lcclaude 1.0.0

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 (1928) hide show
  1. package/.env.example +21 -0
  2. package/README.en.md +333 -0
  3. package/README.md +333 -0
  4. package/bin/lcclaude.js +30 -0
  5. package/dist/preload.js +15 -0
  6. package/dist/runtime/bun-bundle-shim.js +10 -0
  7. package/dist/runtime/bun-wrap-shim.js +63 -0
  8. package/dist/src/QueryEngine.js +804 -0
  9. package/dist/src/Task.js +40 -0
  10. package/dist/src/Tool.js +33 -0
  11. package/dist/src/assistant/sessionHistory.js +39 -0
  12. package/dist/src/bootstrap/state.js +985 -0
  13. package/dist/src/bridge/bridgeApi.js +254 -0
  14. package/dist/src/bridge/bridgeConfig.js +14 -0
  15. package/dist/src/bridge/bridgeDebug.js +64 -0
  16. package/dist/src/bridge/bridgeEnabled.js +55 -0
  17. package/dist/src/bridge/bridgeMain.js +1547 -0
  18. package/dist/src/bridge/bridgeMessaging.js +249 -0
  19. package/dist/src/bridge/bridgePermissionCallbacks.js +7 -0
  20. package/dist/src/bridge/bridgePointer.js +105 -0
  21. package/dist/src/bridge/bridgeStatusUtil.js +81 -0
  22. package/dist/src/bridge/bridgeUI.js +375 -0
  23. package/dist/src/bridge/capacityWake.js +26 -0
  24. package/dist/src/bridge/codeSessionApi.js +78 -0
  25. package/dist/src/bridge/createSession.js +227 -0
  26. package/dist/src/bridge/debugUtils.js +80 -0
  27. package/dist/src/bridge/envLessBridgeConfig.js +61 -0
  28. package/dist/src/bridge/flushGate.js +32 -0
  29. package/dist/src/bridge/inboundAttachments.js +106 -0
  30. package/dist/src/bridge/inboundMessages.js +38 -0
  31. package/dist/src/bridge/initReplBridge.js +276 -0
  32. package/dist/src/bridge/jwtUtils.js +131 -0
  33. package/dist/src/bridge/pollConfig.js +28 -0
  34. package/dist/src/bridge/pollConfigDefaults.js +15 -0
  35. package/dist/src/bridge/remoteBridgeCore.js +511 -0
  36. package/dist/src/bridge/replBridge.js +1098 -0
  37. package/dist/src/bridge/replBridgeHandle.js +14 -0
  38. package/dist/src/bridge/replBridgeTransport.js +147 -0
  39. package/dist/src/bridge/sessionIdCompat.js +16 -0
  40. package/dist/src/bridge/sessionRunner.js +349 -0
  41. package/dist/src/bridge/trustedDevice.js +113 -0
  42. package/dist/src/bridge/types.js +6 -0
  43. package/dist/src/bridge/workSecret.js +51 -0
  44. package/dist/src/buddy/CompanionSprite.js +435 -0
  45. package/dist/src/buddy/companion.js +104 -0
  46. package/dist/src/buddy/prompt.js +31 -0
  47. package/dist/src/buddy/sprites.js +500 -0
  48. package/dist/src/buddy/types.js +85 -0
  49. package/dist/src/buddy/useBuddyNotification.js +93 -0
  50. package/dist/src/cli/exit.js +13 -0
  51. package/dist/src/cli/handlers/agents.js +55 -0
  52. package/dist/src/cli/handlers/auth.js +255 -0
  53. package/dist/src/cli/handlers/autoMode.js +117 -0
  54. package/dist/src/cli/handlers/mcp.js +304 -0
  55. package/dist/src/cli/handlers/plugins.js +538 -0
  56. package/dist/src/cli/handlers/util.js +119 -0
  57. package/dist/src/cli/ndjsonSafeStringify.js +8 -0
  58. package/dist/src/cli/print.js +3112 -0
  59. package/dist/src/cli/remoteIO.js +161 -0
  60. package/dist/src/cli/structuredIO.js +489 -0
  61. package/dist/src/cli/transports/HybridTransport.js +145 -0
  62. package/dist/src/cli/transports/SSETransport.js +403 -0
  63. package/dist/src/cli/transports/SerialBatchEventUploader.js +154 -0
  64. package/dist/src/cli/transports/WebSocketTransport.js +497 -0
  65. package/dist/src/cli/transports/WorkerStateUploader.js +69 -0
  66. package/dist/src/cli/transports/ccrClient.js +522 -0
  67. package/dist/src/cli/transports/transportUtils.js +25 -0
  68. package/dist/src/cli/update.js +361 -0
  69. package/dist/src/commands/add-dir/add-dir.js +140 -0
  70. package/dist/src/commands/add-dir/index.js +8 -0
  71. package/dist/src/commands/add-dir/validation.js +67 -0
  72. package/dist/src/commands/advisor.js +96 -0
  73. package/dist/src/commands/agents/agents.js +12 -0
  74. package/dist/src/commands/agents/index.js +7 -0
  75. package/dist/src/commands/ant-trace/index.js +1 -0
  76. package/dist/src/commands/autofix-pr/index.js +1 -0
  77. package/dist/src/commands/backfill-sessions/index.js +1 -0
  78. package/dist/src/commands/branch/branch.js +168 -0
  79. package/dist/src/commands/branch/index.js +9 -0
  80. package/dist/src/commands/break-cache/index.js +1 -0
  81. package/dist/src/commands/bridge/bridge.js +519 -0
  82. package/dist/src/commands/bridge/index.js +21 -0
  83. package/dist/src/commands/bridge-kick.js +145 -0
  84. package/dist/src/commands/brief.js +66 -0
  85. package/dist/src/commands/btw/btw.js +281 -0
  86. package/dist/src/commands/btw/index.js +9 -0
  87. package/dist/src/commands/bughunter/index.js +1 -0
  88. package/dist/src/commands/chrome/chrome.js +394 -0
  89. package/dist/src/commands/chrome/index.js +10 -0
  90. package/dist/src/commands/clear/caches.js +69 -0
  91. package/dist/src/commands/clear/clear.js +5 -0
  92. package/dist/src/commands/clear/conversation.js +156 -0
  93. package/dist/src/commands/clear/index.js +9 -0
  94. package/dist/src/commands/color/color.js +57 -0
  95. package/dist/src/commands/color/index.js +9 -0
  96. package/dist/src/commands/commit-push-pr.js +145 -0
  97. package/dist/src/commands/commit.js +83 -0
  98. package/dist/src/commands/compact/compact.js +161 -0
  99. package/dist/src/commands/compact/index.js +11 -0
  100. package/dist/src/commands/config/config.js +9 -0
  101. package/dist/src/commands/config/index.js +8 -0
  102. package/dist/src/commands/context/context-noninteractive.js +256 -0
  103. package/dist/src/commands/context/context.js +33 -0
  104. package/dist/src/commands/context/index.js +21 -0
  105. package/dist/src/commands/copy/copy.js +397 -0
  106. package/dist/src/commands/copy/index.js +7 -0
  107. package/dist/src/commands/cost/cost.js +21 -0
  108. package/dist/src/commands/cost/index.js +15 -0
  109. package/dist/src/commands/createMovedToPluginCommand.js +40 -0
  110. package/dist/src/commands/ctx_viz/index.js +1 -0
  111. package/dist/src/commands/debug-tool-call/index.js +1 -0
  112. package/dist/src/commands/desktop/desktop.js +7 -0
  113. package/dist/src/commands/desktop/index.js +22 -0
  114. package/dist/src/commands/diff/diff.js +10 -0
  115. package/dist/src/commands/diff/index.js +6 -0
  116. package/dist/src/commands/doctor/doctor.js +7 -0
  117. package/dist/src/commands/doctor/index.js +9 -0
  118. package/dist/src/commands/effort/effort.js +181 -0
  119. package/dist/src/commands/effort/index.js +11 -0
  120. package/dist/src/commands/env/index.js +1 -0
  121. package/dist/src/commands/exit/exit.js +25 -0
  122. package/dist/src/commands/exit/index.js +9 -0
  123. package/dist/src/commands/export/export.js +79 -0
  124. package/dist/src/commands/export/index.js +8 -0
  125. package/dist/src/commands/extra-usage/extra-usage-core.js +85 -0
  126. package/dist/src/commands/extra-usage/extra-usage-noninteractive.js +11 -0
  127. package/dist/src/commands/extra-usage/extra-usage.js +17 -0
  128. package/dist/src/commands/extra-usage/index.js +27 -0
  129. package/dist/src/commands/fast/fast.js +345 -0
  130. package/dist/src/commands/fast/index.js +23 -0
  131. package/dist/src/commands/feedback/feedback.js +15 -0
  132. package/dist/src/commands/feedback/index.js +13 -0
  133. package/dist/src/commands/files/files.js +13 -0
  134. package/dist/src/commands/files/index.js +9 -0
  135. package/dist/src/commands/good-claude/index.js +1 -0
  136. package/dist/src/commands/heapdump/heapdump.js +15 -0
  137. package/dist/src/commands/heapdump/index.js +9 -0
  138. package/dist/src/commands/help/help.js +12 -0
  139. package/dist/src/commands/help/index.js +7 -0
  140. package/dist/src/commands/hooks/hooks.js +14 -0
  141. package/dist/src/commands/hooks/index.js +8 -0
  142. package/dist/src/commands/ide/ide.js +702 -0
  143. package/dist/src/commands/ide/index.js +8 -0
  144. package/dist/src/commands/init-verifiers.js +258 -0
  145. package/dist/src/commands/init.js +240 -0
  146. package/dist/src/commands/insights.js +2212 -0
  147. package/dist/src/commands/install-github-app/ApiKeyStep.js +290 -0
  148. package/dist/src/commands/install-github-app/CheckExistingSecretStep.js +265 -0
  149. package/dist/src/commands/install-github-app/CheckGitHubStep.js +16 -0
  150. package/dist/src/commands/install-github-app/ChooseRepoStep.js +282 -0
  151. package/dist/src/commands/install-github-app/CreatingStep.js +87 -0
  152. package/dist/src/commands/install-github-app/ErrorStep.js +157 -0
  153. package/dist/src/commands/install-github-app/ExistingWorkflowStep.js +164 -0
  154. package/dist/src/commands/install-github-app/InstallAppStep.js +166 -0
  155. package/dist/src/commands/install-github-app/OAuthFlowStep.js +335 -0
  156. package/dist/src/commands/install-github-app/SuccessStep.js +173 -0
  157. package/dist/src/commands/install-github-app/WarningsStep.js +140 -0
  158. package/dist/src/commands/install-github-app/index.js +10 -0
  159. package/dist/src/commands/install-github-app/install-github-app.js +612 -0
  160. package/dist/src/commands/install-github-app/setupGitHubActions.js +223 -0
  161. package/dist/src/commands/install-slack-app/index.js +9 -0
  162. package/dist/src/commands/install-slack-app/install-slack-app.js +23 -0
  163. package/dist/src/commands/install.js +348 -0
  164. package/dist/src/commands/issue/index.js +1 -0
  165. package/dist/src/commands/keybindings/index.js +10 -0
  166. package/dist/src/commands/keybindings/keybindings.js +43 -0
  167. package/dist/src/commands/login/index.js +9 -0
  168. package/dist/src/commands/login/login.js +105 -0
  169. package/dist/src/commands/logout/index.js +8 -0
  170. package/dist/src/commands/logout/logout.js +68 -0
  171. package/dist/src/commands/mcp/addCommand.js +157 -0
  172. package/dist/src/commands/mcp/index.js +9 -0
  173. package/dist/src/commands/mcp/mcp.js +85 -0
  174. package/dist/src/commands/mcp/xaaIdpCommand.js +135 -0
  175. package/dist/src/commands/memory/index.js +7 -0
  176. package/dist/src/commands/memory/memory.js +95 -0
  177. package/dist/src/commands/mobile/index.js +8 -0
  178. package/dist/src/commands/mobile/mobile.js +324 -0
  179. package/dist/src/commands/mock-limits/index.js +1 -0
  180. package/dist/src/commands/model/index.js +14 -0
  181. package/dist/src/commands/model/model.js +289 -0
  182. package/dist/src/commands/oauth-refresh/index.js +1 -0
  183. package/dist/src/commands/onboarding/index.js +1 -0
  184. package/dist/src/commands/output-style/index.js +8 -0
  185. package/dist/src/commands/output-style/output-style.js +5 -0
  186. package/dist/src/commands/passes/index.js +20 -0
  187. package/dist/src/commands/passes/passes.js +23 -0
  188. package/dist/src/commands/perf-issue/index.js +1 -0
  189. package/dist/src/commands/permissions/index.js +8 -0
  190. package/dist/src/commands/permissions/permissions.js +11 -0
  191. package/dist/src/commands/plan/index.js +8 -0
  192. package/dist/src/commands/plan/plan.js +151 -0
  193. package/dist/src/commands/plugin/AddMarketplace.js +202 -0
  194. package/dist/src/commands/plugin/BrowseMarketplace.js +918 -0
  195. package/dist/src/commands/plugin/DiscoverPlugins.js +935 -0
  196. package/dist/src/commands/plugin/ManageMarketplaces.js +1018 -0
  197. package/dist/src/commands/plugin/ManagePlugins.js +2230 -0
  198. package/dist/src/commands/plugin/PluginErrors.js +118 -0
  199. package/dist/src/commands/plugin/PluginOptionsDialog.js +396 -0
  200. package/dist/src/commands/plugin/PluginOptionsFlow.js +80 -0
  201. package/dist/src/commands/plugin/PluginSettings.js +1313 -0
  202. package/dist/src/commands/plugin/PluginTrustWarning.js +50 -0
  203. package/dist/src/commands/plugin/UnifiedInstalledCell.js +749 -0
  204. package/dist/src/commands/plugin/ValidatePlugin.js +113 -0
  205. package/dist/src/commands/plugin/index.js +9 -0
  206. package/dist/src/commands/plugin/parseArgs.js +61 -0
  207. package/dist/src/commands/plugin/plugin.js +8 -0
  208. package/dist/src/commands/plugin/pluginDetailsHelpers.js +114 -0
  209. package/dist/src/commands/plugin/usePagination.js +75 -0
  210. package/dist/src/commands/pr_comments/index.js +49 -0
  211. package/dist/src/commands/privacy-settings/index.js +11 -0
  212. package/dist/src/commands/privacy-settings/privacy-settings.js +58 -0
  213. package/dist/src/commands/rate-limit-options/index.js +15 -0
  214. package/dist/src/commands/rate-limit-options/rate-limit-options.js +211 -0
  215. package/dist/src/commands/release-notes/index.js +8 -0
  216. package/dist/src/commands/release-notes/release-notes.js +38 -0
  217. package/dist/src/commands/reload-plugins/index.js +8 -0
  218. package/dist/src/commands/reload-plugins/reload-plugins.js +27 -0
  219. package/dist/src/commands/remote-env/index.js +12 -0
  220. package/dist/src/commands/remote-env/remote-env.js +7 -0
  221. package/dist/src/commands/remote-setup/api.js +121 -0
  222. package/dist/src/commands/remote-setup/index.js +14 -0
  223. package/dist/src/commands/remote-setup/remote-setup.js +173 -0
  224. package/dist/src/commands/rename/generateSessionName.js +51 -0
  225. package/dist/src/commands/rename/index.js +9 -0
  226. package/dist/src/commands/rename/rename.js +52 -0
  227. package/dist/src/commands/reset-limits/index.js +4 -0
  228. package/dist/src/commands/resume/index.js +9 -0
  229. package/dist/src/commands/resume/resume.js +281 -0
  230. package/dist/src/commands/review/UltrareviewOverageDialog.js +112 -0
  231. package/dist/src/commands/review/reviewRemote.js +193 -0
  232. package/dist/src/commands/review/ultrareviewCommand.js +50 -0
  233. package/dist/src/commands/review/ultrareviewEnabled.js +5 -0
  234. package/dist/src/commands/review.js +45 -0
  235. package/dist/src/commands/rewind/index.js +10 -0
  236. package/dist/src/commands/rewind/rewind.js +6 -0
  237. package/dist/src/commands/sandbox-toggle/index.js +35 -0
  238. package/dist/src/commands/sandbox-toggle/sandbox-toggle.js +61 -0
  239. package/dist/src/commands/security-review.js +228 -0
  240. package/dist/src/commands/session/index.js +13 -0
  241. package/dist/src/commands/session/session.js +185 -0
  242. package/dist/src/commands/share/index.js +1 -0
  243. package/dist/src/commands/skills/index.js +7 -0
  244. package/dist/src/commands/skills/skills.js +8 -0
  245. package/dist/src/commands/stats/index.js +7 -0
  246. package/dist/src/commands/stats/stats.js +7 -0
  247. package/dist/src/commands/status/index.js +8 -0
  248. package/dist/src/commands/status/status.js +9 -0
  249. package/dist/src/commands/statusline.js +20 -0
  250. package/dist/src/commands/stickers/index.js +8 -0
  251. package/dist/src/commands/stickers/stickers.js +13 -0
  252. package/dist/src/commands/summary/index.js +1 -0
  253. package/dist/src/commands/tag/index.js +9 -0
  254. package/dist/src/commands/tag/tag.js +250 -0
  255. package/dist/src/commands/tasks/index.js +8 -0
  256. package/dist/src/commands/tasks/tasks.js +8 -0
  257. package/dist/src/commands/teleport/index.js +1 -0
  258. package/dist/src/commands/terminalSetup/index.js +15 -0
  259. package/dist/src/commands/terminalSetup/terminalSetup.js +425 -0
  260. package/dist/src/commands/theme/index.js +7 -0
  261. package/dist/src/commands/theme/theme.js +58 -0
  262. package/dist/src/commands/thinkback/index.js +9 -0
  263. package/dist/src/commands/thinkback/thinkback.js +569 -0
  264. package/dist/src/commands/thinkback-play/index.js +11 -0
  265. package/dist/src/commands/thinkback-play/thinkback-play.js +31 -0
  266. package/dist/src/commands/ultraplan.js +361 -0
  267. package/dist/src/commands/upgrade/index.js +11 -0
  268. package/dist/src/commands/upgrade/upgrade.js +37 -0
  269. package/dist/src/commands/usage/index.js +7 -0
  270. package/dist/src/commands/usage/usage.js +9 -0
  271. package/dist/src/commands/version.js +15 -0
  272. package/dist/src/commands/vim/index.js +8 -0
  273. package/dist/src/commands/vim/vim.js +24 -0
  274. package/dist/src/commands/voice/index.js +17 -0
  275. package/dist/src/commands/voice/voice.js +117 -0
  276. package/dist/src/commands.js +476 -0
  277. package/dist/src/components/AgentProgressLine.js +202 -0
  278. package/dist/src/components/App.js +53 -0
  279. package/dist/src/components/ApproveApiKey.js +156 -0
  280. package/dist/src/components/AutoModeOptInDialog.js +154 -0
  281. package/dist/src/components/AutoUpdater.js +178 -0
  282. package/dist/src/components/AutoUpdaterWrapper.js +91 -0
  283. package/dist/src/components/AwsAuthStatusBox.js +119 -0
  284. package/dist/src/components/BaseTextInput.js +158 -0
  285. package/dist/src/components/BashModeProgress.js +65 -0
  286. package/dist/src/components/BridgeDialog.js +460 -0
  287. package/dist/src/components/BypassPermissionsModeDialog.js +111 -0
  288. package/dist/src/components/ChannelDowngradeDialog.js +114 -0
  289. package/dist/src/components/ClaudeCodeHint/PluginHintMenu.js +120 -0
  290. package/dist/src/components/ClaudeInChromeOnboarding.js +176 -0
  291. package/dist/src/components/ClaudeMdExternalIncludesDialog.js +172 -0
  292. package/dist/src/components/ClickableImageRef.js +74 -0
  293. package/dist/src/components/CompactSummary.js +220 -0
  294. package/dist/src/components/ConfigurableShortcutHint.js +33 -0
  295. package/dist/src/components/ConsoleOAuthFlow.js +841 -0
  296. package/dist/src/components/ContextSuggestions.js +85 -0
  297. package/dist/src/components/ContextVisualization.js +878 -0
  298. package/dist/src/components/CoordinatorAgentStatus.js +304 -0
  299. package/dist/src/components/CostThresholdDialog.js +66 -0
  300. package/dist/src/components/CtrlOToExpand.js +56 -0
  301. package/dist/src/components/CustomSelect/SelectMulti.js +246 -0
  302. package/dist/src/components/CustomSelect/index.js +2 -0
  303. package/dist/src/components/CustomSelect/option-map.js +32 -0
  304. package/dist/src/components/CustomSelect/select-input-option.js +558 -0
  305. package/dist/src/components/CustomSelect/select-option.js +39 -0
  306. package/dist/src/components/CustomSelect/select.js +803 -0
  307. package/dist/src/components/CustomSelect/use-multi-select-state.js +175 -0
  308. package/dist/src/components/CustomSelect/use-select-input.js +163 -0
  309. package/dist/src/components/CustomSelect/use-select-navigation.js +334 -0
  310. package/dist/src/components/CustomSelect/use-select-state.js +30 -0
  311. package/dist/src/components/DesktopHandoff.js +214 -0
  312. package/dist/src/components/DesktopUpsell/DesktopUpsellStartup.js +185 -0
  313. package/dist/src/components/DevBar.js +53 -0
  314. package/dist/src/components/DevChannelsDialog.js +128 -0
  315. package/dist/src/components/DiagnosticsDisplay.js +149 -0
  316. package/dist/src/components/EffortCallout.js +302 -0
  317. package/dist/src/components/EffortIndicator.js +30 -0
  318. package/dist/src/components/ExitFlow.js +45 -0
  319. package/dist/src/components/ExportDialog.js +160 -0
  320. package/dist/src/components/FallbackToolUseErrorMessage.js +149 -0
  321. package/dist/src/components/FallbackToolUseRejectedMessage.js +18 -0
  322. package/dist/src/components/FastIcon.js +49 -0
  323. package/dist/src/components/Feedback.js +589 -0
  324. package/dist/src/components/FeedbackSurvey/FeedbackSurvey.js +219 -0
  325. package/dist/src/components/FeedbackSurvey/FeedbackSurveyView.js +168 -0
  326. package/dist/src/components/FeedbackSurvey/TranscriptSharePrompt.js +147 -0
  327. package/dist/src/components/FeedbackSurvey/submitTranscriptShare.js +70 -0
  328. package/dist/src/components/FeedbackSurvey/useDebouncedDigitInput.js +45 -0
  329. package/dist/src/components/FeedbackSurvey/useFeedbackSurvey.js +242 -0
  330. package/dist/src/components/FeedbackSurvey/useMemorySurvey.js +188 -0
  331. package/dist/src/components/FeedbackSurvey/usePostCompactSurvey.js +200 -0
  332. package/dist/src/components/FeedbackSurvey/useSurveyState.js +81 -0
  333. package/dist/src/components/FileEditToolDiff.js +193 -0
  334. package/dist/src/components/FileEditToolUpdatedMessage.js +162 -0
  335. package/dist/src/components/FileEditToolUseRejectedMessage.js +215 -0
  336. package/dist/src/components/FilePathLink.js +33 -0
  337. package/dist/src/components/FullscreenLayout.js +592 -0
  338. package/dist/src/components/GlobalSearchDialog.js +371 -0
  339. package/dist/src/components/HelpV2/Commands.js +99 -0
  340. package/dist/src/components/HelpV2/General.js +48 -0
  341. package/dist/src/components/HelpV2/HelpV2.js +231 -0
  342. package/dist/src/components/HighlightedCode/Fallback.js +200 -0
  343. package/dist/src/components/HighlightedCode.js +219 -0
  344. package/dist/src/components/HistorySearchDialog.js +144 -0
  345. package/dist/src/components/IdeAutoConnectDialog.js +172 -0
  346. package/dist/src/components/IdeOnboardingDialog.js +249 -0
  347. package/dist/src/components/IdeStatusIndicator.js +68 -0
  348. package/dist/src/components/IdleReturnDialog.js +126 -0
  349. package/dist/src/components/InterruptedByUser.js +25 -0
  350. package/dist/src/components/InvalidConfigDialog.js +173 -0
  351. package/dist/src/components/InvalidSettingsDialog.js +94 -0
  352. package/dist/src/components/KeybindingWarnings.js +144 -0
  353. package/dist/src/components/LanguagePicker.js +112 -0
  354. package/dist/src/components/LogSelector.js +1775 -0
  355. package/dist/src/components/LogoV2/AnimatedAsterisk.js +49 -0
  356. package/dist/src/components/LogoV2/AnimatedClawd.js +105 -0
  357. package/dist/src/components/LogoV2/ChannelsNotice.js +334 -0
  358. package/dist/src/components/LogoV2/Clawd.js +285 -0
  359. package/dist/src/components/LogoV2/CondensedLogo.js +218 -0
  360. package/dist/src/components/LogoV2/EmergencyTip.js +47 -0
  361. package/dist/src/components/LogoV2/Feed.js +140 -0
  362. package/dist/src/components/LogoV2/FeedColumn.js +67 -0
  363. package/dist/src/components/LogoV2/GuestPassesUpsell.js +90 -0
  364. package/dist/src/components/LogoV2/LogoV2.js +774 -0
  365. package/dist/src/components/LogoV2/Opus1mMergeNotice.js +68 -0
  366. package/dist/src/components/LogoV2/OverageCreditUpsell.js +154 -0
  367. package/dist/src/components/LogoV2/VoiceModeNotice.js +75 -0
  368. package/dist/src/components/LogoV2/WelcomeV2.js +976 -0
  369. package/dist/src/components/LogoV2/feedConfigs.js +89 -0
  370. package/dist/src/components/LspRecommendation/LspRecommendationMenu.js +128 -0
  371. package/dist/src/components/MCPServerApprovalDialog.js +121 -0
  372. package/dist/src/components/MCPServerDesktopImportDialog.js +249 -0
  373. package/dist/src/components/MCPServerDialogCopy.js +24 -0
  374. package/dist/src/components/MCPServerMultiselectDialog.js +173 -0
  375. package/dist/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +199 -0
  376. package/dist/src/components/ManagedSettingsSecurityDialog/utils.js +75 -0
  377. package/dist/src/components/Markdown.js +200 -0
  378. package/dist/src/components/MarkdownTable.js +215 -0
  379. package/dist/src/components/MemoryUsageIndicator.js +33 -0
  380. package/dist/src/components/Message.js +638 -0
  381. package/dist/src/components/MessageModel.js +43 -0
  382. package/dist/src/components/MessageResponse.js +99 -0
  383. package/dist/src/components/MessageRow.js +350 -0
  384. package/dist/src/components/MessageSelector.js +1021 -0
  385. package/dist/src/components/MessageTimestamp.js +63 -0
  386. package/dist/src/components/Messages.js +576 -0
  387. package/dist/src/components/ModelPicker.js +582 -0
  388. package/dist/src/components/NativeAutoUpdater.js +169 -0
  389. package/dist/src/components/NotebookEditToolUseRejectedMessage.js +123 -0
  390. package/dist/src/components/OffscreenFreeze.js +21 -0
  391. package/dist/src/components/Onboarding.js +307 -0
  392. package/dist/src/components/OutputStylePicker.js +128 -0
  393. package/dist/src/components/PackageManagerAutoUpdater.js +116 -0
  394. package/dist/src/components/Passes/Passes.js +242 -0
  395. package/dist/src/components/PrBadge.js +119 -0
  396. package/dist/src/components/PressEnterToContinue.js +24 -0
  397. package/dist/src/components/PromptInput/HistorySearchInput.js +64 -0
  398. package/dist/src/components/PromptInput/IssueFlagBanner.js +6 -0
  399. package/dist/src/components/PromptInput/Notifications.js +343 -0
  400. package/dist/src/components/PromptInput/PromptInput.js +1837 -0
  401. package/dist/src/components/PromptInput/PromptInputFooter.js +192 -0
  402. package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +504 -0
  403. package/dist/src/components/PromptInput/PromptInputFooterSuggestions.js +296 -0
  404. package/dist/src/components/PromptInput/PromptInputHelpMenu.js +508 -0
  405. package/dist/src/components/PromptInput/PromptInputModeIndicator.js +92 -0
  406. package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +90 -0
  407. package/dist/src/components/PromptInput/PromptInputStashNotice.js +30 -0
  408. package/dist/src/components/PromptInput/SandboxPromptFooterHint.js +80 -0
  409. package/dist/src/components/PromptInput/ShimmeredInput.js +157 -0
  410. package/dist/src/components/PromptInput/VoiceIndicator.js +138 -0
  411. package/dist/src/components/PromptInput/inputModes.js +24 -0
  412. package/dist/src/components/PromptInput/inputPaste.js +46 -0
  413. package/dist/src/components/PromptInput/useMaybeTruncateInput.js +36 -0
  414. package/dist/src/components/PromptInput/usePromptInputPlaceholder.js +39 -0
  415. package/dist/src/components/PromptInput/useShowFastIconHint.js +19 -0
  416. package/dist/src/components/PromptInput/useSwarmBanner.js +99 -0
  417. package/dist/src/components/PromptInput/utils.js +25 -0
  418. package/dist/src/components/QuickOpenDialog.js +272 -0
  419. package/dist/src/components/RemoteCallout.js +81 -0
  420. package/dist/src/components/RemoteEnvironmentDialog.js +451 -0
  421. package/dist/src/components/ResumeTask.js +361 -0
  422. package/dist/src/components/SandboxViolationExpandedView.js +134 -0
  423. package/dist/src/components/ScrollKeybindingHandler.js +589 -0
  424. package/dist/src/components/SearchBox.js +111 -0
  425. package/dist/src/components/SentryErrorBoundary.js +17 -0
  426. package/dist/src/components/SessionBackgroundHint.js +103 -0
  427. package/dist/src/components/SessionPreview.js +263 -0
  428. package/dist/src/components/Settings/Config.js +1776 -0
  429. package/dist/src/components/Settings/Settings.js +159 -0
  430. package/dist/src/components/Settings/Status.js +315 -0
  431. package/dist/src/components/Settings/Usage.js +503 -0
  432. package/dist/src/components/ShowInIDEPrompt.js +212 -0
  433. package/dist/src/components/SkillImprovementSurvey.js +204 -0
  434. package/dist/src/components/Spinner/FlashingChar.js +60 -0
  435. package/dist/src/components/Spinner/GlimmerMessage.js +391 -0
  436. package/dist/src/components/Spinner/ShimmerChar.js +30 -0
  437. package/dist/src/components/Spinner/SpinnerAnimationRow.js +248 -0
  438. package/dist/src/components/Spinner/SpinnerGlyph.js +105 -0
  439. package/dist/src/components/Spinner/TeammateSpinnerLine.js +243 -0
  440. package/dist/src/components/Spinner/TeammateSpinnerTree.js +360 -0
  441. package/dist/src/components/Spinner/index.js +7 -0
  442. package/dist/src/components/Spinner/teammateSelectHint.js +1 -0
  443. package/dist/src/components/Spinner/useShimmerAnimation.js +17 -0
  444. package/dist/src/components/Spinner/useStalledAnimation.js +47 -0
  445. package/dist/src/components/Spinner/utils.js +65 -0
  446. package/dist/src/components/Spinner.js +596 -0
  447. package/dist/src/components/Stats.js +1415 -0
  448. package/dist/src/components/StatusLine.js +264 -0
  449. package/dist/src/components/StatusNotices.js +50 -0
  450. package/dist/src/components/StructuredDiff/Fallback.js +379 -0
  451. package/dist/src/components/StructuredDiff/colorDiff.js +21 -0
  452. package/dist/src/components/StructuredDiff.js +170 -0
  453. package/dist/src/components/StructuredDiffList.js +30 -0
  454. package/dist/src/components/TagTabs.js +124 -0
  455. package/dist/src/components/TaskListV2.js +430 -0
  456. package/dist/src/components/TeammateViewHeader.js +112 -0
  457. package/dist/src/components/TeleportError.js +200 -0
  458. package/dist/src/components/TeleportProgress.js +175 -0
  459. package/dist/src/components/TeleportRepoMismatchDialog.js +160 -0
  460. package/dist/src/components/TeleportResumeWrapper.js +207 -0
  461. package/dist/src/components/TeleportStash.js +159 -0
  462. package/dist/src/components/TextInput.js +94 -0
  463. package/dist/src/components/ThemePicker.js +428 -0
  464. package/dist/src/components/ThinkingToggle.js +233 -0
  465. package/dist/src/components/TokenWarning.js +165 -0
  466. package/dist/src/components/ToolUseLoader.js +44 -0
  467. package/dist/src/components/TrustDialog/TrustDialog.js +337 -0
  468. package/dist/src/components/TrustDialog/utils.js +149 -0
  469. package/dist/src/components/ValidationErrorsList.js +169 -0
  470. package/dist/src/components/VimTextInput.js +142 -0
  471. package/dist/src/components/VirtualMessageList.js +745 -0
  472. package/dist/src/components/WorkflowMultiselectDialog.js +173 -0
  473. package/dist/src/components/WorktreeExitDialog.js +228 -0
  474. package/dist/src/components/agents/AgentDetail.js +371 -0
  475. package/dist/src/components/agents/AgentEditor.js +191 -0
  476. package/dist/src/components/agents/AgentNavigationFooter.js +28 -0
  477. package/dist/src/components/agents/AgentsList.js +623 -0
  478. package/dist/src/components/agents/AgentsMenu.js +897 -0
  479. package/dist/src/components/agents/ColorPicker.js +170 -0
  480. package/dist/src/components/agents/ModelSelector.js +79 -0
  481. package/dist/src/components/agents/ToolSelector.js +581 -0
  482. package/dist/src/components/agents/agentFileUtils.js +142 -0
  483. package/dist/src/components/agents/generateAgent.js +160 -0
  484. package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +101 -0
  485. package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +108 -0
  486. package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +551 -0
  487. package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +73 -0
  488. package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +176 -0
  489. package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +176 -0
  490. package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +104 -0
  491. package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +136 -0
  492. package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +105 -0
  493. package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +75 -0
  494. package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +185 -0
  495. package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +81 -0
  496. package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +146 -0
  497. package/dist/src/components/agents/types.js +4 -0
  498. package/dist/src/components/agents/utils.js +14 -0
  499. package/dist/src/components/agents/validateAgent.js +66 -0
  500. package/dist/src/components/design-system/Byline.js +53 -0
  501. package/dist/src/components/design-system/Dialog.js +171 -0
  502. package/dist/src/components/design-system/Divider.js +107 -0
  503. package/dist/src/components/design-system/FuzzyPicker.js +316 -0
  504. package/dist/src/components/design-system/KeyboardShortcutHint.js +63 -0
  505. package/dist/src/components/design-system/ListItem.js +186 -0
  506. package/dist/src/components/design-system/LoadingState.js +72 -0
  507. package/dist/src/components/design-system/Pane.js +67 -0
  508. package/dist/src/components/design-system/ProgressBar.js +67 -0
  509. package/dist/src/components/design-system/Ratchet.js +83 -0
  510. package/dist/src/components/design-system/StatusIcon.js +60 -0
  511. package/dist/src/components/design-system/Tabs.js +332 -0
  512. package/dist/src/components/design-system/ThemeProvider.js +117 -0
  513. package/dist/src/components/design-system/ThemedBox.js +123 -0
  514. package/dist/src/components/design-system/ThemedText.js +68 -0
  515. package/dist/src/components/design-system/color.js +13 -0
  516. package/dist/src/components/diff/DiffDetailView.js +388 -0
  517. package/dist/src/components/diff/DiffDialog.js +489 -0
  518. package/dist/src/components/diff/DiffFileList.js +359 -0
  519. package/dist/src/components/grove/Grove.js +710 -0
  520. package/dist/src/components/hooks/HooksConfigMenu.js +626 -0
  521. package/dist/src/components/hooks/PromptDialog.js +96 -0
  522. package/dist/src/components/hooks/SelectEventMode.js +169 -0
  523. package/dist/src/components/hooks/SelectHookMode.js +127 -0
  524. package/dist/src/components/hooks/SelectMatcherMode.js +156 -0
  525. package/dist/src/components/hooks/ViewHookMode.js +275 -0
  526. package/dist/src/components/mcp/CapabilitiesSection.js +68 -0
  527. package/dist/src/components/mcp/ElicitationDialog.js +1330 -0
  528. package/dist/src/components/mcp/MCPAgentServerMenu.js +275 -0
  529. package/dist/src/components/mcp/MCPListPanel.js +671 -0
  530. package/dist/src/components/mcp/MCPReconnect.js +210 -0
  531. package/dist/src/components/mcp/MCPRemoteServerMenu.js +906 -0
  532. package/dist/src/components/mcp/MCPSettings.js +415 -0
  533. package/dist/src/components/mcp/MCPStdioServerMenu.js +276 -0
  534. package/dist/src/components/mcp/MCPToolDetailView.js +316 -0
  535. package/dist/src/components/mcp/MCPToolListView.js +169 -0
  536. package/dist/src/components/mcp/McpParsingWarnings.js +319 -0
  537. package/dist/src/components/mcp/index.js +8 -0
  538. package/dist/src/components/mcp/utils/reconnectHelpers.js +28 -0
  539. package/dist/src/components/memory/MemoryFileSelector.js +459 -0
  540. package/dist/src/components/memory/MemoryUpdateNotification.js +51 -0
  541. package/dist/src/components/messageActions.js +464 -0
  542. package/dist/src/components/messages/AdvisorMessage.js +202 -0
  543. package/dist/src/components/messages/AssistantRedactedThinkingMessage.js +34 -0
  544. package/dist/src/components/messages/AssistantTextMessage.js +373 -0
  545. package/dist/src/components/messages/AssistantThinkingMessage.js +105 -0
  546. package/dist/src/components/messages/AssistantToolUseMessage.js +414 -0
  547. package/dist/src/components/messages/AttachmentMessage.js +764 -0
  548. package/dist/src/components/messages/CollapsedReadSearchContent.js +651 -0
  549. package/dist/src/components/messages/CompactBoundaryMessage.js +27 -0
  550. package/dist/src/components/messages/GroupedToolUseContent.js +42 -0
  551. package/dist/src/components/messages/HighlightedThinkingText.js +215 -0
  552. package/dist/src/components/messages/HookProgressMessage.js +150 -0
  553. package/dist/src/components/messages/PlanApprovalMessage.js +294 -0
  554. package/dist/src/components/messages/RateLimitMessage.js +164 -0
  555. package/dist/src/components/messages/ShutdownMessage.js +180 -0
  556. package/dist/src/components/messages/SystemAPIErrorMessage.js +162 -0
  557. package/dist/src/components/messages/SystemTextMessage.js +1145 -0
  558. package/dist/src/components/messages/TaskAssignmentMessage.js +100 -0
  559. package/dist/src/components/messages/UserAgentNotificationMessage.js +89 -0
  560. package/dist/src/components/messages/UserBashInputMessage.js +67 -0
  561. package/dist/src/components/messages/UserBashOutputMessage.js +56 -0
  562. package/dist/src/components/messages/UserChannelMessage.js +145 -0
  563. package/dist/src/components/messages/UserCommandMessage.js +146 -0
  564. package/dist/src/components/messages/UserImageMessage.js +59 -0
  565. package/dist/src/components/messages/UserLocalCommandOutputMessage.js +226 -0
  566. package/dist/src/components/messages/UserMemoryInputMessage.js +101 -0
  567. package/dist/src/components/messages/UserPlanMessage.js +56 -0
  568. package/dist/src/components/messages/UserPromptMessage.js +54 -0
  569. package/dist/src/components/messages/UserResourceUpdateMessage.js +131 -0
  570. package/dist/src/components/messages/UserTeammateMessage.js +215 -0
  571. package/dist/src/components/messages/UserTextMessage.js +207 -0
  572. package/dist/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +46 -0
  573. package/dist/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +21 -0
  574. package/dist/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +18 -0
  575. package/dist/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +90 -0
  576. package/dist/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +80 -0
  577. package/dist/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +116 -0
  578. package/dist/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +73 -0
  579. package/dist/src/components/messages/UserToolResultMessage/utils.js +41 -0
  580. package/dist/src/components/messages/nullRenderingAttachments.js +40 -0
  581. package/dist/src/components/messages/teamMemCollapsed.js +160 -0
  582. package/dist/src/components/messages/teamMemSaved.js +9 -0
  583. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +696 -0
  584. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +263 -0
  585. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +384 -0
  586. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +228 -0
  587. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +611 -0
  588. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +218 -0
  589. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +98 -0
  590. package/dist/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +458 -0
  591. package/dist/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +90 -0
  592. package/dist/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +567 -0
  593. package/dist/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +175 -0
  594. package/dist/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +728 -0
  595. package/dist/src/components/permissions/FallbackPermissionRequest.js +385 -0
  596. package/dist/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +205 -0
  597. package/dist/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +188 -0
  598. package/dist/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +13 -0
  599. package/dist/src/components/permissions/FilePermissionDialog/permissionOptions.js +159 -0
  600. package/dist/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +129 -0
  601. package/dist/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +100 -0
  602. package/dist/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +186 -0
  603. package/dist/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +110 -0
  604. package/dist/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +143 -0
  605. package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +194 -0
  606. package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +278 -0
  607. package/dist/src/components/permissions/PermissionDecisionDebugInfo.js +709 -0
  608. package/dist/src/components/permissions/PermissionDialog.js +90 -0
  609. package/dist/src/components/permissions/PermissionExplanation.js +298 -0
  610. package/dist/src/components/permissions/PermissionPrompt.js +327 -0
  611. package/dist/src/components/permissions/PermissionRequest.js +164 -0
  612. package/dist/src/components/permissions/PermissionRequestTitle.js +85 -0
  613. package/dist/src/components/permissions/PermissionRuleExplanation.js +112 -0
  614. package/dist/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +263 -0
  615. package/dist/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +70 -0
  616. package/dist/src/components/permissions/SandboxPermissionRequest.js +205 -0
  617. package/dist/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +259 -0
  618. package/dist/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +424 -0
  619. package/dist/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +299 -0
  620. package/dist/src/components/permissions/WorkerBadge.js +56 -0
  621. package/dist/src/components/permissions/WorkerPendingPermission.js +158 -0
  622. package/dist/src/components/permissions/hooks.js +128 -0
  623. package/dist/src/components/permissions/rules/AddPermissionRules.js +203 -0
  624. package/dist/src/components/permissions/rules/AddWorkspaceDirectory.js +437 -0
  625. package/dist/src/components/permissions/rules/PermissionRuleDescription.js +101 -0
  626. package/dist/src/components/permissions/rules/PermissionRuleInput.js +208 -0
  627. package/dist/src/components/permissions/rules/PermissionRuleList.js +1382 -0
  628. package/dist/src/components/permissions/rules/RecentDenialsTab.js +229 -0
  629. package/dist/src/components/permissions/rules/RemoveWorkspaceDirectory.js +123 -0
  630. package/dist/src/components/permissions/rules/WorkspaceTab.js +161 -0
  631. package/dist/src/components/permissions/shellPermissionHelpers.js +219 -0
  632. package/dist/src/components/permissions/useShellPermissionFeedback.js +98 -0
  633. package/dist/src/components/permissions/utils.js +18 -0
  634. package/dist/src/components/sandbox/SandboxConfigTab.js +195 -0
  635. package/dist/src/components/sandbox/SandboxDependenciesTab.js +265 -0
  636. package/dist/src/components/sandbox/SandboxDoctorSection.js +80 -0
  637. package/dist/src/components/sandbox/SandboxOverridesTab.js +272 -0
  638. package/dist/src/components/sandbox/SandboxSettings.js +374 -0
  639. package/dist/src/components/shell/ExpandShellOutputContext.js +25 -0
  640. package/dist/src/components/shell/OutputLine.js +107 -0
  641. package/dist/src/components/shell/ShellProgressMessage.js +189 -0
  642. package/dist/src/components/shell/ShellTimeDisplay.js +78 -0
  643. package/dist/src/components/skills/SkillsMenu.js +310 -0
  644. package/dist/src/components/tasks/AsyncAgentDetailDialog.js +353 -0
  645. package/dist/src/components/tasks/BackgroundTask.js +428 -0
  646. package/dist/src/components/tasks/BackgroundTaskStatus.js +522 -0
  647. package/dist/src/components/tasks/BackgroundTasksDialog.js +784 -0
  648. package/dist/src/components/tasks/DreamDetailDialog.js +353 -0
  649. package/dist/src/components/tasks/InProcessTeammateDetailDialog.js +393 -0
  650. package/dist/src/components/tasks/RemoteSessionDetailDialog.js +1188 -0
  651. package/dist/src/components/tasks/RemoteSessionProgress.js +310 -0
  652. package/dist/src/components/tasks/ShellDetailDialog.js +511 -0
  653. package/dist/src/components/tasks/ShellProgress.js +93 -0
  654. package/dist/src/components/tasks/renderToolActivity.js +34 -0
  655. package/dist/src/components/tasks/taskStatusUtils.js +77 -0
  656. package/dist/src/components/teams/TeamStatus.js +95 -0
  657. package/dist/src/components/teams/TeamsDialog.js +734 -0
  658. package/dist/src/components/ui/OrderedList.js +74 -0
  659. package/dist/src/components/ui/OrderedListItem.js +53 -0
  660. package/dist/src/components/ui/TreeSelect.js +307 -0
  661. package/dist/src/components/wizard/WizardDialogLayout.js +71 -0
  662. package/dist/src/components/wizard/WizardNavigationFooter.js +36 -0
  663. package/dist/src/components/wizard/WizardProvider.js +211 -0
  664. package/dist/src/components/wizard/index.js +4 -0
  665. package/dist/src/components/wizard/useWizard.js +9 -0
  666. package/dist/src/constants/apiLimits.js +11 -0
  667. package/dist/src/constants/betas.js +28 -0
  668. package/dist/src/constants/common.js +16 -0
  669. package/dist/src/constants/cyberRiskInstruction.js +1 -0
  670. package/dist/src/constants/errorIds.js +1 -0
  671. package/dist/src/constants/figures.js +31 -0
  672. package/dist/src/constants/files.js +115 -0
  673. package/dist/src/constants/github-app.js +139 -0
  674. package/dist/src/constants/keys.js +4 -0
  675. package/dist/src/constants/messages.js +1 -0
  676. package/dist/src/constants/oauth.js +141 -0
  677. package/dist/src/constants/outputStyles.js +155 -0
  678. package/dist/src/constants/product.js +25 -0
  679. package/dist/src/constants/prompts.js +544 -0
  680. package/dist/src/constants/spinnerVerbs.js +201 -0
  681. package/dist/src/constants/system.js +46 -0
  682. package/dist/src/constants/systemPromptSections.js +27 -0
  683. package/dist/src/constants/toolLimits.js +6 -0
  684. package/dist/src/constants/tools.js +75 -0
  685. package/dist/src/constants/turnCompletionVerbs.js +10 -0
  686. package/dist/src/constants/xml.js +54 -0
  687. package/dist/src/context/QueuedMessageContext.js +57 -0
  688. package/dist/src/context/fpsMetrics.js +26 -0
  689. package/dist/src/context/mailbox.js +37 -0
  690. package/dist/src/context/modalContext.js +26 -0
  691. package/dist/src/context/notifications.js +176 -0
  692. package/dist/src/context/overlayContext.js +92 -0
  693. package/dist/src/context/promptOverlayContext.js +99 -0
  694. package/dist/src/context/stats.js +203 -0
  695. package/dist/src/context/voice.js +62 -0
  696. package/dist/src/context.js +119 -0
  697. package/dist/src/coordinator/coordinatorMode.js +323 -0
  698. package/dist/src/cost-tracker.js +234 -0
  699. package/dist/src/costHook.js +19 -0
  700. package/dist/src/dialogLaunchers.js +92 -0
  701. package/dist/src/entrypoints/agentSdkTypes.js +51 -0
  702. package/dist/src/entrypoints/cli.js +92 -0
  703. package/dist/src/entrypoints/init.js +199 -0
  704. package/dist/src/entrypoints/mcp.js +132 -0
  705. package/dist/src/entrypoints/npm-bin.js +6 -0
  706. package/dist/src/entrypoints/sandboxTypes.js +34 -0
  707. package/dist/src/entrypoints/sdk/controlSchemas.js +347 -0
  708. package/dist/src/entrypoints/sdk/coreSchemas.js +1019 -0
  709. package/dist/src/entrypoints/sdk/coreTypes.generated.js +1 -0
  710. package/dist/src/entrypoints/sdk/coreTypes.js +38 -0
  711. package/dist/src/entrypoints/sdk/runtimeTypes.js +1 -0
  712. package/dist/src/entrypoints/sdk/settingsTypes.generated.js +1 -0
  713. package/dist/src/entrypoints/sdk/toolTypes.js +1 -0
  714. package/dist/src/history.js +297 -0
  715. package/dist/src/hooks/fileSuggestions.js +460 -0
  716. package/dist/src/hooks/notifs/useAutoModeUnavailableNotification.js +39 -0
  717. package/dist/src/hooks/notifs/useCanSwitchToExistingSubscription.js +64 -0
  718. package/dist/src/hooks/notifs/useDeprecationWarningNotification.js +43 -0
  719. package/dist/src/hooks/notifs/useFastModeNotification.js +161 -0
  720. package/dist/src/hooks/notifs/useIDEStatusIndicator.js +187 -0
  721. package/dist/src/hooks/notifs/useInstallMessages.js +25 -0
  722. package/dist/src/hooks/notifs/useLspInitializationNotification.js +147 -0
  723. package/dist/src/hooks/notifs/useMcpConnectivityStatus.js +154 -0
  724. package/dist/src/hooks/notifs/useModelMigrationNotifications.js +45 -0
  725. package/dist/src/hooks/notifs/useNpmDeprecationNotification.js +24 -0
  726. package/dist/src/hooks/notifs/usePluginAutoupdateNotification.js +93 -0
  727. package/dist/src/hooks/notifs/usePluginInstallationStatus.js +143 -0
  728. package/dist/src/hooks/notifs/useRateLimitWarningNotification.js +118 -0
  729. package/dist/src/hooks/notifs/useSettingsErrors.js +67 -0
  730. package/dist/src/hooks/notifs/useStartupNotification.js +24 -0
  731. package/dist/src/hooks/notifs/useTeammateShutdownNotification.js +61 -0
  732. package/dist/src/hooks/renderPlaceholder.js +27 -0
  733. package/dist/src/hooks/toolPermission/PermissionContext.js +186 -0
  734. package/dist/src/hooks/toolPermission/handlers/coordinatorHandler.js +22 -0
  735. package/dist/src/hooks/toolPermission/handlers/interactiveHandler.js +194 -0
  736. package/dist/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +79 -0
  737. package/dist/src/hooks/toolPermission/permissionLogging.js +114 -0
  738. package/dist/src/hooks/unifiedSuggestions.js +115 -0
  739. package/dist/src/hooks/useAfterFirstRender.js +12 -0
  740. package/dist/src/hooks/useApiKeyVerification.js +58 -0
  741. package/dist/src/hooks/useArrowKeyHistory.js +176 -0
  742. package/dist/src/hooks/useAssistantHistory.js +150 -0
  743. package/dist/src/hooks/useAwaySummary.js +95 -0
  744. package/dist/src/hooks/useBackgroundTaskNavigation.js +163 -0
  745. package/dist/src/hooks/useBlink.js +10 -0
  746. package/dist/src/hooks/useCanUseTool.js +144 -0
  747. package/dist/src/hooks/useCancelRequest.js +165 -0
  748. package/dist/src/hooks/useChromeExtensionNotification.js +55 -0
  749. package/dist/src/hooks/useClaudeCodeHintRecommendation.js +113 -0
  750. package/dist/src/hooks/useClipboardImageHint.js +45 -0
  751. package/dist/src/hooks/useCommandKeybindings.js +81 -0
  752. package/dist/src/hooks/useCommandQueue.js +8 -0
  753. package/dist/src/hooks/useCopyOnSelect.js +44 -0
  754. package/dist/src/hooks/useDeferredHookMessages.js +35 -0
  755. package/dist/src/hooks/useDiffData.js +62 -0
  756. package/dist/src/hooks/useDiffInIDE.js +197 -0
  757. package/dist/src/hooks/useDirectConnect.js +154 -0
  758. package/dist/src/hooks/useDoublePress.js +36 -0
  759. package/dist/src/hooks/useDynamicConfig.js +10 -0
  760. package/dist/src/hooks/useElapsedTime.js +12 -0
  761. package/dist/src/hooks/useExitOnCtrlCD.js +27 -0
  762. package/dist/src/hooks/useExitOnCtrlCDWithKeybindings.js +5 -0
  763. package/dist/src/hooks/useFileHistorySnapshotInit.js +17 -0
  764. package/dist/src/hooks/useGlobalKeybindings.js +132 -0
  765. package/dist/src/hooks/useHistorySearch.js +219 -0
  766. package/dist/src/hooks/useIDEIntegration.js +60 -0
  767. package/dist/src/hooks/useIdeAtMentioned.js +42 -0
  768. package/dist/src/hooks/useIdeConnectionStatus.js +18 -0
  769. package/dist/src/hooks/useIdeLogging.js +26 -0
  770. package/dist/src/hooks/useIdeSelection.js +78 -0
  771. package/dist/src/hooks/useInboxPoller.js +626 -0
  772. package/dist/src/hooks/useInputBuffer.js +69 -0
  773. package/dist/src/hooks/useIssueFlagBanner.js +101 -0
  774. package/dist/src/hooks/useLogMessages.js +47 -0
  775. package/dist/src/hooks/useLspPluginRecommendation.js +163 -0
  776. package/dist/src/hooks/useMailboxBridge.js +15 -0
  777. package/dist/src/hooks/useMainLoopModel.js +15 -0
  778. package/dist/src/hooks/useManagePlugins.js +195 -0
  779. package/dist/src/hooks/useMemoryUsage.js +17 -0
  780. package/dist/src/hooks/useMergedClients.js +11 -0
  781. package/dist/src/hooks/useMergedCommands.js +10 -0
  782. package/dist/src/hooks/useMergedTools.js +18 -0
  783. package/dist/src/hooks/useMinDisplayTime.js +19 -0
  784. package/dist/src/hooks/useNotifyAfterTimeout.js +34 -0
  785. package/dist/src/hooks/useOfficialMarketplaceNotification.js +50 -0
  786. package/dist/src/hooks/usePasteHandler.js +129 -0
  787. package/dist/src/hooks/usePluginRecommendationBase.js +98 -0
  788. package/dist/src/hooks/usePrStatus.js +77 -0
  789. package/dist/src/hooks/usePromptSuggestion.js +124 -0
  790. package/dist/src/hooks/usePromptsFromClaudeInChrome.js +60 -0
  791. package/dist/src/hooks/useQueueProcessor.js +29 -0
  792. package/dist/src/hooks/useRemoteSession.js +313 -0
  793. package/dist/src/hooks/useReplBridge.js +59 -0
  794. package/dist/src/hooks/useSSHSession.js +161 -0
  795. package/dist/src/hooks/useScheduledTasks.js +68 -0
  796. package/dist/src/hooks/useSearchInput.js +285 -0
  797. package/dist/src/hooks/useSessionBackgrounding.js +120 -0
  798. package/dist/src/hooks/useSettings.js +4 -0
  799. package/dist/src/hooks/useSettingsChange.js +10 -0
  800. package/dist/src/hooks/useSkillImprovementSurvey.js +61 -0
  801. package/dist/src/hooks/useSkillsChange.js +39 -0
  802. package/dist/src/hooks/useSwarmInitialization.js +39 -0
  803. package/dist/src/hooks/useSwarmPermissionPoller.js +141 -0
  804. package/dist/src/hooks/useTaskListWatcher.js +124 -0
  805. package/dist/src/hooks/useTasksV2.js +161 -0
  806. package/dist/src/hooks/useTeammateViewAutoExit.js +35 -0
  807. package/dist/src/hooks/useTeleportResume.js +75 -0
  808. package/dist/src/hooks/useTerminalSize.js +11 -0
  809. package/dist/src/hooks/useTextInput.js +353 -0
  810. package/dist/src/hooks/useTimeout.js +10 -0
  811. package/dist/src/hooks/useTurnDiffs.js +131 -0
  812. package/dist/src/hooks/useTypeahead.js +993 -0
  813. package/dist/src/hooks/useUpdateNotification.js +21 -0
  814. package/dist/src/hooks/useVimInput.js +210 -0
  815. package/dist/src/hooks/useVirtualScroll.js +282 -0
  816. package/dist/src/hooks/useVoice.js +675 -0
  817. package/dist/src/hooks/useVoiceEnabled.js +12 -0
  818. package/dist/src/hooks/useVoiceIntegration.js +391 -0
  819. package/dist/src/ink/Ansi.js +290 -0
  820. package/dist/src/ink/bidi.js +72 -0
  821. package/dist/src/ink/clearTerminal.js +42 -0
  822. package/dist/src/ink/colorize.js +119 -0
  823. package/dist/src/ink/components/AlternateScreen.js +60 -0
  824. package/dist/src/ink/components/App.js +375 -0
  825. package/dist/src/ink/components/AppContext.js +6 -0
  826. package/dist/src/ink/components/Box.js +181 -0
  827. package/dist/src/ink/components/Button.js +167 -0
  828. package/dist/src/ink/components/ClockContext.js +100 -0
  829. package/dist/src/ink/components/CursorDeclarationContext.js +3 -0
  830. package/dist/src/ink/components/ErrorOverview.js +152 -0
  831. package/dist/src/ink/components/Link.js +42 -0
  832. package/dist/src/ink/components/Newline.js +29 -0
  833. package/dist/src/ink/components/NoSelect.js +40 -0
  834. package/dist/src/ink/components/RawAnsi.js +36 -0
  835. package/dist/src/ink/components/ScrollBox.js +139 -0
  836. package/dist/src/ink/components/Spacer.js +16 -0
  837. package/dist/src/ink/components/StdinContext.js +12 -0
  838. package/dist/src/ink/components/TerminalFocusContext.js +43 -0
  839. package/dist/src/ink/components/TerminalSizeContext.js +2 -0
  840. package/dist/src/ink/components/Text.js +196 -0
  841. package/dist/src/ink/constants.js +1 -0
  842. package/dist/src/ink/dom.js +230 -0
  843. package/dist/src/ink/events/click-event.js +15 -0
  844. package/dist/src/ink/events/dispatcher.js +126 -0
  845. package/dist/src/ink/events/emitter.js +26 -0
  846. package/dist/src/ink/events/event-handlers.js +22 -0
  847. package/dist/src/ink/events/event.js +9 -0
  848. package/dist/src/ink/events/focus-event.js +9 -0
  849. package/dist/src/ink/events/input-event.js +83 -0
  850. package/dist/src/ink/events/keyboard-event.js +31 -0
  851. package/dist/src/ink/events/terminal-event.js +60 -0
  852. package/dist/src/ink/events/terminal-focus-event.js +9 -0
  853. package/dist/src/ink/focus.js +127 -0
  854. package/dist/src/ink/frame.js +22 -0
  855. package/dist/src/ink/get-max-width.js +5 -0
  856. package/dist/src/ink/hit-test.js +76 -0
  857. package/dist/src/ink/hooks/use-animation-frame.js +23 -0
  858. package/dist/src/ink/hooks/use-app.js +4 -0
  859. package/dist/src/ink/hooks/use-declared-cursor.js +27 -0
  860. package/dist/src/ink/hooks/use-input.js +31 -0
  861. package/dist/src/ink/hooks/use-interval.js +38 -0
  862. package/dist/src/ink/hooks/use-search-highlight.js +21 -0
  863. package/dist/src/ink/hooks/use-selection.js +47 -0
  864. package/dist/src/ink/hooks/use-stdin.js +4 -0
  865. package/dist/src/ink/hooks/use-tab-status.js +48 -0
  866. package/dist/src/ink/hooks/use-terminal-focus.js +6 -0
  867. package/dist/src/ink/hooks/use-terminal-title.js +17 -0
  868. package/dist/src/ink/hooks/use-terminal-viewport.js +40 -0
  869. package/dist/src/ink/ink.js +978 -0
  870. package/dist/src/ink/instances.js +2 -0
  871. package/dist/src/ink/layout/engine.js +4 -0
  872. package/dist/src/ink/layout/geometry.js +55 -0
  873. package/dist/src/ink/layout/node.js +60 -0
  874. package/dist/src/ink/layout/yoga.js +232 -0
  875. package/dist/src/ink/line-width-cache.js +14 -0
  876. package/dist/src/ink/log-update.js +408 -0
  877. package/dist/src/ink/measure-element.js +5 -0
  878. package/dist/src/ink/measure-text.js +30 -0
  879. package/dist/src/ink/node-cache.js +19 -0
  880. package/dist/src/ink/optimizer.js +52 -0
  881. package/dist/src/ink/output.js +399 -0
  882. package/dist/src/ink/parse-keypress.js +525 -0
  883. package/dist/src/ink/reconciler.js +359 -0
  884. package/dist/src/ink/render-border.js +110 -0
  885. package/dist/src/ink/render-node-to-output.js +710 -0
  886. package/dist/src/ink/render-to-screen.js +124 -0
  887. package/dist/src/ink/renderer.js +73 -0
  888. package/dist/src/ink/root.js +73 -0
  889. package/dist/src/ink/screen.js +823 -0
  890. package/dist/src/ink/searchHighlight.js +48 -0
  891. package/dist/src/ink/selection.js +507 -0
  892. package/dist/src/ink/squash-text-nodes.js +40 -0
  893. package/dist/src/ink/stringWidth.js +134 -0
  894. package/dist/src/ink/styles.js +279 -0
  895. package/dist/src/ink/supports-hyperlinks.js +29 -0
  896. package/dist/src/ink/tabstops.js +35 -0
  897. package/dist/src/ink/terminal-focus-state.js +33 -0
  898. package/dist/src/ink/terminal-querier.js +89 -0
  899. package/dist/src/ink/terminal.js +128 -0
  900. package/dist/src/ink/termio/ansi.js +53 -0
  901. package/dist/src/ink/termio/csi.js +158 -0
  902. package/dist/src/ink/termio/dec.js +31 -0
  903. package/dist/src/ink/termio/esc.js +36 -0
  904. package/dist/src/ink/termio/osc.js +275 -0
  905. package/dist/src/ink/termio/parser.js +293 -0
  906. package/dist/src/ink/termio/sgr.js +264 -0
  907. package/dist/src/ink/termio/tokenize.js +176 -0
  908. package/dist/src/ink/termio/types.js +33 -0
  909. package/dist/src/ink/termio.js +2 -0
  910. package/dist/src/ink/useTerminalNotification.js +61 -0
  911. package/dist/src/ink/warn.js +10 -0
  912. package/dist/src/ink/widest-line.js +15 -0
  913. package/dist/src/ink/wrap-text.js +50 -0
  914. package/dist/src/ink/wrapAnsi.js +5 -0
  915. package/dist/src/ink.js +55 -0
  916. package/dist/src/interactiveHelpers.js +231 -0
  917. package/dist/src/keybindings/KeybindingContext.js +170 -0
  918. package/dist/src/keybindings/KeybindingProviderSetup.js +225 -0
  919. package/dist/src/keybindings/defaultBindings.js +228 -0
  920. package/dist/src/keybindings/loadUserBindings.js +276 -0
  921. package/dist/src/keybindings/match.js +73 -0
  922. package/dist/src/keybindings/parser.js +152 -0
  923. package/dist/src/keybindings/reservedShortcuts.js +82 -0
  924. package/dist/src/keybindings/resolver.js +116 -0
  925. package/dist/src/keybindings/schema.js +143 -0
  926. package/dist/src/keybindings/shortcutFormat.js +24 -0
  927. package/dist/src/keybindings/template.js +28 -0
  928. package/dist/src/keybindings/useKeybinding.js +100 -0
  929. package/dist/src/keybindings/useShortcutDisplay.js +24 -0
  930. package/dist/src/keybindings/validate.js +313 -0
  931. package/dist/src/localRecoveryCli.js +256 -0
  932. package/dist/src/main.js +2489 -0
  933. package/dist/src/memdir/findRelevantMemories.js +76 -0
  934. package/dist/src/memdir/memdir.js +264 -0
  935. package/dist/src/memdir/memoryAge.js +24 -0
  936. package/dist/src/memdir/memoryScan.js +36 -0
  937. package/dist/src/memdir/memoryTypes.js +190 -0
  938. package/dist/src/memdir/paths.js +106 -0
  939. package/dist/src/memdir/teamMemPaths.js +133 -0
  940. package/dist/src/memdir/teamMemPrompts.js +87 -0
  941. package/dist/src/migrations/migrateAutoUpdatesToSettings.js +41 -0
  942. package/dist/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +29 -0
  943. package/dist/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +70 -0
  944. package/dist/src/migrations/migrateFennecToOpus.js +27 -0
  945. package/dist/src/migrations/migrateLegacyOpusToCurrent.js +30 -0
  946. package/dist/src/migrations/migrateOpusToOpus1m.js +23 -0
  947. package/dist/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +13 -0
  948. package/dist/src/migrations/migrateSonnet1mToSonnet45.js +29 -0
  949. package/dist/src/migrations/migrateSonnet45ToSonnet46.js +41 -0
  950. package/dist/src/migrations/resetAutoModeOptInForDefaultOffer.js +11 -0
  951. package/dist/src/migrations/resetProToOpusDefault.js +42 -0
  952. package/dist/src/moreright/useMoreRight.js +7 -0
  953. package/dist/src/native-ts/color-diff/index.js +729 -0
  954. package/dist/src/native-ts/file-index/index.js +246 -0
  955. package/dist/src/native-ts/yoga-layout/enums.js +96 -0
  956. package/dist/src/native-ts/yoga-layout/index.js +1638 -0
  957. package/dist/src/outputStyles/loadOutputStylesDir.js +47 -0
  958. package/dist/src/plugins/builtinPlugins.js +86 -0
  959. package/dist/src/plugins/bundled/index.js +1 -0
  960. package/dist/src/projectOnboardingState.js +56 -0
  961. package/dist/src/query/config.js +14 -0
  962. package/dist/src/query/deps.js +12 -0
  963. package/dist/src/query/stopHooks.js +251 -0
  964. package/dist/src/query/tokenBudget.js +47 -0
  965. package/dist/src/query.js +813 -0
  966. package/dist/src/remote/RemoteSessionManager.js +144 -0
  967. package/dist/src/remote/SessionsWebSocket.js +231 -0
  968. package/dist/src/remote/remotePermissionBridge.js +57 -0
  969. package/dist/src/remote/sdkMessageAdapter.js +161 -0
  970. package/dist/src/replLauncher.js +15 -0
  971. package/dist/src/schemas/hooks.js +71 -0
  972. package/dist/src/screens/Doctor.js +988 -0
  973. package/dist/src/screens/REPL.js +3588 -0
  974. package/dist/src/screens/ResumeConversation.js +396 -0
  975. package/dist/src/server/createDirectConnectSession.js +55 -0
  976. package/dist/src/server/directConnectManager.js +131 -0
  977. package/dist/src/server/types.js +7 -0
  978. package/dist/src/services/AgentSummary/agentSummary.js +114 -0
  979. package/dist/src/services/MagicDocs/magicDocs.js +151 -0
  980. package/dist/src/services/MagicDocs/prompts.js +85 -0
  981. package/dist/src/services/PromptSuggestion/promptSuggestion.js +350 -0
  982. package/dist/src/services/PromptSuggestion/speculation.js +590 -0
  983. package/dist/src/services/SessionMemory/prompts.js +220 -0
  984. package/dist/src/services/SessionMemory/sessionMemory.js +277 -0
  985. package/dist/src/services/SessionMemory/sessionMemoryUtils.js +94 -0
  986. package/dist/src/services/analytics/config.js +8 -0
  987. package/dist/src/services/analytics/datadog.js +217 -0
  988. package/dist/src/services/analytics/firstPartyEventLogger.js +223 -0
  989. package/dist/src/services/analytics/firstPartyEventLoggingExporter.js +500 -0
  990. package/dist/src/services/analytics/growthbook.js +597 -0
  991. package/dist/src/services/analytics/index.js +56 -0
  992. package/dist/src/services/analytics/metadata.js +507 -0
  993. package/dist/src/services/analytics/sink.js +44 -0
  994. package/dist/src/services/analytics/sinkKillswitch.js +6 -0
  995. package/dist/src/services/api/adminRequests.js +40 -0
  996. package/dist/src/services/api/bootstrap.js +104 -0
  997. package/dist/src/services/api/claude.js +1851 -0
  998. package/dist/src/services/api/client.js +209 -0
  999. package/dist/src/services/api/dumpPrompts.js +145 -0
  1000. package/dist/src/services/api/emptyUsage.js +15 -0
  1001. package/dist/src/services/api/errorUtils.js +137 -0
  1002. package/dist/src/services/api/errors.js +641 -0
  1003. package/dist/src/services/api/filesApi.js +409 -0
  1004. package/dist/src/services/api/firstTokenDate.js +42 -0
  1005. package/dist/src/services/api/grove.js +222 -0
  1006. package/dist/src/services/api/logging.js +478 -0
  1007. package/dist/src/services/api/metricsOptOut.js +87 -0
  1008. package/dist/src/services/api/overageCreditGrant.js +83 -0
  1009. package/dist/src/services/api/promptCacheBreakDetection.js +411 -0
  1010. package/dist/src/services/api/referral.js +178 -0
  1011. package/dist/src/services/api/sessionIngress.js +264 -0
  1012. package/dist/src/services/api/ultrareviewQuota.js +23 -0
  1013. package/dist/src/services/api/usage.js +34 -0
  1014. package/dist/src/services/api/withRetry.js +454 -0
  1015. package/dist/src/services/autoDream/autoDream.js +197 -0
  1016. package/dist/src/services/autoDream/config.js +9 -0
  1017. package/dist/src/services/autoDream/consolidationLock.js +76 -0
  1018. package/dist/src/services/autoDream/consolidationPrompt.js +61 -0
  1019. package/dist/src/services/awaySummary.js +58 -0
  1020. package/dist/src/services/claudeAiLimits.js +269 -0
  1021. package/dist/src/services/claudeAiLimitsHook.js +18 -0
  1022. package/dist/src/services/compact/apiMicrocompact.js +82 -0
  1023. package/dist/src/services/compact/autoCompact.js +151 -0
  1024. package/dist/src/services/compact/compact.js +957 -0
  1025. package/dist/src/services/compact/compactWarningHook.js +5 -0
  1026. package/dist/src/services/compact/compactWarningState.js +8 -0
  1027. package/dist/src/services/compact/grouping.js +20 -0
  1028. package/dist/src/services/compact/microCompact.js +265 -0
  1029. package/dist/src/services/compact/postCompactCleanup.js +23 -0
  1030. package/dist/src/services/compact/prompt.js +303 -0
  1031. package/dist/src/services/compact/sessionMemoryCompact.js +316 -0
  1032. package/dist/src/services/compact/timeBasedMCConfig.js +9 -0
  1033. package/dist/src/services/diagnosticTracking.js +195 -0
  1034. package/dist/src/services/extractMemories/extractMemories.js +309 -0
  1035. package/dist/src/services/extractMemories/prompts.js +113 -0
  1036. package/dist/src/services/internalLogging.js +53 -0
  1037. package/dist/src/services/lsp/LSPClient.js +252 -0
  1038. package/dist/src/services/lsp/LSPDiagnosticRegistry.js +179 -0
  1039. package/dist/src/services/lsp/LSPServerInstance.js +245 -0
  1040. package/dist/src/services/lsp/LSPServerManager.js +217 -0
  1041. package/dist/src/services/lsp/config.js +38 -0
  1042. package/dist/src/services/lsp/manager.js +132 -0
  1043. package/dist/src/services/lsp/passiveFeedback.js +150 -0
  1044. package/dist/src/services/mcp/InProcessTransport.js +37 -0
  1045. package/dist/src/services/mcp/MCPConnectionManager.js +56 -0
  1046. package/dist/src/services/mcp/SdkControlTransport.js +54 -0
  1047. package/dist/src/services/mcp/auth.js +1419 -0
  1048. package/dist/src/services/mcp/channelAllowlist.js +24 -0
  1049. package/dist/src/services/mcp/channelNotification.js +118 -0
  1050. package/dist/src/services/mcp/channelPermissions.js +89 -0
  1051. package/dist/src/services/mcp/claudeai.js +95 -0
  1052. package/dist/src/services/mcp/client.js +1896 -0
  1053. package/dist/src/services/mcp/config.js +942 -0
  1054. package/dist/src/services/mcp/elicitationHandler.js +171 -0
  1055. package/dist/src/services/mcp/envExpansion.js +19 -0
  1056. package/dist/src/services/mcp/headersHelper.js +64 -0
  1057. package/dist/src/services/mcp/mcpStringUtils.js +33 -0
  1058. package/dist/src/services/mcp/normalization.js +8 -0
  1059. package/dist/src/services/mcp/oauthPort.js +47 -0
  1060. package/dist/src/services/mcp/officialRegistry.js +42 -0
  1061. package/dist/src/services/mcp/types.js +82 -0
  1062. package/dist/src/services/mcp/useManageMCPConnections.js +536 -0
  1063. package/dist/src/services/mcp/utils.js +284 -0
  1064. package/dist/src/services/mcp/vscodeSdkMcp.js +55 -0
  1065. package/dist/src/services/mcp/xaa.js +237 -0
  1066. package/dist/src/services/mcp/xaaIdpLogin.js +286 -0
  1067. package/dist/src/services/mcpServerApproval.js +39 -0
  1068. package/dist/src/services/mockRateLimits.js +548 -0
  1069. package/dist/src/services/notifier.js +112 -0
  1070. package/dist/src/services/oauth/auth-code-listener.js +129 -0
  1071. package/dist/src/services/oauth/client.js +341 -0
  1072. package/dist/src/services/oauth/crypto.js +15 -0
  1073. package/dist/src/services/oauth/getOauthProfile.js +44 -0
  1074. package/dist/src/services/oauth/index.js +98 -0
  1075. package/dist/src/services/plugins/PluginInstallationManager.js +111 -0
  1076. package/dist/src/services/plugins/pluginCliCommands.js +173 -0
  1077. package/dist/src/services/plugins/pluginOperations.js +597 -0
  1078. package/dist/src/services/policyLimits/index.js +418 -0
  1079. package/dist/src/services/policyLimits/types.js +5 -0
  1080. package/dist/src/services/preventSleep.js +95 -0
  1081. package/dist/src/services/rateLimitMessages.js +194 -0
  1082. package/dist/src/services/rateLimitMocking.js +58 -0
  1083. package/dist/src/services/remoteManagedSettings/index.js +368 -0
  1084. package/dist/src/services/remoteManagedSettings/securityCheck.js +52 -0
  1085. package/dist/src/services/remoteManagedSettings/syncCache.js +50 -0
  1086. package/dist/src/services/remoteManagedSettings/syncCacheState.js +48 -0
  1087. package/dist/src/services/remoteManagedSettings/types.js +7 -0
  1088. package/dist/src/services/settingsSync/index.js +368 -0
  1089. package/dist/src/services/settingsSync/types.js +18 -0
  1090. package/dist/src/services/teamMemorySync/index.js +731 -0
  1091. package/dist/src/services/teamMemorySync/secretScanner.js +210 -0
  1092. package/dist/src/services/teamMemorySync/teamMemSecretGuard.js +4 -0
  1093. package/dist/src/services/teamMemorySync/types.js +23 -0
  1094. package/dist/src/services/teamMemorySync/watcher.js +197 -0
  1095. package/dist/src/services/tips/tipHistory.js +17 -0
  1096. package/dist/src/services/tips/tipRegistry.js +578 -0
  1097. package/dist/src/services/tips/tipScheduler.js +37 -0
  1098. package/dist/src/services/tokenEstimation.js +283 -0
  1099. package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +75 -0
  1100. package/dist/src/services/tools/StreamingToolExecutor.js +311 -0
  1101. package/dist/src/services/tools/toolExecution.js +1009 -0
  1102. package/dist/src/services/tools/toolHooks.js +384 -0
  1103. package/dist/src/services/tools/toolOrchestration.js +96 -0
  1104. package/dist/src/services/vcr.js +233 -0
  1105. package/dist/src/services/voice.js +315 -0
  1106. package/dist/src/services/voiceKeyterms.js +57 -0
  1107. package/dist/src/services/voiceStreamSTT.js +265 -0
  1108. package/dist/src/setup.js +235 -0
  1109. package/dist/src/skills/bundled/batch.js +114 -0
  1110. package/dist/src/skills/bundled/claudeApi.js +149 -0
  1111. package/dist/src/skills/bundled/claudeApiContent.js +63 -0
  1112. package/dist/src/skills/bundled/claudeInChrome.js +31 -0
  1113. package/dist/src/skills/bundled/debug.js +89 -0
  1114. package/dist/src/skills/bundled/index.js +22 -0
  1115. package/dist/src/skills/bundled/keybindings.js +303 -0
  1116. package/dist/src/skills/bundled/loop.js +86 -0
  1117. package/dist/src/skills/bundled/loremIpsum.js +257 -0
  1118. package/dist/src/skills/bundled/remember.js +78 -0
  1119. package/dist/src/skills/bundled/scheduleRemoteAgents.js +360 -0
  1120. package/dist/src/skills/bundled/simplify.js +70 -0
  1121. package/dist/src/skills/bundled/skillify.js +179 -0
  1122. package/dist/src/skills/bundled/stuck.js +76 -0
  1123. package/dist/src/skills/bundled/updateConfig.js +471 -0
  1124. package/dist/src/skills/bundled/verify/SKILL.md.js +1 -0
  1125. package/dist/src/skills/bundled/verify/examples/cli.md.js +1 -0
  1126. package/dist/src/skills/bundled/verify/examples/server.md.js +1 -0
  1127. package/dist/src/skills/bundled/verify.js +27 -0
  1128. package/dist/src/skills/bundled/verifyContent.js +8 -0
  1129. package/dist/src/skills/bundledSkills.js +114 -0
  1130. package/dist/src/skills/loadSkillsDir.js +583 -0
  1131. package/dist/src/skills/mcpSkillBuilders.js +10 -0
  1132. package/dist/src/state/AppState.js +153 -0
  1133. package/dist/src/state/AppStateStore.js +115 -0
  1134. package/dist/src/state/onChangeAppState.js +94 -0
  1135. package/dist/src/state/selectors.js +29 -0
  1136. package/dist/src/state/store.js +21 -0
  1137. package/dist/src/state/teammateViewHelpers.js +89 -0
  1138. package/dist/src/tasks/DreamTask/DreamTask.js +79 -0
  1139. package/dist/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +70 -0
  1140. package/dist/src/tasks/InProcessTeammateTask/types.js +15 -0
  1141. package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +444 -0
  1142. package/dist/src/tasks/LocalMainSessionTask.js +262 -0
  1143. package/dist/src/tasks/LocalShellTask/LocalShellTask.js +419 -0
  1144. package/dist/src/tasks/LocalShellTask/guards.js +3 -0
  1145. package/dist/src/tasks/LocalShellTask/killShellTasks.js +44 -0
  1146. package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +550 -0
  1147. package/dist/src/tasks/pillLabel.js +53 -0
  1148. package/dist/src/tasks/stopTask.js +53 -0
  1149. package/dist/src/tasks/types.js +9 -0
  1150. package/dist/src/tasks.js +22 -0
  1151. package/dist/src/tools/AgentTool/AgentTool.js +919 -0
  1152. package/dist/src/tools/AgentTool/UI.js +912 -0
  1153. package/dist/src/tools/AgentTool/agentColorManager.js +42 -0
  1154. package/dist/src/tools/AgentTool/agentDisplay.js +45 -0
  1155. package/dist/src/tools/AgentTool/agentMemory.js +85 -0
  1156. package/dist/src/tools/AgentTool/agentMemorySnapshot.js +109 -0
  1157. package/dist/src/tools/AgentTool/agentToolUtils.js +387 -0
  1158. package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +159 -0
  1159. package/dist/src/tools/AgentTool/built-in/exploreAgent.js +66 -0
  1160. package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +26 -0
  1161. package/dist/src/tools/AgentTool/built-in/planAgent.js +81 -0
  1162. package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +140 -0
  1163. package/dist/src/tools/AgentTool/built-in/verificationAgent.js +146 -0
  1164. package/dist/src/tools/AgentTool/builtInAgents.js +32 -0
  1165. package/dist/src/tools/AgentTool/constants.js +7 -0
  1166. package/dist/src/tools/AgentTool/forkSubagent.js +108 -0
  1167. package/dist/src/tools/AgentTool/loadAgentsDir.js +409 -0
  1168. package/dist/src/tools/AgentTool/prompt.js +194 -0
  1169. package/dist/src/tools/AgentTool/resumeAgent.js +169 -0
  1170. package/dist/src/tools/AgentTool/runAgent.js +457 -0
  1171. package/dist/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +282 -0
  1172. package/dist/src/tools/AskUserQuestionTool/prompt.js +38 -0
  1173. package/dist/src/tools/BashTool/BashTool.js +867 -0
  1174. package/dist/src/tools/BashTool/BashToolResultMessage.js +208 -0
  1175. package/dist/src/tools/BashTool/UI.js +189 -0
  1176. package/dist/src/tools/BashTool/bashCommandHelpers.js +145 -0
  1177. package/dist/src/tools/BashTool/bashPermissions.js +1193 -0
  1178. package/dist/src/tools/BashTool/bashSecurity.js +1464 -0
  1179. package/dist/src/tools/BashTool/commandSemantics.js +70 -0
  1180. package/dist/src/tools/BashTool/commentLabel.js +8 -0
  1181. package/dist/src/tools/BashTool/destructiveCommandWarning.js +74 -0
  1182. package/dist/src/tools/BashTool/modeValidation.js +65 -0
  1183. package/dist/src/tools/BashTool/pathValidation.js +771 -0
  1184. package/dist/src/tools/BashTool/prompt.js +307 -0
  1185. package/dist/src/tools/BashTool/readOnlyValidation.js +1312 -0
  1186. package/dist/src/tools/BashTool/sedEditParser.js +179 -0
  1187. package/dist/src/tools/BashTool/sedValidation.js +379 -0
  1188. package/dist/src/tools/BashTool/shouldUseSandbox.js +102 -0
  1189. package/dist/src/tools/BashTool/toolName.js +1 -0
  1190. package/dist/src/tools/BashTool/utils.js +145 -0
  1191. package/dist/src/tools/BriefTool/BriefTool.js +106 -0
  1192. package/dist/src/tools/BriefTool/UI.js +158 -0
  1193. package/dist/src/tools/BriefTool/attachments.js +54 -0
  1194. package/dist/src/tools/BriefTool/prompt.js +19 -0
  1195. package/dist/src/tools/BriefTool/upload.js +37 -0
  1196. package/dist/src/tools/ConfigTool/ConfigTool.js +304 -0
  1197. package/dist/src/tools/ConfigTool/UI.js +76 -0
  1198. package/dist/src/tools/ConfigTool/constants.js +1 -0
  1199. package/dist/src/tools/ConfigTool/prompt.js +76 -0
  1200. package/dist/src/tools/ConfigTool/supportedSettings.js +141 -0
  1201. package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +91 -0
  1202. package/dist/src/tools/EnterPlanModeTool/UI.js +49 -0
  1203. package/dist/src/tools/EnterPlanModeTool/constants.js +1 -0
  1204. package/dist/src/tools/EnterPlanModeTool/prompt.js +154 -0
  1205. package/dist/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +97 -0
  1206. package/dist/src/tools/EnterWorktreeTool/UI.js +25 -0
  1207. package/dist/src/tools/EnterWorktreeTool/constants.js +1 -0
  1208. package/dist/src/tools/EnterWorktreeTool/prompt.js +30 -0
  1209. package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +287 -0
  1210. package/dist/src/tools/ExitPlanModeTool/UI.js +128 -0
  1211. package/dist/src/tools/ExitPlanModeTool/constants.js +2 -0
  1212. package/dist/src/tools/ExitPlanModeTool/prompt.js +25 -0
  1213. package/dist/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +217 -0
  1214. package/dist/src/tools/ExitWorktreeTool/UI.js +36 -0
  1215. package/dist/src/tools/ExitWorktreeTool/constants.js +1 -0
  1216. package/dist/src/tools/ExitWorktreeTool/prompt.js +32 -0
  1217. package/dist/src/tools/FileEditTool/FileEditTool.js +447 -0
  1218. package/dist/src/tools/FileEditTool/UI.js +289 -0
  1219. package/dist/src/tools/FileEditTool/constants.js +4 -0
  1220. package/dist/src/tools/FileEditTool/prompt.js +22 -0
  1221. package/dist/src/tools/FileEditTool/types.js +37 -0
  1222. package/dist/src/tools/FileEditTool/utils.js +411 -0
  1223. package/dist/src/tools/FileReadTool/FileReadTool.js +759 -0
  1224. package/dist/src/tools/FileReadTool/UI.js +232 -0
  1225. package/dist/src/tools/FileReadTool/imageProcessor.js +34 -0
  1226. package/dist/src/tools/FileReadTool/limits.js +28 -0
  1227. package/dist/src/tools/FileReadTool/prompt.js +25 -0
  1228. package/dist/src/tools/FileWriteTool/FileWriteTool.js +300 -0
  1229. package/dist/src/tools/FileWriteTool/UI.js +460 -0
  1230. package/dist/src/tools/FileWriteTool/prompt.js +16 -0
  1231. package/dist/src/tools/GlobTool/GlobTool.js +155 -0
  1232. package/dist/src/tools/GlobTool/UI.js +58 -0
  1233. package/dist/src/tools/GlobTool/prompt.js +6 -0
  1234. package/dist/src/tools/GrepTool/GrepTool.js +390 -0
  1235. package/dist/src/tools/GrepTool/UI.js +254 -0
  1236. package/dist/src/tools/GrepTool/prompt.js +16 -0
  1237. package/dist/src/tools/LSPTool/LSPTool.js +541 -0
  1238. package/dist/src/tools/LSPTool/UI.js +275 -0
  1239. package/dist/src/tools/LSPTool/formatters.js +353 -0
  1240. package/dist/src/tools/LSPTool/prompt.js +20 -0
  1241. package/dist/src/tools/LSPTool/schemas.js +82 -0
  1242. package/dist/src/tools/LSPTool/symbolContext.js +43 -0
  1243. package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +91 -0
  1244. package/dist/src/tools/ListMcpResourcesTool/UI.js +26 -0
  1245. package/dist/src/tools/ListMcpResourcesTool/prompt.js +18 -0
  1246. package/dist/src/tools/MCPTool/MCPTool.js +57 -0
  1247. package/dist/src/tools/MCPTool/UI.js +433 -0
  1248. package/dist/src/tools/MCPTool/classifyForCollapse.js +509 -0
  1249. package/dist/src/tools/MCPTool/prompt.js +2 -0
  1250. package/dist/src/tools/McpAuthTool/McpAuthTool.js +139 -0
  1251. package/dist/src/tools/NotebookEditTool/NotebookEditTool.js +364 -0
  1252. package/dist/src/tools/NotebookEditTool/UI.js +115 -0
  1253. package/dist/src/tools/NotebookEditTool/constants.js +1 -0
  1254. package/dist/src/tools/NotebookEditTool/prompt.js +2 -0
  1255. package/dist/src/tools/PowerShellTool/PowerShellTool.js +700 -0
  1256. package/dist/src/tools/PowerShellTool/UI.js +154 -0
  1257. package/dist/src/tools/PowerShellTool/clmTypes.js +147 -0
  1258. package/dist/src/tools/PowerShellTool/commandSemantics.js +37 -0
  1259. package/dist/src/tools/PowerShellTool/commonParameters.js +17 -0
  1260. package/dist/src/tools/PowerShellTool/destructiveCommandWarning.js +70 -0
  1261. package/dist/src/tools/PowerShellTool/gitSafety.js +102 -0
  1262. package/dist/src/tools/PowerShellTool/modeValidation.js +203 -0
  1263. package/dist/src/tools/PowerShellTool/pathValidation.js +1259 -0
  1264. package/dist/src/tools/PowerShellTool/powershellPermissions.js +791 -0
  1265. package/dist/src/tools/PowerShellTool/powershellSecurity.js +612 -0
  1266. package/dist/src/tools/PowerShellTool/prompt.js +130 -0
  1267. package/dist/src/tools/PowerShellTool/readOnlyValidation.js +1000 -0
  1268. package/dist/src/tools/PowerShellTool/toolName.js +1 -0
  1269. package/dist/src/tools/REPLTool/constants.js +27 -0
  1270. package/dist/src/tools/REPLTool/primitiveTools.js +21 -0
  1271. package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +115 -0
  1272. package/dist/src/tools/ReadMcpResourceTool/UI.js +37 -0
  1273. package/dist/src/tools/ReadMcpResourceTool/prompt.js +15 -0
  1274. package/dist/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +138 -0
  1275. package/dist/src/tools/RemoteTriggerTool/UI.js +28 -0
  1276. package/dist/src/tools/RemoteTriggerTool/prompt.js +12 -0
  1277. package/dist/src/tools/ScheduleCronTool/CronCreateTool.js +117 -0
  1278. package/dist/src/tools/ScheduleCronTool/CronDeleteTool.js +83 -0
  1279. package/dist/src/tools/ScheduleCronTool/CronListTool.js +77 -0
  1280. package/dist/src/tools/ScheduleCronTool/UI.js +73 -0
  1281. package/dist/src/tools/ScheduleCronTool/prompt.js +67 -0
  1282. package/dist/src/tools/SendMessageTool/SendMessageTool.js +561 -0
  1283. package/dist/src/tools/SendMessageTool/UI.js +30 -0
  1284. package/dist/src/tools/SendMessageTool/constants.js +1 -0
  1285. package/dist/src/tools/SendMessageTool/prompt.js +32 -0
  1286. package/dist/src/tools/SkillTool/SkillTool.js +614 -0
  1287. package/dist/src/tools/SkillTool/UI.js +141 -0
  1288. package/dist/src/tools/SkillTool/constants.js +1 -0
  1289. package/dist/src/tools/SkillTool/prompt.js +161 -0
  1290. package/dist/src/tools/SleepTool/prompt.js +14 -0
  1291. package/dist/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +120 -0
  1292. package/dist/src/tools/TaskCreateTool/TaskCreateTool.js +106 -0
  1293. package/dist/src/tools/TaskCreateTool/constants.js +1 -0
  1294. package/dist/src/tools/TaskCreateTool/prompt.js +48 -0
  1295. package/dist/src/tools/TaskGetTool/TaskGetTool.js +110 -0
  1296. package/dist/src/tools/TaskGetTool/constants.js +1 -0
  1297. package/dist/src/tools/TaskGetTool/prompt.js +23 -0
  1298. package/dist/src/tools/TaskListTool/TaskListTool.js +92 -0
  1299. package/dist/src/tools/TaskListTool/constants.js +1 -0
  1300. package/dist/src/tools/TaskListTool/prompt.js +38 -0
  1301. package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +688 -0
  1302. package/dist/src/tools/TaskOutputTool/constants.js +1 -0
  1303. package/dist/src/tools/TaskStopTool/TaskStopTool.js +97 -0
  1304. package/dist/src/tools/TaskStopTool/UI.js +39 -0
  1305. package/dist/src/tools/TaskStopTool/prompt.js +7 -0
  1306. package/dist/src/tools/TaskUpdateTool/TaskUpdateTool.js +279 -0
  1307. package/dist/src/tools/TaskUpdateTool/constants.js +1 -0
  1308. package/dist/src/tools/TaskUpdateTool/prompt.js +76 -0
  1309. package/dist/src/tools/TeamCreateTool/TeamCreateTool.js +161 -0
  1310. package/dist/src/tools/TeamCreateTool/UI.js +4 -0
  1311. package/dist/src/tools/TeamCreateTool/constants.js +1 -0
  1312. package/dist/src/tools/TeamCreateTool/prompt.js +113 -0
  1313. package/dist/src/tools/TeamDeleteTool/TeamDeleteTool.js +96 -0
  1314. package/dist/src/tools/TeamDeleteTool/UI.js +14 -0
  1315. package/dist/src/tools/TeamDeleteTool/constants.js +1 -0
  1316. package/dist/src/tools/TeamDeleteTool/prompt.js +16 -0
  1317. package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +86 -0
  1318. package/dist/src/tools/TodoWriteTool/constants.js +1 -0
  1319. package/dist/src/tools/TodoWriteTool/prompt.js +181 -0
  1320. package/dist/src/tools/ToolSearchTool/ToolSearchTool.js +266 -0
  1321. package/dist/src/tools/ToolSearchTool/constants.js +1 -0
  1322. package/dist/src/tools/ToolSearchTool/prompt.js +40 -0
  1323. package/dist/src/tools/TungstenTool/TungstenLiveMonitor.js +4 -0
  1324. package/dist/src/tools/TungstenTool/TungstenTool.js +39 -0
  1325. package/dist/src/tools/WebFetchTool/UI.js +91 -0
  1326. package/dist/src/tools/WebFetchTool/WebFetchTool.js +234 -0
  1327. package/dist/src/tools/WebFetchTool/preapproved.js +122 -0
  1328. package/dist/src/tools/WebFetchTool/prompt.js +37 -0
  1329. package/dist/src/tools/WebFetchTool/utils.js +303 -0
  1330. package/dist/src/tools/WebSearchTool/UI.js +109 -0
  1331. package/dist/src/tools/WebSearchTool/WebSearchTool.js +313 -0
  1332. package/dist/src/tools/WebSearchTool/prompt.js +32 -0
  1333. package/dist/src/tools/WorkflowTool/constants.js +1 -0
  1334. package/dist/src/tools/shared/gitOperationTracking.js +158 -0
  1335. package/dist/src/tools/shared/spawnMultiAgent.js +630 -0
  1336. package/dist/src/tools/testing/TestingPermissionTool.js +66 -0
  1337. package/dist/src/tools/utils.js +15 -0
  1338. package/dist/src/tools.js +184 -0
  1339. package/dist/src/types/command.js +6 -0
  1340. package/dist/src/types/connectorText.js +3 -0
  1341. package/dist/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +525 -0
  1342. package/dist/src/types/generated/events_mono/common/v1/auth.js +38 -0
  1343. package/dist/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +112 -0
  1344. package/dist/src/types/generated/google/protobuf/timestamp.js +33 -0
  1345. package/dist/src/types/hooks.js +121 -0
  1346. package/dist/src/types/ids.js +10 -0
  1347. package/dist/src/types/logs.js +9 -0
  1348. package/dist/src/types/permissions.js +12 -0
  1349. package/dist/src/types/plugin.js +64 -0
  1350. package/dist/src/types/textInputTypes.js +10 -0
  1351. package/dist/src/upstreamproxy/relay.js +274 -0
  1352. package/dist/src/upstreamproxy/upstreamproxy.js +161 -0
  1353. package/dist/src/utils/CircularBuffer.js +51 -0
  1354. package/dist/src/utils/Cursor.js +1006 -0
  1355. package/dist/src/utils/QueryGuard.js +57 -0
  1356. package/dist/src/utils/Shell.js +260 -0
  1357. package/dist/src/utils/ShellCommand.js +277 -0
  1358. package/dist/src/utils/abortController.js +31 -0
  1359. package/dist/src/utils/activityManager.js +91 -0
  1360. package/dist/src/utils/advisor.js +63 -0
  1361. package/dist/src/utils/agentContext.js +36 -0
  1362. package/dist/src/utils/agentId.js +36 -0
  1363. package/dist/src/utils/agentSwarmsEnabled.js +17 -0
  1364. package/dist/src/utils/agenticSessionSearch.js +194 -0
  1365. package/dist/src/utils/analyzeContext.js +692 -0
  1366. package/dist/src/utils/ansiToPng.js +211 -0
  1367. package/dist/src/utils/ansiToSvg.js +171 -0
  1368. package/dist/src/utils/api.js +435 -0
  1369. package/dist/src/utils/apiPreconnect.js +19 -0
  1370. package/dist/src/utils/appleTerminalBackup.js +91 -0
  1371. package/dist/src/utils/argumentSubstitution.js +58 -0
  1372. package/dist/src/utils/array.js +12 -0
  1373. package/dist/src/utils/asciicast.js +149 -0
  1374. package/dist/src/utils/attachments.js +1854 -0
  1375. package/dist/src/utils/attribution.js +215 -0
  1376. package/dist/src/utils/auth.js +1197 -0
  1377. package/dist/src/utils/authFileDescriptor.js +106 -0
  1378. package/dist/src/utils/authPortable.js +14 -0
  1379. package/dist/src/utils/autoModeDenials.js +10 -0
  1380. package/dist/src/utils/autoRunIssue.js +126 -0
  1381. package/dist/src/utils/autoUpdater.js +339 -0
  1382. package/dist/src/utils/aws.js +30 -0
  1383. package/dist/src/utils/awsAuthStatusManager.js +55 -0
  1384. package/dist/src/utils/background/remote/preconditions.js +134 -0
  1385. package/dist/src/utils/background/remote/remoteSession.js +42 -0
  1386. package/dist/src/utils/backgroundHousekeeping.js +47 -0
  1387. package/dist/src/utils/bash/ParsedCommand.js +194 -0
  1388. package/dist/src/utils/bash/ShellSnapshot.js +333 -0
  1389. package/dist/src/utils/bash/ast.js +1422 -0
  1390. package/dist/src/utils/bash/bashParser.js +3625 -0
  1391. package/dist/src/utils/bash/bashPipeCommand.js +138 -0
  1392. package/dist/src/utils/bash/commands.js +668 -0
  1393. package/dist/src/utils/bash/heredoc.js +288 -0
  1394. package/dist/src/utils/bash/parser.js +110 -0
  1395. package/dist/src/utils/bash/prefix.js +119 -0
  1396. package/dist/src/utils/bash/registry.js +20 -0
  1397. package/dist/src/utils/bash/shellCompletion.js +127 -0
  1398. package/dist/src/utils/bash/shellPrefix.js +11 -0
  1399. package/dist/src/utils/bash/shellQuote.js +159 -0
  1400. package/dist/src/utils/bash/shellQuoting.js +43 -0
  1401. package/dist/src/utils/bash/specs/alias.js +11 -0
  1402. package/dist/src/utils/bash/specs/index.js +16 -0
  1403. package/dist/src/utils/bash/specs/nohup.js +10 -0
  1404. package/dist/src/utils/bash/specs/pyright.js +88 -0
  1405. package/dist/src/utils/bash/specs/sleep.js +10 -0
  1406. package/dist/src/utils/bash/specs/srun.js +28 -0
  1407. package/dist/src/utils/bash/specs/time.js +10 -0
  1408. package/dist/src/utils/bash/specs/timeout.js +17 -0
  1409. package/dist/src/utils/bash/treeSitterAnalysis.js +259 -0
  1410. package/dist/src/utils/betas.js +199 -0
  1411. package/dist/src/utils/billing.js +47 -0
  1412. package/dist/src/utils/binaryCheck.js +25 -0
  1413. package/dist/src/utils/browser.js +47 -0
  1414. package/dist/src/utils/bufferedWriter.js +73 -0
  1415. package/dist/src/utils/bundledMode.js +6 -0
  1416. package/dist/src/utils/caCerts.js +47 -0
  1417. package/dist/src/utils/caCertsConfig.js +32 -0
  1418. package/dist/src/utils/cachePaths.js +22 -0
  1419. package/dist/src/utils/classifierApprovals.js +61 -0
  1420. package/dist/src/utils/classifierApprovalsHook.js +8 -0
  1421. package/dist/src/utils/claudeCodeHints.js +83 -0
  1422. package/dist/src/utils/claudeDesktop.js +87 -0
  1423. package/dist/src/utils/claudeInChrome/chromeNativeHost.js +353 -0
  1424. package/dist/src/utils/claudeInChrome/common.js +416 -0
  1425. package/dist/src/utils/claudeInChrome/mcpServer.js +190 -0
  1426. package/dist/src/utils/claudeInChrome/prompt.js +60 -0
  1427. package/dist/src/utils/claudeInChrome/setup.js +239 -0
  1428. package/dist/src/utils/claudeInChrome/setupPortable.js +133 -0
  1429. package/dist/src/utils/claudeInChrome/toolRendering.js +224 -0
  1430. package/dist/src/utils/claudemd.js +727 -0
  1431. package/dist/src/utils/cleanup.js +423 -0
  1432. package/dist/src/utils/cleanupRegistry.js +8 -0
  1433. package/dist/src/utils/cliArgs.js +21 -0
  1434. package/dist/src/utils/cliHighlight.js +27 -0
  1435. package/dist/src/utils/codeIndexing.js +92 -0
  1436. package/dist/src/utils/collapseBackgroundBashNotifications.js +58 -0
  1437. package/dist/src/utils/collapseHookSummaries.js +38 -0
  1438. package/dist/src/utils/collapseReadSearch.js +569 -0
  1439. package/dist/src/utils/collapseTeammateShutdowns.js +34 -0
  1440. package/dist/src/utils/combinedAbortSignal.js +28 -0
  1441. package/dist/src/utils/commandLifecycle.js +7 -0
  1442. package/dist/src/utils/commitAttribution.js +510 -0
  1443. package/dist/src/utils/completionCache.js +126 -0
  1444. package/dist/src/utils/computerUse/appNames.js +104 -0
  1445. package/dist/src/utils/computerUse/cleanup.js +37 -0
  1446. package/dist/src/utils/computerUse/common.js +25 -0
  1447. package/dist/src/utils/computerUse/computerUseLock.js +117 -0
  1448. package/dist/src/utils/computerUse/drainRunLoop.js +44 -0
  1449. package/dist/src/utils/computerUse/escHotkey.js +33 -0
  1450. package/dist/src/utils/computerUse/executor.js +303 -0
  1451. package/dist/src/utils/computerUse/gates.js +40 -0
  1452. package/dist/src/utils/computerUse/hostAdapter.js +48 -0
  1453. package/dist/src/utils/computerUse/inputLoader.js +10 -0
  1454. package/dist/src/utils/computerUse/mcpServer.js +61 -0
  1455. package/dist/src/utils/computerUse/setup.js +25 -0
  1456. package/dist/src/utils/computerUse/swiftLoader.js +7 -0
  1457. package/dist/src/utils/computerUse/toolRendering.js +96 -0
  1458. package/dist/src/utils/computerUse/wrapper.js +242 -0
  1459. package/dist/src/utils/concurrentSessions.js +108 -0
  1460. package/dist/src/utils/config.js +801 -0
  1461. package/dist/src/utils/configConstants.js +11 -0
  1462. package/dist/src/utils/contentArray.js +19 -0
  1463. package/dist/src/utils/context.js +135 -0
  1464. package/dist/src/utils/contextAnalysis.js +152 -0
  1465. package/dist/src/utils/contextSuggestions.js +141 -0
  1466. package/dist/src/utils/controlMessageCompat.js +17 -0
  1467. package/dist/src/utils/conversationRecovery.js +278 -0
  1468. package/dist/src/utils/cron.js +182 -0
  1469. package/dist/src/utils/cronJitterConfig.js +22 -0
  1470. package/dist/src/utils/cronScheduler.js +295 -0
  1471. package/dist/src/utils/cronTasks.js +183 -0
  1472. package/dist/src/utils/cronTasksLock.js +116 -0
  1473. package/dist/src/utils/crossProjectResume.js +36 -0
  1474. package/dist/src/utils/crypto.js +3 -0
  1475. package/dist/src/utils/cwd.js +16 -0
  1476. package/dist/src/utils/debug.js +170 -0
  1477. package/dist/src/utils/debugFilter.js +69 -0
  1478. package/dist/src/utils/deepLink/banner.js +52 -0
  1479. package/dist/src/utils/deepLink/parseDeepLink.js +68 -0
  1480. package/dist/src/utils/deepLink/protocolHandler.js +66 -0
  1481. package/dist/src/utils/deepLink/registerProtocol.js +206 -0
  1482. package/dist/src/utils/deepLink/terminalLauncher.js +321 -0
  1483. package/dist/src/utils/deepLink/terminalPreference.js +26 -0
  1484. package/dist/src/utils/desktopDeepLink.js +154 -0
  1485. package/dist/src/utils/detectRepository.js +98 -0
  1486. package/dist/src/utils/diagLogs.js +47 -0
  1487. package/dist/src/utils/diff.js +92 -0
  1488. package/dist/src/utils/directMemberMessage.js +27 -0
  1489. package/dist/src/utils/displayTags.js +12 -0
  1490. package/dist/src/utils/doctorContextWarnings.js +151 -0
  1491. package/dist/src/utils/doctorDiagnostic.js +388 -0
  1492. package/dist/src/utils/dxt/helpers.js +36 -0
  1493. package/dist/src/utils/dxt/zip.js +112 -0
  1494. package/dist/src/utils/earlyInput.js +98 -0
  1495. package/dist/src/utils/editor.js +105 -0
  1496. package/dist/src/utils/effort.js +188 -0
  1497. package/dist/src/utils/embeddedTools.js +10 -0
  1498. package/dist/src/utils/env.js +284 -0
  1499. package/dist/src/utils/envDynamic.js +91 -0
  1500. package/dist/src/utils/envUtils.js +88 -0
  1501. package/dist/src/utils/envValidation.js +26 -0
  1502. package/dist/src/utils/errorLogSink.js +142 -0
  1503. package/dist/src/utils/errors.js +123 -0
  1504. package/dist/src/utils/exampleCommands.js +133 -0
  1505. package/dist/src/utils/execFileNoThrow.js +82 -0
  1506. package/dist/src/utils/execFileNoThrowPortable.js +52 -0
  1507. package/dist/src/utils/execSyncWrapper.js +16 -0
  1508. package/dist/src/utils/exportRenderer.js +78 -0
  1509. package/dist/src/utils/extraUsage.js +16 -0
  1510. package/dist/src/utils/fastMode.js +331 -0
  1511. package/dist/src/utils/file.js +318 -0
  1512. package/dist/src/utils/fileHistory.js +662 -0
  1513. package/dist/src/utils/fileOperationAnalytics.js +23 -0
  1514. package/dist/src/utils/filePersistence/filePersistence.js +165 -0
  1515. package/dist/src/utils/filePersistence/outputsScanner.js +72 -0
  1516. package/dist/src/utils/filePersistence/types.js +3 -0
  1517. package/dist/src/utils/fileRead.js +53 -0
  1518. package/dist/src/utils/fileReadCache.js +54 -0
  1519. package/dist/src/utils/fileStateCache.js +79 -0
  1520. package/dist/src/utils/findExecutable.js +5 -0
  1521. package/dist/src/utils/fingerprint.js +30 -0
  1522. package/dist/src/utils/forkedAgent.js +253 -0
  1523. package/dist/src/utils/format.js +200 -0
  1524. package/dist/src/utils/formatBriefTimestamp.js +49 -0
  1525. package/dist/src/utils/fpsTracker.js +32 -0
  1526. package/dist/src/utils/frontmatterParser.js +159 -0
  1527. package/dist/src/utils/fsOperations.js +548 -0
  1528. package/dist/src/utils/fullscreen.js +83 -0
  1529. package/dist/src/utils/generatedFiles.js +96 -0
  1530. package/dist/src/utils/generators.js +60 -0
  1531. package/dist/src/utils/genericProcessUtils.js +96 -0
  1532. package/dist/src/utils/getWorktreePaths.js +30 -0
  1533. package/dist/src/utils/getWorktreePathsPortable.js +14 -0
  1534. package/dist/src/utils/ghPrStatus.js +51 -0
  1535. package/dist/src/utils/git/gitConfigParser.js +166 -0
  1536. package/dist/src/utils/git/gitFilesystem.js +413 -0
  1537. package/dist/src/utils/git/gitignore.js +52 -0
  1538. package/dist/src/utils/git.js +520 -0
  1539. package/dist/src/utils/gitDiff.js +291 -0
  1540. package/dist/src/utils/gitSettings.js +10 -0
  1541. package/dist/src/utils/github/ghAuthStatus.js +15 -0
  1542. package/dist/src/utils/githubRepoPathMapping.js +92 -0
  1543. package/dist/src/utils/glob.js +65 -0
  1544. package/dist/src/utils/gracefulShutdown.js +274 -0
  1545. package/dist/src/utils/groupToolUses.js +107 -0
  1546. package/dist/src/utils/handlePromptSubmit.js +323 -0
  1547. package/dist/src/utils/hash.js +21 -0
  1548. package/dist/src/utils/headlessProfiler.js +95 -0
  1549. package/dist/src/utils/heapDumpService.js +157 -0
  1550. package/dist/src/utils/heatmap.js +118 -0
  1551. package/dist/src/utils/highlightMatch.js +28 -0
  1552. package/dist/src/utils/hooks/AsyncHookRegistry.js +190 -0
  1553. package/dist/src/utils/hooks/apiQueryHookHelper.js +67 -0
  1554. package/dist/src/utils/hooks/execAgentHook.js +216 -0
  1555. package/dist/src/utils/hooks/execHttpHook.js +106 -0
  1556. package/dist/src/utils/hooks/execPromptHook.js +153 -0
  1557. package/dist/src/utils/hooks/fileChangedWatcher.js +154 -0
  1558. package/dist/src/utils/hooks/hookEvents.js +92 -0
  1559. package/dist/src/utils/hooks/hookHelpers.js +43 -0
  1560. package/dist/src/utils/hooks/hooksConfigManager.js +386 -0
  1561. package/dist/src/utils/hooks/hooksConfigSnapshot.js +52 -0
  1562. package/dist/src/utils/hooks/hooksSettings.js +175 -0
  1563. package/dist/src/utils/hooks/postSamplingHooks.js +26 -0
  1564. package/dist/src/utils/hooks/registerFrontmatterHooks.js +34 -0
  1565. package/dist/src/utils/hooks/registerSkillHooks.js +24 -0
  1566. package/dist/src/utils/hooks/sessionHooks.js +176 -0
  1567. package/dist/src/utils/hooks/skillImprovement.js +200 -0
  1568. package/dist/src/utils/hooks/ssrfGuard.js +157 -0
  1569. package/dist/src/utils/hooks.js +2879 -0
  1570. package/dist/src/utils/horizontalScroll.js +72 -0
  1571. package/dist/src/utils/http.js +80 -0
  1572. package/dist/src/utils/hyperlink.js +13 -0
  1573. package/dist/src/utils/iTermBackup.js +46 -0
  1574. package/dist/src/utils/ide.js +938 -0
  1575. package/dist/src/utils/idePathConversion.js +47 -0
  1576. package/dist/src/utils/idleTimeout.js +33 -0
  1577. package/dist/src/utils/imagePaste.js +190 -0
  1578. package/dist/src/utils/imageResizer.js +459 -0
  1579. package/dist/src/utils/imageStore.js +109 -0
  1580. package/dist/src/utils/imageValidation.js +61 -0
  1581. package/dist/src/utils/immediateCommand.js +4 -0
  1582. package/dist/src/utils/inProcessTeammateHelpers.js +28 -0
  1583. package/dist/src/utils/ink.js +14 -0
  1584. package/dist/src/utils/intl.js +61 -0
  1585. package/dist/src/utils/jetbrains.js +130 -0
  1586. package/dist/src/utils/json.js +182 -0
  1587. package/dist/src/utils/jsonRead.js +4 -0
  1588. package/dist/src/utils/keyboardShortcuts.js +8 -0
  1589. package/dist/src/utils/lazySchema.js +4 -0
  1590. package/dist/src/utils/listSessionsImpl.js +219 -0
  1591. package/dist/src/utils/localInstaller.js +86 -0
  1592. package/dist/src/utils/lockfile.js +19 -0
  1593. package/dist/src/utils/log.js +164 -0
  1594. package/dist/src/utils/logoV2Utils.js +192 -0
  1595. package/dist/src/utils/mailbox.js +51 -0
  1596. package/dist/src/utils/managedEnv.js +90 -0
  1597. package/dist/src/utils/managedEnvConstants.js +136 -0
  1598. package/dist/src/utils/markdown.js +216 -0
  1599. package/dist/src/utils/markdownConfigLoader.js +293 -0
  1600. package/dist/src/utils/mcp/dateTimeParser.js +73 -0
  1601. package/dist/src/utils/mcp/elicitationValidation.js +208 -0
  1602. package/dist/src/utils/mcpInstructionsDelta.js +71 -0
  1603. package/dist/src/utils/mcpOutputStorage.js +124 -0
  1604. package/dist/src/utils/mcpValidation.js +138 -0
  1605. package/dist/src/utils/mcpWebSocketTransport.js +152 -0
  1606. package/dist/src/utils/memoize.js +125 -0
  1607. package/dist/src/utils/memory/types.js +8 -0
  1608. package/dist/src/utils/memory/versions.js +4 -0
  1609. package/dist/src/utils/memoryFileDetection.js +151 -0
  1610. package/dist/src/utils/messagePredicates.js +3 -0
  1611. package/dist/src/utils/messageQueueManager.js +267 -0
  1612. package/dist/src/utils/messages/mappers.js +198 -0
  1613. package/dist/src/utils/messages/systemInit.js +47 -0
  1614. package/dist/src/utils/messages.js +3450 -0
  1615. package/dist/src/utils/model/agent.js +91 -0
  1616. package/dist/src/utils/model/aliases.js +16 -0
  1617. package/dist/src/utils/model/antModels.js +23 -0
  1618. package/dist/src/utils/model/bedrock.js +158 -0
  1619. package/dist/src/utils/model/check1mAccess.js +49 -0
  1620. package/dist/src/utils/model/configs.js +81 -0
  1621. package/dist/src/utils/model/contextWindowUpgradeCheck.js +32 -0
  1622. package/dist/src/utils/model/deprecation.js +56 -0
  1623. package/dist/src/utils/model/model.js +377 -0
  1624. package/dist/src/utils/model/modelAllowlist.js +91 -0
  1625. package/dist/src/utils/model/modelCapabilities.js +97 -0
  1626. package/dist/src/utils/model/modelOptions.js +403 -0
  1627. package/dist/src/utils/model/modelStrings.js +112 -0
  1628. package/dist/src/utils/model/modelSupportOverrides.js +32 -0
  1629. package/dist/src/utils/model/providers.js +23 -0
  1630. package/dist/src/utils/model/validateModel.js +108 -0
  1631. package/dist/src/utils/modelCost.js +135 -0
  1632. package/dist/src/utils/modifiers.js +22 -0
  1633. package/dist/src/utils/mtls.js +101 -0
  1634. package/dist/src/utils/nativeInstaller/download.js +309 -0
  1635. package/dist/src/utils/nativeInstaller/index.js +9 -0
  1636. package/dist/src/utils/nativeInstaller/installer.js +1104 -0
  1637. package/dist/src/utils/nativeInstaller/packageManagers.js +174 -0
  1638. package/dist/src/utils/nativeInstaller/pidLock.js +230 -0
  1639. package/dist/src/utils/notebook.js +170 -0
  1640. package/dist/src/utils/objectGroupBy.js +12 -0
  1641. package/dist/src/utils/pasteStore.js +61 -0
  1642. package/dist/src/utils/path.js +65 -0
  1643. package/dist/src/utils/pdf.js +199 -0
  1644. package/dist/src/utils/pdfUtils.js +36 -0
  1645. package/dist/src/utils/peerAddress.js +9 -0
  1646. package/dist/src/utils/permissions/PermissionMode.js +82 -0
  1647. package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +62 -0
  1648. package/dist/src/utils/permissions/PermissionResult.js +10 -0
  1649. package/dist/src/utils/permissions/PermissionRule.js +7 -0
  1650. package/dist/src/utils/permissions/PermissionUpdate.js +219 -0
  1651. package/dist/src/utils/permissions/PermissionUpdateSchema.js +49 -0
  1652. package/dist/src/utils/permissions/autoModeState.js +26 -0
  1653. package/dist/src/utils/permissions/bashClassifier.js +29 -0
  1654. package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +69 -0
  1655. package/dist/src/utils/permissions/classifierDecision.js +56 -0
  1656. package/dist/src/utils/permissions/classifierShared.js +14 -0
  1657. package/dist/src/utils/permissions/dangerousPatterns.js +44 -0
  1658. package/dist/src/utils/permissions/denialTracking.js +28 -0
  1659. package/dist/src/utils/permissions/filesystem.js +889 -0
  1660. package/dist/src/utils/permissions/getNextPermissionMode.js +51 -0
  1661. package/dist/src/utils/permissions/pathValidation.js +230 -0
  1662. package/dist/src/utils/permissions/permissionExplainer.js +162 -0
  1663. package/dist/src/utils/permissions/permissionRuleParser.js +90 -0
  1664. package/dist/src/utils/permissions/permissionSetup.js +770 -0
  1665. package/dist/src/utils/permissions/permissions.js +585 -0
  1666. package/dist/src/utils/permissions/permissionsLoader.js +160 -0
  1667. package/dist/src/utils/permissions/shadowedRuleDetection.js +81 -0
  1668. package/dist/src/utils/permissions/shellRuleMatching.js +108 -0
  1669. package/dist/src/utils/permissions/yoloClassifier.js +868 -0
  1670. package/dist/src/utils/planModeV2.js +45 -0
  1671. package/dist/src/utils/plans.js +232 -0
  1672. package/dist/src/utils/platform.js +102 -0
  1673. package/dist/src/utils/plugins/addDirPluginSettings.js +30 -0
  1674. package/dist/src/utils/plugins/cacheUtils.js +144 -0
  1675. package/dist/src/utils/plugins/dependencyResolver.js +118 -0
  1676. package/dist/src/utils/plugins/fetchTelemetry.js +65 -0
  1677. package/dist/src/utils/plugins/gitAvailability.js +18 -0
  1678. package/dist/src/utils/plugins/headlessPluginInstall.js +92 -0
  1679. package/dist/src/utils/plugins/hintRecommendation.js +95 -0
  1680. package/dist/src/utils/plugins/installCounts.js +144 -0
  1681. package/dist/src/utils/plugins/installedPluginsManager.js +645 -0
  1682. package/dist/src/utils/plugins/loadPluginAgents.js +197 -0
  1683. package/dist/src/utils/plugins/loadPluginCommands.js +488 -0
  1684. package/dist/src/utils/plugins/loadPluginHooks.js +170 -0
  1685. package/dist/src/utils/plugins/loadPluginOutputStyles.js +98 -0
  1686. package/dist/src/utils/plugins/lspPluginIntegration.js +216 -0
  1687. package/dist/src/utils/plugins/lspRecommendation.js +193 -0
  1688. package/dist/src/utils/plugins/managedPlugins.js +18 -0
  1689. package/dist/src/utils/plugins/marketplaceHelpers.js +309 -0
  1690. package/dist/src/utils/plugins/marketplaceManager.js +1225 -0
  1691. package/dist/src/utils/plugins/mcpPluginIntegration.js +336 -0
  1692. package/dist/src/utils/plugins/mcpbHandler.js +487 -0
  1693. package/dist/src/utils/plugins/officialMarketplace.js +5 -0
  1694. package/dist/src/utils/plugins/officialMarketplaceGcs.js +118 -0
  1695. package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +267 -0
  1696. package/dist/src/utils/plugins/orphanedPluginFilter.js +47 -0
  1697. package/dist/src/utils/plugins/parseMarketplaceInput.js +75 -0
  1698. package/dist/src/utils/plugins/performStartupChecks.js +34 -0
  1699. package/dist/src/utils/plugins/pluginAutoupdate.js +130 -0
  1700. package/dist/src/utils/plugins/pluginBlocklist.js +66 -0
  1701. package/dist/src/utils/plugins/pluginDirectories.js +78 -0
  1702. package/dist/src/utils/plugins/pluginFlagging.js +122 -0
  1703. package/dist/src/utils/plugins/pluginIdentifier.js +37 -0
  1704. package/dist/src/utils/plugins/pluginInstallationHelpers.js +281 -0
  1705. package/dist/src/utils/plugins/pluginLoader.js +1596 -0
  1706. package/dist/src/utils/plugins/pluginOptionsStorage.js +162 -0
  1707. package/dist/src/utils/plugins/pluginPolicy.js +5 -0
  1708. package/dist/src/utils/plugins/pluginStartupCheck.js +176 -0
  1709. package/dist/src/utils/plugins/pluginVersioning.js +53 -0
  1710. package/dist/src/utils/plugins/reconciler.js +133 -0
  1711. package/dist/src/utils/plugins/refresh.js +96 -0
  1712. package/dist/src/utils/plugins/schemas.js +411 -0
  1713. package/dist/src/utils/plugins/validatePlugin.js +573 -0
  1714. package/dist/src/utils/plugins/walkPluginMarkdown.js +30 -0
  1715. package/dist/src/utils/plugins/zipCache.js +211 -0
  1716. package/dist/src/utils/plugins/zipCacheAdapters.js +93 -0
  1717. package/dist/src/utils/powershell/dangerousCmdlets.js +97 -0
  1718. package/dist/src/utils/powershell/parser.js +929 -0
  1719. package/dist/src/utils/powershell/staticPrefix.js +142 -0
  1720. package/dist/src/utils/preflightChecks.js +196 -0
  1721. package/dist/src/utils/privacyLevel.js +21 -0
  1722. package/dist/src/utils/process.js +42 -0
  1723. package/dist/src/utils/processUserInput/processBashCommand.js +109 -0
  1724. package/dist/src/utils/processUserInput/processSlashCommand.js +600 -0
  1725. package/dist/src/utils/processUserInput/processTextPrompt.js +54 -0
  1726. package/dist/src/utils/processUserInput/processUserInput.js +272 -0
  1727. package/dist/src/utils/profilerBase.js +15 -0
  1728. package/dist/src/utils/promptCategory.js +21 -0
  1729. package/dist/src/utils/promptEditor.js +115 -0
  1730. package/dist/src/utils/promptShellExecution.js +76 -0
  1731. package/dist/src/utils/proxy.js +228 -0
  1732. package/dist/src/utils/queryContext.js +83 -0
  1733. package/dist/src/utils/queryHelpers.js +329 -0
  1734. package/dist/src/utils/queryProfiler.js +177 -0
  1735. package/dist/src/utils/queueProcessor.js +41 -0
  1736. package/dist/src/utils/readEditContext.js +131 -0
  1737. package/dist/src/utils/readFileInRange.js +212 -0
  1738. package/dist/src/utils/releaseNotes.js +186 -0
  1739. package/dist/src/utils/renderOptions.js +45 -0
  1740. package/dist/src/utils/ripgrep.js +383 -0
  1741. package/dist/src/utils/sandbox/sandbox-adapter.js +505 -0
  1742. package/dist/src/utils/sandbox/sandbox-ui-utils.js +3 -0
  1743. package/dist/src/utils/sanitization.js +33 -0
  1744. package/dist/src/utils/screenshotClipboard.js +73 -0
  1745. package/dist/src/utils/sdkEventQueue.js +36 -0
  1746. package/dist/src/utils/secureStorage/fallbackStorage.js +45 -0
  1747. package/dist/src/utils/secureStorage/index.js +9 -0
  1748. package/dist/src/utils/secureStorage/keychainPrefetch.js +43 -0
  1749. package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +42 -0
  1750. package/dist/src/utils/secureStorage/macOsKeychainStorage.js +147 -0
  1751. package/dist/src/utils/secureStorage/plainTextStorage.js +77 -0
  1752. package/dist/src/utils/semanticBoolean.js +4 -0
  1753. package/dist/src/utils/semanticNumber.js +11 -0
  1754. package/dist/src/utils/semver.js +43 -0
  1755. package/dist/src/utils/sequential.js +30 -0
  1756. package/dist/src/utils/sessionActivity.js +95 -0
  1757. package/dist/src/utils/sessionEnvVars.js +13 -0
  1758. package/dist/src/utils/sessionEnvironment.js +113 -0
  1759. package/dist/src/utils/sessionFileAccessHooks.js +150 -0
  1760. package/dist/src/utils/sessionIngressAuth.js +79 -0
  1761. package/dist/src/utils/sessionRestore.js +205 -0
  1762. package/dist/src/utils/sessionStart.js +119 -0
  1763. package/dist/src/utils/sessionState.js +48 -0
  1764. package/dist/src/utils/sessionStorage.js +2891 -0
  1765. package/dist/src/utils/sessionStoragePortable.js +486 -0
  1766. package/dist/src/utils/sessionTitle.js +89 -0
  1767. package/dist/src/utils/sessionUrl.js +33 -0
  1768. package/dist/src/utils/set.js +38 -0
  1769. package/dist/src/utils/settings/allErrors.js +11 -0
  1770. package/dist/src/utils/settings/applySettingsChange.js +40 -0
  1771. package/dist/src/utils/settings/changeDetector.js +279 -0
  1772. package/dist/src/utils/settings/constants.js +119 -0
  1773. package/dist/src/utils/settings/internalWrites.js +15 -0
  1774. package/dist/src/utils/settings/managedPath.js +19 -0
  1775. package/dist/src/utils/settings/mdm/constants.js +33 -0
  1776. package/dist/src/utils/settings/mdm/rawRead.js +72 -0
  1777. package/dist/src/utils/settings/mdm/settings.js +160 -0
  1778. package/dist/src/utils/settings/permissionValidation.js +169 -0
  1779. package/dist/src/utils/settings/pluginOnlyPolicy.js +19 -0
  1780. package/dist/src/utils/settings/schemaOutput.js +7 -0
  1781. package/dist/src/utils/settings/settings.js +530 -0
  1782. package/dist/src/utils/settings/settingsCache.js +36 -0
  1783. package/dist/src/utils/settings/toolValidationConfig.js +58 -0
  1784. package/dist/src/utils/settings/types.js +224 -0
  1785. package/dist/src/utils/settings/validateEditTool.js +26 -0
  1786. package/dist/src/utils/settings/validation.js +160 -0
  1787. package/dist/src/utils/settings/validationTips.js +94 -0
  1788. package/dist/src/utils/shell/bashProvider.js +123 -0
  1789. package/dist/src/utils/shell/outputLimits.js +7 -0
  1790. package/dist/src/utils/shell/powershellDetection.js +50 -0
  1791. package/dist/src/utils/shell/powershellProvider.js +50 -0
  1792. package/dist/src/utils/shell/prefix.js +183 -0
  1793. package/dist/src/utils/shell/readOnlyCommandValidation.js +1347 -0
  1794. package/dist/src/utils/shell/resolveDefaultShell.js +4 -0
  1795. package/dist/src/utils/shell/shellProvider.js +2 -0
  1796. package/dist/src/utils/shell/shellToolUtils.js +10 -0
  1797. package/dist/src/utils/shell/specPrefix.js +152 -0
  1798. package/dist/src/utils/shellConfig.js +88 -0
  1799. package/dist/src/utils/sideQuery.js +108 -0
  1800. package/dist/src/utils/sideQuestion.js +78 -0
  1801. package/dist/src/utils/signal.js +18 -0
  1802. package/dist/src/utils/sinks.js +6 -0
  1803. package/dist/src/utils/skills/skillChangeDetector.js +184 -0
  1804. package/dist/src/utils/slashCommandParsing.js +25 -0
  1805. package/dist/src/utils/sleep.js +43 -0
  1806. package/dist/src/utils/sliceAnsi.js +48 -0
  1807. package/dist/src/utils/slowOperations.js +165 -0
  1808. package/dist/src/utils/standaloneAgent.js +7 -0
  1809. package/dist/src/utils/startupProfiler.js +106 -0
  1810. package/dist/src/utils/staticRender.js +78 -0
  1811. package/dist/src/utils/stats.js +598 -0
  1812. package/dist/src/utils/statsCache.js +223 -0
  1813. package/dist/src/utils/status.js +361 -0
  1814. package/dist/src/utils/statusNoticeDefinitions.js +280 -0
  1815. package/dist/src/utils/statusNoticeHelpers.js +10 -0
  1816. package/dist/src/utils/stream.js +72 -0
  1817. package/dist/src/utils/streamJsonStdoutGuard.js +73 -0
  1818. package/dist/src/utils/streamlinedTransform.js +130 -0
  1819. package/dist/src/utils/stringUtils.js +108 -0
  1820. package/dist/src/utils/subprocessEnv.js +42 -0
  1821. package/dist/src/utils/suggestions/commandSuggestions.js +301 -0
  1822. package/dist/src/utils/suggestions/directoryCompletion.js +134 -0
  1823. package/dist/src/utils/suggestions/shellHistoryCompletion.js +65 -0
  1824. package/dist/src/utils/suggestions/skillUsageTracking.js +33 -0
  1825. package/dist/src/utils/suggestions/slackChannelSuggestions.js +141 -0
  1826. package/dist/src/utils/swarm/It2SetupPrompt.js +537 -0
  1827. package/dist/src/utils/swarm/backends/ITermBackend.js +153 -0
  1828. package/dist/src/utils/swarm/backends/InProcessBackend.js +160 -0
  1829. package/dist/src/utils/swarm/backends/PaneBackendExecutor.js +171 -0
  1830. package/dist/src/utils/swarm/backends/TmuxBackend.js +458 -0
  1831. package/dist/src/utils/swarm/backends/detection.js +43 -0
  1832. package/dist/src/utils/swarm/backends/it2Setup.js +134 -0
  1833. package/dist/src/utils/swarm/backends/registry.js +220 -0
  1834. package/dist/src/utils/swarm/backends/teammateModeSnapshot.js +33 -0
  1835. package/dist/src/utils/swarm/backends/types.js +3 -0
  1836. package/dist/src/utils/swarm/constants.js +11 -0
  1837. package/dist/src/utils/swarm/inProcessRunner.js +818 -0
  1838. package/dist/src/utils/swarm/leaderPermissionBridge.js +20 -0
  1839. package/dist/src/utils/swarm/permissionSync.js +474 -0
  1840. package/dist/src/utils/swarm/reconnection.js +55 -0
  1841. package/dist/src/utils/swarm/spawnInProcess.js +164 -0
  1842. package/dist/src/utils/swarm/spawnUtils.js +76 -0
  1843. package/dist/src/utils/swarm/teamHelpers.js +320 -0
  1844. package/dist/src/utils/swarm/teammateInit.js +65 -0
  1845. package/dist/src/utils/swarm/teammateLayoutManager.js +40 -0
  1846. package/dist/src/utils/swarm/teammateModel.js +5 -0
  1847. package/dist/src/utils/swarm/teammatePromptAddendum.js +11 -0
  1848. package/dist/src/utils/systemDirectories.js +42 -0
  1849. package/dist/src/utils/systemPrompt.js +41 -0
  1850. package/dist/src/utils/systemPromptType.js +3 -0
  1851. package/dist/src/utils/systemTheme.js +61 -0
  1852. package/dist/src/utils/taggedId.js +27 -0
  1853. package/dist/src/utils/task/TaskOutput.js +244 -0
  1854. package/dist/src/utils/task/diskOutput.js +267 -0
  1855. package/dist/src/utils/task/framework.js +178 -0
  1856. package/dist/src/utils/task/outputFormatting.js +21 -0
  1857. package/dist/src/utils/task/sdkProgress.js +18 -0
  1858. package/dist/src/utils/tasks.js +481 -0
  1859. package/dist/src/utils/teamDiscovery.js +33 -0
  1860. package/dist/src/utils/teamMemoryOps.js +40 -0
  1861. package/dist/src/utils/teammate.js +132 -0
  1862. package/dist/src/utils/teammateContext.js +17 -0
  1863. package/dist/src/utils/teammateMailbox.js +541 -0
  1864. package/dist/src/utils/telemetry/betaSessionTracing.js +255 -0
  1865. package/dist/src/utils/telemetry/bigqueryExporter.js +162 -0
  1866. package/dist/src/utils/telemetry/events.js +46 -0
  1867. package/dist/src/utils/telemetry/instrumentation.js +534 -0
  1868. package/dist/src/utils/telemetry/logger.js +26 -0
  1869. package/dist/src/utils/telemetry/perfettoTracing.js +636 -0
  1870. package/dist/src/utils/telemetry/pluginTelemetry.js +99 -0
  1871. package/dist/src/utils/telemetry/sessionTracing.js +564 -0
  1872. package/dist/src/utils/telemetry/skillLoadedEvent.js +22 -0
  1873. package/dist/src/utils/telemetryAttributes.js +50 -0
  1874. package/dist/src/utils/teleport/api.js +236 -0
  1875. package/dist/src/utils/teleport/environmentSelection.js +42 -0
  1876. package/dist/src/utils/teleport/environments.js +74 -0
  1877. package/dist/src/utils/teleport/gitBundle.js +153 -0
  1878. package/dist/src/utils/teleport.js +856 -0
  1879. package/dist/src/utils/tempfile.js +7 -0
  1880. package/dist/src/utils/terminal.js +65 -0
  1881. package/dist/src/utils/terminalPanel.js +133 -0
  1882. package/dist/src/utils/textHighlighting.js +109 -0
  1883. package/dist/src/utils/theme.js +465 -0
  1884. package/dist/src/utils/thinking.js +92 -0
  1885. package/dist/src/utils/timeouts.js +22 -0
  1886. package/dist/src/utils/tmuxSocket.js +216 -0
  1887. package/dist/src/utils/todo/types.js +9 -0
  1888. package/dist/src/utils/tokenBudget.js +54 -0
  1889. package/dist/src/utils/tokens.js +123 -0
  1890. package/dist/src/utils/toolErrors.js +87 -0
  1891. package/dist/src/utils/toolPool.js +22 -0
  1892. package/dist/src/utils/toolResultStorage.js +444 -0
  1893. package/dist/src/utils/toolSchemaCache.js +7 -0
  1894. package/dist/src/utils/toolSearch.js +314 -0
  1895. package/dist/src/utils/transcriptSearch.js +143 -0
  1896. package/dist/src/utils/treeify.js +89 -0
  1897. package/dist/src/utils/truncate.js +113 -0
  1898. package/dist/src/utils/ultraplan/ccrSession.js +187 -0
  1899. package/dist/src/utils/ultraplan/keyword.js +81 -0
  1900. package/dist/src/utils/ultraplan/prompt.txt.js +1 -0
  1901. package/dist/src/utils/unaryLogging.js +15 -0
  1902. package/dist/src/utils/undercover.js +57 -0
  1903. package/dist/src/utils/user.js +111 -0
  1904. package/dist/src/utils/userAgent.js +3 -0
  1905. package/dist/src/utils/userPromptKeywords.js +13 -0
  1906. package/dist/src/utils/uuid.js +11 -0
  1907. package/dist/src/utils/warningHandler.js +74 -0
  1908. package/dist/src/utils/which.js +50 -0
  1909. package/dist/src/utils/windowsPaths.js +104 -0
  1910. package/dist/src/utils/withResolvers.js +9 -0
  1911. package/dist/src/utils/words.js +763 -0
  1912. package/dist/src/utils/workloadContext.js +9 -0
  1913. package/dist/src/utils/worktree.js +841 -0
  1914. package/dist/src/utils/worktreeModeEnabled.js +3 -0
  1915. package/dist/src/utils/xdg.js +24 -0
  1916. package/dist/src/utils/xml.js +6 -0
  1917. package/dist/src/utils/yaml.js +6 -0
  1918. package/dist/src/utils/zodToJsonSchema.js +10 -0
  1919. package/dist/src/vim/motions.js +54 -0
  1920. package/dist/src/vim/operators.js +329 -0
  1921. package/dist/src/vim/textObjects.js +137 -0
  1922. package/dist/src/vim/transitions.js +324 -0
  1923. package/dist/src/vim/types.js +60 -0
  1924. package/dist/src/voice/voiceModeEnabled.js +18 -0
  1925. package/dist/stubs/ant-claude-for-chrome-mcp.js +6 -0
  1926. package/dist/stubs/color-diff-napi.js +30 -0
  1927. package/litellm.yaml +25 -0
  1928. package/package.json +93 -0
