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