thaddeus 1.0.18 → 1.0.27
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/package.json +14 -5
- package/src/QueryEngine.js +926 -0
- package/src/Task.js +49 -0
- package/src/Tool.js +61 -0
- package/src/assistant/gate.js +5 -0
- package/src/assistant/index.js +106 -0
- package/src/assistant/sessionHistory.js +145 -0
- package/src/bootstrap/state.js +1163 -0
- package/src/bridge/bridgeApi.js +304 -0
- package/src/bridge/bridgeConfig.js +39 -0
- package/src/bridge/bridgeDebug.js +73 -0
- package/src/bridge/bridgeEnabled.js +185 -0
- package/src/bridge/bridgeMain.js +2289 -0
- package/src/bridge/bridgeMessaging.js +353 -0
- package/src/bridge/bridgePermissionCallbacks.js +10 -0
- package/src/bridge/bridgePointer.js +175 -0
- package/src/bridge/bridgeStatusUtil.js +105 -0
- package/src/bridge/bridgeUI.js +411 -0
- package/src/bridge/capacityWake.js +35 -0
- package/src/bridge/codeSessionApi.js +111 -0
- package/src/bridge/createSession.js +273 -0
- package/src/bridge/debugUtils.js +115 -0
- package/src/bridge/envLessBridgeConfig.js +120 -0
- package/src/bridge/flushGate.js +65 -0
- package/src/bridge/inboundAttachments.js +152 -0
- package/src/bridge/inboundMessages.js +63 -0
- package/src/bridge/initReplBridge.js +431 -0
- package/src/bridge/jwtUtils.js +185 -0
- package/src/bridge/peerSessions.js +5 -0
- package/src/bridge/pollConfig.js +85 -0
- package/src/bridge/pollConfigDefaults.js +62 -0
- package/src/bridge/remoteBridgeCore.js +712 -0
- package/src/bridge/replBridge.js +1719 -0
- package/src/bridge/replBridgeHandle.js +30 -0
- package/src/bridge/replBridgeTransport.js +236 -0
- package/src/bridge/sessionIdCompat.js +56 -0
- package/src/bridge/sessionRunner.js +421 -0
- package/src/bridge/trustedDevice.js +170 -0
- package/src/bridge/types.js +9 -0
- package/src/bridge/webhookSanitizer.js +6 -0
- package/src/bridge/workSecret.js +99 -0
- package/src/buddy/CompanionSprite.js +348 -0
- package/src/buddy/companion.js +107 -0
- package/src/buddy/prompt.js +33 -0
- package/src/buddy/sprites.js +488 -0
- package/src/buddy/types.js +90 -0
- package/src/buddy/useBuddyNotification.js +85 -0
- package/src/cli/bg.js +17 -0
- package/src/cli/exit.js +30 -0
- package/src/cli/handlers/agents.js +55 -0
- package/src/cli/handlers/auth.js +249 -0
- package/src/cli/handlers/autoMode.js +128 -0
- package/src/cli/handlers/mcp.js +335 -0
- package/src/cli/handlers/plugins.js +634 -0
- package/src/cli/handlers/templateJobs.js +19 -0
- package/src/cli/handlers/util.js +76 -0
- package/src/cli/ndjsonSafeStringify.js +27 -0
- package/src/cli/print.js +4294 -0
- package/src/cli/remoteIO.js +208 -0
- package/src/cli/structuredIO.js +644 -0
- package/src/cli/transports/HybridTransport.js +233 -0
- package/src/cli/transports/SSETransport.js +538 -0
- package/src/cli/transports/SerialBatchEventUploader.js +224 -0
- package/src/cli/transports/WebSocketTransport.js +613 -0
- package/src/cli/transports/WorkerStateUploader.js +88 -0
- package/src/cli/transports/ccrClient.js +711 -0
- package/src/cli/transports/transportUtils.js +39 -0
- package/src/cli/update.js +314 -0
- package/src/commandCenter/launch.js +39 -0
- package/src/commandCenter/phoneApi.js +168 -0
- package/src/commandCenter/phoneStore.js +159 -0
- package/src/commandCenter/reactorBus.js +130 -0
- package/src/commandCenter/server.js +288 -0
- package/src/commandCenter/server.ts +42 -7
- package/src/commandCenter/tunnel.js +199 -0
- package/src/commands/add-dir/add-dir.js +121 -0
- package/src/commands/add-dir/index.js +8 -0
- package/src/commands/add-dir/validation.js +76 -0
- package/src/commands/advisor.js +88 -0
- package/src/commands/agents/agents.js +10 -0
- package/src/commands/agents/index.js +7 -0
- package/src/commands/agents-platform/index.js +2 -0
- package/src/commands/assistant/index.js +86 -0
- package/src/commands/backup/index.js +31 -0
- package/src/commands/branch/branch.js +205 -0
- package/src/commands/branch/index.js +11 -0
- package/src/commands/bridge/bridge.js +513 -0
- package/src/commands/bridge/index.js +22 -0
- package/src/commands/bridge-kick.js +179 -0
- package/src/commands/brief.js +89 -0
- package/src/commands/btw/btw.js +235 -0
- package/src/commands/btw/index.js +9 -0
- package/src/commands/buddy/buddy.js +100 -0
- package/src/commands/buddy/index.js +11 -0
- package/src/commands/chrome/chrome.js +291 -0
- package/src/commands/chrome/index.js +10 -0
- package/src/commands/clear/caches.js +116 -0
- package/src/commands/clear/clear.js +5 -0
- package/src/commands/clear/conversation.js +189 -0
- package/src/commands/clear/index.js +9 -0
- package/src/commands/color/color.js +58 -0
- package/src/commands/color/index.js +9 -0
- package/src/commands/commit-push-pr.js +137 -0
- package/src/commands/commit.js +80 -0
- package/src/commands/compact/compact.js +194 -0
- package/src/commands/compact/index.js +11 -0
- package/src/commands/config/config.js +6 -0
- package/src/commands/config/index.js +8 -0
- package/src/commands/context/context-noninteractive.js +219 -0
- package/src/commands/context/context.js +45 -0
- package/src/commands/context/index.js +21 -0
- package/src/commands/coordinator.js +34 -0
- package/src/commands/copy/copy.js +366 -0
- package/src/commands/copy/index.js +7 -0
- package/src/commands/cost/cost.js +21 -0
- package/src/commands/cost/index.js +16 -0
- package/src/commands/createMovedToPluginCommand.js +33 -0
- package/src/commands/desktop/desktop.js +6 -0
- package/src/commands/desktop/index.js +22 -0
- package/src/commands/diff/diff.js +6 -0
- package/src/commands/diff/index.js +6 -0
- package/src/commands/doctor/doctor.js +6 -0
- package/src/commands/doctor/index.js +9 -0
- package/src/commands/effort/effort.js +166 -0
- package/src/commands/effort/index.js +11 -0
- package/src/commands/exit/exit.js +32 -0
- package/src/commands/exit/index.js +9 -0
- package/src/commands/export/export.js +87 -0
- package/src/commands/export/index.js +8 -0
- package/src/commands/extra-usage/extra-usage-core.js +99 -0
- package/src/commands/extra-usage/extra-usage-noninteractive.js +13 -0
- package/src/commands/extra-usage/extra-usage.js +15 -0
- package/src/commands/extra-usage/index.js +29 -0
- package/src/commands/fast/fast.js +276 -0
- package/src/commands/fast/index.js +19 -0
- package/src/commands/feedback/feedback.js +11 -0
- package/src/commands/feedback/index.js +20 -0
- package/src/commands/files/files.js +11 -0
- package/src/commands/files/index.js +9 -0
- package/src/commands/force-snip.js +19 -0
- package/src/commands/fork/index.js +67 -0
- package/src/commands/heapdump/heapdump.js +14 -0
- package/src/commands/heapdump/index.js +9 -0
- package/src/commands/help/help.js +6 -0
- package/src/commands/help/index.js +7 -0
- package/src/commands/hooks/hooks.js +12 -0
- package/src/commands/hooks/index.js +8 -0
- package/src/commands/ide/ide.js +615 -0
- package/src/commands/ide/index.js +8 -0
- package/src/commands/init-verifiers.js +258 -0
- package/src/commands/init.js +248 -0
- package/src/commands/insights.js +2554 -0
- package/src/commands/install-github-app/ApiKeyStep.js +230 -0
- package/src/commands/install-github-app/CheckExistingSecretStep.js +194 -0
- package/src/commands/install-github-app/CheckGitHubStep.js +16 -0
- package/src/commands/install-github-app/ChooseRepoStep.js +211 -0
- package/src/commands/install-github-app/CreatingStep.js +53 -0
- package/src/commands/install-github-app/ErrorStep.js +84 -0
- package/src/commands/install-github-app/ExistingWorkflowStep.js +105 -0
- package/src/commands/install-github-app/InstallAppStep.js +97 -0
- package/src/commands/install-github-app/OAuthFlowStep.js +190 -0
- package/src/commands/install-github-app/SuccessStep.js +94 -0
- package/src/commands/install-github-app/WarningsStep.js +71 -0
- package/src/commands/install-github-app/index.js +10 -0
- package/src/commands/install-github-app/install-github-app.js +593 -0
- package/src/commands/install-github-app/setupGitHubActions.js +227 -0
- package/src/commands/install-slack-app/index.js +9 -0
- package/src/commands/install-slack-app/install-slack-app.js +25 -0
- package/src/commands/install.js +198 -0
- package/src/commands/keybindings/index.js +10 -0
- package/src/commands/keybindings/keybindings.js +47 -0
- package/src/commands/login/index.js +21 -0
- package/src/commands/login/login.js +135 -0
- package/src/commands/logout/index.js +11 -0
- package/src/commands/logout/logout.js +75 -0
- package/src/commands/mcp/addCommand.js +183 -0
- package/src/commands/mcp/index.js +9 -0
- package/src/commands/mcp/mcp.js +78 -0
- package/src/commands/mcp/xaaIdpCommand.js +193 -0
- package/src/commands/memories/index.js +9 -0
- package/src/commands/memories/index.ts +12 -0
- package/src/commands/memories/memories.tsx +950 -0
- package/src/commands/memory/index.js +7 -0
- package/src/commands/memory/memory.js +71 -0
- package/src/commands/mobile/index.js +9 -0
- package/src/commands/mobile/mobile.js +279 -0
- package/src/commands/model/index.js +14 -0
- package/src/commands/model/model.js +284 -0
- package/src/commands/output-style/index.js +8 -0
- package/src/commands/output-style/output-style.js +6 -0
- package/src/commands/passes/index.js +17 -0
- package/src/commands/passes/passes.js +23 -0
- package/src/commands/peers/index.js +68 -0
- package/src/commands/permissions/index.js +8 -0
- package/src/commands/permissions/permissions.js +9 -0
- package/src/commands/plan/index.js +8 -0
- package/src/commands/plan/plan.js +116 -0
- package/src/commands/plugin/AddMarketplace.js +96 -0
- package/src/commands/plugin/BrowseMarketplace.js +582 -0
- package/src/commands/plugin/DiscoverPlugins.js +613 -0
- package/src/commands/plugin/ManageMarketplaces.js +583 -0
- package/src/commands/plugin/ManagePlugins.js +1783 -0
- package/src/commands/plugin/PluginErrors.js +124 -0
- package/src/commands/plugin/PluginOptionsDialog.js +367 -0
- package/src/commands/plugin/PluginOptionsFlow.js +97 -0
- package/src/commands/plugin/PluginSettings.js +1041 -0
- package/src/commands/plugin/PluginTrustWarning.js +35 -0
- package/src/commands/plugin/UnifiedInstalledCell.js +616 -0
- package/src/commands/plugin/ValidatePlugin.js +96 -0
- package/src/commands/plugin/index.js +10 -0
- package/src/commands/plugin/parseArgs.js +71 -0
- package/src/commands/plugin/plugin.js +6 -0
- package/src/commands/plugin/pluginDetailsHelpers.js +95 -0
- package/src/commands/plugin/usePagination.js +89 -0
- package/src/commands/pr_comments/index.js +49 -0
- package/src/commands/privacy-settings/index.js +11 -0
- package/src/commands/privacy-settings/privacy-settings.js +55 -0
- package/src/commands/proactive.js +29 -0
- package/src/commands/rate-limit-options/index.js +15 -0
- package/src/commands/rate-limit-options/rate-limit-options.js +213 -0
- package/src/commands/release-notes/index.js +8 -0
- package/src/commands/release-notes/release-notes.js +38 -0
- package/src/commands/reload-plugins/index.js +11 -0
- package/src/commands/reload-plugins/reload-plugins.js +52 -0
- package/src/commands/remote-env/index.js +12 -0
- package/src/commands/remote-env/remote-env.js +6 -0
- package/src/commands/remote-setup/api.js +155 -0
- package/src/commands/remote-setup/index.js +15 -0
- package/src/commands/remote-setup/remote-setup.js +150 -0
- package/src/commands/remoteControlServer/index.js +58 -0
- package/src/commands/rename/generateSessionName.js +58 -0
- package/src/commands/rename/index.js +9 -0
- package/src/commands/rename/rename.js +52 -0
- package/src/commands/resume/index.js +9 -0
- package/src/commands/resume/resume.js +239 -0
- package/src/commands/review/UltrareviewOverageDialog.js +97 -0
- package/src/commands/review/reviewRemote.js +259 -0
- package/src/commands/review/ultrareviewCommand.js +58 -0
- package/src/commands/review/ultrareviewEnabled.js +10 -0
- package/src/commands/review.js +53 -0
- package/src/commands/rewind/index.js +10 -0
- package/src/commands/rewind/rewind.js +7 -0
- package/src/commands/sandbox-toggle/index.js +41 -0
- package/src/commands/sandbox-toggle/sandbox-toggle.js +73 -0
- package/src/commands/security-review.js +231 -0
- package/src/commands/session/index.js +13 -0
- package/src/commands/session/session.js +143 -0
- package/src/commands/skills/index.js +7 -0
- package/src/commands/skills/skills.js +6 -0
- package/src/commands/speak.js +21 -0
- package/src/commands/start-business.js +1575 -0
- package/src/commands/start-business.ts +1581 -0
- package/src/commands/stats/index.js +7 -0
- package/src/commands/stats/stats.js +6 -0
- package/src/commands/status/index.js +8 -0
- package/src/commands/status/status.js +6 -0
- package/src/commands/statusline.js +22 -0
- package/src/commands/stickers/index.js +8 -0
- package/src/commands/stickers/stickers.js +14 -0
- package/src/commands/subscribe-pr.js +131 -0
- package/src/commands/tag/index.js +9 -0
- package/src/commands/tag/tag.js +215 -0
- package/src/commands/tasks/index.js +8 -0
- package/src/commands/tasks/tasks.js +6 -0
- package/src/commands/terminalSetup/index.js +18 -0
- package/src/commands/terminalSetup/terminalSetup.js +491 -0
- package/src/commands/thaddeus-usage/index.js +17 -0
- package/src/commands/theme/index.js +7 -0
- package/src/commands/theme/theme.js +51 -0
- package/src/commands/thinkback/index.js +9 -0
- package/src/commands/thinkback/thinkback.js +528 -0
- package/src/commands/thinkback-play/index.js +13 -0
- package/src/commands/thinkback-play/thinkback-play.js +34 -0
- package/src/commands/torch.js +122 -0
- package/src/commands/ultraplan.js +416 -0
- package/src/commands/upgrade/index.js +12 -0
- package/src/commands/upgrade/upgrade.js +38 -0
- package/src/commands/usage/index.js +7 -0
- package/src/commands/usage/usage.js +6 -0
- package/src/commands/version.js +17 -0
- package/src/commands/vim/index.js +8 -0
- package/src/commands/vim/vim.js +25 -0
- package/src/commands/voice/index.js +13 -0
- package/src/commands/voice/voice.js +44 -0
- package/src/commands/workflows/index.js +123 -0
- package/src/commands.js +614 -0
- package/src/commands.ts +4 -0
- package/src/components/AgentProgressLine.js +112 -0
- package/src/components/AntModelSwitchCallout.js +8 -0
- package/src/components/App.js +46 -0
- package/src/components/ApproveApiKey.js +125 -0
- package/src/components/AutoModeOptInDialog.js +140 -0
- package/src/components/AutoUpdater.js +156 -0
- package/src/components/AutoUpdaterWrapper.js +78 -0
- package/src/components/AwsAuthStatusBox.js +88 -0
- package/src/components/BaseTextInput.js +105 -0
- package/src/components/BashModeProgress.js +49 -0
- package/src/components/BridgeDialog.js +415 -0
- package/src/components/BypassPermissionsModeDialog.js +87 -0
- package/src/components/ChannelDowngradeDialog.js +101 -0
- package/src/components/ClaudeInChromeOnboarding.js +126 -0
- package/src/components/ClaudeMdExternalIncludesDialog.js +137 -0
- package/src/components/ClickableImageRef.js +65 -0
- package/src/components/CompactSummary.js +120 -0
- package/src/components/ConfigurableShortcutHint.js +35 -0
- package/src/components/ConsoleOAuthFlow.js +554 -0
- package/src/components/ContextSuggestions.js +44 -0
- package/src/components/ContextVisualization.js +482 -0
- package/src/components/CoordinatorAgentStatus.js +261 -0
- package/src/components/CostThresholdDialog.js +49 -0
- package/src/components/CtrlOToExpand.js +50 -0
- package/src/components/CustomSelect/SelectMulti.js +150 -0
- package/src/components/CustomSelect/index.js +2 -0
- package/src/components/CustomSelect/option-map.js +32 -0
- package/src/components/CustomSelect/select-input-option.js +426 -0
- package/src/components/CustomSelect/select-option.js +24 -0
- package/src/components/CustomSelect/select.js +518 -0
- package/src/components/CustomSelect/use-multi-select-state.js +214 -0
- package/src/components/CustomSelect/use-select-input.js +170 -0
- package/src/components/CustomSelect/use-select-navigation.js +366 -0
- package/src/components/CustomSelect/use-select-state.js +22 -0
- package/src/components/DesktopHandoff.js +195 -0
- package/src/components/DesktopUpsell/DesktopUpsellStartup.js +174 -0
- package/src/components/DevBar.js +51 -0
- package/src/components/DevChannelsDialog.js +104 -0
- package/src/components/DiagnosticsDisplay.js +91 -0
- package/src/components/EffortCallout.js +264 -0
- package/src/components/EffortIndicator.js +28 -0
- package/src/components/ExitFlow.js +41 -0
- package/src/components/ExportDialog.js +101 -0
- package/src/components/FallbackToolUseErrorMessage.js +116 -0
- package/src/components/FallbackToolUseRejectedMessage.js +17 -0
- package/src/components/FastIcon.js +43 -0
- package/src/components/Feedback.js +369 -0
- package/src/components/FeedbackSurvey/FeedbackSurvey.js +151 -0
- package/src/components/FeedbackSurvey/FeedbackSurveyView.js +104 -0
- package/src/components/FeedbackSurvey/TranscriptSharePrompt.js +84 -0
- package/src/components/FeedbackSurvey/submitTranscriptShare.js +10 -0
- package/src/components/FeedbackSurvey/useDebouncedDigitInput.js +51 -0
- package/src/components/FeedbackSurvey/useFeedbackSurvey.js +258 -0
- package/src/components/FeedbackSurvey/useFrustrationDetection.js +8 -0
- package/src/components/FeedbackSurvey/useMemorySurvey.js +191 -0
- package/src/components/FeedbackSurvey/usePostCompactSurvey.js +202 -0
- package/src/components/FeedbackSurvey/useSurveyState.js +80 -0
- package/src/components/FileEditToolDiff.js +167 -0
- package/src/components/FileEditToolUpdatedMessage.js +112 -0
- package/src/components/FileEditToolUseRejectedMessage.js +158 -0
- package/src/components/FilePathLink.js +35 -0
- package/src/components/FullscreenLayout.js +578 -0
- package/src/components/GlobalSearchDialog.js +340 -0
- package/src/components/HelpV2/Commands.js +66 -0
- package/src/components/HelpV2/General.js +25 -0
- package/src/components/HelpV2/HelpV2.js +186 -0
- package/src/components/HighlightedCode/Fallback.js +193 -0
- package/src/components/HighlightedCode.js +185 -0
- package/src/components/HistorySearchDialog.js +93 -0
- package/src/components/IdeAutoConnectDialog.js +154 -0
- package/src/components/IdeOnboardingDialog.js +175 -0
- package/src/components/IdeStatusIndicator.js +50 -0
- package/src/components/IdleReturnDialog.js +117 -0
- package/src/components/InterruptedByUser.js +16 -0
- package/src/components/InvalidConfigDialog.js +135 -0
- package/src/components/InvalidSettingsDialog.js +85 -0
- package/src/components/KeybindingWarnings.js +55 -0
- package/src/components/LanguagePicker.js +84 -0
- package/src/components/LogSelector.js +1579 -0
- package/src/components/LogoV2/AnimatedAsterisk.js +43 -0
- package/src/components/LogoV2/AnimatedClawd.js +64 -0
- package/src/components/LogoV2/ChannelsNotice.js +262 -0
- package/src/components/LogoV2/Clawd.js +33 -0
- package/src/components/LogoV2/CondensedLogo.js +160 -0
- package/src/components/LogoV2/EmergencyTip.js +48 -0
- package/src/components/LogoV2/Feed.js +85 -0
- package/src/components/LogoV2/FeedColumn.js +55 -0
- package/src/components/LogoV2/GuestPassesUpsell.js +71 -0
- package/src/components/LogoV2/LogoV2.js +565 -0
- package/src/components/LogoV2/Opus1mMergeNotice.js +57 -0
- package/src/components/LogoV2/OverageCreditUpsell.js +161 -0
- package/src/components/LogoV2/VoiceModeNotice.js +71 -0
- package/src/components/LogoV2/WelcomeV2.js +14 -0
- package/src/components/LogoV2/feedConfigs.js +79 -0
- package/src/components/LspRecommendation/LspRecommendationMenu.js +46 -0
- package/src/components/MCPServerApprovalDialog.js +114 -0
- package/src/components/MCPServerDesktopImportDialog.js +206 -0
- package/src/components/MCPServerDialogCopy.js +16 -0
- package/src/components/MCPServerMultiselectDialog.js +134 -0
- package/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +150 -0
- package/src/components/ManagedSettingsSecurityDialog/utils.js +105 -0
- package/src/components/Markdown.js +233 -0
- package/src/components/MarkdownTable.js +280 -0
- package/src/components/MemoryUsageIndicator.js +28 -0
- package/src/components/Message.js +564 -0
- package/src/components/MessageModel.js +37 -0
- package/src/components/MessageResponse.js +73 -0
- package/src/components/MessageRow.js +346 -0
- package/src/components/MessageSelector.js +744 -0
- package/src/components/MessageTimestamp.js +58 -0
- package/src/components/Messages.js +645 -0
- package/src/components/ModelPicker.js +452 -0
- package/src/components/NativeAutoUpdater.js +152 -0
- package/src/components/NotebookEditToolUseRejectedMessage.js +84 -0
- package/src/components/OffscreenFreeze.js +35 -0
- package/src/components/Onboarding.js +174 -0
- package/src/components/OutputStylePicker.js +103 -0
- package/src/components/PackageManagerAutoUpdater.js +99 -0
- package/src/components/Passes/Passes.js +114 -0
- package/src/components/PrBadge.js +91 -0
- package/src/components/PressEnterToContinue.js +16 -0
- package/src/components/PromptInput/HistorySearchInput.js +45 -0
- package/src/components/PromptInput/IssueFlagBanner.js +8 -0
- package/src/components/PromptInput/Notifications.js +220 -0
- package/src/components/PromptInput/PromptInput.js +2014 -0
- package/src/components/PromptInput/PromptInputFooter.js +85 -0
- package/src/components/PromptInput/PromptInputFooterLeftSide.js +408 -0
- package/src/components/PromptInput/PromptInputFooterSuggestions.js +281 -0
- package/src/components/PromptInput/PromptInputHelpMenu.js +380 -0
- package/src/components/PromptInput/PromptInputModeIndicator.js +73 -0
- package/src/components/PromptInput/PromptInputQueuedCommands.js +105 -0
- package/src/components/PromptInput/PromptInputStashNotice.js +21 -0
- package/src/components/PromptInput/SandboxPromptFooterHint.js +66 -0
- package/src/components/PromptInput/ShimmeredInput.js +133 -0
- package/src/components/PromptInput/VoiceIndicator.js +137 -0
- package/src/components/PromptInput/inputModes.js +24 -0
- package/src/components/PromptInput/inputPaste.js +62 -0
- package/src/components/PromptInput/useMaybeTruncateInput.js +33 -0
- package/src/components/PromptInput/usePromptInputPlaceholder.js +53 -0
- package/src/components/PromptInput/useShowFastIconHint.js +23 -0
- package/src/components/PromptInput/useSwarmBanner.js +112 -0
- package/src/components/PromptInput/utils.js +50 -0
- package/src/components/QuickOpenDialog.js +244 -0
- package/src/components/RemoteCallout.js +53 -0
- package/src/components/RemoteEnvironmentDialog.js +346 -0
- package/src/components/ResumeTask.js +173 -0
- package/src/components/SandboxViolationExpandedView.js +106 -0
- package/src/components/SandboxViolationExpandedView.tsx +3 -0
- package/src/components/ScrollKeybindingHandler.js +982 -0
- package/src/components/SearchBox.js +56 -0
- package/src/components/SentryErrorBoundary.js +16 -0
- package/src/components/SessionBackgroundHint.js +105 -0
- package/src/components/SessionPreview.js +200 -0
- package/src/components/Settings/Config.js +1626 -0
- package/src/components/Settings/Settings.js +131 -0
- package/src/components/Settings/Status.js +230 -0
- package/src/components/Settings/Usage.js +341 -0
- package/src/components/ShowInIDEPrompt.js +152 -0
- package/src/components/SkillImprovementSurvey.js +130 -0
- package/src/components/Spinner/FlashingChar.js +52 -0
- package/src/components/Spinner/GlimmerMessage.js +329 -0
- package/src/components/Spinner/ShimmerChar.js +23 -0
- package/src/components/Spinner/SpinnerAnimationRow.js +170 -0
- package/src/components/Spinner/SpinnerGlyph.js +70 -0
- package/src/components/Spinner/TeammateSpinnerLine.js +171 -0
- package/src/components/Spinner/TeammateSpinnerTree.js +269 -0
- package/src/components/Spinner/index.js +9 -0
- package/src/components/Spinner/teammateSelectHint.js +1 -0
- package/src/components/Spinner/useShimmerAnimation.js +22 -0
- package/src/components/Spinner/useStalledAnimation.js +63 -0
- package/src/components/Spinner/utils.js +78 -0
- package/src/components/Spinner.js +474 -0
- package/src/components/Stats.js +1000 -0
- package/src/components/StatusLine.js +286 -0
- package/src/components/StatusNotices.js +50 -0
- package/src/components/StructuredDiff/Fallback.js +336 -0
- package/src/components/StructuredDiff/colorDiff.js +37 -0
- package/src/components/StructuredDiff.js +153 -0
- package/src/components/StructuredDiffList.js +9 -0
- package/src/components/TagTabs.js +101 -0
- package/src/components/TaskListV2.js +333 -0
- package/src/components/TeammateViewHeader.js +88 -0
- package/src/components/TeleportError.js +191 -0
- package/src/components/TeleportProgress.js +131 -0
- package/src/components/TeleportRepoMismatchDialog.js +98 -0
- package/src/components/TeleportResumeWrapper.js +158 -0
- package/src/components/TeleportStash.js +82 -0
- package/src/components/TextInput.js +108 -0
- package/src/components/ThaddeusHint/PluginHintMenu.js +37 -0
- package/src/components/ThemePicker.js +331 -0
- package/src/components/ThinkingToggle.js +154 -0
- package/src/components/TokenWarning.js +171 -0
- package/src/components/ToolUseLoader.js +35 -0
- package/src/components/TrustDialog/TrustDialog.js +301 -0
- package/src/components/TrustDialog/utils.js +199 -0
- package/src/components/UndercoverAutoCallout.js +5 -0
- package/src/components/ValidationErrorsList.js +147 -0
- package/src/components/VimTextInput.js +136 -0
- package/src/components/VirtualMessageList.js +893 -0
- package/src/components/WorkflowMultiselectDialog.js +118 -0
- package/src/components/WorktreeExitDialog.js +220 -0
- package/src/components/agents/AgentDetail.js +227 -0
- package/src/components/agents/AgentEditor.js +147 -0
- package/src/components/agents/AgentNavigationFooter.js +22 -0
- package/src/components/agents/AgentsList.js +436 -0
- package/src/components/agents/AgentsMenu.js +849 -0
- package/src/components/agents/ColorPicker.js +110 -0
- package/src/components/agents/ModelSelector.js +63 -0
- package/src/components/agents/SnapshotUpdateDialog.js +14 -0
- package/src/components/agents/ToolSelector.js +557 -0
- package/src/components/agents/agentFileUtils.js +179 -0
- package/src/components/agents/generateAgent.js +161 -0
- package/src/components/agents/new-agent-creation/CreateAgentWizard.js +89 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +81 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +387 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +63 -0
- package/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +126 -0
- package/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +118 -0
- package/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +80 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +108 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +80 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +49 -0
- package/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +131 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +52 -0
- package/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +100 -0
- package/src/components/agents/types.js +4 -0
- package/src/components/agents/utils.js +14 -0
- package/src/components/agents/validateAgent.js +79 -0
- package/src/components/design-system/Byline.js +72 -0
- package/src/components/design-system/Dialog.js +117 -0
- package/src/components/design-system/Divider.js +110 -0
- package/src/components/design-system/FuzzyPicker.js +191 -0
- package/src/components/design-system/KeyboardShortcutHint.js +68 -0
- package/src/components/design-system/ListItem.js +184 -0
- package/src/components/design-system/LoadingState.js +69 -0
- package/src/components/design-system/Pane.js +69 -0
- package/src/components/design-system/ProgressBar.js +63 -0
- package/src/components/design-system/Ratchet.js +71 -0
- package/src/components/design-system/StatusIcon.js +70 -0
- package/src/components/design-system/Tabs.js +269 -0
- package/src/components/design-system/ThemeProvider.js +137 -0
- package/src/components/design-system/ThemedBox.js +126 -0
- package/src/components/design-system/ThemedText.js +60 -0
- package/src/components/design-system/color.js +22 -0
- package/src/components/diff/DiffDetailView.js +285 -0
- package/src/components/diff/DiffDialog.js +387 -0
- package/src/components/diff/DiffFileList.js +292 -0
- package/src/components/grove/Grove.js +483 -0
- package/src/components/hooks/HooksConfigMenu.js +583 -0
- package/src/components/hooks/PromptDialog.js +82 -0
- package/src/components/hooks/SelectEventMode.js +118 -0
- package/src/components/hooks/SelectHookMode.js +101 -0
- package/src/components/hooks/SelectMatcherMode.js +131 -0
- package/src/components/hooks/ViewHookMode.js +204 -0
- package/src/components/mcp/CapabilitiesSection.js +56 -0
- package/src/components/mcp/ElicitationDialog.js +945 -0
- package/src/components/mcp/MCPAgentServerMenu.js +95 -0
- package/src/components/mcp/MCPListPanel.js +505 -0
- package/src/components/mcp/MCPReconnect.js +168 -0
- package/src/components/mcp/MCPRemoteServerMenu.js +460 -0
- package/src/components/mcp/MCPSettings.js +414 -0
- package/src/components/mcp/MCPStdioServerMenu.js +95 -0
- package/src/components/mcp/MCPToolDetailView.js +219 -0
- package/src/components/mcp/MCPToolListView.js +137 -0
- package/src/components/mcp/McpParsingWarnings.js +212 -0
- package/src/components/mcp/index.js +8 -0
- package/src/components/mcp/utils/reconnectHelpers.js +35 -0
- package/src/components/memory/MemoryFileSelector.js +454 -0
- package/src/components/memory/MemoryUpdateNotification.js +43 -0
- package/src/components/messageActions.js +418 -0
- package/src/components/messages/AdvisorMessage.js +152 -0
- package/src/components/messages/AssistantRedactedThinkingMessage.js +28 -0
- package/src/components/messages/AssistantTextMessage.js +287 -0
- package/src/components/messages/AssistantThinkingMessage.js +70 -0
- package/src/components/messages/AssistantToolUseMessage.js +324 -0
- package/src/components/messages/AttachmentMessage.js +418 -0
- package/src/components/messages/CollapsedReadSearchContent.js +363 -0
- package/src/components/messages/CompactBoundaryMessage.js +19 -0
- package/src/components/messages/GroupedToolUseContent.js +37 -0
- package/src/components/messages/HighlightedThinkingText.js +165 -0
- package/src/components/messages/HookProgressMessage.js +111 -0
- package/src/components/messages/PlanApprovalMessage.js +213 -0
- package/src/components/messages/RateLimitMessage.js +149 -0
- package/src/components/messages/ShutdownMessage.js +124 -0
- package/src/components/messages/SnipBoundaryMessage.js +7 -0
- package/src/components/messages/SystemAPIErrorMessage.js +136 -0
- package/src/components/messages/SystemTextMessage.js +842 -0
- package/src/components/messages/TaskAssignmentMessage.js +72 -0
- package/src/components/messages/UserAgentNotificationMessage.js +78 -0
- package/src/components/messages/UserBashInputMessage.js +52 -0
- package/src/components/messages/UserBashOutputMessage.js +55 -0
- package/src/components/messages/UserChannelMessage.js +130 -0
- package/src/components/messages/UserCommandMessage.js +107 -0
- package/src/components/messages/UserCrossSessionMessage.js +11 -0
- package/src/components/messages/UserForkBoilerplateMessage.js +11 -0
- package/src/components/messages/UserGitHubWebhookMessage.js +12 -0
- package/src/components/messages/UserImageMessage.js +54 -0
- package/src/components/messages/UserLocalCommandOutputMessage.js +170 -0
- package/src/components/messages/UserMemoryInputMessage.js +73 -0
- package/src/components/messages/UserPlanMessage.js +38 -0
- package/src/components/messages/UserPromptMessage.js +63 -0
- package/src/components/messages/UserResourceUpdateMessage.js +102 -0
- package/src/components/messages/UserTeammateMessage.js +156 -0
- package/src/components/messages/UserTextMessage.js +270 -0
- package/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +28 -0
- package/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +17 -0
- package/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +17 -0
- package/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +92 -0
- package/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +74 -0
- package/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +84 -0
- package/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +58 -0
- package/src/components/messages/UserToolResultMessage/utils.js +43 -0
- package/src/components/messages/nullRenderingAttachments.js +58 -0
- package/src/components/messages/teamMemCollapsed.js +142 -0
- package/src/components/messages/teamMemSaved.js +16 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +659 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +219 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +227 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +175 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +444 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +137 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +100 -0
- package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +404 -0
- package/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +110 -0
- package/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +449 -0
- package/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +126 -0
- package/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +653 -0
- package/src/components/permissions/FallbackPermissionRequest.js +349 -0
- package/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +185 -0
- package/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +108 -0
- package/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +13 -0
- package/src/components/permissions/FilePermissionDialog/permissionOptions.js +137 -0
- package/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +131 -0
- package/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +86 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +164 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +79 -0
- package/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +113 -0
- package/src/components/permissions/MonitorPermissionRequest/MonitorPermissionRequest.js +7 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +164 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +218 -0
- package/src/components/permissions/PermissionDecisionDebugInfo.js +467 -0
- package/src/components/permissions/PermissionDialog.js +55 -0
- package/src/components/permissions/PermissionExplanation.js +269 -0
- package/src/components/permissions/PermissionPrompt.js +316 -0
- package/src/components/permissions/PermissionRequest.js +159 -0
- package/src/components/permissions/PermissionRequestTitle.js +58 -0
- package/src/components/permissions/PermissionRuleExplanation.js +110 -0
- package/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +178 -0
- package/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +73 -0
- package/src/components/permissions/ReviewArtifactPermissionRequest/ReviewArtifactPermissionRequest.js +7 -0
- package/src/components/permissions/SandboxPermissionRequest.js +162 -0
- package/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +228 -0
- package/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +385 -0
- package/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +259 -0
- package/src/components/permissions/WorkerBadge.js +44 -0
- package/src/components/permissions/WorkerPendingPermission.js +107 -0
- package/src/components/permissions/hooks.js +163 -0
- package/src/components/permissions/rules/AddPermissionRules.js +171 -0
- package/src/components/permissions/rules/AddWorkspaceDirectory.js +335 -0
- package/src/components/permissions/rules/PermissionRuleDescription.js +78 -0
- package/src/components/permissions/rules/PermissionRuleInput.js +136 -0
- package/src/components/permissions/rules/PermissionRuleList.js +1190 -0
- package/src/components/permissions/rules/RecentDenialsTab.js +205 -0
- package/src/components/permissions/rules/RemoveWorkspaceDirectory.js +103 -0
- package/src/components/permissions/rules/WorkspaceTab.js +133 -0
- package/src/components/permissions/shellPermissionHelpers.js +112 -0
- package/src/components/permissions/useShellPermissionFeedback.js +108 -0
- package/src/components/permissions/utils.js +14 -0
- package/src/components/sandbox/SandboxConfigTab.js +48 -0
- package/src/components/sandbox/SandboxDependenciesTab.js +123 -0
- package/src/components/sandbox/SandboxDoctorSection.js +47 -0
- package/src/components/sandbox/SandboxOverridesTab.js +193 -0
- package/src/components/sandbox/SandboxSettings.js +297 -0
- package/src/components/shell/ExpandShellOutputContext.js +33 -0
- package/src/components/shell/OutputLine.js +110 -0
- package/src/components/shell/ShellProgressMessage.js +144 -0
- package/src/components/shell/ShellTimeDisplay.js +72 -0
- package/src/components/skills/SkillsMenu.js +239 -0
- package/src/components/tasks/AsyncAgentDetailDialog.js +235 -0
- package/src/components/tasks/BackgroundTask.js +364 -0
- package/src/components/tasks/BackgroundTaskStatus.js +419 -0
- package/src/components/tasks/BackgroundTasksDialog.js +494 -0
- package/src/components/tasks/DreamDetailDialog.js +251 -0
- package/src/components/tasks/InProcessTeammateDetailDialog.js +275 -0
- package/src/components/tasks/MonitorMcpDetailDialog.js +7 -0
- package/src/components/tasks/RemoteSessionDetailDialog.js +868 -0
- package/src/components/tasks/RemoteSessionProgress.js +249 -0
- package/src/components/tasks/ShellDetailDialog.js +403 -0
- package/src/components/tasks/ShellProgress.js +77 -0
- package/src/components/tasks/WorkflowDetailDialog.js +7 -0
- package/src/components/tasks/renderToolActivity.js +29 -0
- package/src/components/tasks/taskStatusUtils.js +94 -0
- package/src/components/teams/TeamStatus.js +77 -0
- package/src/components/teams/TeamsDialog.js +673 -0
- package/src/components/ui/OrderedList.js +66 -0
- package/src/components/ui/OrderedListItem.js +41 -0
- package/src/components/ui/TreeSelect.js +300 -0
- package/src/components/wizard/WizardDialogLayout.js +48 -0
- package/src/components/wizard/WizardNavigationFooter.js +11 -0
- package/src/components/wizard/WizardProvider.js +217 -0
- package/src/components/wizard/index.js +4 -0
- package/src/components/wizard/useWizard.js +9 -0
- package/src/constants/apiLimits.js +81 -0
- package/src/constants/betas.js +45 -0
- package/src/constants/common.js +29 -0
- package/src/constants/cyberRiskInstruction.js +23 -0
- package/src/constants/errorIds.js +14 -0
- package/src/constants/figures.js +38 -0
- package/src/constants/files.js +150 -0
- package/src/constants/github-app.js +139 -0
- package/src/constants/identity.js +112 -0
- package/src/constants/keys.js +10 -0
- package/src/constants/messages.js +1 -0
- package/src/constants/oauth.js +175 -0
- package/src/constants/outputStyles.js +162 -0
- package/src/constants/product.js +54 -0
- package/src/constants/prompts.js +994 -0
- package/src/constants/spinnerVerbs.js +98 -0
- package/src/constants/system.js +77 -0
- package/src/constants/systemPromptSections.js +39 -0
- package/src/constants/toolLimits.js +50 -0
- package/src/constants/tools.js +103 -0
- package/src/constants/turnCompletionVerbs.js +12 -0
- package/src/constants/xml.js +73 -0
- package/src/context/QueuedMessageContext.js +51 -0
- package/src/context/fpsMetrics.js +22 -0
- package/src/context/mailbox.js +35 -0
- package/src/context/modalContext.js +34 -0
- package/src/context/notifications.js +199 -0
- package/src/context/overlayContext.js +149 -0
- package/src/context/promptOverlayContext.js +118 -0
- package/src/context/stats.js +207 -0
- package/src/context/voice.js +74 -0
- package/src/context.js +146 -0
- package/src/coordinator/coordinatorMode.js +345 -0
- package/src/coordinator/workerAgent.js +24 -0
- package/src/cost-tracker.js +208 -0
- package/src/costHook.js +17 -0
- package/src/daemon/main.js +19 -0
- package/src/dialogLaunchers.js +77 -0
- package/src/entrypoints/agentSdkTypes.js +202 -0
- package/src/entrypoints/cli.js +226 -0
- package/src/entrypoints/init.js +265 -0
- package/src/entrypoints/mcp.js +141 -0
- package/src/entrypoints/sandboxTypes.js +112 -0
- package/src/entrypoints/sdk/controlSchemas.js +452 -0
- package/src/entrypoints/sdk/controlTypes.js +1 -0
- package/src/entrypoints/sdk/coreSchemas.js +1331 -0
- package/src/entrypoints/sdk/coreTypes.generated.js +3 -0
- package/src/entrypoints/sdk/coreTypes.js +49 -0
- package/src/entrypoints/sdk/runtimeTypes.js +1 -0
- package/src/entrypoints/sdk/sdkUtilityTypes.js +1 -0
- package/src/entrypoints/sdk/settingsTypes.generated.js +1 -0
- package/src/entrypoints/sdk/toolTypes.js +1 -0
- package/src/environment-runner/main.js +8 -0
- package/src/history.js +386 -0
- package/src/hooks/fileSuggestions.js +635 -0
- package/src/hooks/notifs/useAntOrgWarningNotification.js +5 -0
- package/src/hooks/notifs/useAutoModeUnavailableNotification.js +47 -0
- package/src/hooks/notifs/useCanSwitchToExistingSubscription.js +58 -0
- package/src/hooks/notifs/useDeprecationWarningNotification.js +43 -0
- package/src/hooks/notifs/useFastModeNotification.js +164 -0
- package/src/hooks/notifs/useIDEStatusIndicator.js +174 -0
- package/src/hooks/notifs/useInstallMessages.js +27 -0
- package/src/hooks/notifs/useLspInitializationNotification.js +144 -0
- package/src/hooks/notifs/useMcpConnectivityStatus.js +81 -0
- package/src/hooks/notifs/useModelMigrationNotifications.js +53 -0
- package/src/hooks/notifs/useNpmDeprecationNotification.js +25 -0
- package/src/hooks/notifs/usePluginAutoupdateNotification.js +83 -0
- package/src/hooks/notifs/usePluginInstallationStatus.js +128 -0
- package/src/hooks/notifs/useRateLimitWarningNotification.js +119 -0
- package/src/hooks/notifs/useSettingsErrors.js +64 -0
- package/src/hooks/notifs/useStartupNotification.js +33 -0
- package/src/hooks/notifs/useTeammateShutdownNotification.js +64 -0
- package/src/hooks/renderPlaceholder.js +26 -0
- package/src/hooks/toolPermission/PermissionContext.js +211 -0
- package/src/hooks/toolPermission/handlers/coordinatorHandler.js +44 -0
- package/src/hooks/toolPermission/handlers/interactiveHandler.js +397 -0
- package/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +108 -0
- package/src/hooks/toolPermission/permissionLogging.js +145 -0
- package/src/hooks/unifiedSuggestions.js +130 -0
- package/src/hooks/useAfterFirstRender.js +12 -0
- package/src/hooks/useApiKeyVerification.js +63 -0
- package/src/hooks/useArrowKeyHistory.js +203 -0
- package/src/hooks/useAssistantHistory.js +193 -0
- package/src/hooks/useAwaySummary.js +105 -0
- package/src/hooks/useBackgroundTaskNavigation.js +204 -0
- package/src/hooks/useBlink.js +28 -0
- package/src/hooks/useCanUseTool.js +193 -0
- package/src/hooks/useCancelRequest.js +195 -0
- package/src/hooks/useChromeExtensionNotification.js +50 -0
- package/src/hooks/useClipboardImageHint.js +59 -0
- package/src/hooks/useCommandKeybindings.js +87 -0
- package/src/hooks/useCommandQueue.js +10 -0
- package/src/hooks/useCopyOnSelect.js +88 -0
- package/src/hooks/useDeferredHookMessages.js +43 -0
- package/src/hooks/useDiffData.js +69 -0
- package/src/hooks/useDiffInIDE.js +252 -0
- package/src/hooks/useDirectConnect.js +150 -0
- package/src/hooks/useDoublePress.js +44 -0
- package/src/hooks/useDynamicConfig.js +17 -0
- package/src/hooks/useElapsedTime.js +25 -0
- package/src/hooks/useExitOnCtrlCD.js +57 -0
- package/src/hooks/useExitOnCtrlCDWithKeybindings.js +17 -0
- package/src/hooks/useFileHistorySnapshotInit.js +14 -0
- package/src/hooks/useGlobalKeybindings.js +213 -0
- package/src/hooks/useHistorySearch.js +241 -0
- package/src/hooks/useIDEIntegration.js +56 -0
- package/src/hooks/useIdeAtMentioned.js +51 -0
- package/src/hooks/useIdeConnectionStatus.js +21 -0
- package/src/hooks/useIdeLogging.js +29 -0
- package/src/hooks/useIdeSelection.js +106 -0
- package/src/hooks/useInboxPoller.js +709 -0
- package/src/hooks/useInputBuffer.js +73 -0
- package/src/hooks/useIssueFlagBanner.js +115 -0
- package/src/hooks/useLogMessages.js +98 -0
- package/src/hooks/useLspPluginRecommendation.js +176 -0
- package/src/hooks/useMailboxBridge.js +15 -0
- package/src/hooks/useMainLoopModel.js +25 -0
- package/src/hooks/useManagePlugins.js +261 -0
- package/src/hooks/useMemoryUsage.js +28 -0
- package/src/hooks/useMergedClients.js +11 -0
- package/src/hooks/useMergedCommands.js +10 -0
- package/src/hooks/useMergedTools.js +32 -0
- package/src/hooks/useMinDisplayTime.js +26 -0
- package/src/hooks/useNotifyAfterTimeout.js +51 -0
- package/src/hooks/useOfficialMarketplaceNotification.js +47 -0
- package/src/hooks/usePasteHandler.js +195 -0
- package/src/hooks/usePluginRecommendationBase.js +101 -0
- package/src/hooks/usePrStatus.js +91 -0
- package/src/hooks/usePromptSuggestion.js +128 -0
- package/src/hooks/usePromptsFromClaudeInChrome.js +66 -0
- package/src/hooks/useQueueProcessor.js +46 -0
- package/src/hooks/useRemoteSession.js +431 -0
- package/src/hooks/useReplBridge.js +715 -0
- package/src/hooks/useSSHSession.js +167 -0
- package/src/hooks/useScheduledTasks.js +104 -0
- package/src/hooks/useSearchInput.js +302 -0
- package/src/hooks/useSessionBackgrounding.js +132 -0
- package/src/hooks/useSettings.js +10 -0
- package/src/hooks/useSettingsChange.js +13 -0
- package/src/hooks/useSkillImprovementSurvey.js +69 -0
- package/src/hooks/useSkillsChange.js +51 -0
- package/src/hooks/useSwarmInitialization.js +67 -0
- package/src/hooks/useSwarmPermissionPoller.js +215 -0
- package/src/hooks/useTaskListWatcher.js +157 -0
- package/src/hooks/useTasksV2.js +220 -0
- package/src/hooks/useTeammateViewAutoExit.js +55 -0
- package/src/hooks/useTeleportResume.js +81 -0
- package/src/hooks/useTerminalSize.js +9 -0
- package/src/hooks/useTextInput.js +397 -0
- package/src/hooks/useThaddeusHintRecommendation.js +117 -0
- package/src/hooks/useTimeout.js +10 -0
- package/src/hooks/useTurnDiffs.js +160 -0
- package/src/hooks/useTypeahead.js +1250 -0
- package/src/hooks/useUpdateNotification.js +21 -0
- package/src/hooks/useVimInput.js +232 -0
- package/src/hooks/useVirtualScroll.js +627 -0
- package/src/hooks/useVoice.js +952 -0
- package/src/hooks/useVoiceEnabled.js +21 -0
- package/src/hooks/useVoiceIntegration.js +629 -0
- package/src/infrastructure/audit.js +210 -0
- package/src/infrastructure/guardrails.js +513 -0
- package/src/infrastructure/index.js +11 -0
- package/src/ink/Ansi.js +269 -0
- package/src/ink/bidi.js +117 -0
- package/src/ink/clearTerminal.js +58 -0
- package/src/ink/colorize.js +198 -0
- package/src/ink/components/AlternateScreen.js +74 -0
- package/src/ink/components/App.js +562 -0
- package/src/ink/components/AppContext.js +11 -0
- package/src/ink/components/Box.js +155 -0
- package/src/ink/components/Button.js +166 -0
- package/src/ink/components/ClockContext.js +108 -0
- package/src/ink/components/CursorDeclarationContext.js +3 -0
- package/src/ink/components/ErrorOverview.js +50 -0
- package/src/ink/components/Link.js +34 -0
- package/src/ink/components/Newline.js +30 -0
- package/src/ink/components/NoSelect.js +57 -0
- package/src/ink/components/RawAnsi.js +46 -0
- package/src/ink/components/ScrollBox.js +171 -0
- package/src/ink/components/Spacer.js +20 -0
- package/src/ink/components/StdinContext.js +16 -0
- package/src/ink/components/TerminalFocusContext.js +45 -0
- package/src/ink/components/TerminalSizeContext.js +3 -0
- package/src/ink/components/Text.js +195 -0
- package/src/ink/constants.js +2 -0
- package/src/ink/dom.js +298 -0
- package/src/ink/events/click-event.js +36 -0
- package/src/ink/events/dispatcher.js +172 -0
- package/src/ink/events/emitter.js +31 -0
- package/src/ink/events/event-handlers.js +30 -0
- package/src/ink/events/event.js +9 -0
- package/src/ink/events/focus-event.js +16 -0
- package/src/ink/events/input-event.js +161 -0
- package/src/ink/events/keyboard-event.js +46 -0
- package/src/ink/events/terminal-event.js +78 -0
- package/src/ink/events/terminal-focus-event.js +15 -0
- package/src/ink/focus.js +158 -0
- package/src/ink/frame.js +30 -0
- package/src/ink/get-max-width.js +23 -0
- package/src/ink/hit-test.js +113 -0
- package/src/ink/hooks/use-animation-frame.js +48 -0
- package/src/ink/hooks/use-app.js +7 -0
- package/src/ink/hooks/use-declared-cursor.js +60 -0
- package/src/ink/hooks/use-input.js +70 -0
- package/src/ink/hooks/use-interval.js +54 -0
- package/src/ink/hooks/use-search-highlight.js +32 -0
- package/src/ink/hooks/use-selection.js +60 -0
- package/src/ink/hooks/use-stdin.js +7 -0
- package/src/ink/hooks/use-tab-status.js +57 -0
- package/src/ink/hooks/use-terminal-focus.js +15 -0
- package/src/ink/hooks/use-terminal-title.js +29 -0
- package/src/ink/hooks/use-terminal-viewport.js +77 -0
- package/src/ink/ink.js +1645 -0
- package/src/ink/instances.js +7 -0
- package/src/ink/layout/engine.js +4 -0
- package/src/ink/layout/geometry.js +61 -0
- package/src/ink/layout/node.js +62 -0
- package/src/ink/layout/yoga.js +237 -0
- package/src/ink/line-width-cache.js +19 -0
- package/src/ink/log-update.js +583 -0
- package/src/ink/measure-element.js +8 -0
- package/src/ink/measure-text.js +35 -0
- package/src/ink/node-cache.js +30 -0
- package/src/ink/optimizer.js +81 -0
- package/src/ink/output.js +556 -0
- package/src/ink/parse-keypress.js +695 -0
- package/src/ink/reconciler.js +384 -0
- package/src/ink/render-border.js +134 -0
- package/src/ink/render-node-to-output.js +1216 -0
- package/src/ink/render-to-screen.js +171 -0
- package/src/ink/renderer.js +129 -0
- package/src/ink/root.js +80 -0
- package/src/ink/screen.js +1132 -0
- package/src/ink/searchHighlight.js +78 -0
- package/src/ink/selection.js +792 -0
- package/src/ink/squash-text-nodes.js +56 -0
- package/src/ink/stringWidth.js +200 -0
- package/src/ink/styles.js +299 -0
- package/src/ink/supports-hyperlinks.js +40 -0
- package/src/ink/tabstops.js +39 -0
- package/src/ink/terminal-focus-state.js +35 -0
- package/src/ink/terminal-querier.js +173 -0
- package/src/ink/terminal.js +208 -0
- package/src/ink/termio/ansi.js +70 -0
- package/src/ink/termio/csi.js +260 -0
- package/src/ink/termio/dec.js +53 -0
- package/src/ink/termio/esc.js +55 -0
- package/src/ink/termio/osc.js +432 -0
- package/src/ink/termio/parser.js +356 -0
- package/src/ink/termio/sgr.js +292 -0
- package/src/ink/termio/tokenize.js +264 -0
- package/src/ink/termio/types.js +55 -0
- package/src/ink/termio.js +24 -0
- package/src/ink/useTerminalNotification.js +57 -0
- package/src/ink/warn.js +10 -0
- package/src/ink/widest-line.js +14 -0
- package/src/ink/wrap-text.js +54 -0
- package/src/ink/wrapAnsi.js +6 -0
- package/src/ink.js +50 -0
- package/src/integrations/credentialStore.js +176 -0
- package/src/integrations/index.js +5 -0
- package/src/integrations/integrationManager.js +180 -0
- package/src/integrations/providers/BaseProvider.js +180 -0
- package/src/integrations/providers/GitHubProvider.js +217 -0
- package/src/integrations/providers/GmailProvider.js +204 -0
- package/src/integrations/providers/GoogleCalendarProvider.js +113 -0
- package/src/integrations/providers/HubSpotProvider.js +159 -0
- package/src/integrations/providers/JiraProvider.js +216 -0
- package/src/integrations/providers/NotionProvider.js +221 -0
- package/src/integrations/providers/QuickBooksProvider.js +176 -0
- package/src/integrations/providers/SlackProvider.js +174 -0
- package/src/integrations/providers/StripeProvider.js +206 -0
- package/src/integrations/providers/TwilioProvider.js +239 -0
- package/src/integrations/providers/_template.js +112 -0
- package/src/integrations/types.js +7 -0
- package/src/interactiveHelpers.js +308 -0
- package/src/jobs/classifier.js +6 -0
- package/src/keybindings/KeybindingContext.js +184 -0
- package/src/keybindings/KeybindingProviderSetup.js +259 -0
- package/src/keybindings/defaultBindings.js +333 -0
- package/src/keybindings/loadUserBindings.js +393 -0
- package/src/keybindings/match.js +111 -0
- package/src/keybindings/parser.js +184 -0
- package/src/keybindings/reservedShortcuts.js +109 -0
- package/src/keybindings/resolver.js +182 -0
- package/src/keybindings/schema.js +205 -0
- package/src/keybindings/shortcutFormat.js +48 -0
- package/src/keybindings/template.js +40 -0
- package/src/keybindings/useKeybinding.js +161 -0
- package/src/keybindings/useShortcutDisplay.js +43 -0
- package/src/keybindings/validate.js +395 -0
- package/src/main.js +4128 -0
- package/src/memdir/findRelevantMemories.js +99 -0
- package/src/memdir/memdir.js +406 -0
- package/src/memdir/memoryAge.js +52 -0
- package/src/memdir/memoryScan.js +65 -0
- package/src/memdir/memoryShapeTelemetry.js +8 -0
- package/src/memdir/memoryTypes.js +260 -0
- package/src/memdir/paths.js +235 -0
- package/src/memdir/teamMemPaths.js +261 -0
- package/src/memdir/teamMemPrompts.js +82 -0
- package/src/migrations/migrateAutoUpdatesToSettings.js +47 -0
- package/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +32 -0
- package/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +83 -0
- package/src/migrations/migrateFennecToOpus.js +39 -0
- package/src/migrations/migrateLegacyOpusToCurrent.js +44 -0
- package/src/migrations/migrateOpusToOpus1m.js +31 -0
- package/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +23 -0
- package/src/migrations/migrateSonnet1mToSonnet45.js +38 -0
- package/src/migrations/migrateSonnet45ToSonnet46.js +48 -0
- package/src/migrations/resetAutoModeOptInForDefaultOffer.js +47 -0
- package/src/migrations/resetProToOpusDefault.js +46 -0
- package/src/moreright/useMoreRight.js +13 -0
- package/src/native-ts/color-diff/index.js +819 -0
- package/src/native-ts/file-index/index.js +328 -0
- package/src/native-ts/yoga-layout/enums.js +101 -0
- package/src/native-ts/yoga-layout/index.js +2113 -0
- package/src/outputStyles/loadOutputStylesDir.js +71 -0
- package/src/plugins/builtinPlugins.js +132 -0
- package/src/plugins/bundled/index.js +22 -0
- package/src/proactive/index.js +138 -0
- package/src/proactive/useProactive.js +82 -0
- package/src/projectOnboardingState.js +61 -0
- package/src/query/config.js +17 -0
- package/src/query/deps.js +12 -0
- package/src/query/stopHooks.js +332 -0
- package/src/query/tokenBudget.js +49 -0
- package/src/query.js +1264 -0
- package/src/remote/RemoteSessionManager.js +172 -0
- package/src/remote/SessionsWebSocket.js +308 -0
- package/src/remote/remotePermissionBridge.js +70 -0
- package/src/remote/sdkMessageAdapter.js +227 -0
- package/src/replLauncher.js +7 -0
- package/src/schemas/hooks.js +174 -0
- package/src/screens/Doctor.js +580 -0
- package/src/screens/REPL.js +4500 -0
- package/src/screens/ResumeConversation.js +339 -0
- package/src/self-hosted-runner/main.js +8 -0
- package/src/server/backends/dangerousBackend.js +8 -0
- package/src/server/connectHeadless.js +6 -0
- package/src/server/createDirectConnectSession.js +62 -0
- package/src/server/directConnectManager.js +153 -0
- package/src/server/lockfile.js +11 -0
- package/src/server/parseConnectUrl.js +20 -0
- package/src/server/server.js +12 -0
- package/src/server/serverBanner.js +9 -0
- package/src/server/serverLog.js +11 -0
- package/src/server/sessionManager.js +19 -0
- package/src/server/types.js +7 -0
- package/src/services/AgentSummary/agentSummary.js +147 -0
- package/src/services/MagicDocs/magicDocs.js +193 -0
- package/src/services/MagicDocs/prompts.js +110 -0
- package/src/services/PromptSuggestion/promptSuggestion.js +402 -0
- package/src/services/PromptSuggestion/speculation.js +643 -0
- package/src/services/SessionMemory/prompts.js +254 -0
- package/src/services/SessionMemory/sessionMemory.js +358 -0
- package/src/services/SessionMemory/sessionMemoryUtils.js +157 -0
- package/src/services/analytics/config.js +27 -0
- package/src/services/analytics/datadog.js +26 -0
- package/src/services/analytics/firstPartyEventLogger.js +65 -0
- package/src/services/analytics/firstPartyEventLoggingExporter.js +595 -0
- package/src/services/analytics/growthbook.js +103 -0
- package/src/services/analytics/index.js +91 -0
- package/src/services/analytics/metadata.js +696 -0
- package/src/services/analytics/sink.js +19 -0
- package/src/services/analytics/sinkKillswitch.js +19 -0
- package/src/services/api/adminRequests.js +57 -0
- package/src/services/api/bootstrap.js +118 -0
- package/src/services/api/claude.js +2466 -0
- package/src/services/api/client.js +335 -0
- package/src/services/api/dumpPrompts.js +174 -0
- package/src/services/api/emptyUsage.js +20 -0
- package/src/services/api/errorUtils.js +203 -0
- package/src/services/api/errors.js +926 -0
- package/src/services/api/filesApi.js +523 -0
- package/src/services/api/firstTokenDate.js +49 -0
- package/src/services/api/grove.js +44 -0
- package/src/services/api/logging.js +484 -0
- package/src/services/api/metricsOptOut.js +15 -0
- package/src/services/api/overageCreditGrant.js +123 -0
- package/src/services/api/promptCacheBreakDetection.js +510 -0
- package/src/services/api/referral.js +219 -0
- package/src/services/api/sessionIngress.js +358 -0
- package/src/services/api/ultrareviewQuota.js +29 -0
- package/src/services/api/usage.js +31 -0
- package/src/services/api/withRetry.js +587 -0
- package/src/services/api/xai/anthropic-shim.js +885 -0
- package/src/services/api/xai/brightDataSearch.js +161 -0
- package/src/services/api/xai/thaddeus-engine.js +605 -0
- package/src/services/api/xai/xai-client.js +276 -0
- package/src/services/autoDream/autoDream.js +244 -0
- package/src/services/autoDream/config.js +17 -0
- package/src/services/autoDream/consolidationLock.js +122 -0
- package/src/services/autoDream/consolidationPrompt.js +55 -0
- package/src/services/awaySummary.js +61 -0
- package/src/services/claudeAiLimits.js +331 -0
- package/src/services/claudeAiLimitsHook.js +15 -0
- package/src/services/compact/apiMicrocompact.js +97 -0
- package/src/services/compact/autoCompact.js +234 -0
- package/src/services/compact/cachedMCConfig.js +5 -0
- package/src/services/compact/compact.js +1256 -0
- package/src/services/compact/compactWarningHook.js +12 -0
- package/src/services/compact/compactWarningState.js +15 -0
- package/src/services/compact/grouping.js +58 -0
- package/src/services/compact/microCompact.js +414 -0
- package/src/services/compact/postCompactCleanup.js +70 -0
- package/src/services/compact/prompt.js +325 -0
- package/src/services/compact/reactiveCompact.js +20 -0
- package/src/services/compact/sessionMemoryCompact.js +467 -0
- package/src/services/compact/snipCompact.js +23 -0
- package/src/services/compact/snipProjection.js +11 -0
- package/src/services/compact/timeBasedMCConfig.js +11 -0
- package/src/services/contextCollapse/index.js +33 -0
- package/src/services/contextCollapse/operations.js +5 -0
- package/src/services/contextCollapse/persist.js +5 -0
- package/src/services/diagnosticTracking.js +282 -0
- package/src/services/elevenlabsTTS.js +245 -0
- package/src/services/extractMemories/extractMemories.js +442 -0
- package/src/services/extractMemories/prompts.js +129 -0
- package/src/services/internalLogging.js +68 -0
- package/src/services/lsp/LSPClient.js +306 -0
- package/src/services/lsp/LSPDiagnosticRegistry.js +277 -0
- package/src/services/lsp/LSPServerInstance.js +388 -0
- package/src/services/lsp/LSPServerManager.js +305 -0
- package/src/services/lsp/config.js +57 -0
- package/src/services/lsp/manager.js +246 -0
- package/src/services/lsp/passiveFeedback.js +226 -0
- package/src/services/mcp/InProcessTransport.js +54 -0
- package/src/services/mcp/MCPConnectionManager.js +50 -0
- package/src/services/mcp/SdkControlTransport.js +115 -0
- package/src/services/mcp/auth.js +1882 -0
- package/src/services/mcp/channelAllowlist.js +57 -0
- package/src/services/mcp/channelNotification.js +235 -0
- package/src/services/mcp/channelPermissions.js +192 -0
- package/src/services/mcp/claudeai.js +123 -0
- package/src/services/mcp/client.js +2478 -0
- package/src/services/mcp/config.js +1271 -0
- package/src/services/mcp/elicitationHandler.js +192 -0
- package/src/services/mcp/envExpansion.js +30 -0
- package/src/services/mcp/headersHelper.js +93 -0
- package/src/services/mcp/mcpStringUtils.js +85 -0
- package/src/services/mcp/normalization.js +21 -0
- package/src/services/mcp/oauthPort.js +69 -0
- package/src/services/mcp/officialRegistry.js +20 -0
- package/src/services/mcp/types.js +94 -0
- package/src/services/mcp/useManageMCPConnections.js +818 -0
- package/src/services/mcp/utils.js +433 -0
- package/src/services/mcp/vscodeSdkMcp.js +69 -0
- package/src/services/mcp/xaa.js +342 -0
- package/src/services/mcp/xaaIdpLogin.js +377 -0
- package/src/services/mcpServerApproval.js +30 -0
- package/src/services/mockRateLimits.js +666 -0
- package/src/services/notifier.js +114 -0
- package/src/services/oauth/auth-code-listener.js +165 -0
- package/src/services/oauth/client.js +397 -0
- package/src/services/oauth/crypto.js +19 -0
- package/src/services/oauth/getOauthProfile.js +48 -0
- package/src/services/oauth/index.js +133 -0
- package/src/services/plugins/PluginInstallationManager.js +139 -0
- package/src/services/plugins/pluginCliCommands.js +230 -0
- package/src/services/plugins/pluginOperations.js +826 -0
- package/src/services/policyLimits/index.js +547 -0
- package/src/services/policyLimits/types.js +9 -0
- package/src/services/preventSleep.js +143 -0
- package/src/services/rateLimitMessages.js +271 -0
- package/src/services/rateLimitMocking.js +91 -0
- package/src/services/remoteManagedSettings/index.js +534 -0
- package/src/services/remoteManagedSettings/securityCheck.js +60 -0
- package/src/services/remoteManagedSettings/syncCache.js +90 -0
- package/src/services/remoteManagedSettings/syncCacheState.js +89 -0
- package/src/services/remoteManagedSettings/types.js +12 -0
- package/src/services/sessionTranscript/sessionTranscript.js +5 -0
- package/src/services/settingsSync/index.js +478 -0
- package/src/services/settingsSync/types.js +35 -0
- package/src/services/skillSearch/featureCheck.js +8 -0
- package/src/services/skillSearch/localSearch.js +5 -0
- package/src/services/skillSearch/prefetch.js +8 -0
- package/src/services/skillSearch/remoteSkillLoader.js +8 -0
- package/src/services/skillSearch/remoteSkillState.js +11 -0
- package/src/services/skillSearch/signals.js +3 -0
- package/src/services/skillSearch/telemetry.js +8 -0
- package/src/services/teamMemorySync/index.js +976 -0
- package/src/services/teamMemorySync/secretScanner.js +275 -0
- package/src/services/teamMemorySync/teamMemSecretGuard.js +33 -0
- package/src/services/teamMemorySync/types.js +47 -0
- package/src/services/teamMemorySync/watcher.js +326 -0
- package/src/services/thaddeusAuth.js +485 -0
- package/src/services/thaddeusAuthTypes.js +9 -0
- package/src/services/thaddeusLoginFlow.js +236 -0
- package/src/services/tips/tipHistory.js +17 -0
- package/src/services/tips/tipRegistry.js +593 -0
- package/src/services/tips/tipScheduler.js +40 -0
- package/src/services/tokenEstimation.js +365 -0
- package/src/services/toolUseSummary/toolUseSummaryGenerator.js +87 -0
- package/src/services/tools/StreamingToolExecutor.js +413 -0
- package/src/services/tools/toolExecution.js +1309 -0
- package/src/services/tools/toolHooks.js +454 -0
- package/src/services/tools/toolOrchestration.js +110 -0
- package/src/services/vcr.js +291 -0
- package/src/services/voice.js +392 -0
- package/src/services/voiceKeyterms.js +94 -0
- package/src/services/voiceStreamSTT.js +405 -0
- package/src/setup.js +310 -0
- package/src/skills/bundled/batch.js +114 -0
- package/src/skills/bundled/claudeApi.js +145 -0
- package/src/skills/bundled/claudeApiContent.js +71 -0
- package/src/skills/bundled/claudeInChrome.js +27 -0
- package/src/skills/bundled/debug.js +99 -0
- package/src/skills/bundled/dream.js +49 -0
- package/src/skills/bundled/emailSetup.js +196 -0
- package/src/skills/bundled/hunter.js +28 -0
- package/src/skills/bundled/index.js +80 -0
- package/src/skills/bundled/keybindings.js +292 -0
- package/src/skills/bundled/loop.js +81 -0
- package/src/skills/bundled/loremIpsum.js +264 -0
- package/src/skills/bundled/reactor.js +31 -0
- package/src/skills/bundled/remember.js +73 -0
- package/src/skills/bundled/runSkillGenerator.js +12 -0
- package/src/skills/bundled/scheduleRemoteAgents.js +373 -0
- package/src/skills/bundled/simplify.js +66 -0
- package/src/skills/bundled/skillify.js +182 -0
- package/src/skills/bundled/stuck.js +69 -0
- package/src/skills/bundled/updateConfig.js +463 -0
- package/src/skills/bundled/verify.js +23 -0
- package/src/skills/bundled/verifyContent.js +10 -0
- package/src/skills/bundledSkills.js +159 -0
- package/src/skills/loadSkillsDir.js +736 -0
- package/src/skills/mcpSkillBuilders.js +10 -0
- package/src/skills/mcpSkills.js +5 -0
- package/src/state/AppState.js +182 -0
- package/src/state/AppStateStore.js +117 -0
- package/src/state/onChangeAppState.js +132 -0
- package/src/state/selectors.js +51 -0
- package/src/state/store.js +21 -0
- package/src/state/teammateViewHelpers.js +124 -0
- package/src/stubs/ant-chrome-mcp/index.js +4 -0
- package/src/stubs/ant-computer-use-input/index.js +2 -0
- package/src/stubs/ant-computer-use-mcp/index.js +7 -0
- package/src/stubs/ant-computer-use-mcp/sentinelApps.js +2 -0
- package/src/stubs/ant-computer-use-mcp/types.js +3 -0
- package/src/stubs/ant-computer-use-swift/index.js +1 -0
- package/src/stubs/anthropic-sandbox/index.js +34 -0
- package/src/tasks/DreamTask/DreamTask.js +99 -0
- package/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +116 -0
- package/src/tasks/InProcessTeammateTask/types.js +35 -0
- package/src/tasks/LocalAgentTask/LocalAgentTask.js +507 -0
- package/src/tasks/LocalMainSessionTask.js +338 -0
- package/src/tasks/LocalShellTask/LocalShellTask.js +475 -0
- package/src/tasks/LocalShellTask/guards.js +9 -0
- package/src/tasks/LocalShellTask/killShellTasks.js +59 -0
- package/src/tasks/LocalWorkflowTask/LocalWorkflowTask.js +7 -0
- package/src/tasks/MonitorMcpTask/MonitorMcpTask.js +20 -0
- package/src/tasks/RemoteAgentTask/RemoteAgentTask.js +742 -0
- package/src/tasks/pillLabel.js +69 -0
- package/src/tasks/stopTask.js +67 -0
- package/src/tasks/types.js +18 -0
- package/src/tasks.js +37 -0
- package/src/tools/AIEmployeesTool/AIEmployeesTool.js +674 -0
- package/src/tools/AIEmployeesTool/constants.js +1 -0
- package/src/tools/AIEmployeesTool/prompt.js +56 -0
- package/src/tools/AgentTool/AgentTool.js +1221 -0
- package/src/tools/AgentTool/UI.js +593 -0
- package/src/tools/AgentTool/agentColorManager.js +43 -0
- package/src/tools/AgentTool/agentDisplay.js +72 -0
- package/src/tools/AgentTool/agentMemory.js +125 -0
- package/src/tools/AgentTool/agentMemorySnapshot.js +136 -0
- package/src/tools/AgentTool/agentToolUtils.js +456 -0
- package/src/tools/AgentTool/built-in/exploreAgent.js +76 -0
- package/src/tools/AgentTool/built-in/generalPurposeAgent.js +28 -0
- package/src/tools/AgentTool/built-in/planAgent.js +87 -0
- package/src/tools/AgentTool/built-in/statuslineSetup.js +140 -0
- package/src/tools/AgentTool/built-in/thaddeusGuideAgent.js +174 -0
- package/src/tools/AgentTool/built-in/verificationAgent.js +146 -0
- package/src/tools/AgentTool/builtInAgents.js +56 -0
- package/src/tools/AgentTool/constants.js +11 -0
- package/src/tools/AgentTool/forkSubagent.js +177 -0
- package/src/tools/AgentTool/loadAgentsDir.js +497 -0
- package/src/tools/AgentTool/prompt.js +260 -0
- package/src/tools/AgentTool/resumeAgent.js +182 -0
- package/src/tools/AgentTool/runAgent.js +627 -0
- package/src/tools/AppointmentsTool/AppointmentsTool.js +628 -0
- package/src/tools/AppointmentsTool/constants.js +1 -0
- package/src/tools/AppointmentsTool/prompt.js +15 -0
- package/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +238 -0
- package/src/tools/AskUserQuestionTool/prompt.js +38 -0
- package/src/tools/BashTool/BashTool.js +1009 -0
- package/src/tools/BashTool/BashToolResultMessage.js +169 -0
- package/src/tools/BashTool/UI.js +134 -0
- package/src/tools/BashTool/bashCommandHelpers.js +184 -0
- package/src/tools/BashTool/bashPermissions.js +2023 -0
- package/src/tools/BashTool/bashSecurity.js +2267 -0
- package/src/tools/BashTool/commandSemantics.js +105 -0
- package/src/tools/BashTool/commentLabel.js +14 -0
- package/src/tools/BashTool/destructiveCommandWarning.js +88 -0
- package/src/tools/BashTool/modeValidation.js +86 -0
- package/src/tools/BashTool/pathValidation.js +1079 -0
- package/src/tools/BashTool/prompt.js +333 -0
- package/src/tools/BashTool/readOnlyValidation.js +1794 -0
- package/src/tools/BashTool/sedEditParser.js +282 -0
- package/src/tools/BashTool/sedValidation.js +580 -0
- package/src/tools/BashTool/shouldUseSandbox.js +125 -0
- package/src/tools/BashTool/toolName.js +2 -0
- package/src/tools/BashTool/utils.js +180 -0
- package/src/tools/BriefTool/BriefTool.js +173 -0
- package/src/tools/BriefTool/UI.js +67 -0
- package/src/tools/BriefTool/attachments.js +86 -0
- package/src/tools/BriefTool/prompt.js +19 -0
- package/src/tools/BriefTool/upload.js +136 -0
- package/src/tools/CalendarTool/CalendarTool.js +498 -0
- package/src/tools/CalendarTool/constants.js +1 -0
- package/src/tools/CalendarTool/prompt.js +11 -0
- package/src/tools/ConfigTool/ConfigTool.js +398 -0
- package/src/tools/ConfigTool/UI.js +25 -0
- package/src/tools/ConfigTool/constants.js +1 -0
- package/src/tools/ConfigTool/prompt.js +82 -0
- package/src/tools/ConfigTool/supportedSettings.js +180 -0
- package/src/tools/ContactsTool/ContactsTool.js +648 -0
- package/src/tools/ContactsTool/constants.js +1 -0
- package/src/tools/ContactsTool/prompt.js +15 -0
- package/src/tools/CtxInspectTool/CtxInspectTool.js +44 -0
- package/src/tools/DiscoverSkillsTool/prompt.js +4 -0
- package/src/tools/EmailReadTool/index.js +410 -0
- package/src/tools/EmailSendTool/index.js +178 -0
- package/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +98 -0
- package/src/tools/EnterPlanModeTool/UI.js +14 -0
- package/src/tools/EnterPlanModeTool/constants.js +1 -0
- package/src/tools/EnterPlanModeTool/prompt.js +164 -0
- package/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +104 -0
- package/src/tools/EnterWorktreeTool/UI.js +9 -0
- package/src/tools/EnterWorktreeTool/constants.js +1 -0
- package/src/tools/EnterWorktreeTool/prompt.js +30 -0
- package/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +383 -0
- package/src/tools/ExitPlanModeTool/UI.js +32 -0
- package/src/tools/ExitPlanModeTool/constants.js +2 -0
- package/src/tools/ExitPlanModeTool/prompt.js +27 -0
- package/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +257 -0
- package/src/tools/ExitWorktreeTool/UI.js +10 -0
- package/src/tools/ExitWorktreeTool/constants.js +1 -0
- package/src/tools/ExitWorktreeTool/prompt.js +32 -0
- package/src/tools/FileEditTool/FileEditTool.js +480 -0
- package/src/tools/FileEditTool/UI.js +202 -0
- package/src/tools/FileEditTool/constants.js +7 -0
- package/src/tools/FileEditTool/prompt.js +24 -0
- package/src/tools/FileEditTool/types.js +50 -0
- package/src/tools/FileEditTool/utils.js +579 -0
- package/src/tools/FileReadTool/FileReadTool.js +889 -0
- package/src/tools/FileReadTool/UI.js +126 -0
- package/src/tools/FileReadTool/imageProcessor.js +46 -0
- package/src/tools/FileReadTool/limits.js +70 -0
- package/src/tools/FileReadTool/prompt.js +31 -0
- package/src/tools/FileWriteTool/FileWriteTool.js +341 -0
- package/src/tools/FileWriteTool/UI.js +339 -0
- package/src/tools/FileWriteTool/prompt.js +15 -0
- package/src/tools/GlobTool/GlobTool.js +161 -0
- package/src/tools/GlobTool/UI.js +40 -0
- package/src/tools/GlobTool/prompt.js +6 -0
- package/src/tools/GrepTool/GrepTool.js +439 -0
- package/src/tools/GrepTool/UI.js +155 -0
- package/src/tools/GrepTool/prompt.js +16 -0
- package/src/tools/IntegrationsTool/IntegrationsTool.js +217 -0
- package/src/tools/IntegrationsTool/constants.js +1 -0
- package/src/tools/IntegrationsTool/prompt.js +41 -0
- package/src/tools/InteractionsTool/InteractionsTool.js +525 -0
- package/src/tools/InteractionsTool/constants.js +1 -0
- package/src/tools/InteractionsTool/prompt.js +14 -0
- package/src/tools/InvoicesTool/InvoicesTool.js +581 -0
- package/src/tools/InvoicesTool/constants.js +1 -0
- package/src/tools/InvoicesTool/prompt.js +15 -0
- package/src/tools/LSPTool/LSPTool.js +660 -0
- package/src/tools/LSPTool/UI.js +205 -0
- package/src/tools/LSPTool/formatters.js +445 -0
- package/src/tools/LSPTool/prompt.js +20 -0
- package/src/tools/LSPTool/schemas.js +197 -0
- package/src/tools/LSPTool/symbolContext.js +75 -0
- package/src/tools/LeadScorerTool/LeadScorerTool.js +509 -0
- package/src/tools/LeadScorerTool/constants.js +1 -0
- package/src/tools/LeadScorerTool/prompt.js +11 -0
- package/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +100 -0
- package/src/tools/ListMcpResourcesTool/UI.js +17 -0
- package/src/tools/ListMcpResourcesTool/prompt.js +18 -0
- package/src/tools/ListPeersTool/ListPeersTool.js +45 -0
- package/src/tools/MCPTool/MCPTool.js +60 -0
- package/src/tools/MCPTool/UI.js +343 -0
- package/src/tools/MCPTool/classifyForCollapse.js +597 -0
- package/src/tools/MCPTool/prompt.js +3 -0
- package/src/tools/McpAuthTool/McpAuthTool.js +162 -0
- package/src/tools/MonitorTool/MonitorTool.js +55 -0
- package/src/tools/NotebookEditTool/NotebookEditTool.js +421 -0
- package/src/tools/NotebookEditTool/UI.js +41 -0
- package/src/tools/NotebookEditTool/constants.js +2 -0
- package/src/tools/NotebookEditTool/prompt.js +2 -0
- package/src/tools/OverflowTestTool/OverflowTestTool.js +51 -0
- package/src/tools/PhoneBridgeTool/PhoneBridgeTool.js +301 -0
- package/src/tools/PhoneBridgeTool/constants.js +1 -0
- package/src/tools/PhoneBridgeTool/prompt.js +26 -0
- package/src/tools/PowerShellTool/PowerShellTool.js +900 -0
- package/src/tools/PowerShellTool/UI.js +58 -0
- package/src/tools/PowerShellTool/clmTypes.js +207 -0
- package/src/tools/PowerShellTool/commandSemantics.js +115 -0
- package/src/tools/PowerShellTool/commonParameters.js +27 -0
- package/src/tools/PowerShellTool/destructiveCommandWarning.js +92 -0
- package/src/tools/PowerShellTool/gitSafety.js +185 -0
- package/src/tools/PowerShellTool/modeValidation.js +357 -0
- package/src/tools/PowerShellTool/pathValidation.js +1712 -0
- package/src/tools/PowerShellTool/powershellPermissions.js +1351 -0
- package/src/tools/PowerShellTool/powershellSecurity.js +942 -0
- package/src/tools/PowerShellTool/prompt.js +132 -0
- package/src/tools/PowerShellTool/readOnlyValidation.js +1633 -0
- package/src/tools/PowerShellTool/toolName.js +2 -0
- package/src/tools/PushNotificationTool/PushNotificationTool.js +35 -0
- package/src/tools/REPLTool/REPLTool.js +44 -0
- package/src/tools/REPLTool/constants.js +43 -0
- package/src/tools/REPLTool/primitiveTools.js +36 -0
- package/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +112 -0
- package/src/tools/ReadMcpResourceTool/UI.js +24 -0
- package/src/tools/ReadMcpResourceTool/prompt.js +15 -0
- package/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +142 -0
- package/src/tools/RemoteTriggerTool/UI.js +12 -0
- package/src/tools/RemoteTriggerTool/prompt.js +12 -0
- package/src/tools/ReviewArtifactTool/ReviewArtifactTool.js +51 -0
- package/src/tools/ScheduleCronTool/CronCreateTool.js +120 -0
- package/src/tools/ScheduleCronTool/CronDeleteTool.js +74 -0
- package/src/tools/ScheduleCronTool/CronListTool.js +77 -0
- package/src/tools/ScheduleCronTool/UI.js +29 -0
- package/src/tools/ScheduleCronTool/prompt.js +115 -0
- package/src/tools/SendMessageTool/SendMessageTool.js +673 -0
- package/src/tools/SendMessageTool/UI.js +24 -0
- package/src/tools/SendMessageTool/constants.js +1 -0
- package/src/tools/SendMessageTool/prompt.js +47 -0
- package/src/tools/SendUserFileTool/SendUserFileTool.js +35 -0
- package/src/tools/SendUserFileTool/prompt.js +5 -0
- package/src/tools/SkillTool/SkillTool.js +825 -0
- package/src/tools/SkillTool/UI.js +61 -0
- package/src/tools/SkillTool/constants.js +1 -0
- package/src/tools/SkillTool/prompt.js +184 -0
- package/src/tools/SleepTool/SleepTool.js +42 -0
- package/src/tools/SleepTool/prompt.js +14 -0
- package/src/tools/SnipTool/SnipTool.js +47 -0
- package/src/tools/SnipTool/prompt.js +5 -0
- package/src/tools/SubscribePRTool/SubscribePRTool.js +49 -0
- package/src/tools/SuggestBackgroundPRTool/SuggestBackgroundPRTool.js +44 -0
- package/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +138 -0
- package/src/tools/SyntheticOutputTool/SyntheticOutputTool.ts +1 -1
- package/src/tools/TaskCreateTool/TaskCreateTool.js +104 -0
- package/src/tools/TaskCreateTool/constants.js +1 -0
- package/src/tools/TaskCreateTool/prompt.js +52 -0
- package/src/tools/TaskGetTool/TaskGetTool.js +106 -0
- package/src/tools/TaskGetTool/constants.js +1 -0
- package/src/tools/TaskGetTool/prompt.js +23 -0
- package/src/tools/TaskListTool/TaskListTool.js +89 -0
- package/src/tools/TaskListTool/constants.js +1 -0
- package/src/tools/TaskListTool/prompt.js +44 -0
- package/src/tools/TaskOutputTool/TaskOutputTool.js +536 -0
- package/src/tools/TaskOutputTool/constants.js +1 -0
- package/src/tools/TaskStopTool/TaskStopTool.js +110 -0
- package/src/tools/TaskStopTool/UI.js +31 -0
- package/src/tools/TaskStopTool/prompt.js +7 -0
- package/src/tools/TaskUpdateTool/TaskUpdateTool.js +301 -0
- package/src/tools/TaskUpdateTool/constants.js +1 -0
- package/src/tools/TaskUpdateTool/prompt.js +76 -0
- package/src/tools/TeamCreateTool/TeamCreateTool.js +177 -0
- package/src/tools/TeamCreateTool/UI.js +4 -0
- package/src/tools/TeamCreateTool/constants.js +1 -0
- package/src/tools/TeamCreateTool/prompt.js +113 -0
- package/src/tools/TeamDeleteTool/TeamDeleteTool.js +102 -0
- package/src/tools/TeamDeleteTool/UI.js +13 -0
- package/src/tools/TeamDeleteTool/constants.js +1 -0
- package/src/tools/TeamDeleteTool/prompt.js +16 -0
- package/src/tools/TerminalCaptureTool/TerminalCaptureTool.js +47 -0
- package/src/tools/TerminalCaptureTool/prompt.js +11 -0
- package/src/tools/TodoWriteTool/TodoWriteTool.js +99 -0
- package/src/tools/TodoWriteTool/constants.js +1 -0
- package/src/tools/TodoWriteTool/prompt.js +181 -0
- package/src/tools/ToolSearchTool/ToolSearchTool.js +357 -0
- package/src/tools/ToolSearchTool/constants.js +1 -0
- package/src/tools/ToolSearchTool/prompt.js +97 -0
- package/src/tools/TungstenTool/TungstenLiveMonitor.js +7 -0
- package/src/tools/TungstenTool/TungstenTool.js +3 -0
- package/src/tools/VerifyPlanExecutionTool/VerifyPlanExecutionTool.js +45 -0
- package/src/tools/VerifyPlanExecutionTool/constants.js +2 -0
- package/src/tools/WebBrowserTool/WebBrowserPanel.js +5 -0
- package/src/tools/WebBrowserTool/WebBrowserTool.js +58 -0
- package/src/tools/WebFetchTool/UI.js +31 -0
- package/src/tools/WebFetchTool/WebFetchTool.js +246 -0
- package/src/tools/WebFetchTool/preapproved.js +154 -0
- package/src/tools/WebFetchTool/prompt.js +39 -0
- package/src/tools/WebFetchTool/utils.js +368 -0
- package/src/tools/WebSearchTool/UI.js +67 -0
- package/src/tools/WebSearchTool/WebSearchTool.js +396 -0
- package/src/tools/WebSearchTool/prompt.js +32 -0
- package/src/tools/WorkflowTool/WorkflowPermissionRequest.js +7 -0
- package/src/tools/WorkflowTool/WorkflowTool.js +51 -0
- package/src/tools/WorkflowTool/bundled/index.js +5 -0
- package/src/tools/WorkflowTool/constants.js +1 -0
- package/src/tools/WorkflowTool/createWorkflowCommand.js +5 -0
- package/src/tools/shared/gitOperationTracking.js +220 -0
- package/src/tools/shared/spawnMultiAgent.js +805 -0
- package/src/tools/testing/TestingPermissionTool.js +72 -0
- package/src/tools/utils.js +24 -0
- package/src/tools.js +365 -0
- package/src/types/command.js +8 -0
- package/src/types/connectorText.js +3 -0
- package/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +673 -0
- package/src/types/generated/events_mono/common/v1/auth.js +49 -0
- package/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +147 -0
- package/src/types/generated/google/protobuf/timestamp.js +38 -0
- package/src/types/hooks.js +153 -0
- package/src/types/ids.js +27 -0
- package/src/types/logs.js +11 -0
- package/src/types/permissions.js +25 -0
- package/src/types/plugin.js +72 -0
- package/src/types/textInputTypes.js +20 -0
- package/src/upstreamproxy/relay.js +346 -0
- package/src/upstreamproxy/upstreamproxy.js +234 -0
- package/src/utils/CircularBuffer.js +75 -0
- package/src/utils/Cursor.js +1229 -0
- package/src/utils/QueryGuard.js +115 -0
- package/src/utils/Shell.js +374 -0
- package/src/utils/ShellCommand.js +336 -0
- package/src/utils/abortController.js +74 -0
- package/src/utils/activityManager.js +127 -0
- package/src/utils/advisor.js +77 -0
- package/src/utils/agentContext.js +91 -0
- package/src/utils/agentId.js +83 -0
- package/src/utils/agentSwarmsEnabled.js +37 -0
- package/src/utils/agenticSessionSearch.js +255 -0
- package/src/utils/analyzeContext.js +846 -0
- package/src/utils/ansiToPng.js +259 -0
- package/src/utils/ansiToSvg.js +207 -0
- package/src/utils/api.js +555 -0
- package/src/utils/apiPreconnect.js +62 -0
- package/src/utils/appleTerminalBackup.js +95 -0
- package/src/utils/argumentSubstitution.js +114 -0
- package/src/utils/array.js +12 -0
- package/src/utils/asciicast.js +200 -0
- package/src/utils/attachments.js +2518 -0
- package/src/utils/attribution.js +308 -0
- package/src/utils/auth.js +1598 -0
- package/src/utils/authFileDescriptor.js +152 -0
- package/src/utils/authPortable.js +14 -0
- package/src/utils/autoModeDenials.js +15 -0
- package/src/utils/autoRunIssue.js +113 -0
- package/src/utils/autoUpdater.js +457 -0
- package/src/utils/aws.js +44 -0
- package/src/utils/awsAuthStatusManager.js +66 -0
- package/src/utils/background/remote/preconditions.js +175 -0
- package/src/utils/background/remote/remoteSession.js +53 -0
- package/src/utils/backgroundHousekeeping.js +64 -0
- package/src/utils/bash/ParsedCommand.js +241 -0
- package/src/utils/bash/ShellSnapshot.js +489 -0
- package/src/utils/bash/ast.js +2590 -0
- package/src/utils/bash/bashParser.js +4355 -0
- package/src/utils/bash/bashPipeCommand.js +249 -0
- package/src/utils/bash/commands.js +1131 -0
- package/src/utils/bash/heredoc.js +647 -0
- package/src/utils/bash/parser.js +195 -0
- package/src/utils/bash/prefix.js +154 -0
- package/src/utils/bash/registry.js +23 -0
- package/src/utils/bash/shellCompletion.js +196 -0
- package/src/utils/bash/shellPrefix.js +25 -0
- package/src/utils/bash/shellQuote.js +253 -0
- package/src/utils/bash/shellQuoting.js +106 -0
- package/src/utils/bash/specs/alias.js +11 -0
- package/src/utils/bash/specs/index.js +16 -0
- package/src/utils/bash/specs/nohup.js +10 -0
- package/src/utils/bash/specs/pyright.js +88 -0
- package/src/utils/bash/specs/sleep.js +10 -0
- package/src/utils/bash/specs/srun.js +28 -0
- package/src/utils/bash/specs/time.js +10 -0
- package/src/utils/bash/specs/timeout.js +17 -0
- package/src/utils/bash/treeSitterAnalysis.js +407 -0
- package/src/utils/betas.js +331 -0
- package/src/utils/billing.js +54 -0
- package/src/utils/binaryCheck.js +40 -0
- package/src/utils/browser.js +58 -0
- package/src/utils/bufferedWriter.js +77 -0
- package/src/utils/bundledMode.js +19 -0
- package/src/utils/businessDb.js +390 -0
- package/src/utils/caCerts.js +91 -0
- package/src/utils/caCertsConfig.js +77 -0
- package/src/utils/cachePaths.js +28 -0
- package/src/utils/classifierApprovals.js +66 -0
- package/src/utils/classifierApprovalsHook.js +10 -0
- package/src/utils/claudeDesktop.js +108 -0
- package/src/utils/claudeInChrome/chromeNativeHost.js +416 -0
- package/src/utils/claudeInChrome/common.js +466 -0
- package/src/utils/claudeInChrome/mcpServer.js +237 -0
- package/src/utils/claudeInChrome/prompt.js +79 -0
- package/src/utils/claudeInChrome/setup.js +304 -0
- package/src/utils/claudeInChrome/setupPortable.js +172 -0
- package/src/utils/claudeInChrome/toolRendering.js +235 -0
- package/src/utils/claudemd.js +1052 -0
- package/src/utils/cleanup.js +514 -0
- package/src/utils/cleanupRegistry.js +22 -0
- package/src/utils/cliArgs.js +53 -0
- package/src/utils/cliHighlight.js +45 -0
- package/src/utils/codeIndexing.js +149 -0
- package/src/utils/collapseBackgroundBashNotifications.js +70 -0
- package/src/utils/collapseHookSummaries.js +48 -0
- package/src/utils/collapseReadSearch.js +869 -0
- package/src/utils/collapseTeammateShutdowns.js +44 -0
- package/src/utils/combinedAbortSignal.js +40 -0
- package/src/utils/commandLifecycle.js +7 -0
- package/src/utils/commitAttribution.js +718 -0
- package/src/utils/completionCache.js +138 -0
- package/src/utils/computerUse/appNames.js +170 -0
- package/src/utils/computerUse/cleanup.js +65 -0
- package/src/utils/computerUse/common.js +56 -0
- package/src/utils/computerUse/computerUseLock.js +183 -0
- package/src/utils/computerUse/drainRunLoop.js +71 -0
- package/src/utils/computerUse/escHotkey.js +53 -0
- package/src/utils/computerUse/executor.js +480 -0
- package/src/utils/computerUse/gates.js +55 -0
- package/src/utils/computerUse/hostAdapter.js +62 -0
- package/src/utils/computerUse/inputLoader.js +25 -0
- package/src/utils/computerUse/mcpServer.js +84 -0
- package/src/utils/computerUse/setup.js +42 -0
- package/src/utils/computerUse/swiftLoader.js +18 -0
- package/src/utils/computerUse/toolRendering.js +101 -0
- package/src/utils/computerUse/wrapper.js +317 -0
- package/src/utils/concurrentSessions.js +179 -0
- package/src/utils/config.js +1078 -0
- package/src/utils/configConstants.js +18 -0
- package/src/utils/contentArray.js +45 -0
- package/src/utils/context.js +185 -0
- package/src/utils/contextAnalysis.js +171 -0
- package/src/utils/contextSuggestions.js +158 -0
- package/src/utils/controlMessageCompat.js +31 -0
- package/src/utils/conversationRecovery.js +434 -0
- package/src/utils/cron.js +260 -0
- package/src/utils/cronJitterConfig.js +62 -0
- package/src/utils/cronScheduler.js +388 -0
- package/src/utils/cronTasks.js +328 -0
- package/src/utils/cronTasksLock.js +159 -0
- package/src/utils/crossProjectResume.js +46 -0
- package/src/utils/crypto.js +13 -0
- package/src/utils/cwd.js +29 -0
- package/src/utils/debug.js +220 -0
- package/src/utils/debugFilter.js +125 -0
- package/src/utils/deepLink/banner.js +103 -0
- package/src/utils/deepLink/parseDeepLink.js +138 -0
- package/src/utils/deepLink/protocolHandler.js +119 -0
- package/src/utils/deepLink/registerProtocol.js +291 -0
- package/src/utils/deepLink/terminalLauncher.js +455 -0
- package/src/utils/deepLink/terminalPreference.js +51 -0
- package/src/utils/desktopDeepLink.js +208 -0
- package/src/utils/detectRepository.js +157 -0
- package/src/utils/diagLogs.js +74 -0
- package/src/utils/diff.js +108 -0
- package/src/utils/directMemberMessage.js +34 -0
- package/src/utils/displayTags.js +46 -0
- package/src/utils/doctorContextWarnings.js +179 -0
- package/src/utils/doctorDiagnostic.js +494 -0
- package/src/utils/dxt/helpers.js +64 -0
- package/src/utils/dxt/zip.js +167 -0
- package/src/utils/earlyInput.js +166 -0
- package/src/utils/editor.js +163 -0
- package/src/utils/effort.js +271 -0
- package/src/utils/embeddedTools.js +26 -0
- package/src/utils/employeeChat.js +271 -0
- package/src/utils/employeeDb.js +326 -0
- package/src/utils/env.js +358 -0
- package/src/utils/envDynamic.js +130 -0
- package/src/utils/envUtils.js +161 -0
- package/src/utils/envValidation.js +26 -0
- package/src/utils/errorLogSink.js +196 -0
- package/src/utils/errors.js +207 -0
- package/src/utils/exampleCommands.js +165 -0
- package/src/utils/execFileNoThrow.js +93 -0
- package/src/utils/execFileNoThrowPortable.js +49 -0
- package/src/utils/execSyncWrapper.js +6 -0
- package/src/utils/exportRenderer.js +71 -0
- package/src/utils/extraUsage.js +19 -0
- package/src/utils/fastMode.js +393 -0
- package/src/utils/file.js +467 -0
- package/src/utils/fileHistory.js +851 -0
- package/src/utils/fileOperationAnalytics.js +45 -0
- package/src/utils/filePersistence/filePersistence.js +212 -0
- package/src/utils/filePersistence/outputsScanner.js +104 -0
- package/src/utils/filePersistence/types.js +4 -0
- package/src/utils/fileRead.js +81 -0
- package/src/utils/fileReadCache.js +78 -0
- package/src/utils/fileStateCache.js +99 -0
- package/src/utils/findExecutable.js +13 -0
- package/src/utils/fingerprint.js +58 -0
- package/src/utils/forkedAgent.js +410 -0
- package/src/utils/format.js +238 -0
- package/src/utils/formatBriefTimestamp.js +72 -0
- package/src/utils/fpsTracker.js +34 -0
- package/src/utils/frontmatterParser.js +260 -0
- package/src/utils/fsOperations.js +555 -0
- package/src/utils/fullscreen.js +194 -0
- package/src/utils/generatedFiles.js +122 -0
- package/src/utils/generators.js +67 -0
- package/src/utils/genericProcessUtils.js +155 -0
- package/src/utils/getWorktreePaths.js +56 -0
- package/src/utils/getWorktreePathsPortable.js +23 -0
- package/src/utils/ghPrStatus.js +71 -0
- package/src/utils/git/gitConfigParser.js +226 -0
- package/src/utils/git/gitFilesystem.js +606 -0
- package/src/utils/git/gitignore.js +84 -0
- package/src/utils/git.js +725 -0
- package/src/utils/gitDiff.js +395 -0
- package/src/utils/gitSettings.js +18 -0
- package/src/utils/github/ghAuthStatus.js +23 -0
- package/src/utils/githubRepoPathMapping.js +135 -0
- package/src/utils/glob.js +90 -0
- package/src/utils/gracefulShutdown.js +447 -0
- package/src/utils/groupToolUses.js +126 -0
- package/src/utils/handlePromptSubmit.js +398 -0
- package/src/utils/hash.js +44 -0
- package/src/utils/headlessProfiler.js +147 -0
- package/src/utils/heapDumpService.js +201 -0
- package/src/utils/heatmap.js +151 -0
- package/src/utils/highlightMatch.js +29 -0
- package/src/utils/hooks/AsyncHookRegistry.js +187 -0
- package/src/utils/hooks/apiQueryHookHelper.js +77 -0
- package/src/utils/hooks/execAgentHook.js +257 -0
- package/src/utils/hooks/execHttpHook.js +184 -0
- package/src/utils/hooks/execPromptHook.js +171 -0
- package/src/utils/hooks/fileChangedWatcher.js +161 -0
- package/src/utils/hooks/hookEvents.js +111 -0
- package/src/utils/hooks/hookHelpers.js +60 -0
- package/src/utils/hooks/hooksConfigManager.js +323 -0
- package/src/utils/hooks/hooksConfigSnapshot.js +114 -0
- package/src/utils/hooks/hooksSettings.js +204 -0
- package/src/utils/hooks/postSamplingHooks.js +39 -0
- package/src/utils/hooks/registerFrontmatterHooks.js +47 -0
- package/src/utils/hooks/registerSkillHooks.js +40 -0
- package/src/utils/hooks/sessionHooks.js +252 -0
- package/src/utils/hooks/skillImprovement.js +211 -0
- package/src/utils/hooks/ssrfGuard.js +258 -0
- package/src/utils/hooks.js +3668 -0
- package/src/utils/horizontalScroll.js +108 -0
- package/src/utils/http.js +120 -0
- package/src/utils/hyperlink.js +28 -0
- package/src/utils/iTermBackup.js +48 -0
- package/src/utils/ide.js +1195 -0
- package/src/utils/idePathConversion.js +66 -0
- package/src/utils/idleTimeout.js +44 -0
- package/src/utils/imagePaste.js +343 -0
- package/src/utils/imageResizer.js +664 -0
- package/src/utils/imageStore.js +150 -0
- package/src/utils/imageValidation.js +92 -0
- package/src/utils/immediateCommand.js +12 -0
- package/src/utils/inProcessTeammateHelpers.js +71 -0
- package/src/utils/ink.js +20 -0
- package/src/utils/intl.js +83 -0
- package/src/utils/jetbrains.js +152 -0
- package/src/utils/json.js +231 -0
- package/src/utils/jsonRead.js +14 -0
- package/src/utils/keyboardShortcuts.js +11 -0
- package/src/utils/lazySchema.js +8 -0
- package/src/utils/listSessionsImpl.js +332 -0
- package/src/utils/localInstaller.js +130 -0
- package/src/utils/lockfile.js +30 -0
- package/src/utils/log.js +280 -0
- package/src/utils/logoV2Utils.js +256 -0
- package/src/utils/mailbox.js +50 -0
- package/src/utils/managedEnv.js +160 -0
- package/src/utils/managedEnvConstants.js +185 -0
- package/src/utils/markdown.js +315 -0
- package/src/utils/markdownConfigLoader.js +480 -0
- package/src/utils/mcp/dateTimeParser.js +102 -0
- package/src/utils/mcp/elicitationValidation.js +259 -0
- package/src/utils/mcpInstructionsDelta.js +97 -0
- package/src/utils/mcpOutputStorage.js +159 -0
- package/src/utils/mcpValidation.js +165 -0
- package/src/utils/mcpWebSocketTransport.js +180 -0
- package/src/utils/memoize.js +205 -0
- package/src/utils/memory/types.js +9 -0
- package/src/utils/memory/versions.js +7 -0
- package/src/utils/memoryFileDetection.js +245 -0
- package/src/utils/messagePredicates.js +6 -0
- package/src/utils/messageQueueManager.js +430 -0
- package/src/utils/messages/mappers.js +240 -0
- package/src/utils/messages/systemInit.js +72 -0
- package/src/utils/messages.js +4286 -0
- package/src/utils/model/agent.js +128 -0
- package/src/utils/model/aliases.js +21 -0
- package/src/utils/model/antModels.js +25 -0
- package/src/utils/model/bedrock.js +220 -0
- package/src/utils/model/check1mAccess.js +64 -0
- package/src/utils/model/configs.js +86 -0
- package/src/utils/model/contextWindowUpgradeCheck.js +41 -0
- package/src/utils/model/deprecation.js +72 -0
- package/src/utils/model/model.js +533 -0
- package/src/utils/model/modelAllowlist.js +148 -0
- package/src/utils/model/modelCapabilities.js +105 -0
- package/src/utils/model/modelOptions.js +450 -0
- package/src/utils/model/modelStrings.js +144 -0
- package/src/utils/model/modelSupportOverrides.js +40 -0
- package/src/utils/model/providers.js +35 -0
- package/src/utils/model/validateModel.js +131 -0
- package/src/utils/modelCost.js +160 -0
- package/src/utils/modifiers.js +39 -0
- package/src/utils/mtls.js +132 -0
- package/src/utils/nativeInstaller/download.js +370 -0
- package/src/utils/nativeInstaller/index.js +8 -0
- package/src/utils/nativeInstaller/installer.js +1395 -0
- package/src/utils/nativeInstaller/packageManagers.js +258 -0
- package/src/utils/nativeInstaller/pidLock.js +347 -0
- package/src/utils/notebook.js +176 -0
- package/src/utils/objectGroupBy.js +15 -0
- package/src/utils/pasteStore.js +93 -0
- package/src/utils/path.js +140 -0
- package/src/utils/pdf.js +236 -0
- package/src/utils/pdfUtils.js +61 -0
- package/src/utils/peerAddress.js +20 -0
- package/src/utils/permissions/PermissionMode.js +95 -0
- package/src/utils/permissions/PermissionPromptToolResultSchema.js +85 -0
- package/src/utils/permissions/PermissionResult.js +11 -0
- package/src/utils/permissions/PermissionRule.js +19 -0
- package/src/utils/permissions/PermissionUpdate.js +268 -0
- package/src/utils/permissions/PermissionUpdateSchema.js +61 -0
- package/src/utils/permissions/autoModeState.js +31 -0
- package/src/utils/permissions/bashClassifier.js +30 -0
- package/src/utils/permissions/bypassPermissionsKillswitch.js +115 -0
- package/src/utils/permissions/classifierDecision.js +86 -0
- package/src/utils/permissions/classifierShared.js +28 -0
- package/src/utils/permissions/dangerousPatterns.js +78 -0
- package/src/utils/permissions/denialTracking.js +34 -0
- package/src/utils/permissions/filesystem.js +1411 -0
- package/src/utils/permissions/getNextPermissionMode.js +74 -0
- package/src/utils/permissions/pathValidation.js +351 -0
- package/src/utils/permissions/permissionExplainer.js +188 -0
- package/src/utils/permissions/permissionRuleParser.js +175 -0
- package/src/utils/permissions/permissionSetup.js +1162 -0
- package/src/utils/permissions/permissions.js +1063 -0
- package/src/utils/permissions/permissionsLoader.js +217 -0
- package/src/utils/permissions/shadowedRuleDetection.js +149 -0
- package/src/utils/permissions/shellRuleMatching.js +174 -0
- package/src/utils/permissions/yoloClassifier.js +1193 -0
- package/src/utils/planModeV2.js +75 -0
- package/src/utils/plans.js +334 -0
- package/src/utils/platform.js +122 -0
- package/src/utils/plugins/addDirPluginSettings.js +53 -0
- package/src/utils/plugins/cacheUtils.js +174 -0
- package/src/utils/plugins/dependencyResolver.js +244 -0
- package/src/utils/plugins/fetchTelemetry.js +108 -0
- package/src/utils/plugins/gitAvailability.js +65 -0
- package/src/utils/plugins/headlessPluginInstall.js +136 -0
- package/src/utils/plugins/hintRecommendation.js +136 -0
- package/src/utils/plugins/installCounts.js +221 -0
- package/src/utils/plugins/installedPluginsManager.js +1003 -0
- package/src/utils/plugins/loadPluginAgents.js +219 -0
- package/src/utils/plugins/loadPluginCommands.js +595 -0
- package/src/utils/plugins/loadPluginHooks.js +239 -0
- package/src/utils/plugins/loadPluginOutputStyles.js +112 -0
- package/src/utils/plugins/lspPluginIntegration.js +293 -0
- package/src/utils/plugins/lspRecommendation.js +278 -0
- package/src/utils/plugins/managedPlugins.js +26 -0
- package/src/utils/plugins/marketplaceHelpers.js +470 -0
- package/src/utils/plugins/marketplaceManager.js +1939 -0
- package/src/utils/plugins/mcpPluginIntegration.js +465 -0
- package/src/utils/plugins/mcpbHandler.js +708 -0
- package/src/utils/plugins/officialMarketplace.js +19 -0
- package/src/utils/plugins/officialMarketplaceGcs.js +202 -0
- package/src/utils/plugins/officialMarketplaceStartupCheck.js +344 -0
- package/src/utils/plugins/orphanedPluginFilter.js +96 -0
- package/src/utils/plugins/parseMarketplaceInput.js +143 -0
- package/src/utils/plugins/performStartupChecks.js +66 -0
- package/src/utils/plugins/pluginAutoupdate.js +210 -0
- package/src/utils/plugins/pluginBlocklist.js +93 -0
- package/src/utils/plugins/pluginDirectories.js +170 -0
- package/src/utils/plugins/pluginFlagging.js +173 -0
- package/src/utils/plugins/pluginIdentifier.js +78 -0
- package/src/utils/plugins/pluginInstallationHelpers.js +400 -0
- package/src/utils/plugins/pluginLoader.js +2426 -0
- package/src/utils/plugins/pluginOptionsStorage.js +311 -0
- package/src/utils/plugins/pluginPolicy.js +18 -0
- package/src/utils/plugins/pluginStartupCheck.js +261 -0
- package/src/utils/plugins/pluginVersioning.js +128 -0
- package/src/utils/plugins/reconciler.js +181 -0
- package/src/utils/plugins/refresh.js +162 -0
- package/src/utils/plugins/schemas.js +1283 -0
- package/src/utils/plugins/validatePlugin.js +765 -0
- package/src/utils/plugins/walkPluginMarkdown.js +49 -0
- package/src/utils/plugins/zipCache.js +346 -0
- package/src/utils/plugins/zipCacheAdapters.js +133 -0
- package/src/utils/powershell/dangerousCmdlets.js +174 -0
- package/src/utils/powershell/parser.js +1357 -0
- package/src/utils/powershell/staticPrefix.js +277 -0
- package/src/utils/preflightChecks.js +147 -0
- package/src/utils/privacyLevel.js +49 -0
- package/src/utils/process.js +56 -0
- package/src/utils/processUserInput/processBashCommand.js +118 -0
- package/src/utils/processUserInput/processSlashCommand.js +845 -0
- package/src/utils/processUserInput/processTextPrompt.js +68 -0
- package/src/utils/processUserInput/processUserInput.js +344 -0
- package/src/utils/profilerBase.js +32 -0
- package/src/utils/promptCategory.js +39 -0
- package/src/utils/promptEditor.js +151 -0
- package/src/utils/promptShellExecution.js +117 -0
- package/src/utils/protectedNamespace.js +4 -0
- package/src/utils/proxy.js +345 -0
- package/src/utils/queryContext.js +110 -0
- package/src/utils/queryHelpers.js +436 -0
- package/src/utils/queryProfiler.js +242 -0
- package/src/utils/queueProcessor.js +70 -0
- package/src/utils/readEditContext.js +176 -0
- package/src/utils/readFileInRange.js +278 -0
- package/src/utils/releaseNotes.js +307 -0
- package/src/utils/renderOptions.js +67 -0
- package/src/utils/ripgrep.js +521 -0
- package/src/utils/sandbox/sandbox-adapter.js +750 -0
- package/src/utils/sandbox/sandbox-ui-utils.js +11 -0
- package/src/utils/sanitization.js +72 -0
- package/src/utils/screenshotClipboard.js +89 -0
- package/src/utils/sdkEventQueue.js +49 -0
- package/src/utils/secureStorage/fallbackStorage.js +59 -0
- package/src/utils/secureStorage/index.js +13 -0
- package/src/utils/secureStorage/keychainPrefetch.js +91 -0
- package/src/utils/secureStorage/macOsKeychainHelpers.js +91 -0
- package/src/utils/secureStorage/macOsKeychainStorage.js +192 -0
- package/src/utils/secureStorage/plainTextStorage.js +81 -0
- package/src/utils/semanticBoolean.js +23 -0
- package/src/utils/semanticNumber.js +34 -0
- package/src/utils/semver.js +51 -0
- package/src/utils/sequential.js +43 -0
- package/src/utils/sessionActivity.js +120 -0
- package/src/utils/sessionEnvVars.js +18 -0
- package/src/utils/sessionEnvironment.js +131 -0
- package/src/utils/sessionFileAccessHooks.js +205 -0
- package/src/utils/sessionIngressAuth.js +113 -0
- package/src/utils/sessionRestore.js +357 -0
- package/src/utils/sessionStart.js +165 -0
- package/src/utils/sessionState.js +76 -0
- package/src/utils/sessionStorage.js +4162 -0
- package/src/utils/sessionStoragePortable.js +665 -0
- package/src/utils/sessionTitle.js +120 -0
- package/src/utils/sessionUrl.js +50 -0
- package/src/utils/set.js +50 -0
- package/src/utils/settings/allErrors.js +29 -0
- package/src/utils/settings/applySettingsChange.js +65 -0
- package/src/utils/settings/changeDetector.js +409 -0
- package/src/utils/settings/constants.js +166 -0
- package/src/utils/settings/internalWrites.js +33 -0
- package/src/utils/settings/managedPath.js +29 -0
- package/src/utils/settings/mdm/constants.js +62 -0
- package/src/utils/settings/mdm/rawRead.js +97 -0
- package/src/utils/settings/mdm/settings.js +254 -0
- package/src/utils/settings/permissionValidation.js +224 -0
- package/src/utils/settings/pluginOnlyPolicy.js +53 -0
- package/src/utils/settings/schemaOutput.js +7 -0
- package/src/utils/settings/settings.js +791 -0
- package/src/utils/settings/settingsCache.js +47 -0
- package/src/utils/settings/toolValidationConfig.js +76 -0
- package/src/utils/settings/types.js +846 -0
- package/src/utils/settings/validateEditTool.js +34 -0
- package/src/utils/settings/validation.js +192 -0
- package/src/utils/settings/validationTips.js +111 -0
- package/src/utils/shell/bashProvider.js +202 -0
- package/src/utils/shell/outputLimits.js +7 -0
- package/src/utils/shell/powershellDetection.js +96 -0
- package/src/utils/shell/powershellProvider.js +104 -0
- package/src/utils/shell/prefix.js +246 -0
- package/src/utils/shell/readOnlyCommandValidation.js +1776 -0
- package/src/utils/shell/resolveDefaultShell.js +13 -0
- package/src/utils/shell/shellProvider.js +2 -0
- package/src/utils/shell/shellToolUtils.js +21 -0
- package/src/utils/shell/specPrefix.js +198 -0
- package/src/utils/shellConfig.js +136 -0
- package/src/utils/sideQuery.js +134 -0
- package/src/utils/sideQuestion.js +121 -0
- package/src/utils/signal.js +34 -0
- package/src/utils/sinks.js +15 -0
- package/src/utils/skills/skillChangeDetector.js +264 -0
- package/src/utils/slashCommandParsing.js +46 -0
- package/src/utils/sleep.js +72 -0
- package/src/utils/sliceAnsi.js +74 -0
- package/src/utils/slowOperations.js +216 -0
- package/src/utils/standaloneAgent.js +20 -0
- package/src/utils/startupProfiler.js +149 -0
- package/src/utils/staticRender.js +104 -0
- package/src/utils/stats.js +802 -0
- package/src/utils/statsCache.js +330 -0
- package/src/utils/status.js +359 -0
- package/src/utils/statusNoticeDefinitions.js +123 -0
- package/src/utils/statusNoticeHelpers.js +15 -0
- package/src/utils/stream.js +73 -0
- package/src/utils/streamJsonStdoutGuard.js +107 -0
- package/src/utils/streamlinedTransform.js +162 -0
- package/src/utils/stringUtils.js +202 -0
- package/src/utils/subprocessEnv.js +87 -0
- package/src/utils/suggestions/commandSuggestions.js +458 -0
- package/src/utils/suggestions/directoryCompletion.js +191 -0
- package/src/utils/suggestions/shellHistoryCompletion.js +95 -0
- package/src/utils/suggestions/skillUsageTracking.js +50 -0
- package/src/utils/suggestions/slackChannelSuggestions.js +169 -0
- package/src/utils/swarm/It2SetupPrompt.js +386 -0
- package/src/utils/swarm/backends/ITermBackend.js +276 -0
- package/src/utils/swarm/backends/InProcessBackend.js +237 -0
- package/src/utils/swarm/backends/PaneBackendExecutor.js +250 -0
- package/src/utils/swarm/backends/TmuxBackend.js +574 -0
- package/src/utils/swarm/backends/detection.js +112 -0
- package/src/utils/swarm/backends/it2Setup.js +185 -0
- package/src/utils/swarm/backends/registry.js +369 -0
- package/src/utils/swarm/backends/teammateModeSnapshot.js +68 -0
- package/src/utils/swarm/backends/types.js +9 -0
- package/src/utils/swarm/constants.js +29 -0
- package/src/utils/swarm/inProcessRunner.js +1021 -0
- package/src/utils/swarm/leaderPermissionBridge.js +31 -0
- package/src/utils/swarm/permissionSync.js +667 -0
- package/src/utils/swarm/reconnection.js +82 -0
- package/src/utils/swarm/spawnInProcess.js +218 -0
- package/src/utils/swarm/spawnUtils.js +123 -0
- package/src/utils/swarm/teamHelpers.js +484 -0
- package/src/utils/swarm/teammateInit.js +87 -0
- package/src/utils/swarm/teammateLayoutManager.js +82 -0
- package/src/utils/swarm/teammateModel.js +9 -0
- package/src/utils/swarm/teammatePromptAddendum.js +17 -0
- package/src/utils/systemDirectories.js +51 -0
- package/src/utils/systemPrompt.js +88 -0
- package/src/utils/systemPromptType.js +9 -0
- package/src/utils/systemTheme.js +108 -0
- package/src/utils/taggedId.js +49 -0
- package/src/utils/task/TaskOutput.js +320 -0
- package/src/utils/task/diskOutput.js +387 -0
- package/src/utils/task/framework.js +236 -0
- package/src/utils/task/outputFormatting.js +24 -0
- package/src/utils/task/sdkProgress.js +24 -0
- package/src/utils/taskSummary.js +3 -0
- package/src/utils/tasks.js +672 -0
- package/src/utils/teamDiscovery.js +48 -0
- package/src/utils/teamMemoryOps.js +67 -0
- package/src/utils/teammate.js +237 -0
- package/src/utils/teammateContext.js +56 -0
- package/src/utils/teammateMailbox.js +793 -0
- package/src/utils/telemetry/betaSessionTracing.js +25 -0
- package/src/utils/telemetry/bigqueryExporter.js +17 -0
- package/src/utils/telemetry/events.js +7 -0
- package/src/utils/telemetry/instrumentation.js +16 -0
- package/src/utils/telemetry/logger.js +25 -0
- package/src/utils/telemetry/perfettoTracing.js +882 -0
- package/src/utils/telemetry/pluginTelemetry.js +76 -0
- package/src/utils/telemetry/sessionTracing.js +62 -0
- package/src/utils/telemetry/skillLoadedEvent.js +4 -0
- package/src/utils/telemetryAttributes.js +56 -0
- package/src/utils/teleport/api.js +299 -0
- package/src/utils/teleport/environmentSelection.js +55 -0
- package/src/utils/teleport/environments.js +84 -0
- package/src/utils/teleport/gitBundle.js +192 -0
- package/src/utils/teleport.js +1047 -0
- package/src/utils/tempfile.js +26 -0
- package/src/utils/terminal.js +105 -0
- package/src/utils/terminalPanel.js +155 -0
- package/src/utils/textHighlighting.js +113 -0
- package/src/utils/thaddeusHints.js +142 -0
- package/src/utils/theme.js +525 -0
- package/src/utils/thinking.js +130 -0
- package/src/utils/timeouts.js +35 -0
- package/src/utils/tmuxSocket.js +373 -0
- package/src/utils/todo/types.js +9 -0
- package/src/utils/tokenBudget.js +62 -0
- package/src/utils/tokens.js +223 -0
- package/src/utils/toolErrors.js +101 -0
- package/src/utils/toolPool.js +61 -0
- package/src/utils/toolResultStorage.js +768 -0
- package/src/utils/toolSchemaCache.js +7 -0
- package/src/utils/toolSearch.js +551 -0
- package/src/utils/transcriptSearch.js +200 -0
- package/src/utils/treeify.js +111 -0
- package/src/utils/truncate.js +164 -0
- package/src/utils/udsClient.js +5 -0
- package/src/utils/udsMessaging.js +23 -0
- package/src/utils/ultraplan/ccrSession.js +264 -0
- package/src/utils/ultraplan/keyword.js +122 -0
- package/src/utils/unaryLogging.js +16 -0
- package/src/utils/undercover.js +89 -0
- package/src/utils/user.js +137 -0
- package/src/utils/userAgent.js +9 -0
- package/src/utils/userPromptKeywords.js +21 -0
- package/src/utils/uuid.js +22 -0
- package/src/utils/warningHandler.js +97 -0
- package/src/utils/which.js +75 -0
- package/src/utils/windowsPaths.js +146 -0
- package/src/utils/withResolvers.js +13 -0
- package/src/utils/words.js +793 -0
- package/src/utils/workforceIntent.js +192 -0
- package/src/utils/workloadContext.js +42 -0
- package/src/utils/worktree.js +1142 -0
- package/src/utils/worktreeModeEnabled.js +11 -0
- package/src/utils/xdg.js +52 -0
- package/src/utils/xml.js +15 -0
- package/src/utils/yaml.js +14 -0
- package/src/utils/zodToJsonSchema.js +19 -0
- package/src/vim/motions.js +73 -0
- package/src/vim/operators.js +401 -0
- package/src/vim/textObjects.js +153 -0
- package/src/vim/transitions.js +340 -0
- package/src/vim/types.js +93 -0
- package/src/voice/voiceModeEnabled.js +20 -0
- package/thaddeus-terminal.ts +401 -3
- package/thaddeus.command +1 -1
|
@@ -0,0 +1,1250 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { useNotifications } from 'src/context/notifications.js';
|
|
5
|
+
import { Text } from 'src/ink.js';
|
|
6
|
+
import { logEvent } from 'src/services/analytics/index.js';
|
|
7
|
+
import { useDebounceCallback } from 'usehooks-ts';
|
|
8
|
+
import { getCommandName } from '../commands.js';
|
|
9
|
+
import { getModeFromInput, getValueFromInput } from '../components/PromptInput/inputModes.js';
|
|
10
|
+
import { useIsModalOverlayActive, useRegisterOverlay } from '../context/overlayContext.js';
|
|
11
|
+
import { KeyboardEvent } from '../ink/events/keyboard-event.js';
|
|
12
|
+
// eslint-disable-next-line custom-rules/prefer-use-keybindings -- backward-compat bridge until consumers wire handleKeyDown to <Box onKeyDown>
|
|
13
|
+
import { useInput } from '../ink.js';
|
|
14
|
+
import { useOptionalKeybindingContext, useRegisterKeybindingContext } from '../keybindings/KeybindingContext.js';
|
|
15
|
+
import { useKeybindings } from '../keybindings/useKeybinding.js';
|
|
16
|
+
import { useShortcutDisplay } from '../keybindings/useShortcutDisplay.js';
|
|
17
|
+
import { useAppState, useAppStateStore } from '../state/AppState.js';
|
|
18
|
+
import { isAgentSwarmsEnabled } from '../utils/agentSwarmsEnabled.js';
|
|
19
|
+
import { generateProgressiveArgumentHint, parseArguments } from '../utils/argumentSubstitution.js';
|
|
20
|
+
import { getShellCompletions } from '../utils/bash/shellCompletion.js';
|
|
21
|
+
import { formatLogMetadata } from '../utils/format.js';
|
|
22
|
+
import { getSessionIdFromLog, searchSessionsByCustomTitle } from '../utils/sessionStorage.js';
|
|
23
|
+
import { applyCommandSuggestion, findMidInputSlashCommand, generateCommandSuggestions, getBestCommandMatch, isCommandInput } from '../utils/suggestions/commandSuggestions.js';
|
|
24
|
+
import { getDirectoryCompletions, getPathCompletions, isPathLikeToken } from '../utils/suggestions/directoryCompletion.js';
|
|
25
|
+
import { getShellHistoryCompletion } from '../utils/suggestions/shellHistoryCompletion.js';
|
|
26
|
+
import { getSlackChannelSuggestions, hasSlackMcpServer } from '../utils/suggestions/slackChannelSuggestions.js';
|
|
27
|
+
import { TEAM_LEAD_NAME } from '../utils/swarm/constants.js';
|
|
28
|
+
import { applyFileSuggestion, findLongestCommonPrefix, onIndexBuildComplete, startBackgroundCacheRefresh } from './fileSuggestions.js';
|
|
29
|
+
import { generateUnifiedSuggestions } from './unifiedSuggestions.js';
|
|
30
|
+
// Unicode-aware character class for file path tokens:
|
|
31
|
+
// \p{L} = letters (CJK, Latin, Cyrillic, etc.)
|
|
32
|
+
// \p{N} = numbers (incl. fullwidth)
|
|
33
|
+
// \p{M} = combining marks (macOS NFD accents, Devanagari vowel signs)
|
|
34
|
+
const AT_TOKEN_HEAD_RE = /^@[\p{L}\p{N}\p{M}_\-./\\()[\]~:]*/u;
|
|
35
|
+
const PATH_CHAR_HEAD_RE = /^[\p{L}\p{N}\p{M}_\-./\\()[\]~:]+/u;
|
|
36
|
+
const TOKEN_WITH_AT_RE = /(@[\p{L}\p{N}\p{M}_\-./\\()[\]~:]*|[\p{L}\p{N}\p{M}_\-./\\()[\]~:]+)$/u;
|
|
37
|
+
const TOKEN_WITHOUT_AT_RE = /[\p{L}\p{N}\p{M}_\-./\\()[\]~:]+$/u;
|
|
38
|
+
const HAS_AT_SYMBOL_RE = /(^|\s)@([\p{L}\p{N}\p{M}_\-./\\()[\]~:]*|"[^"]*"?)$/u;
|
|
39
|
+
const HASH_CHANNEL_RE = /(^|\s)#([a-z0-9][a-z0-9_-]*)$/;
|
|
40
|
+
// Type guard for path completion metadata
|
|
41
|
+
function isPathMetadata(metadata) {
|
|
42
|
+
return typeof metadata === 'object' && metadata !== null && 'type' in metadata && (metadata.type === 'directory' || metadata.type === 'file');
|
|
43
|
+
}
|
|
44
|
+
// Helper to determine selectedSuggestion when updating suggestions
|
|
45
|
+
function getPreservedSelection(prevSuggestions, prevSelection, newSuggestions) {
|
|
46
|
+
// No new suggestions
|
|
47
|
+
if (newSuggestions.length === 0) {
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
// No previous selection
|
|
51
|
+
if (prevSelection < 0) {
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
// Get the previously selected item
|
|
55
|
+
const prevSelectedItem = prevSuggestions[prevSelection];
|
|
56
|
+
if (!prevSelectedItem) {
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
// Try to find the same item in the new list by ID
|
|
60
|
+
const newIndex = newSuggestions.findIndex(item => item.id === prevSelectedItem.id);
|
|
61
|
+
// Return the new index if found, otherwise default to 0
|
|
62
|
+
return newIndex >= 0 ? newIndex : 0;
|
|
63
|
+
}
|
|
64
|
+
function buildResumeInputFromSuggestion(suggestion) {
|
|
65
|
+
const metadata = suggestion.metadata;
|
|
66
|
+
return metadata?.sessionId ? `/resume ${metadata.sessionId}` : `/resume ${suggestion.displayText}`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Extract search token from a completion token by removing @ prefix and quotes
|
|
70
|
+
* @param completionToken The completion token
|
|
71
|
+
* @returns The search token with @ and quotes removed
|
|
72
|
+
*/
|
|
73
|
+
export function extractSearchToken(completionToken) {
|
|
74
|
+
if (completionToken.isQuoted) {
|
|
75
|
+
// Remove @" prefix and optional closing "
|
|
76
|
+
return completionToken.token.slice(2).replace(/"$/, '');
|
|
77
|
+
}
|
|
78
|
+
else if (completionToken.token.startsWith('@')) {
|
|
79
|
+
return completionToken.token.substring(1);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return completionToken.token;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Format a replacement value with proper @ prefix and quotes based on context
|
|
87
|
+
* @param options Configuration for formatting
|
|
88
|
+
* @param options.displayText The text to display
|
|
89
|
+
* @param options.mode The current mode (bash or prompt)
|
|
90
|
+
* @param options.hasAtPrefix Whether the original token has @ prefix
|
|
91
|
+
* @param options.needsQuotes Whether the text needs quotes (contains spaces)
|
|
92
|
+
* @param options.isQuoted Whether the original token was already quoted (user typed @"...)
|
|
93
|
+
* @param options.isComplete Whether this is a complete suggestion (adds trailing space)
|
|
94
|
+
* @returns The formatted replacement value
|
|
95
|
+
*/
|
|
96
|
+
export function formatReplacementValue(options) {
|
|
97
|
+
const { displayText, mode, hasAtPrefix, needsQuotes, isQuoted, isComplete } = options;
|
|
98
|
+
const space = isComplete ? ' ' : '';
|
|
99
|
+
if (isQuoted || needsQuotes) {
|
|
100
|
+
// Use quoted format
|
|
101
|
+
return mode === 'bash' ? `"${displayText}"${space}` : `@"${displayText}"${space}`;
|
|
102
|
+
}
|
|
103
|
+
else if (hasAtPrefix) {
|
|
104
|
+
return mode === 'bash' ? `${displayText}${space}` : `@${displayText}${space}`;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return displayText;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Apply a shell completion suggestion by replacing the current word
|
|
112
|
+
*/
|
|
113
|
+
export function applyShellSuggestion(suggestion, input, cursorOffset, onInputChange, setCursorOffset, completionType) {
|
|
114
|
+
const beforeCursor = input.slice(0, cursorOffset);
|
|
115
|
+
const lastSpaceIndex = beforeCursor.lastIndexOf(' ');
|
|
116
|
+
const wordStart = lastSpaceIndex + 1;
|
|
117
|
+
// Prepare the replacement text based on completion type
|
|
118
|
+
let replacementText;
|
|
119
|
+
if (completionType === 'variable') {
|
|
120
|
+
replacementText = '$' + suggestion.displayText + ' ';
|
|
121
|
+
}
|
|
122
|
+
else if (completionType === 'command') {
|
|
123
|
+
replacementText = suggestion.displayText + ' ';
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
replacementText = suggestion.displayText;
|
|
127
|
+
}
|
|
128
|
+
const newInput = input.slice(0, wordStart) + replacementText + input.slice(cursorOffset);
|
|
129
|
+
onInputChange(newInput);
|
|
130
|
+
setCursorOffset(wordStart + replacementText.length);
|
|
131
|
+
}
|
|
132
|
+
const DM_MEMBER_RE = /(^|\s)@[\w-]*$/;
|
|
133
|
+
function applyTriggerSuggestion(suggestion, input, cursorOffset, triggerRe, onInputChange, setCursorOffset) {
|
|
134
|
+
const m = input.slice(0, cursorOffset).match(triggerRe);
|
|
135
|
+
if (!m || m.index === undefined)
|
|
136
|
+
return;
|
|
137
|
+
const prefixStart = m.index + (m[1]?.length ?? 0);
|
|
138
|
+
const before = input.slice(0, prefixStart);
|
|
139
|
+
const newInput = before + suggestion.displayText + ' ' + input.slice(cursorOffset);
|
|
140
|
+
onInputChange(newInput);
|
|
141
|
+
setCursorOffset(before.length + suggestion.displayText.length + 1);
|
|
142
|
+
}
|
|
143
|
+
let currentShellCompletionAbortController = null;
|
|
144
|
+
/**
|
|
145
|
+
* Generate bash shell completion suggestions
|
|
146
|
+
*/
|
|
147
|
+
async function generateBashSuggestions(input, cursorOffset) {
|
|
148
|
+
try {
|
|
149
|
+
if (currentShellCompletionAbortController) {
|
|
150
|
+
currentShellCompletionAbortController.abort();
|
|
151
|
+
}
|
|
152
|
+
currentShellCompletionAbortController = new AbortController();
|
|
153
|
+
const suggestions = await getShellCompletions(input, cursorOffset, currentShellCompletionAbortController.signal);
|
|
154
|
+
return suggestions;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
// Silent failure - don't break UX
|
|
158
|
+
logEvent('thaddeus_shell_completion_failed', {});
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Apply a directory/path completion suggestion to the input
|
|
164
|
+
* Always adds @ prefix since we're replacing the entire token (including any existing @)
|
|
165
|
+
*
|
|
166
|
+
* @param input The current input text
|
|
167
|
+
* @param suggestionId The ID of the suggestion to apply
|
|
168
|
+
* @param tokenStartPos The start position of the token being replaced
|
|
169
|
+
* @param tokenLength The length of the token being replaced
|
|
170
|
+
* @param isDirectory Whether the suggestion is a directory (adds / suffix) or file (adds space)
|
|
171
|
+
* @returns Object with the new input text and cursor position
|
|
172
|
+
*/
|
|
173
|
+
export function applyDirectorySuggestion(input, suggestionId, tokenStartPos, tokenLength, isDirectory) {
|
|
174
|
+
const suffix = isDirectory ? '/' : ' ';
|
|
175
|
+
const before = input.slice(0, tokenStartPos);
|
|
176
|
+
const after = input.slice(tokenStartPos + tokenLength);
|
|
177
|
+
// Always add @ prefix - if token already has it, we're replacing
|
|
178
|
+
// the whole token (including @) with @suggestion.id
|
|
179
|
+
const replacement = '@' + suggestionId + suffix;
|
|
180
|
+
const newInput = before + replacement + after;
|
|
181
|
+
return {
|
|
182
|
+
newInput,
|
|
183
|
+
cursorPos: before.length + replacement.length
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Extract a completable token at the cursor position
|
|
188
|
+
* @param text The input text
|
|
189
|
+
* @param cursorPos The cursor position
|
|
190
|
+
* @param includeAtSymbol Whether to consider @ symbol as part of the token
|
|
191
|
+
* @returns The completable token and its start position, or null if not found
|
|
192
|
+
*/
|
|
193
|
+
export function extractCompletionToken(text, cursorPos, includeAtSymbol = false) {
|
|
194
|
+
// Empty input check
|
|
195
|
+
if (!text)
|
|
196
|
+
return null;
|
|
197
|
+
// Get text up to cursor
|
|
198
|
+
const textBeforeCursor = text.substring(0, cursorPos);
|
|
199
|
+
// Check for quoted @ mention first (e.g., @"my file with spaces")
|
|
200
|
+
if (includeAtSymbol) {
|
|
201
|
+
const quotedAtRegex = /@"([^"]*)"?$/;
|
|
202
|
+
const quotedMatch = textBeforeCursor.match(quotedAtRegex);
|
|
203
|
+
if (quotedMatch && quotedMatch.index !== undefined) {
|
|
204
|
+
// Include any remaining quoted content after cursor until closing quote or end
|
|
205
|
+
const textAfterCursor = text.substring(cursorPos);
|
|
206
|
+
const afterQuotedMatch = textAfterCursor.match(/^[^"]*"?/);
|
|
207
|
+
const quotedSuffix = afterQuotedMatch ? afterQuotedMatch[0] : '';
|
|
208
|
+
return {
|
|
209
|
+
token: quotedMatch[0] + quotedSuffix,
|
|
210
|
+
startPos: quotedMatch.index,
|
|
211
|
+
isQuoted: true
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Fast path for @ tokens: use lastIndexOf to avoid expensive $ anchor scan
|
|
216
|
+
if (includeAtSymbol) {
|
|
217
|
+
const atIdx = textBeforeCursor.lastIndexOf('@');
|
|
218
|
+
if (atIdx >= 0 && (atIdx === 0 || /\s/.test(textBeforeCursor[atIdx - 1]))) {
|
|
219
|
+
const fromAt = textBeforeCursor.substring(atIdx);
|
|
220
|
+
const atHeadMatch = fromAt.match(AT_TOKEN_HEAD_RE);
|
|
221
|
+
if (atHeadMatch && atHeadMatch[0].length === fromAt.length) {
|
|
222
|
+
const textAfterCursor = text.substring(cursorPos);
|
|
223
|
+
const afterMatch = textAfterCursor.match(PATH_CHAR_HEAD_RE);
|
|
224
|
+
const tokenSuffix = afterMatch ? afterMatch[0] : '';
|
|
225
|
+
return {
|
|
226
|
+
token: atHeadMatch[0] + tokenSuffix,
|
|
227
|
+
startPos: atIdx,
|
|
228
|
+
isQuoted: false
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// Non-@ token or cursor outside @ token — use $ anchor on (short) tail
|
|
234
|
+
const tokenRegex = includeAtSymbol ? TOKEN_WITH_AT_RE : TOKEN_WITHOUT_AT_RE;
|
|
235
|
+
const match = textBeforeCursor.match(tokenRegex);
|
|
236
|
+
if (!match || match.index === undefined) {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
// Check if cursor is in the MIDDLE of a token (more word characters after cursor)
|
|
240
|
+
// If so, extend the token to include all characters until whitespace or end of string
|
|
241
|
+
const textAfterCursor = text.substring(cursorPos);
|
|
242
|
+
const afterMatch = textAfterCursor.match(PATH_CHAR_HEAD_RE);
|
|
243
|
+
const tokenSuffix = afterMatch ? afterMatch[0] : '';
|
|
244
|
+
return {
|
|
245
|
+
token: match[0] + tokenSuffix,
|
|
246
|
+
startPos: match.index,
|
|
247
|
+
isQuoted: false
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function extractCommandNameAndArgs(value) {
|
|
251
|
+
if (isCommandInput(value)) {
|
|
252
|
+
const spaceIndex = value.indexOf(' ');
|
|
253
|
+
if (spaceIndex === -1)
|
|
254
|
+
return {
|
|
255
|
+
commandName: value.slice(1),
|
|
256
|
+
args: ''
|
|
257
|
+
};
|
|
258
|
+
return {
|
|
259
|
+
commandName: value.slice(1, spaceIndex),
|
|
260
|
+
args: value.slice(spaceIndex + 1)
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
function hasCommandWithArguments(isAtEndWithWhitespace, value) {
|
|
266
|
+
// If value.endsWith(' ') but the user is not at the end, then the user has
|
|
267
|
+
// potentially gone back to the command in an effort to edit the command name
|
|
268
|
+
// (but preserve the arguments).
|
|
269
|
+
return !isAtEndWithWhitespace && value.includes(' ') && !value.endsWith(' ');
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Hook for handling typeahead functionality for both commands and file paths
|
|
273
|
+
*/
|
|
274
|
+
export function useTypeahead({ commands, onInputChange, onSubmit, setCursorOffset, input, cursorOffset, mode, agents, setSuggestionsState, suggestionsState: { suggestions, selectedSuggestion, commandArgumentHint }, suppressSuggestions = false, markAccepted, onModeChange }) {
|
|
275
|
+
const { addNotification } = useNotifications();
|
|
276
|
+
const thinkingToggleShortcut = useShortcutDisplay('chat:thinkingToggle', 'Chat', 'alt+t');
|
|
277
|
+
const [suggestionType, setSuggestionType] = useState('none');
|
|
278
|
+
// Compute max column width from ALL commands once (not filtered results)
|
|
279
|
+
// This prevents layout shift when filtering
|
|
280
|
+
const allCommandsMaxWidth = useMemo(() => {
|
|
281
|
+
const visibleCommands = commands.filter(cmd => !cmd.isHidden);
|
|
282
|
+
if (visibleCommands.length === 0)
|
|
283
|
+
return undefined;
|
|
284
|
+
const maxLen = Math.max(...visibleCommands.map(cmd => getCommandName(cmd).length));
|
|
285
|
+
return maxLen + 6; // +1 for "/" prefix, +5 for padding
|
|
286
|
+
}, [commands]);
|
|
287
|
+
const [maxColumnWidth, setMaxColumnWidth] = useState(undefined);
|
|
288
|
+
const mcpResources = useAppState(s => s.mcp.resources);
|
|
289
|
+
const store = useAppStateStore();
|
|
290
|
+
const promptSuggestion = useAppState(s => s.promptSuggestion);
|
|
291
|
+
// PromptInput hides suggestion ghost text in teammate view — mirror that
|
|
292
|
+
// gate here so Tab/rightArrow can't accept what isn't displayed.
|
|
293
|
+
const isViewingTeammate = useAppState(s => !!s.viewingAgentTaskId);
|
|
294
|
+
// Access keybinding context to check for pending chord sequences
|
|
295
|
+
const keybindingContext = useOptionalKeybindingContext();
|
|
296
|
+
// State for inline ghost text (bash history completion - async)
|
|
297
|
+
const [inlineGhostText, setInlineGhostText] = useState(undefined);
|
|
298
|
+
// Synchronous ghost text for prompt mode mid-input slash commands.
|
|
299
|
+
// Computed during render via useMemo to eliminate the one-frame flicker
|
|
300
|
+
// that occurs when using useState + useEffect (effect runs after render).
|
|
301
|
+
const syncPromptGhostText = useMemo(() => {
|
|
302
|
+
if (mode !== 'prompt' || suppressSuggestions)
|
|
303
|
+
return undefined;
|
|
304
|
+
const midInputCommand = findMidInputSlashCommand(input, cursorOffset);
|
|
305
|
+
if (!midInputCommand)
|
|
306
|
+
return undefined;
|
|
307
|
+
const match = getBestCommandMatch(midInputCommand.partialCommand, commands);
|
|
308
|
+
if (!match)
|
|
309
|
+
return undefined;
|
|
310
|
+
return {
|
|
311
|
+
text: match.suffix,
|
|
312
|
+
fullCommand: match.fullCommand,
|
|
313
|
+
insertPosition: midInputCommand.startPos + 1 + midInputCommand.partialCommand.length
|
|
314
|
+
};
|
|
315
|
+
}, [input, cursorOffset, mode, commands, suppressSuggestions]);
|
|
316
|
+
// Merged ghost text: prompt mode uses synchronous useMemo, bash mode uses async useState
|
|
317
|
+
const effectiveGhostText = suppressSuggestions ? undefined : mode === 'prompt' ? syncPromptGhostText : inlineGhostText;
|
|
318
|
+
// Use a ref for cursorOffset to avoid re-triggering suggestions on cursor movement alone
|
|
319
|
+
// We only want to re-fetch suggestions when the actual search token changes
|
|
320
|
+
const cursorOffsetRef = useRef(cursorOffset);
|
|
321
|
+
cursorOffsetRef.current = cursorOffset;
|
|
322
|
+
// Track the latest search token to discard stale results from slow async operations
|
|
323
|
+
const latestSearchTokenRef = useRef(null);
|
|
324
|
+
// Track previous input to detect actual text changes vs. callback recreations
|
|
325
|
+
const prevInputRef = useRef('');
|
|
326
|
+
// Track the latest path token to discard stale results from path completion
|
|
327
|
+
const latestPathTokenRef = useRef('');
|
|
328
|
+
// Track the latest bash input to discard stale results from history completion
|
|
329
|
+
const latestBashInputRef = useRef('');
|
|
330
|
+
// Track the latest slack channel token to discard stale results from MCP
|
|
331
|
+
const latestSlackTokenRef = useRef('');
|
|
332
|
+
// Track suggestions via ref to avoid updateSuggestions being recreated on selection changes
|
|
333
|
+
const suggestionsRef = useRef(suggestions);
|
|
334
|
+
suggestionsRef.current = suggestions;
|
|
335
|
+
// Track the input value when suggestions were manually dismissed to prevent re-triggering
|
|
336
|
+
const dismissedForInputRef = useRef(null);
|
|
337
|
+
// Clear all suggestions
|
|
338
|
+
const clearSuggestions = useCallback(() => {
|
|
339
|
+
setSuggestionsState(() => ({
|
|
340
|
+
commandArgumentHint: undefined,
|
|
341
|
+
suggestions: [],
|
|
342
|
+
selectedSuggestion: -1
|
|
343
|
+
}));
|
|
344
|
+
setSuggestionType('none');
|
|
345
|
+
setMaxColumnWidth(undefined);
|
|
346
|
+
setInlineGhostText(undefined);
|
|
347
|
+
}, [setSuggestionsState]);
|
|
348
|
+
// Expensive async operation to fetch file/resource suggestions
|
|
349
|
+
const fetchFileSuggestions = useCallback(async (searchToken, isAtSymbol = false) => {
|
|
350
|
+
latestSearchTokenRef.current = searchToken;
|
|
351
|
+
const combinedItems = await generateUnifiedSuggestions(searchToken, mcpResources, agents, isAtSymbol);
|
|
352
|
+
// Discard stale results if a newer query was initiated while waiting
|
|
353
|
+
if (latestSearchTokenRef.current !== searchToken) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if (combinedItems.length === 0) {
|
|
357
|
+
// Inline clearSuggestions logic to avoid needing debouncedFetchFileSuggestions
|
|
358
|
+
setSuggestionsState(() => ({
|
|
359
|
+
commandArgumentHint: undefined,
|
|
360
|
+
suggestions: [],
|
|
361
|
+
selectedSuggestion: -1
|
|
362
|
+
}));
|
|
363
|
+
setSuggestionType('none');
|
|
364
|
+
setMaxColumnWidth(undefined);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
setSuggestionsState(prev => ({
|
|
368
|
+
commandArgumentHint: undefined,
|
|
369
|
+
suggestions: combinedItems,
|
|
370
|
+
selectedSuggestion: getPreservedSelection(prev.suggestions, prev.selectedSuggestion, combinedItems)
|
|
371
|
+
}));
|
|
372
|
+
setSuggestionType(combinedItems.length > 0 ? 'file' : 'none');
|
|
373
|
+
setMaxColumnWidth(undefined); // No fixed width for file suggestions
|
|
374
|
+
}, [mcpResources, setSuggestionsState, setSuggestionType, setMaxColumnWidth, agents]);
|
|
375
|
+
// Pre-warm the file index on mount so the first @-mention doesn't block.
|
|
376
|
+
// The build runs in background with ~4ms event-loop yields, so it doesn't
|
|
377
|
+
// delay first render — it just races the user's first @ keystroke.
|
|
378
|
+
//
|
|
379
|
+
// If the user types before the build finishes, they get partial results
|
|
380
|
+
// from the ready chunks; when the build completes, re-fire the last
|
|
381
|
+
// search so partial upgrades to full. Clears the token ref so the same
|
|
382
|
+
// query isn't discarded as stale.
|
|
383
|
+
//
|
|
384
|
+
// Skipped under NODE_ENV=test: REPL-mounting tests would spawn git ls-files
|
|
385
|
+
// against the real CI workspace (270k+ files on Windows runners), and the
|
|
386
|
+
// background build outlives the test — its setImmediate chain leaks into
|
|
387
|
+
// subsequent tests in the shard. The subscriber still registers so
|
|
388
|
+
// fileSuggestions tests that trigger a refresh directly work correctly.
|
|
389
|
+
useEffect(() => {
|
|
390
|
+
if ("production" !== 'test') {
|
|
391
|
+
startBackgroundCacheRefresh();
|
|
392
|
+
}
|
|
393
|
+
return onIndexBuildComplete(() => {
|
|
394
|
+
const token = latestSearchTokenRef.current;
|
|
395
|
+
if (token !== null) {
|
|
396
|
+
latestSearchTokenRef.current = null;
|
|
397
|
+
void fetchFileSuggestions(token, token === '');
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}, [fetchFileSuggestions]);
|
|
401
|
+
// Debounce the file fetch operation. 50ms sits just above macOS default
|
|
402
|
+
// key-repeat (~33ms) so held-delete/backspace coalesces into one search
|
|
403
|
+
// instead of stuttering on each repeated key. The search itself is ~8–15ms
|
|
404
|
+
// on a 270k-file index.
|
|
405
|
+
const debouncedFetchFileSuggestions = useDebounceCallback(fetchFileSuggestions, 50);
|
|
406
|
+
const fetchSlackChannels = useCallback(async (partial) => {
|
|
407
|
+
latestSlackTokenRef.current = partial;
|
|
408
|
+
const channels = await getSlackChannelSuggestions(store.getState().mcp.clients, partial);
|
|
409
|
+
if (latestSlackTokenRef.current !== partial)
|
|
410
|
+
return;
|
|
411
|
+
setSuggestionsState(prev => ({
|
|
412
|
+
commandArgumentHint: undefined,
|
|
413
|
+
suggestions: channels,
|
|
414
|
+
selectedSuggestion: getPreservedSelection(prev.suggestions, prev.selectedSuggestion, channels)
|
|
415
|
+
}));
|
|
416
|
+
setSuggestionType(channels.length > 0 ? 'slack-channel' : 'none');
|
|
417
|
+
setMaxColumnWidth(undefined);
|
|
418
|
+
},
|
|
419
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- store is a stable context ref
|
|
420
|
+
[setSuggestionsState]);
|
|
421
|
+
// First keystroke after # needs the MCP round-trip; subsequent keystrokes
|
|
422
|
+
// that share the same first-word segment hit the cache synchronously.
|
|
423
|
+
const debouncedFetchSlackChannels = useDebounceCallback(fetchSlackChannels, 150);
|
|
424
|
+
// Handle immediate suggestion logic (cheap operations)
|
|
425
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: store is a stable context ref, read imperatively at call-time
|
|
426
|
+
const updateSuggestions = useCallback(async (value, inputCursorOffset) => {
|
|
427
|
+
// Use provided cursor offset or fall back to ref (avoids dependency on cursorOffset)
|
|
428
|
+
const effectiveCursorOffset = inputCursorOffset ?? cursorOffsetRef.current;
|
|
429
|
+
if (suppressSuggestions) {
|
|
430
|
+
debouncedFetchFileSuggestions.cancel();
|
|
431
|
+
clearSuggestions();
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
// Check for mid-input slash command (e.g., "help me /com")
|
|
435
|
+
// Only in prompt mode, not when input starts with "/" (handled separately)
|
|
436
|
+
// Note: ghost text for prompt mode is computed synchronously via syncPromptGhostText useMemo.
|
|
437
|
+
// We only need to clear dropdown suggestions here when ghost text is active.
|
|
438
|
+
if (mode === 'prompt') {
|
|
439
|
+
const midInputCommand = findMidInputSlashCommand(value, effectiveCursorOffset);
|
|
440
|
+
if (midInputCommand) {
|
|
441
|
+
const match = getBestCommandMatch(midInputCommand.partialCommand, commands);
|
|
442
|
+
if (match) {
|
|
443
|
+
// Clear dropdown suggestions when showing ghost text
|
|
444
|
+
setSuggestionsState(() => ({
|
|
445
|
+
commandArgumentHint: undefined,
|
|
446
|
+
suggestions: [],
|
|
447
|
+
selectedSuggestion: -1
|
|
448
|
+
}));
|
|
449
|
+
setSuggestionType('none');
|
|
450
|
+
setMaxColumnWidth(undefined);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
// Bash mode: check for history-based ghost text completion
|
|
456
|
+
if (mode === 'bash' && value.trim()) {
|
|
457
|
+
latestBashInputRef.current = value;
|
|
458
|
+
const historyMatch = await getShellHistoryCompletion(value);
|
|
459
|
+
// Discard stale results if input changed while waiting
|
|
460
|
+
if (latestBashInputRef.current !== value) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (historyMatch) {
|
|
464
|
+
setInlineGhostText({
|
|
465
|
+
text: historyMatch.suffix,
|
|
466
|
+
fullCommand: historyMatch.fullCommand,
|
|
467
|
+
insertPosition: value.length
|
|
468
|
+
});
|
|
469
|
+
// Clear dropdown suggestions when showing ghost text
|
|
470
|
+
setSuggestionsState(() => ({
|
|
471
|
+
commandArgumentHint: undefined,
|
|
472
|
+
suggestions: [],
|
|
473
|
+
selectedSuggestion: -1
|
|
474
|
+
}));
|
|
475
|
+
setSuggestionType('none');
|
|
476
|
+
setMaxColumnWidth(undefined);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
// No history match, clear ghost text
|
|
481
|
+
setInlineGhostText(undefined);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
// Check for @ to trigger team member / named subagent suggestions
|
|
485
|
+
// Must check before @ file symbol to prevent conflict
|
|
486
|
+
// Skip in bash mode - @ has no special meaning in shell commands
|
|
487
|
+
const atMatch = mode !== 'bash' ? value.substring(0, effectiveCursorOffset).match(/(^|\s)@([\w-]*)$/) : null;
|
|
488
|
+
if (atMatch) {
|
|
489
|
+
const partialName = (atMatch[2] ?? '').toLowerCase();
|
|
490
|
+
// Imperative read — reading at call-time fixes staleness for
|
|
491
|
+
// teammates/subagents added mid-session.
|
|
492
|
+
const state = store.getState();
|
|
493
|
+
const members = [];
|
|
494
|
+
const seen = new Set();
|
|
495
|
+
if (isAgentSwarmsEnabled() && state.teamContext) {
|
|
496
|
+
for (const t of Object.values(state.teamContext.teammates ?? {})) {
|
|
497
|
+
if (t.name === TEAM_LEAD_NAME)
|
|
498
|
+
continue;
|
|
499
|
+
if (!t.name.toLowerCase().startsWith(partialName))
|
|
500
|
+
continue;
|
|
501
|
+
seen.add(t.name);
|
|
502
|
+
members.push({
|
|
503
|
+
id: `dm-${t.name}`,
|
|
504
|
+
displayText: `@${t.name}`,
|
|
505
|
+
description: 'send message'
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
for (const [name, agentId] of state.agentNameRegistry) {
|
|
510
|
+
if (seen.has(name))
|
|
511
|
+
continue;
|
|
512
|
+
if (!name.toLowerCase().startsWith(partialName))
|
|
513
|
+
continue;
|
|
514
|
+
const status = state.tasks[agentId]?.status;
|
|
515
|
+
members.push({
|
|
516
|
+
id: `dm-${name}`,
|
|
517
|
+
displayText: `@${name}`,
|
|
518
|
+
description: status ? `send message · ${status}` : 'send message'
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
if (members.length > 0) {
|
|
522
|
+
debouncedFetchFileSuggestions.cancel();
|
|
523
|
+
setSuggestionsState(prev => ({
|
|
524
|
+
commandArgumentHint: undefined,
|
|
525
|
+
suggestions: members,
|
|
526
|
+
selectedSuggestion: getPreservedSelection(prev.suggestions, prev.selectedSuggestion, members)
|
|
527
|
+
}));
|
|
528
|
+
setSuggestionType('agent');
|
|
529
|
+
setMaxColumnWidth(undefined);
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
// Check for # to trigger Slack channel suggestions (requires Slack MCP server)
|
|
534
|
+
if (mode === 'prompt') {
|
|
535
|
+
const hashMatch = value.substring(0, effectiveCursorOffset).match(HASH_CHANNEL_RE);
|
|
536
|
+
if (hashMatch && hasSlackMcpServer(store.getState().mcp.clients)) {
|
|
537
|
+
debouncedFetchSlackChannels(hashMatch[2]);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
else if (suggestionType === 'slack-channel') {
|
|
541
|
+
debouncedFetchSlackChannels.cancel();
|
|
542
|
+
clearSuggestions();
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
// Check for @ symbol to trigger file suggestions (including quoted paths)
|
|
546
|
+
// Includes colon for MCP resources (e.g., server:resource/path)
|
|
547
|
+
const hasAtSymbol = value.substring(0, effectiveCursorOffset).match(HAS_AT_SYMBOL_RE);
|
|
548
|
+
// First, check for slash command suggestions (higher priority than @ symbol)
|
|
549
|
+
// Only show slash command selector if cursor is not on the "/" character itself
|
|
550
|
+
// Also don't show if cursor is at end of line with whitespace before it
|
|
551
|
+
// Don't show slash commands in bash mode
|
|
552
|
+
const isAtEndWithWhitespace = effectiveCursorOffset === value.length && effectiveCursorOffset > 0 && value.length > 0 && value[effectiveCursorOffset - 1] === ' ';
|
|
553
|
+
// Handle directory completion for commands
|
|
554
|
+
if (mode === 'prompt' && isCommandInput(value) && effectiveCursorOffset > 0) {
|
|
555
|
+
const parsedCommand = extractCommandNameAndArgs(value);
|
|
556
|
+
if (parsedCommand && parsedCommand.commandName === 'add-dir' && parsedCommand.args) {
|
|
557
|
+
const { args } = parsedCommand;
|
|
558
|
+
// Clear suggestions if args end with whitespace (user is done with path)
|
|
559
|
+
if (args.match(/\s+$/)) {
|
|
560
|
+
debouncedFetchFileSuggestions.cancel();
|
|
561
|
+
clearSuggestions();
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const dirSuggestions = await getDirectoryCompletions(args);
|
|
565
|
+
if (dirSuggestions.length > 0) {
|
|
566
|
+
setSuggestionsState(prev => ({
|
|
567
|
+
suggestions: dirSuggestions,
|
|
568
|
+
selectedSuggestion: getPreservedSelection(prev.suggestions, prev.selectedSuggestion, dirSuggestions),
|
|
569
|
+
commandArgumentHint: undefined
|
|
570
|
+
}));
|
|
571
|
+
setSuggestionType('directory');
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
// No suggestions found - clear and return
|
|
575
|
+
debouncedFetchFileSuggestions.cancel();
|
|
576
|
+
clearSuggestions();
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
// Handle custom title completion for /resume command
|
|
580
|
+
if (parsedCommand && parsedCommand.commandName === 'resume' && parsedCommand.args !== undefined && value.includes(' ')) {
|
|
581
|
+
const { args } = parsedCommand;
|
|
582
|
+
// Get custom title suggestions using partial match
|
|
583
|
+
const matches = await searchSessionsByCustomTitle(args, {
|
|
584
|
+
limit: 10
|
|
585
|
+
});
|
|
586
|
+
const suggestions = matches.map(log => {
|
|
587
|
+
const sessionId = getSessionIdFromLog(log);
|
|
588
|
+
return {
|
|
589
|
+
id: `resume-title-${sessionId}`,
|
|
590
|
+
displayText: log.customTitle,
|
|
591
|
+
description: formatLogMetadata(log),
|
|
592
|
+
metadata: {
|
|
593
|
+
sessionId
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
});
|
|
597
|
+
if (suggestions.length > 0) {
|
|
598
|
+
setSuggestionsState(prev => ({
|
|
599
|
+
suggestions,
|
|
600
|
+
selectedSuggestion: getPreservedSelection(prev.suggestions, prev.selectedSuggestion, suggestions),
|
|
601
|
+
commandArgumentHint: undefined
|
|
602
|
+
}));
|
|
603
|
+
setSuggestionType('custom-title');
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
// No suggestions found - clear and return
|
|
607
|
+
clearSuggestions();
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
// Determine whether to display the argument hint and command suggestions.
|
|
612
|
+
if (mode === 'prompt' && isCommandInput(value) && effectiveCursorOffset > 0 && !hasCommandWithArguments(isAtEndWithWhitespace, value)) {
|
|
613
|
+
let commandArgumentHint = undefined;
|
|
614
|
+
if (value.length > 1) {
|
|
615
|
+
// We have a partial or complete command without arguments
|
|
616
|
+
// Check if it matches a command exactly and has an argument hint
|
|
617
|
+
// Extract command name: everything after / until the first space (or end)
|
|
618
|
+
const spaceIndex = value.indexOf(' ');
|
|
619
|
+
const commandName = spaceIndex === -1 ? value.slice(1) : value.slice(1, spaceIndex);
|
|
620
|
+
// Check if there are real arguments (non-whitespace after the command)
|
|
621
|
+
const hasRealArguments = spaceIndex !== -1 && value.slice(spaceIndex + 1).trim().length > 0;
|
|
622
|
+
// Check if input is exactly "command + single space" (ready for arguments)
|
|
623
|
+
const hasExactlyOneTrailingSpace = spaceIndex !== -1 && value.length === spaceIndex + 1;
|
|
624
|
+
// If input has a space after the command, don't show suggestions
|
|
625
|
+
// This prevents Enter from selecting a different command after Tab completion
|
|
626
|
+
if (spaceIndex !== -1) {
|
|
627
|
+
const exactMatch = commands.find(cmd => getCommandName(cmd) === commandName);
|
|
628
|
+
if (exactMatch || hasRealArguments) {
|
|
629
|
+
// Priority 1: Static argumentHint (only on first trailing space for backwards compat)
|
|
630
|
+
if (exactMatch?.argumentHint && hasExactlyOneTrailingSpace) {
|
|
631
|
+
commandArgumentHint = exactMatch.argumentHint;
|
|
632
|
+
}
|
|
633
|
+
// Priority 2: Progressive hint from argNames (show when trailing space)
|
|
634
|
+
else if (exactMatch?.type === 'prompt' && exactMatch.argNames?.length && value.endsWith(' ')) {
|
|
635
|
+
const argsText = value.slice(spaceIndex + 1);
|
|
636
|
+
const typedArgs = parseArguments(argsText);
|
|
637
|
+
commandArgumentHint = generateProgressiveArgumentHint(exactMatch.argNames, typedArgs);
|
|
638
|
+
}
|
|
639
|
+
setSuggestionsState(() => ({
|
|
640
|
+
commandArgumentHint,
|
|
641
|
+
suggestions: [],
|
|
642
|
+
selectedSuggestion: -1
|
|
643
|
+
}));
|
|
644
|
+
setSuggestionType('none');
|
|
645
|
+
setMaxColumnWidth(undefined);
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
// Note: argument hint is only shown when there's exactly one trailing space
|
|
650
|
+
// (set above when hasExactlyOneTrailingSpace is true)
|
|
651
|
+
}
|
|
652
|
+
const commandItems = generateCommandSuggestions(value, commands);
|
|
653
|
+
setSuggestionsState(() => ({
|
|
654
|
+
commandArgumentHint,
|
|
655
|
+
suggestions: commandItems,
|
|
656
|
+
selectedSuggestion: commandItems.length > 0 ? 0 : -1
|
|
657
|
+
}));
|
|
658
|
+
setSuggestionType(commandItems.length > 0 ? 'command' : 'none');
|
|
659
|
+
// Use stable width from all commands (prevents layout shift when filtering)
|
|
660
|
+
if (commandItems.length > 0) {
|
|
661
|
+
setMaxColumnWidth(allCommandsMaxWidth);
|
|
662
|
+
}
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if (suggestionType === 'command') {
|
|
666
|
+
// If we had command suggestions but the input no longer starts with '/'
|
|
667
|
+
// we need to clear the suggestions. However, we should not return
|
|
668
|
+
// because there may be relevant @ symbol and file suggestions.
|
|
669
|
+
debouncedFetchFileSuggestions.cancel();
|
|
670
|
+
clearSuggestions();
|
|
671
|
+
}
|
|
672
|
+
else if (isCommandInput(value) && hasCommandWithArguments(isAtEndWithWhitespace, value)) {
|
|
673
|
+
// If we have a command with arguments (no trailing space), clear any stale hint
|
|
674
|
+
// This prevents the hint from flashing when transitioning between states
|
|
675
|
+
setSuggestionsState(prev => prev.commandArgumentHint ? {
|
|
676
|
+
...prev,
|
|
677
|
+
commandArgumentHint: undefined
|
|
678
|
+
} : prev);
|
|
679
|
+
}
|
|
680
|
+
if (suggestionType === 'custom-title') {
|
|
681
|
+
// If we had custom-title suggestions but the input is no longer /resume
|
|
682
|
+
// we need to clear the suggestions.
|
|
683
|
+
clearSuggestions();
|
|
684
|
+
}
|
|
685
|
+
if (suggestionType === 'agent' && suggestionsRef.current.some((s) => s.id?.startsWith('dm-'))) {
|
|
686
|
+
// If we had team member suggestions but the input no longer has @
|
|
687
|
+
// we need to clear the suggestions.
|
|
688
|
+
const hasAt = value.substring(0, effectiveCursorOffset).match(/(^|\s)@([\w-]*)$/);
|
|
689
|
+
if (!hasAt) {
|
|
690
|
+
clearSuggestions();
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
// Check for @ symbol to trigger file and MCP resource suggestions
|
|
694
|
+
// Skip @ autocomplete in bash mode - @ has no special meaning in shell commands
|
|
695
|
+
if (hasAtSymbol && mode !== 'bash') {
|
|
696
|
+
// Get the @ token (including the @ symbol)
|
|
697
|
+
const completionToken = extractCompletionToken(value, effectiveCursorOffset, true);
|
|
698
|
+
if (completionToken && completionToken.token.startsWith('@')) {
|
|
699
|
+
const searchToken = extractSearchToken(completionToken);
|
|
700
|
+
// If the token after @ is path-like, use path completion instead of fuzzy search
|
|
701
|
+
// This handles cases like @~/path, @./path, @/path for directory traversal
|
|
702
|
+
if (isPathLikeToken(searchToken)) {
|
|
703
|
+
latestPathTokenRef.current = searchToken;
|
|
704
|
+
const pathSuggestions = await getPathCompletions(searchToken, {
|
|
705
|
+
maxResults: 10
|
|
706
|
+
});
|
|
707
|
+
// Discard stale results if a newer query was initiated while waiting
|
|
708
|
+
if (latestPathTokenRef.current !== searchToken) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
if (pathSuggestions.length > 0) {
|
|
712
|
+
setSuggestionsState(prev => ({
|
|
713
|
+
suggestions: pathSuggestions,
|
|
714
|
+
selectedSuggestion: getPreservedSelection(prev.suggestions, prev.selectedSuggestion, pathSuggestions),
|
|
715
|
+
commandArgumentHint: undefined
|
|
716
|
+
}));
|
|
717
|
+
setSuggestionType('directory');
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
// Skip if we already fetched for this exact token (prevents loop from
|
|
722
|
+
// suggestions dependency causing updateSuggestions to be recreated)
|
|
723
|
+
if (latestSearchTokenRef.current === searchToken) {
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
void debouncedFetchFileSuggestions(searchToken, true);
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
// If we have active file suggestions or the input changed, check for file suggestions
|
|
731
|
+
if (suggestionType === 'file') {
|
|
732
|
+
const completionToken = extractCompletionToken(value, effectiveCursorOffset, true);
|
|
733
|
+
if (completionToken) {
|
|
734
|
+
const searchToken = extractSearchToken(completionToken);
|
|
735
|
+
// Skip if we already fetched for this exact token
|
|
736
|
+
if (latestSearchTokenRef.current === searchToken) {
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
void debouncedFetchFileSuggestions(searchToken, false);
|
|
740
|
+
}
|
|
741
|
+
else {
|
|
742
|
+
// If we had file suggestions but now there's no completion token
|
|
743
|
+
debouncedFetchFileSuggestions.cancel();
|
|
744
|
+
clearSuggestions();
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
// Clear shell suggestions if not in bash mode OR if input has changed
|
|
748
|
+
if (suggestionType === 'shell') {
|
|
749
|
+
const inputSnapshot = suggestionsRef.current[0]?.metadata?.inputSnapshot;
|
|
750
|
+
if (mode !== 'bash' || value !== inputSnapshot) {
|
|
751
|
+
debouncedFetchFileSuggestions.cancel();
|
|
752
|
+
clearSuggestions();
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}, [suggestionType, commands, setSuggestionsState, clearSuggestions, debouncedFetchFileSuggestions, debouncedFetchSlackChannels, mode, suppressSuggestions,
|
|
756
|
+
// Note: using suggestionsRef instead of suggestions to avoid recreating
|
|
757
|
+
// this callback when only selectedSuggestion changes (not the suggestions list)
|
|
758
|
+
allCommandsMaxWidth]);
|
|
759
|
+
// Update suggestions when input changes
|
|
760
|
+
// Note: We intentionally don't depend on cursorOffset here - cursor movement alone
|
|
761
|
+
// shouldn't re-trigger suggestions. The cursorOffsetRef is used to get the current
|
|
762
|
+
// position when needed without causing re-renders.
|
|
763
|
+
useEffect(() => {
|
|
764
|
+
// If suggestions were dismissed for this exact input, don't re-trigger
|
|
765
|
+
if (dismissedForInputRef.current === input) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
// When the actual input text changes (not just updateSuggestions being recreated),
|
|
769
|
+
// reset the search token ref so the same query can be re-fetched.
|
|
770
|
+
// This fixes: type @readme.md, clear, retype @readme.md → no suggestions.
|
|
771
|
+
if (prevInputRef.current !== input) {
|
|
772
|
+
prevInputRef.current = input;
|
|
773
|
+
latestSearchTokenRef.current = null;
|
|
774
|
+
}
|
|
775
|
+
// Clear the dismissed state when input changes
|
|
776
|
+
dismissedForInputRef.current = null;
|
|
777
|
+
void updateSuggestions(input);
|
|
778
|
+
}, [input, updateSuggestions]);
|
|
779
|
+
// Handle tab key press - complete suggestions or trigger file suggestions
|
|
780
|
+
const handleTab = useCallback(async () => {
|
|
781
|
+
// If we have inline ghost text, apply it
|
|
782
|
+
if (effectiveGhostText) {
|
|
783
|
+
// Check for bash mode history completion first
|
|
784
|
+
if (mode === 'bash') {
|
|
785
|
+
// Replace the input with the full command from history
|
|
786
|
+
onInputChange(effectiveGhostText.fullCommand);
|
|
787
|
+
setCursorOffset(effectiveGhostText.fullCommand.length);
|
|
788
|
+
setInlineGhostText(undefined);
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
// Find the mid-input command to get its position (for prompt mode)
|
|
792
|
+
const midInputCommand = findMidInputSlashCommand(input, cursorOffset);
|
|
793
|
+
if (midInputCommand) {
|
|
794
|
+
// Replace the partial command with the full command + space
|
|
795
|
+
const before = input.slice(0, midInputCommand.startPos);
|
|
796
|
+
const after = input.slice(midInputCommand.startPos + midInputCommand.token.length);
|
|
797
|
+
const newInput = before + '/' + effectiveGhostText.fullCommand + ' ' + after;
|
|
798
|
+
const newCursorOffset = midInputCommand.startPos + 1 + effectiveGhostText.fullCommand.length + 1;
|
|
799
|
+
onInputChange(newInput);
|
|
800
|
+
setCursorOffset(newCursorOffset);
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
// If we have active suggestions, select one
|
|
805
|
+
if (suggestions.length > 0) {
|
|
806
|
+
// Cancel any pending debounced fetches to prevent flicker when accepting
|
|
807
|
+
debouncedFetchFileSuggestions.cancel();
|
|
808
|
+
debouncedFetchSlackChannels.cancel();
|
|
809
|
+
const index = selectedSuggestion === -1 ? 0 : selectedSuggestion;
|
|
810
|
+
const suggestion = suggestions[index];
|
|
811
|
+
if (suggestionType === 'command' && index < suggestions.length) {
|
|
812
|
+
if (suggestion) {
|
|
813
|
+
applyCommandSuggestion(suggestion, false,
|
|
814
|
+
// don't execute on tab
|
|
815
|
+
commands, onInputChange, setCursorOffset, onSubmit);
|
|
816
|
+
clearSuggestions();
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
else if (suggestionType === 'custom-title' && suggestions.length > 0) {
|
|
820
|
+
// Apply custom title to /resume command with sessionId
|
|
821
|
+
if (suggestion) {
|
|
822
|
+
const newInput = buildResumeInputFromSuggestion(suggestion);
|
|
823
|
+
onInputChange(newInput);
|
|
824
|
+
setCursorOffset(newInput.length);
|
|
825
|
+
clearSuggestions();
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
else if (suggestionType === 'directory' && suggestions.length > 0) {
|
|
829
|
+
const suggestion = suggestions[index];
|
|
830
|
+
if (suggestion) {
|
|
831
|
+
// Check if this is a command context (e.g., /add-dir) or general path completion
|
|
832
|
+
const isInCommandContext = isCommandInput(input);
|
|
833
|
+
let newInput;
|
|
834
|
+
if (isInCommandContext) {
|
|
835
|
+
// Command context: replace just the argument portion
|
|
836
|
+
const spaceIndex = input.indexOf(' ');
|
|
837
|
+
const commandPart = input.slice(0, spaceIndex + 1); // Include the space
|
|
838
|
+
const cmdSuffix = isPathMetadata(suggestion.metadata) && suggestion.metadata.type === 'directory' ? '/' : ' ';
|
|
839
|
+
newInput = commandPart + suggestion.id + cmdSuffix;
|
|
840
|
+
onInputChange(newInput);
|
|
841
|
+
setCursorOffset(newInput.length);
|
|
842
|
+
if (isPathMetadata(suggestion.metadata) && suggestion.metadata.type === 'directory') {
|
|
843
|
+
// For directories, fetch new suggestions for the updated path
|
|
844
|
+
setSuggestionsState(prev => ({
|
|
845
|
+
...prev,
|
|
846
|
+
commandArgumentHint: undefined
|
|
847
|
+
}));
|
|
848
|
+
void updateSuggestions(newInput, newInput.length);
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
clearSuggestions();
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
else {
|
|
855
|
+
// General path completion: replace the path token in input with @-prefixed path
|
|
856
|
+
// Try to get token with @ prefix first to check if already prefixed
|
|
857
|
+
const completionTokenWithAt = extractCompletionToken(input, cursorOffset, true);
|
|
858
|
+
const completionToken = completionTokenWithAt ?? extractCompletionToken(input, cursorOffset, false);
|
|
859
|
+
if (completionToken) {
|
|
860
|
+
const isDir = isPathMetadata(suggestion.metadata) && suggestion.metadata.type === 'directory';
|
|
861
|
+
const result = applyDirectorySuggestion(input, suggestion.id, completionToken.startPos, completionToken.token.length, isDir);
|
|
862
|
+
newInput = result.newInput;
|
|
863
|
+
onInputChange(newInput);
|
|
864
|
+
setCursorOffset(result.cursorPos);
|
|
865
|
+
if (isDir) {
|
|
866
|
+
// For directories, fetch new suggestions for the updated path
|
|
867
|
+
setSuggestionsState(prev => ({
|
|
868
|
+
...prev,
|
|
869
|
+
commandArgumentHint: undefined
|
|
870
|
+
}));
|
|
871
|
+
void updateSuggestions(newInput, result.cursorPos);
|
|
872
|
+
}
|
|
873
|
+
else {
|
|
874
|
+
// For files, clear suggestions
|
|
875
|
+
clearSuggestions();
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
// No completion token found (e.g., cursor after space) - just clear suggestions
|
|
880
|
+
// without modifying input to avoid data loss
|
|
881
|
+
clearSuggestions();
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
else if (suggestionType === 'shell' && suggestions.length > 0) {
|
|
887
|
+
const suggestion = suggestions[index];
|
|
888
|
+
if (suggestion) {
|
|
889
|
+
const metadata = suggestion.metadata;
|
|
890
|
+
applyShellSuggestion(suggestion, input, cursorOffset, onInputChange, setCursorOffset, metadata?.completionType);
|
|
891
|
+
clearSuggestions();
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
else if (suggestionType === 'agent' && suggestions.length > 0 && suggestions[index]?.id?.startsWith('dm-')) {
|
|
895
|
+
const suggestion = suggestions[index];
|
|
896
|
+
if (suggestion) {
|
|
897
|
+
applyTriggerSuggestion(suggestion, input, cursorOffset, DM_MEMBER_RE, onInputChange, setCursorOffset);
|
|
898
|
+
clearSuggestions();
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
else if (suggestionType === 'slack-channel' && suggestions.length > 0) {
|
|
902
|
+
const suggestion = suggestions[index];
|
|
903
|
+
if (suggestion) {
|
|
904
|
+
applyTriggerSuggestion(suggestion, input, cursorOffset, HASH_CHANNEL_RE, onInputChange, setCursorOffset);
|
|
905
|
+
clearSuggestions();
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
else if (suggestionType === 'file' && suggestions.length > 0) {
|
|
909
|
+
const completionToken = extractCompletionToken(input, cursorOffset, true);
|
|
910
|
+
if (!completionToken) {
|
|
911
|
+
clearSuggestions();
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
// Check if all suggestions share a common prefix longer than the current input
|
|
915
|
+
const commonPrefix = findLongestCommonPrefix(suggestions);
|
|
916
|
+
// Determine if token starts with @ to preserve it during replacement
|
|
917
|
+
const hasAtPrefix = completionToken.token.startsWith('@');
|
|
918
|
+
// The effective token length excludes the @ and quotes if present
|
|
919
|
+
let effectiveTokenLength;
|
|
920
|
+
if (completionToken.isQuoted) {
|
|
921
|
+
// Remove @" prefix and optional closing " to get effective length
|
|
922
|
+
effectiveTokenLength = completionToken.token.slice(2).replace(/"$/, '').length;
|
|
923
|
+
}
|
|
924
|
+
else if (hasAtPrefix) {
|
|
925
|
+
effectiveTokenLength = completionToken.token.length - 1;
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
effectiveTokenLength = completionToken.token.length;
|
|
929
|
+
}
|
|
930
|
+
// If there's a common prefix longer than what the user has typed,
|
|
931
|
+
// replace the current input with the common prefix
|
|
932
|
+
if (commonPrefix.length > effectiveTokenLength) {
|
|
933
|
+
const replacementValue = formatReplacementValue({
|
|
934
|
+
displayText: commonPrefix,
|
|
935
|
+
mode,
|
|
936
|
+
hasAtPrefix,
|
|
937
|
+
needsQuotes: false,
|
|
938
|
+
// common prefix doesn't need quotes unless already quoted
|
|
939
|
+
isQuoted: completionToken.isQuoted,
|
|
940
|
+
isComplete: false // partial completion
|
|
941
|
+
});
|
|
942
|
+
applyFileSuggestion(replacementValue, input, completionToken.token, completionToken.startPos, onInputChange, setCursorOffset);
|
|
943
|
+
// Don't clear suggestions so user can continue typing or select a specific option
|
|
944
|
+
// Instead, update for the new prefix
|
|
945
|
+
void updateSuggestions(input.replace(completionToken.token, replacementValue), cursorOffset);
|
|
946
|
+
}
|
|
947
|
+
else if (index < suggestions.length) {
|
|
948
|
+
// Otherwise, apply the selected suggestion
|
|
949
|
+
const suggestion = suggestions[index];
|
|
950
|
+
if (suggestion) {
|
|
951
|
+
const needsQuotes = suggestion.displayText.includes(' ');
|
|
952
|
+
const replacementValue = formatReplacementValue({
|
|
953
|
+
displayText: suggestion.displayText,
|
|
954
|
+
mode,
|
|
955
|
+
hasAtPrefix,
|
|
956
|
+
needsQuotes,
|
|
957
|
+
isQuoted: completionToken.isQuoted,
|
|
958
|
+
isComplete: true // complete suggestion
|
|
959
|
+
});
|
|
960
|
+
applyFileSuggestion(replacementValue, input, completionToken.token, completionToken.startPos, onInputChange, setCursorOffset);
|
|
961
|
+
clearSuggestions();
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
else if (input.trim() !== '') {
|
|
967
|
+
let suggestionType;
|
|
968
|
+
let suggestionItems;
|
|
969
|
+
if (mode === 'bash') {
|
|
970
|
+
suggestionType = 'shell';
|
|
971
|
+
// This should be very fast, taking <10ms
|
|
972
|
+
const bashSuggestions = await generateBashSuggestions(input, cursorOffset);
|
|
973
|
+
if (bashSuggestions.length === 1) {
|
|
974
|
+
// If single suggestion, apply it immediately
|
|
975
|
+
const suggestion = bashSuggestions[0];
|
|
976
|
+
if (suggestion) {
|
|
977
|
+
const metadata = suggestion.metadata;
|
|
978
|
+
applyShellSuggestion(suggestion, input, cursorOffset, onInputChange, setCursorOffset, metadata?.completionType);
|
|
979
|
+
}
|
|
980
|
+
suggestionItems = [];
|
|
981
|
+
}
|
|
982
|
+
else {
|
|
983
|
+
suggestionItems = bashSuggestions;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
else {
|
|
987
|
+
suggestionType = 'file';
|
|
988
|
+
// If no suggestions, fetch file and MCP resource suggestions
|
|
989
|
+
const completionInfo = extractCompletionToken(input, cursorOffset, true);
|
|
990
|
+
if (completionInfo) {
|
|
991
|
+
// If token starts with @, search without the @ prefix
|
|
992
|
+
const isAtSymbol = completionInfo.token.startsWith('@');
|
|
993
|
+
const searchToken = isAtSymbol ? completionInfo.token.substring(1) : completionInfo.token;
|
|
994
|
+
suggestionItems = await generateUnifiedSuggestions(searchToken, mcpResources, agents, isAtSymbol);
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
suggestionItems = [];
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
if (suggestionItems.length > 0) {
|
|
1001
|
+
// Multiple suggestions or not bash mode: show list
|
|
1002
|
+
setSuggestionsState(prev => ({
|
|
1003
|
+
commandArgumentHint: undefined,
|
|
1004
|
+
suggestions: suggestionItems,
|
|
1005
|
+
selectedSuggestion: getPreservedSelection(prev.suggestions, prev.selectedSuggestion, suggestionItems)
|
|
1006
|
+
}));
|
|
1007
|
+
setSuggestionType(suggestionType);
|
|
1008
|
+
setMaxColumnWidth(undefined);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}, [suggestions, selectedSuggestion, input, suggestionType, commands, mode, onInputChange, setCursorOffset, onSubmit, clearSuggestions, cursorOffset, updateSuggestions, mcpResources, setSuggestionsState, agents, debouncedFetchFileSuggestions, debouncedFetchSlackChannels, effectiveGhostText]);
|
|
1012
|
+
// Handle enter key press - apply and execute suggestions
|
|
1013
|
+
const handleEnter = useCallback(() => {
|
|
1014
|
+
if (suggestions.length === 0)
|
|
1015
|
+
return;
|
|
1016
|
+
const index = selectedSuggestion === -1 ? 0 : selectedSuggestion;
|
|
1017
|
+
const suggestion = suggestions[index];
|
|
1018
|
+
if (suggestionType === 'command' && index < suggestions.length) {
|
|
1019
|
+
if (suggestion) {
|
|
1020
|
+
applyCommandSuggestion(suggestion, true,
|
|
1021
|
+
// execute on return
|
|
1022
|
+
commands, onInputChange, setCursorOffset, onSubmit);
|
|
1023
|
+
debouncedFetchFileSuggestions.cancel();
|
|
1024
|
+
clearSuggestions();
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
else if (suggestionType === 'custom-title' && index < suggestions.length) {
|
|
1028
|
+
// Apply custom title and execute /resume command with sessionId
|
|
1029
|
+
if (suggestion) {
|
|
1030
|
+
const newInput = buildResumeInputFromSuggestion(suggestion);
|
|
1031
|
+
onInputChange(newInput);
|
|
1032
|
+
setCursorOffset(newInput.length);
|
|
1033
|
+
onSubmit(newInput, /* isSubmittingSlashCommand */ true);
|
|
1034
|
+
debouncedFetchFileSuggestions.cancel();
|
|
1035
|
+
clearSuggestions();
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
else if (suggestionType === 'shell' && index < suggestions.length) {
|
|
1039
|
+
if (suggestion) {
|
|
1040
|
+
const metadata = suggestion.metadata;
|
|
1041
|
+
applyShellSuggestion(suggestion, input, cursorOffset, onInputChange, setCursorOffset, metadata?.completionType);
|
|
1042
|
+
debouncedFetchFileSuggestions.cancel();
|
|
1043
|
+
clearSuggestions();
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
else if (suggestionType === 'agent' && index < suggestions.length && suggestion?.id?.startsWith('dm-')) {
|
|
1047
|
+
applyTriggerSuggestion(suggestion, input, cursorOffset, DM_MEMBER_RE, onInputChange, setCursorOffset);
|
|
1048
|
+
debouncedFetchFileSuggestions.cancel();
|
|
1049
|
+
clearSuggestions();
|
|
1050
|
+
}
|
|
1051
|
+
else if (suggestionType === 'slack-channel' && index < suggestions.length) {
|
|
1052
|
+
if (suggestion) {
|
|
1053
|
+
applyTriggerSuggestion(suggestion, input, cursorOffset, HASH_CHANNEL_RE, onInputChange, setCursorOffset);
|
|
1054
|
+
debouncedFetchSlackChannels.cancel();
|
|
1055
|
+
clearSuggestions();
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
else if (suggestionType === 'file' && index < suggestions.length) {
|
|
1059
|
+
// Extract completion token directly when needed
|
|
1060
|
+
const completionInfo = extractCompletionToken(input, cursorOffset, true);
|
|
1061
|
+
if (completionInfo) {
|
|
1062
|
+
if (suggestion) {
|
|
1063
|
+
const hasAtPrefix = completionInfo.token.startsWith('@');
|
|
1064
|
+
const needsQuotes = suggestion.displayText.includes(' ');
|
|
1065
|
+
const replacementValue = formatReplacementValue({
|
|
1066
|
+
displayText: suggestion.displayText,
|
|
1067
|
+
mode,
|
|
1068
|
+
hasAtPrefix,
|
|
1069
|
+
needsQuotes,
|
|
1070
|
+
isQuoted: completionInfo.isQuoted,
|
|
1071
|
+
isComplete: true // complete suggestion
|
|
1072
|
+
});
|
|
1073
|
+
applyFileSuggestion(replacementValue, input, completionInfo.token, completionInfo.startPos, onInputChange, setCursorOffset);
|
|
1074
|
+
debouncedFetchFileSuggestions.cancel();
|
|
1075
|
+
clearSuggestions();
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
else if (suggestionType === 'directory' && index < suggestions.length) {
|
|
1080
|
+
if (suggestion) {
|
|
1081
|
+
// In command context (e.g., /add-dir), Enter submits the command
|
|
1082
|
+
// rather than applying the directory suggestion. Just clear
|
|
1083
|
+
// suggestions and let the submit handler process the current input.
|
|
1084
|
+
if (isCommandInput(input)) {
|
|
1085
|
+
debouncedFetchFileSuggestions.cancel();
|
|
1086
|
+
clearSuggestions();
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
// General path completion: replace the path token
|
|
1090
|
+
const completionTokenWithAt = extractCompletionToken(input, cursorOffset, true);
|
|
1091
|
+
const completionToken = completionTokenWithAt ?? extractCompletionToken(input, cursorOffset, false);
|
|
1092
|
+
if (completionToken) {
|
|
1093
|
+
const isDir = isPathMetadata(suggestion.metadata) && suggestion.metadata.type === 'directory';
|
|
1094
|
+
const result = applyDirectorySuggestion(input, suggestion.id, completionToken.startPos, completionToken.token.length, isDir);
|
|
1095
|
+
onInputChange(result.newInput);
|
|
1096
|
+
setCursorOffset(result.cursorPos);
|
|
1097
|
+
}
|
|
1098
|
+
// If no completion token found (e.g., cursor after space), don't modify input
|
|
1099
|
+
// to avoid data loss - just clear suggestions
|
|
1100
|
+
debouncedFetchFileSuggestions.cancel();
|
|
1101
|
+
clearSuggestions();
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}, [suggestions, selectedSuggestion, suggestionType, commands, input, cursorOffset, mode, onInputChange, setCursorOffset, onSubmit, clearSuggestions, debouncedFetchFileSuggestions, debouncedFetchSlackChannels]);
|
|
1105
|
+
// Handler for autocomplete:accept - accepts current suggestion via Tab or Right Arrow
|
|
1106
|
+
const handleAutocompleteAccept = useCallback(() => {
|
|
1107
|
+
void handleTab();
|
|
1108
|
+
}, [handleTab]);
|
|
1109
|
+
// Handler for autocomplete:dismiss - clears suggestions and prevents re-triggering
|
|
1110
|
+
const handleAutocompleteDismiss = useCallback(() => {
|
|
1111
|
+
debouncedFetchFileSuggestions.cancel();
|
|
1112
|
+
debouncedFetchSlackChannels.cancel();
|
|
1113
|
+
clearSuggestions();
|
|
1114
|
+
// Remember the input when dismissed to prevent immediate re-triggering
|
|
1115
|
+
dismissedForInputRef.current = input;
|
|
1116
|
+
}, [debouncedFetchFileSuggestions, debouncedFetchSlackChannels, clearSuggestions, input]);
|
|
1117
|
+
// Handler for autocomplete:previous - selects previous suggestion
|
|
1118
|
+
const handleAutocompletePrevious = useCallback(() => {
|
|
1119
|
+
setSuggestionsState(prev => ({
|
|
1120
|
+
...prev,
|
|
1121
|
+
selectedSuggestion: prev.selectedSuggestion <= 0 ? suggestions.length - 1 : prev.selectedSuggestion - 1
|
|
1122
|
+
}));
|
|
1123
|
+
}, [suggestions.length, setSuggestionsState]);
|
|
1124
|
+
// Handler for autocomplete:next - selects next suggestion
|
|
1125
|
+
const handleAutocompleteNext = useCallback(() => {
|
|
1126
|
+
setSuggestionsState(prev => ({
|
|
1127
|
+
...prev,
|
|
1128
|
+
selectedSuggestion: prev.selectedSuggestion >= suggestions.length - 1 ? 0 : prev.selectedSuggestion + 1
|
|
1129
|
+
}));
|
|
1130
|
+
}, [suggestions.length, setSuggestionsState]);
|
|
1131
|
+
// Autocomplete context keybindings - only active when suggestions are visible
|
|
1132
|
+
const autocompleteHandlers = useMemo(() => ({
|
|
1133
|
+
'autocomplete:accept': handleAutocompleteAccept,
|
|
1134
|
+
'autocomplete:dismiss': handleAutocompleteDismiss,
|
|
1135
|
+
'autocomplete:previous': handleAutocompletePrevious,
|
|
1136
|
+
'autocomplete:next': handleAutocompleteNext
|
|
1137
|
+
}), [handleAutocompleteAccept, handleAutocompleteDismiss, handleAutocompletePrevious, handleAutocompleteNext]);
|
|
1138
|
+
// Register autocomplete as an overlay so CancelRequestHandler defers ESC handling
|
|
1139
|
+
// This ensures ESC dismisses autocomplete before canceling running tasks
|
|
1140
|
+
const isAutocompleteActive = suggestions.length > 0 || !!effectiveGhostText;
|
|
1141
|
+
const isModalOverlayActive = useIsModalOverlayActive();
|
|
1142
|
+
useRegisterOverlay('autocomplete', isAutocompleteActive);
|
|
1143
|
+
// Register Autocomplete context so it appears in activeContexts for other handlers.
|
|
1144
|
+
// This allows Chat's resolver to see Autocomplete and defer to its bindings for up/down.
|
|
1145
|
+
useRegisterKeybindingContext('Autocomplete', isAutocompleteActive);
|
|
1146
|
+
// Disable autocomplete keybindings when a modal overlay (e.g., DiffDialog) is active,
|
|
1147
|
+
// so escape reaches the overlay's handler instead of dismissing autocomplete
|
|
1148
|
+
useKeybindings(autocompleteHandlers, {
|
|
1149
|
+
context: 'Autocomplete',
|
|
1150
|
+
isActive: isAutocompleteActive && !isModalOverlayActive
|
|
1151
|
+
});
|
|
1152
|
+
function acceptSuggestionText(text) {
|
|
1153
|
+
const detectedMode = getModeFromInput(text);
|
|
1154
|
+
if (detectedMode !== 'prompt' && onModeChange) {
|
|
1155
|
+
onModeChange(detectedMode);
|
|
1156
|
+
const stripped = getValueFromInput(text);
|
|
1157
|
+
onInputChange(stripped);
|
|
1158
|
+
setCursorOffset(stripped.length);
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
onInputChange(text);
|
|
1162
|
+
setCursorOffset(text.length);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
// Handle keyboard input for behaviors not covered by keybindings
|
|
1166
|
+
const handleKeyDown = (e) => {
|
|
1167
|
+
// Handle right arrow to accept prompt suggestion ghost text
|
|
1168
|
+
if (e.key === 'right' && !isViewingTeammate) {
|
|
1169
|
+
const suggestionText = promptSuggestion.text;
|
|
1170
|
+
const suggestionShownAt = promptSuggestion.shownAt;
|
|
1171
|
+
if (suggestionText && suggestionShownAt > 0 && input === '') {
|
|
1172
|
+
markAccepted();
|
|
1173
|
+
acceptSuggestionText(suggestionText);
|
|
1174
|
+
e.stopImmediatePropagation();
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
// Handle Tab key fallback behaviors when no autocomplete suggestions
|
|
1179
|
+
// Don't handle tab if shift is pressed (used for mode cycle)
|
|
1180
|
+
if (e.key === 'tab' && !e.shift) {
|
|
1181
|
+
// Skip if autocomplete is handling this (suggestions or ghost text exist)
|
|
1182
|
+
if (suggestions.length > 0 || effectiveGhostText) {
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
// Accept prompt suggestion if it exists in AppState
|
|
1186
|
+
const suggestionText = promptSuggestion.text;
|
|
1187
|
+
const suggestionShownAt = promptSuggestion.shownAt;
|
|
1188
|
+
if (suggestionText && suggestionShownAt > 0 && input === '' && !isViewingTeammate) {
|
|
1189
|
+
e.preventDefault();
|
|
1190
|
+
markAccepted();
|
|
1191
|
+
acceptSuggestionText(suggestionText);
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
// Remind user about thinking toggle shortcut if empty input
|
|
1195
|
+
if (input.trim() === '') {
|
|
1196
|
+
e.preventDefault();
|
|
1197
|
+
addNotification({
|
|
1198
|
+
key: 'thinking-toggle-hint',
|
|
1199
|
+
jsx: _jsxs(Text, { dimColor: true, children: ["Use ", thinkingToggleShortcut, " to toggle thinking"] }),
|
|
1200
|
+
priority: 'immediate',
|
|
1201
|
+
timeoutMs: 3000
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
// Only continue with navigation if we have suggestions
|
|
1207
|
+
if (suggestions.length === 0)
|
|
1208
|
+
return;
|
|
1209
|
+
// Handle Ctrl-N/P for navigation (arrows handled by keybindings)
|
|
1210
|
+
// Skip if we're in the middle of a chord sequence to allow chords like ctrl+f n
|
|
1211
|
+
const hasPendingChord = keybindingContext?.pendingChord != null;
|
|
1212
|
+
if (e.ctrl && e.key === 'n' && !hasPendingChord) {
|
|
1213
|
+
e.preventDefault();
|
|
1214
|
+
handleAutocompleteNext();
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
if (e.ctrl && e.key === 'p' && !hasPendingChord) {
|
|
1218
|
+
e.preventDefault();
|
|
1219
|
+
handleAutocompletePrevious();
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
// Handle selection and execution via return/enter
|
|
1223
|
+
// Shift+Enter and Meta+Enter insert newlines (handled by useTextInput),
|
|
1224
|
+
// so don't accept the suggestion for those.
|
|
1225
|
+
if ((e.key === 'return' || e.key === 'enter') && !e.shift && !e.meta) {
|
|
1226
|
+
e.preventDefault();
|
|
1227
|
+
handleEnter();
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
// Backward-compat bridge: PromptInput doesn't yet wire handleKeyDown to
|
|
1231
|
+
// <Box onKeyDown>. Subscribe via useInput and adapt InputEvent →
|
|
1232
|
+
// KeyboardEvent until the consumer is migrated (separate PR).
|
|
1233
|
+
// TODO(onKeyDown-migration): remove once PromptInput passes handleKeyDown.
|
|
1234
|
+
useInput((_input, _key, event) => {
|
|
1235
|
+
const kbEvent = new KeyboardEvent(event.keypress);
|
|
1236
|
+
handleKeyDown(kbEvent);
|
|
1237
|
+
if (kbEvent.didStopImmediatePropagation()) {
|
|
1238
|
+
event.stopImmediatePropagation();
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
return {
|
|
1242
|
+
suggestions,
|
|
1243
|
+
selectedSuggestion,
|
|
1244
|
+
suggestionType,
|
|
1245
|
+
maxColumnWidth,
|
|
1246
|
+
commandArgumentHint,
|
|
1247
|
+
inlineGhostText: effectiveGhostText,
|
|
1248
|
+
handleKeyDown
|
|
1249
|
+
};
|
|
1250
|
+
}
|