@@ -0,0 +1,1596 @@
1
+ import {
2
+ copyFile,
3
+ readdir,
4
+ readFile,
5
+ readlink,
6
+ realpath,
7
+ rename,
8
+ rm,
9
+ rmdir,
10
+ stat,
11
+ symlink
12
+ } from "fs/promises";
13
+ import memoize from "lodash-es/memoize.js";
14
+ import { basename, dirname, join, relative, resolve, sep } from "path";
15
+ import { getInlinePlugins } from "../../bootstrap/state.js";
16
+ import {
17
+ BUILTIN_MARKETPLACE_NAME,
18
+ getBuiltinPlugins
19
+ } from "../../plugins/builtinPlugins.js";
20
+ import { logForDebugging } from "../debug.js";
21
+ import { isEnvTruthy } from "../envUtils.js";
22
+ import {
23
+ errorMessage,
24
+ getErrnoPath,
25
+ isENOENT,
26
+ isFsInaccessible,
27
+ toError
28
+ } from "../errors.js";
29
+ import { execFileNoThrow, execFileNoThrowWithCwd } from "../execFileNoThrow.js";
30
+ import { pathExists } from "../file.js";
31
+ import { getFsImplementation } from "../fsOperations.js";
32
+ import { gitExe } from "../git.js";
33
+ import { lazySchema } from "../lazySchema.js";
34
+ import { logError } from "../log.js";
35
+ import { getSettings_DEPRECATED } from "../settings/settings.js";
36
+ import {
37
+ clearPluginSettingsBase,
38
+ getPluginSettingsBase,
39
+ resetSettingsCache,
40
+ setPluginSettingsBase
41
+ } from "../settings/settingsCache.js";
42
+ import { SettingsSchema } from "../settings/types.js";
43
+ import { jsonParse, jsonStringify } from "../slowOperations.js";
44
+ import { getAddDirEnabledPlugins } from "./addDirPluginSettings.js";
45
+ import { verifyAndDemote } from "./dependencyResolver.js";
46
+ import { classifyFetchError, logPluginFetch } from "./fetchTelemetry.js";
47
+ import { checkGitAvailable } from "./gitAvailability.js";
48
+ import { getInMemoryInstalledPlugins } from "./installedPluginsManager.js";
49
+ import { getManagedPluginNames } from "./managedPlugins.js";
50
+ import {
51
+ formatSourceForDisplay,
52
+ getBlockedMarketplaces,
53
+ getStrictKnownMarketplaces,
54
+ isSourceAllowedByPolicy,
55
+ isSourceInBlocklist
56
+ } from "./marketplaceHelpers.js";
57
+ import {
58
+ getMarketplaceCacheOnly,
59
+ getPluginByIdCacheOnly,
60
+ loadKnownMarketplacesConfigSafe
61
+ } from "./marketplaceManager.js";
62
+ import { getPluginSeedDirs, getPluginsDirectory } from "./pluginDirectories.js";
63
+ import { parsePluginIdentifier } from "./pluginIdentifier.js";
64
+ import { validatePathWithinBase } from "./pluginInstallationHelpers.js";
65
+ import { calculatePluginVersion } from "./pluginVersioning.js";
66
+ import {
67
+ PluginHooksSchema,
68
+ PluginIdSchema,
69
+ PluginManifestSchema
70
+ } from "./schemas.js";
71
+ import {
72
+ convertDirectoryToZipInPlace,
73
+ extractZipToDirectory,
74
+ getSessionPluginCachePath,
75
+ isPluginZipCacheEnabled
76
+ } from "./zipCache.js";
77
+ export function getPluginCachePath() {
78
+ return join(getPluginsDirectory(), "cache");
79
+ }
80
+ export function getVersionedCachePathIn(baseDir, pluginId, version) {
81
+ const { name: pluginName, marketplace } = parsePluginIdentifier(pluginId);
82
+ const sanitizedMarketplace = (marketplace || "unknown").replace(/[^a-zA-Z0-9\-_]/g, "-");
83
+ const sanitizedPlugin = (pluginName || pluginId).replace(/[^a-zA-Z0-9\-_]/g, "-");
84
+ const sanitizedVersion = version.replace(/[^a-zA-Z0-9\-_.]/g, "-");
85
+ return join(baseDir, "cache", sanitizedMarketplace, sanitizedPlugin, sanitizedVersion);
86
+ }
87
+ export function getVersionedCachePath(pluginId, version) {
88
+ return getVersionedCachePathIn(getPluginsDirectory(), pluginId, version);
89
+ }
90
+ export function getVersionedZipCachePath(pluginId, version) {
91
+ return `${getVersionedCachePath(pluginId, version)}.zip`;
92
+ }
93
+ async function probeSeedCache(pluginId, version) {
94
+ for (const seedDir of getPluginSeedDirs()) {
95
+ const seedPath = getVersionedCachePathIn(seedDir, pluginId, version);
96
+ try {
97
+ const entries = await readdir(seedPath);
98
+ if (entries.length > 0)
99
+ return seedPath;
100
+ } catch {}
101
+ }
102
+ return null;
103
+ }
104
+ export async function probeSeedCacheAnyVersion(pluginId) {
105
+ for (const seedDir of getPluginSeedDirs()) {
106
+ const pluginDir = dirname(getVersionedCachePathIn(seedDir, pluginId, "_"));
107
+ try {
108
+ const versions = await readdir(pluginDir);
109
+ if (versions.length !== 1)
110
+ continue;
111
+ const versionDir = join(pluginDir, versions[0]);
112
+ const entries = await readdir(versionDir);
113
+ if (entries.length > 0)
114
+ return versionDir;
115
+ } catch {}
116
+ }
117
+ return null;
118
+ }
119
+ export function getLegacyCachePath(pluginName) {
120
+ const cachePath = getPluginCachePath();
121
+ return join(cachePath, pluginName.replace(/[^a-zA-Z0-9\-_]/g, "-"));
122
+ }
123
+ export async function resolvePluginPath(pluginId, version) {
124
+ if (version) {
125
+ const versionedPath = getVersionedCachePath(pluginId, version);
126
+ if (await pathExists(versionedPath)) {
127
+ return versionedPath;
128
+ }
129
+ }
130
+ const pluginName = parsePluginIdentifier(pluginId).name || pluginId;
131
+ const legacyPath = getLegacyCachePath(pluginName);
132
+ if (await pathExists(legacyPath)) {
133
+ return legacyPath;
134
+ }
135
+ return version ? getVersionedCachePath(pluginId, version) : legacyPath;
136
+ }
137
+ export async function copyDir(src, dest) {
138
+ await getFsImplementation().mkdir(dest);
139
+ const entries = await readdir(src, { withFileTypes: true });
140
+ for (const entry of entries) {
141
+ const srcPath = join(src, entry.name);
142
+ const destPath = join(dest, entry.name);
143
+ if (entry.isDirectory()) {
144
+ await copyDir(srcPath, destPath);
145
+ } else if (entry.isFile()) {
146
+ await copyFile(srcPath, destPath);
147
+ } else if (entry.isSymbolicLink()) {
148
+ const linkTarget = await readlink(srcPath);
149
+ let resolvedTarget;
150
+ try {
151
+ resolvedTarget = await realpath(srcPath);
152
+ } catch {
153
+ await symlink(linkTarget, destPath);
154
+ continue;
155
+ }
156
+ let resolvedSrc;
157
+ try {
158
+ resolvedSrc = await realpath(src);
159
+ } catch {
160
+ resolvedSrc = src;
161
+ }
162
+ const srcPrefix = resolvedSrc.endsWith(sep) ? resolvedSrc : resolvedSrc + sep;
163
+ if (resolvedTarget.startsWith(srcPrefix) || resolvedTarget === resolvedSrc) {
164
+ const targetRelativeToSrc = relative(resolvedSrc, resolvedTarget);
165
+ const destTargetPath = join(dest, targetRelativeToSrc);
166
+ const relativeLinkPath = relative(dirname(destPath), destTargetPath);
167
+ await symlink(relativeLinkPath, destPath);
168
+ } else {
169
+ await symlink(resolvedTarget, destPath);
170
+ }
171
+ }
172
+ }
173
+ }
174
+ export async function copyPluginToVersionedCache(sourcePath, pluginId, version, entry, marketplaceDir) {
175
+ const zipCacheMode = isPluginZipCacheEnabled();
176
+ const cachePath = getVersionedCachePath(pluginId, version);
177
+ const zipPath = getVersionedZipCachePath(pluginId, version);
178
+ if (zipCacheMode) {
179
+ if (await pathExists(zipPath)) {
180
+ logForDebugging(`Plugin ${pluginId} version ${version} already cached at ${zipPath}`);
181
+ return zipPath;
182
+ }
183
+ } else if (await pathExists(cachePath)) {
184
+ const entries = await readdir(cachePath);
185
+ if (entries.length > 0) {
186
+ logForDebugging(`Plugin ${pluginId} version ${version} already cached at ${cachePath}`);
187
+ return cachePath;
188
+ }
189
+ logForDebugging(`Removing empty cache directory for ${pluginId} at ${cachePath}`);
190
+ await rmdir(cachePath);
191
+ }
192
+ const seedPath = await probeSeedCache(pluginId, version);
193
+ if (seedPath) {
194
+ logForDebugging(`Using seed cache for ${pluginId}@${version} at ${seedPath}`);
195
+ return seedPath;
196
+ }
197
+ await getFsImplementation().mkdir(dirname(cachePath));
198
+ if (entry && typeof entry.source === "string" && marketplaceDir) {
199
+ const sourceDir = validatePathWithinBase(marketplaceDir, entry.source);
200
+ logForDebugging(`Copying source directory ${entry.source} for plugin ${pluginId}`);
201
+ try {
202
+ await copyDir(sourceDir, cachePath);
203
+ } catch (e) {
204
+ if (isENOENT(e) && getErrnoPath(e) === sourceDir) {
205
+ throw new Error(`Plugin source directory not found: ${sourceDir} (from entry.source: ${entry.source})`);
206
+ }
207
+ throw e;
208
+ }
209
+ } else {
210
+ logForDebugging(`Copying plugin ${pluginId} to versioned cache (fallback to full copy)`);
211
+ await copyDir(sourcePath, cachePath);
212
+ }
213
+ const gitPath = join(cachePath, ".git");
214
+ await rm(gitPath, { recursive: true, force: true });
215
+ const cacheEntries = await readdir(cachePath);
216
+ if (cacheEntries.length === 0) {
217
+ throw new Error(`Failed to copy plugin ${pluginId} to versioned cache: destination is empty after copy`);
218
+ }
219
+ if (zipCacheMode) {
220
+ await convertDirectoryToZipInPlace(cachePath, zipPath);
221
+ logForDebugging(`Successfully cached plugin ${pluginId} as ZIP at ${zipPath}`);
222
+ return zipPath;
223
+ }
224
+ logForDebugging(`Successfully cached plugin ${pluginId} at ${cachePath}`);
225
+ return cachePath;
226
+ }
227
+ function validateGitUrl(url) {
228
+ try {
229
+ const parsed = new URL(url);
230
+ if (!["https:", "http:", "file:"].includes(parsed.protocol)) {
231
+ if (!/^git@[a-zA-Z0-9.-]+:/.test(url)) {
232
+ throw new Error(`Invalid git URL protocol: ${parsed.protocol}. Only HTTPS, HTTP, file:// and SSH (git@) URLs are supported.`);
233
+ }
234
+ }
235
+ return url;
236
+ } catch {
237
+ if (/^git@[a-zA-Z0-9.-]+:/.test(url)) {
238
+ return url;
239
+ }
240
+ throw new Error(`Invalid git URL: ${url}`);
241
+ }
242
+ }
243
+ export async function installFromNpm(packageName, targetPath, options = {}) {
244
+ const npmCachePath = join(getPluginsDirectory(), "npm-cache");
245
+ await getFsImplementation().mkdir(npmCachePath);
246
+ const packageSpec = options.version ? `${packageName}@${options.version}` : packageName;
247
+ const packagePath = join(npmCachePath, "node_modules", packageName);
248
+ const needsInstall = !await pathExists(packagePath);
249
+ if (needsInstall) {
250
+ logForDebugging(`Installing npm package ${packageSpec} to cache`);
251
+ const args = ["install", packageSpec, "--prefix", npmCachePath];
252
+ if (options.registry) {
253
+ args.push("--registry", options.registry);
254
+ }
255
+ const result = await execFileNoThrow("npm", args, { useCwd: false });
256
+ if (result.code !== 0) {
257
+ throw new Error(`Failed to install npm package: ${result.stderr}`);
258
+ }
259
+ }
260
+ await copyDir(packagePath, targetPath);
261
+ logForDebugging(`Copied npm package ${packageName} from cache to ${targetPath}`);
262
+ }
263
+ export async function gitClone(gitUrl, targetPath, ref, sha) {
264
+ const args = [
265
+ "clone",
266
+ "--depth",
267
+ "1",
268
+ "--recurse-submodules",
269
+ "--shallow-submodules"
270
+ ];
271
+ if (ref) {
272
+ args.push("--branch", ref);
273
+ }
274
+ if (sha) {
275
+ args.push("--no-checkout");
276
+ }
277
+ args.push(gitUrl, targetPath);
278
+ const cloneStarted = performance.now();
279
+ const cloneResult = await execFileNoThrow(gitExe(), args);
280
+ if (cloneResult.code !== 0) {
281
+ logPluginFetch("plugin_clone", gitUrl, "failure", performance.now() - cloneStarted, classifyFetchError(cloneResult.stderr));
282
+ throw new Error(`Failed to clone repository: ${cloneResult.stderr}`);
283
+ }
284
+ if (sha) {
285
+ const shallowFetchResult = await execFileNoThrowWithCwd(gitExe(), ["fetch", "--depth", "1", "origin", sha], { cwd: targetPath });
286
+ if (shallowFetchResult.code !== 0) {
287
+ logForDebugging(`Shallow fetch of SHA ${sha} failed, falling back to unshallow fetch`);
288
+ const unshallowResult = await execFileNoThrowWithCwd(gitExe(), ["fetch", "--unshallow"], { cwd: targetPath });
289
+ if (unshallowResult.code !== 0) {
290
+ logPluginFetch("plugin_clone", gitUrl, "failure", performance.now() - cloneStarted, classifyFetchError(unshallowResult.stderr));
291
+ throw new Error(`Failed to fetch commit ${sha}: ${unshallowResult.stderr}`);
292
+ }
293
+ }
294
+ const checkoutResult = await execFileNoThrowWithCwd(gitExe(), ["checkout", sha], { cwd: targetPath });
295
+ if (checkoutResult.code !== 0) {
296
+ logPluginFetch("plugin_clone", gitUrl, "failure", performance.now() - cloneStarted, classifyFetchError(checkoutResult.stderr));
297
+ throw new Error(`Failed to checkout commit ${sha}: ${checkoutResult.stderr}`);
298
+ }
299
+ }
300
+ logPluginFetch("plugin_clone", gitUrl, "success", performance.now() - cloneStarted);
301
+ }
302
+ async function installFromGit(gitUrl, targetPath, ref, sha) {
303
+ const safeUrl = validateGitUrl(gitUrl);
304
+ await gitClone(safeUrl, targetPath, ref, sha);
305
+ const refMessage = ref ? ` (ref: ${ref})` : "";
306
+ logForDebugging(`Cloned repository from ${safeUrl}${refMessage} to ${targetPath}`);
307
+ }
308
+ async function installFromGitHub(repo, targetPath, ref, sha) {
309
+ if (!/^[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/.test(repo)) {
310
+ throw new Error(`Invalid GitHub repository format: ${repo}. Expected format: owner/repo`);
311
+ }
312
+ const gitUrl = isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) ? `https://github.com/${repo}.git` : `git@github.com:${repo}.git`;
313
+ return installFromGit(gitUrl, targetPath, ref, sha);
314
+ }
315
+ function resolveGitSubdirUrl(url) {
316
+ if (/^[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/.test(url)) {
317
+ return isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) ? `https://github.com/${url}.git` : `git@github.com:${url}.git`;
318
+ }
319
+ return validateGitUrl(url);
320
+ }
321
+ export async function installFromGitSubdir(url, targetPath, subdirPath, ref, sha) {
322
+ if (!await checkGitAvailable()) {
323
+ throw new Error("git-subdir plugin source requires git to be installed and on PATH. " + "Install git (version 2.25 or later for sparse-checkout cone mode) and try again.");
324
+ }
325
+ const gitUrl = resolveGitSubdirUrl(url);
326
+ const cloneDir = `${targetPath}.clone`;
327
+ const cloneArgs = [
328
+ "clone",
329
+ "--depth",
330
+ "1",
331
+ "--filter=tree:0",
332
+ "--no-checkout"
333
+ ];
334
+ if (ref) {
335
+ cloneArgs.push("--branch", ref);
336
+ }
337
+ cloneArgs.push(gitUrl, cloneDir);
338
+ const cloneResult = await execFileNoThrow(gitExe(), cloneArgs);
339
+ if (cloneResult.code !== 0) {
340
+ throw new Error(`Failed to clone repository for git-subdir source: ${cloneResult.stderr}`);
341
+ }
342
+ try {
343
+ const sparseResult = await execFileNoThrowWithCwd(gitExe(), ["sparse-checkout", "set", "--cone", "--", subdirPath], { cwd: cloneDir });
344
+ if (sparseResult.code !== 0) {
345
+ throw new Error(`git sparse-checkout set failed (git >= 2.25 required for cone mode): ${sparseResult.stderr}`);
346
+ }
347
+ let resolvedSha;
348
+ if (sha) {
349
+ const fetchSha = await execFileNoThrowWithCwd(gitExe(), ["fetch", "--depth", "1", "origin", sha], { cwd: cloneDir });
350
+ if (fetchSha.code !== 0) {
351
+ logForDebugging(`Shallow fetch of SHA ${sha} failed for git-subdir, falling back to unshallow fetch`);
352
+ const unshallow = await execFileNoThrowWithCwd(gitExe(), ["fetch", "--unshallow"], { cwd: cloneDir });
353
+ if (unshallow.code !== 0) {
354
+ throw new Error(`Failed to fetch commit ${sha}: ${unshallow.stderr}`);
355
+ }
356
+ }
357
+ const checkout = await execFileNoThrowWithCwd(gitExe(), ["checkout", sha], { cwd: cloneDir });
358
+ if (checkout.code !== 0) {
359
+ throw new Error(`Failed to checkout commit ${sha}: ${checkout.stderr}`);
360
+ }
361
+ resolvedSha = sha;
362
+ } else {
363
+ const [checkout, revParse] = await Promise.all([
364
+ execFileNoThrowWithCwd(gitExe(), ["checkout", "HEAD"], {
365
+ cwd: cloneDir
366
+ }),
367
+ execFileNoThrowWithCwd(gitExe(), ["rev-parse", "HEAD"], {
368
+ cwd: cloneDir
369
+ })
370
+ ]);
371
+ if (checkout.code !== 0) {
372
+ throw new Error(`git checkout after sparse-checkout failed: ${checkout.stderr}`);
373
+ }
374
+ if (revParse.code === 0) {
375
+ resolvedSha = revParse.stdout.trim();
376
+ }
377
+ }
378
+ const resolvedSubdir = validatePathWithinBase(cloneDir, subdirPath);
379
+ try {
380
+ await rename(resolvedSubdir, targetPath);
381
+ } catch (e) {
382
+ if (isENOENT(e)) {
383
+ throw new Error(`Subdirectory '${subdirPath}' not found in repository ${gitUrl}${ref ? ` (ref: ${ref})` : ""}. ` + "Check that the path is correct and exists at the specified ref/sha.");
384
+ }
385
+ throw e;
386
+ }
387
+ const refMsg = ref ? ` ref=${ref}` : "";
388
+ const shaMsg = resolvedSha ? ` sha=${resolvedSha}` : "";
389
+ logForDebugging(`Extracted subdir ${subdirPath} from ${gitUrl}${refMsg}${shaMsg} to ${targetPath}`);
390
+ return resolvedSha;
391
+ } finally {
392
+ await rm(cloneDir, { recursive: true, force: true });
393
+ }
394
+ }
395
+ async function installFromLocal(sourcePath, targetPath) {
396
+ if (!await pathExists(sourcePath)) {
397
+ throw new Error(`Source path does not exist: ${sourcePath}`);
398
+ }
399
+ await copyDir(sourcePath, targetPath);
400
+ const gitPath = join(targetPath, ".git");
401
+ await rm(gitPath, { recursive: true, force: true });
402
+ }
403
+ export function generateTemporaryCacheNameForPlugin(source) {
404
+ const timestamp = Date.now();
405
+ const random = Math.random().toString(36).substring(2, 8);
406
+ let prefix;
407
+ if (typeof source === "string") {
408
+ prefix = "local";
409
+ } else {
410
+ switch (source.source) {
411
+ case "npm":
412
+ prefix = "npm";
413
+ break;
414
+ case "pip":
415
+ prefix = "pip";
416
+ break;
417
+ case "github":
418
+ prefix = "github";
419
+ break;
420
+ case "url":
421
+ prefix = "git";
422
+ break;
423
+ case "git-subdir":
424
+ prefix = "subdir";
425
+ break;
426
+ default:
427
+ prefix = "unknown";
428
+ }
429
+ }
430
+ return `temp_${prefix}_${timestamp}_${random}`;
431
+ }
432
+ export async function cachePlugin(source, options) {
433
+ const cachePath = getPluginCachePath();
434
+ await getFsImplementation().mkdir(cachePath);
435
+ const tempName = generateTemporaryCacheNameForPlugin(source);
436
+ const tempPath = join(cachePath, tempName);
437
+ let shouldCleanup = false;
438
+ let gitCommitSha;
439
+ try {
440
+ logForDebugging(`Caching plugin from source: ${jsonStringify(source)} to temporary path ${tempPath}`);
441
+ shouldCleanup = true;
442
+ if (typeof source === "string") {
443
+ await installFromLocal(source, tempPath);
444
+ } else {
445
+ switch (source.source) {
446
+ case "npm":
447
+ await installFromNpm(source.package, tempPath, {
448
+ registry: source.registry,
449
+ version: source.version
450
+ });
451
+ break;
452
+ case "github":
453
+ await installFromGitHub(source.repo, tempPath, source.ref, source.sha);
454
+ break;
455
+ case "url":
456
+ await installFromGit(source.url, tempPath, source.ref, source.sha);
457
+ break;
458
+ case "git-subdir":
459
+ gitCommitSha = await installFromGitSubdir(source.url, tempPath, source.path, source.ref, source.sha);
460
+ break;
461
+ case "pip":
462
+ throw new Error("Python package plugins are not yet supported");
463
+ default:
464
+ throw new Error(`Unsupported plugin source type`);
465
+ }
466
+ }
467
+ } catch (error) {
468
+ if (shouldCleanup && await pathExists(tempPath)) {
469
+ logForDebugging(`Cleaning up failed installation at ${tempPath}`);
470
+ try {
471
+ await rm(tempPath, { recursive: true, force: true });
472
+ } catch (cleanupError) {
473
+ logForDebugging(`Failed to clean up installation: ${cleanupError}`, {
474
+ level: "error"
475
+ });
476
+ }
477
+ }
478
+ throw error;
479
+ }
480
+ const manifestPath = join(tempPath, ".claude-plugin", "plugin.json");
481
+ const legacyManifestPath = join(tempPath, "plugin.json");
482
+ let manifest;
483
+ if (await pathExists(manifestPath)) {
484
+ try {
485
+ const content = await readFile(manifestPath, { encoding: "utf-8" });
486
+ const parsed = jsonParse(content);
487
+ const result = PluginManifestSchema().safeParse(parsed);
488
+ if (result.success) {
489
+ manifest = result.data;
490
+ } else {
491
+ const errors = result.error.issues.map((err) => `${err.path.join(".")}: ${err.message}`).join(", ");
492
+ logForDebugging(`Invalid manifest at ${manifestPath}: ${errors}`, {
493
+ level: "error"
494
+ });
495
+ throw new Error(`Plugin has an invalid manifest file at ${manifestPath}. Validation errors: ${errors}`);
496
+ }
497
+ } catch (error) {
498
+ if (error instanceof Error && error.message.includes("invalid manifest file")) {
499
+ throw error;
500
+ }
501
+ const errorMsg = errorMessage(error);
502
+ logForDebugging(`Failed to parse manifest at ${manifestPath}: ${errorMsg}`, {
503
+ level: "error"
504
+ });
505
+ throw new Error(`Plugin has a corrupt manifest file at ${manifestPath}. JSON parse error: ${errorMsg}`);
506
+ }
507
+ } else if (await pathExists(legacyManifestPath)) {
508
+ try {
509
+ const content = await readFile(legacyManifestPath, {
510
+ encoding: "utf-8"
511
+ });
512
+ const parsed = jsonParse(content);
513
+ const result = PluginManifestSchema().safeParse(parsed);
514
+ if (result.success) {
515
+ manifest = result.data;
516
+ } else {
517
+ const errors = result.error.issues.map((err) => `${err.path.join(".")}: ${err.message}`).join(", ");
518
+ logForDebugging(`Invalid legacy manifest at ${legacyManifestPath}: ${errors}`, { level: "error" });
519
+ throw new Error(`Plugin has an invalid manifest file at ${legacyManifestPath}. Validation errors: ${errors}`);
520
+ }
521
+ } catch (error) {
522
+ if (error instanceof Error && error.message.includes("invalid manifest file")) {
523
+ throw error;
524
+ }
525
+ const errorMsg = errorMessage(error);
526
+ logForDebugging(`Failed to parse legacy manifest at ${legacyManifestPath}: ${errorMsg}`, {
527
+ level: "error"
528
+ });
529
+ throw new Error(`Plugin has a corrupt manifest file at ${legacyManifestPath}. JSON parse error: ${errorMsg}`);
530
+ }
531
+ } else {
532
+ manifest = options?.manifest || {
533
+ name: tempName,
534
+ description: `Plugin cached from ${typeof source === "string" ? source : source.source}`
535
+ };
536
+ }
537
+ const finalName = manifest.name.replace(/[^a-zA-Z0-9-_]/g, "-");
538
+ const finalPath = join(cachePath, finalName);
539
+ if (await pathExists(finalPath)) {
540
+ logForDebugging(`Removing old cached version at ${finalPath}`);
541
+ await rm(finalPath, { recursive: true, force: true });
542
+ }
543
+ await rename(tempPath, finalPath);
544
+ logForDebugging(`Successfully cached plugin ${manifest.name} to ${finalPath}`);
545
+ return {
546
+ path: finalPath,
547
+ manifest,
548
+ ...gitCommitSha && { gitCommitSha }
549
+ };
550
+ }
551
+ export async function loadPluginManifest(manifestPath, pluginName, source) {
552
+ if (!await pathExists(manifestPath)) {
553
+ return {
554
+ name: pluginName,
555
+ description: `Plugin from ${source}`
556
+ };
557
+ }
558
+ try {
559
+ const content = await readFile(manifestPath, { encoding: "utf-8" });
560
+ const parsedJson = jsonParse(content);
561
+ const result = PluginManifestSchema().safeParse(parsedJson);
562
+ if (result.success) {
563
+ return result.data;
564
+ }
565
+ const errors = result.error.issues.map((err) => err.path.length > 0 ? `${err.path.join(".")}: ${err.message}` : err.message).join(", ");
566
+ logForDebugging(`Plugin ${pluginName} has an invalid manifest file at ${manifestPath}. Validation errors: ${errors}`, { level: "error" });
567
+ throw new Error(`Plugin ${pluginName} has an invalid manifest file at ${manifestPath}.
568
+
569
+ Validation errors: ${errors}`);
570
+ } catch (error) {
571
+ if (error instanceof Error && error.message.includes("invalid manifest file")) {
572
+ throw error;
573
+ }
574
+ const errorMsg = errorMessage(error);
575
+ logForDebugging(`Plugin ${pluginName} has a corrupt manifest file at ${manifestPath}. Parse error: ${errorMsg}`, { level: "error" });
576
+ throw new Error(`Plugin ${pluginName} has a corrupt manifest file at ${manifestPath}.
577
+
578
+ JSON parse error: ${errorMsg}`);
579
+ }
580
+ }
581
+ async function loadPluginHooks(hooksConfigPath, pluginName) {
582
+ if (!await pathExists(hooksConfigPath)) {
583
+ throw new Error(`Hooks file not found at ${hooksConfigPath} for plugin ${pluginName}. If the manifest declares hooks, the file must exist.`);
584
+ }
585
+ const content = await readFile(hooksConfigPath, { encoding: "utf-8" });
586
+ const rawHooksConfig = jsonParse(content);
587
+ const validatedPluginHooks = PluginHooksSchema().parse(rawHooksConfig);
588
+ return validatedPluginHooks.hooks;
589
+ }
590
+ async function validatePluginPaths(relPaths, pluginPath, pluginName, source, component, componentLabel, contextLabel, errors) {
591
+ const checks = await Promise.all(relPaths.map(async (relPath) => {
592
+ const fullPath = join(pluginPath, relPath);
593
+ return { relPath, fullPath, exists: await pathExists(fullPath) };
594
+ }));
595
+ const validPaths = [];
596
+ for (const { relPath, fullPath, exists } of checks) {
597
+ if (exists) {
598
+ validPaths.push(fullPath);
599
+ } else {
600
+ logForDebugging(`${componentLabel} path ${relPath} ${contextLabel} not found at ${fullPath} for ${pluginName}`, { level: "warn" });
601
+ logError(new Error(`Plugin component file not found: ${fullPath} for ${pluginName}`));
602
+ errors.push({
603
+ type: "path-not-found",
604
+ source,
605
+ plugin: pluginName,
606
+ path: fullPath,
607
+ component
608
+ });
609
+ }
610
+ }
611
+ return validPaths;
612
+ }
613
+ export async function createPluginFromPath(pluginPath, source, enabled, fallbackName, strict = true) {
614
+ const errors = [];
615
+ const manifestPath = join(pluginPath, ".claude-plugin", "plugin.json");
616
+ const manifest = await loadPluginManifest(manifestPath, fallbackName, source);
617
+ const plugin = {
618
+ name: manifest.name,
619
+ manifest,
620
+ path: pluginPath,
621
+ source,
622
+ repository: source,
623
+ enabled
624
+ };
625
+ const [
626
+ commandsDirExists,
627
+ agentsDirExists,
628
+ skillsDirExists,
629
+ outputStylesDirExists
630
+ ] = await Promise.all([
631
+ !manifest.commands ? pathExists(join(pluginPath, "commands")) : false,
632
+ !manifest.agents ? pathExists(join(pluginPath, "agents")) : false,
633
+ !manifest.skills ? pathExists(join(pluginPath, "skills")) : false,
634
+ !manifest.outputStyles ? pathExists(join(pluginPath, "output-styles")) : false
635
+ ]);
636
+ const commandsPath = join(pluginPath, "commands");
637
+ if (commandsDirExists) {
638
+ plugin.commandsPath = commandsPath;
639
+ }
640
+ if (manifest.commands) {
641
+ const firstValue = Object.values(manifest.commands)[0];
642
+ if (typeof manifest.commands === "object" && !Array.isArray(manifest.commands) && firstValue && typeof firstValue === "object" && (("source" in firstValue) || ("content" in firstValue))) {
643
+ const commandsMetadata = {};
644
+ const validPaths = [];
645
+ const entries = Object.entries(manifest.commands);
646
+ const checks = await Promise.all(entries.map(async ([commandName, metadata]) => {
647
+ if (!metadata || typeof metadata !== "object") {
648
+ return { commandName, metadata, kind: "skip" };
649
+ }
650
+ if (metadata.source) {
651
+ const fullPath = join(pluginPath, metadata.source);
652
+ return {
653
+ commandName,
654
+ metadata,
655
+ kind: "source",
656
+ fullPath,
657
+ exists: await pathExists(fullPath)
658
+ };
659
+ }
660
+ if (metadata.content) {
661
+ return { commandName, metadata, kind: "content" };
662
+ }
663
+ return { commandName, metadata, kind: "skip" };
664
+ }));
665
+ for (const check of checks) {
666
+ if (check.kind === "skip")
667
+ continue;
668
+ if (check.kind === "content") {
669
+ commandsMetadata[check.commandName] = check.metadata;
670
+ continue;
671
+ }
672
+ if (check.exists) {
673
+ validPaths.push(check.fullPath);
674
+ commandsMetadata[check.commandName] = check.metadata;
675
+ } else {
676
+ logForDebugging(`Command ${check.commandName} path ${check.metadata.source} specified in manifest but not found at ${check.fullPath} for ${manifest.name}`, { level: "warn" });
677
+ logError(new Error(`Plugin component file not found: ${check.fullPath} for ${manifest.name}`));
678
+ errors.push({
679
+ type: "path-not-found",
680
+ source,
681
+ plugin: manifest.name,
682
+ path: check.fullPath,
683
+ component: "commands"
684
+ });
685
+ }
686
+ }
687
+ if (validPaths.length > 0) {
688
+ plugin.commandsPaths = validPaths;
689
+ }
690
+ if (Object.keys(commandsMetadata).length > 0) {
691
+ plugin.commandsMetadata = commandsMetadata;
692
+ }
693
+ } else {
694
+ const commandPaths = Array.isArray(manifest.commands) ? manifest.commands : [manifest.commands];
695
+ const checks = await Promise.all(commandPaths.map(async (cmdPath) => {
696
+ if (typeof cmdPath !== "string") {
697
+ return { cmdPath, kind: "invalid" };
698
+ }
699
+ const fullPath = join(pluginPath, cmdPath);
700
+ return {
701
+ cmdPath,
702
+ kind: "path",
703
+ fullPath,
704
+ exists: await pathExists(fullPath)
705
+ };
706
+ }));
707
+ const validPaths = [];
708
+ for (const check of checks) {
709
+ if (check.kind === "invalid") {
710
+ logForDebugging(`Unexpected command format in manifest for ${manifest.name}`, { level: "error" });
711
+ continue;
712
+ }
713
+ if (check.exists) {
714
+ validPaths.push(check.fullPath);
715
+ } else {
716
+ logForDebugging(`Command path ${check.cmdPath} specified in manifest but not found at ${check.fullPath} for ${manifest.name}`, { level: "warn" });
717
+ logError(new Error(`Plugin component file not found: ${check.fullPath} for ${manifest.name}`));
718
+ errors.push({
719
+ type: "path-not-found",
720
+ source,
721
+ plugin: manifest.name,
722
+ path: check.fullPath,
723
+ component: "commands"
724
+ });
725
+ }
726
+ }
727
+ if (validPaths.length > 0) {
728
+ plugin.commandsPaths = validPaths;
729
+ }
730
+ }
731
+ }
732
+ const agentsPath = join(pluginPath, "agents");
733
+ if (agentsDirExists) {
734
+ plugin.agentsPath = agentsPath;
735
+ }
736
+ if (manifest.agents) {
737
+ const agentPaths = Array.isArray(manifest.agents) ? manifest.agents : [manifest.agents];
738
+ const validPaths = await validatePluginPaths(agentPaths, pluginPath, manifest.name, source, "agents", "Agent", "specified in manifest but", errors);
739
+ if (validPaths.length > 0) {
740
+ plugin.agentsPaths = validPaths;
741
+ }
742
+ }
743
+ const skillsPath = join(pluginPath, "skills");
744
+ if (skillsDirExists) {
745
+ plugin.skillsPath = skillsPath;
746
+ }
747
+ if (manifest.skills) {
748
+ const skillPaths = Array.isArray(manifest.skills) ? manifest.skills : [manifest.skills];
749
+ const validPaths = await validatePluginPaths(skillPaths, pluginPath, manifest.name, source, "skills", "Skill", "specified in manifest but", errors);
750
+ if (validPaths.length > 0) {
751
+ plugin.skillsPaths = validPaths;
752
+ }
753
+ }
754
+ const outputStylesPath = join(pluginPath, "output-styles");
755
+ if (outputStylesDirExists) {
756
+ plugin.outputStylesPath = outputStylesPath;
757
+ }
758
+ if (manifest.outputStyles) {
759
+ const outputStylePaths = Array.isArray(manifest.outputStyles) ? manifest.outputStyles : [manifest.outputStyles];
760
+ const validPaths = await validatePluginPaths(outputStylePaths, pluginPath, manifest.name, source, "output-styles", "Output style", "specified in manifest but", errors);
761
+ if (validPaths.length > 0) {
762
+ plugin.outputStylesPaths = validPaths;
763
+ }
764
+ }
765
+ let mergedHooks;
766
+ const loadedHookPaths = new Set;
767
+ const standardHooksPath = join(pluginPath, "hooks", "hooks.json");
768
+ if (await pathExists(standardHooksPath)) {
769
+ try {
770
+ mergedHooks = await loadPluginHooks(standardHooksPath, manifest.name);
771
+ try {
772
+ loadedHookPaths.add(await realpath(standardHooksPath));
773
+ } catch {
774
+ loadedHookPaths.add(standardHooksPath);
775
+ }
776
+ logForDebugging(`Loaded hooks from standard location for plugin ${manifest.name}: ${standardHooksPath}`);
777
+ } catch (error) {
778
+ const errorMsg = errorMessage(error);
779
+ logForDebugging(`Failed to load hooks for ${manifest.name}: ${errorMsg}`, {
780
+ level: "error"
781
+ });
782
+ logError(toError(error));
783
+ errors.push({
784
+ type: "hook-load-failed",
785
+ source,
786
+ plugin: manifest.name,
787
+ hookPath: standardHooksPath,
788
+ reason: errorMsg
789
+ });
790
+ }
791
+ }
792
+ if (manifest.hooks) {
793
+ const manifestHooksArray = Array.isArray(manifest.hooks) ? manifest.hooks : [manifest.hooks];
794
+ for (const hookSpec of manifestHooksArray) {
795
+ if (typeof hookSpec === "string") {
796
+ const hookFilePath = join(pluginPath, hookSpec);
797
+ if (!await pathExists(hookFilePath)) {
798
+ logForDebugging(`Hooks file ${hookSpec} specified in manifest but not found at ${hookFilePath} for ${manifest.name}`, { level: "error" });
799
+ logError(new Error(`Plugin component file not found: ${hookFilePath} for ${manifest.name}`));
800
+ errors.push({
801
+ type: "path-not-found",
802
+ source,
803
+ plugin: manifest.name,
804
+ path: hookFilePath,
805
+ component: "hooks"
806
+ });
807
+ continue;
808
+ }
809
+ let normalizedPath;
810
+ try {
811
+ normalizedPath = await realpath(hookFilePath);
812
+ } catch {
813
+ normalizedPath = hookFilePath;
814
+ }
815
+ if (loadedHookPaths.has(normalizedPath)) {
816
+ logForDebugging(`Skipping duplicate hooks file for plugin ${manifest.name}: ${hookSpec} ` + `(resolves to already-loaded file: ${normalizedPath})`);
817
+ if (strict) {
818
+ const errorMsg = `Duplicate hooks file detected: ${hookSpec} resolves to already-loaded file ${normalizedPath}. The standard hooks/hooks.json is loaded automatically, so manifest.hooks should only reference additional hook files.`;
819
+ logError(new Error(errorMsg));
820
+ errors.push({
821
+ type: "hook-load-failed",
822
+ source,
823
+ plugin: manifest.name,
824
+ hookPath: hookFilePath,
825
+ reason: errorMsg
826
+ });
827
+ }
828
+ continue;
829
+ }
830
+ try {
831
+ const additionalHooks = await loadPluginHooks(hookFilePath, manifest.name);
832
+ try {
833
+ mergedHooks = mergeHooksSettings(mergedHooks, additionalHooks);
834
+ loadedHookPaths.add(normalizedPath);
835
+ logForDebugging(`Loaded and merged hooks from manifest for plugin ${manifest.name}: ${hookSpec}`);
836
+ } catch (mergeError) {
837
+ const mergeErrorMsg = errorMessage(mergeError);
838
+ logForDebugging(`Failed to merge hooks from ${hookSpec} for ${manifest.name}: ${mergeErrorMsg}`, { level: "error" });
839
+ logError(toError(mergeError));
840
+ errors.push({
841
+ type: "hook-load-failed",
842
+ source,
843
+ plugin: manifest.name,
844
+ hookPath: hookFilePath,
845
+ reason: `Failed to merge: ${mergeErrorMsg}`
846
+ });
847
+ }
848
+ } catch (error) {
849
+ const errorMsg = errorMessage(error);
850
+ logForDebugging(`Failed to load hooks from ${hookSpec} for ${manifest.name}: ${errorMsg}`, { level: "error" });
851
+ logError(toError(error));
852
+ errors.push({
853
+ type: "hook-load-failed",
854
+ source,
855
+ plugin: manifest.name,
856
+ hookPath: hookFilePath,
857
+ reason: errorMsg
858
+ });
859
+ }
860
+ } else if (typeof hookSpec === "object") {
861
+ mergedHooks = mergeHooksSettings(mergedHooks, hookSpec);
862
+ }
863
+ }
864
+ }
865
+ if (mergedHooks) {
866
+ plugin.hooksConfig = mergedHooks;
867
+ }
868
+ const pluginSettings = await loadPluginSettings(pluginPath, manifest);
869
+ if (pluginSettings) {
870
+ plugin.settings = pluginSettings;
871
+ }
872
+ return { plugin, errors };
873
+ }
874
+ const PluginSettingsSchema = lazySchema(() => SettingsSchema().pick({
875
+ agent: true
876
+ }).strip());
877
+ function parsePluginSettings(raw) {
878
+ const result = PluginSettingsSchema().safeParse(raw);
879
+ if (!result.success) {
880
+ return;
881
+ }
882
+ const data = result.data;
883
+ if (Object.keys(data).length === 0) {
884
+ return;
885
+ }
886
+ return data;
887
+ }
888
+ async function loadPluginSettings(pluginPath, manifest) {
889
+ const settingsJsonPath = join(pluginPath, "settings.json");
890
+ try {
891
+ const content = await readFile(settingsJsonPath, { encoding: "utf-8" });
892
+ const parsed = jsonParse(content);
893
+ if (isRecord(parsed)) {
894
+ const filtered = parsePluginSettings(parsed);
895
+ if (filtered) {
896
+ logForDebugging(`Loaded settings from settings.json for plugin ${manifest.name}`);
897
+ return filtered;
898
+ }
899
+ }
900
+ } catch (e) {
901
+ if (!isFsInaccessible(e)) {
902
+ logForDebugging(`Failed to parse settings.json for plugin ${manifest.name}: ${e}`, { level: "warn" });
903
+ }
904
+ }
905
+ if (manifest.settings) {
906
+ const filtered = parsePluginSettings(manifest.settings);
907
+ if (filtered) {
908
+ logForDebugging(`Loaded settings from manifest for plugin ${manifest.name}`);
909
+ return filtered;
910
+ }
911
+ }
912
+ return;
913
+ }
914
+ function mergeHooksSettings(base, additional) {
915
+ if (!base) {
916
+ return additional;
917
+ }
918
+ const merged = { ...base };
919
+ for (const [event, matchers] of Object.entries(additional)) {
920
+ if (!merged[event]) {
921
+ merged[event] = matchers;
922
+ } else {
923
+ merged[event] = [
924
+ ...merged[event] || [],
925
+ ...matchers
926
+ ];
927
+ }
928
+ }
929
+ return merged;
930
+ }
931
+ async function loadPluginsFromMarketplaces({
932
+ cacheOnly
933
+ }) {
934
+ const settings = getSettings_DEPRECATED();
935
+ const enabledPlugins = {
936
+ ...getAddDirEnabledPlugins(),
937
+ ...settings.enabledPlugins || {}
938
+ };
939
+ const plugins = [];
940
+ const errors = [];
941
+ const marketplacePluginEntries = Object.entries(enabledPlugins).filter(([key, value]) => {
942
+ const isValidFormat = PluginIdSchema().safeParse(key).success;
943
+ if (!isValidFormat || value === undefined)
944
+ return false;
945
+ const { marketplace } = parsePluginIdentifier(key);
946
+ return marketplace !== BUILTIN_MARKETPLACE_NAME;
947
+ });
948
+ const knownMarketplaces = await loadKnownMarketplacesConfigSafe();
949
+ const strictAllowlist = getStrictKnownMarketplaces();
950
+ const blocklist = getBlockedMarketplaces();
951
+ const hasEnterprisePolicy = strictAllowlist !== null || blocklist !== null && blocklist.length > 0;
952
+ const uniqueMarketplaces = new Set(marketplacePluginEntries.map(([pluginId]) => parsePluginIdentifier(pluginId).marketplace).filter((m) => !!m));
953
+ const marketplaceCatalogs = new Map;
954
+ await Promise.all([...uniqueMarketplaces].map(async (name) => {
955
+ marketplaceCatalogs.set(name, await getMarketplaceCacheOnly(name));
956
+ }));
957
+ const installedPluginsData = getInMemoryInstalledPlugins();
958
+ const results = await Promise.allSettled(marketplacePluginEntries.map(async ([pluginId, enabledValue]) => {
959
+ const { name: pluginName, marketplace: marketplaceName } = parsePluginIdentifier(pluginId);
960
+ const marketplaceConfig = knownMarketplaces[marketplaceName];
961
+ if (!marketplaceConfig && hasEnterprisePolicy) {
962
+ errors.push({
963
+ type: "marketplace-blocked-by-policy",
964
+ source: pluginId,
965
+ plugin: pluginName,
966
+ marketplace: marketplaceName,
967
+ blockedByBlocklist: strictAllowlist === null,
968
+ allowedSources: (strictAllowlist ?? []).map((s) => formatSourceForDisplay(s))
969
+ });
970
+ return null;
971
+ }
972
+ if (marketplaceConfig && !isSourceAllowedByPolicy(marketplaceConfig.source)) {
973
+ const isBlocked = isSourceInBlocklist(marketplaceConfig.source);
974
+ const allowlist = getStrictKnownMarketplaces() || [];
975
+ errors.push({
976
+ type: "marketplace-blocked-by-policy",
977
+ source: pluginId,
978
+ plugin: pluginName,
979
+ marketplace: marketplaceName,
980
+ blockedByBlocklist: isBlocked,
981
+ allowedSources: isBlocked ? [] : allowlist.map((s) => formatSourceForDisplay(s))
982
+ });
983
+ return null;
984
+ }
985
+ let result = null;
986
+ const marketplace = marketplaceCatalogs.get(marketplaceName);
987
+ if (marketplace && marketplaceConfig) {
988
+ const entry = marketplace.plugins.find((p) => p.name === pluginName);
989
+ if (entry) {
990
+ result = {
991
+ entry,
992
+ marketplaceInstallLocation: marketplaceConfig.installLocation
993
+ };
994
+ }
995
+ } else {
996
+ result = await getPluginByIdCacheOnly(pluginId);
997
+ }
998
+ if (!result) {
999
+ errors.push({
1000
+ type: "plugin-not-found",
1001
+ source: pluginId,
1002
+ pluginId: pluginName,
1003
+ marketplace: marketplaceName
1004
+ });
1005
+ return null;
1006
+ }
1007
+ const installEntry = installedPluginsData.plugins[pluginId]?.[0];
1008
+ return cacheOnly ? loadPluginFromMarketplaceEntryCacheOnly(result.entry, result.marketplaceInstallLocation, pluginId, enabledValue === true, errors, installEntry?.installPath) : loadPluginFromMarketplaceEntry(result.entry, result.marketplaceInstallLocation, pluginId, enabledValue === true, errors, installEntry?.version);
1009
+ }));
1010
+ for (const [i, result] of results.entries()) {
1011
+ if (result.status === "fulfilled" && result.value) {
1012
+ plugins.push(result.value);
1013
+ } else if (result.status === "rejected") {
1014
+ const err = toError(result.reason);
1015
+ logError(err);
1016
+ const pluginId = marketplacePluginEntries[i][0];
1017
+ errors.push({
1018
+ type: "generic-error",
1019
+ source: pluginId,
1020
+ plugin: pluginId.split("@")[0],
1021
+ error: err.message
1022
+ });
1023
+ }
1024
+ }
1025
+ return { plugins, errors };
1026
+ }
1027
+ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstallLocation, pluginId, enabled, errorsOut, installPath) {
1028
+ let pluginPath;
1029
+ if (typeof entry.source === "string") {
1030
+ let marketplaceDir;
1031
+ try {
1032
+ marketplaceDir = (await stat(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation : join(marketplaceInstallLocation, "..");
1033
+ } catch {
1034
+ errorsOut.push({
1035
+ type: "plugin-cache-miss",
1036
+ source: pluginId,
1037
+ plugin: entry.name,
1038
+ installPath: marketplaceInstallLocation
1039
+ });
1040
+ return null;
1041
+ }
1042
+ pluginPath = join(marketplaceDir, entry.source);
1043
+ } else {
1044
+ if (!installPath || !await pathExists(installPath)) {
1045
+ errorsOut.push({
1046
+ type: "plugin-cache-miss",
1047
+ source: pluginId,
1048
+ plugin: entry.name,
1049
+ installPath: installPath ?? "(not recorded)"
1050
+ });
1051
+ return null;
1052
+ }
1053
+ pluginPath = installPath;
1054
+ }
1055
+ if (isPluginZipCacheEnabled() && pluginPath.endsWith(".zip")) {
1056
+ const sessionDir = await getSessionPluginCachePath();
1057
+ const extractDir = join(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, "-"));
1058
+ try {
1059
+ await extractZipToDirectory(pluginPath, extractDir);
1060
+ pluginPath = extractDir;
1061
+ } catch (error) {
1062
+ logForDebugging(`Failed to extract plugin ZIP ${pluginPath}: ${error}`, {
1063
+ level: "error"
1064
+ });
1065
+ errorsOut.push({
1066
+ type: "plugin-cache-miss",
1067
+ source: pluginId,
1068
+ plugin: entry.name,
1069
+ installPath: pluginPath
1070
+ });
1071
+ return null;
1072
+ }
1073
+ }
1074
+ return finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath);
1075
+ }
1076
+ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation, pluginId, enabled, errorsOut, installedVersion) {
1077
+ logForDebugging(`Loading plugin ${entry.name} from source: ${jsonStringify(entry.source)}`);
1078
+ let pluginPath;
1079
+ if (typeof entry.source === "string") {
1080
+ const marketplaceDir = (await stat(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation : join(marketplaceInstallLocation, "..");
1081
+ const sourcePluginPath = join(marketplaceDir, entry.source);
1082
+ if (!await pathExists(sourcePluginPath)) {
1083
+ const error = new Error(`Plugin path not found: ${sourcePluginPath}`);
1084
+ logForDebugging(`Plugin path not found: ${sourcePluginPath}`, {
1085
+ level: "error"
1086
+ });
1087
+ logError(error);
1088
+ errorsOut.push({
1089
+ type: "generic-error",
1090
+ source: pluginId,
1091
+ error: `Plugin directory not found at path: ${sourcePluginPath}. Check that the marketplace entry has the correct path.`
1092
+ });
1093
+ return null;
1094
+ }
1095
+ try {
1096
+ const manifestPath = join(sourcePluginPath, ".claude-plugin", "plugin.json");
1097
+ let pluginManifest;
1098
+ try {
1099
+ pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
1100
+ } catch {}
1101
+ const version = await calculatePluginVersion(pluginId, entry.source, pluginManifest, marketplaceDir, entry.version);
1102
+ pluginPath = await copyPluginToVersionedCache(sourcePluginPath, pluginId, version, entry, marketplaceDir);
1103
+ logForDebugging(`Resolved local plugin ${entry.name} to versioned cache: ${pluginPath}`);
1104
+ } catch (error) {
1105
+ const errorMsg = errorMessage(error);
1106
+ logForDebugging(`Failed to copy plugin ${entry.name} to versioned cache: ${errorMsg}. Using marketplace path.`, { level: "warn" });
1107
+ pluginPath = sourcePluginPath;
1108
+ }
1109
+ } else {
1110
+ try {
1111
+ const version = await calculatePluginVersion(pluginId, entry.source, undefined, undefined, installedVersion ?? entry.version, "sha" in entry.source ? entry.source.sha : undefined);
1112
+ const versionedPath = getVersionedCachePath(pluginId, version);
1113
+ const zipPath = getVersionedZipCachePath(pluginId, version);
1114
+ if (isPluginZipCacheEnabled() && await pathExists(zipPath)) {
1115
+ logForDebugging(`Using versioned cached plugin ZIP ${entry.name} from ${zipPath}`);
1116
+ pluginPath = zipPath;
1117
+ } else if (await pathExists(versionedPath)) {
1118
+ logForDebugging(`Using versioned cached plugin ${entry.name} from ${versionedPath}`);
1119
+ pluginPath = versionedPath;
1120
+ } else {
1121
+ const seedPath = await probeSeedCache(pluginId, version) ?? (version === "unknown" ? await probeSeedCacheAnyVersion(pluginId) : null);
1122
+ if (seedPath) {
1123
+ pluginPath = seedPath;
1124
+ logForDebugging(`Using seed cache for external plugin ${entry.name} at ${seedPath}`);
1125
+ } else {
1126
+ const cached = await cachePlugin(entry.source, {
1127
+ manifest: { name: entry.name }
1128
+ });
1129
+ const actualVersion = version !== "unknown" ? version : await calculatePluginVersion(pluginId, entry.source, cached.manifest, cached.path, installedVersion ?? entry.version, cached.gitCommitSha);
1130
+ pluginPath = await copyPluginToVersionedCache(cached.path, pluginId, actualVersion, entry, undefined);
1131
+ if (cached.path !== pluginPath) {
1132
+ await rm(cached.path, { recursive: true, force: true });
1133
+ }
1134
+ }
1135
+ }
1136
+ } catch (error) {
1137
+ const errorMsg = errorMessage(error);
1138
+ logForDebugging(`Failed to cache plugin ${entry.name}: ${errorMsg}`, {
1139
+ level: "error"
1140
+ });
1141
+ logError(toError(error));
1142
+ errorsOut.push({
1143
+ type: "generic-error",
1144
+ source: pluginId,
1145
+ error: `Failed to download/cache plugin ${entry.name}: ${errorMsg}`
1146
+ });
1147
+ return null;
1148
+ }
1149
+ }
1150
+ if (isPluginZipCacheEnabled() && pluginPath.endsWith(".zip")) {
1151
+ const sessionDir = await getSessionPluginCachePath();
1152
+ const extractDir = join(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, "-"));
1153
+ try {
1154
+ await extractZipToDirectory(pluginPath, extractDir);
1155
+ logForDebugging(`Extracted plugin ZIP to session dir: ${extractDir}`);
1156
+ pluginPath = extractDir;
1157
+ } catch (error) {
1158
+ logForDebugging(`Failed to extract plugin ZIP ${pluginPath}, deleting corrupt file: ${error}`);
1159
+ await rm(pluginPath, { force: true }).catch(() => {});
1160
+ throw error;
1161
+ }
1162
+ }
1163
+ return finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath);
1164
+ }
1165
+ async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath) {
1166
+ const errors = [];
1167
+ const manifestPath = join(pluginPath, ".claude-plugin", "plugin.json");
1168
+ const hasManifest = await pathExists(manifestPath);
1169
+ const { plugin, errors: pluginErrors } = await createPluginFromPath(pluginPath, pluginId, enabled, entry.name, entry.strict ?? true);
1170
+ errors.push(...pluginErrors);
1171
+ if (typeof entry.source === "object" && "sha" in entry.source && entry.source.sha) {
1172
+ plugin.sha = entry.source.sha;
1173
+ }
1174
+ if (!hasManifest) {
1175
+ plugin.manifest = {
1176
+ ...entry,
1177
+ id: undefined,
1178
+ source: undefined,
1179
+ strict: undefined
1180
+ };
1181
+ plugin.name = plugin.manifest.name;
1182
+ if (entry.commands) {
1183
+ const firstValue = Object.values(entry.commands)[0];
1184
+ if (typeof entry.commands === "object" && !Array.isArray(entry.commands) && firstValue && typeof firstValue === "object" && (("source" in firstValue) || ("content" in firstValue))) {
1185
+ const commandsMetadata = {};
1186
+ const validPaths = [];
1187
+ const entries = Object.entries(entry.commands);
1188
+ const checks = await Promise.all(entries.map(async ([commandName, metadata]) => {
1189
+ if (!metadata || typeof metadata !== "object" || !metadata.source) {
1190
+ return { commandName, metadata, skip: true };
1191
+ }
1192
+ const fullPath = join(pluginPath, metadata.source);
1193
+ return {
1194
+ commandName,
1195
+ metadata,
1196
+ skip: false,
1197
+ fullPath,
1198
+ exists: await pathExists(fullPath)
1199
+ };
1200
+ }));
1201
+ for (const check of checks) {
1202
+ if (check.skip)
1203
+ continue;
1204
+ if (check.exists) {
1205
+ validPaths.push(check.fullPath);
1206
+ commandsMetadata[check.commandName] = check.metadata;
1207
+ } else {
1208
+ logForDebugging(`Command ${check.commandName} path ${check.metadata.source} from marketplace entry not found at ${check.fullPath} for ${entry.name}`, { level: "warn" });
1209
+ logError(new Error(`Plugin component file not found: ${check.fullPath} for ${entry.name}`));
1210
+ errors.push({
1211
+ type: "path-not-found",
1212
+ source: pluginId,
1213
+ plugin: entry.name,
1214
+ path: check.fullPath,
1215
+ component: "commands"
1216
+ });
1217
+ }
1218
+ }
1219
+ if (validPaths.length > 0) {
1220
+ plugin.commandsPaths = validPaths;
1221
+ plugin.commandsMetadata = commandsMetadata;
1222
+ }
1223
+ } else {
1224
+ const commandPaths = Array.isArray(entry.commands) ? entry.commands : [entry.commands];
1225
+ const checks = await Promise.all(commandPaths.map(async (cmdPath) => {
1226
+ if (typeof cmdPath !== "string") {
1227
+ return { cmdPath, kind: "invalid" };
1228
+ }
1229
+ const fullPath = join(pluginPath, cmdPath);
1230
+ return {
1231
+ cmdPath,
1232
+ kind: "path",
1233
+ fullPath,
1234
+ exists: await pathExists(fullPath)
1235
+ };
1236
+ }));
1237
+ const validPaths = [];
1238
+ for (const check of checks) {
1239
+ if (check.kind === "invalid") {
1240
+ logForDebugging(`Unexpected command format in marketplace entry for ${entry.name}`, { level: "error" });
1241
+ continue;
1242
+ }
1243
+ if (check.exists) {
1244
+ validPaths.push(check.fullPath);
1245
+ } else {
1246
+ logForDebugging(`Command path ${check.cmdPath} from marketplace entry not found at ${check.fullPath} for ${entry.name}`, { level: "warn" });
1247
+ logError(new Error(`Plugin component file not found: ${check.fullPath} for ${entry.name}`));
1248
+ errors.push({
1249
+ type: "path-not-found",
1250
+ source: pluginId,
1251
+ plugin: entry.name,
1252
+ path: check.fullPath,
1253
+ component: "commands"
1254
+ });
1255
+ }
1256
+ }
1257
+ if (validPaths.length > 0) {
1258
+ plugin.commandsPaths = validPaths;
1259
+ }
1260
+ }
1261
+ }
1262
+ if (entry.agents) {
1263
+ const agentPaths = Array.isArray(entry.agents) ? entry.agents : [entry.agents];
1264
+ const validPaths = await validatePluginPaths(agentPaths, pluginPath, entry.name, pluginId, "agents", "Agent", "from marketplace entry", errors);
1265
+ if (validPaths.length > 0) {
1266
+ plugin.agentsPaths = validPaths;
1267
+ }
1268
+ }
1269
+ if (entry.skills) {
1270
+ logForDebugging(`Processing ${Array.isArray(entry.skills) ? entry.skills.length : 1} skill paths for plugin ${entry.name}`);
1271
+ const skillPaths = Array.isArray(entry.skills) ? entry.skills : [entry.skills];
1272
+ const checks = await Promise.all(skillPaths.map(async (skillPath) => {
1273
+ const fullPath = join(pluginPath, skillPath);
1274
+ return { skillPath, fullPath, exists: await pathExists(fullPath) };
1275
+ }));
1276
+ const validPaths = [];
1277
+ for (const { skillPath, fullPath, exists } of checks) {
1278
+ logForDebugging(`Checking skill path: ${skillPath} -> ${fullPath} (exists: ${exists})`);
1279
+ if (exists) {
1280
+ validPaths.push(fullPath);
1281
+ } else {
1282
+ logForDebugging(`Skill path ${skillPath} from marketplace entry not found at ${fullPath} for ${entry.name}`, { level: "warn" });
1283
+ logError(new Error(`Plugin component file not found: ${fullPath} for ${entry.name}`));
1284
+ errors.push({
1285
+ type: "path-not-found",
1286
+ source: pluginId,
1287
+ plugin: entry.name,
1288
+ path: fullPath,
1289
+ component: "skills"
1290
+ });
1291
+ }
1292
+ }
1293
+ logForDebugging(`Found ${validPaths.length} valid skill paths for plugin ${entry.name}, setting skillsPaths`);
1294
+ if (validPaths.length > 0) {
1295
+ plugin.skillsPaths = validPaths;
1296
+ }
1297
+ } else {
1298
+ logForDebugging(`Plugin ${entry.name} has no entry.skills defined`);
1299
+ }
1300
+ if (entry.outputStyles) {
1301
+ const outputStylePaths = Array.isArray(entry.outputStyles) ? entry.outputStyles : [entry.outputStyles];
1302
+ const validPaths = await validatePluginPaths(outputStylePaths, pluginPath, entry.name, pluginId, "output-styles", "Output style", "from marketplace entry", errors);
1303
+ if (validPaths.length > 0) {
1304
+ plugin.outputStylesPaths = validPaths;
1305
+ }
1306
+ }
1307
+ if (entry.hooks) {
1308
+ plugin.hooksConfig = entry.hooks;
1309
+ }
1310
+ } else if (!entry.strict && hasManifest && (entry.commands || entry.agents || entry.skills || entry.hooks || entry.outputStyles)) {
1311
+ const error = new Error(`Plugin ${entry.name} has both plugin.json and marketplace manifest entries for commands/agents/skills/hooks/outputStyles. This is a conflict.`);
1312
+ logForDebugging(`Plugin ${entry.name} has both plugin.json and marketplace manifest entries for commands/agents/skills/hooks/outputStyles. This is a conflict.`, { level: "error" });
1313
+ logError(error);
1314
+ errorsOut.push({
1315
+ type: "generic-error",
1316
+ source: pluginId,
1317
+ error: `Plugin ${entry.name} has conflicting manifests: both plugin.json and marketplace entry specify components. Set strict: true in marketplace entry or remove component specs from one location.`
1318
+ });
1319
+ return null;
1320
+ } else if (hasManifest) {
1321
+ if (entry.commands) {
1322
+ const firstValue = Object.values(entry.commands)[0];
1323
+ if (typeof entry.commands === "object" && !Array.isArray(entry.commands) && firstValue && typeof firstValue === "object" && (("source" in firstValue) || ("content" in firstValue))) {
1324
+ const commandsMetadata = {
1325
+ ...plugin.commandsMetadata || {}
1326
+ };
1327
+ const validPaths = [];
1328
+ const entries = Object.entries(entry.commands);
1329
+ const checks = await Promise.all(entries.map(async ([commandName, metadata]) => {
1330
+ if (!metadata || typeof metadata !== "object" || !metadata.source) {
1331
+ return { commandName, metadata, skip: true };
1332
+ }
1333
+ const fullPath = join(pluginPath, metadata.source);
1334
+ return {
1335
+ commandName,
1336
+ metadata,
1337
+ skip: false,
1338
+ fullPath,
1339
+ exists: await pathExists(fullPath)
1340
+ };
1341
+ }));
1342
+ for (const check of checks) {
1343
+ if (check.skip)
1344
+ continue;
1345
+ if (check.exists) {
1346
+ validPaths.push(check.fullPath);
1347
+ commandsMetadata[check.commandName] = check.metadata;
1348
+ } else {
1349
+ logForDebugging(`Command ${check.commandName} path ${check.metadata.source} from marketplace entry not found at ${check.fullPath} for ${entry.name}`, { level: "warn" });
1350
+ logError(new Error(`Plugin component file not found: ${check.fullPath} for ${entry.name}`));
1351
+ errors.push({
1352
+ type: "path-not-found",
1353
+ source: pluginId,
1354
+ plugin: entry.name,
1355
+ path: check.fullPath,
1356
+ component: "commands"
1357
+ });
1358
+ }
1359
+ }
1360
+ if (validPaths.length > 0) {
1361
+ plugin.commandsPaths = [
1362
+ ...plugin.commandsPaths || [],
1363
+ ...validPaths
1364
+ ];
1365
+ plugin.commandsMetadata = commandsMetadata;
1366
+ }
1367
+ } else {
1368
+ const commandPaths = Array.isArray(entry.commands) ? entry.commands : [entry.commands];
1369
+ const checks = await Promise.all(commandPaths.map(async (cmdPath) => {
1370
+ if (typeof cmdPath !== "string") {
1371
+ return { cmdPath, kind: "invalid" };
1372
+ }
1373
+ const fullPath = join(pluginPath, cmdPath);
1374
+ return {
1375
+ cmdPath,
1376
+ kind: "path",
1377
+ fullPath,
1378
+ exists: await pathExists(fullPath)
1379
+ };
1380
+ }));
1381
+ const validPaths = [];
1382
+ for (const check of checks) {
1383
+ if (check.kind === "invalid") {
1384
+ logForDebugging(`Unexpected command format in marketplace entry for ${entry.name}`, { level: "error" });
1385
+ continue;
1386
+ }
1387
+ if (check.exists) {
1388
+ validPaths.push(check.fullPath);
1389
+ } else {
1390
+ logForDebugging(`Command path ${check.cmdPath} from marketplace entry not found at ${check.fullPath} for ${entry.name}`, { level: "warn" });
1391
+ logError(new Error(`Plugin component file not found: ${check.fullPath} for ${entry.name}`));
1392
+ errors.push({
1393
+ type: "path-not-found",
1394
+ source: pluginId,
1395
+ plugin: entry.name,
1396
+ path: check.fullPath,
1397
+ component: "commands"
1398
+ });
1399
+ }
1400
+ }
1401
+ if (validPaths.length > 0) {
1402
+ plugin.commandsPaths = [
1403
+ ...plugin.commandsPaths || [],
1404
+ ...validPaths
1405
+ ];
1406
+ }
1407
+ }
1408
+ }
1409
+ if (entry.agents) {
1410
+ const agentPaths = Array.isArray(entry.agents) ? entry.agents : [entry.agents];
1411
+ const validPaths = await validatePluginPaths(agentPaths, pluginPath, entry.name, pluginId, "agents", "Agent", "from marketplace entry", errors);
1412
+ if (validPaths.length > 0) {
1413
+ plugin.agentsPaths = [...plugin.agentsPaths || [], ...validPaths];
1414
+ }
1415
+ }
1416
+ if (entry.skills) {
1417
+ const skillPaths = Array.isArray(entry.skills) ? entry.skills : [entry.skills];
1418
+ const validPaths = await validatePluginPaths(skillPaths, pluginPath, entry.name, pluginId, "skills", "Skill", "from marketplace entry", errors);
1419
+ if (validPaths.length > 0) {
1420
+ plugin.skillsPaths = [...plugin.skillsPaths || [], ...validPaths];
1421
+ }
1422
+ }
1423
+ if (entry.outputStyles) {
1424
+ const outputStylePaths = Array.isArray(entry.outputStyles) ? entry.outputStyles : [entry.outputStyles];
1425
+ const validPaths = await validatePluginPaths(outputStylePaths, pluginPath, entry.name, pluginId, "output-styles", "Output style", "from marketplace entry", errors);
1426
+ if (validPaths.length > 0) {
1427
+ plugin.outputStylesPaths = [
1428
+ ...plugin.outputStylesPaths || [],
1429
+ ...validPaths
1430
+ ];
1431
+ }
1432
+ }
1433
+ if (entry.hooks) {
1434
+ plugin.hooksConfig = {
1435
+ ...plugin.hooksConfig || {},
1436
+ ...entry.hooks
1437
+ };
1438
+ }
1439
+ }
1440
+ errorsOut.push(...errors);
1441
+ return plugin;
1442
+ }
1443
+ async function loadSessionOnlyPlugins(sessionPluginPaths) {
1444
+ if (sessionPluginPaths.length === 0) {
1445
+ return { plugins: [], errors: [] };
1446
+ }
1447
+ const plugins = [];
1448
+ const errors = [];
1449
+ for (const [index, pluginPath] of sessionPluginPaths.entries()) {
1450
+ try {
1451
+ const resolvedPath = resolve(pluginPath);
1452
+ if (!await pathExists(resolvedPath)) {
1453
+ logForDebugging(`Plugin path does not exist: ${resolvedPath}, skipping`, { level: "warn" });
1454
+ errors.push({
1455
+ type: "path-not-found",
1456
+ source: `inline[${index}]`,
1457
+ path: resolvedPath,
1458
+ component: "commands"
1459
+ });
1460
+ continue;
1461
+ }
1462
+ const dirName = basename(resolvedPath);
1463
+ const { plugin, errors: pluginErrors } = await createPluginFromPath(resolvedPath, `${dirName}@inline`, true, dirName);
1464
+ plugin.source = `${plugin.name}@inline`;
1465
+ plugin.repository = `${plugin.name}@inline`;
1466
+ plugins.push(plugin);
1467
+ errors.push(...pluginErrors);
1468
+ logForDebugging(`Loaded inline plugin from path: ${plugin.name}`);
1469
+ } catch (error) {
1470
+ const errorMsg = errorMessage(error);
1471
+ logForDebugging(`Failed to load session plugin from ${pluginPath}: ${errorMsg}`, { level: "warn" });
1472
+ errors.push({
1473
+ type: "generic-error",
1474
+ source: `inline[${index}]`,
1475
+ error: `Failed to load plugin: ${errorMsg}`
1476
+ });
1477
+ }
1478
+ }
1479
+ if (plugins.length > 0) {
1480
+ logForDebugging(`Loaded ${plugins.length} session-only plugins from --plugin-dir`);
1481
+ }
1482
+ return { plugins, errors };
1483
+ }
1484
+ export function mergePluginSources(sources) {
1485
+ const errors = [];
1486
+ const managed = sources.managedNames;
1487
+ const sessionPlugins = sources.session.filter((p) => {
1488
+ if (managed?.has(p.name)) {
1489
+ logForDebugging(`Plugin "${p.name}" from --plugin-dir is blocked by managed settings`, { level: "warn" });
1490
+ errors.push({
1491
+ type: "generic-error",
1492
+ source: p.source,
1493
+ plugin: p.name,
1494
+ error: `--plugin-dir copy of "${p.name}" ignored: plugin is locked by managed settings`
1495
+ });
1496
+ return false;
1497
+ }
1498
+ return true;
1499
+ });
1500
+ const sessionNames = new Set(sessionPlugins.map((p) => p.name));
1501
+ const marketplacePlugins = sources.marketplace.filter((p) => {
1502
+ if (sessionNames.has(p.name)) {
1503
+ logForDebugging(`Plugin "${p.name}" from --plugin-dir overrides installed version`);
1504
+ return false;
1505
+ }
1506
+ return true;
1507
+ });
1508
+ return {
1509
+ plugins: [...sessionPlugins, ...marketplacePlugins, ...sources.builtin],
1510
+ errors
1511
+ };
1512
+ }
1513
+ export const loadAllPlugins = memoize(async () => {
1514
+ const result = await assemblePluginLoadResult(() => loadPluginsFromMarketplaces({ cacheOnly: false }));
1515
+ loadAllPluginsCacheOnly.cache?.set(undefined, Promise.resolve(result));
1516
+ return result;
1517
+ });
1518
+ export const loadAllPluginsCacheOnly = memoize(async () => {
1519
+ if (isEnvTruthy(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)) {
1520
+ return loadAllPlugins();
1521
+ }
1522
+ return assemblePluginLoadResult(() => loadPluginsFromMarketplaces({ cacheOnly: true }));
1523
+ });
1524
+ async function assemblePluginLoadResult(marketplaceLoader) {
1525
+ const inlinePlugins = getInlinePlugins();
1526
+ const [marketplaceResult, sessionResult] = await Promise.all([
1527
+ marketplaceLoader(),
1528
+ inlinePlugins.length > 0 ? loadSessionOnlyPlugins(inlinePlugins) : Promise.resolve({ plugins: [], errors: [] })
1529
+ ]);
1530
+ const builtinResult = getBuiltinPlugins();
1531
+ const { plugins: allPlugins, errors: mergeErrors } = mergePluginSources({
1532
+ session: sessionResult.plugins,
1533
+ marketplace: marketplaceResult.plugins,
1534
+ builtin: [...builtinResult.enabled, ...builtinResult.disabled],
1535
+ managedNames: getManagedPluginNames()
1536
+ });
1537
+ const allErrors = [
1538
+ ...marketplaceResult.errors,
1539
+ ...sessionResult.errors,
1540
+ ...mergeErrors
1541
+ ];
1542
+ const { demoted, errors: depErrors } = verifyAndDemote(allPlugins);
1543
+ for (const p of allPlugins) {
1544
+ if (demoted.has(p.source))
1545
+ p.enabled = false;
1546
+ }
1547
+ allErrors.push(...depErrors);
1548
+ const enabledPlugins = allPlugins.filter((p) => p.enabled);
1549
+ logForDebugging(`Found ${allPlugins.length} plugins (${enabledPlugins.length} enabled, ${allPlugins.length - enabledPlugins.length} disabled)`);
1550
+ cachePluginSettings(enabledPlugins);
1551
+ return {
1552
+ enabled: enabledPlugins,
1553
+ disabled: allPlugins.filter((p) => !p.enabled),
1554
+ errors: allErrors
1555
+ };
1556
+ }
1557
+ export function clearPluginCache(reason) {
1558
+ if (reason) {
1559
+ logForDebugging(`clearPluginCache: invalidating loadAllPlugins cache (${reason})`);
1560
+ }
1561
+ loadAllPlugins.cache?.clear?.();
1562
+ loadAllPluginsCacheOnly.cache?.clear?.();
1563
+ if (getPluginSettingsBase() !== undefined) {
1564
+ resetSettingsCache();
1565
+ }
1566
+ clearPluginSettingsBase();
1567
+ }
1568
+ function mergePluginSettings(plugins) {
1569
+ let merged;
1570
+ for (const plugin of plugins) {
1571
+ if (!plugin.settings) {
1572
+ continue;
1573
+ }
1574
+ if (!merged) {
1575
+ merged = {};
1576
+ }
1577
+ for (const [key, value] of Object.entries(plugin.settings)) {
1578
+ if (key in merged) {
1579
+ logForDebugging(`Plugin "${plugin.name}" overrides setting "${key}" (previously set by another plugin)`);
1580
+ }
1581
+ merged[key] = value;
1582
+ }
1583
+ }
1584
+ return merged;
1585
+ }
1586
+ export function cachePluginSettings(plugins) {
1587
+ const settings = mergePluginSettings(plugins);
1588
+ setPluginSettingsBase(settings);
1589
+ if (settings && Object.keys(settings).length > 0) {
1590
+ resetSettingsCache();
1591
+ logForDebugging(`Cached plugin settings with keys: ${Object.keys(settings).join(", ")}`);
1592
+ }
1593
+ }
1594
+ function isRecord(value) {
1595
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1596
+ }