@iaforged/context-code 1.0.63 → 1.0.65

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 (2000) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +633 -9
  3. package/context-bootstrap.js +28 -28
  4. package/package.json +169 -170
  5. package/dist/src/QueryEngine.js +0 -928
  6. package/dist/src/Task.js +0 -49
  7. package/dist/src/Tool.js +0 -56
  8. package/dist/src/assistant/AssistantSessionChooser.js +0 -16
  9. package/dist/src/assistant/index.js +0 -16
  10. package/dist/src/assistant/sessionDiscovery.js +0 -16
  11. package/dist/src/assistant/sessionHistory.js +0 -47
  12. package/dist/src/bootstrap/state.js +0 -1165
  13. package/dist/src/bridge/bridgeApi.js +0 -304
  14. package/dist/src/bridge/bridgeConfig.js +0 -39
  15. package/dist/src/bridge/bridgeDebug.js +0 -73
  16. package/dist/src/bridge/bridgeEnabled.js +0 -187
  17. package/dist/src/bridge/bridgeMain.js +0 -2289
  18. package/dist/src/bridge/bridgeMessaging.js +0 -353
  19. package/dist/src/bridge/bridgePermissionCallbacks.js +0 -10
  20. package/dist/src/bridge/bridgePointer.js +0 -175
  21. package/dist/src/bridge/bridgeStatusUtil.js +0 -105
  22. package/dist/src/bridge/bridgeUI.js +0 -412
  23. package/dist/src/bridge/capacityWake.js +0 -35
  24. package/dist/src/bridge/codeSessionApi.js +0 -111
  25. package/dist/src/bridge/createSession.js +0 -273
  26. package/dist/src/bridge/debugUtils.js +0 -115
  27. package/dist/src/bridge/envLessBridgeConfig.js +0 -121
  28. package/dist/src/bridge/flushGate.js +0 -65
  29. package/dist/src/bridge/inboundAttachments.js +0 -152
  30. package/dist/src/bridge/inboundMessages.js +0 -63
  31. package/dist/src/bridge/initReplBridge.js +0 -428
  32. package/dist/src/bridge/jwtUtils.js +0 -185
  33. package/dist/src/bridge/pollConfig.js +0 -85
  34. package/dist/src/bridge/pollConfigDefaults.js +0 -62
  35. package/dist/src/bridge/remoteBridgeCore.js +0 -712
  36. package/dist/src/bridge/replBridge.js +0 -1720
  37. package/dist/src/bridge/replBridgeHandle.js +0 -30
  38. package/dist/src/bridge/replBridgeTransport.js +0 -236
  39. package/dist/src/bridge/sessionIdCompat.js +0 -56
  40. package/dist/src/bridge/sessionRunner.js +0 -421
  41. package/dist/src/bridge/trustedDevice.js +0 -172
  42. package/dist/src/bridge/types.js +0 -9
  43. package/dist/src/bridge/workSecret.js +0 -99
  44. package/dist/src/buddy/CompanionSprite.js +0 -349
  45. package/dist/src/buddy/companion.js +0 -107
  46. package/dist/src/buddy/prompt.js +0 -33
  47. package/dist/src/buddy/sprites.js +0 -488
  48. package/dist/src/buddy/types.js +0 -90
  49. package/dist/src/buddy/useBuddyNotification.js +0 -90
  50. package/dist/src/cli/bg.js +0 -16
  51. package/dist/src/cli/exit.js +0 -30
  52. package/dist/src/cli/handlers/agents.js +0 -55
  53. package/dist/src/cli/handlers/ant.js +0 -16
  54. package/dist/src/cli/handlers/auth.js +0 -312
  55. package/dist/src/cli/handlers/autoMode.js +0 -128
  56. package/dist/src/cli/handlers/mcp.js +0 -334
  57. package/dist/src/cli/handlers/plugins.js +0 -634
  58. package/dist/src/cli/handlers/projects_bridge.js +0 -40
  59. package/dist/src/cli/handlers/templateJobs.js +0 -16
  60. package/dist/src/cli/handlers/util.js +0 -76
  61. package/dist/src/cli/ndjsonSafeStringify.js +0 -27
  62. package/dist/src/cli/print.js +0 -4225
  63. package/dist/src/cli/remoteIO.js +0 -208
  64. package/dist/src/cli/rollback.js +0 -16
  65. package/dist/src/cli/structuredIO.js +0 -644
  66. package/dist/src/cli/transports/HybridTransport.js +0 -233
  67. package/dist/src/cli/transports/SSETransport.js +0 -538
  68. package/dist/src/cli/transports/SerialBatchEventUploader.js +0 -224
  69. package/dist/src/cli/transports/Transport.js +0 -1
  70. package/dist/src/cli/transports/WebSocketTransport.js +0 -613
  71. package/dist/src/cli/transports/WorkerStateUploader.js +0 -88
  72. package/dist/src/cli/transports/ccrClient.js +0 -711
  73. package/dist/src/cli/transports/transportUtils.js +0 -39
  74. package/dist/src/cli/up.js +0 -16
  75. package/dist/src/cli/update.js +0 -315
  76. package/dist/src/commands/add-dir/add-dir.js +0 -121
  77. package/dist/src/commands/add-dir/index.js +0 -8
  78. package/dist/src/commands/add-dir/validation.js +0 -76
  79. package/dist/src/commands/advisor.js +0 -88
  80. package/dist/src/commands/agents/agents.js +0 -9
  81. package/dist/src/commands/agents/index.js +0 -7
  82. package/dist/src/commands/ant-trace/index.js +0 -1
  83. package/dist/src/commands/assistant/assistant.js +0 -16
  84. package/dist/src/commands/autofix-pr/index.js +0 -1
  85. package/dist/src/commands/backfill-sessions/index.js +0 -1
  86. package/dist/src/commands/branch/branch.js +0 -205
  87. package/dist/src/commands/branch/index.js +0 -11
  88. package/dist/src/commands/break-cache/index.js +0 -1
  89. package/dist/src/commands/bridge/bridge.js +0 -512
  90. package/dist/src/commands/bridge/index.js +0 -22
  91. package/dist/src/commands/bridge-kick.js +0 -179
  92. package/dist/src/commands/brief.js +0 -94
  93. package/dist/src/commands/btw/btw.js +0 -234
  94. package/dist/src/commands/btw/index.js +0 -9
  95. package/dist/src/commands/bughunter/index.js +0 -1
  96. package/dist/src/commands/chrome/chrome.js +0 -291
  97. package/dist/src/commands/chrome/index.js +0 -10
  98. package/dist/src/commands/clear/caches.js +0 -116
  99. package/dist/src/commands/clear/clear.js +0 -5
  100. package/dist/src/commands/clear/conversation.js +0 -191
  101. package/dist/src/commands/clear/index.js +0 -9
  102. package/dist/src/commands/color/color.js +0 -58
  103. package/dist/src/commands/color/index.js +0 -9
  104. package/dist/src/commands/commit-push-pr.js +0 -137
  105. package/dist/src/commands/commit.js +0 -80
  106. package/dist/src/commands/compact/compact.js +0 -196
  107. package/dist/src/commands/compact/index.js +0 -11
  108. package/dist/src/commands/config/config.js +0 -5
  109. package/dist/src/commands/config/index.js +0 -8
  110. package/dist/src/commands/context/context-noninteractive.js +0 -221
  111. package/dist/src/commands/context/context.js +0 -46
  112. package/dist/src/commands/context/index.js +0 -21
  113. package/dist/src/commands/copy/copy.js +0 -366
  114. package/dist/src/commands/copy/index.js +0 -7
  115. package/dist/src/commands/cost/cost.js +0 -21
  116. package/dist/src/commands/cost/index.js +0 -16
  117. package/dist/src/commands/createMovedToPluginCommand.js +0 -33
  118. package/dist/src/commands/ctx_viz/index.js +0 -1
  119. package/dist/src/commands/debug-tool-call/index.js +0 -1
  120. package/dist/src/commands/desktop/desktop.js +0 -5
  121. package/dist/src/commands/desktop/index.js +0 -22
  122. package/dist/src/commands/diff/diff.js +0 -5
  123. package/dist/src/commands/diff/index.js +0 -6
  124. package/dist/src/commands/doctor/doctor.js +0 -5
  125. package/dist/src/commands/doctor/index.js +0 -9
  126. package/dist/src/commands/effort/effort.js +0 -166
  127. package/dist/src/commands/effort/index.js +0 -11
  128. package/dist/src/commands/env/index.js +0 -1
  129. package/dist/src/commands/exit/exit.js +0 -31
  130. package/dist/src/commands/exit/index.js +0 -9
  131. package/dist/src/commands/export/export.js +0 -86
  132. package/dist/src/commands/export/index.js +0 -8
  133. package/dist/src/commands/extra-usage/extra-usage-core.js +0 -99
  134. package/dist/src/commands/extra-usage/extra-usage-noninteractive.js +0 -13
  135. package/dist/src/commands/extra-usage/extra-usage.js +0 -14
  136. package/dist/src/commands/extra-usage/index.js +0 -27
  137. package/dist/src/commands/fast/fast.js +0 -275
  138. package/dist/src/commands/fast/index.js +0 -20
  139. package/dist/src/commands/feedback/feedback.js +0 -10
  140. package/dist/src/commands/feedback/index.js +0 -20
  141. package/dist/src/commands/files/files.js +0 -11
  142. package/dist/src/commands/files/index.js +0 -9
  143. package/dist/src/commands/good-claude/index.js +0 -1
  144. package/dist/src/commands/heapdump/heapdump.js +0 -14
  145. package/dist/src/commands/heapdump/index.js +0 -9
  146. package/dist/src/commands/help/help.js +0 -5
  147. package/dist/src/commands/help/index.js +0 -7
  148. package/dist/src/commands/hooks/hooks.js +0 -11
  149. package/dist/src/commands/hooks/index.js +0 -8
  150. package/dist/src/commands/ide/ide.js +0 -615
  151. package/dist/src/commands/ide/index.js +0 -8
  152. package/dist/src/commands/init-verifiers.js +0 -258
  153. package/dist/src/commands/init.js +0 -249
  154. package/dist/src/commands/insights.js +0 -2555
  155. package/dist/src/commands/install-github-app/ApiKeyStep.js +0 -230
  156. package/dist/src/commands/install-github-app/CheckExistingSecretStep.js +0 -194
  157. package/dist/src/commands/install-github-app/CheckGitHubStep.js +0 -15
  158. package/dist/src/commands/install-github-app/ChooseRepoStep.js +0 -211
  159. package/dist/src/commands/install-github-app/CreatingStep.js +0 -52
  160. package/dist/src/commands/install-github-app/ErrorStep.js +0 -83
  161. package/dist/src/commands/install-github-app/ExistingWorkflowStep.js +0 -104
  162. package/dist/src/commands/install-github-app/InstallAppStep.js +0 -96
  163. package/dist/src/commands/install-github-app/OAuthFlowStep.js +0 -190
  164. package/dist/src/commands/install-github-app/SuccessStep.js +0 -93
  165. package/dist/src/commands/install-github-app/WarningsStep.js +0 -70
  166. package/dist/src/commands/install-github-app/index.js +0 -10
  167. package/dist/src/commands/install-github-app/install-github-app.js +0 -593
  168. package/dist/src/commands/install-github-app/setupGitHubActions.js +0 -227
  169. package/dist/src/commands/install-slack-app/index.js +0 -9
  170. package/dist/src/commands/install-slack-app/install-slack-app.js +0 -25
  171. package/dist/src/commands/install.js +0 -118
  172. package/dist/src/commands/issue/index.js +0 -1
  173. package/dist/src/commands/keybindings/index.js +0 -10
  174. package/dist/src/commands/keybindings/keybindings.js +0 -47
  175. package/dist/src/commands/login/index.js +0 -11
  176. package/dist/src/commands/login/login.js +0 -99
  177. package/dist/src/commands/login-openai/index.js +0 -7
  178. package/dist/src/commands/login-openai/login-openai.js +0 -54
  179. package/dist/src/commands/logout/index.js +0 -8
  180. package/dist/src/commands/logout/logout.js +0 -72
  181. package/dist/src/commands/mcp/addCommand.js +0 -183
  182. package/dist/src/commands/mcp/index.js +0 -9
  183. package/dist/src/commands/mcp/mcp.js +0 -78
  184. package/dist/src/commands/mcp/xaaIdpCommand.js +0 -193
  185. package/dist/src/commands/memory/index.js +0 -7
  186. package/dist/src/commands/memory/memory.js +0 -71
  187. package/dist/src/commands/mobile/index.js +0 -8
  188. package/dist/src/commands/mobile/mobile.js +0 -278
  189. package/dist/src/commands/mock-limits/index.js +0 -1
  190. package/dist/src/commands/model/index.js +0 -14
  191. package/dist/src/commands/model/model.js +0 -297
  192. package/dist/src/commands/oauth-refresh/index.js +0 -1
  193. package/dist/src/commands/onboarding/index.js +0 -1
  194. package/dist/src/commands/output-style/index.js +0 -8
  195. package/dist/src/commands/output-style/output-style.js +0 -6
  196. package/dist/src/commands/passes/index.js +0 -17
  197. package/dist/src/commands/passes/passes.js +0 -22
  198. package/dist/src/commands/perf-issue/index.js +0 -1
  199. package/dist/src/commands/permissions/index.js +0 -8
  200. package/dist/src/commands/permissions/permissions.js +0 -8
  201. package/dist/src/commands/plan/index.js +0 -8
  202. package/dist/src/commands/plan/plan.js +0 -115
  203. package/dist/src/commands/plugin/AddMarketplace.js +0 -95
  204. package/dist/src/commands/plugin/BrowseMarketplace.js +0 -576
  205. package/dist/src/commands/plugin/DiscoverPlugins.js +0 -613
  206. package/dist/src/commands/plugin/ManageMarketplaces.js +0 -582
  207. package/dist/src/commands/plugin/ManagePlugins.js +0 -1783
  208. package/dist/src/commands/plugin/PluginErrors.js +0 -124
  209. package/dist/src/commands/plugin/PluginOptionsDialog.js +0 -367
  210. package/dist/src/commands/plugin/PluginOptionsFlow.js +0 -97
  211. package/dist/src/commands/plugin/PluginSettings.js +0 -1042
  212. package/dist/src/commands/plugin/PluginTrustWarning.js +0 -34
  213. package/dist/src/commands/plugin/UnifiedInstalledCell.js +0 -615
  214. package/dist/src/commands/plugin/ValidatePlugin.js +0 -95
  215. package/dist/src/commands/plugin/index.js +0 -10
  216. package/dist/src/commands/plugin/parseArgs.js +0 -71
  217. package/dist/src/commands/plugin/plugin.js +0 -5
  218. package/dist/src/commands/plugin/pluginDetailsHelpers.js +0 -89
  219. package/dist/src/commands/plugin/usePagination.js +0 -89
  220. package/dist/src/commands/pr_comments/index.js +0 -49
  221. package/dist/src/commands/privacy-settings/index.js +0 -11
  222. package/dist/src/commands/privacy-settings/privacy-settings.js +0 -54
  223. package/dist/src/commands/profile/index.js +0 -9
  224. package/dist/src/commands/profile/profile.js +0 -426
  225. package/dist/src/commands/provider/index.js +0 -8
  226. package/dist/src/commands/provider/provider.js +0 -349
  227. package/dist/src/commands/rate-limit-options/index.js +0 -15
  228. package/dist/src/commands/rate-limit-options/rate-limit-options.js +0 -213
  229. package/dist/src/commands/release-notes/index.js +0 -8
  230. package/dist/src/commands/release-notes/release-notes.js +0 -38
  231. package/dist/src/commands/reload-plugins/index.js +0 -11
  232. package/dist/src/commands/reload-plugins/reload-plugins.js +0 -52
  233. package/dist/src/commands/remote-env/index.js +0 -12
  234. package/dist/src/commands/remote-env/remote-env.js +0 -5
  235. package/dist/src/commands/remote-setup/api.js +0 -155
  236. package/dist/src/commands/remote-setup/index.js +0 -15
  237. package/dist/src/commands/remote-setup/remote-setup.js +0 -149
  238. package/dist/src/commands/rename/generateSessionName.js +0 -58
  239. package/dist/src/commands/rename/index.js +0 -9
  240. package/dist/src/commands/rename/rename.js +0 -52
  241. package/dist/src/commands/reset-limits/index.js +0 -4
  242. package/dist/src/commands/resume/index.js +0 -9
  243. package/dist/src/commands/resume/resume.js +0 -239
  244. package/dist/src/commands/review/UltrareviewOverageDialog.js +0 -97
  245. package/dist/src/commands/review/reviewRemote.js +0 -259
  246. package/dist/src/commands/review/ultrareviewCommand.js +0 -57
  247. package/dist/src/commands/review/ultrareviewEnabled.js +0 -10
  248. package/dist/src/commands/review.js +0 -50
  249. package/dist/src/commands/rewind/index.js +0 -10
  250. package/dist/src/commands/rewind/rewind.js +0 -7
  251. package/dist/src/commands/sandbox-toggle/index.js +0 -41
  252. package/dist/src/commands/sandbox-toggle/sandbox-toggle.js +0 -72
  253. package/dist/src/commands/security-review.js +0 -231
  254. package/dist/src/commands/session/index.js +0 -13
  255. package/dist/src/commands/session/session.js +0 -142
  256. package/dist/src/commands/share/index.js +0 -1
  257. package/dist/src/commands/skills/index.js +0 -7
  258. package/dist/src/commands/skills/skills.js +0 -5
  259. package/dist/src/commands/stats/index.js +0 -7
  260. package/dist/src/commands/stats/stats.js +0 -5
  261. package/dist/src/commands/status/index.js +0 -8
  262. package/dist/src/commands/status/status.js +0 -5
  263. package/dist/src/commands/statusline.js +0 -22
  264. package/dist/src/commands/stickers/index.js +0 -8
  265. package/dist/src/commands/stickers/stickers.js +0 -14
  266. package/dist/src/commands/summary/index.js +0 -1
  267. package/dist/src/commands/tag/index.js +0 -9
  268. package/dist/src/commands/tag/tag.js +0 -215
  269. package/dist/src/commands/tasks/index.js +0 -8
  270. package/dist/src/commands/tasks/tasks.js +0 -5
  271. package/dist/src/commands/telegram/index.js +0 -9
  272. package/dist/src/commands/telegram/telegram.js +0 -118
  273. package/dist/src/commands/teleport/index.js +0 -1
  274. package/dist/src/commands/terminalSetup/index.js +0 -18
  275. package/dist/src/commands/terminalSetup/terminalSetup.js +0 -491
  276. package/dist/src/commands/theme/index.js +0 -7
  277. package/dist/src/commands/theme/theme.js +0 -50
  278. package/dist/src/commands/thinkback/index.js +0 -9
  279. package/dist/src/commands/thinkback/thinkback.js +0 -527
  280. package/dist/src/commands/thinkback-play/index.js +0 -13
  281. package/dist/src/commands/thinkback-play/thinkback-play.js +0 -34
  282. package/dist/src/commands/ultraplan.js +0 -418
  283. package/dist/src/commands/upgrade/index.js +0 -12
  284. package/dist/src/commands/upgrade/upgrade.js +0 -37
  285. package/dist/src/commands/usage/index.js +0 -7
  286. package/dist/src/commands/usage/usage.js +0 -5
  287. package/dist/src/commands/version.js +0 -18
  288. package/dist/src/commands/vim/index.js +0 -8
  289. package/dist/src/commands/vim/vim.js +0 -25
  290. package/dist/src/commands/voice/index.js +0 -14
  291. package/dist/src/commands/voice/voice.js +0 -130
  292. package/dist/src/commands/whatsapp/index.js +0 -9
  293. package/dist/src/commands/whatsapp/whatsapp.js +0 -326
  294. package/dist/src/commands.js +0 -646
  295. package/dist/src/components/AgentProgressLine.js +0 -111
  296. package/dist/src/components/App.js +0 -45
  297. package/dist/src/components/ApproveApiKey.js +0 -124
  298. package/dist/src/components/AutoModeOptInDialog.js +0 -140
  299. package/dist/src/components/AutoUpdater.js +0 -157
  300. package/dist/src/components/AutoUpdaterWrapper.js +0 -78
  301. package/dist/src/components/AwsAuthStatusBox.js +0 -88
  302. package/dist/src/components/BaseTextInput.js +0 -105
  303. package/dist/src/components/BashModeProgress.js +0 -48
  304. package/dist/src/components/BridgeDialog.js +0 -414
  305. package/dist/src/components/BypassPermissionsModeDialog.js +0 -87
  306. package/dist/src/components/ChannelDowngradeDialog.js +0 -100
  307. package/dist/src/components/ClaudeCodeHint/PluginHintMenu.js +0 -37
  308. package/dist/src/components/ClaudeInChromeOnboarding.js +0 -126
  309. package/dist/src/components/ClaudeMdExternalIncludesDialog.js +0 -137
  310. package/dist/src/components/ClickableImageRef.js +0 -64
  311. package/dist/src/components/CompactSummary.js +0 -119
  312. package/dist/src/components/ConfigurableShortcutHint.js +0 -34
  313. package/dist/src/components/ConsoleOAuthFlow.js +0 -756
  314. package/dist/src/components/ContextSuggestions.js +0 -43
  315. package/dist/src/components/ContextVisualization.js +0 -483
  316. package/dist/src/components/CoordinatorAgentStatus.js +0 -261
  317. package/dist/src/components/CostThresholdDialog.js +0 -48
  318. package/dist/src/components/CtrlOToExpand.js +0 -50
  319. package/dist/src/components/CustomSelect/SelectMulti.js +0 -149
  320. package/dist/src/components/CustomSelect/index.js +0 -2
  321. package/dist/src/components/CustomSelect/option-map.js +0 -32
  322. package/dist/src/components/CustomSelect/select-input-option.js +0 -426
  323. package/dist/src/components/CustomSelect/select-option.js +0 -23
  324. package/dist/src/components/CustomSelect/select.js +0 -518
  325. package/dist/src/components/CustomSelect/use-multi-select-state.js +0 -214
  326. package/dist/src/components/CustomSelect/use-select-input.js +0 -170
  327. package/dist/src/components/CustomSelect/use-select-navigation.js +0 -366
  328. package/dist/src/components/CustomSelect/use-select-state.js +0 -22
  329. package/dist/src/components/DesktopHandoff.js +0 -195
  330. package/dist/src/components/DesktopUpsell/DesktopUpsellStartup.js +0 -173
  331. package/dist/src/components/DevBar.js +0 -50
  332. package/dist/src/components/DevChannelsDialog.js +0 -103
  333. package/dist/src/components/DiagnosticsDisplay.js +0 -91
  334. package/dist/src/components/EffortCallout.js +0 -264
  335. package/dist/src/components/EffortIndicator.js +0 -29
  336. package/dist/src/components/ExitFlow.js +0 -40
  337. package/dist/src/components/ExportDialog.js +0 -101
  338. package/dist/src/components/FallbackToolUseErrorMessage.js +0 -115
  339. package/dist/src/components/FallbackToolUseRejectedMessage.js +0 -16
  340. package/dist/src/components/FastIcon.js +0 -42
  341. package/dist/src/components/Feedback.js +0 -439
  342. package/dist/src/components/FeedbackSurvey/FeedbackSurvey.js +0 -150
  343. package/dist/src/components/FeedbackSurvey/FeedbackSurveyView.js +0 -103
  344. package/dist/src/components/FeedbackSurvey/TranscriptSharePrompt.js +0 -83
  345. package/dist/src/components/FeedbackSurvey/submitTranscriptShare.js +0 -75
  346. package/dist/src/components/FeedbackSurvey/useDebouncedDigitInput.js +0 -51
  347. package/dist/src/components/FeedbackSurvey/useFeedbackSurvey.js +0 -258
  348. package/dist/src/components/FeedbackSurvey/useMemorySurvey.js +0 -191
  349. package/dist/src/components/FeedbackSurvey/usePostCompactSurvey.js +0 -202
  350. package/dist/src/components/FeedbackSurvey/useSurveyState.js +0 -80
  351. package/dist/src/components/FileEditToolDiff.js +0 -166
  352. package/dist/src/components/FileEditToolUpdatedMessage.js +0 -111
  353. package/dist/src/components/FileEditToolUseRejectedMessage.js +0 -157
  354. package/dist/src/components/FilePathLink.js +0 -34
  355. package/dist/src/components/FullscreenLayout.js +0 -578
  356. package/dist/src/components/GlobalSearchDialog.js +0 -339
  357. package/dist/src/components/HelpV2/Commands.js +0 -65
  358. package/dist/src/components/HelpV2/General.js +0 -24
  359. package/dist/src/components/HelpV2/HelpV2.js +0 -186
  360. package/dist/src/components/HighlightedCode/Fallback.js +0 -193
  361. package/dist/src/components/HighlightedCode.js +0 -184
  362. package/dist/src/components/HistorySearchDialog.js +0 -92
  363. package/dist/src/components/IdeAutoConnectDialog.js +0 -153
  364. package/dist/src/components/IdeOnboardingDialog.js +0 -174
  365. package/dist/src/components/IdeStatusIndicator.js +0 -49
  366. package/dist/src/components/IdleReturnDialog.js +0 -116
  367. package/dist/src/components/InterruptedByUser.js +0 -15
  368. package/dist/src/components/InvalidConfigDialog.js +0 -134
  369. package/dist/src/components/InvalidSettingsDialog.js +0 -84
  370. package/dist/src/components/KeybindingWarnings.js +0 -54
  371. package/dist/src/components/LanguagePicker.js +0 -84
  372. package/dist/src/components/LogSelector.js +0 -1579
  373. package/dist/src/components/LogoV2/AnimatedAsterisk.js +0 -42
  374. package/dist/src/components/LogoV2/AnimatedClawd.js +0 -111
  375. package/dist/src/components/LogoV2/ChannelsNotice.js +0 -258
  376. package/dist/src/components/LogoV2/Clawd.js +0 -5
  377. package/dist/src/components/LogoV2/CondensedLogo.js +0 -159
  378. package/dist/src/components/LogoV2/EmergencyTip.js +0 -47
  379. package/dist/src/components/LogoV2/Feed.js +0 -84
  380. package/dist/src/components/LogoV2/FeedColumn.js +0 -55
  381. package/dist/src/components/LogoV2/GuestPassesUpsell.js +0 -71
  382. package/dist/src/components/LogoV2/LogoV2.js +0 -565
  383. package/dist/src/components/LogoV2/Opus1mMergeNotice.js +0 -56
  384. package/dist/src/components/LogoV2/OverageCreditUpsell.js +0 -160
  385. package/dist/src/components/LogoV2/VoiceModeNotice.js +0 -70
  386. package/dist/src/components/LogoV2/WelcomeV2.js +0 -461
  387. package/dist/src/components/LogoV2/feedConfigs.js +0 -78
  388. package/dist/src/components/LspRecommendation/LspRecommendationMenu.js +0 -46
  389. package/dist/src/components/MCPServerApprovalDialog.js +0 -113
  390. package/dist/src/components/MCPServerDesktopImportDialog.js +0 -206
  391. package/dist/src/components/MCPServerDialogCopy.js +0 -15
  392. package/dist/src/components/MCPServerMultiselectDialog.js +0 -133
  393. package/dist/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +0 -149
  394. package/dist/src/components/ManagedSettingsSecurityDialog/utils.js +0 -105
  395. package/dist/src/components/Markdown.js +0 -217
  396. package/dist/src/components/MarkdownTable.js +0 -279
  397. package/dist/src/components/MemoryUsageIndicator.js +0 -27
  398. package/dist/src/components/Message.js +0 -566
  399. package/dist/src/components/MessageModel.js +0 -36
  400. package/dist/src/components/MessageResponse.js +0 -73
  401. package/dist/src/components/MessageRow.js +0 -346
  402. package/dist/src/components/MessageSelector.js +0 -743
  403. package/dist/src/components/MessageTimestamp.js +0 -57
  404. package/dist/src/components/Messages.js +0 -637
  405. package/dist/src/components/ModelPicker.js +0 -484
  406. package/dist/src/components/NativeAutoUpdater.js +0 -153
  407. package/dist/src/components/NotebookEditToolUseRejectedMessage.js +0 -83
  408. package/dist/src/components/OffscreenFreeze.js +0 -35
  409. package/dist/src/components/Onboarding.js +0 -174
  410. package/dist/src/components/OutputStylePicker.js +0 -102
  411. package/dist/src/components/PackageManagerAutoUpdater.js +0 -100
  412. package/dist/src/components/Passes/Passes.js +0 -113
  413. package/dist/src/components/PrBadge.js +0 -90
  414. package/dist/src/components/PressEnterToContinue.js +0 -15
  415. package/dist/src/components/PromptInput/HistorySearchInput.js +0 -44
  416. package/dist/src/components/PromptInput/IssueFlagBanner.js +0 -8
  417. package/dist/src/components/PromptInput/Notifications.js +0 -221
  418. package/dist/src/components/PromptInput/PromptInput.js +0 -1998
  419. package/dist/src/components/PromptInput/PromptInputFooter.js +0 -84
  420. package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +0 -409
  421. package/dist/src/components/PromptInput/PromptInputFooterSuggestions.js +0 -280
  422. package/dist/src/components/PromptInput/PromptInputHelpMenu.js +0 -379
  423. package/dist/src/components/PromptInput/PromptInputModeIndicator.js +0 -72
  424. package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +0 -105
  425. package/dist/src/components/PromptInput/PromptInputStashNotice.js +0 -20
  426. package/dist/src/components/PromptInput/SandboxPromptFooterHint.js +0 -65
  427. package/dist/src/components/PromptInput/ShimmeredInput.js +0 -132
  428. package/dist/src/components/PromptInput/VoiceIndicator.js +0 -136
  429. package/dist/src/components/PromptInput/inputModes.js +0 -24
  430. package/dist/src/components/PromptInput/inputPaste.js +0 -62
  431. package/dist/src/components/PromptInput/useMaybeTruncateInput.js +0 -33
  432. package/dist/src/components/PromptInput/usePromptInputPlaceholder.js +0 -55
  433. package/dist/src/components/PromptInput/useShowFastIconHint.js +0 -23
  434. package/dist/src/components/PromptInput/useSwarmBanner.js +0 -112
  435. package/dist/src/components/PromptInput/utils.js +0 -50
  436. package/dist/src/components/QuickOpenDialog.js +0 -243
  437. package/dist/src/components/RemoteCallout.js +0 -53
  438. package/dist/src/components/RemoteEnvironmentDialog.js +0 -345
  439. package/dist/src/components/ResumeTask.js +0 -173
  440. package/dist/src/components/SandboxViolationExpandedView.js +0 -102
  441. package/dist/src/components/ScrollKeybindingHandler.js +0 -982
  442. package/dist/src/components/SearchBox.js +0 -55
  443. package/dist/src/components/SentryErrorBoundary.js +0 -16
  444. package/dist/src/components/SessionBackgroundHint.js +0 -104
  445. package/dist/src/components/SessionPreview.js +0 -200
  446. package/dist/src/components/Settings/Config.js +0 -1628
  447. package/dist/src/components/Settings/Settings.js +0 -129
  448. package/dist/src/components/Settings/Status.js +0 -230
  449. package/dist/src/components/Settings/Usage.js +0 -341
  450. package/dist/src/components/ShowInIDEPrompt.js +0 -151
  451. package/dist/src/components/SkillImprovementSurvey.js +0 -130
  452. package/dist/src/components/Spinner/FlashingChar.js +0 -51
  453. package/dist/src/components/Spinner/GlimmerMessage.js +0 -328
  454. package/dist/src/components/Spinner/ShimmerChar.js +0 -22
  455. package/dist/src/components/Spinner/SpinnerAnimationRow.js +0 -169
  456. package/dist/src/components/Spinner/SpinnerGlyph.js +0 -69
  457. package/dist/src/components/Spinner/TeammateSpinnerLine.js +0 -170
  458. package/dist/src/components/Spinner/TeammateSpinnerTree.js +0 -268
  459. package/dist/src/components/Spinner/index.js +0 -11
  460. package/dist/src/components/Spinner/teammateSelectHint.js +0 -1
  461. package/dist/src/components/Spinner/useShimmerAnimation.js +0 -22
  462. package/dist/src/components/Spinner/useStalledAnimation.js +0 -63
  463. package/dist/src/components/Spinner/utils.js +0 -77
  464. package/dist/src/components/Spinner.js +0 -470
  465. package/dist/src/components/Stats.js +0 -1000
  466. package/dist/src/components/StatusLine.js +0 -285
  467. package/dist/src/components/StatusNotices.js +0 -50
  468. package/dist/src/components/StructuredDiff/Fallback.js +0 -335
  469. package/dist/src/components/StructuredDiff/colorDiff.js +0 -26
  470. package/dist/src/components/StructuredDiff.js +0 -152
  471. package/dist/src/components/StructuredDiffList.js +0 -8
  472. package/dist/src/components/TagTabs.js +0 -100
  473. package/dist/src/components/TaskListV2.js +0 -333
  474. package/dist/src/components/TeammateViewHeader.js +0 -87
  475. package/dist/src/components/TeleportError.js +0 -191
  476. package/dist/src/components/TeleportProgress.js +0 -130
  477. package/dist/src/components/TeleportRepoMismatchDialog.js +0 -98
  478. package/dist/src/components/TeleportResumeWrapper.js +0 -158
  479. package/dist/src/components/TeleportStash.js +0 -82
  480. package/dist/src/components/TextInput.js +0 -108
  481. package/dist/src/components/ThemePicker.js +0 -330
  482. package/dist/src/components/ThinkingToggle.js +0 -153
  483. package/dist/src/components/TokenWarning.js +0 -172
  484. package/dist/src/components/ToolUseLoader.js +0 -34
  485. package/dist/src/components/TrustDialog/TrustDialog.js +0 -301
  486. package/dist/src/components/TrustDialog/utils.js +0 -199
  487. package/dist/src/components/ValidationErrorsList.js +0 -146
  488. package/dist/src/components/VimTextInput.js +0 -136
  489. package/dist/src/components/VirtualMessageList.js +0 -892
  490. package/dist/src/components/WorkflowMultiselectDialog.js +0 -118
  491. package/dist/src/components/WorktreeExitDialog.js +0 -222
  492. package/dist/src/components/agents/AgentDetail.js +0 -226
  493. package/dist/src/components/agents/AgentEditor.js +0 -146
  494. package/dist/src/components/agents/AgentNavigationFooter.js +0 -21
  495. package/dist/src/components/agents/AgentsList.js +0 -436
  496. package/dist/src/components/agents/AgentsMenu.js +0 -848
  497. package/dist/src/components/agents/ColorPicker.js +0 -110
  498. package/dist/src/components/agents/ModelSelector.js +0 -62
  499. package/dist/src/components/agents/SnapshotUpdateDialog.js +0 -16
  500. package/dist/src/components/agents/ToolSelector.js +0 -557
  501. package/dist/src/components/agents/agentFileUtils.js +0 -179
  502. package/dist/src/components/agents/generateAgent.js +0 -161
  503. package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +0 -88
  504. package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +0 -80
  505. package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +0 -386
  506. package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +0 -63
  507. package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +0 -126
  508. package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +0 -118
  509. package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +0 -79
  510. package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +0 -107
  511. package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +0 -79
  512. package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +0 -48
  513. package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +0 -131
  514. package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +0 -51
  515. package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +0 -100
  516. package/dist/src/components/agents/types.js +0 -4
  517. package/dist/src/components/agents/utils.js +0 -14
  518. package/dist/src/components/agents/validateAgent.js +0 -79
  519. package/dist/src/components/design-system/Byline.js +0 -72
  520. package/dist/src/components/design-system/Dialog.js +0 -116
  521. package/dist/src/components/design-system/Divider.js +0 -109
  522. package/dist/src/components/design-system/FuzzyPicker.js +0 -187
  523. package/dist/src/components/design-system/KeyboardShortcutHint.js +0 -67
  524. package/dist/src/components/design-system/ListItem.js +0 -183
  525. package/dist/src/components/design-system/LoadingState.js +0 -68
  526. package/dist/src/components/design-system/Pane.js +0 -68
  527. package/dist/src/components/design-system/ProgressBar.js +0 -62
  528. package/dist/src/components/design-system/Ratchet.js +0 -71
  529. package/dist/src/components/design-system/StatusIcon.js +0 -69
  530. package/dist/src/components/design-system/Tabs.js +0 -269
  531. package/dist/src/components/design-system/ThemeProvider.js +0 -137
  532. package/dist/src/components/design-system/ThemedBox.js +0 -125
  533. package/dist/src/components/design-system/ThemedText.js +0 -60
  534. package/dist/src/components/design-system/color.js +0 -22
  535. package/dist/src/components/diff/DiffDetailView.js +0 -284
  536. package/dist/src/components/diff/DiffDialog.js +0 -387
  537. package/dist/src/components/diff/DiffFileList.js +0 -291
  538. package/dist/src/components/grove/Grove.js +0 -483
  539. package/dist/src/components/hooks/HooksConfigMenu.js +0 -570
  540. package/dist/src/components/hooks/PromptDialog.js +0 -81
  541. package/dist/src/components/hooks/SelectEventMode.js +0 -117
  542. package/dist/src/components/hooks/SelectHookMode.js +0 -93
  543. package/dist/src/components/hooks/SelectMatcherMode.js +0 -124
  544. package/dist/src/components/hooks/ViewHookMode.js +0 -197
  545. package/dist/src/components/mcp/CapabilitiesSection.js +0 -55
  546. package/dist/src/components/mcp/ElicitationDialog.js +0 -945
  547. package/dist/src/components/mcp/MCPAgentServerMenu.js +0 -95
  548. package/dist/src/components/mcp/MCPListPanel.js +0 -504
  549. package/dist/src/components/mcp/MCPReconnect.js +0 -168
  550. package/dist/src/components/mcp/MCPRemoteServerMenu.js +0 -460
  551. package/dist/src/components/mcp/MCPSettings.js +0 -414
  552. package/dist/src/components/mcp/MCPStdioServerMenu.js +0 -95
  553. package/dist/src/components/mcp/MCPToolDetailView.js +0 -219
  554. package/dist/src/components/mcp/MCPToolListView.js +0 -136
  555. package/dist/src/components/mcp/McpParsingWarnings.js +0 -211
  556. package/dist/src/components/mcp/index.js +0 -8
  557. package/dist/src/components/mcp/types.js +0 -3
  558. package/dist/src/components/mcp/utils/reconnectHelpers.js +0 -35
  559. package/dist/src/components/memory/MemoryFileSelector.js +0 -455
  560. package/dist/src/components/memory/MemoryUpdateNotification.js +0 -42
  561. package/dist/src/components/messageActions.js +0 -418
  562. package/dist/src/components/messages/AdvisorMessage.js +0 -151
  563. package/dist/src/components/messages/AssistantRedactedThinkingMessage.js +0 -27
  564. package/dist/src/components/messages/AssistantTextMessage.js +0 -274
  565. package/dist/src/components/messages/AssistantThinkingMessage.js +0 -69
  566. package/dist/src/components/messages/AssistantToolUseMessage.js +0 -323
  567. package/dist/src/components/messages/AttachmentMessage.js +0 -418
  568. package/dist/src/components/messages/CollapsedReadSearchContent.js +0 -362
  569. package/dist/src/components/messages/CompactBoundaryMessage.js +0 -18
  570. package/dist/src/components/messages/GroupedToolUseContent.js +0 -37
  571. package/dist/src/components/messages/HighlightedThinkingText.js +0 -164
  572. package/dist/src/components/messages/HookProgressMessage.js +0 -110
  573. package/dist/src/components/messages/PlanApprovalMessage.js +0 -212
  574. package/dist/src/components/messages/RateLimitMessage.js +0 -149
  575. package/dist/src/components/messages/ShutdownMessage.js +0 -123
  576. package/dist/src/components/messages/SystemAPIErrorMessage.js +0 -135
  577. package/dist/src/components/messages/SystemTextMessage.js +0 -843
  578. package/dist/src/components/messages/TaskAssignmentMessage.js +0 -71
  579. package/dist/src/components/messages/UserAgentNotificationMessage.js +0 -77
  580. package/dist/src/components/messages/UserBashInputMessage.js +0 -51
  581. package/dist/src/components/messages/UserBashOutputMessage.js +0 -54
  582. package/dist/src/components/messages/UserChannelMessage.js +0 -129
  583. package/dist/src/components/messages/UserCommandMessage.js +0 -106
  584. package/dist/src/components/messages/UserImageMessage.js +0 -53
  585. package/dist/src/components/messages/UserLocalCommandOutputMessage.js +0 -169
  586. package/dist/src/components/messages/UserMemoryInputMessage.js +0 -72
  587. package/dist/src/components/messages/UserPlanMessage.js +0 -37
  588. package/dist/src/components/messages/UserPromptMessage.js +0 -63
  589. package/dist/src/components/messages/UserResourceUpdateMessage.js +0 -101
  590. package/dist/src/components/messages/UserTeammateMessage.js +0 -156
  591. package/dist/src/components/messages/UserTextMessage.js +0 -271
  592. package/dist/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +0 -27
  593. package/dist/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +0 -16
  594. package/dist/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +0 -16
  595. package/dist/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +0 -91
  596. package/dist/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +0 -73
  597. package/dist/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +0 -83
  598. package/dist/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +0 -58
  599. package/dist/src/components/messages/UserToolResultMessage/utils.js +0 -43
  600. package/dist/src/components/messages/nullRenderingAttachments.js +0 -58
  601. package/dist/src/components/messages/teamMemCollapsed.js +0 -142
  602. package/dist/src/components/messages/teamMemSaved.js +0 -17
  603. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +0 -654
  604. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +0 -219
  605. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +0 -227
  606. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +0 -174
  607. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +0 -444
  608. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +0 -136
  609. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +0 -100
  610. package/dist/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +0 -404
  611. package/dist/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +0 -110
  612. package/dist/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +0 -448
  613. package/dist/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +0 -125
  614. package/dist/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +0 -650
  615. package/dist/src/components/permissions/FallbackPermissionRequest.js +0 -348
  616. package/dist/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +0 -184
  617. package/dist/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +0 -108
  618. package/dist/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +0 -13
  619. package/dist/src/components/permissions/FilePermissionDialog/permissionOptions.js +0 -136
  620. package/dist/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +0 -131
  621. package/dist/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +0 -86
  622. package/dist/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +0 -163
  623. package/dist/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +0 -78
  624. package/dist/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +0 -112
  625. package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +0 -163
  626. package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +0 -217
  627. package/dist/src/components/permissions/PermissionDecisionDebugInfo.js +0 -466
  628. package/dist/src/components/permissions/PermissionDialog.js +0 -54
  629. package/dist/src/components/permissions/PermissionExplanation.js +0 -269
  630. package/dist/src/components/permissions/PermissionPrompt.js +0 -316
  631. package/dist/src/components/permissions/PermissionRequest.js +0 -160
  632. package/dist/src/components/permissions/PermissionRequestTitle.js +0 -57
  633. package/dist/src/components/permissions/PermissionRuleExplanation.js +0 -109
  634. package/dist/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +0 -178
  635. package/dist/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +0 -73
  636. package/dist/src/components/permissions/SandboxPermissionRequest.js +0 -161
  637. package/dist/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +0 -228
  638. package/dist/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +0 -384
  639. package/dist/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +0 -258
  640. package/dist/src/components/permissions/WorkerBadge.js +0 -43
  641. package/dist/src/components/permissions/WorkerPendingPermission.js +0 -106
  642. package/dist/src/components/permissions/hooks.js +0 -163
  643. package/dist/src/components/permissions/rules/AddPermissionRules.js +0 -170
  644. package/dist/src/components/permissions/rules/AddWorkspaceDirectory.js +0 -334
  645. package/dist/src/components/permissions/rules/PermissionRuleDescription.js +0 -77
  646. package/dist/src/components/permissions/rules/PermissionRuleInput.js +0 -135
  647. package/dist/src/components/permissions/rules/PermissionRuleList.js +0 -1189
  648. package/dist/src/components/permissions/rules/RecentDenialsTab.js +0 -204
  649. package/dist/src/components/permissions/rules/RemoveWorkspaceDirectory.js +0 -102
  650. package/dist/src/components/permissions/rules/WorkspaceTab.js +0 -132
  651. package/dist/src/components/permissions/shellPermissionHelpers.js +0 -111
  652. package/dist/src/components/permissions/useShellPermissionFeedback.js +0 -108
  653. package/dist/src/components/permissions/utils.js +0 -14
  654. package/dist/src/components/sandbox/SandboxConfigTab.js +0 -47
  655. package/dist/src/components/sandbox/SandboxDependenciesTab.js +0 -122
  656. package/dist/src/components/sandbox/SandboxDoctorSection.js +0 -46
  657. package/dist/src/components/sandbox/SandboxOverridesTab.js +0 -192
  658. package/dist/src/components/sandbox/SandboxSettings.js +0 -296
  659. package/dist/src/components/shell/ExpandShellOutputContext.js +0 -33
  660. package/dist/src/components/shell/OutputLine.js +0 -110
  661. package/dist/src/components/shell/ShellProgressMessage.js +0 -143
  662. package/dist/src/components/shell/ShellTimeDisplay.js +0 -71
  663. package/dist/src/components/skills/SkillsMenu.js +0 -238
  664. package/dist/src/components/tasks/AsyncAgentDetailDialog.js +0 -234
  665. package/dist/src/components/tasks/BackgroundTask.js +0 -363
  666. package/dist/src/components/tasks/BackgroundTaskStatus.js +0 -419
  667. package/dist/src/components/tasks/BackgroundTasksDialog.js +0 -496
  668. package/dist/src/components/tasks/DreamDetailDialog.js +0 -250
  669. package/dist/src/components/tasks/InProcessTeammateDetailDialog.js +0 -274
  670. package/dist/src/components/tasks/RemoteSessionDetailDialog.js +0 -868
  671. package/dist/src/components/tasks/RemoteSessionProgress.js +0 -249
  672. package/dist/src/components/tasks/ShellDetailDialog.js +0 -403
  673. package/dist/src/components/tasks/ShellProgress.js +0 -76
  674. package/dist/src/components/tasks/renderToolActivity.js +0 -28
  675. package/dist/src/components/tasks/taskStatusUtils.js +0 -94
  676. package/dist/src/components/teams/TeamStatus.js +0 -76
  677. package/dist/src/components/teams/TeamsDialog.js +0 -672
  678. package/dist/src/components/ui/OrderedList.js +0 -66
  679. package/dist/src/components/ui/OrderedListItem.js +0 -41
  680. package/dist/src/components/ui/TreeSelect.js +0 -300
  681. package/dist/src/components/wizard/WizardDialogLayout.js +0 -47
  682. package/dist/src/components/wizard/WizardNavigationFooter.js +0 -10
  683. package/dist/src/components/wizard/WizardProvider.js +0 -217
  684. package/dist/src/components/wizard/index.js +0 -4
  685. package/dist/src/components/wizard/useWizard.js +0 -9
  686. package/dist/src/constants/apiLimits.js +0 -81
  687. package/dist/src/constants/betas.js +0 -45
  688. package/dist/src/constants/common.js +0 -29
  689. package/dist/src/constants/cyberRiskInstruction.js +0 -24
  690. package/dist/src/constants/errorIds.js +0 -14
  691. package/dist/src/constants/figures.js +0 -38
  692. package/dist/src/constants/files.js +0 -150
  693. package/dist/src/constants/github-app.js +0 -139
  694. package/dist/src/constants/keys.js +0 -10
  695. package/dist/src/constants/messages.js +0 -1
  696. package/dist/src/constants/oauth.js +0 -221
  697. package/dist/src/constants/outputStyles.js +0 -162
  698. package/dist/src/constants/product.js +0 -56
  699. package/dist/src/constants/prompts.js +0 -752
  700. package/dist/src/constants/spinnerVerbs.js +0 -202
  701. package/dist/src/constants/system.js +0 -77
  702. package/dist/src/constants/systemPromptSections.js +0 -39
  703. package/dist/src/constants/toolLimits.js +0 -50
  704. package/dist/src/constants/tools.js +0 -103
  705. package/dist/src/constants/turnCompletionVerbs.js +0 -12
  706. package/dist/src/constants/xml.js +0 -73
  707. package/dist/src/context/QueuedMessageContext.js +0 -51
  708. package/dist/src/context/fpsMetrics.js +0 -22
  709. package/dist/src/context/mailbox.js +0 -35
  710. package/dist/src/context/modalContext.js +0 -34
  711. package/dist/src/context/notifications.js +0 -199
  712. package/dist/src/context/overlayContext.js +0 -149
  713. package/dist/src/context/promptOverlayContext.js +0 -118
  714. package/dist/src/context/stats.js +0 -207
  715. package/dist/src/context/voice.js +0 -74
  716. package/dist/src/context.js +0 -146
  717. package/dist/src/coordinator/coordinatorMode.js +0 -345
  718. package/dist/src/cost-tracker.js +0 -208
  719. package/dist/src/costHook.js +0 -17
  720. package/dist/src/daemon/main.js +0 -16
  721. package/dist/src/daemon/workerRegistry.js +0 -16
  722. package/dist/src/dialogLaunchers.js +0 -68
  723. package/dist/src/entrypoints/agentSdkTypes.js +0 -202
  724. package/dist/src/entrypoints/cli.js +0 -237
  725. package/dist/src/entrypoints/init.js +0 -265
  726. package/dist/src/entrypoints/mcp.js +0 -142
  727. package/dist/src/entrypoints/sandboxTypes.js +0 -112
  728. package/dist/src/entrypoints/sdk/controlSchemas.js +0 -452
  729. package/dist/src/entrypoints/sdk/controlTypes.js +0 -1
  730. package/dist/src/entrypoints/sdk/coreSchemas.js +0 -1331
  731. package/dist/src/entrypoints/sdk/coreTypes.generated.js +0 -1
  732. package/dist/src/entrypoints/sdk/coreTypes.js +0 -49
  733. package/dist/src/entrypoints/sdk/runtimeTypes.js +0 -1
  734. package/dist/src/entrypoints/sdk/toolTypes.js +0 -1
  735. package/dist/src/environment-runner/main.js +0 -16
  736. package/dist/src/history.js +0 -386
  737. package/dist/src/hooks/fileSuggestions.js +0 -635
  738. package/dist/src/hooks/notifs/useAutoModeUnavailableNotification.js +0 -47
  739. package/dist/src/hooks/notifs/useCanSwitchToExistingSubscription.js +0 -57
  740. package/dist/src/hooks/notifs/useDeprecationWarningNotification.js +0 -43
  741. package/dist/src/hooks/notifs/useFastModeNotification.js +0 -164
  742. package/dist/src/hooks/notifs/useIDEStatusIndicator.js +0 -174
  743. package/dist/src/hooks/notifs/useInstallMessages.js +0 -27
  744. package/dist/src/hooks/notifs/useLspInitializationNotification.js +0 -144
  745. package/dist/src/hooks/notifs/useMcpConnectivityStatus.js +0 -80
  746. package/dist/src/hooks/notifs/useModelMigrationNotifications.js +0 -53
  747. package/dist/src/hooks/notifs/useNpmDeprecationNotification.js +0 -24
  748. package/dist/src/hooks/notifs/usePluginAutoupdateNotification.js +0 -82
  749. package/dist/src/hooks/notifs/usePluginInstallationStatus.js +0 -127
  750. package/dist/src/hooks/notifs/useRateLimitWarningNotification.js +0 -118
  751. package/dist/src/hooks/notifs/useSettingsErrors.js +0 -64
  752. package/dist/src/hooks/notifs/useStartupNotification.js +0 -33
  753. package/dist/src/hooks/notifs/useTeammateShutdownNotification.js +0 -64
  754. package/dist/src/hooks/renderPlaceholder.js +0 -26
  755. package/dist/src/hooks/toolPermission/PermissionContext.js +0 -211
  756. package/dist/src/hooks/toolPermission/handlers/coordinatorHandler.js +0 -44
  757. package/dist/src/hooks/toolPermission/handlers/interactiveHandler.js +0 -397
  758. package/dist/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +0 -108
  759. package/dist/src/hooks/toolPermission/permissionLogging.js +0 -145
  760. package/dist/src/hooks/unifiedSuggestions.js +0 -130
  761. package/dist/src/hooks/useAfterFirstRender.js +0 -12
  762. package/dist/src/hooks/useApiKeyVerification.js +0 -63
  763. package/dist/src/hooks/useArrowKeyHistory.js +0 -203
  764. package/dist/src/hooks/useAssistantHistory.js +0 -194
  765. package/dist/src/hooks/useAwaySummary.js +0 -105
  766. package/dist/src/hooks/useBackgroundTaskNavigation.js +0 -204
  767. package/dist/src/hooks/useBlink.js +0 -28
  768. package/dist/src/hooks/useCanUseTool.js +0 -192
  769. package/dist/src/hooks/useCancelRequest.js +0 -195
  770. package/dist/src/hooks/useChromeExtensionNotification.js +0 -49
  771. package/dist/src/hooks/useClaudeCodeHintRecommendation.js +0 -117
  772. package/dist/src/hooks/useClipboardImageHint.js +0 -59
  773. package/dist/src/hooks/useCommandKeybindings.js +0 -87
  774. package/dist/src/hooks/useCommandQueue.js +0 -10
  775. package/dist/src/hooks/useCopyOnSelect.js +0 -88
  776. package/dist/src/hooks/useDeferredHookMessages.js +0 -43
  777. package/dist/src/hooks/useDiffData.js +0 -69
  778. package/dist/src/hooks/useDiffInIDE.js +0 -252
  779. package/dist/src/hooks/useDirectConnect.js +0 -150
  780. package/dist/src/hooks/useDoublePress.js +0 -44
  781. package/dist/src/hooks/useDynamicConfig.js +0 -17
  782. package/dist/src/hooks/useElapsedTime.js +0 -25
  783. package/dist/src/hooks/useExitOnCtrlCD.js +0 -57
  784. package/dist/src/hooks/useExitOnCtrlCDWithKeybindings.js +0 -17
  785. package/dist/src/hooks/useFileHistorySnapshotInit.js +0 -14
  786. package/dist/src/hooks/useGlobalKeybindings.js +0 -215
  787. package/dist/src/hooks/useHistorySearch.js +0 -241
  788. package/dist/src/hooks/useIDEIntegration.js +0 -56
  789. package/dist/src/hooks/useIdeAtMentioned.js +0 -51
  790. package/dist/src/hooks/useIdeConnectionStatus.js +0 -21
  791. package/dist/src/hooks/useIdeLogging.js +0 -29
  792. package/dist/src/hooks/useIdeSelection.js +0 -106
  793. package/dist/src/hooks/useInboxPoller.js +0 -709
  794. package/dist/src/hooks/useInputBuffer.js +0 -73
  795. package/dist/src/hooks/useIssueFlagBanner.js +0 -115
  796. package/dist/src/hooks/useLogMessages.js +0 -98
  797. package/dist/src/hooks/useLspPluginRecommendation.js +0 -176
  798. package/dist/src/hooks/useMailboxBridge.js +0 -15
  799. package/dist/src/hooks/useMainLoopModel.js +0 -25
  800. package/dist/src/hooks/useManagePlugins.js +0 -261
  801. package/dist/src/hooks/useMemoryUsage.js +0 -28
  802. package/dist/src/hooks/useMergedClients.js +0 -11
  803. package/dist/src/hooks/useMergedCommands.js +0 -10
  804. package/dist/src/hooks/useMergedTools.js +0 -32
  805. package/dist/src/hooks/useMinDisplayTime.js +0 -26
  806. package/dist/src/hooks/useNotifyAfterTimeout.js +0 -51
  807. package/dist/src/hooks/useOfficialMarketplaceNotification.js +0 -46
  808. package/dist/src/hooks/usePasteHandler.js +0 -188
  809. package/dist/src/hooks/usePluginRecommendationBase.js +0 -101
  810. package/dist/src/hooks/usePrStatus.js +0 -91
  811. package/dist/src/hooks/usePromptSuggestion.js +0 -128
  812. package/dist/src/hooks/usePromptsFromClaudeInChrome.js +0 -66
  813. package/dist/src/hooks/useQueueProcessor.js +0 -46
  814. package/dist/src/hooks/useRemoteSession.js +0 -431
  815. package/dist/src/hooks/useReplBridge.js +0 -717
  816. package/dist/src/hooks/useSSHSession.js +0 -167
  817. package/dist/src/hooks/useScheduledTasks.js +0 -104
  818. package/dist/src/hooks/useSearchInput.js +0 -302
  819. package/dist/src/hooks/useSessionBackgrounding.js +0 -132
  820. package/dist/src/hooks/useSettings.js +0 -10
  821. package/dist/src/hooks/useSettingsChange.js +0 -13
  822. package/dist/src/hooks/useSkillImprovementSurvey.js +0 -69
  823. package/dist/src/hooks/useSkillsChange.js +0 -51
  824. package/dist/src/hooks/useSwarmInitialization.js +0 -67
  825. package/dist/src/hooks/useSwarmPermissionPoller.js +0 -215
  826. package/dist/src/hooks/useTaskListWatcher.js +0 -157
  827. package/dist/src/hooks/useTasksV2.js +0 -220
  828. package/dist/src/hooks/useTeammateViewAutoExit.js +0 -55
  829. package/dist/src/hooks/useTelegramMirror.js +0 -47
  830. package/dist/src/hooks/useTeleportResume.js +0 -81
  831. package/dist/src/hooks/useTerminalSize.js +0 -9
  832. package/dist/src/hooks/useTextInput.js +0 -397
  833. package/dist/src/hooks/useTimeout.js +0 -10
  834. package/dist/src/hooks/useTurnDiffs.js +0 -160
  835. package/dist/src/hooks/useTypeahead.js +0 -1392
  836. package/dist/src/hooks/useUpdateNotification.js +0 -22
  837. package/dist/src/hooks/useVimInput.js +0 -232
  838. package/dist/src/hooks/useVirtualScroll.js +0 -627
  839. package/dist/src/hooks/useVoice.js +0 -954
  840. package/dist/src/hooks/useVoiceEnabled.js +0 -21
  841. package/dist/src/hooks/useVoiceIntegration.js +0 -631
  842. package/dist/src/hooks/useWhatsAppMirror.js +0 -46
  843. package/dist/src/index.js +0 -18
  844. package/dist/src/ink/Ansi.js +0 -269
  845. package/dist/src/ink/bidi.js +0 -117
  846. package/dist/src/ink/clearTerminal.js +0 -58
  847. package/dist/src/ink/colorize.js +0 -198
  848. package/dist/src/ink/components/AlternateScreen.js +0 -74
  849. package/dist/src/ink/components/App.js +0 -558
  850. package/dist/src/ink/components/AppContext.js +0 -11
  851. package/dist/src/ink/components/Box.js +0 -153
  852. package/dist/src/ink/components/Button.js +0 -166
  853. package/dist/src/ink/components/ClockContext.js +0 -108
  854. package/dist/src/ink/components/CursorDeclarationContext.js +0 -3
  855. package/dist/src/ink/components/ErrorOverview.js +0 -49
  856. package/dist/src/ink/components/Link.js +0 -33
  857. package/dist/src/ink/components/Newline.js +0 -29
  858. package/dist/src/ink/components/NoSelect.js +0 -56
  859. package/dist/src/ink/components/RawAnsi.js +0 -45
  860. package/dist/src/ink/components/ScrollBox.js +0 -170
  861. package/dist/src/ink/components/Spacer.js +0 -19
  862. package/dist/src/ink/components/StdinContext.js +0 -16
  863. package/dist/src/ink/components/TerminalFocusContext.js +0 -45
  864. package/dist/src/ink/components/TerminalSizeContext.js +0 -3
  865. package/dist/src/ink/components/Text.js +0 -194
  866. package/dist/src/ink/constants.js +0 -2
  867. package/dist/src/ink/devtools.js +0 -16
  868. package/dist/src/ink/dom.js +0 -298
  869. package/dist/src/ink/events/click-event.js +0 -36
  870. package/dist/src/ink/events/dispatcher.js +0 -172
  871. package/dist/src/ink/events/emitter.js +0 -31
  872. package/dist/src/ink/events/event-handlers.js +0 -30
  873. package/dist/src/ink/events/event.js +0 -9
  874. package/dist/src/ink/events/focus-event.js +0 -16
  875. package/dist/src/ink/events/input-event.js +0 -161
  876. package/dist/src/ink/events/keyboard-event.js +0 -45
  877. package/dist/src/ink/events/terminal-event.js +0 -78
  878. package/dist/src/ink/events/terminal-focus-event.js +0 -15
  879. package/dist/src/ink/focus.js +0 -158
  880. package/dist/src/ink/frame.js +0 -30
  881. package/dist/src/ink/get-max-width.js +0 -23
  882. package/dist/src/ink/hit-test.js +0 -113
  883. package/dist/src/ink/hooks/use-animation-frame.js +0 -48
  884. package/dist/src/ink/hooks/use-app.js +0 -7
  885. package/dist/src/ink/hooks/use-declared-cursor.js +0 -60
  886. package/dist/src/ink/hooks/use-input.js +0 -70
  887. package/dist/src/ink/hooks/use-interval.js +0 -54
  888. package/dist/src/ink/hooks/use-search-highlight.js +0 -32
  889. package/dist/src/ink/hooks/use-selection.js +0 -60
  890. package/dist/src/ink/hooks/use-stdin.js +0 -7
  891. package/dist/src/ink/hooks/use-tab-status.js +0 -57
  892. package/dist/src/ink/hooks/use-terminal-focus.js +0 -15
  893. package/dist/src/ink/hooks/use-terminal-title.js +0 -29
  894. package/dist/src/ink/hooks/use-terminal-viewport.js +0 -77
  895. package/dist/src/ink/ink.js +0 -1644
  896. package/dist/src/ink/instances.js +0 -7
  897. package/dist/src/ink/layout/engine.js +0 -4
  898. package/dist/src/ink/layout/geometry.js +0 -61
  899. package/dist/src/ink/layout/node.js +0 -62
  900. package/dist/src/ink/layout/yoga.js +0 -237
  901. package/dist/src/ink/line-width-cache.js +0 -19
  902. package/dist/src/ink/log-update.js +0 -583
  903. package/dist/src/ink/measure-element.js +0 -8
  904. package/dist/src/ink/measure-text.js +0 -35
  905. package/dist/src/ink/node-cache.js +0 -30
  906. package/dist/src/ink/optimizer.js +0 -81
  907. package/dist/src/ink/output.js +0 -556
  908. package/dist/src/ink/parse-keypress.js +0 -695
  909. package/dist/src/ink/reconciler.js +0 -384
  910. package/dist/src/ink/render-border.js +0 -134
  911. package/dist/src/ink/render-node-to-output.js +0 -1216
  912. package/dist/src/ink/render-to-screen.js +0 -171
  913. package/dist/src/ink/renderer.js +0 -129
  914. package/dist/src/ink/root.js +0 -80
  915. package/dist/src/ink/screen.js +0 -1132
  916. package/dist/src/ink/searchHighlight.js +0 -78
  917. package/dist/src/ink/selection.js +0 -792
  918. package/dist/src/ink/squash-text-nodes.js +0 -56
  919. package/dist/src/ink/stringWidth.js +0 -200
  920. package/dist/src/ink/styles.js +0 -299
  921. package/dist/src/ink/supports-hyperlinks.js +0 -40
  922. package/dist/src/ink/tabstops.js +0 -39
  923. package/dist/src/ink/terminal-focus-state.js +0 -35
  924. package/dist/src/ink/terminal-querier.js +0 -173
  925. package/dist/src/ink/terminal.js +0 -208
  926. package/dist/src/ink/termio/ansi.js +0 -70
  927. package/dist/src/ink/termio/csi.js +0 -260
  928. package/dist/src/ink/termio/dec.js +0 -53
  929. package/dist/src/ink/termio/esc.js +0 -55
  930. package/dist/src/ink/termio/osc.js +0 -432
  931. package/dist/src/ink/termio/parser.js +0 -356
  932. package/dist/src/ink/termio/sgr.js +0 -292
  933. package/dist/src/ink/termio/tokenize.js +0 -264
  934. package/dist/src/ink/termio/types.js +0 -55
  935. package/dist/src/ink/termio.js +0 -24
  936. package/dist/src/ink/useTerminalNotification.js +0 -57
  937. package/dist/src/ink/warn.js +0 -10
  938. package/dist/src/ink/widest-line.js +0 -14
  939. package/dist/src/ink/wrap-text.js +0 -54
  940. package/dist/src/ink/wrapAnsi.js +0 -6
  941. package/dist/src/ink.js +0 -50
  942. package/dist/src/interactiveHelpers.js +0 -317
  943. package/dist/src/keybindings/KeybindingContext.js +0 -184
  944. package/dist/src/keybindings/KeybindingProviderSetup.js +0 -259
  945. package/dist/src/keybindings/defaultBindings.js +0 -333
  946. package/dist/src/keybindings/loadUserBindings.js +0 -393
  947. package/dist/src/keybindings/match.js +0 -111
  948. package/dist/src/keybindings/parser.js +0 -184
  949. package/dist/src/keybindings/reservedShortcuts.js +0 -109
  950. package/dist/src/keybindings/resolver.js +0 -182
  951. package/dist/src/keybindings/schema.js +0 -205
  952. package/dist/src/keybindings/shortcutFormat.js +0 -48
  953. package/dist/src/keybindings/template.js +0 -40
  954. package/dist/src/keybindings/useKeybinding.js +0 -161
  955. package/dist/src/keybindings/useShortcutDisplay.js +0 -43
  956. package/dist/src/keybindings/validate.js +0 -395
  957. package/dist/src/main.js +0 -4073
  958. package/dist/src/memdir/findRelevantMemories.js +0 -101
  959. package/dist/src/memdir/memdir.js +0 -408
  960. package/dist/src/memdir/memoryAge.js +0 -52
  961. package/dist/src/memdir/memoryScan.js +0 -65
  962. package/dist/src/memdir/memoryTypes.js +0 -260
  963. package/dist/src/memdir/paths.js +0 -236
  964. package/dist/src/memdir/teamMemPaths.js +0 -261
  965. package/dist/src/memdir/teamMemPrompts.js +0 -82
  966. package/dist/src/migrations/migrateAutoUpdatesToSettings.js +0 -47
  967. package/dist/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +0 -32
  968. package/dist/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +0 -83
  969. package/dist/src/migrations/migrateFennecToOpus.js +0 -39
  970. package/dist/src/migrations/migrateLegacyOpusToCurrent.js +0 -44
  971. package/dist/src/migrations/migrateOpusToOpus1m.js +0 -31
  972. package/dist/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +0 -23
  973. package/dist/src/migrations/migrateSonnet1mToSonnet45.js +0 -38
  974. package/dist/src/migrations/migrateSonnet45ToSonnet46.js +0 -48
  975. package/dist/src/migrations/resetAutoModeOptInForDefaultOffer.js +0 -47
  976. package/dist/src/migrations/resetProToOpusDefault.js +0 -46
  977. package/dist/src/mirrors/shared.js +0 -186
  978. package/dist/src/moreright/useMoreRight.js +0 -13
  979. package/dist/src/native-ts/color-diff/index.js +0 -821
  980. package/dist/src/native-ts/file-index/index.js +0 -328
  981. package/dist/src/native-ts/yoga-layout/enums.js +0 -101
  982. package/dist/src/native-ts/yoga-layout/index.js +0 -2113
  983. package/dist/src/outputStyles/loadOutputStylesDir.js +0 -71
  984. package/dist/src/plugins/builtinPlugins.js +0 -132
  985. package/dist/src/plugins/bundled/index.js +0 -22
  986. package/dist/src/projectOnboardingState.js +0 -61
  987. package/dist/src/query/config.js +0 -17
  988. package/dist/src/query/deps.js +0 -12
  989. package/dist/src/query/stopHooks.js +0 -334
  990. package/dist/src/query/tokenBudget.js +0 -49
  991. package/dist/src/query.js +0 -1330
  992. package/dist/src/recovery/bunBundleShim.js +0 -11
  993. package/dist/src/remote/RemoteSessionManager.js +0 -195
  994. package/dist/src/remote/SessionsWebSocket.js +0 -305
  995. package/dist/src/remote/remotePermissionBridge.js +0 -70
  996. package/dist/src/remote/sdkMessageAdapter.js +0 -227
  997. package/dist/src/replLauncher.js +0 -6
  998. package/dist/src/schemas/hooks.js +0 -174
  999. package/dist/src/screens/Doctor.js +0 -580
  1000. package/dist/src/screens/REPL.js +0 -4434
  1001. package/dist/src/screens/ResumeConversation.js +0 -341
  1002. package/dist/src/self-hosted-runner/main.js +0 -16
  1003. package/dist/src/server/backends/dangerousBackend.js +0 -16
  1004. package/dist/src/server/connectHeadless.js +0 -16
  1005. package/dist/src/server/createDirectConnectSession.js +0 -62
  1006. package/dist/src/server/directConnectManager.js +0 -153
  1007. package/dist/src/server/lockfile.js +0 -16
  1008. package/dist/src/server/parseConnectUrl.js +0 -16
  1009. package/dist/src/server/server.js +0 -16
  1010. package/dist/src/server/serverBanner.js +0 -16
  1011. package/dist/src/server/serverLog.js +0 -16
  1012. package/dist/src/server/sessionManager.js +0 -16
  1013. package/dist/src/server/types.js +0 -7
  1014. package/dist/src/services/AgentSummary/agentSummary.js +0 -147
  1015. package/dist/src/services/MagicDocs/magicDocs.js +0 -193
  1016. package/dist/src/services/MagicDocs/prompts.js +0 -110
  1017. package/dist/src/services/PromptSuggestion/promptSuggestion.js +0 -402
  1018. package/dist/src/services/PromptSuggestion/speculation.js +0 -643
  1019. package/dist/src/services/SessionMemory/prompts.js +0 -254
  1020. package/dist/src/services/SessionMemory/sessionMemory.js +0 -358
  1021. package/dist/src/services/SessionMemory/sessionMemoryUtils.js +0 -157
  1022. package/dist/src/services/analytics/config.js +0 -33
  1023. package/dist/src/services/analytics/datadog.js +0 -259
  1024. package/dist/src/services/analytics/firstPartyEventLogger.js +0 -342
  1025. package/dist/src/services/analytics/firstPartyEventLoggingExporter.js +0 -594
  1026. package/dist/src/services/analytics/growthbook.js +0 -952
  1027. package/dist/src/services/analytics/index.js +0 -114
  1028. package/dist/src/services/analytics/metadata.js +0 -698
  1029. package/dist/src/services/analytics/sink.js +0 -95
  1030. package/dist/src/services/analytics/sinkKillswitch.js +0 -19
  1031. package/dist/src/services/api/adminRequests.js +0 -57
  1032. package/dist/src/services/api/bootstrap.js +0 -149
  1033. package/dist/src/services/api/claude.js +0 -2461
  1034. package/dist/src/services/api/client.js +0 -325
  1035. package/dist/src/services/api/dumpPrompts.js +0 -174
  1036. package/dist/src/services/api/emptyUsage.js +0 -20
  1037. package/dist/src/services/api/errorUtils.js +0 -203
  1038. package/dist/src/services/api/errors.js +0 -934
  1039. package/dist/src/services/api/filesApi.js +0 -523
  1040. package/dist/src/services/api/firstTokenDate.js +0 -49
  1041. package/dist/src/services/api/grove.js +0 -272
  1042. package/dist/src/services/api/index.js +0 -23
  1043. package/dist/src/services/api/logging.js +0 -484
  1044. package/dist/src/services/api/metricsOptOut.js +0 -127
  1045. package/dist/src/services/api/openai.js +0 -1187
  1046. package/dist/src/services/api/openrouter.js +0 -30
  1047. package/dist/src/services/api/overageCreditGrant.js +0 -123
  1048. package/dist/src/services/api/promptCacheBreakDetection.js +0 -510
  1049. package/dist/src/services/api/referral.js +0 -219
  1050. package/dist/src/services/api/sessionIngress.js +0 -358
  1051. package/dist/src/services/api/ultrareviewQuota.js +0 -29
  1052. package/dist/src/services/api/usage.js +0 -31
  1053. package/dist/src/services/api/withRetry.js +0 -599
  1054. package/dist/src/services/autoDream/autoDream.js +0 -244
  1055. package/dist/src/services/autoDream/config.js +0 -17
  1056. package/dist/src/services/autoDream/consolidationLock.js +0 -122
  1057. package/dist/src/services/autoDream/consolidationPrompt.js +0 -56
  1058. package/dist/src/services/awaySummary.js +0 -61
  1059. package/dist/src/services/claudeAiLimits.js +0 -331
  1060. package/dist/src/services/claudeAiLimitsHook.js +0 -15
  1061. package/dist/src/services/compact/apiMicrocompact.js +0 -97
  1062. package/dist/src/services/compact/autoCompact.js +0 -236
  1063. package/dist/src/services/compact/cachedMicrocompact.js +0 -16
  1064. package/dist/src/services/compact/compact.js +0 -1258
  1065. package/dist/src/services/compact/compactWarningHook.js +0 -12
  1066. package/dist/src/services/compact/compactWarningState.js +0 -15
  1067. package/dist/src/services/compact/grouping.js +0 -58
  1068. package/dist/src/services/compact/microCompact.js +0 -414
  1069. package/dist/src/services/compact/postCompactCleanup.js +0 -72
  1070. package/dist/src/services/compact/prompt.js +0 -327
  1071. package/dist/src/services/compact/sessionMemoryCompact.js +0 -467
  1072. package/dist/src/services/compact/timeBasedMCConfig.js +0 -11
  1073. package/dist/src/services/diagnosticTracking.js +0 -282
  1074. package/dist/src/services/extractMemories/extractMemories.js +0 -444
  1075. package/dist/src/services/extractMemories/prompts.js +0 -129
  1076. package/dist/src/services/internalLogging.js +0 -68
  1077. package/dist/src/services/lsp/LSPClient.js +0 -306
  1078. package/dist/src/services/lsp/LSPDiagnosticRegistry.js +0 -277
  1079. package/dist/src/services/lsp/LSPServerInstance.js +0 -390
  1080. package/dist/src/services/lsp/LSPServerManager.js +0 -305
  1081. package/dist/src/services/lsp/config.js +0 -57
  1082. package/dist/src/services/lsp/manager.js +0 -246
  1083. package/dist/src/services/lsp/passiveFeedback.js +0 -226
  1084. package/dist/src/services/mcp/InProcessTransport.js +0 -54
  1085. package/dist/src/services/mcp/MCPConnectionManager.js +0 -50
  1086. package/dist/src/services/mcp/SdkControlTransport.js +0 -115
  1087. package/dist/src/services/mcp/auth.js +0 -1882
  1088. package/dist/src/services/mcp/channelAllowlist.js +0 -57
  1089. package/dist/src/services/mcp/channelNotification.js +0 -236
  1090. package/dist/src/services/mcp/channelPermissions.js +0 -192
  1091. package/dist/src/services/mcp/claudeai.js +0 -123
  1092. package/dist/src/services/mcp/client.js +0 -2480
  1093. package/dist/src/services/mcp/config.js +0 -1277
  1094. package/dist/src/services/mcp/elicitationHandler.js +0 -192
  1095. package/dist/src/services/mcp/envExpansion.js +0 -30
  1096. package/dist/src/services/mcp/headersHelper.js +0 -94
  1097. package/dist/src/services/mcp/mcpStringUtils.js +0 -85
  1098. package/dist/src/services/mcp/normalization.js +0 -21
  1099. package/dist/src/services/mcp/oauthPort.js +0 -69
  1100. package/dist/src/services/mcp/officialRegistry.js +0 -54
  1101. package/dist/src/services/mcp/types.js +0 -94
  1102. package/dist/src/services/mcp/useManageMCPConnections.js +0 -820
  1103. package/dist/src/services/mcp/utils.js +0 -433
  1104. package/dist/src/services/mcp/vscodeSdkMcp.js +0 -69
  1105. package/dist/src/services/mcp/xaa.js +0 -342
  1106. package/dist/src/services/mcp/xaaIdpLogin.js +0 -377
  1107. package/dist/src/services/mcpServerApproval.js +0 -29
  1108. package/dist/src/services/mockRateLimits.js +0 -666
  1109. package/dist/src/services/notifier.js +0 -114
  1110. package/dist/src/services/oauth/auth-code-listener.js +0 -236
  1111. package/dist/src/services/oauth/client.js +0 -545
  1112. package/dist/src/services/oauth/crypto.js +0 -19
  1113. package/dist/src/services/oauth/getOauthProfile.js +0 -48
  1114. package/dist/src/services/oauth/index.js +0 -152
  1115. package/dist/src/services/oauth/types.js +0 -1
  1116. package/dist/src/services/plugins/PluginInstallationManager.js +0 -139
  1117. package/dist/src/services/plugins/pluginCliCommands.js +0 -230
  1118. package/dist/src/services/plugins/pluginOperations.js +0 -826
  1119. package/dist/src/services/policyLimits/index.js +0 -547
  1120. package/dist/src/services/policyLimits/types.js +0 -9
  1121. package/dist/src/services/preventSleep.js +0 -143
  1122. package/dist/src/services/rateLimitMessages.js +0 -271
  1123. package/dist/src/services/rateLimitMocking.js +0 -91
  1124. package/dist/src/services/remoteManagedSettings/index.js +0 -534
  1125. package/dist/src/services/remoteManagedSettings/securityCheck.js +0 -59
  1126. package/dist/src/services/remoteManagedSettings/syncCache.js +0 -90
  1127. package/dist/src/services/remoteManagedSettings/syncCacheState.js +0 -89
  1128. package/dist/src/services/remoteManagedSettings/types.js +0 -12
  1129. package/dist/src/services/settingsSync/index.js +0 -478
  1130. package/dist/src/services/settingsSync/types.js +0 -35
  1131. package/dist/src/services/teamMemorySync/index.js +0 -976
  1132. package/dist/src/services/teamMemorySync/secretScanner.js +0 -275
  1133. package/dist/src/services/teamMemorySync/teamMemSecretGuard.js +0 -35
  1134. package/dist/src/services/teamMemorySync/types.js +0 -47
  1135. package/dist/src/services/teamMemorySync/watcher.js +0 -326
  1136. package/dist/src/services/tips/tipHistory.js +0 -17
  1137. package/dist/src/services/tips/tipRegistry.js +0 -589
  1138. package/dist/src/services/tips/tipScheduler.js +0 -40
  1139. package/dist/src/services/tokenEstimation.js +0 -365
  1140. package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +0 -87
  1141. package/dist/src/services/tools/StreamingToolExecutor.js +0 -413
  1142. package/dist/src/services/tools/toolExecution.js +0 -1218
  1143. package/dist/src/services/tools/toolHooks.js +0 -454
  1144. package/dist/src/services/tools/toolOrchestration.js +0 -110
  1145. package/dist/src/services/vcr.js +0 -291
  1146. package/dist/src/services/voice.js +0 -394
  1147. package/dist/src/services/voiceKeyterms.js +0 -94
  1148. package/dist/src/services/voiceStreamSTT.js +0 -406
  1149. package/dist/src/setup.js +0 -349
  1150. package/dist/src/skills/bundled/batch.js +0 -114
  1151. package/dist/src/skills/bundled/claudeApi.js +0 -145
  1152. package/dist/src/skills/bundled/claudeApiContent.js +0 -14
  1153. package/dist/src/skills/bundled/claudeInChrome.js +0 -27
  1154. package/dist/src/skills/bundled/debug.js +0 -99
  1155. package/dist/src/skills/bundled/index.js +0 -5
  1156. package/dist/src/skills/bundled/keybindings.js +0 -292
  1157. package/dist/src/skills/bundled/loop.js +0 -81
  1158. package/dist/src/skills/bundled/loremIpsum.js +0 -266
  1159. package/dist/src/skills/bundled/remember.js +0 -75
  1160. package/dist/src/skills/bundled/scheduleRemoteAgents.js +0 -373
  1161. package/dist/src/skills/bundled/simplify.js +0 -66
  1162. package/dist/src/skills/bundled/skillify.js +0 -184
  1163. package/dist/src/skills/bundled/stuck.js +0 -75
  1164. package/dist/src/skills/bundled/updateConfig.js +0 -463
  1165. package/dist/src/skills/bundled/verify.js +0 -25
  1166. package/dist/src/skills/bundled/verifyContent.js +0 -7
  1167. package/dist/src/skills/bundledSkills.js +0 -159
  1168. package/dist/src/skills/loadSkillsDir.js +0 -736
  1169. package/dist/src/skills/mcpSkillBuilders.js +0 -10
  1170. package/dist/src/ssh/createSSHSession.js +0 -16
  1171. package/dist/src/state/AppState.js +0 -184
  1172. package/dist/src/state/AppStateStore.js +0 -119
  1173. package/dist/src/state/onChangeAppState.js +0 -132
  1174. package/dist/src/state/selectors.js +0 -51
  1175. package/dist/src/state/store.js +0 -21
  1176. package/dist/src/state/teammateViewHelpers.js +0 -124
  1177. package/dist/src/tasks/DreamTask/DreamTask.js +0 -99
  1178. package/dist/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +0 -116
  1179. package/dist/src/tasks/InProcessTeammateTask/types.js +0 -35
  1180. package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +0 -507
  1181. package/dist/src/tasks/LocalMainSessionTask.js +0 -338
  1182. package/dist/src/tasks/LocalShellTask/LocalShellTask.js +0 -475
  1183. package/dist/src/tasks/LocalShellTask/guards.js +0 -9
  1184. package/dist/src/tasks/LocalShellTask/killShellTasks.js +0 -59
  1185. package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +0 -742
  1186. package/dist/src/tasks/pillLabel.js +0 -69
  1187. package/dist/src/tasks/stopTask.js +0 -67
  1188. package/dist/src/tasks/types.js +0 -18
  1189. package/dist/src/tasks.js +0 -39
  1190. package/dist/src/telegram/bridge.js +0 -334
  1191. package/dist/src/telegram/config.js +0 -57
  1192. package/dist/src/telegram/mirror.js +0 -91
  1193. package/dist/src/tools/AgentTool/AgentTool.js +0 -1222
  1194. package/dist/src/tools/AgentTool/UI.js +0 -592
  1195. package/dist/src/tools/AgentTool/agentColorManager.js +0 -43
  1196. package/dist/src/tools/AgentTool/agentDisplay.js +0 -72
  1197. package/dist/src/tools/AgentTool/agentMemory.js +0 -125
  1198. package/dist/src/tools/AgentTool/agentMemorySnapshot.js +0 -136
  1199. package/dist/src/tools/AgentTool/agentToolUtils.js +0 -456
  1200. package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +0 -175
  1201. package/dist/src/tools/AgentTool/built-in/exploreAgent.js +0 -76
  1202. package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +0 -28
  1203. package/dist/src/tools/AgentTool/built-in/planAgent.js +0 -87
  1204. package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +0 -140
  1205. package/dist/src/tools/AgentTool/built-in/verificationAgent.js +0 -146
  1206. package/dist/src/tools/AgentTool/builtInAgents.js +0 -58
  1207. package/dist/src/tools/AgentTool/constants.js +0 -11
  1208. package/dist/src/tools/AgentTool/forkSubagent.js +0 -177
  1209. package/dist/src/tools/AgentTool/loadAgentsDir.js +0 -497
  1210. package/dist/src/tools/AgentTool/prompt.js +0 -260
  1211. package/dist/src/tools/AgentTool/resumeAgent.js +0 -182
  1212. package/dist/src/tools/AgentTool/runAgent.js +0 -629
  1213. package/dist/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +0 -237
  1214. package/dist/src/tools/AskUserQuestionTool/prompt.js +0 -38
  1215. package/dist/src/tools/BashTool/BashTool.js +0 -1008
  1216. package/dist/src/tools/BashTool/BashToolResultMessage.js +0 -168
  1217. package/dist/src/tools/BashTool/UI.js +0 -133
  1218. package/dist/src/tools/BashTool/bashCommandHelpers.js +0 -184
  1219. package/dist/src/tools/BashTool/bashPermissions.js +0 -2023
  1220. package/dist/src/tools/BashTool/bashSecurity.js +0 -2267
  1221. package/dist/src/tools/BashTool/commandSemantics.js +0 -105
  1222. package/dist/src/tools/BashTool/commentLabel.js +0 -14
  1223. package/dist/src/tools/BashTool/destructiveCommandWarning.js +0 -88
  1224. package/dist/src/tools/BashTool/modeValidation.js +0 -86
  1225. package/dist/src/tools/BashTool/pathValidation.js +0 -1080
  1226. package/dist/src/tools/BashTool/prompt.js +0 -333
  1227. package/dist/src/tools/BashTool/readOnlyValidation.js +0 -1794
  1228. package/dist/src/tools/BashTool/sedEditParser.js +0 -282
  1229. package/dist/src/tools/BashTool/sedValidation.js +0 -580
  1230. package/dist/src/tools/BashTool/shouldUseSandbox.js +0 -125
  1231. package/dist/src/tools/BashTool/toolName.js +0 -2
  1232. package/dist/src/tools/BashTool/utils.js +0 -180
  1233. package/dist/src/tools/BriefTool/BriefTool.js +0 -172
  1234. package/dist/src/tools/BriefTool/UI.js +0 -66
  1235. package/dist/src/tools/BriefTool/attachments.js +0 -86
  1236. package/dist/src/tools/BriefTool/prompt.js +0 -19
  1237. package/dist/src/tools/BriefTool/upload.js +0 -136
  1238. package/dist/src/tools/ConfigTool/ConfigTool.js +0 -398
  1239. package/dist/src/tools/ConfigTool/UI.js +0 -24
  1240. package/dist/src/tools/ConfigTool/constants.js +0 -1
  1241. package/dist/src/tools/ConfigTool/prompt.js +0 -82
  1242. package/dist/src/tools/ConfigTool/supportedSettings.js +0 -180
  1243. package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +0 -98
  1244. package/dist/src/tools/EnterPlanModeTool/UI.js +0 -13
  1245. package/dist/src/tools/EnterPlanModeTool/constants.js +0 -1
  1246. package/dist/src/tools/EnterPlanModeTool/prompt.js +0 -164
  1247. package/dist/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +0 -104
  1248. package/dist/src/tools/EnterWorktreeTool/UI.js +0 -8
  1249. package/dist/src/tools/EnterWorktreeTool/constants.js +0 -1
  1250. package/dist/src/tools/EnterWorktreeTool/prompt.js +0 -30
  1251. package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +0 -385
  1252. package/dist/src/tools/ExitPlanModeTool/UI.js +0 -31
  1253. package/dist/src/tools/ExitPlanModeTool/constants.js +0 -2
  1254. package/dist/src/tools/ExitPlanModeTool/prompt.js +0 -27
  1255. package/dist/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +0 -257
  1256. package/dist/src/tools/ExitWorktreeTool/UI.js +0 -9
  1257. package/dist/src/tools/ExitWorktreeTool/constants.js +0 -1
  1258. package/dist/src/tools/ExitWorktreeTool/prompt.js +0 -32
  1259. package/dist/src/tools/FileEditTool/FileEditTool.js +0 -480
  1260. package/dist/src/tools/FileEditTool/UI.js +0 -201
  1261. package/dist/src/tools/FileEditTool/constants.js +0 -7
  1262. package/dist/src/tools/FileEditTool/prompt.js +0 -24
  1263. package/dist/src/tools/FileEditTool/types.js +0 -50
  1264. package/dist/src/tools/FileEditTool/utils.js +0 -579
  1265. package/dist/src/tools/FileReadTool/FileReadTool.js +0 -889
  1266. package/dist/src/tools/FileReadTool/UI.js +0 -125
  1267. package/dist/src/tools/FileReadTool/imageProcessor.js +0 -46
  1268. package/dist/src/tools/FileReadTool/limits.js +0 -70
  1269. package/dist/src/tools/FileReadTool/prompt.js +0 -31
  1270. package/dist/src/tools/FileWriteTool/FileWriteTool.js +0 -341
  1271. package/dist/src/tools/FileWriteTool/UI.js +0 -338
  1272. package/dist/src/tools/FileWriteTool/prompt.js +0 -15
  1273. package/dist/src/tools/GlobTool/GlobTool.js +0 -161
  1274. package/dist/src/tools/GlobTool/UI.js +0 -39
  1275. package/dist/src/tools/GlobTool/prompt.js +0 -6
  1276. package/dist/src/tools/GrepTool/GrepTool.js +0 -439
  1277. package/dist/src/tools/GrepTool/UI.js +0 -154
  1278. package/dist/src/tools/GrepTool/prompt.js +0 -16
  1279. package/dist/src/tools/LSPTool/LSPTool.js +0 -660
  1280. package/dist/src/tools/LSPTool/UI.js +0 -204
  1281. package/dist/src/tools/LSPTool/formatters.js +0 -445
  1282. package/dist/src/tools/LSPTool/prompt.js +0 -20
  1283. package/dist/src/tools/LSPTool/schemas.js +0 -197
  1284. package/dist/src/tools/LSPTool/symbolContext.js +0 -75
  1285. package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +0 -100
  1286. package/dist/src/tools/ListMcpResourcesTool/UI.js +0 -16
  1287. package/dist/src/tools/ListMcpResourcesTool/prompt.js +0 -18
  1288. package/dist/src/tools/MCPTool/MCPTool.js +0 -60
  1289. package/dist/src/tools/MCPTool/UI.js +0 -342
  1290. package/dist/src/tools/MCPTool/classifyForCollapse.js +0 -597
  1291. package/dist/src/tools/MCPTool/prompt.js +0 -3
  1292. package/dist/src/tools/McpAuthTool/McpAuthTool.js +0 -162
  1293. package/dist/src/tools/NotebookEditTool/NotebookEditTool.js +0 -421
  1294. package/dist/src/tools/NotebookEditTool/UI.js +0 -40
  1295. package/dist/src/tools/NotebookEditTool/constants.js +0 -2
  1296. package/dist/src/tools/NotebookEditTool/prompt.js +0 -2
  1297. package/dist/src/tools/PowerShellTool/PowerShellTool.js +0 -899
  1298. package/dist/src/tools/PowerShellTool/UI.js +0 -57
  1299. package/dist/src/tools/PowerShellTool/clmTypes.js +0 -207
  1300. package/dist/src/tools/PowerShellTool/commandSemantics.js +0 -115
  1301. package/dist/src/tools/PowerShellTool/commonParameters.js +0 -27
  1302. package/dist/src/tools/PowerShellTool/destructiveCommandWarning.js +0 -92
  1303. package/dist/src/tools/PowerShellTool/gitSafety.js +0 -185
  1304. package/dist/src/tools/PowerShellTool/modeValidation.js +0 -357
  1305. package/dist/src/tools/PowerShellTool/pathValidation.js +0 -1712
  1306. package/dist/src/tools/PowerShellTool/powershellPermissions.js +0 -1351
  1307. package/dist/src/tools/PowerShellTool/powershellSecurity.js +0 -942
  1308. package/dist/src/tools/PowerShellTool/prompt.js +0 -132
  1309. package/dist/src/tools/PowerShellTool/readOnlyValidation.js +0 -1633
  1310. package/dist/src/tools/PowerShellTool/toolName.js +0 -2
  1311. package/dist/src/tools/REPLTool/constants.js +0 -43
  1312. package/dist/src/tools/REPLTool/primitiveTools.js +0 -36
  1313. package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +0 -112
  1314. package/dist/src/tools/ReadMcpResourceTool/UI.js +0 -23
  1315. package/dist/src/tools/ReadMcpResourceTool/prompt.js +0 -15
  1316. package/dist/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +0 -142
  1317. package/dist/src/tools/RemoteTriggerTool/UI.js +0 -11
  1318. package/dist/src/tools/RemoteTriggerTool/prompt.js +0 -12
  1319. package/dist/src/tools/ScheduleCronTool/CronCreateTool.js +0 -120
  1320. package/dist/src/tools/ScheduleCronTool/CronDeleteTool.js +0 -74
  1321. package/dist/src/tools/ScheduleCronTool/CronListTool.js +0 -77
  1322. package/dist/src/tools/ScheduleCronTool/UI.js +0 -28
  1323. package/dist/src/tools/ScheduleCronTool/prompt.js +0 -115
  1324. package/dist/src/tools/SendMessageTool/SendMessageTool.js +0 -675
  1325. package/dist/src/tools/SendMessageTool/UI.js +0 -23
  1326. package/dist/src/tools/SendMessageTool/constants.js +0 -1
  1327. package/dist/src/tools/SendMessageTool/prompt.js +0 -47
  1328. package/dist/src/tools/SkillTool/SkillTool.js +0 -827
  1329. package/dist/src/tools/SkillTool/UI.js +0 -60
  1330. package/dist/src/tools/SkillTool/constants.js +0 -1
  1331. package/dist/src/tools/SkillTool/prompt.js +0 -184
  1332. package/dist/src/tools/SleepTool/prompt.js +0 -14
  1333. package/dist/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +0 -138
  1334. package/dist/src/tools/TaskCreateTool/TaskCreateTool.js +0 -104
  1335. package/dist/src/tools/TaskCreateTool/constants.js +0 -1
  1336. package/dist/src/tools/TaskCreateTool/prompt.js +0 -52
  1337. package/dist/src/tools/TaskGetTool/TaskGetTool.js +0 -106
  1338. package/dist/src/tools/TaskGetTool/constants.js +0 -1
  1339. package/dist/src/tools/TaskGetTool/prompt.js +0 -23
  1340. package/dist/src/tools/TaskListTool/TaskListTool.js +0 -89
  1341. package/dist/src/tools/TaskListTool/constants.js +0 -1
  1342. package/dist/src/tools/TaskListTool/prompt.js +0 -44
  1343. package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +0 -535
  1344. package/dist/src/tools/TaskOutputTool/constants.js +0 -1
  1345. package/dist/src/tools/TaskStopTool/TaskStopTool.js +0 -110
  1346. package/dist/src/tools/TaskStopTool/UI.js +0 -30
  1347. package/dist/src/tools/TaskStopTool/prompt.js +0 -7
  1348. package/dist/src/tools/TaskUpdateTool/TaskUpdateTool.js +0 -301
  1349. package/dist/src/tools/TaskUpdateTool/constants.js +0 -1
  1350. package/dist/src/tools/TaskUpdateTool/prompt.js +0 -76
  1351. package/dist/src/tools/TeamCreateTool/TeamCreateTool.js +0 -177
  1352. package/dist/src/tools/TeamCreateTool/UI.js +0 -4
  1353. package/dist/src/tools/TeamCreateTool/constants.js +0 -1
  1354. package/dist/src/tools/TeamCreateTool/prompt.js +0 -113
  1355. package/dist/src/tools/TeamDeleteTool/TeamDeleteTool.js +0 -102
  1356. package/dist/src/tools/TeamDeleteTool/UI.js +0 -13
  1357. package/dist/src/tools/TeamDeleteTool/constants.js +0 -1
  1358. package/dist/src/tools/TeamDeleteTool/prompt.js +0 -16
  1359. package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +0 -99
  1360. package/dist/src/tools/TodoWriteTool/constants.js +0 -1
  1361. package/dist/src/tools/TodoWriteTool/prompt.js +0 -181
  1362. package/dist/src/tools/ToolSearchTool/ToolSearchTool.js +0 -357
  1363. package/dist/src/tools/ToolSearchTool/constants.js +0 -1
  1364. package/dist/src/tools/ToolSearchTool/prompt.js +0 -99
  1365. package/dist/src/tools/TungstenTool/TungstenLiveMonitor.js +0 -7
  1366. package/dist/src/tools/TungstenTool/TungstenTool.js +0 -3
  1367. package/dist/src/tools/WebFetchTool/UI.js +0 -30
  1368. package/dist/src/tools/WebFetchTool/WebFetchTool.js +0 -246
  1369. package/dist/src/tools/WebFetchTool/preapproved.js +0 -155
  1370. package/dist/src/tools/WebFetchTool/prompt.js +0 -39
  1371. package/dist/src/tools/WebFetchTool/utils.js +0 -381
  1372. package/dist/src/tools/WebSearchTool/UI.js +0 -66
  1373. package/dist/src/tools/WebSearchTool/WebSearchTool.js +0 -352
  1374. package/dist/src/tools/WebSearchTool/prompt.js +0 -32
  1375. package/dist/src/tools/WorkflowTool/constants.js +0 -2
  1376. package/dist/src/tools/shared/gitOperationTracking.js +0 -220
  1377. package/dist/src/tools/shared/spawnMultiAgent.js +0 -805
  1378. package/dist/src/tools/testing/TestingPermissionTool.js +0 -72
  1379. package/dist/src/tools/utils.js +0 -24
  1380. package/dist/src/tools.js +0 -332
  1381. package/dist/src/types/command.js +0 -10
  1382. package/dist/src/types/connectorText.js +0 -2
  1383. package/dist/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +0 -673
  1384. package/dist/src/types/generated/events_mono/common/v1/auth.js +0 -49
  1385. package/dist/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +0 -147
  1386. package/dist/src/types/generated/google/protobuf/timestamp.js +0 -38
  1387. package/dist/src/types/hooks.js +0 -153
  1388. package/dist/src/types/ids.js +0 -27
  1389. package/dist/src/types/logs.js +0 -11
  1390. package/dist/src/types/message.js +0 -1
  1391. package/dist/src/types/permissions.js +0 -25
  1392. package/dist/src/types/plugin.js +0 -72
  1393. package/dist/src/types/textInputTypes.js +0 -20
  1394. package/dist/src/types/utils.js +0 -5
  1395. package/dist/src/upstreamproxy/relay.js +0 -346
  1396. package/dist/src/upstreamproxy/upstreamproxy.js +0 -236
  1397. package/dist/src/utils/CircularBuffer.js +0 -75
  1398. package/dist/src/utils/Cursor.js +0 -1229
  1399. package/dist/src/utils/QueryGuard.js +0 -115
  1400. package/dist/src/utils/Shell.js +0 -374
  1401. package/dist/src/utils/ShellCommand.js +0 -338
  1402. package/dist/src/utils/abortController.js +0 -74
  1403. package/dist/src/utils/activityManager.js +0 -127
  1404. package/dist/src/utils/advisor.js +0 -77
  1405. package/dist/src/utils/agentContext.js +0 -91
  1406. package/dist/src/utils/agentId.js +0 -83
  1407. package/dist/src/utils/agentSwarmsEnabled.js +0 -37
  1408. package/dist/src/utils/agenticSessionSearch.js +0 -255
  1409. package/dist/src/utils/analyzeContext.js +0 -848
  1410. package/dist/src/utils/ansiToPng.js +0 -259
  1411. package/dist/src/utils/ansiToSvg.js +0 -207
  1412. package/dist/src/utils/api.js +0 -555
  1413. package/dist/src/utils/apiPreconnect.js +0 -62
  1414. package/dist/src/utils/appleTerminalBackup.js +0 -95
  1415. package/dist/src/utils/argumentSubstitution.js +0 -114
  1416. package/dist/src/utils/array.js +0 -12
  1417. package/dist/src/utils/asciicast.js +0 -200
  1418. package/dist/src/utils/attachments.js +0 -2514
  1419. package/dist/src/utils/attribution.js +0 -308
  1420. package/dist/src/utils/attributionHooks.js +0 -16
  1421. package/dist/src/utils/attributionTrailer.js +0 -16
  1422. package/dist/src/utils/auth.js +0 -2020
  1423. package/dist/src/utils/authFileDescriptor.js +0 -152
  1424. package/dist/src/utils/authPortable.js +0 -14
  1425. package/dist/src/utils/autoModeDenials.js +0 -15
  1426. package/dist/src/utils/autoRunIssue.js +0 -112
  1427. package/dist/src/utils/autoUpdater.js +0 -461
  1428. package/dist/src/utils/aws.js +0 -44
  1429. package/dist/src/utils/awsAuthStatusManager.js +0 -66
  1430. package/dist/src/utils/background/remote/preconditions.js +0 -175
  1431. package/dist/src/utils/background/remote/remoteSession.js +0 -53
  1432. package/dist/src/utils/backgroundHousekeeping.js +0 -66
  1433. package/dist/src/utils/bash/ParsedCommand.js +0 -241
  1434. package/dist/src/utils/bash/ShellSnapshot.js +0 -489
  1435. package/dist/src/utils/bash/ast.js +0 -2590
  1436. package/dist/src/utils/bash/bashParser.js +0 -4355
  1437. package/dist/src/utils/bash/bashPipeCommand.js +0 -249
  1438. package/dist/src/utils/bash/commands.js +0 -1131
  1439. package/dist/src/utils/bash/heredoc.js +0 -647
  1440. package/dist/src/utils/bash/parser.js +0 -195
  1441. package/dist/src/utils/bash/prefix.js +0 -154
  1442. package/dist/src/utils/bash/registry.js +0 -23
  1443. package/dist/src/utils/bash/shellCompletion.js +0 -196
  1444. package/dist/src/utils/bash/shellPrefix.js +0 -25
  1445. package/dist/src/utils/bash/shellQuote.js +0 -253
  1446. package/dist/src/utils/bash/shellQuoting.js +0 -106
  1447. package/dist/src/utils/bash/specs/alias.js +0 -11
  1448. package/dist/src/utils/bash/specs/index.js +0 -16
  1449. package/dist/src/utils/bash/specs/nohup.js +0 -10
  1450. package/dist/src/utils/bash/specs/pyright.js +0 -88
  1451. package/dist/src/utils/bash/specs/sleep.js +0 -10
  1452. package/dist/src/utils/bash/specs/srun.js +0 -28
  1453. package/dist/src/utils/bash/specs/time.js +0 -10
  1454. package/dist/src/utils/bash/specs/timeout.js +0 -17
  1455. package/dist/src/utils/bash/treeSitterAnalysis.js +0 -407
  1456. package/dist/src/utils/betas.js +0 -332
  1457. package/dist/src/utils/billing.js +0 -54
  1458. package/dist/src/utils/binaryCheck.js +0 -40
  1459. package/dist/src/utils/browser.js +0 -58
  1460. package/dist/src/utils/bufferedWriter.js +0 -77
  1461. package/dist/src/utils/bundledMode.js +0 -19
  1462. package/dist/src/utils/caCerts.js +0 -93
  1463. package/dist/src/utils/caCertsConfig.js +0 -77
  1464. package/dist/src/utils/cachePaths.js +0 -28
  1465. package/dist/src/utils/ccshareResume.js +0 -16
  1466. package/dist/src/utils/classifierApprovals.js +0 -66
  1467. package/dist/src/utils/classifierApprovalsHook.js +0 -10
  1468. package/dist/src/utils/claudeCodeHints.js +0 -142
  1469. package/dist/src/utils/claudeDesktop.js +0 -108
  1470. package/dist/src/utils/claudeInChrome/chromeNativeHost.js +0 -416
  1471. package/dist/src/utils/claudeInChrome/common.js +0 -466
  1472. package/dist/src/utils/claudeInChrome/mcpServer.js +0 -237
  1473. package/dist/src/utils/claudeInChrome/prompt.js +0 -79
  1474. package/dist/src/utils/claudeInChrome/setup.js +0 -320
  1475. package/dist/src/utils/claudeInChrome/setupPortable.js +0 -172
  1476. package/dist/src/utils/claudeInChrome/toolRendering.js +0 -234
  1477. package/dist/src/utils/claudemd.js +0 -1054
  1478. package/dist/src/utils/cleanup.js +0 -514
  1479. package/dist/src/utils/cleanupRegistry.js +0 -22
  1480. package/dist/src/utils/cliArgs.js +0 -53
  1481. package/dist/src/utils/cliHighlight.js +0 -45
  1482. package/dist/src/utils/codeIndexing.js +0 -149
  1483. package/dist/src/utils/collapseBackgroundBashNotifications.js +0 -70
  1484. package/dist/src/utils/collapseHookSummaries.js +0 -48
  1485. package/dist/src/utils/collapseReadSearch.js +0 -871
  1486. package/dist/src/utils/collapseTeammateShutdowns.js +0 -44
  1487. package/dist/src/utils/combinedAbortSignal.js +0 -40
  1488. package/dist/src/utils/commandLifecycle.js +0 -7
  1489. package/dist/src/utils/commitAttribution.js +0 -720
  1490. package/dist/src/utils/completionCache.js +0 -138
  1491. package/dist/src/utils/computerUse/appNames.js +0 -170
  1492. package/dist/src/utils/computerUse/cleanup.js +0 -66
  1493. package/dist/src/utils/computerUse/common.js +0 -56
  1494. package/dist/src/utils/computerUse/computerUseLock.js +0 -183
  1495. package/dist/src/utils/computerUse/drainRunLoop.js +0 -71
  1496. package/dist/src/utils/computerUse/escHotkey.js +0 -53
  1497. package/dist/src/utils/computerUse/executor.js +0 -480
  1498. package/dist/src/utils/computerUse/gates.js +0 -55
  1499. package/dist/src/utils/computerUse/hostAdapter.js +0 -62
  1500. package/dist/src/utils/computerUse/inputLoader.js +0 -27
  1501. package/dist/src/utils/computerUse/mcpServer.js +0 -84
  1502. package/dist/src/utils/computerUse/setup.js +0 -42
  1503. package/dist/src/utils/computerUse/swiftLoader.js +0 -20
  1504. package/dist/src/utils/computerUse/toolRendering.js +0 -100
  1505. package/dist/src/utils/computerUse/wrapper.js +0 -318
  1506. package/dist/src/utils/concurrentSessions.js +0 -179
  1507. package/dist/src/utils/config.js +0 -1084
  1508. package/dist/src/utils/configConstants.js +0 -18
  1509. package/dist/src/utils/contentArray.js +0 -45
  1510. package/dist/src/utils/context.js +0 -185
  1511. package/dist/src/utils/contextAnalysis.js +0 -171
  1512. package/dist/src/utils/contextSuggestions.js +0 -158
  1513. package/dist/src/utils/controlMessageCompat.js +0 -31
  1514. package/dist/src/utils/conversationRecovery.js +0 -436
  1515. package/dist/src/utils/cron.js +0 -260
  1516. package/dist/src/utils/cronJitterConfig.js +0 -62
  1517. package/dist/src/utils/cronScheduler.js +0 -388
  1518. package/dist/src/utils/cronTasks.js +0 -328
  1519. package/dist/src/utils/cronTasksLock.js +0 -159
  1520. package/dist/src/utils/crossProjectResume.js +0 -46
  1521. package/dist/src/utils/crypto.js +0 -13
  1522. package/dist/src/utils/cwd.js +0 -29
  1523. package/dist/src/utils/databaseMcp/common.js +0 -48
  1524. package/dist/src/utils/databaseMcp/mcpServer.js +0 -2
  1525. package/dist/src/utils/databaseMcp/server/connection.js +0 -243
  1526. package/dist/src/utils/databaseMcp/server/index.js +0 -1442
  1527. package/dist/src/utils/databaseMcp/server/queries.js +0 -683
  1528. package/dist/src/utils/databaseMcp/server/types.js +0 -7
  1529. package/dist/src/utils/databaseMcp/setup.js +0 -28
  1530. package/dist/src/utils/debug.js +0 -220
  1531. package/dist/src/utils/debugFilter.js +0 -125
  1532. package/dist/src/utils/deepLink/banner.js +0 -103
  1533. package/dist/src/utils/deepLink/parseDeepLink.js +0 -138
  1534. package/dist/src/utils/deepLink/protocolHandler.js +0 -119
  1535. package/dist/src/utils/deepLink/registerProtocol.js +0 -291
  1536. package/dist/src/utils/deepLink/terminalLauncher.js +0 -455
  1537. package/dist/src/utils/deepLink/terminalPreference.js +0 -51
  1538. package/dist/src/utils/desktopDeepLink.js +0 -208
  1539. package/dist/src/utils/detectRepository.js +0 -157
  1540. package/dist/src/utils/diagLogs.js +0 -74
  1541. package/dist/src/utils/diff.js +0 -108
  1542. package/dist/src/utils/directMemberMessage.js +0 -34
  1543. package/dist/src/utils/displayTags.js +0 -46
  1544. package/dist/src/utils/doctorContextWarnings.js +0 -179
  1545. package/dist/src/utils/doctorDiagnostic.js +0 -495
  1546. package/dist/src/utils/dxt/helpers.js +0 -64
  1547. package/dist/src/utils/dxt/zip.js +0 -167
  1548. package/dist/src/utils/earlyInput.js +0 -166
  1549. package/dist/src/utils/editor.js +0 -163
  1550. package/dist/src/utils/effort.js +0 -278
  1551. package/dist/src/utils/embeddedTools.js +0 -26
  1552. package/dist/src/utils/env.js +0 -358
  1553. package/dist/src/utils/envDynamic.js +0 -130
  1554. package/dist/src/utils/envUtils.js +0 -154
  1555. package/dist/src/utils/envValidation.js +0 -26
  1556. package/dist/src/utils/errorLogSink.js +0 -197
  1557. package/dist/src/utils/errors.js +0 -207
  1558. package/dist/src/utils/eventLoopStallDetector.js +0 -16
  1559. package/dist/src/utils/exampleCommands.js +0 -165
  1560. package/dist/src/utils/execFileNoThrow.js +0 -93
  1561. package/dist/src/utils/execFileNoThrowPortable.js +0 -111
  1562. package/dist/src/utils/execSyncWrapper.js +0 -68
  1563. package/dist/src/utils/exportRenderer.js +0 -71
  1564. package/dist/src/utils/extraUsage.js +0 -19
  1565. package/dist/src/utils/fastMode.js +0 -393
  1566. package/dist/src/utils/file.js +0 -467
  1567. package/dist/src/utils/fileHistory.js +0 -851
  1568. package/dist/src/utils/fileOperationAnalytics.js +0 -45
  1569. package/dist/src/utils/filePersistence/filePersistence.js +0 -212
  1570. package/dist/src/utils/filePersistence/outputsScanner.js +0 -104
  1571. package/dist/src/utils/filePersistence/types.js +0 -5
  1572. package/dist/src/utils/fileRead.js +0 -81
  1573. package/dist/src/utils/fileReadCache.js +0 -78
  1574. package/dist/src/utils/fileStateCache.js +0 -99
  1575. package/dist/src/utils/findExecutable.js +0 -13
  1576. package/dist/src/utils/fingerprint.js +0 -59
  1577. package/dist/src/utils/forkedAgent.js +0 -410
  1578. package/dist/src/utils/format.js +0 -238
  1579. package/dist/src/utils/formatBriefTimestamp.js +0 -72
  1580. package/dist/src/utils/fpsTracker.js +0 -34
  1581. package/dist/src/utils/frontmatterParser.js +0 -260
  1582. package/dist/src/utils/fsOperations.js +0 -834
  1583. package/dist/src/utils/fullscreen.js +0 -194
  1584. package/dist/src/utils/generatedFiles.js +0 -122
  1585. package/dist/src/utils/generators.js +0 -67
  1586. package/dist/src/utils/genericProcessUtils.js +0 -155
  1587. package/dist/src/utils/getWorktreePaths.js +0 -56
  1588. package/dist/src/utils/getWorktreePathsPortable.js +0 -23
  1589. package/dist/src/utils/ghPrStatus.js +0 -71
  1590. package/dist/src/utils/git/gitConfigParser.js +0 -226
  1591. package/dist/src/utils/git/gitFilesystem.js +0 -606
  1592. package/dist/src/utils/git/gitignore.js +0 -84
  1593. package/dist/src/utils/git.js +0 -725
  1594. package/dist/src/utils/gitDiff.js +0 -395
  1595. package/dist/src/utils/gitSettings.js +0 -18
  1596. package/dist/src/utils/github/ghAuthStatus.js +0 -23
  1597. package/dist/src/utils/githubRepoPathMapping.js +0 -135
  1598. package/dist/src/utils/glob.js +0 -90
  1599. package/dist/src/utils/gracefulShutdown.js +0 -447
  1600. package/dist/src/utils/groupToolUses.js +0 -126
  1601. package/dist/src/utils/handlePromptSubmit.js +0 -398
  1602. package/dist/src/utils/hash.js +0 -46
  1603. package/dist/src/utils/headlessProfiler.js +0 -147
  1604. package/dist/src/utils/heapDumpService.js +0 -202
  1605. package/dist/src/utils/heatmap.js +0 -151
  1606. package/dist/src/utils/highlightMatch.js +0 -28
  1607. package/dist/src/utils/hooks/AsyncHookRegistry.js +0 -187
  1608. package/dist/src/utils/hooks/apiQueryHookHelper.js +0 -77
  1609. package/dist/src/utils/hooks/execAgentHook.js +0 -257
  1610. package/dist/src/utils/hooks/execHttpHook.js +0 -184
  1611. package/dist/src/utils/hooks/execPromptHook.js +0 -171
  1612. package/dist/src/utils/hooks/fileChangedWatcher.js +0 -161
  1613. package/dist/src/utils/hooks/hookEvents.js +0 -111
  1614. package/dist/src/utils/hooks/hookHelpers.js +0 -60
  1615. package/dist/src/utils/hooks/hooksConfigManager.js +0 -323
  1616. package/dist/src/utils/hooks/hooksConfigSnapshot.js +0 -114
  1617. package/dist/src/utils/hooks/hooksSettings.js +0 -204
  1618. package/dist/src/utils/hooks/postSamplingHooks.js +0 -39
  1619. package/dist/src/utils/hooks/registerFrontmatterHooks.js +0 -47
  1620. package/dist/src/utils/hooks/registerSkillHooks.js +0 -40
  1621. package/dist/src/utils/hooks/sessionHooks.js +0 -252
  1622. package/dist/src/utils/hooks/skillImprovement.js +0 -211
  1623. package/dist/src/utils/hooks/ssrfGuard.js +0 -258
  1624. package/dist/src/utils/hooks.js +0 -3668
  1625. package/dist/src/utils/horizontalScroll.js +0 -108
  1626. package/dist/src/utils/http.js +0 -121
  1627. package/dist/src/utils/hyperlink.js +0 -28
  1628. package/dist/src/utils/iTermBackup.js +0 -48
  1629. package/dist/src/utils/ide.js +0 -1198
  1630. package/dist/src/utils/idePathConversion.js +0 -66
  1631. package/dist/src/utils/idleTimeout.js +0 -44
  1632. package/dist/src/utils/imagePaste.js +0 -329
  1633. package/dist/src/utils/imageResizer.js +0 -664
  1634. package/dist/src/utils/imageStore.js +0 -150
  1635. package/dist/src/utils/imageValidation.js +0 -92
  1636. package/dist/src/utils/immediateCommand.js +0 -12
  1637. package/dist/src/utils/inProcessTeammateHelpers.js +0 -71
  1638. package/dist/src/utils/ink.js +0 -20
  1639. package/dist/src/utils/intl.js +0 -83
  1640. package/dist/src/utils/jetbrains.js +0 -152
  1641. package/dist/src/utils/json.js +0 -295
  1642. package/dist/src/utils/jsonRead.js +0 -14
  1643. package/dist/src/utils/keyboardShortcuts.js +0 -11
  1644. package/dist/src/utils/lazySchema.js +0 -8
  1645. package/dist/src/utils/listSessionsImpl.js +0 -332
  1646. package/dist/src/utils/localInstaller.js +0 -131
  1647. package/dist/src/utils/lockfile.js +0 -22
  1648. package/dist/src/utils/log.js +0 -280
  1649. package/dist/src/utils/logoV2Utils.js +0 -288
  1650. package/dist/src/utils/mailbox.js +0 -50
  1651. package/dist/src/utils/managedEnv.js +0 -160
  1652. package/dist/src/utils/managedEnvConstants.js +0 -187
  1653. package/dist/src/utils/markdown.js +0 -300
  1654. package/dist/src/utils/markdownConfigLoader.js +0 -480
  1655. package/dist/src/utils/mcp/dateTimeParser.js +0 -102
  1656. package/dist/src/utils/mcp/elicitationValidation.js +0 -259
  1657. package/dist/src/utils/mcpInstructionsDelta.js +0 -97
  1658. package/dist/src/utils/mcpOutputStorage.js +0 -159
  1659. package/dist/src/utils/mcpValidation.js +0 -165
  1660. package/dist/src/utils/mcpWebSocketTransport.js +0 -180
  1661. package/dist/src/utils/memoize.js +0 -205
  1662. package/dist/src/utils/memory/types.js +0 -9
  1663. package/dist/src/utils/memory/versions.js +0 -7
  1664. package/dist/src/utils/memoryFileDetection.js +0 -247
  1665. package/dist/src/utils/messagePredicates.js +0 -6
  1666. package/dist/src/utils/messageQueueManager.js +0 -430
  1667. package/dist/src/utils/messages/mappers.js +0 -240
  1668. package/dist/src/utils/messages/systemInit.js +0 -74
  1669. package/dist/src/utils/messages.js +0 -4273
  1670. package/dist/src/utils/model/agent.js +0 -128
  1671. package/dist/src/utils/model/aliases.js +0 -21
  1672. package/dist/src/utils/model/antModels.js +0 -25
  1673. package/dist/src/utils/model/bedrock.js +0 -220
  1674. package/dist/src/utils/model/check1mAccess.js +0 -64
  1675. package/dist/src/utils/model/configs.js +0 -93
  1676. package/dist/src/utils/model/contextWindowUpgradeCheck.js +0 -41
  1677. package/dist/src/utils/model/deprecation.js +0 -72
  1678. package/dist/src/utils/model/model.js +0 -635
  1679. package/dist/src/utils/model/modelAllowlist.js +0 -148
  1680. package/dist/src/utils/model/modelCapabilities.js +0 -107
  1681. package/dist/src/utils/model/modelOptions.js +0 -627
  1682. package/dist/src/utils/model/modelStrings.js +0 -144
  1683. package/dist/src/utils/model/modelSupportOverrides.js +0 -40
  1684. package/dist/src/utils/model/openrouter.js +0 -51
  1685. package/dist/src/utils/model/providerBaseUrls.js +0 -77
  1686. package/dist/src/utils/model/providerCatalog.js +0 -81
  1687. package/dist/src/utils/model/providerModels.js +0 -334
  1688. package/dist/src/utils/model/providerProfiles.js +0 -392
  1689. package/dist/src/utils/model/providerProfilesDb.js +0 -556
  1690. package/dist/src/utils/model/providerSwitch.js +0 -68
  1691. package/dist/src/utils/model/providers.js +0 -199
  1692. package/dist/src/utils/model/validateModel.js +0 -257
  1693. package/dist/src/utils/modelCost.js +0 -160
  1694. package/dist/src/utils/modifiers.js +0 -35
  1695. package/dist/src/utils/mtls.js +0 -134
  1696. package/dist/src/utils/nativeInstaller/download.js +0 -370
  1697. package/dist/src/utils/nativeInstaller/index.js +0 -8
  1698. package/dist/src/utils/nativeInstaller/installer.js +0 -1396
  1699. package/dist/src/utils/nativeInstaller/packageManagers.js +0 -258
  1700. package/dist/src/utils/nativeInstaller/pidLock.js +0 -347
  1701. package/dist/src/utils/notebook.js +0 -176
  1702. package/dist/src/utils/objectGroupBy.js +0 -15
  1703. package/dist/src/utils/pasteStore.js +0 -93
  1704. package/dist/src/utils/path.js +0 -140
  1705. package/dist/src/utils/pdf.js +0 -236
  1706. package/dist/src/utils/pdfUtils.js +0 -61
  1707. package/dist/src/utils/peerAddress.js +0 -20
  1708. package/dist/src/utils/permissions/PermissionMode.js +0 -95
  1709. package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +0 -85
  1710. package/dist/src/utils/permissions/PermissionResult.js +0 -11
  1711. package/dist/src/utils/permissions/PermissionRule.js +0 -19
  1712. package/dist/src/utils/permissions/PermissionUpdate.js +0 -268
  1713. package/dist/src/utils/permissions/PermissionUpdateSchema.js +0 -61
  1714. package/dist/src/utils/permissions/autoModeState.js +0 -34
  1715. package/dist/src/utils/permissions/bashClassifier.js +0 -30
  1716. package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +0 -115
  1717. package/dist/src/utils/permissions/classifierDecision.js +0 -88
  1718. package/dist/src/utils/permissions/classifierShared.js +0 -28
  1719. package/dist/src/utils/permissions/dangerousPatterns.js +0 -78
  1720. package/dist/src/utils/permissions/denialTracking.js +0 -34
  1721. package/dist/src/utils/permissions/filesystem.js +0 -1411
  1722. package/dist/src/utils/permissions/getNextPermissionMode.js +0 -74
  1723. package/dist/src/utils/permissions/pathValidation.js +0 -351
  1724. package/dist/src/utils/permissions/permissionExplainer.js +0 -188
  1725. package/dist/src/utils/permissions/permissionRuleParser.js +0 -177
  1726. package/dist/src/utils/permissions/permissionSetup.js +0 -1164
  1727. package/dist/src/utils/permissions/permissions.js +0 -1065
  1728. package/dist/src/utils/permissions/permissionsLoader.js +0 -217
  1729. package/dist/src/utils/permissions/shadowedRuleDetection.js +0 -149
  1730. package/dist/src/utils/permissions/shellRuleMatching.js +0 -174
  1731. package/dist/src/utils/permissions/yoloClassifier.js +0 -1195
  1732. package/dist/src/utils/planModeV2.js +0 -75
  1733. package/dist/src/utils/plans.js +0 -334
  1734. package/dist/src/utils/platform.js +0 -122
  1735. package/dist/src/utils/plugins/addDirPluginSettings.js +0 -53
  1736. package/dist/src/utils/plugins/cacheUtils.js +0 -174
  1737. package/dist/src/utils/plugins/dependencyResolver.js +0 -244
  1738. package/dist/src/utils/plugins/fetchTelemetry.js +0 -108
  1739. package/dist/src/utils/plugins/gitAvailability.js +0 -65
  1740. package/dist/src/utils/plugins/headlessPluginInstall.js +0 -136
  1741. package/dist/src/utils/plugins/hintRecommendation.js +0 -136
  1742. package/dist/src/utils/plugins/installCounts.js +0 -218
  1743. package/dist/src/utils/plugins/installedPluginsManager.js +0 -1003
  1744. package/dist/src/utils/plugins/loadPluginAgents.js +0 -219
  1745. package/dist/src/utils/plugins/loadPluginCommands.js +0 -595
  1746. package/dist/src/utils/plugins/loadPluginHooks.js +0 -239
  1747. package/dist/src/utils/plugins/loadPluginOutputStyles.js +0 -112
  1748. package/dist/src/utils/plugins/lspPluginIntegration.js +0 -293
  1749. package/dist/src/utils/plugins/lspRecommendation.js +0 -278
  1750. package/dist/src/utils/plugins/managedPlugins.js +0 -26
  1751. package/dist/src/utils/plugins/marketplaceHelpers.js +0 -470
  1752. package/dist/src/utils/plugins/marketplaceManager.js +0 -1939
  1753. package/dist/src/utils/plugins/mcpPluginIntegration.js +0 -465
  1754. package/dist/src/utils/plugins/mcpbHandler.js +0 -708
  1755. package/dist/src/utils/plugins/officialMarketplace.js +0 -21
  1756. package/dist/src/utils/plugins/officialMarketplaceGcs.js +0 -195
  1757. package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +0 -338
  1758. package/dist/src/utils/plugins/orphanedPluginFilter.js +0 -96
  1759. package/dist/src/utils/plugins/parseMarketplaceInput.js +0 -143
  1760. package/dist/src/utils/plugins/performStartupChecks.js +0 -66
  1761. package/dist/src/utils/plugins/pluginAutoupdate.js +0 -210
  1762. package/dist/src/utils/plugins/pluginBlocklist.js +0 -93
  1763. package/dist/src/utils/plugins/pluginDirectories.js +0 -170
  1764. package/dist/src/utils/plugins/pluginFlagging.js +0 -173
  1765. package/dist/src/utils/plugins/pluginIdentifier.js +0 -78
  1766. package/dist/src/utils/plugins/pluginInstallationHelpers.js +0 -400
  1767. package/dist/src/utils/plugins/pluginLoader.js +0 -2426
  1768. package/dist/src/utils/plugins/pluginOptionsStorage.js +0 -311
  1769. package/dist/src/utils/plugins/pluginPolicy.js +0 -18
  1770. package/dist/src/utils/plugins/pluginStartupCheck.js +0 -261
  1771. package/dist/src/utils/plugins/pluginVersioning.js +0 -128
  1772. package/dist/src/utils/plugins/reconciler.js +0 -181
  1773. package/dist/src/utils/plugins/refresh.js +0 -162
  1774. package/dist/src/utils/plugins/schemas.js +0 -1283
  1775. package/dist/src/utils/plugins/validatePlugin.js +0 -765
  1776. package/dist/src/utils/plugins/walkPluginMarkdown.js +0 -49
  1777. package/dist/src/utils/plugins/zipCache.js +0 -346
  1778. package/dist/src/utils/plugins/zipCacheAdapters.js +0 -133
  1779. package/dist/src/utils/postCommitAttribution.js +0 -16
  1780. package/dist/src/utils/powershell/dangerousCmdlets.js +0 -174
  1781. package/dist/src/utils/powershell/parser.js +0 -1357
  1782. package/dist/src/utils/powershell/staticPrefix.js +0 -277
  1783. package/dist/src/utils/preflightChecks.js +0 -147
  1784. package/dist/src/utils/privacyLevel.js +0 -49
  1785. package/dist/src/utils/process.js +0 -56
  1786. package/dist/src/utils/processUserInput/processBashCommand.js +0 -119
  1787. package/dist/src/utils/processUserInput/processSlashCommand.js +0 -845
  1788. package/dist/src/utils/processUserInput/processTextPrompt.js +0 -68
  1789. package/dist/src/utils/processUserInput/processUserInput.js +0 -326
  1790. package/dist/src/utils/profilerBase.js +0 -29
  1791. package/dist/src/utils/promptCategory.js +0 -39
  1792. package/dist/src/utils/promptEditor.js +0 -151
  1793. package/dist/src/utils/promptShellExecution.js +0 -119
  1794. package/dist/src/utils/proxy.js +0 -347
  1795. package/dist/src/utils/queryContext.js +0 -110
  1796. package/dist/src/utils/queryHelpers.js +0 -436
  1797. package/dist/src/utils/queryProfiler.js +0 -242
  1798. package/dist/src/utils/queueProcessor.js +0 -70
  1799. package/dist/src/utils/readEditContext.js +0 -176
  1800. package/dist/src/utils/readFileInRange.js +0 -278
  1801. package/dist/src/utils/releaseNotes.js +0 -304
  1802. package/dist/src/utils/renderOptions.js +0 -67
  1803. package/dist/src/utils/ripgrep.js +0 -540
  1804. package/dist/src/utils/sandbox/sandbox-adapter.js +0 -749
  1805. package/dist/src/utils/sandbox/sandbox-ui-utils.js +0 -11
  1806. package/dist/src/utils/sanitization.js +0 -72
  1807. package/dist/src/utils/screenshotClipboard.js +0 -89
  1808. package/dist/src/utils/sdkEventQueue.js +0 -49
  1809. package/dist/src/utils/sdkHeapDumpMonitor.js +0 -16
  1810. package/dist/src/utils/secureStorage/fallbackStorage.js +0 -59
  1811. package/dist/src/utils/secureStorage/index.js +0 -14
  1812. package/dist/src/utils/secureStorage/keychainPrefetch.js +0 -91
  1813. package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +0 -91
  1814. package/dist/src/utils/secureStorage/macOsKeychainStorage.js +0 -192
  1815. package/dist/src/utils/secureStorage/plainTextStorage.js +0 -81
  1816. package/dist/src/utils/secureStorage/secureStoreDefs.js +0 -1
  1817. package/dist/src/utils/secureStorage/sqliteStorage.js +0 -217
  1818. package/dist/src/utils/secureStorage/types.js +0 -1
  1819. package/dist/src/utils/semanticBoolean.js +0 -23
  1820. package/dist/src/utils/semanticNumber.js +0 -34
  1821. package/dist/src/utils/semver.js +0 -53
  1822. package/dist/src/utils/sequential.js +0 -43
  1823. package/dist/src/utils/sessionActivity.js +0 -120
  1824. package/dist/src/utils/sessionDataUploader.js +0 -16
  1825. package/dist/src/utils/sessionEnvVars.js +0 -18
  1826. package/dist/src/utils/sessionEnvironment.js +0 -131
  1827. package/dist/src/utils/sessionFileAccessHooks.js +0 -207
  1828. package/dist/src/utils/sessionIngressAuth.js +0 -113
  1829. package/dist/src/utils/sessionRestore.js +0 -359
  1830. package/dist/src/utils/sessionStart.js +0 -165
  1831. package/dist/src/utils/sessionState.js +0 -76
  1832. package/dist/src/utils/sessionStorage.js +0 -4162
  1833. package/dist/src/utils/sessionStoragePortable.js +0 -665
  1834. package/dist/src/utils/sessionTitle.js +0 -120
  1835. package/dist/src/utils/sessionUrl.js +0 -50
  1836. package/dist/src/utils/set.js +0 -50
  1837. package/dist/src/utils/settings/allErrors.js +0 -29
  1838. package/dist/src/utils/settings/applySettingsChange.js +0 -65
  1839. package/dist/src/utils/settings/changeDetector.js +0 -409
  1840. package/dist/src/utils/settings/constants.js +0 -166
  1841. package/dist/src/utils/settings/internalWrites.js +0 -33
  1842. package/dist/src/utils/settings/managedPath.js +0 -29
  1843. package/dist/src/utils/settings/mdm/constants.js +0 -62
  1844. package/dist/src/utils/settings/mdm/rawRead.js +0 -97
  1845. package/dist/src/utils/settings/mdm/settings.js +0 -254
  1846. package/dist/src/utils/settings/permissionValidation.js +0 -224
  1847. package/dist/src/utils/settings/pluginOnlyPolicy.js +0 -53
  1848. package/dist/src/utils/settings/schemaOutput.js +0 -7
  1849. package/dist/src/utils/settings/settings.js +0 -791
  1850. package/dist/src/utils/settings/settingsCache.js +0 -47
  1851. package/dist/src/utils/settings/toolValidationConfig.js +0 -76
  1852. package/dist/src/utils/settings/types.js +0 -846
  1853. package/dist/src/utils/settings/validateEditTool.js +0 -34
  1854. package/dist/src/utils/settings/validation.js +0 -192
  1855. package/dist/src/utils/settings/validationTips.js +0 -111
  1856. package/dist/src/utils/shell/bashProvider.js +0 -202
  1857. package/dist/src/utils/shell/outputLimits.js +0 -7
  1858. package/dist/src/utils/shell/powershellDetection.js +0 -96
  1859. package/dist/src/utils/shell/powershellProvider.js +0 -104
  1860. package/dist/src/utils/shell/prefix.js +0 -246
  1861. package/dist/src/utils/shell/readOnlyCommandValidation.js +0 -1776
  1862. package/dist/src/utils/shell/resolveDefaultShell.js +0 -13
  1863. package/dist/src/utils/shell/shellProvider.js +0 -2
  1864. package/dist/src/utils/shell/shellToolUtils.js +0 -21
  1865. package/dist/src/utils/shell/specPrefix.js +0 -198
  1866. package/dist/src/utils/shellConfig.js +0 -136
  1867. package/dist/src/utils/sideQuery.js +0 -195
  1868. package/dist/src/utils/sideQuestion.js +0 -121
  1869. package/dist/src/utils/signal.js +0 -34
  1870. package/dist/src/utils/sinks.js +0 -15
  1871. package/dist/src/utils/skills/skillChangeDetector.js +0 -264
  1872. package/dist/src/utils/slashCommandParsing.js +0 -46
  1873. package/dist/src/utils/sleep.js +0 -72
  1874. package/dist/src/utils/sliceAnsi.js +0 -74
  1875. package/dist/src/utils/slowOperations.js +0 -323
  1876. package/dist/src/utils/standaloneAgent.js +0 -20
  1877. package/dist/src/utils/startupProfiler.js +0 -158
  1878. package/dist/src/utils/staticRender.js +0 -103
  1879. package/dist/src/utils/stats.js +0 -802
  1880. package/dist/src/utils/statsCache.js +0 -330
  1881. package/dist/src/utils/status.js +0 -544
  1882. package/dist/src/utils/statusNoticeDefinitions.js +0 -112
  1883. package/dist/src/utils/statusNoticeHelpers.js +0 -15
  1884. package/dist/src/utils/stream.js +0 -73
  1885. package/dist/src/utils/streamJsonStdoutGuard.js +0 -107
  1886. package/dist/src/utils/streamlinedTransform.js +0 -162
  1887. package/dist/src/utils/stringUtils.js +0 -202
  1888. package/dist/src/utils/subprocessEnv.js +0 -87
  1889. package/dist/src/utils/suggestions/commandSuggestions.js +0 -458
  1890. package/dist/src/utils/suggestions/directoryCompletion.js +0 -191
  1891. package/dist/src/utils/suggestions/shellHistoryCompletion.js +0 -95
  1892. package/dist/src/utils/suggestions/skillUsageTracking.js +0 -50
  1893. package/dist/src/utils/suggestions/slackChannelSuggestions.js +0 -169
  1894. package/dist/src/utils/swarm/It2SetupPrompt.js +0 -386
  1895. package/dist/src/utils/swarm/backends/ITermBackend.js +0 -276
  1896. package/dist/src/utils/swarm/backends/InProcessBackend.js +0 -237
  1897. package/dist/src/utils/swarm/backends/PaneBackendExecutor.js +0 -250
  1898. package/dist/src/utils/swarm/backends/TmuxBackend.js +0 -574
  1899. package/dist/src/utils/swarm/backends/detection.js +0 -112
  1900. package/dist/src/utils/swarm/backends/it2Setup.js +0 -185
  1901. package/dist/src/utils/swarm/backends/registry.js +0 -369
  1902. package/dist/src/utils/swarm/backends/teammateModeSnapshot.js +0 -68
  1903. package/dist/src/utils/swarm/backends/types.js +0 -9
  1904. package/dist/src/utils/swarm/constants.js +0 -29
  1905. package/dist/src/utils/swarm/inProcessRunner.js +0 -1021
  1906. package/dist/src/utils/swarm/leaderPermissionBridge.js +0 -31
  1907. package/dist/src/utils/swarm/permissionSync.js +0 -667
  1908. package/dist/src/utils/swarm/reconnection.js +0 -82
  1909. package/dist/src/utils/swarm/spawnInProcess.js +0 -218
  1910. package/dist/src/utils/swarm/spawnUtils.js +0 -123
  1911. package/dist/src/utils/swarm/teamHelpers.js +0 -484
  1912. package/dist/src/utils/swarm/teammateInit.js +0 -87
  1913. package/dist/src/utils/swarm/teammateLayoutManager.js +0 -82
  1914. package/dist/src/utils/swarm/teammateModel.js +0 -9
  1915. package/dist/src/utils/swarm/teammatePromptAddendum.js +0 -17
  1916. package/dist/src/utils/systemDirectories.js +0 -51
  1917. package/dist/src/utils/systemPrompt.js +0 -90
  1918. package/dist/src/utils/systemPromptType.js +0 -9
  1919. package/dist/src/utils/systemTheme.js +0 -108
  1920. package/dist/src/utils/systemThemeWatcher.js +0 -16
  1921. package/dist/src/utils/taggedId.js +0 -49
  1922. package/dist/src/utils/task/TaskOutput.js +0 -320
  1923. package/dist/src/utils/task/diskOutput.js +0 -387
  1924. package/dist/src/utils/task/framework.js +0 -236
  1925. package/dist/src/utils/task/outputFormatting.js +0 -24
  1926. package/dist/src/utils/task/sdkProgress.js +0 -24
  1927. package/dist/src/utils/tasks.js +0 -672
  1928. package/dist/src/utils/teamDiscovery.js +0 -48
  1929. package/dist/src/utils/teamMemoryOps.js +0 -67
  1930. package/dist/src/utils/teammate.js +0 -237
  1931. package/dist/src/utils/teammateContext.js +0 -56
  1932. package/dist/src/utils/teammateMailbox.js +0 -793
  1933. package/dist/src/utils/telemetry/betaSessionTracing.js +0 -371
  1934. package/dist/src/utils/telemetry/bigqueryExporter.js +0 -178
  1935. package/dist/src/utils/telemetry/events.js +0 -57
  1936. package/dist/src/utils/telemetry/instrumentation.js +0 -617
  1937. package/dist/src/utils/telemetry/logger.js +0 -25
  1938. package/dist/src/utils/telemetry/perfettoTracing.js +0 -882
  1939. package/dist/src/utils/telemetry/pluginTelemetry.js +0 -157
  1940. package/dist/src/utils/telemetry/sessionTracing.js +0 -693
  1941. package/dist/src/utils/telemetry/skillLoadedEvent.js +0 -26
  1942. package/dist/src/utils/telemetryAttributes.js +0 -57
  1943. package/dist/src/utils/teleport/api.js +0 -299
  1944. package/dist/src/utils/teleport/environmentSelection.js +0 -55
  1945. package/dist/src/utils/teleport/environments.js +0 -84
  1946. package/dist/src/utils/teleport/gitBundle.js +0 -192
  1947. package/dist/src/utils/teleport.js +0 -1041
  1948. package/dist/src/utils/tempfile.js +0 -26
  1949. package/dist/src/utils/terminal.js +0 -105
  1950. package/dist/src/utils/terminalPanel.js +0 -155
  1951. package/dist/src/utils/textHighlighting.js +0 -113
  1952. package/dist/src/utils/theme.js +0 -525
  1953. package/dist/src/utils/thinking.js +0 -130
  1954. package/dist/src/utils/timeouts.js +0 -35
  1955. package/dist/src/utils/tmuxSocket.js +0 -373
  1956. package/dist/src/utils/todo/types.js +0 -9
  1957. package/dist/src/utils/tokenBudget.js +0 -62
  1958. package/dist/src/utils/tokens.js +0 -223
  1959. package/dist/src/utils/toolErrors.js +0 -101
  1960. package/dist/src/utils/toolPool.js +0 -63
  1961. package/dist/src/utils/toolResultStorage.js +0 -769
  1962. package/dist/src/utils/toolSchemaCache.js +0 -7
  1963. package/dist/src/utils/toolSearch.js +0 -551
  1964. package/dist/src/utils/transcriptSearch.js +0 -200
  1965. package/dist/src/utils/treeify.js +0 -111
  1966. package/dist/src/utils/truncate.js +0 -164
  1967. package/dist/src/utils/udsClient.js +0 -16
  1968. package/dist/src/utils/udsMessaging.js +0 -16
  1969. package/dist/src/utils/ultraplan/ccrSession.js +0 -264
  1970. package/dist/src/utils/ultraplan/keyword.js +0 -122
  1971. package/dist/src/utils/ultraplan/prompt.txt +0 -1
  1972. package/dist/src/utils/unaryLogging.js +0 -16
  1973. package/dist/src/utils/undercover.js +0 -89
  1974. package/dist/src/utils/user.js +0 -138
  1975. package/dist/src/utils/userAgent.js +0 -13
  1976. package/dist/src/utils/userPromptKeywords.js +0 -21
  1977. package/dist/src/utils/uuid.js +0 -22
  1978. package/dist/src/utils/warningHandler.js +0 -97
  1979. package/dist/src/utils/which.js +0 -75
  1980. package/dist/src/utils/windowsPaths.js +0 -146
  1981. package/dist/src/utils/withResolvers.js +0 -13
  1982. package/dist/src/utils/words.js +0 -793
  1983. package/dist/src/utils/workloadContext.js +0 -42
  1984. package/dist/src/utils/worktree.js +0 -1142
  1985. package/dist/src/utils/worktreeModeEnabled.js +0 -11
  1986. package/dist/src/utils/xdg.js +0 -52
  1987. package/dist/src/utils/xml.js +0 -15
  1988. package/dist/src/utils/yaml.js +0 -16
  1989. package/dist/src/utils/zodToJsonSchema.js +0 -19
  1990. package/dist/src/vim/motions.js +0 -73
  1991. package/dist/src/vim/operators.js +0 -401
  1992. package/dist/src/vim/textObjects.js +0 -153
  1993. package/dist/src/vim/transitions.js +0 -340
  1994. package/dist/src/vim/types.js +0 -93
  1995. package/dist/src/voice/voiceModeEnabled.js +0 -48
  1996. package/dist/src/whatsapp/bridge.js +0 -267
  1997. package/dist/src/whatsapp/config.js +0 -128
  1998. package/dist/src/whatsapp/markdown.js +0 -37
  1999. package/dist/src/whatsapp/mirror.js +0 -74
  2000. package/dist/src/whatsapp/session.js +0 -142
