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