@@ -1,2426 +0,0 @@
1
- /**
2
- * Plugin Loader Module
3
- *
4
- * This module is responsible for discovering, loading, and validating Context Code plugins
5
- * from various sources including marketplaces and git repositories.
6
- *
7
- * NPM packages are also supported but must be referenced through marketplaces - the marketplace
8
- * entry contains the NPM package information.
9
- *
10
- * Plugin Discovery Sources (in order of precedence):
11
- * 1. Marketplace-based plugins (plugin@marketplace format in settings)
12
- * 2. Session-only plugins (from --plugin-dir CLI flag or SDK plugins option)
13
- *
14
- * Plugin Directory Structure:
15
- * ```
16
- * my-plugin/
17
- * ├── plugin.json # Optional manifest with metadata
18
- * ├── commands/ # Custom slash commands
19
- * │ ├── build.md
20
- * │ └── deploy.md
21
- * ├── agents/ # Custom AI agents
22
- * │ └── test-runner.md
23
- * └── hooks/ # Hook configurations
24
- * └── hooks.json # Hook definitions
25
- * ```
26
- *
27
- * The loader handles:
28
- * - Plugin manifest validation
29
- * - Hooks configuration loading and variable resolution
30
- * - Duplicate name detection
31
- * - Enable/disable state management
32
- * - Error collection and reporting
33
- */
34
- import { copyFile, readdir, readFile, readlink, realpath, rename, rm, rmdir, stat, symlink, } from 'fs/promises';
35
- import memoize from 'lodash-es/memoize.js';
36
- import { basename, dirname, join, relative, resolve, sep } from 'path';
37
- import { getInlinePlugins } from '../../bootstrap/state.js';
38
- import { BUILTIN_MARKETPLACE_NAME, getBuiltinPlugins, } from '../../plugins/builtinPlugins.js';
39
- import { logForDebugging } from '../debug.js';
40
- import { isEnvTruthy } from '../envUtils.js';
41
- import { errorMessage, getErrnoPath, isENOENT, isFsInaccessible, toError, } from '../errors.js';
42
- import { execFileNoThrow, execFileNoThrowWithCwd } from '../execFileNoThrow.js';
43
- import { pathExists } from '../file.js';
44
- import { getFsImplementation } from '../fsOperations.js';
45
- import { gitExe } from '../git.js';
46
- import { lazySchema } from '../lazySchema.js';
47
- import { logError } from '../log.js';
48
- import { getSettings_DEPRECATED } from '../settings/settings.js';
49
- import { clearPluginSettingsBase, getPluginSettingsBase, resetSettingsCache, setPluginSettingsBase, } from '../settings/settingsCache.js';
50
- import { SettingsSchema } from '../settings/types.js';
51
- import { jsonParse, jsonStringify } from '../slowOperations.js';
52
- import { getAddDirEnabledPlugins } from './addDirPluginSettings.js';
53
- import { verifyAndDemote } from './dependencyResolver.js';
54
- import { classifyFetchError, logPluginFetch } from './fetchTelemetry.js';
55
- import { checkGitAvailable } from './gitAvailability.js';
56
- import { getInMemoryInstalledPlugins } from './installedPluginsManager.js';
57
- import { getManagedPluginNames } from './managedPlugins.js';
58
- import { formatSourceForDisplay, getBlockedMarketplaces, getStrictKnownMarketplaces, isSourceAllowedByPolicy, isSourceInBlocklist, } from './marketplaceHelpers.js';
59
- import { getMarketplaceCacheOnly, getPluginByIdCacheOnly, loadKnownMarketplacesConfigSafe, } from './marketplaceManager.js';
60
- import { getPluginSeedDirs, getPluginsDirectory } from './pluginDirectories.js';
61
- import { parsePluginIdentifier } from './pluginIdentifier.js';
62
- import { validatePathWithinBase } from './pluginInstallationHelpers.js';
63
- import { calculatePluginVersion } from './pluginVersioning.js';
64
- import { PluginHooksSchema, PluginIdSchema, PluginManifestSchema, } from './schemas.js';
65
- import { convertDirectoryToZipInPlace, extractZipToDirectory, getSessionPluginCachePath, isPluginZipCacheEnabled, } from './zipCache.js';
66
- /**
67
- * Get the path where plugin cache is stored
68
- */
69
- export function getPluginCachePath() {
70
- return join(getPluginsDirectory(), 'cache');
71
- }
72
- /**
73
- * Compute the versioned cache path under a specific base plugins directory.
74
- * Used to probe both primary and seed caches.
75
- *
76
- * @param baseDir - Base plugins directory (e.g. getPluginsDirectory() or seed dir)
77
- * @param pluginId - Plugin identifier in format "name@marketplace"
78
- * @param version - Version string (semver, git SHA, etc.)
79
- * @returns Absolute path to versioned plugin directory under baseDir
80
- */
81
- export function getVersionedCachePathIn(baseDir, pluginId, version) {
82
- const { name: pluginName, marketplace } = parsePluginIdentifier(pluginId);
83
- const sanitizedMarketplace = (marketplace || 'unknown').replace(/[^a-zA-Z0-9\-_]/g, '-');
84
- const sanitizedPlugin = (pluginName || pluginId).replace(/[^a-zA-Z0-9\-_]/g, '-');
85
- // Sanitize version to prevent path traversal attacks
86
- const sanitizedVersion = version.replace(/[^a-zA-Z0-9\-_.]/g, '-');
87
- return join(baseDir, 'cache', sanitizedMarketplace, sanitizedPlugin, sanitizedVersion);
88
- }
89
- /**
90
- * Get versioned cache path for a plugin under the primary plugins directory.
91
- * Format: ~/.claude/plugins/cache/{marketplace}/{plugin}/{version}/
92
- *
93
- * @param pluginId - Plugin identifier in format "name@marketplace"
94
- * @param version - Version string (semver, git SHA, etc.)
95
- * @returns Absolute path to versioned plugin directory
96
- */
97
- export function getVersionedCachePath(pluginId, version) {
98
- return getVersionedCachePathIn(getPluginsDirectory(), pluginId, version);
99
- }
100
- /**
101
- * Get versioned ZIP cache path for a plugin.
102
- * This is the zip cache variant of getVersionedCachePath.
103
- */
104
- export function getVersionedZipCachePath(pluginId, version) {
105
- return `${getVersionedCachePath(pluginId, version)}.zip`;
106
- }
107
- /**
108
- * Probe seed directories for a populated cache at this plugin version.
109
- * Seeds are checked in precedence order; first hit wins. Returns null if no
110
- * seed is configured or none contains a populated directory at this version.
111
- */
112
- async function probeSeedCache(pluginId, version) {
113
- for (const seedDir of getPluginSeedDirs()) {
114
- const seedPath = getVersionedCachePathIn(seedDir, pluginId, version);
115
- try {
116
- const entries = await readdir(seedPath);
117
- if (entries.length > 0)
118
- return seedPath;
119
- }
120
- catch {
121
- // Try next seed
122
- }
123
- }
124
- return null;
125
- }
126
- /**
127
- * When the computed version is 'unknown', probe seed/cache/<m>/<p>/ for an
128
- * actual version dir. Handles the first-boot chicken-and-egg where the
129
- * version can only be known after cloning, but seed already has the clone.
130
- *
131
- * Per seed, only matches when exactly one version exists (typical BYOC case).
132
- * Multiple versions within a single seed → ambiguous → try next seed.
133
- * Seeds are checked in precedence order; first match wins.
134
- */
135
- export async function probeSeedCacheAnyVersion(pluginId) {
136
- for (const seedDir of getPluginSeedDirs()) {
137
- // The parent of the version dir — computed the same way as
138
- // getVersionedCachePathIn, just without the version component.
139
- const pluginDir = dirname(getVersionedCachePathIn(seedDir, pluginId, '_'));
140
- try {
141
- const versions = await readdir(pluginDir);
142
- if (versions.length !== 1)
143
- continue;
144
- const versionDir = join(pluginDir, versions[0]);
145
- const entries = await readdir(versionDir);
146
- if (entries.length > 0)
147
- return versionDir;
148
- }
149
- catch {
150
- // Try next seed
151
- }
152
- }
153
- return null;
154
- }
155
- /**
156
- * Get legacy (non-versioned) cache path for a plugin.
157
- * Format: ~/.claude/plugins/cache/{plugin-name}/
158
- *
159
- * Used for backward compatibility with existing installations.
160
- *
161
- * @param pluginName - Plugin name (without marketplace suffix)
162
- * @returns Absolute path to legacy plugin directory
163
- */
164
- export function getLegacyCachePath(pluginName) {
165
- const cachePath = getPluginCachePath();
166
- return join(cachePath, pluginName.replace(/[^a-zA-Z0-9\-_]/g, '-'));
167
- }
168
- /**
169
- * Resolve plugin path with fallback to legacy location.
170
- *
171
- * Always:
172
- * 1. Try versioned path first if version is provided
173
- * 2. Fall back to legacy path for existing installations
174
- * 3. Return versioned path for new installations
175
- *
176
- * @param pluginId - Plugin identifier in format "name@marketplace"
177
- * @param version - Optional version string
178
- * @returns Absolute path to plugin directory
179
- */
180
- export async function resolvePluginPath(pluginId, version) {
181
- // Try versioned path first
182
- if (version) {
183
- const versionedPath = getVersionedCachePath(pluginId, version);
184
- if (await pathExists(versionedPath)) {
185
- return versionedPath;
186
- }
187
- }
188
- // Fall back to legacy path for existing installations
189
- const pluginName = parsePluginIdentifier(pluginId).name || pluginId;
190
- const legacyPath = getLegacyCachePath(pluginName);
191
- if (await pathExists(legacyPath)) {
192
- return legacyPath;
193
- }
194
- // Return versioned path for new installations
195
- return version ? getVersionedCachePath(pluginId, version) : legacyPath;
196
- }
197
- /**
198
- * Recursively copy a directory.
199
- * Exported for testing purposes.
200
- */
201
- export async function copyDir(src, dest) {
202
- await getFsImplementation().mkdir(dest);
203
- const entries = await readdir(src, { withFileTypes: true });
204
- for (const entry of entries) {
205
- const srcPath = join(src, entry.name);
206
- const destPath = join(dest, entry.name);
207
- if (entry.isDirectory()) {
208
- await copyDir(srcPath, destPath);
209
- }
210
- else if (entry.isFile()) {
211
- await copyFile(srcPath, destPath);
212
- }
213
- else if (entry.isSymbolicLink()) {
214
- const linkTarget = await readlink(srcPath);
215
- // Resolve the symlink to get the actual target path
216
- // This prevents circular symlinks when src and dest overlap (e.g., via symlink chains)
217
- let resolvedTarget;
218
- try {
219
- resolvedTarget = await realpath(srcPath);
220
- }
221
- catch {
222
- // Broken symlink - copy the raw link target as-is
223
- await symlink(linkTarget, destPath);
224
- continue;
225
- }
226
- // Resolve the source directory to handle symlinked source dirs
227
- let resolvedSrc;
228
- try {
229
- resolvedSrc = await realpath(src);
230
- }
231
- catch {
232
- resolvedSrc = src;
233
- }
234
- // Check if target is within the source tree (using proper path prefix matching)
235
- const srcPrefix = resolvedSrc.endsWith(sep)
236
- ? resolvedSrc
237
- : resolvedSrc + sep;
238
- if (resolvedTarget.startsWith(srcPrefix) ||
239
- resolvedTarget === resolvedSrc) {
240
- // Target is within source tree - create relative symlink that preserves
241
- // the same structure in the destination
242
- const targetRelativeToSrc = relative(resolvedSrc, resolvedTarget);
243
- const destTargetPath = join(dest, targetRelativeToSrc);
244
- const relativeLinkPath = relative(dirname(destPath), destTargetPath);
245
- await symlink(relativeLinkPath, destPath);
246
- }
247
- else {
248
- // Target is outside source tree - use absolute resolved path
249
- await symlink(resolvedTarget, destPath);
250
- }
251
- }
252
- }
253
- }
254
- /**
255
- * Copy plugin files to versioned cache directory.
256
- *
257
- * For local plugins: Uses entry.source from marketplace.json as the single source of truth.
258
- * For remote plugins: Falls back to copying sourcePath (the downloaded content).
259
- *
260
- * @param sourcePath - Path to the plugin source (used as fallback for remote plugins)
261
- * @param pluginId - Plugin identifier in format "name@marketplace"
262
- * @param version - Version string for versioned path
263
- * @param entry - Optional marketplace entry containing the source field
264
- * @param marketplaceDir - Marketplace directory for resolving entry.source (undefined for remote plugins)
265
- * @returns Path to the cached plugin directory
266
- * @throws Error if the source directory is not found
267
- * @throws Error if the destination directory is empty after copy
268
- */
269
- export async function copyPluginToVersionedCache(sourcePath, pluginId, version, entry, marketplaceDir) {
270
- // When zip cache is enabled, the canonical format is a ZIP file
271
- const zipCacheMode = isPluginZipCacheEnabled();
272
- const cachePath = getVersionedCachePath(pluginId, version);
273
- const zipPath = getVersionedZipCachePath(pluginId, version);
274
- // If cache already exists (directory or ZIP), return it
275
- if (zipCacheMode) {
276
- if (await pathExists(zipPath)) {
277
- logForDebugging(`Plugin ${pluginId} version ${version} already cached at ${zipPath}`);
278
- return zipPath;
279
- }
280
- }
281
- else if (await pathExists(cachePath)) {
282
- const entries = await readdir(cachePath);
283
- if (entries.length > 0) {
284
- logForDebugging(`Plugin ${pluginId} version ${version} already cached at ${cachePath}`);
285
- return cachePath;
286
- }
287
- // Directory exists but is empty, remove it so we can recreate with content
288
- logForDebugging(`Removing empty cache directory for ${pluginId} at ${cachePath}`);
289
- await rmdir(cachePath);
290
- }
291
- // Seed cache hit — return seed path in place (read-only, no copy).
292
- // Callers handle both directory and .zip paths; this returns a directory.
293
- const seedPath = await probeSeedCache(pluginId, version);
294
- if (seedPath) {
295
- logForDebugging(`Using seed cache for ${pluginId}@${version} at ${seedPath}`);
296
- return seedPath;
297
- }
298
- // Create parent directories
299
- await getFsImplementation().mkdir(dirname(cachePath));
300
- // For local plugins: copy entry.source directory (the single source of truth)
301
- // For remote plugins: marketplaceDir is undefined, fall back to copying sourcePath
302
- if (entry && typeof entry.source === 'string' && marketplaceDir) {
303
- const sourceDir = validatePathWithinBase(marketplaceDir, entry.source);
304
- logForDebugging(`Copying source directory ${entry.source} for plugin ${pluginId}`);
305
- try {
306
- await copyDir(sourceDir, cachePath);
307
- }
308
- catch (e) {
309
- // Only remap ENOENT from the top-level sourceDir itself — nested ENOENTs
310
- // from recursive copyDir (broken symlinks, raced deletes) should preserve
311
- // their original path in the error.
312
- if (isENOENT(e) && getErrnoPath(e) === sourceDir) {
313
- throw new Error(`Plugin source directory not found: ${sourceDir} (from entry.source: ${entry.source})`);
314
- }
315
- throw e;
316
- }
317
- }
318
- else {
319
- // Fallback for remote plugins (already downloaded) or plugins without entry.source
320
- logForDebugging(`Copying plugin ${pluginId} to versioned cache (fallback to full copy)`);
321
- await copyDir(sourcePath, cachePath);
322
- }
323
- // Remove .git directory from cache if present
324
- const gitPath = join(cachePath, '.git');
325
- await rm(gitPath, { recursive: true, force: true });
326
- // Validate that cache has content - if empty, throw so fallback can be used
327
- const cacheEntries = await readdir(cachePath);
328
- if (cacheEntries.length === 0) {
329
- throw new Error(`Failed to copy plugin ${pluginId} to versioned cache: destination is empty after copy`);
330
- }
331
- // Zip cache mode: convert directory to ZIP and remove the directory
332
- if (zipCacheMode) {
333
- await convertDirectoryToZipInPlace(cachePath, zipPath);
334
- logForDebugging(`Successfully cached plugin ${pluginId} as ZIP at ${zipPath}`);
335
- return zipPath;
336
- }
337
- logForDebugging(`Successfully cached plugin ${pluginId} at ${cachePath}`);
338
- return cachePath;
339
- }
340
- /**
341
- * Validate a git URL using Node.js URL parsing
342
- */
343
- function validateGitUrl(url) {
344
- try {
345
- const parsed = new URL(url);
346
- if (!['https:', 'http:', 'file:'].includes(parsed.protocol)) {
347
- if (!/^git@[a-zA-Z0-9.-]+:/.test(url)) {
348
- throw new Error(`Invalid git URL protocol: ${parsed.protocol}. Only HTTPS, HTTP, file:// and SSH (git@) URLs are supported.`);
349
- }
350
- }
351
- return url;
352
- }
353
- catch {
354
- if (/^git@[a-zA-Z0-9.-]+:/.test(url)) {
355
- return url;
356
- }
357
- throw new Error(`Invalid git URL: ${url}`);
358
- }
359
- }
360
- /**
361
- * Install a plugin from npm using a global cache (exported for testing)
362
- */
363
- export async function installFromNpm(packageName, targetPath, options = {}) {
364
- const npmCachePath = join(getPluginsDirectory(), 'npm-cache');
365
- await getFsImplementation().mkdir(npmCachePath);
366
- const packageSpec = options.version
367
- ? `${packageName}@${options.version}`
368
- : packageName;
369
- const packagePath = join(npmCachePath, 'node_modules', packageName);
370
- const needsInstall = !(await pathExists(packagePath));
371
- if (needsInstall) {
372
- logForDebugging(`Installing npm package ${packageSpec} to cache`);
373
- const args = ['install', packageSpec, '--prefix', npmCachePath];
374
- if (options.registry) {
375
- args.push('--registry', options.registry);
376
- }
377
- const result = await execFileNoThrow('npm', args, { useCwd: false });
378
- if (result.code !== 0) {
379
- throw new Error(`Failed to install npm package: ${result.stderr}`);
380
- }
381
- }
382
- await copyDir(packagePath, targetPath);
383
- logForDebugging(`Copied npm package ${packageName} from cache to ${targetPath}`);
384
- }
385
- /**
386
- * Clone a git repository (exported for testing)
387
- *
388
- * @param gitUrl - The git URL to clone
389
- * @param targetPath - Where to clone the repository
390
- * @param ref - Optional branch or tag to checkout
391
- * @param sha - Optional specific commit SHA to checkout
392
- */
393
- export async function gitClone(gitUrl, targetPath, ref, sha) {
394
- // Use --recurse-submodules to initialize submodules
395
- // Always start with shallow clone for efficiency
396
- const args = [
397
- 'clone',
398
- '--depth',
399
- '1',
400
- '--recurse-submodules',
401
- '--shallow-submodules',
402
- ];
403
- // Add --branch flag for specific ref (works for both branches and tags)
404
- if (ref) {
405
- args.push('--branch', ref);
406
- }
407
- // If sha is specified, use --no-checkout since we'll checkout the SHA separately
408
- if (sha) {
409
- args.push('--no-checkout');
410
- }
411
- args.push(gitUrl, targetPath);
412
- const cloneStarted = performance.now();
413
- const cloneResult = await execFileNoThrow(gitExe(), args);
414
- if (cloneResult.code !== 0) {
415
- logPluginFetch('plugin_clone', gitUrl, 'failure', performance.now() - cloneStarted, classifyFetchError(cloneResult.stderr));
416
- throw new Error(`Failed to clone repository: ${cloneResult.stderr}`);
417
- }
418
- // If sha is specified, fetch and checkout that specific commit
419
- if (sha) {
420
- // Try shallow fetch of the specific SHA first (most efficient)
421
- const shallowFetchResult = await execFileNoThrowWithCwd(gitExe(), ['fetch', '--depth', '1', 'origin', sha], { cwd: targetPath });
422
- if (shallowFetchResult.code !== 0) {
423
- // Some servers don't support fetching arbitrary SHAs
424
- // Fall back to unshallow fetch to get full history
425
- logForDebugging(`Shallow fetch of SHA ${sha} failed, falling back to unshallow fetch`);
426
- const unshallowResult = await execFileNoThrowWithCwd(gitExe(), ['fetch', '--unshallow'], { cwd: targetPath });
427
- if (unshallowResult.code !== 0) {
428
- logPluginFetch('plugin_clone', gitUrl, 'failure', performance.now() - cloneStarted, classifyFetchError(unshallowResult.stderr));
429
- throw new Error(`Failed to fetch commit ${sha}: ${unshallowResult.stderr}`);
430
- }
431
- }
432
- // Checkout the specific commit
433
- const checkoutResult = await execFileNoThrowWithCwd(gitExe(), ['checkout', sha], { cwd: targetPath });
434
- if (checkoutResult.code !== 0) {
435
- logPluginFetch('plugin_clone', gitUrl, 'failure', performance.now() - cloneStarted, classifyFetchError(checkoutResult.stderr));
436
- throw new Error(`Failed to checkout commit ${sha}: ${checkoutResult.stderr}`);
437
- }
438
- }
439
- // Fire success only after ALL network ops (clone + optional SHA fetch)
440
- // complete — same telemetry-scope discipline as mcpb and marketplace_url.
441
- logPluginFetch('plugin_clone', gitUrl, 'success', performance.now() - cloneStarted);
442
- }
443
- /**
444
- * Install a plugin from a git URL
445
- */
446
- async function installFromGit(gitUrl, targetPath, ref, sha) {
447
- const safeUrl = validateGitUrl(gitUrl);
448
- await gitClone(safeUrl, targetPath, ref, sha);
449
- const refMessage = ref ? ` (ref: ${ref})` : '';
450
- logForDebugging(`Cloned repository from ${safeUrl}${refMessage} to ${targetPath}`);
451
- }
452
- /**
453
- * Install a plugin from GitHub
454
- */
455
- async function installFromGitHub(repo, targetPath, ref, sha) {
456
- if (!/^[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/.test(repo)) {
457
- throw new Error(`Invalid GitHub repository format: ${repo}. Expected format: owner/repo`);
458
- }
459
- // Use HTTPS for CCR (no SSH keys), SSH for normal CLI
460
- const gitUrl = isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)
461
- ? `https://github.com/${repo}.git`
462
- : `git@github.com:${repo}.git`;
463
- return installFromGit(gitUrl, targetPath, ref, sha);
464
- }
465
- /**
466
- * Resolve a git-subdir `url` field to a clonable git URL.
467
- * Accepts GitHub owner/repo shorthand (converted to ssh or https depending on
468
- * CLAUDE_CODE_REMOTE) or any URL that passes validateGitUrl (https, http,
469
- * file, git@ ssh).
470
- */
471
- function resolveGitSubdirUrl(url) {
472
- if (/^[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/.test(url)) {
473
- return isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)
474
- ? `https://github.com/${url}.git`
475
- : `git@github.com:${url}.git`;
476
- }
477
- return validateGitUrl(url);
478
- }
479
- /**
480
- * Install a plugin from a subdirectory of a git repository (exported for
481
- * testing).
482
- *
483
- * Uses partial clone (--filter=tree:0) + sparse-checkout so only the tree
484
- * objects along the path and the blobs under it are downloaded. For large
485
- * monorepos this is dramatically cheaper than a full clone — the tree objects
486
- * for a million-file repo can be hundreds of MB, all avoided here.
487
- *
488
- * Sequence:
489
- * 1. clone --depth 1 --filter=tree:0 --no-checkout [--branch ref]
490
- * 2. sparse-checkout set --cone -- <path>
491
- * 3. If sha: fetch --depth 1 origin <sha> (fallback: --unshallow), then
492
- * checkout <sha>. The partial-clone filter is stored in remote config so
493
- * subsequent fetches respect it; --unshallow gets all commits but trees
494
- * and blobs remain lazy.
495
- * If no sha: checkout HEAD (points to ref if --branch was used).
496
- * 4. Move <cloneDir>/<path> to targetPath and discard the clone.
497
- *
498
- * The clone is ephemeral — it goes into a sibling temp directory and is
499
- * removed after the subdir is extracted. targetPath ends up containing only
500
- * the plugin files with no .git directory.
501
- */
502
- export async function installFromGitSubdir(url, targetPath, subdirPath, ref, sha) {
503
- if (!(await checkGitAvailable())) {
504
- throw new Error('git-subdir plugin source requires git to be installed and on PATH. ' +
505
- 'Install git (version 2.25 or later for sparse-checkout cone mode) and try again.');
506
- }
507
- const gitUrl = resolveGitSubdirUrl(url);
508
- // Clone into a sibling temp dir (same filesystem → rename works, no EXDEV).
509
- const cloneDir = `${targetPath}.clone`;
510
- const cloneArgs = [
511
- 'clone',
512
- '--depth',
513
- '1',
514
- '--filter=tree:0',
515
- '--no-checkout',
516
- ];
517
- if (ref) {
518
- cloneArgs.push('--branch', ref);
519
- }
520
- cloneArgs.push(gitUrl, cloneDir);
521
- const cloneResult = await execFileNoThrow(gitExe(), cloneArgs);
522
- if (cloneResult.code !== 0) {
523
- throw new Error(`Failed to clone repository for git-subdir source: ${cloneResult.stderr}`);
524
- }
525
- try {
526
- const sparseResult = await execFileNoThrowWithCwd(gitExe(), ['sparse-checkout', 'set', '--cone', '--', subdirPath], { cwd: cloneDir });
527
- if (sparseResult.code !== 0) {
528
- throw new Error(`git sparse-checkout set failed (git >= 2.25 required for cone mode): ${sparseResult.stderr}`);
529
- }
530
- // Capture the resolved commit SHA before discarding the clone. The
531
- // extracted subdir has no .git, so the caller can't rev-parse it later.
532
- // If the source specified a full 40-char sha we already know it; otherwise
533
- // read HEAD (which points to ref's tip after --branch, or the remote
534
- // default branch if no ref was given).
535
- let resolvedSha;
536
- if (sha) {
537
- const fetchSha = await execFileNoThrowWithCwd(gitExe(), ['fetch', '--depth', '1', 'origin', sha], { cwd: cloneDir });
538
- if (fetchSha.code !== 0) {
539
- logForDebugging(`Shallow fetch of SHA ${sha} failed for git-subdir, falling back to unshallow fetch`);
540
- const unshallow = await execFileNoThrowWithCwd(gitExe(), ['fetch', '--unshallow'], { cwd: cloneDir });
541
- if (unshallow.code !== 0) {
542
- throw new Error(`Failed to fetch commit ${sha}: ${unshallow.stderr}`);
543
- }
544
- }
545
- const checkout = await execFileNoThrowWithCwd(gitExe(), ['checkout', sha], { cwd: cloneDir });
546
- if (checkout.code !== 0) {
547
- throw new Error(`Failed to checkout commit ${sha}: ${checkout.stderr}`);
548
- }
549
- resolvedSha = sha;
550
- }
551
- else {
552
- // checkout HEAD materializes the working tree (this is where blobs are
553
- // lazy-fetched — the slow, network-bound step). It doesn't move HEAD;
554
- // --branch at clone time already positioned it. rev-parse HEAD is a
555
- // purely read-only ref lookup (no index lock), so it runs safely in
556
- // parallel with checkout and we avoid waiting on the network for it.
557
- const [checkout, revParse] = await Promise.all([
558
- execFileNoThrowWithCwd(gitExe(), ['checkout', 'HEAD'], {
559
- cwd: cloneDir,
560
- }),
561
- execFileNoThrowWithCwd(gitExe(), ['rev-parse', 'HEAD'], {
562
- cwd: cloneDir,
563
- }),
564
- ]);
565
- if (checkout.code !== 0) {
566
- throw new Error(`git checkout after sparse-checkout failed: ${checkout.stderr}`);
567
- }
568
- if (revParse.code === 0) {
569
- resolvedSha = revParse.stdout.trim();
570
- }
571
- }
572
- // Path traversal guard: resolve+verify the subdir stays inside cloneDir
573
- // before moving it out. rename ENOENT is wrapped with a friendlier
574
- // message that references the source path, not internal temp dirs.
575
- const resolvedSubdir = validatePathWithinBase(cloneDir, subdirPath);
576
- try {
577
- await rename(resolvedSubdir, targetPath);
578
- }
579
- catch (e) {
580
- if (isENOENT(e)) {
581
- throw new Error(`Subdirectory '${subdirPath}' not found in repository ${gitUrl}${ref ? ` (ref: ${ref})` : ''}. ` +
582
- 'Check that the path is correct and exists at the specified ref/sha.');
583
- }
584
- throw e;
585
- }
586
- const refMsg = ref ? ` ref=${ref}` : '';
587
- const shaMsg = resolvedSha ? ` sha=${resolvedSha}` : '';
588
- logForDebugging(`Extracted subdir ${subdirPath} from ${gitUrl}${refMsg}${shaMsg} to ${targetPath}`);
589
- return resolvedSha;
590
- }
591
- finally {
592
- await rm(cloneDir, { recursive: true, force: true });
593
- }
594
- }
595
- /**
596
- * Install a plugin from a local path
597
- */
598
- async function installFromLocal(sourcePath, targetPath) {
599
- if (!(await pathExists(sourcePath))) {
600
- throw new Error(`Source path does not exist: ${sourcePath}`);
601
- }
602
- await copyDir(sourcePath, targetPath);
603
- const gitPath = join(targetPath, '.git');
604
- await rm(gitPath, { recursive: true, force: true });
605
- }
606
- /**
607
- * Generate a temporary cache name for a plugin
608
- */
609
- export function generateTemporaryCacheNameForPlugin(source) {
610
- const timestamp = Date.now();
611
- const random = Math.random().toString(36).substring(2, 8);
612
- let prefix;
613
- if (typeof source === 'string') {
614
- prefix = 'local';
615
- }
616
- else {
617
- switch (source.source) {
618
- case 'npm':
619
- prefix = 'npm';
620
- break;
621
- case 'pip':
622
- prefix = 'pip';
623
- break;
624
- case 'github':
625
- prefix = 'github';
626
- break;
627
- case 'url':
628
- prefix = 'git';
629
- break;
630
- case 'git-subdir':
631
- prefix = 'subdir';
632
- break;
633
- default:
634
- prefix = 'unknown';
635
- }
636
- }
637
- return `temp_${prefix}_${timestamp}_${random}`;
638
- }
639
- /**
640
- * Cache a plugin from an external source
641
- */
642
- export async function cachePlugin(source, options) {
643
- const cachePath = getPluginCachePath();
644
- await getFsImplementation().mkdir(cachePath);
645
- const tempName = generateTemporaryCacheNameForPlugin(source);
646
- const tempPath = join(cachePath, tempName);
647
- let shouldCleanup = false;
648
- let gitCommitSha;
649
- try {
650
- logForDebugging(`Caching plugin from source: ${jsonStringify(source)} to temporary path ${tempPath}`);
651
- shouldCleanup = true;
652
- if (typeof source === 'string') {
653
- await installFromLocal(source, tempPath);
654
- }
655
- else {
656
- switch (source.source) {
657
- case 'npm':
658
- await installFromNpm(source.package, tempPath, {
659
- registry: source.registry,
660
- version: source.version,
661
- });
662
- break;
663
- case 'github':
664
- await installFromGitHub(source.repo, tempPath, source.ref, source.sha);
665
- break;
666
- case 'url':
667
- await installFromGit(source.url, tempPath, source.ref, source.sha);
668
- break;
669
- case 'git-subdir':
670
- gitCommitSha = await installFromGitSubdir(source.url, tempPath, source.path, source.ref, source.sha);
671
- break;
672
- case 'pip':
673
- throw new Error('Python package plugins are not yet supported');
674
- default:
675
- throw new Error(`Unsupported plugin source type`);
676
- }
677
- }
678
- }
679
- catch (error) {
680
- if (shouldCleanup && (await pathExists(tempPath))) {
681
- logForDebugging(`Cleaning up failed installation at ${tempPath}`);
682
- try {
683
- await rm(tempPath, { recursive: true, force: true });
684
- }
685
- catch (cleanupError) {
686
- logForDebugging(`Failed to clean up installation: ${cleanupError}`, {
687
- level: 'error',
688
- });
689
- }
690
- }
691
- throw error;
692
- }
693
- const manifestPath = join(tempPath, '.claude-plugin', 'plugin.json');
694
- const legacyManifestPath = join(tempPath, 'plugin.json');
695
- let manifest;
696
- if (await pathExists(manifestPath)) {
697
- try {
698
- const content = await readFile(manifestPath, { encoding: 'utf-8' });
699
- const parsed = jsonParse(content);
700
- const result = PluginManifestSchema().safeParse(parsed);
701
- if (result.success) {
702
- manifest = result.data;
703
- }
704
- else {
705
- // Manifest exists but is invalid - throw error
706
- const errors = result.error.issues
707
- .map(err => `${err.path.join('.')}: ${err.message}`)
708
- .join(', ');
709
- logForDebugging(`Invalid manifest at ${manifestPath}: ${errors}`, {
710
- level: 'error',
711
- });
712
- throw new Error(`Plugin has an invalid manifest file at ${manifestPath}. Validation errors: ${errors}`);
713
- }
714
- }
715
- catch (error) {
716
- // Check if this is a validation error we just threw
717
- if (error instanceof Error &&
718
- error.message.includes('invalid manifest file')) {
719
- throw error;
720
- }
721
- // JSON parse error
722
- const errorMsg = errorMessage(error);
723
- logForDebugging(`Failed to parse manifest at ${manifestPath}: ${errorMsg}`, {
724
- level: 'error',
725
- });
726
- throw new Error(`Plugin has a corrupt manifest file at ${manifestPath}. JSON parse error: ${errorMsg}`);
727
- }
728
- }
729
- else if (await pathExists(legacyManifestPath)) {
730
- try {
731
- const content = await readFile(legacyManifestPath, {
732
- encoding: 'utf-8',
733
- });
734
- const parsed = jsonParse(content);
735
- const result = PluginManifestSchema().safeParse(parsed);
736
- if (result.success) {
737
- manifest = result.data;
738
- }
739
- else {
740
- // Manifest exists but is invalid - throw error
741
- const errors = result.error.issues
742
- .map(err => `${err.path.join('.')}: ${err.message}`)
743
- .join(', ');
744
- logForDebugging(`Invalid legacy manifest at ${legacyManifestPath}: ${errors}`, { level: 'error' });
745
- throw new Error(`Plugin has an invalid manifest file at ${legacyManifestPath}. Validation errors: ${errors}`);
746
- }
747
- }
748
- catch (error) {
749
- // Check if this is a validation error we just threw
750
- if (error instanceof Error &&
751
- error.message.includes('invalid manifest file')) {
752
- throw error;
753
- }
754
- // JSON parse error
755
- const errorMsg = errorMessage(error);
756
- logForDebugging(`Failed to parse legacy manifest at ${legacyManifestPath}: ${errorMsg}`, {
757
- level: 'error',
758
- });
759
- throw new Error(`Plugin has a corrupt manifest file at ${legacyManifestPath}. JSON parse error: ${errorMsg}`);
760
- }
761
- }
762
- else {
763
- manifest = options?.manifest || {
764
- name: tempName,
765
- description: `Plugin cached from ${typeof source === 'string' ? source : source.source}`,
766
- };
767
- }
768
- const finalName = manifest.name.replace(/[^a-zA-Z0-9-_]/g, '-');
769
- const finalPath = join(cachePath, finalName);
770
- if (await pathExists(finalPath)) {
771
- logForDebugging(`Removing old cached version at ${finalPath}`);
772
- await rm(finalPath, { recursive: true, force: true });
773
- }
774
- await rename(tempPath, finalPath);
775
- logForDebugging(`Successfully cached plugin ${manifest.name} to ${finalPath}`);
776
- return {
777
- path: finalPath,
778
- manifest,
779
- ...(gitCommitSha && { gitCommitSha }),
780
- };
781
- }
782
- /**
783
- * Loads and validates a plugin manifest from a JSON file.
784
- *
785
- * The manifest provides metadata about the plugin including name, version,
786
- * description, author, and other optional fields. If no manifest exists,
787
- * a minimal one is created to allow the plugin to function.
788
- *
789
- * Example plugin.json:
790
- * ```json
791
- * {
792
- * "name": "code-assistant",
793
- * "version": "1.2.0",
794
- * "description": "AI-powered code assistance tools",
795
- * "author": {
796
- * "name": "John Doe",
797
- * "email": "john@example.com"
798
- * },
799
- * "keywords": ["coding", "ai", "assistant"],
800
- * "homepage": "https://example.com/code-assistant",
801
- * "hooks": "./custom-hooks.json",
802
- * "commands": ["./extra-commands/*.md"]
803
- * }
804
- * ```
805
- */
806
- /**
807
- * Loads and validates a plugin manifest from a JSON file.
808
- *
809
- * The manifest provides metadata about the plugin including name, version,
810
- * description, author, and other optional fields. If no manifest exists,
811
- * a minimal one is created to allow the plugin to function.
812
- *
813
- * Unknown keys in the manifest are silently stripped (PluginManifestSchema
814
- * uses zod's default strip behavior, not .strict()). Type mismatches and
815
- * other validation errors still fail.
816
- *
817
- * Behavior:
818
- * - Missing file: Creates default with provided name and source
819
- * - Invalid JSON: Throws error with parse details
820
- * - Schema validation failure: Throws error with validation details
821
- *
822
- * @param manifestPath - Full path to the plugin.json file
823
- * @param pluginName - Name to use in default manifest (e.g., "my-plugin")
824
- * @param source - Source description for default manifest (e.g., "git:repo" or ".claude-plugin/name")
825
- * @returns A valid PluginManifest object (either loaded or default)
826
- * @throws Error if manifest exists but is invalid (corrupt JSON or schema validation failure)
827
- */
828
- export async function loadPluginManifest(manifestPath, pluginName, source) {
829
- // Check if manifest file exists
830
- // If not, create a minimal manifest to allow plugin to function
831
- if (!(await pathExists(manifestPath))) {
832
- // Return default manifest with provided name and source
833
- return {
834
- name: pluginName,
835
- description: `Plugin from ${source}`,
836
- };
837
- }
838
- try {
839
- // Read and parse the manifest JSON file
840
- const content = await readFile(manifestPath, { encoding: 'utf-8' });
841
- const parsedJson = jsonParse(content);
842
- // Validate against the PluginManifest schema
843
- const result = PluginManifestSchema().safeParse(parsedJson);
844
- if (result.success) {
845
- // Valid manifest - return the validated data
846
- return result.data;
847
- }
848
- // Schema validation failed but JSON was valid
849
- const errors = result.error.issues
850
- .map(err => err.path.length > 0
851
- ? `${err.path.join('.')}: ${err.message}`
852
- : err.message)
853
- .join(', ');
854
- logForDebugging(`Plugin ${pluginName} has an invalid manifest file at ${manifestPath}. Validation errors: ${errors}`, { level: 'error' });
855
- throw new Error(`Plugin ${pluginName} has an invalid manifest file at ${manifestPath}.\n\nValidation errors: ${errors}`);
856
- }
857
- catch (error) {
858
- // Check if this is the error we just threw (validation error)
859
- if (error instanceof Error &&
860
- error.message.includes('invalid manifest file')) {
861
- throw error;
862
- }
863
- // JSON parsing failed or file read error
864
- const errorMsg = errorMessage(error);
865
- logForDebugging(`Plugin ${pluginName} has a corrupt manifest file at ${manifestPath}. Parse error: ${errorMsg}`, { level: 'error' });
866
- throw new Error(`Plugin ${pluginName} has a corrupt manifest file at ${manifestPath}.\n\nJSON parse error: ${errorMsg}`);
867
- }
868
- }
869
- /**
870
- * Loads and validates plugin hooks configuration from a JSON file.
871
- * IMPORTANT: Only call this when the hooks file is expected to exist.
872
- *
873
- * @param hooksConfigPath - Full path to the hooks.json file
874
- * @param pluginName - Plugin name for error messages
875
- * @returns Validated HooksSettings
876
- * @throws Error if file doesn't exist or is invalid
877
- */
878
- async function loadPluginHooks(hooksConfigPath, pluginName) {
879
- if (!(await pathExists(hooksConfigPath))) {
880
- throw new Error(`Hooks file not found at ${hooksConfigPath} for plugin ${pluginName}. If the manifest declares hooks, the file must exist.`);
881
- }
882
- const content = await readFile(hooksConfigPath, { encoding: 'utf-8' });
883
- const rawHooksConfig = jsonParse(content);
884
- // The hooks.json file has a wrapper structure with description and hooks
885
- // Use PluginHooksSchema to validate and extract the hooks property
886
- const validatedPluginHooks = PluginHooksSchema().parse(rawHooksConfig);
887
- return validatedPluginHooks.hooks;
888
- }
889
- /**
890
- * Validate a list of plugin component relative paths by checking existence in parallel.
891
- *
892
- * This helper parallelizes the pathExists checks (the expensive async part) while
893
- * preserving deterministic error/log ordering by iterating results sequentially.
894
- *
895
- * Introduced to fix a perf regression from the sync→async fs migration: sequential
896
- * `for { await pathExists }` loops add ~1-5ms of event-loop overhead per iteration.
897
- * With many plugins × several component types, this compounds to hundreds of ms.
898
- *
899
- * @param relPaths - Relative paths from the manifest/marketplace entry to validate
900
- * @param pluginPath - Plugin root directory to resolve relative paths against
901
- * @param pluginName - Plugin name for error messages
902
- * @param source - Source identifier for PluginError records
903
- * @param component - Which component these paths belong to (for error records)
904
- * @param componentLabel - Human-readable label for log messages (e.g. "Agent", "Skill")
905
- * @param contextLabel - Where the path came from, for log messages
906
- * (e.g. "specified in manifest but", "from marketplace entry")
907
- * @param errors - Error array to push path-not-found errors into (mutated)
908
- * @returns Array of full paths that exist on disk, in original order
909
- */
910
- async function validatePluginPaths(relPaths, pluginPath, pluginName, source, component, componentLabel, contextLabel, errors) {
911
- // Parallelize the async pathExists checks
912
- const checks = await Promise.all(relPaths.map(async (relPath) => {
913
- const fullPath = join(pluginPath, relPath);
914
- return { relPath, fullPath, exists: await pathExists(fullPath) };
915
- }));
916
- // Process results in original order to keep error/log ordering deterministic
917
- const validPaths = [];
918
- for (const { relPath, fullPath, exists } of checks) {
919
- if (exists) {
920
- validPaths.push(fullPath);
921
- }
922
- else {
923
- logForDebugging(`${componentLabel} path ${relPath} ${contextLabel} not found at ${fullPath} for ${pluginName}`, { level: 'warn' });
924
- logError(new Error(`Plugin component file not found: ${fullPath} for ${pluginName}`));
925
- errors.push({
926
- type: 'path-not-found',
927
- source,
928
- plugin: pluginName,
929
- path: fullPath,
930
- component,
931
- });
932
- }
933
- }
934
- return validPaths;
935
- }
936
- /**
937
- * Creates a LoadedPlugin object from a plugin directory path.
938
- *
939
- * This is the central function that assembles a complete plugin representation
940
- * by scanning the plugin directory structure and loading all components.
941
- * It handles both fully-featured plugins with manifests and minimal plugins
942
- * with just commands or agents directories.
943
- *
944
- * Directory structure it looks for:
945
- * ```
946
- * plugin-directory/
947
- * ├── plugin.json # Optional: Plugin manifest
948
- * ├── commands/ # Optional: Custom slash commands
949
- * │ ├── build.md # /build command
950
- * │ └── test.md # /test command
951
- * ├── agents/ # Optional: Custom AI agents
952
- * │ ├── reviewer.md # Code review agent
953
- * │ └── optimizer.md # Performance optimization agent
954
- * └── hooks/ # Optional: Hook configurations
955
- * └── hooks.json # Hook definitions
956
- * ```
957
- *
958
- * Component detection:
959
- * - Manifest: Loaded from plugin.json if present, otherwise creates default
960
- * - Commands: Sets commandsPath if commands/ directory exists
961
- * - Agents: Sets agentsPath if agents/ directory exists
962
- * - Hooks: Loads from hooks/hooks.json if present
963
- *
964
- * The function is tolerant of missing components - a plugin can have
965
- * any combination of the above directories/files. Missing component files
966
- * are reported as errors but don't prevent plugin loading.
967
- *
968
- * @param pluginPath - Absolute path to the plugin directory
969
- * @param source - Source identifier (e.g., "git:repo", ".claude-plugin/my-plugin")
970
- * @param enabled - Initial enabled state (may be overridden by settings)
971
- * @param fallbackName - Name to use if manifest doesn't specify one
972
- * @param strict - When true, adds errors for duplicate hook files (default: true)
973
- * @returns Object containing the LoadedPlugin and any errors encountered
974
- */
975
- export async function createPluginFromPath(pluginPath, source, enabled, fallbackName, strict = true) {
976
- const errors = [];
977
- // Step 1: Load or create the plugin manifest
978
- // This provides metadata about the plugin (name, version, etc.)
979
- const manifestPath = join(pluginPath, '.claude-plugin', 'plugin.json');
980
- const manifest = await loadPluginManifest(manifestPath, fallbackName, source);
981
- // Step 2: Create the base plugin object
982
- // Start with required fields from manifest and parameters
983
- const plugin = {
984
- name: manifest.name, // Use name from manifest (or fallback)
985
- manifest, // Store full manifest for later use
986
- path: pluginPath, // Absolute path to plugin directory
987
- source, // Source identifier (e.g., "git:repo" or ".claude-plugin/name")
988
- repository: source, // For backward compatibility with Plugin Repository
989
- enabled, // Current enabled state
990
- };
991
- // Step 3: Auto-detect optional directories in parallel
992
- const [commandsDirExists, agentsDirExists, skillsDirExists, outputStylesDirExists,] = await Promise.all([
993
- !manifest.commands ? pathExists(join(pluginPath, 'commands')) : false,
994
- !manifest.agents ? pathExists(join(pluginPath, 'agents')) : false,
995
- !manifest.skills ? pathExists(join(pluginPath, 'skills')) : false,
996
- !manifest.outputStyles
997
- ? pathExists(join(pluginPath, 'output-styles'))
998
- : false,
999
- ]);
1000
- const commandsPath = join(pluginPath, 'commands');
1001
- if (commandsDirExists) {
1002
- plugin.commandsPath = commandsPath;
1003
- }
1004
- // Step 3a: Process additional command paths from manifest
1005
- if (manifest.commands) {
1006
- // Check if it's an object mapping (record of command name → metadata)
1007
- const firstValue = Object.values(manifest.commands)[0];
1008
- if (typeof manifest.commands === 'object' &&
1009
- !Array.isArray(manifest.commands) &&
1010
- firstValue &&
1011
- typeof firstValue === 'object' &&
1012
- ('source' in firstValue || 'content' in firstValue)) {
1013
- // Object mapping format: { "about": { "source": "./README.md", ... } }
1014
- const commandsMetadata = {};
1015
- const validPaths = [];
1016
- // Parallelize pathExists checks; process results in order to keep
1017
- // error/log ordering deterministic.
1018
- const entries = Object.entries(manifest.commands);
1019
- const checks = await Promise.all(entries.map(async ([commandName, metadata]) => {
1020
- if (!metadata || typeof metadata !== 'object') {
1021
- return { commandName, metadata, kind: 'skip' };
1022
- }
1023
- if (metadata.source) {
1024
- const fullPath = join(pluginPath, metadata.source);
1025
- return {
1026
- commandName,
1027
- metadata,
1028
- kind: 'source',
1029
- fullPath,
1030
- exists: await pathExists(fullPath),
1031
- };
1032
- }
1033
- if (metadata.content) {
1034
- return { commandName, metadata, kind: 'content' };
1035
- }
1036
- return { commandName, metadata, kind: 'skip' };
1037
- }));
1038
- for (const check of checks) {
1039
- if (check.kind === 'skip')
1040
- continue;
1041
- if (check.kind === 'content') {
1042
- // For inline content commands, add metadata without path
1043
- commandsMetadata[check.commandName] = check.metadata;
1044
- continue;
1045
- }
1046
- // kind === 'source'
1047
- if (check.exists) {
1048
- validPaths.push(check.fullPath);
1049
- commandsMetadata[check.commandName] = check.metadata;
1050
- }
1051
- else {
1052
- logForDebugging(`Command ${check.commandName} path ${check.metadata.source} specified in manifest but not found at ${check.fullPath} for ${manifest.name}`, { level: 'warn' });
1053
- logError(new Error(`Plugin component file not found: ${check.fullPath} for ${manifest.name}`));
1054
- errors.push({
1055
- type: 'path-not-found',
1056
- source,
1057
- plugin: manifest.name,
1058
- path: check.fullPath,
1059
- component: 'commands',
1060
- });
1061
- }
1062
- }
1063
- // Set commandsPaths if there are file-based commands
1064
- if (validPaths.length > 0) {
1065
- plugin.commandsPaths = validPaths;
1066
- }
1067
- // Set commandsMetadata if there are any commands (file-based or inline)
1068
- if (Object.keys(commandsMetadata).length > 0) {
1069
- plugin.commandsMetadata = commandsMetadata;
1070
- }
1071
- }
1072
- else {
1073
- // Path or array of paths format
1074
- const commandPaths = Array.isArray(manifest.commands)
1075
- ? manifest.commands
1076
- : [manifest.commands];
1077
- // Parallelize pathExists checks; process results in order.
1078
- const checks = await Promise.all(commandPaths.map(async (cmdPath) => {
1079
- if (typeof cmdPath !== 'string') {
1080
- return { cmdPath, kind: 'invalid' };
1081
- }
1082
- const fullPath = join(pluginPath, cmdPath);
1083
- return {
1084
- cmdPath,
1085
- kind: 'path',
1086
- fullPath,
1087
- exists: await pathExists(fullPath),
1088
- };
1089
- }));
1090
- const validPaths = [];
1091
- for (const check of checks) {
1092
- if (check.kind === 'invalid') {
1093
- logForDebugging(`Unexpected command format in manifest for ${manifest.name}`, { level: 'error' });
1094
- continue;
1095
- }
1096
- if (check.exists) {
1097
- validPaths.push(check.fullPath);
1098
- }
1099
- else {
1100
- logForDebugging(`Command path ${check.cmdPath} specified in manifest but not found at ${check.fullPath} for ${manifest.name}`, { level: 'warn' });
1101
- logError(new Error(`Plugin component file not found: ${check.fullPath} for ${manifest.name}`));
1102
- errors.push({
1103
- type: 'path-not-found',
1104
- source,
1105
- plugin: manifest.name,
1106
- path: check.fullPath,
1107
- component: 'commands',
1108
- });
1109
- }
1110
- }
1111
- if (validPaths.length > 0) {
1112
- plugin.commandsPaths = validPaths;
1113
- }
1114
- }
1115
- }
1116
- // Step 4: Register agents directory if detected
1117
- const agentsPath = join(pluginPath, 'agents');
1118
- if (agentsDirExists) {
1119
- plugin.agentsPath = agentsPath;
1120
- }
1121
- // Step 4a: Process additional agent paths from manifest
1122
- if (manifest.agents) {
1123
- const agentPaths = Array.isArray(manifest.agents)
1124
- ? manifest.agents
1125
- : [manifest.agents];
1126
- const validPaths = await validatePluginPaths(agentPaths, pluginPath, manifest.name, source, 'agents', 'Agent', 'specified in manifest but', errors);
1127
- if (validPaths.length > 0) {
1128
- plugin.agentsPaths = validPaths;
1129
- }
1130
- }
1131
- // Step 4b: Register skills directory if detected
1132
- const skillsPath = join(pluginPath, 'skills');
1133
- if (skillsDirExists) {
1134
- plugin.skillsPath = skillsPath;
1135
- }
1136
- // Step 4c: Process additional skill paths from manifest
1137
- if (manifest.skills) {
1138
- const skillPaths = Array.isArray(manifest.skills)
1139
- ? manifest.skills
1140
- : [manifest.skills];
1141
- const validPaths = await validatePluginPaths(skillPaths, pluginPath, manifest.name, source, 'skills', 'Skill', 'specified in manifest but', errors);
1142
- if (validPaths.length > 0) {
1143
- plugin.skillsPaths = validPaths;
1144
- }
1145
- }
1146
- // Step 4d: Register output-styles directory if detected
1147
- const outputStylesPath = join(pluginPath, 'output-styles');
1148
- if (outputStylesDirExists) {
1149
- plugin.outputStylesPath = outputStylesPath;
1150
- }
1151
- // Step 4e: Process additional output style paths from manifest
1152
- if (manifest.outputStyles) {
1153
- const outputStylePaths = Array.isArray(manifest.outputStyles)
1154
- ? manifest.outputStyles
1155
- : [manifest.outputStyles];
1156
- const validPaths = await validatePluginPaths(outputStylePaths, pluginPath, manifest.name, source, 'output-styles', 'Output style', 'specified in manifest but', errors);
1157
- if (validPaths.length > 0) {
1158
- plugin.outputStylesPaths = validPaths;
1159
- }
1160
- }
1161
- // Step 5: Load hooks configuration
1162
- let mergedHooks;
1163
- const loadedHookPaths = new Set(); // Track loaded hook files
1164
- // Load from standard hooks/hooks.json if it exists
1165
- const standardHooksPath = join(pluginPath, 'hooks', 'hooks.json');
1166
- if (await pathExists(standardHooksPath)) {
1167
- try {
1168
- mergedHooks = await loadPluginHooks(standardHooksPath, manifest.name);
1169
- // Track the normalized path to prevent duplicate loading
1170
- try {
1171
- loadedHookPaths.add(await realpath(standardHooksPath));
1172
- }
1173
- catch {
1174
- // If realpathSync fails, use original path
1175
- loadedHookPaths.add(standardHooksPath);
1176
- }
1177
- logForDebugging(`Loaded hooks from standard location for plugin ${manifest.name}: ${standardHooksPath}`);
1178
- }
1179
- catch (error) {
1180
- const errorMsg = errorMessage(error);
1181
- logForDebugging(`Failed to load hooks for ${manifest.name}: ${errorMsg}`, {
1182
- level: 'error',
1183
- });
1184
- logError(toError(error));
1185
- errors.push({
1186
- type: 'hook-load-failed',
1187
- source,
1188
- plugin: manifest.name,
1189
- hookPath: standardHooksPath,
1190
- reason: errorMsg,
1191
- });
1192
- }
1193
- }
1194
- // Load and merge hooks from manifest.hooks if specified
1195
- if (manifest.hooks) {
1196
- const manifestHooksArray = Array.isArray(manifest.hooks)
1197
- ? manifest.hooks
1198
- : [manifest.hooks];
1199
- for (const hookSpec of manifestHooksArray) {
1200
- if (typeof hookSpec === 'string') {
1201
- // Path to additional hooks file
1202
- const hookFilePath = join(pluginPath, hookSpec);
1203
- if (!(await pathExists(hookFilePath))) {
1204
- logForDebugging(`Hooks file ${hookSpec} specified in manifest but not found at ${hookFilePath} for ${manifest.name}`, { level: 'error' });
1205
- logError(new Error(`Plugin component file not found: ${hookFilePath} for ${manifest.name}`));
1206
- errors.push({
1207
- type: 'path-not-found',
1208
- source,
1209
- plugin: manifest.name,
1210
- path: hookFilePath,
1211
- component: 'hooks',
1212
- });
1213
- continue;
1214
- }
1215
- // Check if this path resolves to an already-loaded hooks file
1216
- let normalizedPath;
1217
- try {
1218
- normalizedPath = await realpath(hookFilePath);
1219
- }
1220
- catch {
1221
- // If realpathSync fails, use original path
1222
- normalizedPath = hookFilePath;
1223
- }
1224
- if (loadedHookPaths.has(normalizedPath)) {
1225
- logForDebugging(`Skipping duplicate hooks file for plugin ${manifest.name}: ${hookSpec} ` +
1226
- `(resolves to already-loaded file: ${normalizedPath})`);
1227
- if (strict) {
1228
- 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.`;
1229
- logError(new Error(errorMsg));
1230
- errors.push({
1231
- type: 'hook-load-failed',
1232
- source,
1233
- plugin: manifest.name,
1234
- hookPath: hookFilePath,
1235
- reason: errorMsg,
1236
- });
1237
- }
1238
- continue;
1239
- }
1240
- try {
1241
- const additionalHooks = await loadPluginHooks(hookFilePath, manifest.name);
1242
- try {
1243
- mergedHooks = mergeHooksSettings(mergedHooks, additionalHooks);
1244
- loadedHookPaths.add(normalizedPath);
1245
- logForDebugging(`Loaded and merged hooks from manifest for plugin ${manifest.name}: ${hookSpec}`);
1246
- }
1247
- catch (mergeError) {
1248
- const mergeErrorMsg = errorMessage(mergeError);
1249
- logForDebugging(`Failed to merge hooks from ${hookSpec} for ${manifest.name}: ${mergeErrorMsg}`, { level: 'error' });
1250
- logError(toError(mergeError));
1251
- errors.push({
1252
- type: 'hook-load-failed',
1253
- source,
1254
- plugin: manifest.name,
1255
- hookPath: hookFilePath,
1256
- reason: `Failed to merge: ${mergeErrorMsg}`,
1257
- });
1258
- }
1259
- }
1260
- catch (error) {
1261
- const errorMsg = errorMessage(error);
1262
- logForDebugging(`Failed to load hooks from ${hookSpec} for ${manifest.name}: ${errorMsg}`, { level: 'error' });
1263
- logError(toError(error));
1264
- errors.push({
1265
- type: 'hook-load-failed',
1266
- source,
1267
- plugin: manifest.name,
1268
- hookPath: hookFilePath,
1269
- reason: errorMsg,
1270
- });
1271
- }
1272
- }
1273
- else if (typeof hookSpec === 'object') {
1274
- // Inline hooks
1275
- mergedHooks = mergeHooksSettings(mergedHooks, hookSpec);
1276
- }
1277
- }
1278
- }
1279
- if (mergedHooks) {
1280
- plugin.hooksConfig = mergedHooks;
1281
- }
1282
- // Step 6: Load plugin settings
1283
- // Settings can come from settings.json in the plugin directory or from manifest.settings
1284
- // Only allowlisted keys are kept (currently: agent)
1285
- const pluginSettings = await loadPluginSettings(pluginPath, manifest);
1286
- if (pluginSettings) {
1287
- plugin.settings = pluginSettings;
1288
- }
1289
- return { plugin, errors };
1290
- }
1291
- /**
1292
- * Schema derived from SettingsSchema that only keeps keys plugins are allowed to set.
1293
- * Uses .strip() so unknown keys are silently removed during parsing.
1294
- */
1295
- const PluginSettingsSchema = lazySchema(() => SettingsSchema()
1296
- .pick({
1297
- agent: true,
1298
- })
1299
- .strip());
1300
- /**
1301
- * Parse raw settings through PluginSettingsSchema, returning only allowlisted keys.
1302
- * Returns undefined if parsing fails or all keys are filtered out.
1303
- */
1304
- function parsePluginSettings(raw) {
1305
- const result = PluginSettingsSchema().safeParse(raw);
1306
- if (!result.success) {
1307
- return undefined;
1308
- }
1309
- const data = result.data;
1310
- if (Object.keys(data).length === 0) {
1311
- return undefined;
1312
- }
1313
- return data;
1314
- }
1315
- /**
1316
- * Load plugin settings from settings.json file or manifest.settings.
1317
- * settings.json takes priority over manifest.settings when both exist.
1318
- * Only allowlisted keys are included in the result.
1319
- */
1320
- async function loadPluginSettings(pluginPath, manifest) {
1321
- // Try loading settings.json from the plugin directory
1322
- const settingsJsonPath = join(pluginPath, 'settings.json');
1323
- try {
1324
- const content = await readFile(settingsJsonPath, { encoding: 'utf-8' });
1325
- const parsed = jsonParse(content);
1326
- if (isRecord(parsed)) {
1327
- const filtered = parsePluginSettings(parsed);
1328
- if (filtered) {
1329
- logForDebugging(`Loaded settings from settings.json for plugin ${manifest.name}`);
1330
- return filtered;
1331
- }
1332
- }
1333
- }
1334
- catch (e) {
1335
- // Missing/inaccessible is expected - settings.json is optional
1336
- if (!isFsInaccessible(e)) {
1337
- logForDebugging(`Failed to parse settings.json for plugin ${manifest.name}: ${e}`, { level: 'warn' });
1338
- }
1339
- }
1340
- // Fall back to manifest.settings
1341
- if (manifest.settings) {
1342
- const filtered = parsePluginSettings(manifest.settings);
1343
- if (filtered) {
1344
- logForDebugging(`Loaded settings from manifest for plugin ${manifest.name}`);
1345
- return filtered;
1346
- }
1347
- }
1348
- return undefined;
1349
- }
1350
- /**
1351
- * Merge two HooksSettings objects
1352
- */
1353
- function mergeHooksSettings(base, additional) {
1354
- if (!base) {
1355
- return additional;
1356
- }
1357
- const merged = { ...base };
1358
- for (const [event, matchers] of Object.entries(additional)) {
1359
- if (!merged[event]) {
1360
- merged[event] = matchers;
1361
- }
1362
- else {
1363
- // Merge matchers for this event
1364
- merged[event] = [
1365
- ...(merged[event] || []),
1366
- ...matchers,
1367
- ];
1368
- }
1369
- }
1370
- return merged;
1371
- }
1372
- /**
1373
- * Shared discovery/policy/merge pipeline for both load modes.
1374
- *
1375
- * Resolves enabledPlugins → marketplace entries, runs enterprise policy
1376
- * checks, pre-loads catalogs, then dispatches each entry to the full or
1377
- * cache-only per-entry loader. The ONLY difference between loadAllPlugins
1378
- * and loadAllPluginsCacheOnly is which loader runs — discovery and policy
1379
- * are identical.
1380
- */
1381
- async function loadPluginsFromMarketplaces({ cacheOnly, }) {
1382
- const settings = getSettings_DEPRECATED();
1383
- // Merge --add-dir plugins at lowest priority; standard settings win on conflict
1384
- const enabledPlugins = {
1385
- ...getAddDirEnabledPlugins(),
1386
- ...(settings.enabledPlugins || {}),
1387
- };
1388
- const plugins = [];
1389
- const errors = [];
1390
- // Filter to plugin@marketplace format and validate
1391
- const marketplacePluginEntries = Object.entries(enabledPlugins).filter(([key, value]) => {
1392
- // Check if it's in plugin@marketplace format (includes both enabled and disabled)
1393
- const isValidFormat = PluginIdSchema().safeParse(key).success;
1394
- if (!isValidFormat || value === undefined)
1395
- return false;
1396
- // Skip built-in plugins — handled separately by getBuiltinPlugins()
1397
- const { marketplace } = parsePluginIdentifier(key);
1398
- return marketplace !== BUILTIN_MARKETPLACE_NAME;
1399
- });
1400
- // Load known marketplaces config to look up sources for policy checking.
1401
- // Use the Safe variant so a corrupted config file doesn't crash all plugin
1402
- // loading — this is a read-only path, so returning {} degrades gracefully.
1403
- const knownMarketplaces = await loadKnownMarketplacesConfigSafe();
1404
- // Fail-closed guard for enterprise policy: if a policy IS configured and we
1405
- // cannot resolve a marketplace's source (config returned {} due to corruption,
1406
- // or entry missing), we must NOT silently skip the policy check and load the
1407
- // plugin anyway. Before Safe, a corrupted config crashed everything (loud,
1408
- // fail-closed). With Safe + no guard, the policy check short-circuits on
1409
- // undefined marketplaceConfig and the fallback path (getPluginByIdCacheOnly)
1410
- // loads the plugin unchecked — a silent fail-open. This guard restores
1411
- // fail-closed: unknown source + active policy → block.
1412
- //
1413
- // Allowlist: any value (including []) is active — empty allowlist = deny all.
1414
- // Blocklist: empty [] is a semantic no-op — only non-empty counts as active.
1415
- const strictAllowlist = getStrictKnownMarketplaces();
1416
- const blocklist = getBlockedMarketplaces();
1417
- const hasEnterprisePolicy = strictAllowlist !== null || (blocklist !== null && blocklist.length > 0);
1418
- // Pre-load marketplace catalogs once per marketplace rather than re-reading
1419
- // known_marketplaces.json + marketplace.json for every plugin. This is the
1420
- // hot path — with N plugins across M marketplaces, the old per-plugin
1421
- // getPluginByIdCacheOnly() did 2N config reads + N catalog reads; this does M.
1422
- const uniqueMarketplaces = new Set(marketplacePluginEntries
1423
- .map(([pluginId]) => parsePluginIdentifier(pluginId).marketplace)
1424
- .filter((m) => !!m));
1425
- const marketplaceCatalogs = new Map();
1426
- await Promise.all([...uniqueMarketplaces].map(async (name) => {
1427
- marketplaceCatalogs.set(name, await getMarketplaceCacheOnly(name));
1428
- }));
1429
- // Look up installed versions once so the first-pass ZIP cache check
1430
- // can hit even when the marketplace entry omits `version`.
1431
- const installedPluginsData = getInMemoryInstalledPlugins();
1432
- // Load all marketplace plugins in parallel for faster startup
1433
- const results = await Promise.allSettled(marketplacePluginEntries.map(async ([pluginId, enabledValue]) => {
1434
- const { name: pluginName, marketplace: marketplaceName } = parsePluginIdentifier(pluginId);
1435
- // Check if marketplace source is allowed by enterprise policy
1436
- const marketplaceConfig = knownMarketplaces[marketplaceName];
1437
- // Fail-closed: if enterprise policy is active and we can't look up the
1438
- // marketplace source (config corrupted/empty, or entry missing), block
1439
- // rather than silently skip the policy check. See hasEnterprisePolicy
1440
- // comment above for the fail-open hazard this guards against.
1441
- //
1442
- // This also fires for the "stale enabledPlugins entry with no registered
1443
- // marketplace" case, which is a UX trade-off: the user gets a policy
1444
- // error instead of plugin-not-found. Accepted because the fallback path
1445
- // (getPluginByIdCacheOnly) does a raw cast of known_marketplaces.json
1446
- // with NO schema validation — if one entry is malformed enough to fail
1447
- // our validation but readable enough for the raw cast, it would load
1448
- // unchecked. Unverifiable source + active policy → block, always.
1449
- if (!marketplaceConfig && hasEnterprisePolicy) {
1450
- // We can't know whether the unverifiable source would actually be in
1451
- // the blocklist or not in the allowlist — so pick the error variant
1452
- // that matches whichever policy IS configured. If an allowlist exists,
1453
- // "not in allowed list" is the right framing; if only a blocklist
1454
- // exists, "blocked by blocklist" is less misleading than showing an
1455
- // empty allowed-sources list.
1456
- errors.push({
1457
- type: 'marketplace-blocked-by-policy',
1458
- source: pluginId,
1459
- plugin: pluginName,
1460
- marketplace: marketplaceName,
1461
- blockedByBlocklist: strictAllowlist === null,
1462
- allowedSources: (strictAllowlist ?? []).map(s => formatSourceForDisplay(s)),
1463
- });
1464
- return null;
1465
- }
1466
- if (marketplaceConfig &&
1467
- !isSourceAllowedByPolicy(marketplaceConfig.source)) {
1468
- // Check if explicitly blocked vs not in allowlist for better error context
1469
- const isBlocked = isSourceInBlocklist(marketplaceConfig.source);
1470
- const allowlist = getStrictKnownMarketplaces() || [];
1471
- errors.push({
1472
- type: 'marketplace-blocked-by-policy',
1473
- source: pluginId,
1474
- plugin: pluginName,
1475
- marketplace: marketplaceName,
1476
- blockedByBlocklist: isBlocked,
1477
- allowedSources: isBlocked
1478
- ? []
1479
- : allowlist.map(s => formatSourceForDisplay(s)),
1480
- });
1481
- return null;
1482
- }
1483
- // Look up plugin entry from pre-loaded marketplace catalog (no per-plugin I/O).
1484
- // Fall back to getPluginByIdCacheOnly if the catalog couldn't be pre-loaded.
1485
- let result = null;
1486
- const marketplace = marketplaceCatalogs.get(marketplaceName);
1487
- if (marketplace && marketplaceConfig) {
1488
- const entry = marketplace.plugins.find(p => p.name === pluginName);
1489
- if (entry) {
1490
- result = {
1491
- entry,
1492
- marketplaceInstallLocation: marketplaceConfig.installLocation,
1493
- };
1494
- }
1495
- }
1496
- else {
1497
- result = await getPluginByIdCacheOnly(pluginId);
1498
- }
1499
- if (!result) {
1500
- errors.push({
1501
- type: 'plugin-not-found',
1502
- source: pluginId,
1503
- pluginId: pluginName,
1504
- marketplace: marketplaceName,
1505
- });
1506
- return null;
1507
- }
1508
- // installed_plugins.json records what's actually cached on disk
1509
- // (version for the full loader's first-pass probe, installPath for
1510
- // the cache-only loader's direct read).
1511
- const installEntry = installedPluginsData.plugins[pluginId]?.[0];
1512
- return cacheOnly
1513
- ? loadPluginFromMarketplaceEntryCacheOnly(result.entry, result.marketplaceInstallLocation, pluginId, enabledValue === true, errors, installEntry?.installPath)
1514
- : loadPluginFromMarketplaceEntry(result.entry, result.marketplaceInstallLocation, pluginId, enabledValue === true, errors, installEntry?.version);
1515
- }));
1516
- for (const [i, result] of results.entries()) {
1517
- if (result.status === 'fulfilled' && result.value) {
1518
- plugins.push(result.value);
1519
- }
1520
- else if (result.status === 'rejected') {
1521
- const err = toError(result.reason);
1522
- logError(err);
1523
- const pluginId = marketplacePluginEntries[i][0];
1524
- errors.push({
1525
- type: 'generic-error',
1526
- source: pluginId,
1527
- plugin: pluginId.split('@')[0],
1528
- error: err.message,
1529
- });
1530
- }
1531
- }
1532
- return { plugins, errors };
1533
- }
1534
- /**
1535
- * Cache-only variant of loadPluginFromMarketplaceEntry.
1536
- *
1537
- * Skips network (cachePlugin) and disk-copy (copyPluginToVersionedCache).
1538
- * Reads directly from the recorded installPath; if missing, emits
1539
- * 'plugin-cache-miss'. Still extracts ZIP-cached plugins (local, fast).
1540
- */
1541
- async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstallLocation, pluginId, enabled, errorsOut, installPath) {
1542
- let pluginPath;
1543
- if (typeof entry.source === 'string') {
1544
- // Local relative path — read from the marketplace source dir directly.
1545
- // Skip copyPluginToVersionedCache; startup doesn't need a fresh copy.
1546
- let marketplaceDir;
1547
- try {
1548
- marketplaceDir = (await stat(marketplaceInstallLocation)).isDirectory()
1549
- ? marketplaceInstallLocation
1550
- : join(marketplaceInstallLocation, '..');
1551
- }
1552
- catch {
1553
- errorsOut.push({
1554
- type: 'plugin-cache-miss',
1555
- source: pluginId,
1556
- plugin: entry.name,
1557
- installPath: marketplaceInstallLocation,
1558
- });
1559
- return null;
1560
- }
1561
- pluginPath = join(marketplaceDir, entry.source);
1562
- // finishLoadingPluginFromPath reads pluginPath — its error handling
1563
- // surfaces ENOENT as a load failure, no need to pre-check here.
1564
- }
1565
- else {
1566
- // External source (npm/github/url/git-subdir) — use recorded installPath.
1567
- if (!installPath || !(await pathExists(installPath))) {
1568
- errorsOut.push({
1569
- type: 'plugin-cache-miss',
1570
- source: pluginId,
1571
- plugin: entry.name,
1572
- installPath: installPath ?? '(not recorded)',
1573
- });
1574
- return null;
1575
- }
1576
- pluginPath = installPath;
1577
- }
1578
- // Zip cache extraction — must still happen in cacheOnly mode (invariant 4)
1579
- if (isPluginZipCacheEnabled() && pluginPath.endsWith('.zip')) {
1580
- const sessionDir = await getSessionPluginCachePath();
1581
- const extractDir = join(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, '-'));
1582
- try {
1583
- await extractZipToDirectory(pluginPath, extractDir);
1584
- pluginPath = extractDir;
1585
- }
1586
- catch (error) {
1587
- logForDebugging(`Failed to extract plugin ZIP ${pluginPath}: ${error}`, {
1588
- level: 'error',
1589
- });
1590
- errorsOut.push({
1591
- type: 'plugin-cache-miss',
1592
- source: pluginId,
1593
- plugin: entry.name,
1594
- installPath: pluginPath,
1595
- });
1596
- return null;
1597
- }
1598
- }
1599
- // Delegate to the shared tail — identical to the full loader from here
1600
- return finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath);
1601
- }
1602
- /**
1603
- * Load a plugin from a marketplace entry based on its source configuration.
1604
- *
1605
- * Handles different source types:
1606
- * - Relative path: Loads from marketplace repo directory
1607
- * - npm/github/url: Caches then loads from cache
1608
- *
1609
- * @param installedVersion - Version from installed_plugins.json, used as a
1610
- * first-pass hint for the versioned cache lookup when the marketplace entry
1611
- * omits `version`. Avoids re-cloning external plugins just to discover the
1612
- * version we already recorded at install time.
1613
- *
1614
- * Returns both the loaded plugin and any errors encountered during loading.
1615
- * Errors include missing component files and hook load failures.
1616
- */
1617
- async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation, pluginId, enabled, errorsOut, installedVersion) {
1618
- logForDebugging(`Loading plugin ${entry.name} from source: ${jsonStringify(entry.source)}`);
1619
- let pluginPath;
1620
- if (typeof entry.source === 'string') {
1621
- // Relative path - resolve relative to marketplace install location
1622
- const marketplaceDir = (await stat(marketplaceInstallLocation)).isDirectory()
1623
- ? marketplaceInstallLocation
1624
- : join(marketplaceInstallLocation, '..');
1625
- const sourcePluginPath = join(marketplaceDir, entry.source);
1626
- if (!(await pathExists(sourcePluginPath))) {
1627
- const error = new Error(`Plugin path not found: ${sourcePluginPath}`);
1628
- logForDebugging(`Plugin path not found: ${sourcePluginPath}`, {
1629
- level: 'error',
1630
- });
1631
- logError(error);
1632
- errorsOut.push({
1633
- type: 'generic-error',
1634
- source: pluginId,
1635
- error: `Plugin directory not found at path: ${sourcePluginPath}. Check that the marketplace entry has the correct path.`,
1636
- });
1637
- return null;
1638
- }
1639
- // Always copy local plugins to versioned cache
1640
- try {
1641
- // Try to load manifest from plugin directory to check for version field first
1642
- const manifestPath = join(sourcePluginPath, '.claude-plugin', 'plugin.json');
1643
- let pluginManifest;
1644
- try {
1645
- pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
1646
- }
1647
- catch {
1648
- // Manifest loading failed - will fall back to provided version or git SHA
1649
- }
1650
- // Calculate version with fallback order:
1651
- // 1. Plugin manifest version, 2. Marketplace entry version, 3. Git SHA, 4. 'unknown'
1652
- const version = await calculatePluginVersion(pluginId, entry.source, pluginManifest, marketplaceDir, entry.version);
1653
- // Copy to versioned cache
1654
- pluginPath = await copyPluginToVersionedCache(sourcePluginPath, pluginId, version, entry, marketplaceDir);
1655
- logForDebugging(`Resolved local plugin ${entry.name} to versioned cache: ${pluginPath}`);
1656
- }
1657
- catch (error) {
1658
- // If copy fails, fall back to loading from marketplace directly
1659
- const errorMsg = errorMessage(error);
1660
- logForDebugging(`Failed to copy plugin ${entry.name} to versioned cache: ${errorMsg}. Using marketplace path.`, { level: 'warn' });
1661
- pluginPath = sourcePluginPath;
1662
- }
1663
- }
1664
- else {
1665
- // External source (npm, github, url, pip) - always use versioned cache
1666
- try {
1667
- // Calculate version with fallback order:
1668
- // 1. No manifest yet, 2. installed_plugins.json version,
1669
- // 3. Marketplace entry version, 4. source.sha (pinned commits — the
1670
- // exact value the post-clone call at cached.gitCommitSha would see),
1671
- // 5. 'unknown' → ref-tracked, falls through to clone by design.
1672
- const version = await calculatePluginVersion(pluginId, entry.source, undefined, undefined, installedVersion ?? entry.version, 'sha' in entry.source ? entry.source.sha : undefined);
1673
- const versionedPath = getVersionedCachePath(pluginId, version);
1674
- // Check for cached version — ZIP file (zip cache mode) or directory
1675
- const zipPath = getVersionedZipCachePath(pluginId, version);
1676
- if (isPluginZipCacheEnabled() && (await pathExists(zipPath))) {
1677
- logForDebugging(`Using versioned cached plugin ZIP ${entry.name} from ${zipPath}`);
1678
- pluginPath = zipPath;
1679
- }
1680
- else if (await pathExists(versionedPath)) {
1681
- logForDebugging(`Using versioned cached plugin ${entry.name} from ${versionedPath}`);
1682
- pluginPath = versionedPath;
1683
- }
1684
- else {
1685
- // Seed cache probe (CCR pre-baked images, read-only). Seed content is
1686
- // frozen at image build time — no freshness concern, 'whatever's there'
1687
- // is what the image builder put there. Primary cache is NOT probed
1688
- // here; ref-tracked sources fall through to clone (the re-clone IS
1689
- // the freshness mechanism). If the clone fails, the plugin is simply
1690
- // disabled for this session — errorsOut.push below surfaces it.
1691
- const seedPath = (await probeSeedCache(pluginId, version)) ??
1692
- (version === 'unknown'
1693
- ? await probeSeedCacheAnyVersion(pluginId)
1694
- : null);
1695
- if (seedPath) {
1696
- pluginPath = seedPath;
1697
- logForDebugging(`Using seed cache for external plugin ${entry.name} at ${seedPath}`);
1698
- }
1699
- else {
1700
- // Download to temp location, then copy to versioned cache
1701
- const cached = await cachePlugin(entry.source, {
1702
- manifest: { name: entry.name },
1703
- });
1704
- // If the pre-clone version was deterministic (source.sha /
1705
- // entry.version / installedVersion), REUSE it. The post-clone
1706
- // recomputation with cached.manifest can return a DIFFERENT value
1707
- // — manifest.version (step 1) outranks gitCommitSha (step 3) —
1708
- // which would cache at e.g. "2.0.0/" while every warm start
1709
- // probes "{sha12}-{hash}/". Mismatched keys = re-clone forever.
1710
- // Recomputation is only needed when pre-clone was 'unknown'
1711
- // (ref-tracked, no hints) — the clone is the ONLY way to learn.
1712
- const actualVersion = version !== 'unknown'
1713
- ? version
1714
- : await calculatePluginVersion(pluginId, entry.source, cached.manifest, cached.path, installedVersion ?? entry.version, cached.gitCommitSha);
1715
- // Copy to versioned cache
1716
- // For external sources, marketplaceDir is not applicable (already downloaded)
1717
- pluginPath = await copyPluginToVersionedCache(cached.path, pluginId, actualVersion, entry, undefined);
1718
- // Clean up temp path
1719
- if (cached.path !== pluginPath) {
1720
- await rm(cached.path, { recursive: true, force: true });
1721
- }
1722
- }
1723
- }
1724
- }
1725
- catch (error) {
1726
- const errorMsg = errorMessage(error);
1727
- logForDebugging(`Failed to cache plugin ${entry.name}: ${errorMsg}`, {
1728
- level: 'error',
1729
- });
1730
- logError(toError(error));
1731
- errorsOut.push({
1732
- type: 'generic-error',
1733
- source: pluginId,
1734
- error: `Failed to download/cache plugin ${entry.name}: ${errorMsg}`,
1735
- });
1736
- return null;
1737
- }
1738
- }
1739
- // Zip cache mode: extract ZIP to session temp dir before loading
1740
- if (isPluginZipCacheEnabled() && pluginPath.endsWith('.zip')) {
1741
- const sessionDir = await getSessionPluginCachePath();
1742
- const extractDir = join(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, '-'));
1743
- try {
1744
- await extractZipToDirectory(pluginPath, extractDir);
1745
- logForDebugging(`Extracted plugin ZIP to session dir: ${extractDir}`);
1746
- pluginPath = extractDir;
1747
- }
1748
- catch (error) {
1749
- // Corrupt ZIP: delete it so next install attempt re-creates it
1750
- logForDebugging(`Failed to extract plugin ZIP ${pluginPath}, deleting corrupt file: ${error}`);
1751
- await rm(pluginPath, { force: true }).catch(() => { });
1752
- throw error;
1753
- }
1754
- }
1755
- return finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath);
1756
- }
1757
- /**
1758
- * Shared tail of both loadPluginFromMarketplaceEntry variants.
1759
- *
1760
- * Once pluginPath is resolved (via clone, cache, or installPath lookup),
1761
- * the rest of the load — manifest probe, createPluginFromPath, marketplace
1762
- * entry supplementation — is identical. Extracted so the cache-only path
1763
- * doesn't duplicate ~500 lines.
1764
- */
1765
- async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath) {
1766
- const errors = [];
1767
- // Check if plugin.json exists to determine if we should use marketplace manifest
1768
- const manifestPath = join(pluginPath, '.claude-plugin', 'plugin.json');
1769
- const hasManifest = await pathExists(manifestPath);
1770
- const { plugin, errors: pluginErrors } = await createPluginFromPath(pluginPath, pluginId, enabled, entry.name, entry.strict ?? true);
1771
- errors.push(...pluginErrors);
1772
- // Set sha from source if available (for github and url source types)
1773
- if (typeof entry.source === 'object' &&
1774
- 'sha' in entry.source &&
1775
- entry.source.sha) {
1776
- plugin.sha = entry.source.sha;
1777
- }
1778
- // If there's no plugin.json, use marketplace entry as manifest (regardless of strict mode)
1779
- if (!hasManifest) {
1780
- plugin.manifest = {
1781
- ...entry,
1782
- id: undefined,
1783
- source: undefined,
1784
- strict: undefined,
1785
- };
1786
- plugin.name = plugin.manifest.name;
1787
- // Process commands from marketplace entry
1788
- if (entry.commands) {
1789
- // Check if it's an object mapping
1790
- const firstValue = Object.values(entry.commands)[0];
1791
- if (typeof entry.commands === 'object' &&
1792
- !Array.isArray(entry.commands) &&
1793
- firstValue &&
1794
- typeof firstValue === 'object' &&
1795
- ('source' in firstValue || 'content' in firstValue)) {
1796
- // Object mapping format
1797
- const commandsMetadata = {};
1798
- const validPaths = [];
1799
- // Parallelize pathExists checks; process results in order.
1800
- const entries = Object.entries(entry.commands);
1801
- const checks = await Promise.all(entries.map(async ([commandName, metadata]) => {
1802
- if (!metadata || typeof metadata !== 'object' || !metadata.source) {
1803
- return { commandName, metadata, skip: true };
1804
- }
1805
- const fullPath = join(pluginPath, metadata.source);
1806
- return {
1807
- commandName,
1808
- metadata,
1809
- skip: false,
1810
- fullPath,
1811
- exists: await pathExists(fullPath),
1812
- };
1813
- }));
1814
- for (const check of checks) {
1815
- if (check.skip)
1816
- continue;
1817
- if (check.exists) {
1818
- validPaths.push(check.fullPath);
1819
- commandsMetadata[check.commandName] = check.metadata;
1820
- }
1821
- else {
1822
- logForDebugging(`Command ${check.commandName} path ${check.metadata.source} from marketplace entry not found at ${check.fullPath} for ${entry.name}`, { level: 'warn' });
1823
- logError(new Error(`Plugin component file not found: ${check.fullPath} for ${entry.name}`));
1824
- errors.push({
1825
- type: 'path-not-found',
1826
- source: pluginId,
1827
- plugin: entry.name,
1828
- path: check.fullPath,
1829
- component: 'commands',
1830
- });
1831
- }
1832
- }
1833
- if (validPaths.length > 0) {
1834
- plugin.commandsPaths = validPaths;
1835
- plugin.commandsMetadata = commandsMetadata;
1836
- }
1837
- }
1838
- else {
1839
- // Path or array of paths format
1840
- const commandPaths = Array.isArray(entry.commands)
1841
- ? entry.commands
1842
- : [entry.commands];
1843
- // Parallelize pathExists checks; process results in order.
1844
- const checks = await Promise.all(commandPaths.map(async (cmdPath) => {
1845
- if (typeof cmdPath !== 'string') {
1846
- return { cmdPath, kind: 'invalid' };
1847
- }
1848
- const fullPath = join(pluginPath, cmdPath);
1849
- return {
1850
- cmdPath,
1851
- kind: 'path',
1852
- fullPath,
1853
- exists: await pathExists(fullPath),
1854
- };
1855
- }));
1856
- const validPaths = [];
1857
- for (const check of checks) {
1858
- if (check.kind === 'invalid') {
1859
- logForDebugging(`Unexpected command format in marketplace entry for ${entry.name}`, { level: 'error' });
1860
- continue;
1861
- }
1862
- if (check.exists) {
1863
- validPaths.push(check.fullPath);
1864
- }
1865
- else {
1866
- logForDebugging(`Command path ${check.cmdPath} from marketplace entry not found at ${check.fullPath} for ${entry.name}`, { level: 'warn' });
1867
- logError(new Error(`Plugin component file not found: ${check.fullPath} for ${entry.name}`));
1868
- errors.push({
1869
- type: 'path-not-found',
1870
- source: pluginId,
1871
- plugin: entry.name,
1872
- path: check.fullPath,
1873
- component: 'commands',
1874
- });
1875
- }
1876
- }
1877
- if (validPaths.length > 0) {
1878
- plugin.commandsPaths = validPaths;
1879
- }
1880
- }
1881
- }
1882
- // Process agents from marketplace entry
1883
- if (entry.agents) {
1884
- const agentPaths = Array.isArray(entry.agents)
1885
- ? entry.agents
1886
- : [entry.agents];
1887
- const validPaths = await validatePluginPaths(agentPaths, pluginPath, entry.name, pluginId, 'agents', 'Agent', 'from marketplace entry', errors);
1888
- if (validPaths.length > 0) {
1889
- plugin.agentsPaths = validPaths;
1890
- }
1891
- }
1892
- // Process skills from marketplace entry
1893
- if (entry.skills) {
1894
- logForDebugging(`Processing ${Array.isArray(entry.skills) ? entry.skills.length : 1} skill paths for plugin ${entry.name}`);
1895
- const skillPaths = Array.isArray(entry.skills)
1896
- ? entry.skills
1897
- : [entry.skills];
1898
- // Parallelize pathExists checks; process results in order.
1899
- // Note: previously this loop called pathExists() TWICE per iteration
1900
- // (once in a debug log template, once in the if) — now called once.
1901
- const checks = await Promise.all(skillPaths.map(async (skillPath) => {
1902
- const fullPath = join(pluginPath, skillPath);
1903
- return { skillPath, fullPath, exists: await pathExists(fullPath) };
1904
- }));
1905
- const validPaths = [];
1906
- for (const { skillPath, fullPath, exists } of checks) {
1907
- logForDebugging(`Checking skill path: ${skillPath} -> ${fullPath} (exists: ${exists})`);
1908
- if (exists) {
1909
- validPaths.push(fullPath);
1910
- }
1911
- else {
1912
- logForDebugging(`Skill path ${skillPath} from marketplace entry not found at ${fullPath} for ${entry.name}`, { level: 'warn' });
1913
- logError(new Error(`Plugin component file not found: ${fullPath} for ${entry.name}`));
1914
- errors.push({
1915
- type: 'path-not-found',
1916
- source: pluginId,
1917
- plugin: entry.name,
1918
- path: fullPath,
1919
- component: 'skills',
1920
- });
1921
- }
1922
- }
1923
- logForDebugging(`Found ${validPaths.length} valid skill paths for plugin ${entry.name}, setting skillsPaths`);
1924
- if (validPaths.length > 0) {
1925
- plugin.skillsPaths = validPaths;
1926
- }
1927
- }
1928
- else {
1929
- logForDebugging(`Plugin ${entry.name} has no entry.skills defined`);
1930
- }
1931
- // Process output styles from marketplace entry
1932
- if (entry.outputStyles) {
1933
- const outputStylePaths = Array.isArray(entry.outputStyles)
1934
- ? entry.outputStyles
1935
- : [entry.outputStyles];
1936
- const validPaths = await validatePluginPaths(outputStylePaths, pluginPath, entry.name, pluginId, 'output-styles', 'Output style', 'from marketplace entry', errors);
1937
- if (validPaths.length > 0) {
1938
- plugin.outputStylesPaths = validPaths;
1939
- }
1940
- }
1941
- // Process inline hooks from marketplace entry
1942
- if (entry.hooks) {
1943
- plugin.hooksConfig = entry.hooks;
1944
- }
1945
- }
1946
- else if (!entry.strict &&
1947
- hasManifest &&
1948
- (entry.commands ||
1949
- entry.agents ||
1950
- entry.skills ||
1951
- entry.hooks ||
1952
- entry.outputStyles)) {
1953
- // In non-strict mode with plugin.json, marketplace entries for commands/agents/skills/hooks/outputStyles are conflicts
1954
- 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.`);
1955
- logForDebugging(`Plugin ${entry.name} has both plugin.json and marketplace manifest entries for commands/agents/skills/hooks/outputStyles. This is a conflict.`, { level: 'error' });
1956
- logError(error);
1957
- errorsOut.push({
1958
- type: 'generic-error',
1959
- source: pluginId,
1960
- 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.`,
1961
- });
1962
- return null;
1963
- }
1964
- else if (hasManifest) {
1965
- // Has plugin.json - marketplace can supplement commands/agents/skills/hooks/outputStyles
1966
- // Supplement commands from marketplace entry
1967
- if (entry.commands) {
1968
- // Check if it's an object mapping
1969
- const firstValue = Object.values(entry.commands)[0];
1970
- if (typeof entry.commands === 'object' &&
1971
- !Array.isArray(entry.commands) &&
1972
- firstValue &&
1973
- typeof firstValue === 'object' &&
1974
- ('source' in firstValue || 'content' in firstValue)) {
1975
- // Object mapping format - merge metadata
1976
- const commandsMetadata = {
1977
- ...(plugin.commandsMetadata || {}),
1978
- };
1979
- const validPaths = [];
1980
- // Parallelize pathExists checks; process results in order.
1981
- const entries = Object.entries(entry.commands);
1982
- const checks = await Promise.all(entries.map(async ([commandName, metadata]) => {
1983
- if (!metadata || typeof metadata !== 'object' || !metadata.source) {
1984
- return { commandName, metadata, skip: true };
1985
- }
1986
- const fullPath = join(pluginPath, metadata.source);
1987
- return {
1988
- commandName,
1989
- metadata,
1990
- skip: false,
1991
- fullPath,
1992
- exists: await pathExists(fullPath),
1993
- };
1994
- }));
1995
- for (const check of checks) {
1996
- if (check.skip)
1997
- continue;
1998
- if (check.exists) {
1999
- validPaths.push(check.fullPath);
2000
- commandsMetadata[check.commandName] = check.metadata;
2001
- }
2002
- else {
2003
- logForDebugging(`Command ${check.commandName} path ${check.metadata.source} from marketplace entry not found at ${check.fullPath} for ${entry.name}`, { level: 'warn' });
2004
- logError(new Error(`Plugin component file not found: ${check.fullPath} for ${entry.name}`));
2005
- errors.push({
2006
- type: 'path-not-found',
2007
- source: pluginId,
2008
- plugin: entry.name,
2009
- path: check.fullPath,
2010
- component: 'commands',
2011
- });
2012
- }
2013
- }
2014
- if (validPaths.length > 0) {
2015
- plugin.commandsPaths = [
2016
- ...(plugin.commandsPaths || []),
2017
- ...validPaths,
2018
- ];
2019
- plugin.commandsMetadata = commandsMetadata;
2020
- }
2021
- }
2022
- else {
2023
- // Path or array of paths format
2024
- const commandPaths = Array.isArray(entry.commands)
2025
- ? entry.commands
2026
- : [entry.commands];
2027
- // Parallelize pathExists checks; process results in order.
2028
- const checks = await Promise.all(commandPaths.map(async (cmdPath) => {
2029
- if (typeof cmdPath !== 'string') {
2030
- return { cmdPath, kind: 'invalid' };
2031
- }
2032
- const fullPath = join(pluginPath, cmdPath);
2033
- return {
2034
- cmdPath,
2035
- kind: 'path',
2036
- fullPath,
2037
- exists: await pathExists(fullPath),
2038
- };
2039
- }));
2040
- const validPaths = [];
2041
- for (const check of checks) {
2042
- if (check.kind === 'invalid') {
2043
- logForDebugging(`Unexpected command format in marketplace entry for ${entry.name}`, { level: 'error' });
2044
- continue;
2045
- }
2046
- if (check.exists) {
2047
- validPaths.push(check.fullPath);
2048
- }
2049
- else {
2050
- logForDebugging(`Command path ${check.cmdPath} from marketplace entry not found at ${check.fullPath} for ${entry.name}`, { level: 'warn' });
2051
- logError(new Error(`Plugin component file not found: ${check.fullPath} for ${entry.name}`));
2052
- errors.push({
2053
- type: 'path-not-found',
2054
- source: pluginId,
2055
- plugin: entry.name,
2056
- path: check.fullPath,
2057
- component: 'commands',
2058
- });
2059
- }
2060
- }
2061
- if (validPaths.length > 0) {
2062
- plugin.commandsPaths = [
2063
- ...(plugin.commandsPaths || []),
2064
- ...validPaths,
2065
- ];
2066
- }
2067
- }
2068
- }
2069
- // Supplement agents from marketplace entry
2070
- if (entry.agents) {
2071
- const agentPaths = Array.isArray(entry.agents)
2072
- ? entry.agents
2073
- : [entry.agents];
2074
- const validPaths = await validatePluginPaths(agentPaths, pluginPath, entry.name, pluginId, 'agents', 'Agent', 'from marketplace entry', errors);
2075
- if (validPaths.length > 0) {
2076
- plugin.agentsPaths = [...(plugin.agentsPaths || []), ...validPaths];
2077
- }
2078
- }
2079
- // Supplement skills from marketplace entry
2080
- if (entry.skills) {
2081
- const skillPaths = Array.isArray(entry.skills)
2082
- ? entry.skills
2083
- : [entry.skills];
2084
- const validPaths = await validatePluginPaths(skillPaths, pluginPath, entry.name, pluginId, 'skills', 'Skill', 'from marketplace entry', errors);
2085
- if (validPaths.length > 0) {
2086
- plugin.skillsPaths = [...(plugin.skillsPaths || []), ...validPaths];
2087
- }
2088
- }
2089
- // Supplement output styles from marketplace entry
2090
- if (entry.outputStyles) {
2091
- const outputStylePaths = Array.isArray(entry.outputStyles)
2092
- ? entry.outputStyles
2093
- : [entry.outputStyles];
2094
- const validPaths = await validatePluginPaths(outputStylePaths, pluginPath, entry.name, pluginId, 'output-styles', 'Output style', 'from marketplace entry', errors);
2095
- if (validPaths.length > 0) {
2096
- plugin.outputStylesPaths = [
2097
- ...(plugin.outputStylesPaths || []),
2098
- ...validPaths,
2099
- ];
2100
- }
2101
- }
2102
- // Supplement hooks from marketplace entry
2103
- if (entry.hooks) {
2104
- plugin.hooksConfig = {
2105
- ...(plugin.hooksConfig || {}),
2106
- ...entry.hooks,
2107
- };
2108
- }
2109
- }
2110
- errorsOut.push(...errors);
2111
- return plugin;
2112
- }
2113
- /**
2114
- * Load session-only plugins from --plugin-dir CLI flag.
2115
- *
2116
- * These plugins are loaded directly without going through the marketplace system.
2117
- * They appear with source='plugin-name@inline' and are always enabled for the current session.
2118
- *
2119
- * @param sessionPluginPaths - Array of plugin directory paths from CLI
2120
- * @returns LoadedPlugin objects and any errors encountered
2121
- */
2122
- async function loadSessionOnlyPlugins(sessionPluginPaths) {
2123
- if (sessionPluginPaths.length === 0) {
2124
- return { plugins: [], errors: [] };
2125
- }
2126
- const plugins = [];
2127
- const errors = [];
2128
- for (const [index, pluginPath] of sessionPluginPaths.entries()) {
2129
- try {
2130
- const resolvedPath = resolve(pluginPath);
2131
- if (!(await pathExists(resolvedPath))) {
2132
- logForDebugging(`Plugin path does not exist: ${resolvedPath}, skipping`, { level: 'warn' });
2133
- errors.push({
2134
- type: 'path-not-found',
2135
- source: `inline[${index}]`,
2136
- path: resolvedPath,
2137
- component: 'commands',
2138
- });
2139
- continue;
2140
- }
2141
- const dirName = basename(resolvedPath);
2142
- const { plugin, errors: pluginErrors } = await createPluginFromPath(resolvedPath, `${dirName}@inline`, // temporary, will be updated after we know the real name
2143
- true, // always enabled
2144
- dirName);
2145
- // Update source to use the actual plugin name from manifest
2146
- plugin.source = `${plugin.name}@inline`;
2147
- plugin.repository = `${plugin.name}@inline`;
2148
- plugins.push(plugin);
2149
- errors.push(...pluginErrors);
2150
- logForDebugging(`Loaded inline plugin from path: ${plugin.name}`);
2151
- }
2152
- catch (error) {
2153
- const errorMsg = errorMessage(error);
2154
- logForDebugging(`Failed to load session plugin from ${pluginPath}: ${errorMsg}`, { level: 'warn' });
2155
- errors.push({
2156
- type: 'generic-error',
2157
- source: `inline[${index}]`,
2158
- error: `Failed to load plugin: ${errorMsg}`,
2159
- });
2160
- }
2161
- }
2162
- if (plugins.length > 0) {
2163
- logForDebugging(`Loaded ${plugins.length} session-only plugins from --plugin-dir`);
2164
- }
2165
- return { plugins, errors };
2166
- }
2167
- /**
2168
- * Merge plugins from session (--plugin-dir), marketplace (installed), and
2169
- * builtin sources. Session plugins override marketplace plugins with the
2170
- * same name — the user explicitly pointed at a directory for this session.
2171
- *
2172
- * Exception: marketplace plugins locked by managed settings (policySettings)
2173
- * cannot be overridden. Enterprise admin intent beats local dev convenience.
2174
- * When a session plugin collides with a managed one, the session copy is
2175
- * dropped and an error is returned for surfacing.
2176
- *
2177
- * Without this dedup, both versions sat in the array and marketplace won
2178
- * on first-match, making --plugin-dir useless for iterating on an
2179
- * installed plugin.
2180
- */
2181
- export function mergePluginSources(sources) {
2182
- const errors = [];
2183
- const managed = sources.managedNames;
2184
- // Managed settings win over --plugin-dir. Drop session plugins whose
2185
- // name appears in policySettings.enabledPlugins (whether force-enabled
2186
- // OR force-disabled — both are admin intent that --plugin-dir must not
2187
- // bypass). Surface an error so the user knows why their dev copy was
2188
- // ignored.
2189
- //
2190
- // NOTE: managedNames contains the pluginId prefix (entry.name), which is
2191
- // expected to equal manifest.name by convention (schema description at
2192
- // schemas.ts PluginMarketplaceEntry.name). If a marketplace publishes a
2193
- // plugin where entry.name ≠ manifest.name, this guard will silently miss —
2194
- // but that's a marketplace misconfiguration that breaks other things too
2195
- // (e.g., ManagePlugins constructs pluginIds from manifest.name).
2196
- const sessionPlugins = sources.session.filter(p => {
2197
- if (managed?.has(p.name)) {
2198
- logForDebugging(`Plugin "${p.name}" from --plugin-dir is blocked by managed settings`, { level: 'warn' });
2199
- errors.push({
2200
- type: 'generic-error',
2201
- source: p.source,
2202
- plugin: p.name,
2203
- error: `--plugin-dir copy of "${p.name}" ignored: plugin is locked by managed settings`,
2204
- });
2205
- return false;
2206
- }
2207
- return true;
2208
- });
2209
- const sessionNames = new Set(sessionPlugins.map(p => p.name));
2210
- const marketplacePlugins = sources.marketplace.filter(p => {
2211
- if (sessionNames.has(p.name)) {
2212
- logForDebugging(`Plugin "${p.name}" from --plugin-dir overrides installed version`);
2213
- return false;
2214
- }
2215
- return true;
2216
- });
2217
- // Session first, then non-overridden marketplace, then builtin.
2218
- // Downstream first-match consumers see session plugins before
2219
- // installed ones for any that slipped past the name filter.
2220
- return {
2221
- plugins: [...sessionPlugins, ...marketplacePlugins, ...sources.builtin],
2222
- errors,
2223
- };
2224
- }
2225
- /**
2226
- * Main plugin loading function that discovers and loads all plugins.
2227
- *
2228
- * This function is memoized to avoid repeated filesystem scanning and is
2229
- * the primary entry point for the plugin system. It discovers plugins from
2230
- * multiple sources and returns categorized results.
2231
- *
2232
- * Loading order and precedence (see mergePluginSources):
2233
- * 1. Session-only plugins (from --plugin-dir CLI flag) — override
2234
- * installed plugins with the same name, UNLESS that plugin is
2235
- * locked by managed settings (policySettings, either force-enabled
2236
- * or force-disabled)
2237
- * 2. Marketplace-based plugins (plugin@marketplace format from settings)
2238
- * 3. Built-in plugins shipped with the CLI
2239
- *
2240
- * Name collision: session plugin wins over installed. The user explicitly
2241
- * pointed at a directory for this session — that intent beats whatever
2242
- * is installed. Exception: managed settings (enterprise policy) win over
2243
- * --plugin-dir. Admin intent beats local dev convenience.
2244
- *
2245
- * Error collection:
2246
- * - Non-fatal errors are collected and returned
2247
- * - System continues loading other plugins on errors
2248
- * - Errors include source information for debugging
2249
- *
2250
- * @returns Promise resolving to categorized plugin results:
2251
- * - enabled: Array of enabled LoadedPlugin objects
2252
- * - disabled: Array of disabled LoadedPlugin objects
2253
- * - errors: Array of loading errors with source information
2254
- */
2255
- export const loadAllPlugins = memoize(async () => {
2256
- const result = await assemblePluginLoadResult(() => loadPluginsFromMarketplaces({ cacheOnly: false }));
2257
- // A fresh full-load result is strictly valid for cache-only callers
2258
- // (both variants share assemblePluginLoadResult). Warm the separate
2259
- // memoize so refreshActivePlugins()'s downstream getPluginCommands() /
2260
- // getAgentDefinitionsWithOverrides() — which now call
2261
- // loadAllPluginsCacheOnly — see just-cloned plugins instead of reading
2262
- // an installed_plugins.json that nothing writes mid-session.
2263
- loadAllPluginsCacheOnly.cache?.set(undefined, Promise.resolve(result));
2264
- return result;
2265
- });
2266
- /**
2267
- * Cache-only variant of loadAllPlugins.
2268
- *
2269
- * Same merge/dependency/settings logic, but the marketplace loader never
2270
- * hits the network (no cachePlugin, no copyPluginToVersionedCache). Reads
2271
- * from installed_plugins.json's installPath. Plugins not on disk emit
2272
- * 'plugin-cache-miss' and are skipped.
2273
- *
2274
- * Use this in startup consumers (getCommands, loadPluginAgents, MCP/LSP
2275
- * config) so interactive startup never blocks on git clones for ref-tracked
2276
- * plugins. Use loadAllPlugins() in explicit refresh paths (/plugins,
2277
- * refresh.ts, headlessPluginInstall) where fresh source is the intent.
2278
- *
2279
- * CLAUDE_CODE_SYNC_PLUGIN_INSTALL=1 delegates to the full loader — that
2280
- * mode explicitly opts into blocking install before first query, and
2281
- * main.tsx's getClaudeCodeMcpConfigs()/getInitialSettings().agent run
2282
- * BEFORE runHeadless() can warm this cache. First-run CCR/headless has
2283
- * no installed_plugins.json, so cache-only would miss plugin MCP servers
2284
- * and plugin settings (the agent key). The interactive startup win is
2285
- * preserved since interactive mode doesn't set SYNC_PLUGIN_INSTALL.
2286
- *
2287
- * Separate memoize cache from loadAllPlugins — a cache-only result must
2288
- * never satisfy a caller that wants fresh source. The reverse IS valid:
2289
- * loadAllPlugins warms this cache on completion so refresh paths that run
2290
- * the full loader don't get plugin-cache-miss from their downstream
2291
- * cache-only consumers.
2292
- */
2293
- export const loadAllPluginsCacheOnly = memoize(async () => {
2294
- if (isEnvTruthy(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)) {
2295
- return loadAllPlugins();
2296
- }
2297
- return assemblePluginLoadResult(() => loadPluginsFromMarketplaces({ cacheOnly: true }));
2298
- });
2299
- /**
2300
- * Shared body of loadAllPlugins and loadAllPluginsCacheOnly.
2301
- *
2302
- * The only difference between the two is which marketplace loader runs —
2303
- * session plugins, builtins, merge, verifyAndDemote, and cachePluginSettings
2304
- * are identical (invariants 1-3).
2305
- */
2306
- async function assemblePluginLoadResult(marketplaceLoader) {
2307
- // Load marketplace plugins and session-only plugins in parallel.
2308
- // getInlinePlugins() is a synchronous state read with no dependency on
2309
- // marketplace loading, so these two sources can be fetched concurrently.
2310
- const inlinePlugins = getInlinePlugins();
2311
- const [marketplaceResult, sessionResult] = await Promise.all([
2312
- marketplaceLoader(),
2313
- inlinePlugins.length > 0
2314
- ? loadSessionOnlyPlugins(inlinePlugins)
2315
- : Promise.resolve({ plugins: [], errors: [] }),
2316
- ]);
2317
- // 3. Load built-in plugins that ship with the CLI
2318
- const builtinResult = getBuiltinPlugins();
2319
- // Session plugins (--plugin-dir) override installed ones by name,
2320
- // UNLESS the installed plugin is locked by managed settings
2321
- // (policySettings). See mergePluginSources() for details.
2322
- const { plugins: allPlugins, errors: mergeErrors } = mergePluginSources({
2323
- session: sessionResult.plugins,
2324
- marketplace: marketplaceResult.plugins,
2325
- builtin: [...builtinResult.enabled, ...builtinResult.disabled],
2326
- managedNames: getManagedPluginNames(),
2327
- });
2328
- const allErrors = [
2329
- ...marketplaceResult.errors,
2330
- ...sessionResult.errors,
2331
- ...mergeErrors,
2332
- ];
2333
- // Verify dependencies. Runs AFTER the parallel load — deps are presence
2334
- // checks, not load-order, so no topological sort needed. Demotion is
2335
- // session-local: does NOT write settings (user fixes intent via /doctor).
2336
- const { demoted, errors: depErrors } = verifyAndDemote(allPlugins);
2337
- for (const p of allPlugins) {
2338
- if (demoted.has(p.source))
2339
- p.enabled = false;
2340
- }
2341
- allErrors.push(...depErrors);
2342
- const enabledPlugins = allPlugins.filter(p => p.enabled);
2343
- logForDebugging(`Found ${allPlugins.length} plugins (${enabledPlugins.length} enabled, ${allPlugins.length - enabledPlugins.length} disabled)`);
2344
- // 3. Cache plugin settings for synchronous access by the settings cascade
2345
- cachePluginSettings(enabledPlugins);
2346
- return {
2347
- enabled: enabledPlugins,
2348
- disabled: allPlugins.filter(p => !p.enabled),
2349
- errors: allErrors,
2350
- };
2351
- }
2352
- /**
2353
- * Clears the memoized plugin cache.
2354
- *
2355
- * Call this when plugins are installed, removed, or settings change
2356
- * to force a fresh scan on the next loadAllPlugins call.
2357
- *
2358
- * Use cases:
2359
- * - After installing/uninstalling plugins
2360
- * - After modifying .claude-plugin/ directory (for export)
2361
- * - After changing enabledPlugins settings
2362
- * - When debugging plugin loading issues
2363
- */
2364
- export function clearPluginCache(reason) {
2365
- if (reason) {
2366
- logForDebugging(`clearPluginCache: invalidating loadAllPlugins cache (${reason})`);
2367
- }
2368
- loadAllPlugins.cache?.clear?.();
2369
- loadAllPluginsCacheOnly.cache?.clear?.();
2370
- // If a plugin previously contributed settings, the session settings cache
2371
- // holds a merged result that includes them. cachePluginSettings() on reload
2372
- // won't bust the cache when the new base is empty (the startup perf win),
2373
- // so bust it here to drop stale plugin overrides. When the base is already
2374
- // undefined (startup, or no prior plugin settings) this is a no-op.
2375
- if (getPluginSettingsBase() !== undefined) {
2376
- resetSettingsCache();
2377
- }
2378
- clearPluginSettingsBase();
2379
- // TODO: Clear installed plugins cache when installedPluginsManager is implemented
2380
- }
2381
- /**
2382
- * Merge settings from all enabled plugins into a single record.
2383
- * Later plugins override earlier ones for the same key.
2384
- * Only allowlisted keys are included (filtering happens at load time).
2385
- */
2386
- function mergePluginSettings(plugins) {
2387
- let merged;
2388
- for (const plugin of plugins) {
2389
- if (!plugin.settings) {
2390
- continue;
2391
- }
2392
- if (!merged) {
2393
- merged = {};
2394
- }
2395
- for (const [key, value] of Object.entries(plugin.settings)) {
2396
- if (key in merged) {
2397
- logForDebugging(`Plugin "${plugin.name}" overrides setting "${key}" (previously set by another plugin)`);
2398
- }
2399
- merged[key] = value;
2400
- }
2401
- }
2402
- return merged;
2403
- }
2404
- /**
2405
- * Store merged plugin settings in the synchronous cache.
2406
- * Called after loadAllPlugins resolves.
2407
- */
2408
- export function cachePluginSettings(plugins) {
2409
- const settings = mergePluginSettings(plugins);
2410
- setPluginSettingsBase(settings);
2411
- // Only bust the session settings cache if there are actually plugin settings
2412
- // to merge. In the common case (no plugins, or plugins without settings) the
2413
- // base layer is empty and loadSettingsFromDisk would produce the same result
2414
- // anyway — resetting here would waste ~17ms on startup re-reading and
2415
- // re-validating every settings file on the next getSettingsWithErrors() call.
2416
- if (settings && Object.keys(settings).length > 0) {
2417
- resetSettingsCache();
2418
- logForDebugging(`Cached plugin settings with keys: ${Object.keys(settings).join(', ')}`);
2419
- }
2420
- }
2421
- /**
2422
- * Type predicate: check if a value is a non-null, non-array object (i.e., a record).
2423
- */
2424
- function isRecord(value) {
2425
- return typeof value === 'object' && value !== null && !Array.isArray(value);
2426
- }