lcclaude 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +21 -0
- package/README.en.md +333 -0
- package/README.md +333 -0
- package/bin/lcclaude.js +30 -0
- package/dist/preload.js +15 -0
- package/dist/runtime/bun-bundle-shim.js +10 -0
- package/dist/runtime/bun-wrap-shim.js +63 -0
- package/dist/src/QueryEngine.js +804 -0
- package/dist/src/Task.js +40 -0
- package/dist/src/Tool.js +33 -0
- package/dist/src/assistant/sessionHistory.js +39 -0
- package/dist/src/bootstrap/state.js +985 -0
- package/dist/src/bridge/bridgeApi.js +254 -0
- package/dist/src/bridge/bridgeConfig.js +14 -0
- package/dist/src/bridge/bridgeDebug.js +64 -0
- package/dist/src/bridge/bridgeEnabled.js +55 -0
- package/dist/src/bridge/bridgeMain.js +1547 -0
- package/dist/src/bridge/bridgeMessaging.js +249 -0
- package/dist/src/bridge/bridgePermissionCallbacks.js +7 -0
- package/dist/src/bridge/bridgePointer.js +105 -0
- package/dist/src/bridge/bridgeStatusUtil.js +81 -0
- package/dist/src/bridge/bridgeUI.js +375 -0
- package/dist/src/bridge/capacityWake.js +26 -0
- package/dist/src/bridge/codeSessionApi.js +78 -0
- package/dist/src/bridge/createSession.js +227 -0
- package/dist/src/bridge/debugUtils.js +80 -0
- package/dist/src/bridge/envLessBridgeConfig.js +61 -0
- package/dist/src/bridge/flushGate.js +32 -0
- package/dist/src/bridge/inboundAttachments.js +106 -0
- package/dist/src/bridge/inboundMessages.js +38 -0
- package/dist/src/bridge/initReplBridge.js +276 -0
- package/dist/src/bridge/jwtUtils.js +131 -0
- package/dist/src/bridge/pollConfig.js +28 -0
- package/dist/src/bridge/pollConfigDefaults.js +15 -0
- package/dist/src/bridge/remoteBridgeCore.js +511 -0
- package/dist/src/bridge/replBridge.js +1098 -0
- package/dist/src/bridge/replBridgeHandle.js +14 -0
- package/dist/src/bridge/replBridgeTransport.js +147 -0
- package/dist/src/bridge/sessionIdCompat.js +16 -0
- package/dist/src/bridge/sessionRunner.js +349 -0
- package/dist/src/bridge/trustedDevice.js +113 -0
- package/dist/src/bridge/types.js +6 -0
- package/dist/src/bridge/workSecret.js +51 -0
- package/dist/src/buddy/CompanionSprite.js +435 -0
- package/dist/src/buddy/companion.js +104 -0
- package/dist/src/buddy/prompt.js +31 -0
- package/dist/src/buddy/sprites.js +500 -0
- package/dist/src/buddy/types.js +85 -0
- package/dist/src/buddy/useBuddyNotification.js +93 -0
- package/dist/src/cli/exit.js +13 -0
- package/dist/src/cli/handlers/agents.js +55 -0
- package/dist/src/cli/handlers/auth.js +255 -0
- package/dist/src/cli/handlers/autoMode.js +117 -0
- package/dist/src/cli/handlers/mcp.js +304 -0
- package/dist/src/cli/handlers/plugins.js +538 -0
- package/dist/src/cli/handlers/util.js +119 -0
- package/dist/src/cli/ndjsonSafeStringify.js +8 -0
- package/dist/src/cli/print.js +3112 -0
- package/dist/src/cli/remoteIO.js +161 -0
- package/dist/src/cli/structuredIO.js +489 -0
- package/dist/src/cli/transports/HybridTransport.js +145 -0
- package/dist/src/cli/transports/SSETransport.js +403 -0
- package/dist/src/cli/transports/SerialBatchEventUploader.js +154 -0
- package/dist/src/cli/transports/WebSocketTransport.js +497 -0
- package/dist/src/cli/transports/WorkerStateUploader.js +69 -0
- package/dist/src/cli/transports/ccrClient.js +522 -0
- package/dist/src/cli/transports/transportUtils.js +25 -0
- package/dist/src/cli/update.js +361 -0
- package/dist/src/commands/add-dir/add-dir.js +140 -0
- package/dist/src/commands/add-dir/index.js +8 -0
- package/dist/src/commands/add-dir/validation.js +67 -0
- package/dist/src/commands/advisor.js +96 -0
- package/dist/src/commands/agents/agents.js +12 -0
- package/dist/src/commands/agents/index.js +7 -0
- package/dist/src/commands/ant-trace/index.js +1 -0
- package/dist/src/commands/autofix-pr/index.js +1 -0
- package/dist/src/commands/backfill-sessions/index.js +1 -0
- package/dist/src/commands/branch/branch.js +168 -0
- package/dist/src/commands/branch/index.js +9 -0
- package/dist/src/commands/break-cache/index.js +1 -0
- package/dist/src/commands/bridge/bridge.js +519 -0
- package/dist/src/commands/bridge/index.js +21 -0
- package/dist/src/commands/bridge-kick.js +145 -0
- package/dist/src/commands/brief.js +66 -0
- package/dist/src/commands/btw/btw.js +281 -0
- package/dist/src/commands/btw/index.js +9 -0
- package/dist/src/commands/bughunter/index.js +1 -0
- package/dist/src/commands/chrome/chrome.js +394 -0
- package/dist/src/commands/chrome/index.js +10 -0
- package/dist/src/commands/clear/caches.js +69 -0
- package/dist/src/commands/clear/clear.js +5 -0
- package/dist/src/commands/clear/conversation.js +156 -0
- package/dist/src/commands/clear/index.js +9 -0
- package/dist/src/commands/color/color.js +57 -0
- package/dist/src/commands/color/index.js +9 -0
- package/dist/src/commands/commit-push-pr.js +145 -0
- package/dist/src/commands/commit.js +83 -0
- package/dist/src/commands/compact/compact.js +161 -0
- package/dist/src/commands/compact/index.js +11 -0
- package/dist/src/commands/config/config.js +9 -0
- package/dist/src/commands/config/index.js +8 -0
- package/dist/src/commands/context/context-noninteractive.js +256 -0
- package/dist/src/commands/context/context.js +33 -0
- package/dist/src/commands/context/index.js +21 -0
- package/dist/src/commands/copy/copy.js +397 -0
- package/dist/src/commands/copy/index.js +7 -0
- package/dist/src/commands/cost/cost.js +21 -0
- package/dist/src/commands/cost/index.js +15 -0
- package/dist/src/commands/createMovedToPluginCommand.js +40 -0
- package/dist/src/commands/ctx_viz/index.js +1 -0
- package/dist/src/commands/debug-tool-call/index.js +1 -0
- package/dist/src/commands/desktop/desktop.js +7 -0
- package/dist/src/commands/desktop/index.js +22 -0
- package/dist/src/commands/diff/diff.js +10 -0
- package/dist/src/commands/diff/index.js +6 -0
- package/dist/src/commands/doctor/doctor.js +7 -0
- package/dist/src/commands/doctor/index.js +9 -0
- package/dist/src/commands/effort/effort.js +181 -0
- package/dist/src/commands/effort/index.js +11 -0
- package/dist/src/commands/env/index.js +1 -0
- package/dist/src/commands/exit/exit.js +25 -0
- package/dist/src/commands/exit/index.js +9 -0
- package/dist/src/commands/export/export.js +79 -0
- package/dist/src/commands/export/index.js +8 -0
- package/dist/src/commands/extra-usage/extra-usage-core.js +85 -0
- package/dist/src/commands/extra-usage/extra-usage-noninteractive.js +11 -0
- package/dist/src/commands/extra-usage/extra-usage.js +17 -0
- package/dist/src/commands/extra-usage/index.js +27 -0
- package/dist/src/commands/fast/fast.js +345 -0
- package/dist/src/commands/fast/index.js +23 -0
- package/dist/src/commands/feedback/feedback.js +15 -0
- package/dist/src/commands/feedback/index.js +13 -0
- package/dist/src/commands/files/files.js +13 -0
- package/dist/src/commands/files/index.js +9 -0
- package/dist/src/commands/good-claude/index.js +1 -0
- package/dist/src/commands/heapdump/heapdump.js +15 -0
- package/dist/src/commands/heapdump/index.js +9 -0
- package/dist/src/commands/help/help.js +12 -0
- package/dist/src/commands/help/index.js +7 -0
- package/dist/src/commands/hooks/hooks.js +14 -0
- package/dist/src/commands/hooks/index.js +8 -0
- package/dist/src/commands/ide/ide.js +702 -0
- package/dist/src/commands/ide/index.js +8 -0
- package/dist/src/commands/init-verifiers.js +258 -0
- package/dist/src/commands/init.js +240 -0
- package/dist/src/commands/insights.js +2212 -0
- package/dist/src/commands/install-github-app/ApiKeyStep.js +290 -0
- package/dist/src/commands/install-github-app/CheckExistingSecretStep.js +265 -0
- package/dist/src/commands/install-github-app/CheckGitHubStep.js +16 -0
- package/dist/src/commands/install-github-app/ChooseRepoStep.js +282 -0
- package/dist/src/commands/install-github-app/CreatingStep.js +87 -0
- package/dist/src/commands/install-github-app/ErrorStep.js +157 -0
- package/dist/src/commands/install-github-app/ExistingWorkflowStep.js +164 -0
- package/dist/src/commands/install-github-app/InstallAppStep.js +166 -0
- package/dist/src/commands/install-github-app/OAuthFlowStep.js +335 -0
- package/dist/src/commands/install-github-app/SuccessStep.js +173 -0
- package/dist/src/commands/install-github-app/WarningsStep.js +140 -0
- package/dist/src/commands/install-github-app/index.js +10 -0
- package/dist/src/commands/install-github-app/install-github-app.js +612 -0
- package/dist/src/commands/install-github-app/setupGitHubActions.js +223 -0
- package/dist/src/commands/install-slack-app/index.js +9 -0
- package/dist/src/commands/install-slack-app/install-slack-app.js +23 -0
- package/dist/src/commands/install.js +348 -0
- package/dist/src/commands/issue/index.js +1 -0
- package/dist/src/commands/keybindings/index.js +10 -0
- package/dist/src/commands/keybindings/keybindings.js +43 -0
- package/dist/src/commands/login/index.js +9 -0
- package/dist/src/commands/login/login.js +105 -0
- package/dist/src/commands/logout/index.js +8 -0
- package/dist/src/commands/logout/logout.js +68 -0
- package/dist/src/commands/mcp/addCommand.js +157 -0
- package/dist/src/commands/mcp/index.js +9 -0
- package/dist/src/commands/mcp/mcp.js +85 -0
- package/dist/src/commands/mcp/xaaIdpCommand.js +135 -0
- package/dist/src/commands/memory/index.js +7 -0
- package/dist/src/commands/memory/memory.js +95 -0
- package/dist/src/commands/mobile/index.js +8 -0
- package/dist/src/commands/mobile/mobile.js +324 -0
- package/dist/src/commands/mock-limits/index.js +1 -0
- package/dist/src/commands/model/index.js +14 -0
- package/dist/src/commands/model/model.js +289 -0
- package/dist/src/commands/oauth-refresh/index.js +1 -0
- package/dist/src/commands/onboarding/index.js +1 -0
- package/dist/src/commands/output-style/index.js +8 -0
- package/dist/src/commands/output-style/output-style.js +5 -0
- package/dist/src/commands/passes/index.js +20 -0
- package/dist/src/commands/passes/passes.js +23 -0
- package/dist/src/commands/perf-issue/index.js +1 -0
- package/dist/src/commands/permissions/index.js +8 -0
- package/dist/src/commands/permissions/permissions.js +11 -0
- package/dist/src/commands/plan/index.js +8 -0
- package/dist/src/commands/plan/plan.js +151 -0
- package/dist/src/commands/plugin/AddMarketplace.js +202 -0
- package/dist/src/commands/plugin/BrowseMarketplace.js +918 -0
- package/dist/src/commands/plugin/DiscoverPlugins.js +935 -0
- package/dist/src/commands/plugin/ManageMarketplaces.js +1018 -0
- package/dist/src/commands/plugin/ManagePlugins.js +2230 -0
- package/dist/src/commands/plugin/PluginErrors.js +118 -0
- package/dist/src/commands/plugin/PluginOptionsDialog.js +396 -0
- package/dist/src/commands/plugin/PluginOptionsFlow.js +80 -0
- package/dist/src/commands/plugin/PluginSettings.js +1313 -0
- package/dist/src/commands/plugin/PluginTrustWarning.js +50 -0
- package/dist/src/commands/plugin/UnifiedInstalledCell.js +749 -0
- package/dist/src/commands/plugin/ValidatePlugin.js +113 -0
- package/dist/src/commands/plugin/index.js +9 -0
- package/dist/src/commands/plugin/parseArgs.js +61 -0
- package/dist/src/commands/plugin/plugin.js +8 -0
- package/dist/src/commands/plugin/pluginDetailsHelpers.js +114 -0
- package/dist/src/commands/plugin/usePagination.js +75 -0
- package/dist/src/commands/pr_comments/index.js +49 -0
- package/dist/src/commands/privacy-settings/index.js +11 -0
- package/dist/src/commands/privacy-settings/privacy-settings.js +58 -0
- package/dist/src/commands/rate-limit-options/index.js +15 -0
- package/dist/src/commands/rate-limit-options/rate-limit-options.js +211 -0
- package/dist/src/commands/release-notes/index.js +8 -0
- package/dist/src/commands/release-notes/release-notes.js +38 -0
- package/dist/src/commands/reload-plugins/index.js +8 -0
- package/dist/src/commands/reload-plugins/reload-plugins.js +27 -0
- package/dist/src/commands/remote-env/index.js +12 -0
- package/dist/src/commands/remote-env/remote-env.js +7 -0
- package/dist/src/commands/remote-setup/api.js +121 -0
- package/dist/src/commands/remote-setup/index.js +14 -0
- package/dist/src/commands/remote-setup/remote-setup.js +173 -0
- package/dist/src/commands/rename/generateSessionName.js +51 -0
- package/dist/src/commands/rename/index.js +9 -0
- package/dist/src/commands/rename/rename.js +52 -0
- package/dist/src/commands/reset-limits/index.js +4 -0
- package/dist/src/commands/resume/index.js +9 -0
- package/dist/src/commands/resume/resume.js +281 -0
- package/dist/src/commands/review/UltrareviewOverageDialog.js +112 -0
- package/dist/src/commands/review/reviewRemote.js +193 -0
- package/dist/src/commands/review/ultrareviewCommand.js +50 -0
- package/dist/src/commands/review/ultrareviewEnabled.js +5 -0
- package/dist/src/commands/review.js +45 -0
- package/dist/src/commands/rewind/index.js +10 -0
- package/dist/src/commands/rewind/rewind.js +6 -0
- package/dist/src/commands/sandbox-toggle/index.js +35 -0
- package/dist/src/commands/sandbox-toggle/sandbox-toggle.js +61 -0
- package/dist/src/commands/security-review.js +228 -0
- package/dist/src/commands/session/index.js +13 -0
- package/dist/src/commands/session/session.js +185 -0
- package/dist/src/commands/share/index.js +1 -0
- package/dist/src/commands/skills/index.js +7 -0
- package/dist/src/commands/skills/skills.js +8 -0
- package/dist/src/commands/stats/index.js +7 -0
- package/dist/src/commands/stats/stats.js +7 -0
- package/dist/src/commands/status/index.js +8 -0
- package/dist/src/commands/status/status.js +9 -0
- package/dist/src/commands/statusline.js +20 -0
- package/dist/src/commands/stickers/index.js +8 -0
- package/dist/src/commands/stickers/stickers.js +13 -0
- package/dist/src/commands/summary/index.js +1 -0
- package/dist/src/commands/tag/index.js +9 -0
- package/dist/src/commands/tag/tag.js +250 -0
- package/dist/src/commands/tasks/index.js +8 -0
- package/dist/src/commands/tasks/tasks.js +8 -0
- package/dist/src/commands/teleport/index.js +1 -0
- package/dist/src/commands/terminalSetup/index.js +15 -0
- package/dist/src/commands/terminalSetup/terminalSetup.js +425 -0
- package/dist/src/commands/theme/index.js +7 -0
- package/dist/src/commands/theme/theme.js +58 -0
- package/dist/src/commands/thinkback/index.js +9 -0
- package/dist/src/commands/thinkback/thinkback.js +569 -0
- package/dist/src/commands/thinkback-play/index.js +11 -0
- package/dist/src/commands/thinkback-play/thinkback-play.js +31 -0
- package/dist/src/commands/ultraplan.js +361 -0
- package/dist/src/commands/upgrade/index.js +11 -0
- package/dist/src/commands/upgrade/upgrade.js +37 -0
- package/dist/src/commands/usage/index.js +7 -0
- package/dist/src/commands/usage/usage.js +9 -0
- package/dist/src/commands/version.js +15 -0
- package/dist/src/commands/vim/index.js +8 -0
- package/dist/src/commands/vim/vim.js +24 -0
- package/dist/src/commands/voice/index.js +17 -0
- package/dist/src/commands/voice/voice.js +117 -0
- package/dist/src/commands.js +476 -0
- package/dist/src/components/AgentProgressLine.js +202 -0
- package/dist/src/components/App.js +53 -0
- package/dist/src/components/ApproveApiKey.js +156 -0
- package/dist/src/components/AutoModeOptInDialog.js +154 -0
- package/dist/src/components/AutoUpdater.js +178 -0
- package/dist/src/components/AutoUpdaterWrapper.js +91 -0
- package/dist/src/components/AwsAuthStatusBox.js +119 -0
- package/dist/src/components/BaseTextInput.js +158 -0
- package/dist/src/components/BashModeProgress.js +65 -0
- package/dist/src/components/BridgeDialog.js +460 -0
- package/dist/src/components/BypassPermissionsModeDialog.js +111 -0
- package/dist/src/components/ChannelDowngradeDialog.js +114 -0
- package/dist/src/components/ClaudeCodeHint/PluginHintMenu.js +120 -0
- package/dist/src/components/ClaudeInChromeOnboarding.js +176 -0
- package/dist/src/components/ClaudeMdExternalIncludesDialog.js +172 -0
- package/dist/src/components/ClickableImageRef.js +74 -0
- package/dist/src/components/CompactSummary.js +220 -0
- package/dist/src/components/ConfigurableShortcutHint.js +33 -0
- package/dist/src/components/ConsoleOAuthFlow.js +841 -0
- package/dist/src/components/ContextSuggestions.js +85 -0
- package/dist/src/components/ContextVisualization.js +878 -0
- package/dist/src/components/CoordinatorAgentStatus.js +304 -0
- package/dist/src/components/CostThresholdDialog.js +66 -0
- package/dist/src/components/CtrlOToExpand.js +56 -0
- package/dist/src/components/CustomSelect/SelectMulti.js +246 -0
- package/dist/src/components/CustomSelect/index.js +2 -0
- package/dist/src/components/CustomSelect/option-map.js +32 -0
- package/dist/src/components/CustomSelect/select-input-option.js +558 -0
- package/dist/src/components/CustomSelect/select-option.js +39 -0
- package/dist/src/components/CustomSelect/select.js +803 -0
- package/dist/src/components/CustomSelect/use-multi-select-state.js +175 -0
- package/dist/src/components/CustomSelect/use-select-input.js +163 -0
- package/dist/src/components/CustomSelect/use-select-navigation.js +334 -0
- package/dist/src/components/CustomSelect/use-select-state.js +30 -0
- package/dist/src/components/DesktopHandoff.js +214 -0
- package/dist/src/components/DesktopUpsell/DesktopUpsellStartup.js +185 -0
- package/dist/src/components/DevBar.js +53 -0
- package/dist/src/components/DevChannelsDialog.js +128 -0
- package/dist/src/components/DiagnosticsDisplay.js +149 -0
- package/dist/src/components/EffortCallout.js +302 -0
- package/dist/src/components/EffortIndicator.js +30 -0
- package/dist/src/components/ExitFlow.js +45 -0
- package/dist/src/components/ExportDialog.js +160 -0
- package/dist/src/components/FallbackToolUseErrorMessage.js +149 -0
- package/dist/src/components/FallbackToolUseRejectedMessage.js +18 -0
- package/dist/src/components/FastIcon.js +49 -0
- package/dist/src/components/Feedback.js +589 -0
- package/dist/src/components/FeedbackSurvey/FeedbackSurvey.js +219 -0
- package/dist/src/components/FeedbackSurvey/FeedbackSurveyView.js +168 -0
- package/dist/src/components/FeedbackSurvey/TranscriptSharePrompt.js +147 -0
- package/dist/src/components/FeedbackSurvey/submitTranscriptShare.js +70 -0
- package/dist/src/components/FeedbackSurvey/useDebouncedDigitInput.js +45 -0
- package/dist/src/components/FeedbackSurvey/useFeedbackSurvey.js +242 -0
- package/dist/src/components/FeedbackSurvey/useMemorySurvey.js +188 -0
- package/dist/src/components/FeedbackSurvey/usePostCompactSurvey.js +200 -0
- package/dist/src/components/FeedbackSurvey/useSurveyState.js +81 -0
- package/dist/src/components/FileEditToolDiff.js +193 -0
- package/dist/src/components/FileEditToolUpdatedMessage.js +162 -0
- package/dist/src/components/FileEditToolUseRejectedMessage.js +215 -0
- package/dist/src/components/FilePathLink.js +33 -0
- package/dist/src/components/FullscreenLayout.js +592 -0
- package/dist/src/components/GlobalSearchDialog.js +371 -0
- package/dist/src/components/HelpV2/Commands.js +99 -0
- package/dist/src/components/HelpV2/General.js +48 -0
- package/dist/src/components/HelpV2/HelpV2.js +231 -0
- package/dist/src/components/HighlightedCode/Fallback.js +200 -0
- package/dist/src/components/HighlightedCode.js +219 -0
- package/dist/src/components/HistorySearchDialog.js +144 -0
- package/dist/src/components/IdeAutoConnectDialog.js +172 -0
- package/dist/src/components/IdeOnboardingDialog.js +249 -0
- package/dist/src/components/IdeStatusIndicator.js +68 -0
- package/dist/src/components/IdleReturnDialog.js +126 -0
- package/dist/src/components/InterruptedByUser.js +25 -0
- package/dist/src/components/InvalidConfigDialog.js +173 -0
- package/dist/src/components/InvalidSettingsDialog.js +94 -0
- package/dist/src/components/KeybindingWarnings.js +144 -0
- package/dist/src/components/LanguagePicker.js +112 -0
- package/dist/src/components/LogSelector.js +1775 -0
- package/dist/src/components/LogoV2/AnimatedAsterisk.js +49 -0
- package/dist/src/components/LogoV2/AnimatedClawd.js +105 -0
- package/dist/src/components/LogoV2/ChannelsNotice.js +334 -0
- package/dist/src/components/LogoV2/Clawd.js +285 -0
- package/dist/src/components/LogoV2/CondensedLogo.js +218 -0
- package/dist/src/components/LogoV2/EmergencyTip.js +47 -0
- package/dist/src/components/LogoV2/Feed.js +140 -0
- package/dist/src/components/LogoV2/FeedColumn.js +67 -0
- package/dist/src/components/LogoV2/GuestPassesUpsell.js +90 -0
- package/dist/src/components/LogoV2/LogoV2.js +774 -0
- package/dist/src/components/LogoV2/Opus1mMergeNotice.js +68 -0
- package/dist/src/components/LogoV2/OverageCreditUpsell.js +154 -0
- package/dist/src/components/LogoV2/VoiceModeNotice.js +75 -0
- package/dist/src/components/LogoV2/WelcomeV2.js +976 -0
- package/dist/src/components/LogoV2/feedConfigs.js +89 -0
- package/dist/src/components/LspRecommendation/LspRecommendationMenu.js +128 -0
- package/dist/src/components/MCPServerApprovalDialog.js +121 -0
- package/dist/src/components/MCPServerDesktopImportDialog.js +249 -0
- package/dist/src/components/MCPServerDialogCopy.js +24 -0
- package/dist/src/components/MCPServerMultiselectDialog.js +173 -0
- package/dist/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +199 -0
- package/dist/src/components/ManagedSettingsSecurityDialog/utils.js +75 -0
- package/dist/src/components/Markdown.js +200 -0
- package/dist/src/components/MarkdownTable.js +215 -0
- package/dist/src/components/MemoryUsageIndicator.js +33 -0
- package/dist/src/components/Message.js +638 -0
- package/dist/src/components/MessageModel.js +43 -0
- package/dist/src/components/MessageResponse.js +99 -0
- package/dist/src/components/MessageRow.js +350 -0
- package/dist/src/components/MessageSelector.js +1021 -0
- package/dist/src/components/MessageTimestamp.js +63 -0
- package/dist/src/components/Messages.js +576 -0
- package/dist/src/components/ModelPicker.js +582 -0
- package/dist/src/components/NativeAutoUpdater.js +169 -0
- package/dist/src/components/NotebookEditToolUseRejectedMessage.js +123 -0
- package/dist/src/components/OffscreenFreeze.js +21 -0
- package/dist/src/components/Onboarding.js +307 -0
- package/dist/src/components/OutputStylePicker.js +128 -0
- package/dist/src/components/PackageManagerAutoUpdater.js +116 -0
- package/dist/src/components/Passes/Passes.js +242 -0
- package/dist/src/components/PrBadge.js +119 -0
- package/dist/src/components/PressEnterToContinue.js +24 -0
- package/dist/src/components/PromptInput/HistorySearchInput.js +64 -0
- package/dist/src/components/PromptInput/IssueFlagBanner.js +6 -0
- package/dist/src/components/PromptInput/Notifications.js +343 -0
- package/dist/src/components/PromptInput/PromptInput.js +1837 -0
- package/dist/src/components/PromptInput/PromptInputFooter.js +192 -0
- package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +504 -0
- package/dist/src/components/PromptInput/PromptInputFooterSuggestions.js +296 -0
- package/dist/src/components/PromptInput/PromptInputHelpMenu.js +508 -0
- package/dist/src/components/PromptInput/PromptInputModeIndicator.js +92 -0
- package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +90 -0
- package/dist/src/components/PromptInput/PromptInputStashNotice.js +30 -0
- package/dist/src/components/PromptInput/SandboxPromptFooterHint.js +80 -0
- package/dist/src/components/PromptInput/ShimmeredInput.js +157 -0
- package/dist/src/components/PromptInput/VoiceIndicator.js +138 -0
- package/dist/src/components/PromptInput/inputModes.js +24 -0
- package/dist/src/components/PromptInput/inputPaste.js +46 -0
- package/dist/src/components/PromptInput/useMaybeTruncateInput.js +36 -0
- package/dist/src/components/PromptInput/usePromptInputPlaceholder.js +39 -0
- package/dist/src/components/PromptInput/useShowFastIconHint.js +19 -0
- package/dist/src/components/PromptInput/useSwarmBanner.js +99 -0
- package/dist/src/components/PromptInput/utils.js +25 -0
- package/dist/src/components/QuickOpenDialog.js +272 -0
- package/dist/src/components/RemoteCallout.js +81 -0
- package/dist/src/components/RemoteEnvironmentDialog.js +451 -0
- package/dist/src/components/ResumeTask.js +361 -0
- package/dist/src/components/SandboxViolationExpandedView.js +134 -0
- package/dist/src/components/ScrollKeybindingHandler.js +589 -0
- package/dist/src/components/SearchBox.js +111 -0
- package/dist/src/components/SentryErrorBoundary.js +17 -0
- package/dist/src/components/SessionBackgroundHint.js +103 -0
- package/dist/src/components/SessionPreview.js +263 -0
- package/dist/src/components/Settings/Config.js +1776 -0
- package/dist/src/components/Settings/Settings.js +159 -0
- package/dist/src/components/Settings/Status.js +315 -0
- package/dist/src/components/Settings/Usage.js +503 -0
- package/dist/src/components/ShowInIDEPrompt.js +212 -0
- package/dist/src/components/SkillImprovementSurvey.js +204 -0
- package/dist/src/components/Spinner/FlashingChar.js +60 -0
- package/dist/src/components/Spinner/GlimmerMessage.js +391 -0
- package/dist/src/components/Spinner/ShimmerChar.js +30 -0
- package/dist/src/components/Spinner/SpinnerAnimationRow.js +248 -0
- package/dist/src/components/Spinner/SpinnerGlyph.js +105 -0
- package/dist/src/components/Spinner/TeammateSpinnerLine.js +243 -0
- package/dist/src/components/Spinner/TeammateSpinnerTree.js +360 -0
- package/dist/src/components/Spinner/index.js +7 -0
- package/dist/src/components/Spinner/teammateSelectHint.js +1 -0
- package/dist/src/components/Spinner/useShimmerAnimation.js +17 -0
- package/dist/src/components/Spinner/useStalledAnimation.js +47 -0
- package/dist/src/components/Spinner/utils.js +65 -0
- package/dist/src/components/Spinner.js +596 -0
- package/dist/src/components/Stats.js +1415 -0
- package/dist/src/components/StatusLine.js +264 -0
- package/dist/src/components/StatusNotices.js +50 -0
- package/dist/src/components/StructuredDiff/Fallback.js +379 -0
- package/dist/src/components/StructuredDiff/colorDiff.js +21 -0
- package/dist/src/components/StructuredDiff.js +170 -0
- package/dist/src/components/StructuredDiffList.js +30 -0
- package/dist/src/components/TagTabs.js +124 -0
- package/dist/src/components/TaskListV2.js +430 -0
- package/dist/src/components/TeammateViewHeader.js +112 -0
- package/dist/src/components/TeleportError.js +200 -0
- package/dist/src/components/TeleportProgress.js +175 -0
- package/dist/src/components/TeleportRepoMismatchDialog.js +160 -0
- package/dist/src/components/TeleportResumeWrapper.js +207 -0
- package/dist/src/components/TeleportStash.js +159 -0
- package/dist/src/components/TextInput.js +94 -0
- package/dist/src/components/ThemePicker.js +428 -0
- package/dist/src/components/ThinkingToggle.js +233 -0
- package/dist/src/components/TokenWarning.js +165 -0
- package/dist/src/components/ToolUseLoader.js +44 -0
- package/dist/src/components/TrustDialog/TrustDialog.js +337 -0
- package/dist/src/components/TrustDialog/utils.js +149 -0
- package/dist/src/components/ValidationErrorsList.js +169 -0
- package/dist/src/components/VimTextInput.js +142 -0
- package/dist/src/components/VirtualMessageList.js +745 -0
- package/dist/src/components/WorkflowMultiselectDialog.js +173 -0
- package/dist/src/components/WorktreeExitDialog.js +228 -0
- package/dist/src/components/agents/AgentDetail.js +371 -0
- package/dist/src/components/agents/AgentEditor.js +191 -0
- package/dist/src/components/agents/AgentNavigationFooter.js +28 -0
- package/dist/src/components/agents/AgentsList.js +623 -0
- package/dist/src/components/agents/AgentsMenu.js +897 -0
- package/dist/src/components/agents/ColorPicker.js +170 -0
- package/dist/src/components/agents/ModelSelector.js +79 -0
- package/dist/src/components/agents/ToolSelector.js +581 -0
- package/dist/src/components/agents/agentFileUtils.js +142 -0
- package/dist/src/components/agents/generateAgent.js +160 -0
- package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +101 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +108 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +551 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +73 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +176 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +176 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +104 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +136 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +105 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +75 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +185 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +81 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +146 -0
- package/dist/src/components/agents/types.js +4 -0
- package/dist/src/components/agents/utils.js +14 -0
- package/dist/src/components/agents/validateAgent.js +66 -0
- package/dist/src/components/design-system/Byline.js +53 -0
- package/dist/src/components/design-system/Dialog.js +171 -0
- package/dist/src/components/design-system/Divider.js +107 -0
- package/dist/src/components/design-system/FuzzyPicker.js +316 -0
- package/dist/src/components/design-system/KeyboardShortcutHint.js +63 -0
- package/dist/src/components/design-system/ListItem.js +186 -0
- package/dist/src/components/design-system/LoadingState.js +72 -0
- package/dist/src/components/design-system/Pane.js +67 -0
- package/dist/src/components/design-system/ProgressBar.js +67 -0
- package/dist/src/components/design-system/Ratchet.js +83 -0
- package/dist/src/components/design-system/StatusIcon.js +60 -0
- package/dist/src/components/design-system/Tabs.js +332 -0
- package/dist/src/components/design-system/ThemeProvider.js +117 -0
- package/dist/src/components/design-system/ThemedBox.js +123 -0
- package/dist/src/components/design-system/ThemedText.js +68 -0
- package/dist/src/components/design-system/color.js +13 -0
- package/dist/src/components/diff/DiffDetailView.js +388 -0
- package/dist/src/components/diff/DiffDialog.js +489 -0
- package/dist/src/components/diff/DiffFileList.js +359 -0
- package/dist/src/components/grove/Grove.js +710 -0
- package/dist/src/components/hooks/HooksConfigMenu.js +626 -0
- package/dist/src/components/hooks/PromptDialog.js +96 -0
- package/dist/src/components/hooks/SelectEventMode.js +169 -0
- package/dist/src/components/hooks/SelectHookMode.js +127 -0
- package/dist/src/components/hooks/SelectMatcherMode.js +156 -0
- package/dist/src/components/hooks/ViewHookMode.js +275 -0
- package/dist/src/components/mcp/CapabilitiesSection.js +68 -0
- package/dist/src/components/mcp/ElicitationDialog.js +1330 -0
- package/dist/src/components/mcp/MCPAgentServerMenu.js +275 -0
- package/dist/src/components/mcp/MCPListPanel.js +671 -0
- package/dist/src/components/mcp/MCPReconnect.js +210 -0
- package/dist/src/components/mcp/MCPRemoteServerMenu.js +906 -0
- package/dist/src/components/mcp/MCPSettings.js +415 -0
- package/dist/src/components/mcp/MCPStdioServerMenu.js +276 -0
- package/dist/src/components/mcp/MCPToolDetailView.js +316 -0
- package/dist/src/components/mcp/MCPToolListView.js +169 -0
- package/dist/src/components/mcp/McpParsingWarnings.js +319 -0
- package/dist/src/components/mcp/index.js +8 -0
- package/dist/src/components/mcp/utils/reconnectHelpers.js +28 -0
- package/dist/src/components/memory/MemoryFileSelector.js +459 -0
- package/dist/src/components/memory/MemoryUpdateNotification.js +51 -0
- package/dist/src/components/messageActions.js +464 -0
- package/dist/src/components/messages/AdvisorMessage.js +202 -0
- package/dist/src/components/messages/AssistantRedactedThinkingMessage.js +34 -0
- package/dist/src/components/messages/AssistantTextMessage.js +373 -0
- package/dist/src/components/messages/AssistantThinkingMessage.js +105 -0
- package/dist/src/components/messages/AssistantToolUseMessage.js +414 -0
- package/dist/src/components/messages/AttachmentMessage.js +764 -0
- package/dist/src/components/messages/CollapsedReadSearchContent.js +651 -0
- package/dist/src/components/messages/CompactBoundaryMessage.js +27 -0
- package/dist/src/components/messages/GroupedToolUseContent.js +42 -0
- package/dist/src/components/messages/HighlightedThinkingText.js +215 -0
- package/dist/src/components/messages/HookProgressMessage.js +150 -0
- package/dist/src/components/messages/PlanApprovalMessage.js +294 -0
- package/dist/src/components/messages/RateLimitMessage.js +164 -0
- package/dist/src/components/messages/ShutdownMessage.js +180 -0
- package/dist/src/components/messages/SystemAPIErrorMessage.js +162 -0
- package/dist/src/components/messages/SystemTextMessage.js +1145 -0
- package/dist/src/components/messages/TaskAssignmentMessage.js +100 -0
- package/dist/src/components/messages/UserAgentNotificationMessage.js +89 -0
- package/dist/src/components/messages/UserBashInputMessage.js +67 -0
- package/dist/src/components/messages/UserBashOutputMessage.js +56 -0
- package/dist/src/components/messages/UserChannelMessage.js +145 -0
- package/dist/src/components/messages/UserCommandMessage.js +146 -0
- package/dist/src/components/messages/UserImageMessage.js +59 -0
- package/dist/src/components/messages/UserLocalCommandOutputMessage.js +226 -0
- package/dist/src/components/messages/UserMemoryInputMessage.js +101 -0
- package/dist/src/components/messages/UserPlanMessage.js +56 -0
- package/dist/src/components/messages/UserPromptMessage.js +54 -0
- package/dist/src/components/messages/UserResourceUpdateMessage.js +131 -0
- package/dist/src/components/messages/UserTeammateMessage.js +215 -0
- package/dist/src/components/messages/UserTextMessage.js +207 -0
- package/dist/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +46 -0
- package/dist/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +21 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +18 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +90 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +80 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +116 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +73 -0
- package/dist/src/components/messages/UserToolResultMessage/utils.js +41 -0
- package/dist/src/components/messages/nullRenderingAttachments.js +40 -0
- package/dist/src/components/messages/teamMemCollapsed.js +160 -0
- package/dist/src/components/messages/teamMemSaved.js +9 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +696 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +263 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +384 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +228 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +611 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +218 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +98 -0
- package/dist/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +458 -0
- package/dist/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +90 -0
- package/dist/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +567 -0
- package/dist/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +175 -0
- package/dist/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +728 -0
- package/dist/src/components/permissions/FallbackPermissionRequest.js +385 -0
- package/dist/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +205 -0
- package/dist/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +188 -0
- package/dist/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +13 -0
- package/dist/src/components/permissions/FilePermissionDialog/permissionOptions.js +159 -0
- package/dist/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +129 -0
- package/dist/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +100 -0
- package/dist/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +186 -0
- package/dist/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +110 -0
- package/dist/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +143 -0
- package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +194 -0
- package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +278 -0
- package/dist/src/components/permissions/PermissionDecisionDebugInfo.js +709 -0
- package/dist/src/components/permissions/PermissionDialog.js +90 -0
- package/dist/src/components/permissions/PermissionExplanation.js +298 -0
- package/dist/src/components/permissions/PermissionPrompt.js +327 -0
- package/dist/src/components/permissions/PermissionRequest.js +164 -0
- package/dist/src/components/permissions/PermissionRequestTitle.js +85 -0
- package/dist/src/components/permissions/PermissionRuleExplanation.js +112 -0
- package/dist/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +263 -0
- package/dist/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +70 -0
- package/dist/src/components/permissions/SandboxPermissionRequest.js +205 -0
- package/dist/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +259 -0
- package/dist/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +424 -0
- package/dist/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +299 -0
- package/dist/src/components/permissions/WorkerBadge.js +56 -0
- package/dist/src/components/permissions/WorkerPendingPermission.js +158 -0
- package/dist/src/components/permissions/hooks.js +128 -0
- package/dist/src/components/permissions/rules/AddPermissionRules.js +203 -0
- package/dist/src/components/permissions/rules/AddWorkspaceDirectory.js +437 -0
- package/dist/src/components/permissions/rules/PermissionRuleDescription.js +101 -0
- package/dist/src/components/permissions/rules/PermissionRuleInput.js +208 -0
- package/dist/src/components/permissions/rules/PermissionRuleList.js +1382 -0
- package/dist/src/components/permissions/rules/RecentDenialsTab.js +229 -0
- package/dist/src/components/permissions/rules/RemoveWorkspaceDirectory.js +123 -0
- package/dist/src/components/permissions/rules/WorkspaceTab.js +161 -0
- package/dist/src/components/permissions/shellPermissionHelpers.js +219 -0
- package/dist/src/components/permissions/useShellPermissionFeedback.js +98 -0
- package/dist/src/components/permissions/utils.js +18 -0
- package/dist/src/components/sandbox/SandboxConfigTab.js +195 -0
- package/dist/src/components/sandbox/SandboxDependenciesTab.js +265 -0
- package/dist/src/components/sandbox/SandboxDoctorSection.js +80 -0
- package/dist/src/components/sandbox/SandboxOverridesTab.js +272 -0
- package/dist/src/components/sandbox/SandboxSettings.js +374 -0
- package/dist/src/components/shell/ExpandShellOutputContext.js +25 -0
- package/dist/src/components/shell/OutputLine.js +107 -0
- package/dist/src/components/shell/ShellProgressMessage.js +189 -0
- package/dist/src/components/shell/ShellTimeDisplay.js +78 -0
- package/dist/src/components/skills/SkillsMenu.js +310 -0
- package/dist/src/components/tasks/AsyncAgentDetailDialog.js +353 -0
- package/dist/src/components/tasks/BackgroundTask.js +428 -0
- package/dist/src/components/tasks/BackgroundTaskStatus.js +522 -0
- package/dist/src/components/tasks/BackgroundTasksDialog.js +784 -0
- package/dist/src/components/tasks/DreamDetailDialog.js +353 -0
- package/dist/src/components/tasks/InProcessTeammateDetailDialog.js +393 -0
- package/dist/src/components/tasks/RemoteSessionDetailDialog.js +1188 -0
- package/dist/src/components/tasks/RemoteSessionProgress.js +310 -0
- package/dist/src/components/tasks/ShellDetailDialog.js +511 -0
- package/dist/src/components/tasks/ShellProgress.js +93 -0
- package/dist/src/components/tasks/renderToolActivity.js +34 -0
- package/dist/src/components/tasks/taskStatusUtils.js +77 -0
- package/dist/src/components/teams/TeamStatus.js +95 -0
- package/dist/src/components/teams/TeamsDialog.js +734 -0
- package/dist/src/components/ui/OrderedList.js +74 -0
- package/dist/src/components/ui/OrderedListItem.js +53 -0
- package/dist/src/components/ui/TreeSelect.js +307 -0
- package/dist/src/components/wizard/WizardDialogLayout.js +71 -0
- package/dist/src/components/wizard/WizardNavigationFooter.js +36 -0
- package/dist/src/components/wizard/WizardProvider.js +211 -0
- package/dist/src/components/wizard/index.js +4 -0
- package/dist/src/components/wizard/useWizard.js +9 -0
- package/dist/src/constants/apiLimits.js +11 -0
- package/dist/src/constants/betas.js +28 -0
- package/dist/src/constants/common.js +16 -0
- package/dist/src/constants/cyberRiskInstruction.js +1 -0
- package/dist/src/constants/errorIds.js +1 -0
- package/dist/src/constants/figures.js +31 -0
- package/dist/src/constants/files.js +115 -0
- package/dist/src/constants/github-app.js +139 -0
- package/dist/src/constants/keys.js +4 -0
- package/dist/src/constants/messages.js +1 -0
- package/dist/src/constants/oauth.js +141 -0
- package/dist/src/constants/outputStyles.js +155 -0
- package/dist/src/constants/product.js +25 -0
- package/dist/src/constants/prompts.js +544 -0
- package/dist/src/constants/spinnerVerbs.js +201 -0
- package/dist/src/constants/system.js +46 -0
- package/dist/src/constants/systemPromptSections.js +27 -0
- package/dist/src/constants/toolLimits.js +6 -0
- package/dist/src/constants/tools.js +75 -0
- package/dist/src/constants/turnCompletionVerbs.js +10 -0
- package/dist/src/constants/xml.js +54 -0
- package/dist/src/context/QueuedMessageContext.js +57 -0
- package/dist/src/context/fpsMetrics.js +26 -0
- package/dist/src/context/mailbox.js +37 -0
- package/dist/src/context/modalContext.js +26 -0
- package/dist/src/context/notifications.js +176 -0
- package/dist/src/context/overlayContext.js +92 -0
- package/dist/src/context/promptOverlayContext.js +99 -0
- package/dist/src/context/stats.js +203 -0
- package/dist/src/context/voice.js +62 -0
- package/dist/src/context.js +119 -0
- package/dist/src/coordinator/coordinatorMode.js +323 -0
- package/dist/src/cost-tracker.js +234 -0
- package/dist/src/costHook.js +19 -0
- package/dist/src/dialogLaunchers.js +92 -0
- package/dist/src/entrypoints/agentSdkTypes.js +51 -0
- package/dist/src/entrypoints/cli.js +92 -0
- package/dist/src/entrypoints/init.js +199 -0
- package/dist/src/entrypoints/mcp.js +132 -0
- package/dist/src/entrypoints/npm-bin.js +6 -0
- package/dist/src/entrypoints/sandboxTypes.js +34 -0
- package/dist/src/entrypoints/sdk/controlSchemas.js +347 -0
- package/dist/src/entrypoints/sdk/coreSchemas.js +1019 -0
- package/dist/src/entrypoints/sdk/coreTypes.generated.js +1 -0
- package/dist/src/entrypoints/sdk/coreTypes.js +38 -0
- package/dist/src/entrypoints/sdk/runtimeTypes.js +1 -0
- package/dist/src/entrypoints/sdk/settingsTypes.generated.js +1 -0
- package/dist/src/entrypoints/sdk/toolTypes.js +1 -0
- package/dist/src/history.js +297 -0
- package/dist/src/hooks/fileSuggestions.js +460 -0
- package/dist/src/hooks/notifs/useAutoModeUnavailableNotification.js +39 -0
- package/dist/src/hooks/notifs/useCanSwitchToExistingSubscription.js +64 -0
- package/dist/src/hooks/notifs/useDeprecationWarningNotification.js +43 -0
- package/dist/src/hooks/notifs/useFastModeNotification.js +161 -0
- package/dist/src/hooks/notifs/useIDEStatusIndicator.js +187 -0
- package/dist/src/hooks/notifs/useInstallMessages.js +25 -0
- package/dist/src/hooks/notifs/useLspInitializationNotification.js +147 -0
- package/dist/src/hooks/notifs/useMcpConnectivityStatus.js +154 -0
- package/dist/src/hooks/notifs/useModelMigrationNotifications.js +45 -0
- package/dist/src/hooks/notifs/useNpmDeprecationNotification.js +24 -0
- package/dist/src/hooks/notifs/usePluginAutoupdateNotification.js +93 -0
- package/dist/src/hooks/notifs/usePluginInstallationStatus.js +143 -0
- package/dist/src/hooks/notifs/useRateLimitWarningNotification.js +118 -0
- package/dist/src/hooks/notifs/useSettingsErrors.js +67 -0
- package/dist/src/hooks/notifs/useStartupNotification.js +24 -0
- package/dist/src/hooks/notifs/useTeammateShutdownNotification.js +61 -0
- package/dist/src/hooks/renderPlaceholder.js +27 -0
- package/dist/src/hooks/toolPermission/PermissionContext.js +186 -0
- package/dist/src/hooks/toolPermission/handlers/coordinatorHandler.js +22 -0
- package/dist/src/hooks/toolPermission/handlers/interactiveHandler.js +194 -0
- package/dist/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +79 -0
- package/dist/src/hooks/toolPermission/permissionLogging.js +114 -0
- package/dist/src/hooks/unifiedSuggestions.js +115 -0
- package/dist/src/hooks/useAfterFirstRender.js +12 -0
- package/dist/src/hooks/useApiKeyVerification.js +58 -0
- package/dist/src/hooks/useArrowKeyHistory.js +176 -0
- package/dist/src/hooks/useAssistantHistory.js +150 -0
- package/dist/src/hooks/useAwaySummary.js +95 -0
- package/dist/src/hooks/useBackgroundTaskNavigation.js +163 -0
- package/dist/src/hooks/useBlink.js +10 -0
- package/dist/src/hooks/useCanUseTool.js +144 -0
- package/dist/src/hooks/useCancelRequest.js +165 -0
- package/dist/src/hooks/useChromeExtensionNotification.js +55 -0
- package/dist/src/hooks/useClaudeCodeHintRecommendation.js +113 -0
- package/dist/src/hooks/useClipboardImageHint.js +45 -0
- package/dist/src/hooks/useCommandKeybindings.js +81 -0
- package/dist/src/hooks/useCommandQueue.js +8 -0
- package/dist/src/hooks/useCopyOnSelect.js +44 -0
- package/dist/src/hooks/useDeferredHookMessages.js +35 -0
- package/dist/src/hooks/useDiffData.js +62 -0
- package/dist/src/hooks/useDiffInIDE.js +197 -0
- package/dist/src/hooks/useDirectConnect.js +154 -0
- package/dist/src/hooks/useDoublePress.js +36 -0
- package/dist/src/hooks/useDynamicConfig.js +10 -0
- package/dist/src/hooks/useElapsedTime.js +12 -0
- package/dist/src/hooks/useExitOnCtrlCD.js +27 -0
- package/dist/src/hooks/useExitOnCtrlCDWithKeybindings.js +5 -0
- package/dist/src/hooks/useFileHistorySnapshotInit.js +17 -0
- package/dist/src/hooks/useGlobalKeybindings.js +132 -0
- package/dist/src/hooks/useHistorySearch.js +219 -0
- package/dist/src/hooks/useIDEIntegration.js +60 -0
- package/dist/src/hooks/useIdeAtMentioned.js +42 -0
- package/dist/src/hooks/useIdeConnectionStatus.js +18 -0
- package/dist/src/hooks/useIdeLogging.js +26 -0
- package/dist/src/hooks/useIdeSelection.js +78 -0
- package/dist/src/hooks/useInboxPoller.js +626 -0
- package/dist/src/hooks/useInputBuffer.js +69 -0
- package/dist/src/hooks/useIssueFlagBanner.js +101 -0
- package/dist/src/hooks/useLogMessages.js +47 -0
- package/dist/src/hooks/useLspPluginRecommendation.js +163 -0
- package/dist/src/hooks/useMailboxBridge.js +15 -0
- package/dist/src/hooks/useMainLoopModel.js +15 -0
- package/dist/src/hooks/useManagePlugins.js +195 -0
- package/dist/src/hooks/useMemoryUsage.js +17 -0
- package/dist/src/hooks/useMergedClients.js +11 -0
- package/dist/src/hooks/useMergedCommands.js +10 -0
- package/dist/src/hooks/useMergedTools.js +18 -0
- package/dist/src/hooks/useMinDisplayTime.js +19 -0
- package/dist/src/hooks/useNotifyAfterTimeout.js +34 -0
- package/dist/src/hooks/useOfficialMarketplaceNotification.js +50 -0
- package/dist/src/hooks/usePasteHandler.js +129 -0
- package/dist/src/hooks/usePluginRecommendationBase.js +98 -0
- package/dist/src/hooks/usePrStatus.js +77 -0
- package/dist/src/hooks/usePromptSuggestion.js +124 -0
- package/dist/src/hooks/usePromptsFromClaudeInChrome.js +60 -0
- package/dist/src/hooks/useQueueProcessor.js +29 -0
- package/dist/src/hooks/useRemoteSession.js +313 -0
- package/dist/src/hooks/useReplBridge.js +59 -0
- package/dist/src/hooks/useSSHSession.js +161 -0
- package/dist/src/hooks/useScheduledTasks.js +68 -0
- package/dist/src/hooks/useSearchInput.js +285 -0
- package/dist/src/hooks/useSessionBackgrounding.js +120 -0
- package/dist/src/hooks/useSettings.js +4 -0
- package/dist/src/hooks/useSettingsChange.js +10 -0
- package/dist/src/hooks/useSkillImprovementSurvey.js +61 -0
- package/dist/src/hooks/useSkillsChange.js +39 -0
- package/dist/src/hooks/useSwarmInitialization.js +39 -0
- package/dist/src/hooks/useSwarmPermissionPoller.js +141 -0
- package/dist/src/hooks/useTaskListWatcher.js +124 -0
- package/dist/src/hooks/useTasksV2.js +161 -0
- package/dist/src/hooks/useTeammateViewAutoExit.js +35 -0
- package/dist/src/hooks/useTeleportResume.js +75 -0
- package/dist/src/hooks/useTerminalSize.js +11 -0
- package/dist/src/hooks/useTextInput.js +353 -0
- package/dist/src/hooks/useTimeout.js +10 -0
- package/dist/src/hooks/useTurnDiffs.js +131 -0
- package/dist/src/hooks/useTypeahead.js +993 -0
- package/dist/src/hooks/useUpdateNotification.js +21 -0
- package/dist/src/hooks/useVimInput.js +210 -0
- package/dist/src/hooks/useVirtualScroll.js +282 -0
- package/dist/src/hooks/useVoice.js +675 -0
- package/dist/src/hooks/useVoiceEnabled.js +12 -0
- package/dist/src/hooks/useVoiceIntegration.js +391 -0
- package/dist/src/ink/Ansi.js +290 -0
- package/dist/src/ink/bidi.js +72 -0
- package/dist/src/ink/clearTerminal.js +42 -0
- package/dist/src/ink/colorize.js +119 -0
- package/dist/src/ink/components/AlternateScreen.js +60 -0
- package/dist/src/ink/components/App.js +375 -0
- package/dist/src/ink/components/AppContext.js +6 -0
- package/dist/src/ink/components/Box.js +181 -0
- package/dist/src/ink/components/Button.js +167 -0
- package/dist/src/ink/components/ClockContext.js +100 -0
- package/dist/src/ink/components/CursorDeclarationContext.js +3 -0
- package/dist/src/ink/components/ErrorOverview.js +152 -0
- package/dist/src/ink/components/Link.js +42 -0
- package/dist/src/ink/components/Newline.js +29 -0
- package/dist/src/ink/components/NoSelect.js +40 -0
- package/dist/src/ink/components/RawAnsi.js +36 -0
- package/dist/src/ink/components/ScrollBox.js +139 -0
- package/dist/src/ink/components/Spacer.js +16 -0
- package/dist/src/ink/components/StdinContext.js +12 -0
- package/dist/src/ink/components/TerminalFocusContext.js +43 -0
- package/dist/src/ink/components/TerminalSizeContext.js +2 -0
- package/dist/src/ink/components/Text.js +196 -0
- package/dist/src/ink/constants.js +1 -0
- package/dist/src/ink/dom.js +230 -0
- package/dist/src/ink/events/click-event.js +15 -0
- package/dist/src/ink/events/dispatcher.js +126 -0
- package/dist/src/ink/events/emitter.js +26 -0
- package/dist/src/ink/events/event-handlers.js +22 -0
- package/dist/src/ink/events/event.js +9 -0
- package/dist/src/ink/events/focus-event.js +9 -0
- package/dist/src/ink/events/input-event.js +83 -0
- package/dist/src/ink/events/keyboard-event.js +31 -0
- package/dist/src/ink/events/terminal-event.js +60 -0
- package/dist/src/ink/events/terminal-focus-event.js +9 -0
- package/dist/src/ink/focus.js +127 -0
- package/dist/src/ink/frame.js +22 -0
- package/dist/src/ink/get-max-width.js +5 -0
- package/dist/src/ink/hit-test.js +76 -0
- package/dist/src/ink/hooks/use-animation-frame.js +23 -0
- package/dist/src/ink/hooks/use-app.js +4 -0
- package/dist/src/ink/hooks/use-declared-cursor.js +27 -0
- package/dist/src/ink/hooks/use-input.js +31 -0
- package/dist/src/ink/hooks/use-interval.js +38 -0
- package/dist/src/ink/hooks/use-search-highlight.js +21 -0
- package/dist/src/ink/hooks/use-selection.js +47 -0
- package/dist/src/ink/hooks/use-stdin.js +4 -0
- package/dist/src/ink/hooks/use-tab-status.js +48 -0
- package/dist/src/ink/hooks/use-terminal-focus.js +6 -0
- package/dist/src/ink/hooks/use-terminal-title.js +17 -0
- package/dist/src/ink/hooks/use-terminal-viewport.js +40 -0
- package/dist/src/ink/ink.js +978 -0
- package/dist/src/ink/instances.js +2 -0
- package/dist/src/ink/layout/engine.js +4 -0
- package/dist/src/ink/layout/geometry.js +55 -0
- package/dist/src/ink/layout/node.js +60 -0
- package/dist/src/ink/layout/yoga.js +232 -0
- package/dist/src/ink/line-width-cache.js +14 -0
- package/dist/src/ink/log-update.js +408 -0
- package/dist/src/ink/measure-element.js +5 -0
- package/dist/src/ink/measure-text.js +30 -0
- package/dist/src/ink/node-cache.js +19 -0
- package/dist/src/ink/optimizer.js +52 -0
- package/dist/src/ink/output.js +399 -0
- package/dist/src/ink/parse-keypress.js +525 -0
- package/dist/src/ink/reconciler.js +359 -0
- package/dist/src/ink/render-border.js +110 -0
- package/dist/src/ink/render-node-to-output.js +710 -0
- package/dist/src/ink/render-to-screen.js +124 -0
- package/dist/src/ink/renderer.js +73 -0
- package/dist/src/ink/root.js +73 -0
- package/dist/src/ink/screen.js +823 -0
- package/dist/src/ink/searchHighlight.js +48 -0
- package/dist/src/ink/selection.js +507 -0
- package/dist/src/ink/squash-text-nodes.js +40 -0
- package/dist/src/ink/stringWidth.js +134 -0
- package/dist/src/ink/styles.js +279 -0
- package/dist/src/ink/supports-hyperlinks.js +29 -0
- package/dist/src/ink/tabstops.js +35 -0
- package/dist/src/ink/terminal-focus-state.js +33 -0
- package/dist/src/ink/terminal-querier.js +89 -0
- package/dist/src/ink/terminal.js +128 -0
- package/dist/src/ink/termio/ansi.js +53 -0
- package/dist/src/ink/termio/csi.js +158 -0
- package/dist/src/ink/termio/dec.js +31 -0
- package/dist/src/ink/termio/esc.js +36 -0
- package/dist/src/ink/termio/osc.js +275 -0
- package/dist/src/ink/termio/parser.js +293 -0
- package/dist/src/ink/termio/sgr.js +264 -0
- package/dist/src/ink/termio/tokenize.js +176 -0
- package/dist/src/ink/termio/types.js +33 -0
- package/dist/src/ink/termio.js +2 -0
- package/dist/src/ink/useTerminalNotification.js +61 -0
- package/dist/src/ink/warn.js +10 -0
- package/dist/src/ink/widest-line.js +15 -0
- package/dist/src/ink/wrap-text.js +50 -0
- package/dist/src/ink/wrapAnsi.js +5 -0
- package/dist/src/ink.js +55 -0
- package/dist/src/interactiveHelpers.js +231 -0
- package/dist/src/keybindings/KeybindingContext.js +170 -0
- package/dist/src/keybindings/KeybindingProviderSetup.js +225 -0
- package/dist/src/keybindings/defaultBindings.js +228 -0
- package/dist/src/keybindings/loadUserBindings.js +276 -0
- package/dist/src/keybindings/match.js +73 -0
- package/dist/src/keybindings/parser.js +152 -0
- package/dist/src/keybindings/reservedShortcuts.js +82 -0
- package/dist/src/keybindings/resolver.js +116 -0
- package/dist/src/keybindings/schema.js +143 -0
- package/dist/src/keybindings/shortcutFormat.js +24 -0
- package/dist/src/keybindings/template.js +28 -0
- package/dist/src/keybindings/useKeybinding.js +100 -0
- package/dist/src/keybindings/useShortcutDisplay.js +24 -0
- package/dist/src/keybindings/validate.js +313 -0
- package/dist/src/localRecoveryCli.js +256 -0
- package/dist/src/main.js +2489 -0
- package/dist/src/memdir/findRelevantMemories.js +76 -0
- package/dist/src/memdir/memdir.js +264 -0
- package/dist/src/memdir/memoryAge.js +24 -0
- package/dist/src/memdir/memoryScan.js +36 -0
- package/dist/src/memdir/memoryTypes.js +190 -0
- package/dist/src/memdir/paths.js +106 -0
- package/dist/src/memdir/teamMemPaths.js +133 -0
- package/dist/src/memdir/teamMemPrompts.js +87 -0
- package/dist/src/migrations/migrateAutoUpdatesToSettings.js +41 -0
- package/dist/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +29 -0
- package/dist/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +70 -0
- package/dist/src/migrations/migrateFennecToOpus.js +27 -0
- package/dist/src/migrations/migrateLegacyOpusToCurrent.js +30 -0
- package/dist/src/migrations/migrateOpusToOpus1m.js +23 -0
- package/dist/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +13 -0
- package/dist/src/migrations/migrateSonnet1mToSonnet45.js +29 -0
- package/dist/src/migrations/migrateSonnet45ToSonnet46.js +41 -0
- package/dist/src/migrations/resetAutoModeOptInForDefaultOffer.js +11 -0
- package/dist/src/migrations/resetProToOpusDefault.js +42 -0
- package/dist/src/moreright/useMoreRight.js +7 -0
- package/dist/src/native-ts/color-diff/index.js +729 -0
- package/dist/src/native-ts/file-index/index.js +246 -0
- package/dist/src/native-ts/yoga-layout/enums.js +96 -0
- package/dist/src/native-ts/yoga-layout/index.js +1638 -0
- package/dist/src/outputStyles/loadOutputStylesDir.js +47 -0
- package/dist/src/plugins/builtinPlugins.js +86 -0
- package/dist/src/plugins/bundled/index.js +1 -0
- package/dist/src/projectOnboardingState.js +56 -0
- package/dist/src/query/config.js +14 -0
- package/dist/src/query/deps.js +12 -0
- package/dist/src/query/stopHooks.js +251 -0
- package/dist/src/query/tokenBudget.js +47 -0
- package/dist/src/query.js +813 -0
- package/dist/src/remote/RemoteSessionManager.js +144 -0
- package/dist/src/remote/SessionsWebSocket.js +231 -0
- package/dist/src/remote/remotePermissionBridge.js +57 -0
- package/dist/src/remote/sdkMessageAdapter.js +161 -0
- package/dist/src/replLauncher.js +15 -0
- package/dist/src/schemas/hooks.js +71 -0
- package/dist/src/screens/Doctor.js +988 -0
- package/dist/src/screens/REPL.js +3588 -0
- package/dist/src/screens/ResumeConversation.js +396 -0
- package/dist/src/server/createDirectConnectSession.js +55 -0
- package/dist/src/server/directConnectManager.js +131 -0
- package/dist/src/server/types.js +7 -0
- package/dist/src/services/AgentSummary/agentSummary.js +114 -0
- package/dist/src/services/MagicDocs/magicDocs.js +151 -0
- package/dist/src/services/MagicDocs/prompts.js +85 -0
- package/dist/src/services/PromptSuggestion/promptSuggestion.js +350 -0
- package/dist/src/services/PromptSuggestion/speculation.js +590 -0
- package/dist/src/services/SessionMemory/prompts.js +220 -0
- package/dist/src/services/SessionMemory/sessionMemory.js +277 -0
- package/dist/src/services/SessionMemory/sessionMemoryUtils.js +94 -0
- package/dist/src/services/analytics/config.js +8 -0
- package/dist/src/services/analytics/datadog.js +217 -0
- package/dist/src/services/analytics/firstPartyEventLogger.js +223 -0
- package/dist/src/services/analytics/firstPartyEventLoggingExporter.js +500 -0
- package/dist/src/services/analytics/growthbook.js +597 -0
- package/dist/src/services/analytics/index.js +56 -0
- package/dist/src/services/analytics/metadata.js +507 -0
- package/dist/src/services/analytics/sink.js +44 -0
- package/dist/src/services/analytics/sinkKillswitch.js +6 -0
- package/dist/src/services/api/adminRequests.js +40 -0
- package/dist/src/services/api/bootstrap.js +104 -0
- package/dist/src/services/api/claude.js +1851 -0
- package/dist/src/services/api/client.js +209 -0
- package/dist/src/services/api/dumpPrompts.js +145 -0
- package/dist/src/services/api/emptyUsage.js +15 -0
- package/dist/src/services/api/errorUtils.js +137 -0
- package/dist/src/services/api/errors.js +641 -0
- package/dist/src/services/api/filesApi.js +409 -0
- package/dist/src/services/api/firstTokenDate.js +42 -0
- package/dist/src/services/api/grove.js +222 -0
- package/dist/src/services/api/logging.js +478 -0
- package/dist/src/services/api/metricsOptOut.js +87 -0
- package/dist/src/services/api/overageCreditGrant.js +83 -0
- package/dist/src/services/api/promptCacheBreakDetection.js +411 -0
- package/dist/src/services/api/referral.js +178 -0
- package/dist/src/services/api/sessionIngress.js +264 -0
- package/dist/src/services/api/ultrareviewQuota.js +23 -0
- package/dist/src/services/api/usage.js +34 -0
- package/dist/src/services/api/withRetry.js +454 -0
- package/dist/src/services/autoDream/autoDream.js +197 -0
- package/dist/src/services/autoDream/config.js +9 -0
- package/dist/src/services/autoDream/consolidationLock.js +76 -0
- package/dist/src/services/autoDream/consolidationPrompt.js +61 -0
- package/dist/src/services/awaySummary.js +58 -0
- package/dist/src/services/claudeAiLimits.js +269 -0
- package/dist/src/services/claudeAiLimitsHook.js +18 -0
- package/dist/src/services/compact/apiMicrocompact.js +82 -0
- package/dist/src/services/compact/autoCompact.js +151 -0
- package/dist/src/services/compact/compact.js +957 -0
- package/dist/src/services/compact/compactWarningHook.js +5 -0
- package/dist/src/services/compact/compactWarningState.js +8 -0
- package/dist/src/services/compact/grouping.js +20 -0
- package/dist/src/services/compact/microCompact.js +265 -0
- package/dist/src/services/compact/postCompactCleanup.js +23 -0
- package/dist/src/services/compact/prompt.js +303 -0
- package/dist/src/services/compact/sessionMemoryCompact.js +316 -0
- package/dist/src/services/compact/timeBasedMCConfig.js +9 -0
- package/dist/src/services/diagnosticTracking.js +195 -0
- package/dist/src/services/extractMemories/extractMemories.js +309 -0
- package/dist/src/services/extractMemories/prompts.js +113 -0
- package/dist/src/services/internalLogging.js +53 -0
- package/dist/src/services/lsp/LSPClient.js +252 -0
- package/dist/src/services/lsp/LSPDiagnosticRegistry.js +179 -0
- package/dist/src/services/lsp/LSPServerInstance.js +245 -0
- package/dist/src/services/lsp/LSPServerManager.js +217 -0
- package/dist/src/services/lsp/config.js +38 -0
- package/dist/src/services/lsp/manager.js +132 -0
- package/dist/src/services/lsp/passiveFeedback.js +150 -0
- package/dist/src/services/mcp/InProcessTransport.js +37 -0
- package/dist/src/services/mcp/MCPConnectionManager.js +56 -0
- package/dist/src/services/mcp/SdkControlTransport.js +54 -0
- package/dist/src/services/mcp/auth.js +1419 -0
- package/dist/src/services/mcp/channelAllowlist.js +24 -0
- package/dist/src/services/mcp/channelNotification.js +118 -0
- package/dist/src/services/mcp/channelPermissions.js +89 -0
- package/dist/src/services/mcp/claudeai.js +95 -0
- package/dist/src/services/mcp/client.js +1896 -0
- package/dist/src/services/mcp/config.js +942 -0
- package/dist/src/services/mcp/elicitationHandler.js +171 -0
- package/dist/src/services/mcp/envExpansion.js +19 -0
- package/dist/src/services/mcp/headersHelper.js +64 -0
- package/dist/src/services/mcp/mcpStringUtils.js +33 -0
- package/dist/src/services/mcp/normalization.js +8 -0
- package/dist/src/services/mcp/oauthPort.js +47 -0
- package/dist/src/services/mcp/officialRegistry.js +42 -0
- package/dist/src/services/mcp/types.js +82 -0
- package/dist/src/services/mcp/useManageMCPConnections.js +536 -0
- package/dist/src/services/mcp/utils.js +284 -0
- package/dist/src/services/mcp/vscodeSdkMcp.js +55 -0
- package/dist/src/services/mcp/xaa.js +237 -0
- package/dist/src/services/mcp/xaaIdpLogin.js +286 -0
- package/dist/src/services/mcpServerApproval.js +39 -0
- package/dist/src/services/mockRateLimits.js +548 -0
- package/dist/src/services/notifier.js +112 -0
- package/dist/src/services/oauth/auth-code-listener.js +129 -0
- package/dist/src/services/oauth/client.js +341 -0
- package/dist/src/services/oauth/crypto.js +15 -0
- package/dist/src/services/oauth/getOauthProfile.js +44 -0
- package/dist/src/services/oauth/index.js +98 -0
- package/dist/src/services/plugins/PluginInstallationManager.js +111 -0
- package/dist/src/services/plugins/pluginCliCommands.js +173 -0
- package/dist/src/services/plugins/pluginOperations.js +597 -0
- package/dist/src/services/policyLimits/index.js +418 -0
- package/dist/src/services/policyLimits/types.js +5 -0
- package/dist/src/services/preventSleep.js +95 -0
- package/dist/src/services/rateLimitMessages.js +194 -0
- package/dist/src/services/rateLimitMocking.js +58 -0
- package/dist/src/services/remoteManagedSettings/index.js +368 -0
- package/dist/src/services/remoteManagedSettings/securityCheck.js +52 -0
- package/dist/src/services/remoteManagedSettings/syncCache.js +50 -0
- package/dist/src/services/remoteManagedSettings/syncCacheState.js +48 -0
- package/dist/src/services/remoteManagedSettings/types.js +7 -0
- package/dist/src/services/settingsSync/index.js +368 -0
- package/dist/src/services/settingsSync/types.js +18 -0
- package/dist/src/services/teamMemorySync/index.js +731 -0
- package/dist/src/services/teamMemorySync/secretScanner.js +210 -0
- package/dist/src/services/teamMemorySync/teamMemSecretGuard.js +4 -0
- package/dist/src/services/teamMemorySync/types.js +23 -0
- package/dist/src/services/teamMemorySync/watcher.js +197 -0
- package/dist/src/services/tips/tipHistory.js +17 -0
- package/dist/src/services/tips/tipRegistry.js +578 -0
- package/dist/src/services/tips/tipScheduler.js +37 -0
- package/dist/src/services/tokenEstimation.js +283 -0
- package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +75 -0
- package/dist/src/services/tools/StreamingToolExecutor.js +311 -0
- package/dist/src/services/tools/toolExecution.js +1009 -0
- package/dist/src/services/tools/toolHooks.js +384 -0
- package/dist/src/services/tools/toolOrchestration.js +96 -0
- package/dist/src/services/vcr.js +233 -0
- package/dist/src/services/voice.js +315 -0
- package/dist/src/services/voiceKeyterms.js +57 -0
- package/dist/src/services/voiceStreamSTT.js +265 -0
- package/dist/src/setup.js +235 -0
- package/dist/src/skills/bundled/batch.js +114 -0
- package/dist/src/skills/bundled/claudeApi.js +149 -0
- package/dist/src/skills/bundled/claudeApiContent.js +63 -0
- package/dist/src/skills/bundled/claudeInChrome.js +31 -0
- package/dist/src/skills/bundled/debug.js +89 -0
- package/dist/src/skills/bundled/index.js +22 -0
- package/dist/src/skills/bundled/keybindings.js +303 -0
- package/dist/src/skills/bundled/loop.js +86 -0
- package/dist/src/skills/bundled/loremIpsum.js +257 -0
- package/dist/src/skills/bundled/remember.js +78 -0
- package/dist/src/skills/bundled/scheduleRemoteAgents.js +360 -0
- package/dist/src/skills/bundled/simplify.js +70 -0
- package/dist/src/skills/bundled/skillify.js +179 -0
- package/dist/src/skills/bundled/stuck.js +76 -0
- package/dist/src/skills/bundled/updateConfig.js +471 -0
- package/dist/src/skills/bundled/verify/SKILL.md.js +1 -0
- package/dist/src/skills/bundled/verify/examples/cli.md.js +1 -0
- package/dist/src/skills/bundled/verify/examples/server.md.js +1 -0
- package/dist/src/skills/bundled/verify.js +27 -0
- package/dist/src/skills/bundled/verifyContent.js +8 -0
- package/dist/src/skills/bundledSkills.js +114 -0
- package/dist/src/skills/loadSkillsDir.js +583 -0
- package/dist/src/skills/mcpSkillBuilders.js +10 -0
- package/dist/src/state/AppState.js +153 -0
- package/dist/src/state/AppStateStore.js +115 -0
- package/dist/src/state/onChangeAppState.js +94 -0
- package/dist/src/state/selectors.js +29 -0
- package/dist/src/state/store.js +21 -0
- package/dist/src/state/teammateViewHelpers.js +89 -0
- package/dist/src/tasks/DreamTask/DreamTask.js +79 -0
- package/dist/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +70 -0
- package/dist/src/tasks/InProcessTeammateTask/types.js +15 -0
- package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +444 -0
- package/dist/src/tasks/LocalMainSessionTask.js +262 -0
- package/dist/src/tasks/LocalShellTask/LocalShellTask.js +419 -0
- package/dist/src/tasks/LocalShellTask/guards.js +3 -0
- package/dist/src/tasks/LocalShellTask/killShellTasks.js +44 -0
- package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +550 -0
- package/dist/src/tasks/pillLabel.js +53 -0
- package/dist/src/tasks/stopTask.js +53 -0
- package/dist/src/tasks/types.js +9 -0
- package/dist/src/tasks.js +22 -0
- package/dist/src/tools/AgentTool/AgentTool.js +919 -0
- package/dist/src/tools/AgentTool/UI.js +912 -0
- package/dist/src/tools/AgentTool/agentColorManager.js +42 -0
- package/dist/src/tools/AgentTool/agentDisplay.js +45 -0
- package/dist/src/tools/AgentTool/agentMemory.js +85 -0
- package/dist/src/tools/AgentTool/agentMemorySnapshot.js +109 -0
- package/dist/src/tools/AgentTool/agentToolUtils.js +387 -0
- package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +159 -0
- package/dist/src/tools/AgentTool/built-in/exploreAgent.js +66 -0
- package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +26 -0
- package/dist/src/tools/AgentTool/built-in/planAgent.js +81 -0
- package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +140 -0
- package/dist/src/tools/AgentTool/built-in/verificationAgent.js +146 -0
- package/dist/src/tools/AgentTool/builtInAgents.js +32 -0
- package/dist/src/tools/AgentTool/constants.js +7 -0
- package/dist/src/tools/AgentTool/forkSubagent.js +108 -0
- package/dist/src/tools/AgentTool/loadAgentsDir.js +409 -0
- package/dist/src/tools/AgentTool/prompt.js +194 -0
- package/dist/src/tools/AgentTool/resumeAgent.js +169 -0
- package/dist/src/tools/AgentTool/runAgent.js +457 -0
- package/dist/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +282 -0
- package/dist/src/tools/AskUserQuestionTool/prompt.js +38 -0
- package/dist/src/tools/BashTool/BashTool.js +867 -0
- package/dist/src/tools/BashTool/BashToolResultMessage.js +208 -0
- package/dist/src/tools/BashTool/UI.js +189 -0
- package/dist/src/tools/BashTool/bashCommandHelpers.js +145 -0
- package/dist/src/tools/BashTool/bashPermissions.js +1193 -0
- package/dist/src/tools/BashTool/bashSecurity.js +1464 -0
- package/dist/src/tools/BashTool/commandSemantics.js +70 -0
- package/dist/src/tools/BashTool/commentLabel.js +8 -0
- package/dist/src/tools/BashTool/destructiveCommandWarning.js +74 -0
- package/dist/src/tools/BashTool/modeValidation.js +65 -0
- package/dist/src/tools/BashTool/pathValidation.js +771 -0
- package/dist/src/tools/BashTool/prompt.js +307 -0
- package/dist/src/tools/BashTool/readOnlyValidation.js +1312 -0
- package/dist/src/tools/BashTool/sedEditParser.js +179 -0
- package/dist/src/tools/BashTool/sedValidation.js +379 -0
- package/dist/src/tools/BashTool/shouldUseSandbox.js +102 -0
- package/dist/src/tools/BashTool/toolName.js +1 -0
- package/dist/src/tools/BashTool/utils.js +145 -0
- package/dist/src/tools/BriefTool/BriefTool.js +106 -0
- package/dist/src/tools/BriefTool/UI.js +158 -0
- package/dist/src/tools/BriefTool/attachments.js +54 -0
- package/dist/src/tools/BriefTool/prompt.js +19 -0
- package/dist/src/tools/BriefTool/upload.js +37 -0
- package/dist/src/tools/ConfigTool/ConfigTool.js +304 -0
- package/dist/src/tools/ConfigTool/UI.js +76 -0
- package/dist/src/tools/ConfigTool/constants.js +1 -0
- package/dist/src/tools/ConfigTool/prompt.js +76 -0
- package/dist/src/tools/ConfigTool/supportedSettings.js +141 -0
- package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +91 -0
- package/dist/src/tools/EnterPlanModeTool/UI.js +49 -0
- package/dist/src/tools/EnterPlanModeTool/constants.js +1 -0
- package/dist/src/tools/EnterPlanModeTool/prompt.js +154 -0
- package/dist/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +97 -0
- package/dist/src/tools/EnterWorktreeTool/UI.js +25 -0
- package/dist/src/tools/EnterWorktreeTool/constants.js +1 -0
- package/dist/src/tools/EnterWorktreeTool/prompt.js +30 -0
- package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +287 -0
- package/dist/src/tools/ExitPlanModeTool/UI.js +128 -0
- package/dist/src/tools/ExitPlanModeTool/constants.js +2 -0
- package/dist/src/tools/ExitPlanModeTool/prompt.js +25 -0
- package/dist/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +217 -0
- package/dist/src/tools/ExitWorktreeTool/UI.js +36 -0
- package/dist/src/tools/ExitWorktreeTool/constants.js +1 -0
- package/dist/src/tools/ExitWorktreeTool/prompt.js +32 -0
- package/dist/src/tools/FileEditTool/FileEditTool.js +447 -0
- package/dist/src/tools/FileEditTool/UI.js +289 -0
- package/dist/src/tools/FileEditTool/constants.js +4 -0
- package/dist/src/tools/FileEditTool/prompt.js +22 -0
- package/dist/src/tools/FileEditTool/types.js +37 -0
- package/dist/src/tools/FileEditTool/utils.js +411 -0
- package/dist/src/tools/FileReadTool/FileReadTool.js +759 -0
- package/dist/src/tools/FileReadTool/UI.js +232 -0
- package/dist/src/tools/FileReadTool/imageProcessor.js +34 -0
- package/dist/src/tools/FileReadTool/limits.js +28 -0
- package/dist/src/tools/FileReadTool/prompt.js +25 -0
- package/dist/src/tools/FileWriteTool/FileWriteTool.js +300 -0
- package/dist/src/tools/FileWriteTool/UI.js +460 -0
- package/dist/src/tools/FileWriteTool/prompt.js +16 -0
- package/dist/src/tools/GlobTool/GlobTool.js +155 -0
- package/dist/src/tools/GlobTool/UI.js +58 -0
- package/dist/src/tools/GlobTool/prompt.js +6 -0
- package/dist/src/tools/GrepTool/GrepTool.js +390 -0
- package/dist/src/tools/GrepTool/UI.js +254 -0
- package/dist/src/tools/GrepTool/prompt.js +16 -0
- package/dist/src/tools/LSPTool/LSPTool.js +541 -0
- package/dist/src/tools/LSPTool/UI.js +275 -0
- package/dist/src/tools/LSPTool/formatters.js +353 -0
- package/dist/src/tools/LSPTool/prompt.js +20 -0
- package/dist/src/tools/LSPTool/schemas.js +82 -0
- package/dist/src/tools/LSPTool/symbolContext.js +43 -0
- package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +91 -0
- package/dist/src/tools/ListMcpResourcesTool/UI.js +26 -0
- package/dist/src/tools/ListMcpResourcesTool/prompt.js +18 -0
- package/dist/src/tools/MCPTool/MCPTool.js +57 -0
- package/dist/src/tools/MCPTool/UI.js +433 -0
- package/dist/src/tools/MCPTool/classifyForCollapse.js +509 -0
- package/dist/src/tools/MCPTool/prompt.js +2 -0
- package/dist/src/tools/McpAuthTool/McpAuthTool.js +139 -0
- package/dist/src/tools/NotebookEditTool/NotebookEditTool.js +364 -0
- package/dist/src/tools/NotebookEditTool/UI.js +115 -0
- package/dist/src/tools/NotebookEditTool/constants.js +1 -0
- package/dist/src/tools/NotebookEditTool/prompt.js +2 -0
- package/dist/src/tools/PowerShellTool/PowerShellTool.js +700 -0
- package/dist/src/tools/PowerShellTool/UI.js +154 -0
- package/dist/src/tools/PowerShellTool/clmTypes.js +147 -0
- package/dist/src/tools/PowerShellTool/commandSemantics.js +37 -0
- package/dist/src/tools/PowerShellTool/commonParameters.js +17 -0
- package/dist/src/tools/PowerShellTool/destructiveCommandWarning.js +70 -0
- package/dist/src/tools/PowerShellTool/gitSafety.js +102 -0
- package/dist/src/tools/PowerShellTool/modeValidation.js +203 -0
- package/dist/src/tools/PowerShellTool/pathValidation.js +1259 -0
- package/dist/src/tools/PowerShellTool/powershellPermissions.js +791 -0
- package/dist/src/tools/PowerShellTool/powershellSecurity.js +612 -0
- package/dist/src/tools/PowerShellTool/prompt.js +130 -0
- package/dist/src/tools/PowerShellTool/readOnlyValidation.js +1000 -0
- package/dist/src/tools/PowerShellTool/toolName.js +1 -0
- package/dist/src/tools/REPLTool/constants.js +27 -0
- package/dist/src/tools/REPLTool/primitiveTools.js +21 -0
- package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +115 -0
- package/dist/src/tools/ReadMcpResourceTool/UI.js +37 -0
- package/dist/src/tools/ReadMcpResourceTool/prompt.js +15 -0
- package/dist/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +138 -0
- package/dist/src/tools/RemoteTriggerTool/UI.js +28 -0
- package/dist/src/tools/RemoteTriggerTool/prompt.js +12 -0
- package/dist/src/tools/ScheduleCronTool/CronCreateTool.js +117 -0
- package/dist/src/tools/ScheduleCronTool/CronDeleteTool.js +83 -0
- package/dist/src/tools/ScheduleCronTool/CronListTool.js +77 -0
- package/dist/src/tools/ScheduleCronTool/UI.js +73 -0
- package/dist/src/tools/ScheduleCronTool/prompt.js +67 -0
- package/dist/src/tools/SendMessageTool/SendMessageTool.js +561 -0
- package/dist/src/tools/SendMessageTool/UI.js +30 -0
- package/dist/src/tools/SendMessageTool/constants.js +1 -0
- package/dist/src/tools/SendMessageTool/prompt.js +32 -0
- package/dist/src/tools/SkillTool/SkillTool.js +614 -0
- package/dist/src/tools/SkillTool/UI.js +141 -0
- package/dist/src/tools/SkillTool/constants.js +1 -0
- package/dist/src/tools/SkillTool/prompt.js +161 -0
- package/dist/src/tools/SleepTool/prompt.js +14 -0
- package/dist/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +120 -0
- package/dist/src/tools/TaskCreateTool/TaskCreateTool.js +106 -0
- package/dist/src/tools/TaskCreateTool/constants.js +1 -0
- package/dist/src/tools/TaskCreateTool/prompt.js +48 -0
- package/dist/src/tools/TaskGetTool/TaskGetTool.js +110 -0
- package/dist/src/tools/TaskGetTool/constants.js +1 -0
- package/dist/src/tools/TaskGetTool/prompt.js +23 -0
- package/dist/src/tools/TaskListTool/TaskListTool.js +92 -0
- package/dist/src/tools/TaskListTool/constants.js +1 -0
- package/dist/src/tools/TaskListTool/prompt.js +38 -0
- package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +688 -0
- package/dist/src/tools/TaskOutputTool/constants.js +1 -0
- package/dist/src/tools/TaskStopTool/TaskStopTool.js +97 -0
- package/dist/src/tools/TaskStopTool/UI.js +39 -0
- package/dist/src/tools/TaskStopTool/prompt.js +7 -0
- package/dist/src/tools/TaskUpdateTool/TaskUpdateTool.js +279 -0
- package/dist/src/tools/TaskUpdateTool/constants.js +1 -0
- package/dist/src/tools/TaskUpdateTool/prompt.js +76 -0
- package/dist/src/tools/TeamCreateTool/TeamCreateTool.js +161 -0
- package/dist/src/tools/TeamCreateTool/UI.js +4 -0
- package/dist/src/tools/TeamCreateTool/constants.js +1 -0
- package/dist/src/tools/TeamCreateTool/prompt.js +113 -0
- package/dist/src/tools/TeamDeleteTool/TeamDeleteTool.js +96 -0
- package/dist/src/tools/TeamDeleteTool/UI.js +14 -0
- package/dist/src/tools/TeamDeleteTool/constants.js +1 -0
- package/dist/src/tools/TeamDeleteTool/prompt.js +16 -0
- package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +86 -0
- package/dist/src/tools/TodoWriteTool/constants.js +1 -0
- package/dist/src/tools/TodoWriteTool/prompt.js +181 -0
- package/dist/src/tools/ToolSearchTool/ToolSearchTool.js +266 -0
- package/dist/src/tools/ToolSearchTool/constants.js +1 -0
- package/dist/src/tools/ToolSearchTool/prompt.js +40 -0
- package/dist/src/tools/TungstenTool/TungstenLiveMonitor.js +4 -0
- package/dist/src/tools/TungstenTool/TungstenTool.js +39 -0
- package/dist/src/tools/WebFetchTool/UI.js +91 -0
- package/dist/src/tools/WebFetchTool/WebFetchTool.js +234 -0
- package/dist/src/tools/WebFetchTool/preapproved.js +122 -0
- package/dist/src/tools/WebFetchTool/prompt.js +37 -0
- package/dist/src/tools/WebFetchTool/utils.js +303 -0
- package/dist/src/tools/WebSearchTool/UI.js +109 -0
- package/dist/src/tools/WebSearchTool/WebSearchTool.js +313 -0
- package/dist/src/tools/WebSearchTool/prompt.js +32 -0
- package/dist/src/tools/WorkflowTool/constants.js +1 -0
- package/dist/src/tools/shared/gitOperationTracking.js +158 -0
- package/dist/src/tools/shared/spawnMultiAgent.js +630 -0
- package/dist/src/tools/testing/TestingPermissionTool.js +66 -0
- package/dist/src/tools/utils.js +15 -0
- package/dist/src/tools.js +184 -0
- package/dist/src/types/command.js +6 -0
- package/dist/src/types/connectorText.js +3 -0
- package/dist/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +525 -0
- package/dist/src/types/generated/events_mono/common/v1/auth.js +38 -0
- package/dist/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +112 -0
- package/dist/src/types/generated/google/protobuf/timestamp.js +33 -0
- package/dist/src/types/hooks.js +121 -0
- package/dist/src/types/ids.js +10 -0
- package/dist/src/types/logs.js +9 -0
- package/dist/src/types/permissions.js +12 -0
- package/dist/src/types/plugin.js +64 -0
- package/dist/src/types/textInputTypes.js +10 -0
- package/dist/src/upstreamproxy/relay.js +274 -0
- package/dist/src/upstreamproxy/upstreamproxy.js +161 -0
- package/dist/src/utils/CircularBuffer.js +51 -0
- package/dist/src/utils/Cursor.js +1006 -0
- package/dist/src/utils/QueryGuard.js +57 -0
- package/dist/src/utils/Shell.js +260 -0
- package/dist/src/utils/ShellCommand.js +277 -0
- package/dist/src/utils/abortController.js +31 -0
- package/dist/src/utils/activityManager.js +91 -0
- package/dist/src/utils/advisor.js +63 -0
- package/dist/src/utils/agentContext.js +36 -0
- package/dist/src/utils/agentId.js +36 -0
- package/dist/src/utils/agentSwarmsEnabled.js +17 -0
- package/dist/src/utils/agenticSessionSearch.js +194 -0
- package/dist/src/utils/analyzeContext.js +692 -0
- package/dist/src/utils/ansiToPng.js +211 -0
- package/dist/src/utils/ansiToSvg.js +171 -0
- package/dist/src/utils/api.js +435 -0
- package/dist/src/utils/apiPreconnect.js +19 -0
- package/dist/src/utils/appleTerminalBackup.js +91 -0
- package/dist/src/utils/argumentSubstitution.js +58 -0
- package/dist/src/utils/array.js +12 -0
- package/dist/src/utils/asciicast.js +149 -0
- package/dist/src/utils/attachments.js +1854 -0
- package/dist/src/utils/attribution.js +215 -0
- package/dist/src/utils/auth.js +1197 -0
- package/dist/src/utils/authFileDescriptor.js +106 -0
- package/dist/src/utils/authPortable.js +14 -0
- package/dist/src/utils/autoModeDenials.js +10 -0
- package/dist/src/utils/autoRunIssue.js +126 -0
- package/dist/src/utils/autoUpdater.js +339 -0
- package/dist/src/utils/aws.js +30 -0
- package/dist/src/utils/awsAuthStatusManager.js +55 -0
- package/dist/src/utils/background/remote/preconditions.js +134 -0
- package/dist/src/utils/background/remote/remoteSession.js +42 -0
- package/dist/src/utils/backgroundHousekeeping.js +47 -0
- package/dist/src/utils/bash/ParsedCommand.js +194 -0
- package/dist/src/utils/bash/ShellSnapshot.js +333 -0
- package/dist/src/utils/bash/ast.js +1422 -0
- package/dist/src/utils/bash/bashParser.js +3625 -0
- package/dist/src/utils/bash/bashPipeCommand.js +138 -0
- package/dist/src/utils/bash/commands.js +668 -0
- package/dist/src/utils/bash/heredoc.js +288 -0
- package/dist/src/utils/bash/parser.js +110 -0
- package/dist/src/utils/bash/prefix.js +119 -0
- package/dist/src/utils/bash/registry.js +20 -0
- package/dist/src/utils/bash/shellCompletion.js +127 -0
- package/dist/src/utils/bash/shellPrefix.js +11 -0
- package/dist/src/utils/bash/shellQuote.js +159 -0
- package/dist/src/utils/bash/shellQuoting.js +43 -0
- package/dist/src/utils/bash/specs/alias.js +11 -0
- package/dist/src/utils/bash/specs/index.js +16 -0
- package/dist/src/utils/bash/specs/nohup.js +10 -0
- package/dist/src/utils/bash/specs/pyright.js +88 -0
- package/dist/src/utils/bash/specs/sleep.js +10 -0
- package/dist/src/utils/bash/specs/srun.js +28 -0
- package/dist/src/utils/bash/specs/time.js +10 -0
- package/dist/src/utils/bash/specs/timeout.js +17 -0
- package/dist/src/utils/bash/treeSitterAnalysis.js +259 -0
- package/dist/src/utils/betas.js +199 -0
- package/dist/src/utils/billing.js +47 -0
- package/dist/src/utils/binaryCheck.js +25 -0
- package/dist/src/utils/browser.js +47 -0
- package/dist/src/utils/bufferedWriter.js +73 -0
- package/dist/src/utils/bundledMode.js +6 -0
- package/dist/src/utils/caCerts.js +47 -0
- package/dist/src/utils/caCertsConfig.js +32 -0
- package/dist/src/utils/cachePaths.js +22 -0
- package/dist/src/utils/classifierApprovals.js +61 -0
- package/dist/src/utils/classifierApprovalsHook.js +8 -0
- package/dist/src/utils/claudeCodeHints.js +83 -0
- package/dist/src/utils/claudeDesktop.js +87 -0
- package/dist/src/utils/claudeInChrome/chromeNativeHost.js +353 -0
- package/dist/src/utils/claudeInChrome/common.js +416 -0
- package/dist/src/utils/claudeInChrome/mcpServer.js +190 -0
- package/dist/src/utils/claudeInChrome/prompt.js +60 -0
- package/dist/src/utils/claudeInChrome/setup.js +239 -0
- package/dist/src/utils/claudeInChrome/setupPortable.js +133 -0
- package/dist/src/utils/claudeInChrome/toolRendering.js +224 -0
- package/dist/src/utils/claudemd.js +727 -0
- package/dist/src/utils/cleanup.js +423 -0
- package/dist/src/utils/cleanupRegistry.js +8 -0
- package/dist/src/utils/cliArgs.js +21 -0
- package/dist/src/utils/cliHighlight.js +27 -0
- package/dist/src/utils/codeIndexing.js +92 -0
- package/dist/src/utils/collapseBackgroundBashNotifications.js +58 -0
- package/dist/src/utils/collapseHookSummaries.js +38 -0
- package/dist/src/utils/collapseReadSearch.js +569 -0
- package/dist/src/utils/collapseTeammateShutdowns.js +34 -0
- package/dist/src/utils/combinedAbortSignal.js +28 -0
- package/dist/src/utils/commandLifecycle.js +7 -0
- package/dist/src/utils/commitAttribution.js +510 -0
- package/dist/src/utils/completionCache.js +126 -0
- package/dist/src/utils/computerUse/appNames.js +104 -0
- package/dist/src/utils/computerUse/cleanup.js +37 -0
- package/dist/src/utils/computerUse/common.js +25 -0
- package/dist/src/utils/computerUse/computerUseLock.js +117 -0
- package/dist/src/utils/computerUse/drainRunLoop.js +44 -0
- package/dist/src/utils/computerUse/escHotkey.js +33 -0
- package/dist/src/utils/computerUse/executor.js +303 -0
- package/dist/src/utils/computerUse/gates.js +40 -0
- package/dist/src/utils/computerUse/hostAdapter.js +48 -0
- package/dist/src/utils/computerUse/inputLoader.js +10 -0
- package/dist/src/utils/computerUse/mcpServer.js +61 -0
- package/dist/src/utils/computerUse/setup.js +25 -0
- package/dist/src/utils/computerUse/swiftLoader.js +7 -0
- package/dist/src/utils/computerUse/toolRendering.js +96 -0
- package/dist/src/utils/computerUse/wrapper.js +242 -0
- package/dist/src/utils/concurrentSessions.js +108 -0
- package/dist/src/utils/config.js +801 -0
- package/dist/src/utils/configConstants.js +11 -0
- package/dist/src/utils/contentArray.js +19 -0
- package/dist/src/utils/context.js +135 -0
- package/dist/src/utils/contextAnalysis.js +152 -0
- package/dist/src/utils/contextSuggestions.js +141 -0
- package/dist/src/utils/controlMessageCompat.js +17 -0
- package/dist/src/utils/conversationRecovery.js +278 -0
- package/dist/src/utils/cron.js +182 -0
- package/dist/src/utils/cronJitterConfig.js +22 -0
- package/dist/src/utils/cronScheduler.js +295 -0
- package/dist/src/utils/cronTasks.js +183 -0
- package/dist/src/utils/cronTasksLock.js +116 -0
- package/dist/src/utils/crossProjectResume.js +36 -0
- package/dist/src/utils/crypto.js +3 -0
- package/dist/src/utils/cwd.js +16 -0
- package/dist/src/utils/debug.js +170 -0
- package/dist/src/utils/debugFilter.js +69 -0
- package/dist/src/utils/deepLink/banner.js +52 -0
- package/dist/src/utils/deepLink/parseDeepLink.js +68 -0
- package/dist/src/utils/deepLink/protocolHandler.js +66 -0
- package/dist/src/utils/deepLink/registerProtocol.js +206 -0
- package/dist/src/utils/deepLink/terminalLauncher.js +321 -0
- package/dist/src/utils/deepLink/terminalPreference.js +26 -0
- package/dist/src/utils/desktopDeepLink.js +154 -0
- package/dist/src/utils/detectRepository.js +98 -0
- package/dist/src/utils/diagLogs.js +47 -0
- package/dist/src/utils/diff.js +92 -0
- package/dist/src/utils/directMemberMessage.js +27 -0
- package/dist/src/utils/displayTags.js +12 -0
- package/dist/src/utils/doctorContextWarnings.js +151 -0
- package/dist/src/utils/doctorDiagnostic.js +388 -0
- package/dist/src/utils/dxt/helpers.js +36 -0
- package/dist/src/utils/dxt/zip.js +112 -0
- package/dist/src/utils/earlyInput.js +98 -0
- package/dist/src/utils/editor.js +105 -0
- package/dist/src/utils/effort.js +188 -0
- package/dist/src/utils/embeddedTools.js +10 -0
- package/dist/src/utils/env.js +284 -0
- package/dist/src/utils/envDynamic.js +91 -0
- package/dist/src/utils/envUtils.js +88 -0
- package/dist/src/utils/envValidation.js +26 -0
- package/dist/src/utils/errorLogSink.js +142 -0
- package/dist/src/utils/errors.js +123 -0
- package/dist/src/utils/exampleCommands.js +133 -0
- package/dist/src/utils/execFileNoThrow.js +82 -0
- package/dist/src/utils/execFileNoThrowPortable.js +52 -0
- package/dist/src/utils/execSyncWrapper.js +16 -0
- package/dist/src/utils/exportRenderer.js +78 -0
- package/dist/src/utils/extraUsage.js +16 -0
- package/dist/src/utils/fastMode.js +331 -0
- package/dist/src/utils/file.js +318 -0
- package/dist/src/utils/fileHistory.js +662 -0
- package/dist/src/utils/fileOperationAnalytics.js +23 -0
- package/dist/src/utils/filePersistence/filePersistence.js +165 -0
- package/dist/src/utils/filePersistence/outputsScanner.js +72 -0
- package/dist/src/utils/filePersistence/types.js +3 -0
- package/dist/src/utils/fileRead.js +53 -0
- package/dist/src/utils/fileReadCache.js +54 -0
- package/dist/src/utils/fileStateCache.js +79 -0
- package/dist/src/utils/findExecutable.js +5 -0
- package/dist/src/utils/fingerprint.js +30 -0
- package/dist/src/utils/forkedAgent.js +253 -0
- package/dist/src/utils/format.js +200 -0
- package/dist/src/utils/formatBriefTimestamp.js +49 -0
- package/dist/src/utils/fpsTracker.js +32 -0
- package/dist/src/utils/frontmatterParser.js +159 -0
- package/dist/src/utils/fsOperations.js +548 -0
- package/dist/src/utils/fullscreen.js +83 -0
- package/dist/src/utils/generatedFiles.js +96 -0
- package/dist/src/utils/generators.js +60 -0
- package/dist/src/utils/genericProcessUtils.js +96 -0
- package/dist/src/utils/getWorktreePaths.js +30 -0
- package/dist/src/utils/getWorktreePathsPortable.js +14 -0
- package/dist/src/utils/ghPrStatus.js +51 -0
- package/dist/src/utils/git/gitConfigParser.js +166 -0
- package/dist/src/utils/git/gitFilesystem.js +413 -0
- package/dist/src/utils/git/gitignore.js +52 -0
- package/dist/src/utils/git.js +520 -0
- package/dist/src/utils/gitDiff.js +291 -0
- package/dist/src/utils/gitSettings.js +10 -0
- package/dist/src/utils/github/ghAuthStatus.js +15 -0
- package/dist/src/utils/githubRepoPathMapping.js +92 -0
- package/dist/src/utils/glob.js +65 -0
- package/dist/src/utils/gracefulShutdown.js +274 -0
- package/dist/src/utils/groupToolUses.js +107 -0
- package/dist/src/utils/handlePromptSubmit.js +323 -0
- package/dist/src/utils/hash.js +21 -0
- package/dist/src/utils/headlessProfiler.js +95 -0
- package/dist/src/utils/heapDumpService.js +157 -0
- package/dist/src/utils/heatmap.js +118 -0
- package/dist/src/utils/highlightMatch.js +28 -0
- package/dist/src/utils/hooks/AsyncHookRegistry.js +190 -0
- package/dist/src/utils/hooks/apiQueryHookHelper.js +67 -0
- package/dist/src/utils/hooks/execAgentHook.js +216 -0
- package/dist/src/utils/hooks/execHttpHook.js +106 -0
- package/dist/src/utils/hooks/execPromptHook.js +153 -0
- package/dist/src/utils/hooks/fileChangedWatcher.js +154 -0
- package/dist/src/utils/hooks/hookEvents.js +92 -0
- package/dist/src/utils/hooks/hookHelpers.js +43 -0
- package/dist/src/utils/hooks/hooksConfigManager.js +386 -0
- package/dist/src/utils/hooks/hooksConfigSnapshot.js +52 -0
- package/dist/src/utils/hooks/hooksSettings.js +175 -0
- package/dist/src/utils/hooks/postSamplingHooks.js +26 -0
- package/dist/src/utils/hooks/registerFrontmatterHooks.js +34 -0
- package/dist/src/utils/hooks/registerSkillHooks.js +24 -0
- package/dist/src/utils/hooks/sessionHooks.js +176 -0
- package/dist/src/utils/hooks/skillImprovement.js +200 -0
- package/dist/src/utils/hooks/ssrfGuard.js +157 -0
- package/dist/src/utils/hooks.js +2879 -0
- package/dist/src/utils/horizontalScroll.js +72 -0
- package/dist/src/utils/http.js +80 -0
- package/dist/src/utils/hyperlink.js +13 -0
- package/dist/src/utils/iTermBackup.js +46 -0
- package/dist/src/utils/ide.js +938 -0
- package/dist/src/utils/idePathConversion.js +47 -0
- package/dist/src/utils/idleTimeout.js +33 -0
- package/dist/src/utils/imagePaste.js +190 -0
- package/dist/src/utils/imageResizer.js +459 -0
- package/dist/src/utils/imageStore.js +109 -0
- package/dist/src/utils/imageValidation.js +61 -0
- package/dist/src/utils/immediateCommand.js +4 -0
- package/dist/src/utils/inProcessTeammateHelpers.js +28 -0
- package/dist/src/utils/ink.js +14 -0
- package/dist/src/utils/intl.js +61 -0
- package/dist/src/utils/jetbrains.js +130 -0
- package/dist/src/utils/json.js +182 -0
- package/dist/src/utils/jsonRead.js +4 -0
- package/dist/src/utils/keyboardShortcuts.js +8 -0
- package/dist/src/utils/lazySchema.js +4 -0
- package/dist/src/utils/listSessionsImpl.js +219 -0
- package/dist/src/utils/localInstaller.js +86 -0
- package/dist/src/utils/lockfile.js +19 -0
- package/dist/src/utils/log.js +164 -0
- package/dist/src/utils/logoV2Utils.js +192 -0
- package/dist/src/utils/mailbox.js +51 -0
- package/dist/src/utils/managedEnv.js +90 -0
- package/dist/src/utils/managedEnvConstants.js +136 -0
- package/dist/src/utils/markdown.js +216 -0
- package/dist/src/utils/markdownConfigLoader.js +293 -0
- package/dist/src/utils/mcp/dateTimeParser.js +73 -0
- package/dist/src/utils/mcp/elicitationValidation.js +208 -0
- package/dist/src/utils/mcpInstructionsDelta.js +71 -0
- package/dist/src/utils/mcpOutputStorage.js +124 -0
- package/dist/src/utils/mcpValidation.js +138 -0
- package/dist/src/utils/mcpWebSocketTransport.js +152 -0
- package/dist/src/utils/memoize.js +125 -0
- package/dist/src/utils/memory/types.js +8 -0
- package/dist/src/utils/memory/versions.js +4 -0
- package/dist/src/utils/memoryFileDetection.js +151 -0
- package/dist/src/utils/messagePredicates.js +3 -0
- package/dist/src/utils/messageQueueManager.js +267 -0
- package/dist/src/utils/messages/mappers.js +198 -0
- package/dist/src/utils/messages/systemInit.js +47 -0
- package/dist/src/utils/messages.js +3450 -0
- package/dist/src/utils/model/agent.js +91 -0
- package/dist/src/utils/model/aliases.js +16 -0
- package/dist/src/utils/model/antModels.js +23 -0
- package/dist/src/utils/model/bedrock.js +158 -0
- package/dist/src/utils/model/check1mAccess.js +49 -0
- package/dist/src/utils/model/configs.js +81 -0
- package/dist/src/utils/model/contextWindowUpgradeCheck.js +32 -0
- package/dist/src/utils/model/deprecation.js +56 -0
- package/dist/src/utils/model/model.js +377 -0
- package/dist/src/utils/model/modelAllowlist.js +91 -0
- package/dist/src/utils/model/modelCapabilities.js +97 -0
- package/dist/src/utils/model/modelOptions.js +403 -0
- package/dist/src/utils/model/modelStrings.js +112 -0
- package/dist/src/utils/model/modelSupportOverrides.js +32 -0
- package/dist/src/utils/model/providers.js +23 -0
- package/dist/src/utils/model/validateModel.js +108 -0
- package/dist/src/utils/modelCost.js +135 -0
- package/dist/src/utils/modifiers.js +22 -0
- package/dist/src/utils/mtls.js +101 -0
- package/dist/src/utils/nativeInstaller/download.js +309 -0
- package/dist/src/utils/nativeInstaller/index.js +9 -0
- package/dist/src/utils/nativeInstaller/installer.js +1104 -0
- package/dist/src/utils/nativeInstaller/packageManagers.js +174 -0
- package/dist/src/utils/nativeInstaller/pidLock.js +230 -0
- package/dist/src/utils/notebook.js +170 -0
- package/dist/src/utils/objectGroupBy.js +12 -0
- package/dist/src/utils/pasteStore.js +61 -0
- package/dist/src/utils/path.js +65 -0
- package/dist/src/utils/pdf.js +199 -0
- package/dist/src/utils/pdfUtils.js +36 -0
- package/dist/src/utils/peerAddress.js +9 -0
- package/dist/src/utils/permissions/PermissionMode.js +82 -0
- package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +62 -0
- package/dist/src/utils/permissions/PermissionResult.js +10 -0
- package/dist/src/utils/permissions/PermissionRule.js +7 -0
- package/dist/src/utils/permissions/PermissionUpdate.js +219 -0
- package/dist/src/utils/permissions/PermissionUpdateSchema.js +49 -0
- package/dist/src/utils/permissions/autoModeState.js +26 -0
- package/dist/src/utils/permissions/bashClassifier.js +29 -0
- package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +69 -0
- package/dist/src/utils/permissions/classifierDecision.js +56 -0
- package/dist/src/utils/permissions/classifierShared.js +14 -0
- package/dist/src/utils/permissions/dangerousPatterns.js +44 -0
- package/dist/src/utils/permissions/denialTracking.js +28 -0
- package/dist/src/utils/permissions/filesystem.js +889 -0
- package/dist/src/utils/permissions/getNextPermissionMode.js +51 -0
- package/dist/src/utils/permissions/pathValidation.js +230 -0
- package/dist/src/utils/permissions/permissionExplainer.js +162 -0
- package/dist/src/utils/permissions/permissionRuleParser.js +90 -0
- package/dist/src/utils/permissions/permissionSetup.js +770 -0
- package/dist/src/utils/permissions/permissions.js +585 -0
- package/dist/src/utils/permissions/permissionsLoader.js +160 -0
- package/dist/src/utils/permissions/shadowedRuleDetection.js +81 -0
- package/dist/src/utils/permissions/shellRuleMatching.js +108 -0
- package/dist/src/utils/permissions/yoloClassifier.js +868 -0
- package/dist/src/utils/planModeV2.js +45 -0
- package/dist/src/utils/plans.js +232 -0
- package/dist/src/utils/platform.js +102 -0
- package/dist/src/utils/plugins/addDirPluginSettings.js +30 -0
- package/dist/src/utils/plugins/cacheUtils.js +144 -0
- package/dist/src/utils/plugins/dependencyResolver.js +118 -0
- package/dist/src/utils/plugins/fetchTelemetry.js +65 -0
- package/dist/src/utils/plugins/gitAvailability.js +18 -0
- package/dist/src/utils/plugins/headlessPluginInstall.js +92 -0
- package/dist/src/utils/plugins/hintRecommendation.js +95 -0
- package/dist/src/utils/plugins/installCounts.js +144 -0
- package/dist/src/utils/plugins/installedPluginsManager.js +645 -0
- package/dist/src/utils/plugins/loadPluginAgents.js +197 -0
- package/dist/src/utils/plugins/loadPluginCommands.js +488 -0
- package/dist/src/utils/plugins/loadPluginHooks.js +170 -0
- package/dist/src/utils/plugins/loadPluginOutputStyles.js +98 -0
- package/dist/src/utils/plugins/lspPluginIntegration.js +216 -0
- package/dist/src/utils/plugins/lspRecommendation.js +193 -0
- package/dist/src/utils/plugins/managedPlugins.js +18 -0
- package/dist/src/utils/plugins/marketplaceHelpers.js +309 -0
- package/dist/src/utils/plugins/marketplaceManager.js +1225 -0
- package/dist/src/utils/plugins/mcpPluginIntegration.js +336 -0
- package/dist/src/utils/plugins/mcpbHandler.js +487 -0
- package/dist/src/utils/plugins/officialMarketplace.js +5 -0
- package/dist/src/utils/plugins/officialMarketplaceGcs.js +118 -0
- package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +267 -0
- package/dist/src/utils/plugins/orphanedPluginFilter.js +47 -0
- package/dist/src/utils/plugins/parseMarketplaceInput.js +75 -0
- package/dist/src/utils/plugins/performStartupChecks.js +34 -0
- package/dist/src/utils/plugins/pluginAutoupdate.js +130 -0
- package/dist/src/utils/plugins/pluginBlocklist.js +66 -0
- package/dist/src/utils/plugins/pluginDirectories.js +78 -0
- package/dist/src/utils/plugins/pluginFlagging.js +122 -0
- package/dist/src/utils/plugins/pluginIdentifier.js +37 -0
- package/dist/src/utils/plugins/pluginInstallationHelpers.js +281 -0
- package/dist/src/utils/plugins/pluginLoader.js +1596 -0
- package/dist/src/utils/plugins/pluginOptionsStorage.js +162 -0
- package/dist/src/utils/plugins/pluginPolicy.js +5 -0
- package/dist/src/utils/plugins/pluginStartupCheck.js +176 -0
- package/dist/src/utils/plugins/pluginVersioning.js +53 -0
- package/dist/src/utils/plugins/reconciler.js +133 -0
- package/dist/src/utils/plugins/refresh.js +96 -0
- package/dist/src/utils/plugins/schemas.js +411 -0
- package/dist/src/utils/plugins/validatePlugin.js +573 -0
- package/dist/src/utils/plugins/walkPluginMarkdown.js +30 -0
- package/dist/src/utils/plugins/zipCache.js +211 -0
- package/dist/src/utils/plugins/zipCacheAdapters.js +93 -0
- package/dist/src/utils/powershell/dangerousCmdlets.js +97 -0
- package/dist/src/utils/powershell/parser.js +929 -0
- package/dist/src/utils/powershell/staticPrefix.js +142 -0
- package/dist/src/utils/preflightChecks.js +196 -0
- package/dist/src/utils/privacyLevel.js +21 -0
- package/dist/src/utils/process.js +42 -0
- package/dist/src/utils/processUserInput/processBashCommand.js +109 -0
- package/dist/src/utils/processUserInput/processSlashCommand.js +600 -0
- package/dist/src/utils/processUserInput/processTextPrompt.js +54 -0
- package/dist/src/utils/processUserInput/processUserInput.js +272 -0
- package/dist/src/utils/profilerBase.js +15 -0
- package/dist/src/utils/promptCategory.js +21 -0
- package/dist/src/utils/promptEditor.js +115 -0
- package/dist/src/utils/promptShellExecution.js +76 -0
- package/dist/src/utils/proxy.js +228 -0
- package/dist/src/utils/queryContext.js +83 -0
- package/dist/src/utils/queryHelpers.js +329 -0
- package/dist/src/utils/queryProfiler.js +177 -0
- package/dist/src/utils/queueProcessor.js +41 -0
- package/dist/src/utils/readEditContext.js +131 -0
- package/dist/src/utils/readFileInRange.js +212 -0
- package/dist/src/utils/releaseNotes.js +186 -0
- package/dist/src/utils/renderOptions.js +45 -0
- package/dist/src/utils/ripgrep.js +383 -0
- package/dist/src/utils/sandbox/sandbox-adapter.js +505 -0
- package/dist/src/utils/sandbox/sandbox-ui-utils.js +3 -0
- package/dist/src/utils/sanitization.js +33 -0
- package/dist/src/utils/screenshotClipboard.js +73 -0
- package/dist/src/utils/sdkEventQueue.js +36 -0
- package/dist/src/utils/secureStorage/fallbackStorage.js +45 -0
- package/dist/src/utils/secureStorage/index.js +9 -0
- package/dist/src/utils/secureStorage/keychainPrefetch.js +43 -0
- package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +42 -0
- package/dist/src/utils/secureStorage/macOsKeychainStorage.js +147 -0
- package/dist/src/utils/secureStorage/plainTextStorage.js +77 -0
- package/dist/src/utils/semanticBoolean.js +4 -0
- package/dist/src/utils/semanticNumber.js +11 -0
- package/dist/src/utils/semver.js +43 -0
- package/dist/src/utils/sequential.js +30 -0
- package/dist/src/utils/sessionActivity.js +95 -0
- package/dist/src/utils/sessionEnvVars.js +13 -0
- package/dist/src/utils/sessionEnvironment.js +113 -0
- package/dist/src/utils/sessionFileAccessHooks.js +150 -0
- package/dist/src/utils/sessionIngressAuth.js +79 -0
- package/dist/src/utils/sessionRestore.js +205 -0
- package/dist/src/utils/sessionStart.js +119 -0
- package/dist/src/utils/sessionState.js +48 -0
- package/dist/src/utils/sessionStorage.js +2891 -0
- package/dist/src/utils/sessionStoragePortable.js +486 -0
- package/dist/src/utils/sessionTitle.js +89 -0
- package/dist/src/utils/sessionUrl.js +33 -0
- package/dist/src/utils/set.js +38 -0
- package/dist/src/utils/settings/allErrors.js +11 -0
- package/dist/src/utils/settings/applySettingsChange.js +40 -0
- package/dist/src/utils/settings/changeDetector.js +279 -0
- package/dist/src/utils/settings/constants.js +119 -0
- package/dist/src/utils/settings/internalWrites.js +15 -0
- package/dist/src/utils/settings/managedPath.js +19 -0
- package/dist/src/utils/settings/mdm/constants.js +33 -0
- package/dist/src/utils/settings/mdm/rawRead.js +72 -0
- package/dist/src/utils/settings/mdm/settings.js +160 -0
- package/dist/src/utils/settings/permissionValidation.js +169 -0
- package/dist/src/utils/settings/pluginOnlyPolicy.js +19 -0
- package/dist/src/utils/settings/schemaOutput.js +7 -0
- package/dist/src/utils/settings/settings.js +530 -0
- package/dist/src/utils/settings/settingsCache.js +36 -0
- package/dist/src/utils/settings/toolValidationConfig.js +58 -0
- package/dist/src/utils/settings/types.js +224 -0
- package/dist/src/utils/settings/validateEditTool.js +26 -0
- package/dist/src/utils/settings/validation.js +160 -0
- package/dist/src/utils/settings/validationTips.js +94 -0
- package/dist/src/utils/shell/bashProvider.js +123 -0
- package/dist/src/utils/shell/outputLimits.js +7 -0
- package/dist/src/utils/shell/powershellDetection.js +50 -0
- package/dist/src/utils/shell/powershellProvider.js +50 -0
- package/dist/src/utils/shell/prefix.js +183 -0
- package/dist/src/utils/shell/readOnlyCommandValidation.js +1347 -0
- package/dist/src/utils/shell/resolveDefaultShell.js +4 -0
- package/dist/src/utils/shell/shellProvider.js +2 -0
- package/dist/src/utils/shell/shellToolUtils.js +10 -0
- package/dist/src/utils/shell/specPrefix.js +152 -0
- package/dist/src/utils/shellConfig.js +88 -0
- package/dist/src/utils/sideQuery.js +108 -0
- package/dist/src/utils/sideQuestion.js +78 -0
- package/dist/src/utils/signal.js +18 -0
- package/dist/src/utils/sinks.js +6 -0
- package/dist/src/utils/skills/skillChangeDetector.js +184 -0
- package/dist/src/utils/slashCommandParsing.js +25 -0
- package/dist/src/utils/sleep.js +43 -0
- package/dist/src/utils/sliceAnsi.js +48 -0
- package/dist/src/utils/slowOperations.js +165 -0
- package/dist/src/utils/standaloneAgent.js +7 -0
- package/dist/src/utils/startupProfiler.js +106 -0
- package/dist/src/utils/staticRender.js +78 -0
- package/dist/src/utils/stats.js +598 -0
- package/dist/src/utils/statsCache.js +223 -0
- package/dist/src/utils/status.js +361 -0
- package/dist/src/utils/statusNoticeDefinitions.js +280 -0
- package/dist/src/utils/statusNoticeHelpers.js +10 -0
- package/dist/src/utils/stream.js +72 -0
- package/dist/src/utils/streamJsonStdoutGuard.js +73 -0
- package/dist/src/utils/streamlinedTransform.js +130 -0
- package/dist/src/utils/stringUtils.js +108 -0
- package/dist/src/utils/subprocessEnv.js +42 -0
- package/dist/src/utils/suggestions/commandSuggestions.js +301 -0
- package/dist/src/utils/suggestions/directoryCompletion.js +134 -0
- package/dist/src/utils/suggestions/shellHistoryCompletion.js +65 -0
- package/dist/src/utils/suggestions/skillUsageTracking.js +33 -0
- package/dist/src/utils/suggestions/slackChannelSuggestions.js +141 -0
- package/dist/src/utils/swarm/It2SetupPrompt.js +537 -0
- package/dist/src/utils/swarm/backends/ITermBackend.js +153 -0
- package/dist/src/utils/swarm/backends/InProcessBackend.js +160 -0
- package/dist/src/utils/swarm/backends/PaneBackendExecutor.js +171 -0
- package/dist/src/utils/swarm/backends/TmuxBackend.js +458 -0
- package/dist/src/utils/swarm/backends/detection.js +43 -0
- package/dist/src/utils/swarm/backends/it2Setup.js +134 -0
- package/dist/src/utils/swarm/backends/registry.js +220 -0
- package/dist/src/utils/swarm/backends/teammateModeSnapshot.js +33 -0
- package/dist/src/utils/swarm/backends/types.js +3 -0
- package/dist/src/utils/swarm/constants.js +11 -0
- package/dist/src/utils/swarm/inProcessRunner.js +818 -0
- package/dist/src/utils/swarm/leaderPermissionBridge.js +20 -0
- package/dist/src/utils/swarm/permissionSync.js +474 -0
- package/dist/src/utils/swarm/reconnection.js +55 -0
- package/dist/src/utils/swarm/spawnInProcess.js +164 -0
- package/dist/src/utils/swarm/spawnUtils.js +76 -0
- package/dist/src/utils/swarm/teamHelpers.js +320 -0
- package/dist/src/utils/swarm/teammateInit.js +65 -0
- package/dist/src/utils/swarm/teammateLayoutManager.js +40 -0
- package/dist/src/utils/swarm/teammateModel.js +5 -0
- package/dist/src/utils/swarm/teammatePromptAddendum.js +11 -0
- package/dist/src/utils/systemDirectories.js +42 -0
- package/dist/src/utils/systemPrompt.js +41 -0
- package/dist/src/utils/systemPromptType.js +3 -0
- package/dist/src/utils/systemTheme.js +61 -0
- package/dist/src/utils/taggedId.js +27 -0
- package/dist/src/utils/task/TaskOutput.js +244 -0
- package/dist/src/utils/task/diskOutput.js +267 -0
- package/dist/src/utils/task/framework.js +178 -0
- package/dist/src/utils/task/outputFormatting.js +21 -0
- package/dist/src/utils/task/sdkProgress.js +18 -0
- package/dist/src/utils/tasks.js +481 -0
- package/dist/src/utils/teamDiscovery.js +33 -0
- package/dist/src/utils/teamMemoryOps.js +40 -0
- package/dist/src/utils/teammate.js +132 -0
- package/dist/src/utils/teammateContext.js +17 -0
- package/dist/src/utils/teammateMailbox.js +541 -0
- package/dist/src/utils/telemetry/betaSessionTracing.js +255 -0
- package/dist/src/utils/telemetry/bigqueryExporter.js +162 -0
- package/dist/src/utils/telemetry/events.js +46 -0
- package/dist/src/utils/telemetry/instrumentation.js +534 -0
- package/dist/src/utils/telemetry/logger.js +26 -0
- package/dist/src/utils/telemetry/perfettoTracing.js +636 -0
- package/dist/src/utils/telemetry/pluginTelemetry.js +99 -0
- package/dist/src/utils/telemetry/sessionTracing.js +564 -0
- package/dist/src/utils/telemetry/skillLoadedEvent.js +22 -0
- package/dist/src/utils/telemetryAttributes.js +50 -0
- package/dist/src/utils/teleport/api.js +236 -0
- package/dist/src/utils/teleport/environmentSelection.js +42 -0
- package/dist/src/utils/teleport/environments.js +74 -0
- package/dist/src/utils/teleport/gitBundle.js +153 -0
- package/dist/src/utils/teleport.js +856 -0
- package/dist/src/utils/tempfile.js +7 -0
- package/dist/src/utils/terminal.js +65 -0
- package/dist/src/utils/terminalPanel.js +133 -0
- package/dist/src/utils/textHighlighting.js +109 -0
- package/dist/src/utils/theme.js +465 -0
- package/dist/src/utils/thinking.js +92 -0
- package/dist/src/utils/timeouts.js +22 -0
- package/dist/src/utils/tmuxSocket.js +216 -0
- package/dist/src/utils/todo/types.js +9 -0
- package/dist/src/utils/tokenBudget.js +54 -0
- package/dist/src/utils/tokens.js +123 -0
- package/dist/src/utils/toolErrors.js +87 -0
- package/dist/src/utils/toolPool.js +22 -0
- package/dist/src/utils/toolResultStorage.js +444 -0
- package/dist/src/utils/toolSchemaCache.js +7 -0
- package/dist/src/utils/toolSearch.js +314 -0
- package/dist/src/utils/transcriptSearch.js +143 -0
- package/dist/src/utils/treeify.js +89 -0
- package/dist/src/utils/truncate.js +113 -0
- package/dist/src/utils/ultraplan/ccrSession.js +187 -0
- package/dist/src/utils/ultraplan/keyword.js +81 -0
- package/dist/src/utils/ultraplan/prompt.txt.js +1 -0
- package/dist/src/utils/unaryLogging.js +15 -0
- package/dist/src/utils/undercover.js +57 -0
- package/dist/src/utils/user.js +111 -0
- package/dist/src/utils/userAgent.js +3 -0
- package/dist/src/utils/userPromptKeywords.js +13 -0
- package/dist/src/utils/uuid.js +11 -0
- package/dist/src/utils/warningHandler.js +74 -0
- package/dist/src/utils/which.js +50 -0
- package/dist/src/utils/windowsPaths.js +104 -0
- package/dist/src/utils/withResolvers.js +9 -0
- package/dist/src/utils/words.js +763 -0
- package/dist/src/utils/workloadContext.js +9 -0
- package/dist/src/utils/worktree.js +841 -0
- package/dist/src/utils/worktreeModeEnabled.js +3 -0
- package/dist/src/utils/xdg.js +24 -0
- package/dist/src/utils/xml.js +6 -0
- package/dist/src/utils/yaml.js +6 -0
- package/dist/src/utils/zodToJsonSchema.js +10 -0
- package/dist/src/vim/motions.js +54 -0
- package/dist/src/vim/operators.js +329 -0
- package/dist/src/vim/textObjects.js +137 -0
- package/dist/src/vim/transitions.js +324 -0
- package/dist/src/vim/types.js +60 -0
- package/dist/src/voice/voiceModeEnabled.js +18 -0
- package/dist/stubs/ant-claude-for-chrome-mcp.js +6 -0
- package/dist/stubs/color-diff-napi.js +30 -0
- package/litellm.yaml +25 -0
- package/package.json +93 -0
|
@@ -0,0 +1,3588 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { spawnSync } from "child_process";
|
|
3
|
+
import { snapshotOutputTokensForTurn, getCurrentTurnTokenBudget, getTurnOutputTokens, getBudgetContinuationCount, getTotalInputTokens } from "../bootstrap/state.js";
|
|
4
|
+
import { parseTokenBudget } from "../utils/tokenBudget.js";
|
|
5
|
+
import { count } from "../utils/array.js";
|
|
6
|
+
import { dirname, join } from "path";
|
|
7
|
+
import { tmpdir } from "os";
|
|
8
|
+
import figures from "figures";
|
|
9
|
+
import { useInput } from "../ink.js";
|
|
10
|
+
import { useSearchInput } from "../hooks/useSearchInput.js";
|
|
11
|
+
import { useTerminalSize } from "../hooks/useTerminalSize.js";
|
|
12
|
+
import { useSearchHighlight } from "../ink/hooks/use-search-highlight.js";
|
|
13
|
+
import { renderMessagesToPlainText } from "../utils/exportRenderer.js";
|
|
14
|
+
import { openFileInExternalEditor } from "../utils/editor.js";
|
|
15
|
+
import { writeFile } from "fs/promises";
|
|
16
|
+
import { Box, Text, useStdin, useTheme, useTerminalFocus, useTerminalTitle, useTabStatus } from "../ink.js";
|
|
17
|
+
import { CostThresholdDialog } from "../components/CostThresholdDialog.js";
|
|
18
|
+
import { IdleReturnDialog } from "../components/IdleReturnDialog.js";
|
|
19
|
+
import * as React from "react";
|
|
20
|
+
import { useEffect, useMemo, useRef, useState, useCallback, useDeferredValue, useLayoutEffect } from "react";
|
|
21
|
+
import { useNotifications } from "../context/notifications.js";
|
|
22
|
+
import { sendNotification } from "../services/notifier.js";
|
|
23
|
+
import { startPreventSleep, stopPreventSleep } from "../services/preventSleep.js";
|
|
24
|
+
import { useTerminalNotification } from "../ink/useTerminalNotification.js";
|
|
25
|
+
import { hasCursorUpViewportYankBug } from "../ink/terminal.js";
|
|
26
|
+
import { createFileStateCacheWithSizeLimit, mergeFileStateCaches, READ_FILE_STATE_CACHE_SIZE } from "../utils/fileStateCache.js";
|
|
27
|
+
import { updateLastInteractionTime, getLastInteractionTime, getOriginalCwd, getProjectRoot, getSessionId, switchSession, setCostStateForRestore, getTurnHookDurationMs, getTurnHookCount, resetTurnHookDuration, getTurnToolDurationMs, getTurnToolCount, resetTurnToolDuration, getTurnClassifierDurationMs, getTurnClassifierCount, resetTurnClassifierDuration } from "../bootstrap/state.js";
|
|
28
|
+
import { asSessionId, asAgentId } from "../types/ids.js";
|
|
29
|
+
import { logForDebugging } from "../utils/debug.js";
|
|
30
|
+
import { QueryGuard } from "../utils/QueryGuard.js";
|
|
31
|
+
import { isEnvTruthy } from "../utils/envUtils.js";
|
|
32
|
+
import { formatTokens, truncateToWidth } from "../utils/format.js";
|
|
33
|
+
import { consumeEarlyInput } from "../utils/earlyInput.js";
|
|
34
|
+
import { setMemberActive } from "../utils/swarm/teamHelpers.js";
|
|
35
|
+
import { isSwarmWorker, generateSandboxRequestId, sendSandboxPermissionRequestViaMailbox, sendSandboxPermissionResponseViaMailbox } from "../utils/swarm/permissionSync.js";
|
|
36
|
+
import { registerSandboxPermissionCallback } from "../hooks/useSwarmPermissionPoller.js";
|
|
37
|
+
import { getTeamName, getAgentName } from "../utils/teammate.js";
|
|
38
|
+
import { WorkerPendingPermission } from "../components/permissions/WorkerPendingPermission.js";
|
|
39
|
+
import { injectUserMessageToTeammate, getAllInProcessTeammateTasks } from "../tasks/InProcessTeammateTask/InProcessTeammateTask.js";
|
|
40
|
+
import { isLocalAgentTask, queuePendingMessage, appendMessageToLocalAgent } from "../tasks/LocalAgentTask/LocalAgentTask.js";
|
|
41
|
+
import { registerLeaderToolUseConfirmQueue, unregisterLeaderToolUseConfirmQueue, registerLeaderSetToolPermissionContext, unregisterLeaderSetToolPermissionContext } from "../utils/swarm/leaderPermissionBridge.js";
|
|
42
|
+
import { endInteractionSpan } from "../utils/telemetry/sessionTracing.js";
|
|
43
|
+
import { useLogMessages } from "../hooks/useLogMessages.js";
|
|
44
|
+
import { useReplBridge } from "../hooks/useReplBridge.js";
|
|
45
|
+
import { getCommandName, isCommandEnabled } from "../commands.js";
|
|
46
|
+
import { MessageSelector, selectableUserMessagesFilter, messagesAfterAreOnlySynthetic } from "../components/MessageSelector.js";
|
|
47
|
+
import { useIdeLogging } from "../hooks/useIdeLogging.js";
|
|
48
|
+
import { PermissionRequest } from "../components/permissions/PermissionRequest.js";
|
|
49
|
+
import { ElicitationDialog } from "../components/mcp/ElicitationDialog.js";
|
|
50
|
+
import { PromptDialog } from "../components/hooks/PromptDialog.js";
|
|
51
|
+
import PromptInput from "../components/PromptInput/PromptInput.js";
|
|
52
|
+
import { PromptInputQueuedCommands } from "../components/PromptInput/PromptInputQueuedCommands.js";
|
|
53
|
+
import { useRemoteSession } from "../hooks/useRemoteSession.js";
|
|
54
|
+
import { useDirectConnect } from "../hooks/useDirectConnect.js";
|
|
55
|
+
import { useSSHSession } from "../hooks/useSSHSession.js";
|
|
56
|
+
import { useAssistantHistory } from "../hooks/useAssistantHistory.js";
|
|
57
|
+
import { SkillImprovementSurvey } from "../components/SkillImprovementSurvey.js";
|
|
58
|
+
import { useSkillImprovementSurvey } from "../hooks/useSkillImprovementSurvey.js";
|
|
59
|
+
import { useMoreRight } from "../moreright/useMoreRight.js";
|
|
60
|
+
import { SpinnerWithVerb, BriefIdleStatus } from "../components/Spinner.js";
|
|
61
|
+
import { getSystemPrompt } from "../constants/prompts.js";
|
|
62
|
+
import { buildEffectiveSystemPrompt } from "../utils/systemPrompt.js";
|
|
63
|
+
import { getSystemContext, getUserContext } from "../context.js";
|
|
64
|
+
import { getMemoryFiles } from "../utils/claudemd.js";
|
|
65
|
+
import { startBackgroundHousekeeping } from "../utils/backgroundHousekeeping.js";
|
|
66
|
+
import { getTotalCost, saveCurrentSessionCosts, resetCostState, getStoredSessionCosts } from "../cost-tracker.js";
|
|
67
|
+
import { useCostSummary } from "../costHook.js";
|
|
68
|
+
import { useFpsMetrics } from "../context/fpsMetrics.js";
|
|
69
|
+
import { useAfterFirstRender } from "../hooks/useAfterFirstRender.js";
|
|
70
|
+
import { useDeferredHookMessages } from "../hooks/useDeferredHookMessages.js";
|
|
71
|
+
import { addToHistory, removeLastFromHistory, expandPastedTextRefs, parseReferences } from "../history.js";
|
|
72
|
+
import { prependModeCharacterToInput } from "../components/PromptInput/inputModes.js";
|
|
73
|
+
import { prependToShellHistoryCache } from "../utils/suggestions/shellHistoryCompletion.js";
|
|
74
|
+
import { useApiKeyVerification } from "../hooks/useApiKeyVerification.js";
|
|
75
|
+
import { GlobalKeybindingHandlers } from "../hooks/useGlobalKeybindings.js";
|
|
76
|
+
import { CommandKeybindingHandlers } from "../hooks/useCommandKeybindings.js";
|
|
77
|
+
import { KeybindingSetup } from "../keybindings/KeybindingProviderSetup.js";
|
|
78
|
+
import { useShortcutDisplay } from "../keybindings/useShortcutDisplay.js";
|
|
79
|
+
import { getShortcutDisplay } from "../keybindings/shortcutFormat.js";
|
|
80
|
+
import { CancelRequestHandler } from "../hooks/useCancelRequest.js";
|
|
81
|
+
import { useBackgroundTaskNavigation } from "../hooks/useBackgroundTaskNavigation.js";
|
|
82
|
+
import { useSwarmInitialization } from "../hooks/useSwarmInitialization.js";
|
|
83
|
+
import { useTeammateViewAutoExit } from "../hooks/useTeammateViewAutoExit.js";
|
|
84
|
+
import { errorMessage } from "../utils/errors.js";
|
|
85
|
+
import { isHumanTurn } from "../utils/messagePredicates.js";
|
|
86
|
+
import { logError } from "../utils/log.js";
|
|
87
|
+
const useVoiceIntegration = () => ({
|
|
88
|
+
stripTrailing: () => 0,
|
|
89
|
+
handleKeyEvent: () => {},
|
|
90
|
+
resetAnchor: () => {}
|
|
91
|
+
});
|
|
92
|
+
const VoiceKeybindingHandler = () => null;
|
|
93
|
+
const useFrustrationDetection = () => ({
|
|
94
|
+
state: "closed",
|
|
95
|
+
handleTranscriptSelect: () => {}
|
|
96
|
+
});
|
|
97
|
+
const useAntOrgWarningNotification = () => {};
|
|
98
|
+
const getCoordinatorUserContext = () => ({});
|
|
99
|
+
import useCanUseTool from "../hooks/useCanUseTool.js";
|
|
100
|
+
import { applyPermissionUpdate, applyPermissionUpdates, persistPermissionUpdate } from "../utils/permissions/PermissionUpdate.js";
|
|
101
|
+
import { buildPermissionUpdates } from "../components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js";
|
|
102
|
+
import { stripDangerousPermissionsForAutoMode } from "../utils/permissions/permissionSetup.js";
|
|
103
|
+
import { getScratchpadDir, isScratchpadEnabled } from "../utils/permissions/filesystem.js";
|
|
104
|
+
import { WEB_FETCH_TOOL_NAME } from "../tools/WebFetchTool/prompt.js";
|
|
105
|
+
import { SLEEP_TOOL_NAME } from "../tools/SleepTool/prompt.js";
|
|
106
|
+
import { clearSpeculativeChecks } from "../tools/BashTool/bashPermissions.js";
|
|
107
|
+
import { getGlobalConfig, saveGlobalConfig, getGlobalConfigWriteCount } from "../utils/config.js";
|
|
108
|
+
import { hasConsoleBillingAccess } from "../utils/billing.js";
|
|
109
|
+
import { logEvent } from "../services/analytics/index.js";
|
|
110
|
+
import { getFeatureValue_CACHED_MAY_BE_STALE } from "../services/analytics/growthbook.js";
|
|
111
|
+
import { textForResubmit, handleMessageFromStream, isCompactBoundaryMessage, getMessagesAfterCompactBoundary, getContentText, createUserMessage, createAssistantMessage, createTurnDurationMessage, createAgentsKilledMessage, createApiMetricsMessage, createSystemMessage, createCommandInputMessage, formatCommandInputTags } from "../utils/messages.js";
|
|
112
|
+
import { generateSessionTitle } from "../utils/sessionTitle.js";
|
|
113
|
+
import { BASH_INPUT_TAG, COMMAND_MESSAGE_TAG, COMMAND_NAME_TAG, LOCAL_COMMAND_STDOUT_TAG } from "../constants/xml.js";
|
|
114
|
+
import { escapeXml } from "../utils/xml.js";
|
|
115
|
+
import { gracefulShutdownSync } from "../utils/gracefulShutdown.js";
|
|
116
|
+
import { handlePromptSubmit } from "../utils/handlePromptSubmit.js";
|
|
117
|
+
import { useQueueProcessor } from "../hooks/useQueueProcessor.js";
|
|
118
|
+
import { useMailboxBridge } from "../hooks/useMailboxBridge.js";
|
|
119
|
+
import { queryCheckpoint, logQueryProfileReport } from "../utils/queryProfiler.js";
|
|
120
|
+
import { query } from "../query.js";
|
|
121
|
+
import { mergeClients, useMergedClients } from "../hooks/useMergedClients.js";
|
|
122
|
+
import { getQuerySourceForREPL } from "../utils/promptCategory.js";
|
|
123
|
+
import { useMergedTools } from "../hooks/useMergedTools.js";
|
|
124
|
+
import { mergeAndFilterTools } from "../utils/toolPool.js";
|
|
125
|
+
import { useMergedCommands } from "../hooks/useMergedCommands.js";
|
|
126
|
+
import { useSkillsChange } from "../hooks/useSkillsChange.js";
|
|
127
|
+
import { useManagePlugins } from "../hooks/useManagePlugins.js";
|
|
128
|
+
import { Messages } from "../components/Messages.js";
|
|
129
|
+
import { TaskListV2 } from "../components/TaskListV2.js";
|
|
130
|
+
import { TeammateViewHeader } from "../components/TeammateViewHeader.js";
|
|
131
|
+
import { useTasksV2WithCollapseEffect } from "../hooks/useTasksV2.js";
|
|
132
|
+
import { maybeMarkProjectOnboardingComplete } from "../projectOnboardingState.js";
|
|
133
|
+
import { randomUUID } from "crypto";
|
|
134
|
+
import { processSessionStartHooks } from "../utils/sessionStart.js";
|
|
135
|
+
import { executeSessionEndHooks, getSessionEndHookTimeoutMs } from "../utils/hooks.js";
|
|
136
|
+
import { useIdeSelection } from "../hooks/useIdeSelection.js";
|
|
137
|
+
import { getTools, assembleToolPool } from "../tools.js";
|
|
138
|
+
import { resolveAgentTools } from "../tools/AgentTool/agentToolUtils.js";
|
|
139
|
+
import { resumeAgentBackground } from "../tools/AgentTool/resumeAgent.js";
|
|
140
|
+
import { useMainLoopModel } from "../hooks/useMainLoopModel.js";
|
|
141
|
+
import { useAppState, useSetAppState, useAppStateStore } from "../state/AppState.js";
|
|
142
|
+
import { copyPlanForFork, copyPlanForResume, getPlanSlug, setPlanSlug } from "../utils/plans.js";
|
|
143
|
+
import { clearSessionMetadata, resetSessionFilePointer, adoptResumedSessionFile, removeTranscriptMessage, restoreSessionMetadata, getCurrentSessionTitle, isEphemeralToolProgress, isLoggableMessage, saveWorktreeState, getAgentTranscript } from "../utils/sessionStorage.js";
|
|
144
|
+
import { deserializeMessages } from "../utils/conversationRecovery.js";
|
|
145
|
+
import { extractReadFilesFromMessages, extractBashToolsFromMessages } from "../utils/queryHelpers.js";
|
|
146
|
+
import { resetMicrocompactState } from "../services/compact/microCompact.js";
|
|
147
|
+
import { runPostCompactCleanup } from "../services/compact/postCompactCleanup.js";
|
|
148
|
+
import { provisionContentReplacementState, reconstructContentReplacementState } from "../utils/toolResultStorage.js";
|
|
149
|
+
import { partialCompactConversation } from "../services/compact/compact.js";
|
|
150
|
+
import { fileHistoryMakeSnapshot, fileHistoryRewind, copyFileHistoryForResume, fileHistoryEnabled, fileHistoryHasAnyChanges } from "../utils/fileHistory.js";
|
|
151
|
+
import { incrementPromptCount } from "../utils/commitAttribution.js";
|
|
152
|
+
import { recordAttributionSnapshot } from "../utils/sessionStorage.js";
|
|
153
|
+
import { computeStandaloneAgentContext, restoreAgentFromSession, restoreSessionStateFromLog, restoreWorktreeForResume, exitRestoredWorktree } from "../utils/sessionRestore.js";
|
|
154
|
+
import { isBgSession, updateSessionName, updateSessionActivity } from "../utils/concurrentSessions.js";
|
|
155
|
+
import { isInProcessTeammateTask } from "../tasks/InProcessTeammateTask/types.js";
|
|
156
|
+
import { restoreRemoteAgentTasks } from "../tasks/RemoteAgentTask/RemoteAgentTask.js";
|
|
157
|
+
import { useInboxPoller } from "../hooks/useInboxPoller.js";
|
|
158
|
+
const proactiveModule = null;
|
|
159
|
+
const PROACTIVE_NO_OP_SUBSCRIBE = (_cb) => () => {};
|
|
160
|
+
const PROACTIVE_FALSE = () => false;
|
|
161
|
+
const SUGGEST_BG_PR_NOOP = (_p, _n) => false;
|
|
162
|
+
const useProactive = null;
|
|
163
|
+
const useScheduledTasks = null;
|
|
164
|
+
import { isAgentSwarmsEnabled } from "../utils/agentSwarmsEnabled.js";
|
|
165
|
+
import { useTaskListWatcher } from "../hooks/useTaskListWatcher.js";
|
|
166
|
+
import { closeOpenDiffs, getConnectedIdeClient } from "../utils/ide.js";
|
|
167
|
+
import { useIDEIntegration } from "../hooks/useIDEIntegration.js";
|
|
168
|
+
import exit from "../commands/exit/index.js";
|
|
169
|
+
import { ExitFlow } from "../components/ExitFlow.js";
|
|
170
|
+
import { getCurrentWorktreeSession } from "../utils/worktree.js";
|
|
171
|
+
import { popAllEditable, enqueue, getCommandQueue, getCommandQueueLength, removeByFilter } from "../utils/messageQueueManager.js";
|
|
172
|
+
import { useCommandQueue } from "../hooks/useCommandQueue.js";
|
|
173
|
+
import { SessionBackgroundHint } from "../components/SessionBackgroundHint.js";
|
|
174
|
+
import { startBackgroundSession } from "../tasks/LocalMainSessionTask.js";
|
|
175
|
+
import { useSessionBackgrounding } from "../hooks/useSessionBackgrounding.js";
|
|
176
|
+
import { diagnosticTracker } from "../services/diagnosticTracking.js";
|
|
177
|
+
import { handleSpeculationAccept } from "../services/PromptSuggestion/speculation.js";
|
|
178
|
+
import { IdeOnboardingDialog } from "../components/IdeOnboardingDialog.js";
|
|
179
|
+
import { EffortCallout, shouldShowEffortCallout } from "../components/EffortCallout.js";
|
|
180
|
+
import { RemoteCallout } from "../components/RemoteCallout.js";
|
|
181
|
+
const AntModelSwitchCallout = null;
|
|
182
|
+
const shouldShowAntModelSwitch = () => false;
|
|
183
|
+
const UndercoverAutoCallout = null;
|
|
184
|
+
import { activityManager } from "../utils/activityManager.js";
|
|
185
|
+
import { createAbortController } from "../utils/abortController.js";
|
|
186
|
+
import { MCPConnectionManager } from "../services/mcp/MCPConnectionManager.js";
|
|
187
|
+
import { useFeedbackSurvey } from "../components/FeedbackSurvey/useFeedbackSurvey.js";
|
|
188
|
+
import { useMemorySurvey } from "../components/FeedbackSurvey/useMemorySurvey.js";
|
|
189
|
+
import { usePostCompactSurvey } from "../components/FeedbackSurvey/usePostCompactSurvey.js";
|
|
190
|
+
import { FeedbackSurvey } from "../components/FeedbackSurvey/FeedbackSurvey.js";
|
|
191
|
+
import { useInstallMessages } from "../hooks/notifs/useInstallMessages.js";
|
|
192
|
+
import { useAwaySummary } from "../hooks/useAwaySummary.js";
|
|
193
|
+
import { useChromeExtensionNotification } from "../hooks/useChromeExtensionNotification.js";
|
|
194
|
+
import { useOfficialMarketplaceNotification } from "../hooks/useOfficialMarketplaceNotification.js";
|
|
195
|
+
import { usePromptsFromClaudeInChrome } from "../hooks/usePromptsFromClaudeInChrome.js";
|
|
196
|
+
import { getTipToShowOnSpinner, recordShownTip } from "../services/tips/tipScheduler.js";
|
|
197
|
+
import { checkAndDisableBypassPermissionsIfNeeded, checkAndDisableAutoModeIfNeeded, useKickOffCheckAndDisableBypassPermissionsIfNeeded, useKickOffCheckAndDisableAutoModeIfNeeded } from "../utils/permissions/bypassPermissionsKillswitch.js";
|
|
198
|
+
import { SandboxManager } from "../utils/sandbox/sandbox-adapter.js";
|
|
199
|
+
import { SANDBOX_NETWORK_ACCESS_TOOL_NAME } from "../cli/structuredIO.js";
|
|
200
|
+
import { useFileHistorySnapshotInit } from "../hooks/useFileHistorySnapshotInit.js";
|
|
201
|
+
import { SandboxPermissionRequest } from "../components/permissions/SandboxPermissionRequest.js";
|
|
202
|
+
import { SandboxViolationExpandedView } from "../components/SandboxViolationExpandedView.js";
|
|
203
|
+
import { useSettingsErrors } from "../hooks/notifs/useSettingsErrors.js";
|
|
204
|
+
import { useMcpConnectivityStatus } from "../hooks/notifs/useMcpConnectivityStatus.js";
|
|
205
|
+
import { useAutoModeUnavailableNotification } from "../hooks/notifs/useAutoModeUnavailableNotification.js";
|
|
206
|
+
import { AUTO_MODE_DESCRIPTION } from "../components/AutoModeOptInDialog.js";
|
|
207
|
+
import { useLspInitializationNotification } from "../hooks/notifs/useLspInitializationNotification.js";
|
|
208
|
+
import { useLspPluginRecommendation } from "../hooks/useLspPluginRecommendation.js";
|
|
209
|
+
import { LspRecommendationMenu } from "../components/LspRecommendation/LspRecommendationMenu.js";
|
|
210
|
+
import { useClaudeCodeHintRecommendation } from "../hooks/useClaudeCodeHintRecommendation.js";
|
|
211
|
+
import { PluginHintMenu } from "../components/ClaudeCodeHint/PluginHintMenu.js";
|
|
212
|
+
import { DesktopUpsellStartup, shouldShowDesktopUpsellStartup } from "../components/DesktopUpsell/DesktopUpsellStartup.js";
|
|
213
|
+
import { usePluginInstallationStatus } from "../hooks/notifs/usePluginInstallationStatus.js";
|
|
214
|
+
import { usePluginAutoupdateNotification } from "../hooks/notifs/usePluginAutoupdateNotification.js";
|
|
215
|
+
import { performStartupChecks } from "../utils/plugins/performStartupChecks.js";
|
|
216
|
+
import { UserTextMessage } from "../components/messages/UserTextMessage.js";
|
|
217
|
+
import { AwsAuthStatusBox } from "../components/AwsAuthStatusBox.js";
|
|
218
|
+
import { useRateLimitWarningNotification } from "../hooks/notifs/useRateLimitWarningNotification.js";
|
|
219
|
+
import { useDeprecationWarningNotification } from "../hooks/notifs/useDeprecationWarningNotification.js";
|
|
220
|
+
import { useNpmDeprecationNotification } from "../hooks/notifs/useNpmDeprecationNotification.js";
|
|
221
|
+
import { useIDEStatusIndicator } from "../hooks/notifs/useIDEStatusIndicator.js";
|
|
222
|
+
import { useModelMigrationNotifications } from "../hooks/notifs/useModelMigrationNotifications.js";
|
|
223
|
+
import { useCanSwitchToExistingSubscription } from "../hooks/notifs/useCanSwitchToExistingSubscription.js";
|
|
224
|
+
import { useTeammateLifecycleNotification } from "../hooks/notifs/useTeammateShutdownNotification.js";
|
|
225
|
+
import { useFastModeNotification } from "../hooks/notifs/useFastModeNotification.js";
|
|
226
|
+
import { AutoRunIssueNotification, shouldAutoRunIssue, getAutoRunIssueReasonText, getAutoRunCommand } from "../utils/autoRunIssue.js";
|
|
227
|
+
import { TungstenLiveMonitor } from "../tools/TungstenTool/TungstenLiveMonitor.js";
|
|
228
|
+
const WebBrowserPanelModule = null;
|
|
229
|
+
import { IssueFlagBanner } from "../components/PromptInput/IssueFlagBanner.js";
|
|
230
|
+
import { useIssueFlagBanner } from "../hooks/useIssueFlagBanner.js";
|
|
231
|
+
import { CompanionSprite, CompanionFloatingBubble, MIN_COLS_FOR_FULL_SPRITE } from "../buddy/CompanionSprite.js";
|
|
232
|
+
import { DevBar } from "../components/DevBar.js";
|
|
233
|
+
import { REMOTE_SAFE_COMMANDS } from "../commands.js";
|
|
234
|
+
import { FullscreenLayout, useUnseenDivider, computeUnseenDivider } from "../components/FullscreenLayout.js";
|
|
235
|
+
import { isFullscreenEnvEnabled, maybeGetTmuxMouseHint, isMouseTrackingEnabled } from "../utils/fullscreen.js";
|
|
236
|
+
import { AlternateScreen } from "../ink/components/AlternateScreen.js";
|
|
237
|
+
import { ScrollKeybindingHandler } from "../components/ScrollKeybindingHandler.js";
|
|
238
|
+
import { useMessageActions, MessageActionsKeybindings, MessageActionsBar } from "../components/messageActions.js";
|
|
239
|
+
import { setClipboard } from "../ink/termio/osc.js";
|
|
240
|
+
import { createAttachmentMessage, getQueuedCommandAttachments } from "../utils/attachments.js";
|
|
241
|
+
const EMPTY_MCP_CLIENTS = [];
|
|
242
|
+
const HISTORY_STUB = {
|
|
243
|
+
maybeLoadOlder: (_) => {}
|
|
244
|
+
};
|
|
245
|
+
const RECENT_SCROLL_REPIN_WINDOW_MS = 3000;
|
|
246
|
+
function median(values) {
|
|
247
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
248
|
+
const mid = Math.floor(sorted.length / 2);
|
|
249
|
+
return sorted.length % 2 === 0 ? Math.round((sorted[mid - 1] + sorted[mid]) / 2) : sorted[mid];
|
|
250
|
+
}
|
|
251
|
+
function TranscriptModeFooter(t0) {
|
|
252
|
+
const $ = _c(9);
|
|
253
|
+
const {
|
|
254
|
+
showAllInTranscript,
|
|
255
|
+
virtualScroll,
|
|
256
|
+
searchBadge,
|
|
257
|
+
suppressShowAll: t1,
|
|
258
|
+
status
|
|
259
|
+
} = t0;
|
|
260
|
+
const suppressShowAll = t1 === undefined ? false : t1;
|
|
261
|
+
const toggleShortcut = useShortcutDisplay("app:toggleTranscript", "Global", "ctrl+o");
|
|
262
|
+
const showAllShortcut = useShortcutDisplay("transcript:toggleShowAll", "Transcript", "ctrl+e");
|
|
263
|
+
const t2 = searchBadge ? " · n/N to navigate" : virtualScroll ? ` · ${figures.arrowUp}${figures.arrowDown} scroll · home/end top/bottom` : suppressShowAll ? "" : ` · ${showAllShortcut} to ${showAllInTranscript ? "collapse" : "show all"}`;
|
|
264
|
+
let t3;
|
|
265
|
+
if ($[0] !== t2 || $[1] !== toggleShortcut) {
|
|
266
|
+
t3 = jsxDEV_7x81h0kn(Text, {
|
|
267
|
+
dimColor: true,
|
|
268
|
+
children: [
|
|
269
|
+
"Showing detailed transcript · ",
|
|
270
|
+
toggleShortcut,
|
|
271
|
+
" to toggle",
|
|
272
|
+
t2
|
|
273
|
+
]
|
|
274
|
+
}, undefined, true, undefined, this);
|
|
275
|
+
$[0] = t2;
|
|
276
|
+
$[1] = toggleShortcut;
|
|
277
|
+
$[2] = t3;
|
|
278
|
+
} else {
|
|
279
|
+
t3 = $[2];
|
|
280
|
+
}
|
|
281
|
+
let t4;
|
|
282
|
+
if ($[3] !== searchBadge || $[4] !== status) {
|
|
283
|
+
t4 = status ? jsxDEV_7x81h0kn(Fragment_8vg9x3sq, {
|
|
284
|
+
children: [
|
|
285
|
+
jsxDEV_7x81h0kn(Box, {
|
|
286
|
+
flexGrow: 1
|
|
287
|
+
}, undefined, false, undefined, this),
|
|
288
|
+
jsxDEV_7x81h0kn(Text, {
|
|
289
|
+
children: [
|
|
290
|
+
status,
|
|
291
|
+
" "
|
|
292
|
+
]
|
|
293
|
+
}, undefined, true, undefined, this)
|
|
294
|
+
]
|
|
295
|
+
}, undefined, true, undefined, this) : searchBadge ? jsxDEV_7x81h0kn(Fragment_8vg9x3sq, {
|
|
296
|
+
children: [
|
|
297
|
+
jsxDEV_7x81h0kn(Box, {
|
|
298
|
+
flexGrow: 1
|
|
299
|
+
}, undefined, false, undefined, this),
|
|
300
|
+
jsxDEV_7x81h0kn(Text, {
|
|
301
|
+
dimColor: true,
|
|
302
|
+
children: [
|
|
303
|
+
searchBadge.current,
|
|
304
|
+
"/",
|
|
305
|
+
searchBadge.count,
|
|
306
|
+
" "
|
|
307
|
+
]
|
|
308
|
+
}, undefined, true, undefined, this)
|
|
309
|
+
]
|
|
310
|
+
}, undefined, true, undefined, this) : null;
|
|
311
|
+
$[3] = searchBadge;
|
|
312
|
+
$[4] = status;
|
|
313
|
+
$[5] = t4;
|
|
314
|
+
} else {
|
|
315
|
+
t4 = $[5];
|
|
316
|
+
}
|
|
317
|
+
let t5;
|
|
318
|
+
if ($[6] !== t3 || $[7] !== t4) {
|
|
319
|
+
t5 = jsxDEV_7x81h0kn(Box, {
|
|
320
|
+
noSelect: true,
|
|
321
|
+
alignItems: "center",
|
|
322
|
+
alignSelf: "center",
|
|
323
|
+
borderTopDimColor: true,
|
|
324
|
+
borderBottom: false,
|
|
325
|
+
borderLeft: false,
|
|
326
|
+
borderRight: false,
|
|
327
|
+
borderStyle: "single",
|
|
328
|
+
marginTop: 1,
|
|
329
|
+
paddingLeft: 2,
|
|
330
|
+
width: "100%",
|
|
331
|
+
children: [
|
|
332
|
+
t3,
|
|
333
|
+
t4
|
|
334
|
+
]
|
|
335
|
+
}, undefined, true, undefined, this);
|
|
336
|
+
$[6] = t3;
|
|
337
|
+
$[7] = t4;
|
|
338
|
+
$[8] = t5;
|
|
339
|
+
} else {
|
|
340
|
+
t5 = $[8];
|
|
341
|
+
}
|
|
342
|
+
return t5;
|
|
343
|
+
}
|
|
344
|
+
function TranscriptSearchBar({
|
|
345
|
+
jumpRef,
|
|
346
|
+
count,
|
|
347
|
+
current,
|
|
348
|
+
onClose,
|
|
349
|
+
onCancel,
|
|
350
|
+
setHighlight,
|
|
351
|
+
initialQuery
|
|
352
|
+
}) {
|
|
353
|
+
const {
|
|
354
|
+
query,
|
|
355
|
+
cursorOffset
|
|
356
|
+
} = useSearchInput({
|
|
357
|
+
isActive: true,
|
|
358
|
+
initialQuery,
|
|
359
|
+
onExit: () => onClose(query),
|
|
360
|
+
onCancel
|
|
361
|
+
});
|
|
362
|
+
const [indexStatus, setIndexStatus] = React.useState("building");
|
|
363
|
+
React.useEffect(() => {
|
|
364
|
+
let alive = true;
|
|
365
|
+
const warm = jumpRef.current?.warmSearchIndex;
|
|
366
|
+
if (!warm) {
|
|
367
|
+
setIndexStatus(null);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
setIndexStatus("building");
|
|
371
|
+
warm().then((ms) => {
|
|
372
|
+
if (!alive)
|
|
373
|
+
return;
|
|
374
|
+
if (ms < 20) {
|
|
375
|
+
setIndexStatus(null);
|
|
376
|
+
} else {
|
|
377
|
+
setIndexStatus({
|
|
378
|
+
ms
|
|
379
|
+
});
|
|
380
|
+
setTimeout(() => alive && setIndexStatus(null), 2000);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
return () => {
|
|
384
|
+
alive = false;
|
|
385
|
+
};
|
|
386
|
+
}, []);
|
|
387
|
+
const warmDone = indexStatus !== "building";
|
|
388
|
+
useEffect(() => {
|
|
389
|
+
if (!warmDone)
|
|
390
|
+
return;
|
|
391
|
+
jumpRef.current?.setSearchQuery(query);
|
|
392
|
+
setHighlight(query);
|
|
393
|
+
}, [query, warmDone]);
|
|
394
|
+
const off = cursorOffset;
|
|
395
|
+
const cursorChar = off < query.length ? query[off] : " ";
|
|
396
|
+
return jsxDEV_7x81h0kn(Box, {
|
|
397
|
+
borderTopDimColor: true,
|
|
398
|
+
borderBottom: false,
|
|
399
|
+
borderLeft: false,
|
|
400
|
+
borderRight: false,
|
|
401
|
+
borderStyle: "single",
|
|
402
|
+
marginTop: 1,
|
|
403
|
+
paddingLeft: 2,
|
|
404
|
+
width: "100%",
|
|
405
|
+
noSelect: true,
|
|
406
|
+
children: [
|
|
407
|
+
jsxDEV_7x81h0kn(Text, {
|
|
408
|
+
children: "/"
|
|
409
|
+
}, undefined, false, undefined, this),
|
|
410
|
+
jsxDEV_7x81h0kn(Text, {
|
|
411
|
+
children: query.slice(0, off)
|
|
412
|
+
}, undefined, false, undefined, this),
|
|
413
|
+
jsxDEV_7x81h0kn(Text, {
|
|
414
|
+
inverse: true,
|
|
415
|
+
children: cursorChar
|
|
416
|
+
}, undefined, false, undefined, this),
|
|
417
|
+
off < query.length && jsxDEV_7x81h0kn(Text, {
|
|
418
|
+
children: query.slice(off + 1)
|
|
419
|
+
}, undefined, false, undefined, this),
|
|
420
|
+
jsxDEV_7x81h0kn(Box, {
|
|
421
|
+
flexGrow: 1
|
|
422
|
+
}, undefined, false, undefined, this),
|
|
423
|
+
indexStatus === "building" ? jsxDEV_7x81h0kn(Text, {
|
|
424
|
+
dimColor: true,
|
|
425
|
+
children: "indexing… "
|
|
426
|
+
}, undefined, false, undefined, this) : indexStatus ? jsxDEV_7x81h0kn(Text, {
|
|
427
|
+
dimColor: true,
|
|
428
|
+
children: [
|
|
429
|
+
"indexed in ",
|
|
430
|
+
indexStatus.ms,
|
|
431
|
+
"ms "
|
|
432
|
+
]
|
|
433
|
+
}, undefined, true, undefined, this) : count === 0 && query ? jsxDEV_7x81h0kn(Text, {
|
|
434
|
+
color: "error",
|
|
435
|
+
children: "no matches "
|
|
436
|
+
}, undefined, false, undefined, this) : count > 0 ? jsxDEV_7x81h0kn(Text, {
|
|
437
|
+
dimColor: true,
|
|
438
|
+
children: [
|
|
439
|
+
current,
|
|
440
|
+
"/",
|
|
441
|
+
count,
|
|
442
|
+
" "
|
|
443
|
+
]
|
|
444
|
+
}, undefined, true, undefined, this) : null
|
|
445
|
+
]
|
|
446
|
+
}, undefined, true, undefined, this);
|
|
447
|
+
}
|
|
448
|
+
const TITLE_ANIMATION_FRAMES = ["⠂", "⠐"];
|
|
449
|
+
const TITLE_STATIC_PREFIX = "✳";
|
|
450
|
+
const TITLE_ANIMATION_INTERVAL_MS = 960;
|
|
451
|
+
function AnimatedTerminalTitle(t0) {
|
|
452
|
+
const $ = _c(6);
|
|
453
|
+
const {
|
|
454
|
+
isAnimating,
|
|
455
|
+
title,
|
|
456
|
+
disabled,
|
|
457
|
+
noPrefix
|
|
458
|
+
} = t0;
|
|
459
|
+
const terminalFocused = useTerminalFocus();
|
|
460
|
+
const [frame, setFrame] = useState(0);
|
|
461
|
+
let t1;
|
|
462
|
+
let t2;
|
|
463
|
+
if ($[0] !== disabled || $[1] !== isAnimating || $[2] !== noPrefix || $[3] !== terminalFocused) {
|
|
464
|
+
t1 = () => {
|
|
465
|
+
if (disabled || noPrefix || !isAnimating || !terminalFocused) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const interval = setInterval(_temp2, TITLE_ANIMATION_INTERVAL_MS, setFrame);
|
|
469
|
+
return () => clearInterval(interval);
|
|
470
|
+
};
|
|
471
|
+
t2 = [disabled, noPrefix, isAnimating, terminalFocused];
|
|
472
|
+
$[0] = disabled;
|
|
473
|
+
$[1] = isAnimating;
|
|
474
|
+
$[2] = noPrefix;
|
|
475
|
+
$[3] = terminalFocused;
|
|
476
|
+
$[4] = t1;
|
|
477
|
+
$[5] = t2;
|
|
478
|
+
} else {
|
|
479
|
+
t1 = $[4];
|
|
480
|
+
t2 = $[5];
|
|
481
|
+
}
|
|
482
|
+
useEffect(t1, t2);
|
|
483
|
+
const prefix = isAnimating ? TITLE_ANIMATION_FRAMES[frame] ?? TITLE_STATIC_PREFIX : TITLE_STATIC_PREFIX;
|
|
484
|
+
useTerminalTitle(disabled ? null : noPrefix ? title : `${prefix} ${title}`);
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
function _temp2(setFrame_0) {
|
|
488
|
+
return setFrame_0(_temp);
|
|
489
|
+
}
|
|
490
|
+
function _temp(f) {
|
|
491
|
+
return (f + 1) % TITLE_ANIMATION_FRAMES.length;
|
|
492
|
+
}
|
|
493
|
+
export function REPL({
|
|
494
|
+
commands: initialCommands,
|
|
495
|
+
debug,
|
|
496
|
+
initialTools,
|
|
497
|
+
initialMessages,
|
|
498
|
+
pendingHookMessages,
|
|
499
|
+
initialFileHistorySnapshots,
|
|
500
|
+
initialContentReplacements,
|
|
501
|
+
initialAgentName,
|
|
502
|
+
initialAgentColor,
|
|
503
|
+
mcpClients: initialMcpClients,
|
|
504
|
+
dynamicMcpConfig: initialDynamicMcpConfig,
|
|
505
|
+
autoConnectIdeFlag,
|
|
506
|
+
strictMcpConfig = false,
|
|
507
|
+
systemPrompt: customSystemPrompt,
|
|
508
|
+
appendSystemPrompt,
|
|
509
|
+
onBeforeQuery,
|
|
510
|
+
onTurnComplete,
|
|
511
|
+
disabled = false,
|
|
512
|
+
mainThreadAgentDefinition: initialMainThreadAgentDefinition,
|
|
513
|
+
disableSlashCommands = false,
|
|
514
|
+
taskListId,
|
|
515
|
+
remoteSessionConfig,
|
|
516
|
+
directConnectConfig,
|
|
517
|
+
sshSession,
|
|
518
|
+
thinkingConfig
|
|
519
|
+
}) {
|
|
520
|
+
const isRemoteSession = !!remoteSessionConfig;
|
|
521
|
+
const titleDisabled = useMemo(() => isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE), []);
|
|
522
|
+
const moreRightEnabled = useMemo(() => false, []);
|
|
523
|
+
const disableVirtualScroll = useMemo(() => isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL), []);
|
|
524
|
+
const disableMessageActions = false;
|
|
525
|
+
useEffect(() => {
|
|
526
|
+
logForDebugging(`[REPL:mount] REPL mounted, disabled=${disabled}`);
|
|
527
|
+
return () => logForDebugging(`[REPL:unmount] REPL unmounting`);
|
|
528
|
+
}, [disabled]);
|
|
529
|
+
const [mainThreadAgentDefinition, setMainThreadAgentDefinition] = useState(initialMainThreadAgentDefinition);
|
|
530
|
+
const toolPermissionContext = useAppState((s) => s.toolPermissionContext);
|
|
531
|
+
const verbose = useAppState((s) => s.verbose);
|
|
532
|
+
const mcp = useAppState((s) => s.mcp);
|
|
533
|
+
const plugins = useAppState((s) => s.plugins);
|
|
534
|
+
const agentDefinitions = useAppState((s) => s.agentDefinitions);
|
|
535
|
+
const fileHistory = useAppState((s) => s.fileHistory);
|
|
536
|
+
const initialMessage = useAppState((s) => s.initialMessage);
|
|
537
|
+
const queuedCommands = useCommandQueue();
|
|
538
|
+
const spinnerTip = useAppState((s) => s.spinnerTip);
|
|
539
|
+
const showExpandedTodos = useAppState((s) => s.expandedView) === "tasks";
|
|
540
|
+
const pendingWorkerRequest = useAppState((s) => s.pendingWorkerRequest);
|
|
541
|
+
const pendingSandboxRequest = useAppState((s) => s.pendingSandboxRequest);
|
|
542
|
+
const teamContext = useAppState((s) => s.teamContext);
|
|
543
|
+
const tasks = useAppState((s) => s.tasks);
|
|
544
|
+
const workerSandboxPermissions = useAppState((s) => s.workerSandboxPermissions);
|
|
545
|
+
const elicitation = useAppState((s) => s.elicitation);
|
|
546
|
+
const ultraplanPendingChoice = useAppState((s) => s.ultraplanPendingChoice);
|
|
547
|
+
const ultraplanLaunchPending = useAppState((s) => s.ultraplanLaunchPending);
|
|
548
|
+
const viewingAgentTaskId = useAppState((s) => s.viewingAgentTaskId);
|
|
549
|
+
const setAppState = useSetAppState();
|
|
550
|
+
const viewedLocalAgent = viewingAgentTaskId ? tasks[viewingAgentTaskId] : undefined;
|
|
551
|
+
const needsBootstrap = isLocalAgentTask(viewedLocalAgent) && viewedLocalAgent.retain && !viewedLocalAgent.diskLoaded;
|
|
552
|
+
useEffect(() => {
|
|
553
|
+
if (!viewingAgentTaskId || !needsBootstrap)
|
|
554
|
+
return;
|
|
555
|
+
const taskId = viewingAgentTaskId;
|
|
556
|
+
getAgentTranscript(asAgentId(taskId)).then((result) => {
|
|
557
|
+
setAppState((prev) => {
|
|
558
|
+
const t = prev.tasks[taskId];
|
|
559
|
+
if (!isLocalAgentTask(t) || t.diskLoaded || !t.retain)
|
|
560
|
+
return prev;
|
|
561
|
+
const live = t.messages ?? [];
|
|
562
|
+
const liveUuids = new Set(live.map((m) => m.uuid));
|
|
563
|
+
const diskOnly = result ? result.messages.filter((m) => !liveUuids.has(m.uuid)) : [];
|
|
564
|
+
return {
|
|
565
|
+
...prev,
|
|
566
|
+
tasks: {
|
|
567
|
+
...prev.tasks,
|
|
568
|
+
[taskId]: {
|
|
569
|
+
...t,
|
|
570
|
+
messages: [...diskOnly, ...live],
|
|
571
|
+
diskLoaded: true
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
}, [viewingAgentTaskId, needsBootstrap, setAppState]);
|
|
578
|
+
const store = useAppStateStore();
|
|
579
|
+
const terminal = useTerminalNotification();
|
|
580
|
+
const mainLoopModel = useMainLoopModel();
|
|
581
|
+
const [localCommands, setLocalCommands] = useState(initialCommands);
|
|
582
|
+
useSkillsChange(isRemoteSession ? undefined : getProjectRoot(), setLocalCommands);
|
|
583
|
+
const proactiveActive = React.useSyncExternalStore(proactiveModule?.subscribeToProactiveChanges ?? PROACTIVE_NO_OP_SUBSCRIBE, proactiveModule?.isProactiveActive ?? PROACTIVE_FALSE);
|
|
584
|
+
const isBriefOnly = useAppState((s) => s.isBriefOnly);
|
|
585
|
+
const localTools = useMemo(() => getTools(toolPermissionContext), [toolPermissionContext, proactiveActive, isBriefOnly]);
|
|
586
|
+
useKickOffCheckAndDisableBypassPermissionsIfNeeded();
|
|
587
|
+
useKickOffCheckAndDisableAutoModeIfNeeded();
|
|
588
|
+
const [dynamicMcpConfig, setDynamicMcpConfig] = useState(initialDynamicMcpConfig);
|
|
589
|
+
const onChangeDynamicMcpConfig = useCallback((config) => {
|
|
590
|
+
setDynamicMcpConfig(config);
|
|
591
|
+
}, [setDynamicMcpConfig]);
|
|
592
|
+
const [screen, setScreen] = useState("prompt");
|
|
593
|
+
const [showAllInTranscript, setShowAllInTranscript] = useState(false);
|
|
594
|
+
const [dumpMode, setDumpMode] = useState(false);
|
|
595
|
+
const [editorStatus, setEditorStatus] = useState("");
|
|
596
|
+
const editorGenRef = useRef(0);
|
|
597
|
+
const editorTimerRef = useRef(undefined);
|
|
598
|
+
const editorRenderingRef = useRef(false);
|
|
599
|
+
const {
|
|
600
|
+
addNotification,
|
|
601
|
+
removeNotification
|
|
602
|
+
} = useNotifications();
|
|
603
|
+
let trySuggestBgPRIntercept = SUGGEST_BG_PR_NOOP;
|
|
604
|
+
const mcpClients = useMergedClients(initialMcpClients, mcp.clients);
|
|
605
|
+
const [ideSelection, setIDESelection] = useState(undefined);
|
|
606
|
+
const [ideToInstallExtension, setIDEToInstallExtension] = useState(null);
|
|
607
|
+
const [ideInstallationStatus, setIDEInstallationStatus] = useState(null);
|
|
608
|
+
const [showIdeOnboarding, setShowIdeOnboarding] = useState(false);
|
|
609
|
+
const [showModelSwitchCallout, setShowModelSwitchCallout] = useState(() => {
|
|
610
|
+
if (false) {}
|
|
611
|
+
return false;
|
|
612
|
+
});
|
|
613
|
+
const [showEffortCallout, setShowEffortCallout] = useState(() => shouldShowEffortCallout(mainLoopModel));
|
|
614
|
+
const showRemoteCallout = useAppState((s) => s.showRemoteCallout);
|
|
615
|
+
const [showDesktopUpsellStartup, setShowDesktopUpsellStartup] = useState(() => shouldShowDesktopUpsellStartup());
|
|
616
|
+
useModelMigrationNotifications();
|
|
617
|
+
useCanSwitchToExistingSubscription();
|
|
618
|
+
useIDEStatusIndicator({
|
|
619
|
+
ideSelection,
|
|
620
|
+
mcpClients,
|
|
621
|
+
ideInstallationStatus
|
|
622
|
+
});
|
|
623
|
+
useMcpConnectivityStatus({
|
|
624
|
+
mcpClients
|
|
625
|
+
});
|
|
626
|
+
useAutoModeUnavailableNotification();
|
|
627
|
+
usePluginInstallationStatus();
|
|
628
|
+
usePluginAutoupdateNotification();
|
|
629
|
+
useSettingsErrors();
|
|
630
|
+
useRateLimitWarningNotification(mainLoopModel);
|
|
631
|
+
useFastModeNotification();
|
|
632
|
+
useDeprecationWarningNotification(mainLoopModel);
|
|
633
|
+
useNpmDeprecationNotification();
|
|
634
|
+
useAntOrgWarningNotification();
|
|
635
|
+
useInstallMessages();
|
|
636
|
+
useChromeExtensionNotification();
|
|
637
|
+
useOfficialMarketplaceNotification();
|
|
638
|
+
useLspInitializationNotification();
|
|
639
|
+
useTeammateLifecycleNotification();
|
|
640
|
+
const {
|
|
641
|
+
recommendation: lspRecommendation,
|
|
642
|
+
handleResponse: handleLspResponse
|
|
643
|
+
} = useLspPluginRecommendation();
|
|
644
|
+
const {
|
|
645
|
+
recommendation: hintRecommendation,
|
|
646
|
+
handleResponse: handleHintResponse
|
|
647
|
+
} = useClaudeCodeHintRecommendation();
|
|
648
|
+
const combinedInitialTools = useMemo(() => {
|
|
649
|
+
return [...localTools, ...initialTools];
|
|
650
|
+
}, [localTools, initialTools]);
|
|
651
|
+
useManagePlugins({
|
|
652
|
+
enabled: !isRemoteSession
|
|
653
|
+
});
|
|
654
|
+
const tasksV2 = useTasksV2WithCollapseEffect();
|
|
655
|
+
useEffect(() => {
|
|
656
|
+
if (isRemoteSession)
|
|
657
|
+
return;
|
|
658
|
+
performStartupChecks(setAppState);
|
|
659
|
+
}, [setAppState, isRemoteSession]);
|
|
660
|
+
usePromptsFromClaudeInChrome(isRemoteSession ? EMPTY_MCP_CLIENTS : mcpClients, toolPermissionContext.mode);
|
|
661
|
+
useSwarmInitialization(setAppState, initialMessages, {
|
|
662
|
+
enabled: !isRemoteSession
|
|
663
|
+
});
|
|
664
|
+
const mergedTools = useMergedTools(combinedInitialTools, mcp.tools, toolPermissionContext);
|
|
665
|
+
const {
|
|
666
|
+
tools,
|
|
667
|
+
allowedAgentTypes
|
|
668
|
+
} = useMemo(() => {
|
|
669
|
+
if (!mainThreadAgentDefinition) {
|
|
670
|
+
return {
|
|
671
|
+
tools: mergedTools,
|
|
672
|
+
allowedAgentTypes: undefined
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
const resolved = resolveAgentTools(mainThreadAgentDefinition, mergedTools, false, true);
|
|
676
|
+
return {
|
|
677
|
+
tools: resolved.resolvedTools,
|
|
678
|
+
allowedAgentTypes: resolved.allowedAgentTypes
|
|
679
|
+
};
|
|
680
|
+
}, [mainThreadAgentDefinition, mergedTools]);
|
|
681
|
+
const commandsWithPlugins = useMergedCommands(localCommands, plugins.commands);
|
|
682
|
+
const mergedCommands = useMergedCommands(commandsWithPlugins, mcp.commands);
|
|
683
|
+
const commands = useMemo(() => disableSlashCommands ? [] : mergedCommands, [disableSlashCommands, mergedCommands]);
|
|
684
|
+
useIdeLogging(isRemoteSession ? EMPTY_MCP_CLIENTS : mcp.clients);
|
|
685
|
+
useIdeSelection(isRemoteSession ? EMPTY_MCP_CLIENTS : mcp.clients, setIDESelection);
|
|
686
|
+
const [streamMode, setStreamMode] = useState("responding");
|
|
687
|
+
const streamModeRef = useRef(streamMode);
|
|
688
|
+
streamModeRef.current = streamMode;
|
|
689
|
+
const [streamingToolUses, setStreamingToolUses] = useState([]);
|
|
690
|
+
const [streamingThinking, setStreamingThinking] = useState(null);
|
|
691
|
+
useEffect(() => {
|
|
692
|
+
if (streamingThinking && !streamingThinking.isStreaming && streamingThinking.streamingEndedAt) {
|
|
693
|
+
const elapsed = Date.now() - streamingThinking.streamingEndedAt;
|
|
694
|
+
const remaining = 30000 - elapsed;
|
|
695
|
+
if (remaining > 0) {
|
|
696
|
+
const timer = setTimeout(setStreamingThinking, remaining, null);
|
|
697
|
+
return () => clearTimeout(timer);
|
|
698
|
+
} else {
|
|
699
|
+
setStreamingThinking(null);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}, [streamingThinking]);
|
|
703
|
+
const [abortController, setAbortController] = useState(null);
|
|
704
|
+
const abortControllerRef = useRef(null);
|
|
705
|
+
abortControllerRef.current = abortController;
|
|
706
|
+
const sendBridgeResultRef = useRef(() => {});
|
|
707
|
+
const restoreMessageSyncRef = useRef(() => {});
|
|
708
|
+
const scrollRef = useRef(null);
|
|
709
|
+
const modalScrollRef = useRef(null);
|
|
710
|
+
const lastUserScrollTsRef = useRef(0);
|
|
711
|
+
const queryGuard = React.useRef(new QueryGuard).current;
|
|
712
|
+
const isQueryActive = React.useSyncExternalStore(queryGuard.subscribe, queryGuard.getSnapshot);
|
|
713
|
+
const [isExternalLoading, setIsExternalLoadingRaw] = React.useState(remoteSessionConfig?.hasInitialPrompt ?? false);
|
|
714
|
+
const isLoading = isQueryActive || isExternalLoading;
|
|
715
|
+
const [userInputOnProcessing, setUserInputOnProcessingRaw] = React.useState(undefined);
|
|
716
|
+
const userInputBaselineRef = React.useRef(0);
|
|
717
|
+
const userMessagePendingRef = React.useRef(false);
|
|
718
|
+
const loadingStartTimeRef = React.useRef(0);
|
|
719
|
+
const totalPausedMsRef = React.useRef(0);
|
|
720
|
+
const pauseStartTimeRef = React.useRef(null);
|
|
721
|
+
const resetTimingRefs = React.useCallback(() => {
|
|
722
|
+
loadingStartTimeRef.current = Date.now();
|
|
723
|
+
totalPausedMsRef.current = 0;
|
|
724
|
+
pauseStartTimeRef.current = null;
|
|
725
|
+
}, []);
|
|
726
|
+
const wasQueryActiveRef = React.useRef(false);
|
|
727
|
+
if (isQueryActive && !wasQueryActiveRef.current) {
|
|
728
|
+
resetTimingRefs();
|
|
729
|
+
}
|
|
730
|
+
wasQueryActiveRef.current = isQueryActive;
|
|
731
|
+
const setIsExternalLoading = React.useCallback((value) => {
|
|
732
|
+
setIsExternalLoadingRaw(value);
|
|
733
|
+
if (value)
|
|
734
|
+
resetTimingRefs();
|
|
735
|
+
}, [resetTimingRefs]);
|
|
736
|
+
const swarmStartTimeRef = React.useRef(null);
|
|
737
|
+
const swarmBudgetInfoRef = React.useRef(undefined);
|
|
738
|
+
const focusedInputDialogRef = React.useRef(undefined);
|
|
739
|
+
const PROMPT_SUPPRESSION_MS = 1500;
|
|
740
|
+
const [isPromptInputActive, setIsPromptInputActive] = React.useState(false);
|
|
741
|
+
const [autoUpdaterResult, setAutoUpdaterResult] = useState(null);
|
|
742
|
+
useEffect(() => {
|
|
743
|
+
if (autoUpdaterResult?.notifications) {
|
|
744
|
+
autoUpdaterResult.notifications.forEach((notification) => {
|
|
745
|
+
addNotification({
|
|
746
|
+
key: "auto-updater-notification",
|
|
747
|
+
text: notification,
|
|
748
|
+
priority: "low"
|
|
749
|
+
});
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
}, [autoUpdaterResult, addNotification]);
|
|
753
|
+
useEffect(() => {
|
|
754
|
+
if (isFullscreenEnvEnabled()) {
|
|
755
|
+
maybeGetTmuxMouseHint().then((hint) => {
|
|
756
|
+
if (hint) {
|
|
757
|
+
addNotification({
|
|
758
|
+
key: "tmux-mouse-hint",
|
|
759
|
+
text: hint,
|
|
760
|
+
priority: "low"
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
}, []);
|
|
766
|
+
const [showUndercoverCallout, setShowUndercoverCallout] = useState(false);
|
|
767
|
+
useEffect(() => {
|
|
768
|
+
if (false) {}
|
|
769
|
+
}, []);
|
|
770
|
+
const [toolJSX, setToolJSXInternal] = useState(null);
|
|
771
|
+
const localJSXCommandRef = useRef(null);
|
|
772
|
+
const setToolJSX = useCallback((args) => {
|
|
773
|
+
if (args?.isLocalJSXCommand) {
|
|
774
|
+
const {
|
|
775
|
+
clearLocalJSX: _,
|
|
776
|
+
...rest
|
|
777
|
+
} = args;
|
|
778
|
+
localJSXCommandRef.current = {
|
|
779
|
+
...rest,
|
|
780
|
+
isLocalJSXCommand: true
|
|
781
|
+
};
|
|
782
|
+
setToolJSXInternal(rest);
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
if (localJSXCommandRef.current) {
|
|
786
|
+
if (args?.clearLocalJSX) {
|
|
787
|
+
localJSXCommandRef.current = null;
|
|
788
|
+
setToolJSXInternal(null);
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
if (args?.clearLocalJSX) {
|
|
794
|
+
setToolJSXInternal(null);
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
setToolJSXInternal(args);
|
|
798
|
+
}, []);
|
|
799
|
+
const [toolUseConfirmQueue, setToolUseConfirmQueue] = useState([]);
|
|
800
|
+
const [permissionStickyFooter, setPermissionStickyFooter] = useState(null);
|
|
801
|
+
const [sandboxPermissionRequestQueue, setSandboxPermissionRequestQueue] = useState([]);
|
|
802
|
+
const [promptQueue, setPromptQueue] = useState([]);
|
|
803
|
+
const sandboxBridgeCleanupRef = useRef(new Map);
|
|
804
|
+
const terminalTitleFromRename = useAppState((s) => s.settings.terminalTitleFromRename) !== false;
|
|
805
|
+
const sessionTitle = terminalTitleFromRename ? getCurrentSessionTitle(getSessionId()) : undefined;
|
|
806
|
+
const [haikuTitle, setHaikuTitle] = useState();
|
|
807
|
+
const haikuTitleAttemptedRef = useRef((initialMessages?.length ?? 0) > 0);
|
|
808
|
+
const agentTitle = mainThreadAgentDefinition?.agentType;
|
|
809
|
+
const terminalTitle = sessionTitle ?? agentTitle ?? haikuTitle ?? "Claude Code";
|
|
810
|
+
const isWaitingForApproval = toolUseConfirmQueue.length > 0 || promptQueue.length > 0 || pendingWorkerRequest || pendingSandboxRequest;
|
|
811
|
+
const isShowingLocalJSXCommand = toolJSX?.isLocalJSXCommand === true && toolJSX?.jsx != null;
|
|
812
|
+
const titleIsAnimating = isLoading && !isWaitingForApproval && !isShowingLocalJSXCommand;
|
|
813
|
+
useEffect(() => {
|
|
814
|
+
if (isLoading && !isWaitingForApproval && !isShowingLocalJSXCommand) {
|
|
815
|
+
startPreventSleep();
|
|
816
|
+
return () => stopPreventSleep();
|
|
817
|
+
}
|
|
818
|
+
}, [isLoading, isWaitingForApproval, isShowingLocalJSXCommand]);
|
|
819
|
+
const sessionStatus = isWaitingForApproval || isShowingLocalJSXCommand ? "waiting" : isLoading ? "busy" : "idle";
|
|
820
|
+
const waitingFor = sessionStatus !== "waiting" ? undefined : toolUseConfirmQueue.length > 0 ? `approve ${toolUseConfirmQueue[0].tool.name}` : pendingWorkerRequest ? "worker request" : pendingSandboxRequest ? "sandbox request" : isShowingLocalJSXCommand ? "dialog open" : "input needed";
|
|
821
|
+
useEffect(() => {
|
|
822
|
+
if (false) {}
|
|
823
|
+
}, [sessionStatus, waitingFor]);
|
|
824
|
+
const tabStatusGateEnabled = getFeatureValue_CACHED_MAY_BE_STALE("tengu_terminal_sidebar", false);
|
|
825
|
+
const showStatusInTerminalTab = tabStatusGateEnabled && (getGlobalConfig().showStatusInTerminalTab ?? false);
|
|
826
|
+
useTabStatus(titleDisabled || !showStatusInTerminalTab ? null : sessionStatus);
|
|
827
|
+
useEffect(() => {
|
|
828
|
+
registerLeaderToolUseConfirmQueue(setToolUseConfirmQueue);
|
|
829
|
+
return () => unregisterLeaderToolUseConfirmQueue();
|
|
830
|
+
}, [setToolUseConfirmQueue]);
|
|
831
|
+
const [messages, rawSetMessages] = useState(initialMessages ?? []);
|
|
832
|
+
const messagesRef = useRef(messages);
|
|
833
|
+
const idleHintShownRef = useRef(false);
|
|
834
|
+
const setMessages = useCallback((action) => {
|
|
835
|
+
const prev = messagesRef.current;
|
|
836
|
+
const next = typeof action === "function" ? action(messagesRef.current) : action;
|
|
837
|
+
messagesRef.current = next;
|
|
838
|
+
if (next.length < userInputBaselineRef.current) {
|
|
839
|
+
userInputBaselineRef.current = 0;
|
|
840
|
+
} else if (next.length > prev.length && userMessagePendingRef.current) {
|
|
841
|
+
const delta = next.length - prev.length;
|
|
842
|
+
const added = prev.length === 0 || next[0] === prev[0] ? next.slice(-delta) : next.slice(0, delta);
|
|
843
|
+
if (added.some(isHumanTurn)) {
|
|
844
|
+
userMessagePendingRef.current = false;
|
|
845
|
+
} else {
|
|
846
|
+
userInputBaselineRef.current = next.length;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
rawSetMessages(next);
|
|
850
|
+
}, []);
|
|
851
|
+
const setUserInputOnProcessing = useCallback((input) => {
|
|
852
|
+
if (input !== undefined) {
|
|
853
|
+
userInputBaselineRef.current = messagesRef.current.length;
|
|
854
|
+
userMessagePendingRef.current = true;
|
|
855
|
+
} else {
|
|
856
|
+
userMessagePendingRef.current = false;
|
|
857
|
+
}
|
|
858
|
+
setUserInputOnProcessingRaw(input);
|
|
859
|
+
}, []);
|
|
860
|
+
const {
|
|
861
|
+
dividerIndex,
|
|
862
|
+
dividerYRef,
|
|
863
|
+
onScrollAway,
|
|
864
|
+
onRepin,
|
|
865
|
+
jumpToNew,
|
|
866
|
+
shiftDivider
|
|
867
|
+
} = useUnseenDivider(messages.length);
|
|
868
|
+
if (false) {}
|
|
869
|
+
const [cursor, setCursor] = useState(null);
|
|
870
|
+
const cursorNavRef = useRef(null);
|
|
871
|
+
const unseenDivider = useMemo(() => computeUnseenDivider(messages, dividerIndex), [dividerIndex, messages.length]);
|
|
872
|
+
const repinScroll = useCallback(() => {
|
|
873
|
+
scrollRef.current?.scrollToBottom();
|
|
874
|
+
onRepin();
|
|
875
|
+
setCursor(null);
|
|
876
|
+
}, [onRepin, setCursor]);
|
|
877
|
+
const lastMsg = messages.at(-1);
|
|
878
|
+
const lastMsgIsHuman = lastMsg != null && isHumanTurn(lastMsg);
|
|
879
|
+
useEffect(() => {
|
|
880
|
+
if (lastMsgIsHuman) {
|
|
881
|
+
repinScroll();
|
|
882
|
+
}
|
|
883
|
+
}, [lastMsgIsHuman, lastMsg, repinScroll]);
|
|
884
|
+
const {
|
|
885
|
+
maybeLoadOlder
|
|
886
|
+
} = HISTORY_STUB;
|
|
887
|
+
const composedOnScroll = useCallback((sticky, handle) => {
|
|
888
|
+
lastUserScrollTsRef.current = Date.now();
|
|
889
|
+
if (sticky) {
|
|
890
|
+
onRepin();
|
|
891
|
+
} else {
|
|
892
|
+
onScrollAway(handle);
|
|
893
|
+
if (false)
|
|
894
|
+
;
|
|
895
|
+
if (false) {}
|
|
896
|
+
}
|
|
897
|
+
}, [onRepin, onScrollAway, maybeLoadOlder, setAppState]);
|
|
898
|
+
const awaitPendingHooks = useDeferredHookMessages(pendingHookMessages, setMessages);
|
|
899
|
+
const deferredMessages = useDeferredValue(messages);
|
|
900
|
+
const deferredBehind = messages.length - deferredMessages.length;
|
|
901
|
+
if (deferredBehind > 0) {
|
|
902
|
+
logForDebugging(`[useDeferredValue] Messages deferred by ${deferredBehind} (${deferredMessages.length}→${messages.length})`);
|
|
903
|
+
}
|
|
904
|
+
const [frozenTranscriptState, setFrozenTranscriptState] = useState(null);
|
|
905
|
+
const [inputValue, setInputValueRaw] = useState(() => consumeEarlyInput());
|
|
906
|
+
const inputValueRef = useRef(inputValue);
|
|
907
|
+
inputValueRef.current = inputValue;
|
|
908
|
+
const insertTextRef = useRef(null);
|
|
909
|
+
const setInputValue = useCallback((value) => {
|
|
910
|
+
if (trySuggestBgPRIntercept(inputValueRef.current, value))
|
|
911
|
+
return;
|
|
912
|
+
if (inputValueRef.current === "" && value !== "" && Date.now() - lastUserScrollTsRef.current >= RECENT_SCROLL_REPIN_WINDOW_MS) {
|
|
913
|
+
repinScroll();
|
|
914
|
+
}
|
|
915
|
+
inputValueRef.current = value;
|
|
916
|
+
setInputValueRaw(value);
|
|
917
|
+
setIsPromptInputActive(value.trim().length > 0);
|
|
918
|
+
}, [setIsPromptInputActive, repinScroll, trySuggestBgPRIntercept]);
|
|
919
|
+
useEffect(() => {
|
|
920
|
+
if (inputValue.trim().length === 0)
|
|
921
|
+
return;
|
|
922
|
+
const timer = setTimeout(setIsPromptInputActive, PROMPT_SUPPRESSION_MS, false);
|
|
923
|
+
return () => clearTimeout(timer);
|
|
924
|
+
}, [inputValue]);
|
|
925
|
+
const [inputMode, setInputMode] = useState("prompt");
|
|
926
|
+
const [stashedPrompt, setStashedPrompt] = useState();
|
|
927
|
+
const handleRemoteInit = useCallback((remoteSlashCommands) => {
|
|
928
|
+
const remoteCommandSet = new Set(remoteSlashCommands);
|
|
929
|
+
setLocalCommands((prev) => prev.filter((cmd) => remoteCommandSet.has(cmd.name) || REMOTE_SAFE_COMMANDS.has(cmd)));
|
|
930
|
+
}, [setLocalCommands]);
|
|
931
|
+
const [inProgressToolUseIDs, setInProgressToolUseIDs] = useState(new Set);
|
|
932
|
+
const hasInterruptibleToolInProgressRef = useRef(false);
|
|
933
|
+
const remoteSession = useRemoteSession({
|
|
934
|
+
config: remoteSessionConfig,
|
|
935
|
+
setMessages,
|
|
936
|
+
setIsLoading: setIsExternalLoading,
|
|
937
|
+
onInit: handleRemoteInit,
|
|
938
|
+
setToolUseConfirmQueue,
|
|
939
|
+
tools: combinedInitialTools,
|
|
940
|
+
setStreamingToolUses,
|
|
941
|
+
setStreamMode,
|
|
942
|
+
setInProgressToolUseIDs
|
|
943
|
+
});
|
|
944
|
+
const directConnect = useDirectConnect({
|
|
945
|
+
config: directConnectConfig,
|
|
946
|
+
setMessages,
|
|
947
|
+
setIsLoading: setIsExternalLoading,
|
|
948
|
+
setToolUseConfirmQueue,
|
|
949
|
+
tools: combinedInitialTools
|
|
950
|
+
});
|
|
951
|
+
const sshRemote = useSSHSession({
|
|
952
|
+
session: sshSession,
|
|
953
|
+
setMessages,
|
|
954
|
+
setIsLoading: setIsExternalLoading,
|
|
955
|
+
setToolUseConfirmQueue,
|
|
956
|
+
tools: combinedInitialTools
|
|
957
|
+
});
|
|
958
|
+
const activeRemote = sshRemote.isRemoteMode ? sshRemote : directConnect.isRemoteMode ? directConnect : remoteSession;
|
|
959
|
+
const [pastedContents, setPastedContents] = useState({});
|
|
960
|
+
const [submitCount, setSubmitCount] = useState(0);
|
|
961
|
+
const responseLengthRef = useRef(0);
|
|
962
|
+
const apiMetricsRef = useRef([]);
|
|
963
|
+
const setResponseLength = useCallback((f) => {
|
|
964
|
+
const prev = responseLengthRef.current;
|
|
965
|
+
responseLengthRef.current = f(prev);
|
|
966
|
+
if (responseLengthRef.current > prev) {
|
|
967
|
+
const entries = apiMetricsRef.current;
|
|
968
|
+
if (entries.length > 0) {
|
|
969
|
+
const lastEntry = entries.at(-1);
|
|
970
|
+
lastEntry.lastTokenTime = Date.now();
|
|
971
|
+
lastEntry.endResponseLength = responseLengthRef.current;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}, []);
|
|
975
|
+
const [streamingText, setStreamingText] = useState(null);
|
|
976
|
+
const reducedMotion = useAppState((s) => s.settings.prefersReducedMotion) ?? false;
|
|
977
|
+
const showStreamingText = !reducedMotion && !hasCursorUpViewportYankBug();
|
|
978
|
+
const onStreamingText = useCallback((f) => {
|
|
979
|
+
if (!showStreamingText)
|
|
980
|
+
return;
|
|
981
|
+
setStreamingText(f);
|
|
982
|
+
}, [showStreamingText]);
|
|
983
|
+
const visibleStreamingText = streamingText && showStreamingText ? streamingText.substring(0, streamingText.lastIndexOf(`
|
|
984
|
+
`) + 1) || null : null;
|
|
985
|
+
const [lastQueryCompletionTime, setLastQueryCompletionTime] = useState(0);
|
|
986
|
+
const [spinnerMessage, setSpinnerMessage] = useState(null);
|
|
987
|
+
const [spinnerColor, setSpinnerColor] = useState(null);
|
|
988
|
+
const [spinnerShimmerColor, setSpinnerShimmerColor] = useState(null);
|
|
989
|
+
const [isMessageSelectorVisible, setIsMessageSelectorVisible] = useState(false);
|
|
990
|
+
const [messageSelectorPreselect, setMessageSelectorPreselect] = useState(undefined);
|
|
991
|
+
const [showCostDialog, setShowCostDialog] = useState(false);
|
|
992
|
+
const [conversationId, setConversationId] = useState(randomUUID());
|
|
993
|
+
const [idleReturnPending, setIdleReturnPending] = useState(null);
|
|
994
|
+
const skipIdleCheckRef = useRef(false);
|
|
995
|
+
const lastQueryCompletionTimeRef = useRef(lastQueryCompletionTime);
|
|
996
|
+
lastQueryCompletionTimeRef.current = lastQueryCompletionTime;
|
|
997
|
+
const [contentReplacementStateRef] = useState(() => ({
|
|
998
|
+
current: provisionContentReplacementState(initialMessages, initialContentReplacements)
|
|
999
|
+
}));
|
|
1000
|
+
const [haveShownCostDialog, setHaveShownCostDialog] = useState(getGlobalConfig().hasAcknowledgedCostThreshold);
|
|
1001
|
+
const [vimMode, setVimMode] = useState("INSERT");
|
|
1002
|
+
const [showBashesDialog, setShowBashesDialog] = useState(false);
|
|
1003
|
+
const [isSearchingHistory, setIsSearchingHistory] = useState(false);
|
|
1004
|
+
const [isHelpOpen, setIsHelpOpen] = useState(false);
|
|
1005
|
+
useEffect(() => {
|
|
1006
|
+
if (ultraplanPendingChoice && showBashesDialog) {
|
|
1007
|
+
setShowBashesDialog(false);
|
|
1008
|
+
}
|
|
1009
|
+
}, [ultraplanPendingChoice, showBashesDialog]);
|
|
1010
|
+
const isTerminalFocused = useTerminalFocus();
|
|
1011
|
+
const terminalFocusRef = useRef(isTerminalFocused);
|
|
1012
|
+
terminalFocusRef.current = isTerminalFocused;
|
|
1013
|
+
const [theme] = useTheme();
|
|
1014
|
+
const tipPickedThisTurnRef = React.useRef(false);
|
|
1015
|
+
const pickNewSpinnerTip = useCallback(() => {
|
|
1016
|
+
if (tipPickedThisTurnRef.current)
|
|
1017
|
+
return;
|
|
1018
|
+
tipPickedThisTurnRef.current = true;
|
|
1019
|
+
const newMessages = messagesRef.current.slice(bashToolsProcessedIdx.current);
|
|
1020
|
+
for (const tool of extractBashToolsFromMessages(newMessages)) {
|
|
1021
|
+
bashTools.current.add(tool);
|
|
1022
|
+
}
|
|
1023
|
+
bashToolsProcessedIdx.current = messagesRef.current.length;
|
|
1024
|
+
getTipToShowOnSpinner({
|
|
1025
|
+
theme,
|
|
1026
|
+
readFileState: readFileState.current,
|
|
1027
|
+
bashTools: bashTools.current
|
|
1028
|
+
}).then(async (tip) => {
|
|
1029
|
+
if (tip) {
|
|
1030
|
+
const content = await tip.content({
|
|
1031
|
+
theme
|
|
1032
|
+
});
|
|
1033
|
+
setAppState((prev) => ({
|
|
1034
|
+
...prev,
|
|
1035
|
+
spinnerTip: content
|
|
1036
|
+
}));
|
|
1037
|
+
recordShownTip(tip);
|
|
1038
|
+
} else {
|
|
1039
|
+
setAppState((prev) => {
|
|
1040
|
+
if (prev.spinnerTip === undefined)
|
|
1041
|
+
return prev;
|
|
1042
|
+
return {
|
|
1043
|
+
...prev,
|
|
1044
|
+
spinnerTip: undefined
|
|
1045
|
+
};
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
}, [setAppState, theme]);
|
|
1050
|
+
const resetLoadingState = useCallback(() => {
|
|
1051
|
+
setIsExternalLoading(false);
|
|
1052
|
+
setUserInputOnProcessing(undefined);
|
|
1053
|
+
responseLengthRef.current = 0;
|
|
1054
|
+
apiMetricsRef.current = [];
|
|
1055
|
+
setStreamingText(null);
|
|
1056
|
+
setStreamingToolUses([]);
|
|
1057
|
+
setSpinnerMessage(null);
|
|
1058
|
+
setSpinnerColor(null);
|
|
1059
|
+
setSpinnerShimmerColor(null);
|
|
1060
|
+
pickNewSpinnerTip();
|
|
1061
|
+
endInteractionSpan();
|
|
1062
|
+
clearSpeculativeChecks();
|
|
1063
|
+
}, [pickNewSpinnerTip]);
|
|
1064
|
+
const hasRunningTeammates = useMemo(() => getAllInProcessTeammateTasks(tasks).some((t) => t.status === "running"), [tasks]);
|
|
1065
|
+
useEffect(() => {
|
|
1066
|
+
if (!hasRunningTeammates && swarmStartTimeRef.current !== null) {
|
|
1067
|
+
const totalMs = Date.now() - swarmStartTimeRef.current;
|
|
1068
|
+
const deferredBudget = swarmBudgetInfoRef.current;
|
|
1069
|
+
swarmStartTimeRef.current = null;
|
|
1070
|
+
swarmBudgetInfoRef.current = undefined;
|
|
1071
|
+
setMessages((prev) => [...prev, createTurnDurationMessage(totalMs, deferredBudget, count(prev, isLoggableMessage))]);
|
|
1072
|
+
}
|
|
1073
|
+
}, [hasRunningTeammates, setMessages]);
|
|
1074
|
+
const safeYoloMessageShownRef = useRef(false);
|
|
1075
|
+
useEffect(() => {
|
|
1076
|
+
if (false) {}
|
|
1077
|
+
}, [toolPermissionContext.mode, setMessages]);
|
|
1078
|
+
const worktreeTipShownRef = useRef(false);
|
|
1079
|
+
useEffect(() => {
|
|
1080
|
+
if (worktreeTipShownRef.current)
|
|
1081
|
+
return;
|
|
1082
|
+
const wt = getCurrentWorktreeSession();
|
|
1083
|
+
if (!wt?.creationDurationMs || wt.usedSparsePaths)
|
|
1084
|
+
return;
|
|
1085
|
+
if (wt.creationDurationMs < 15000)
|
|
1086
|
+
return;
|
|
1087
|
+
worktreeTipShownRef.current = true;
|
|
1088
|
+
const secs = Math.round(wt.creationDurationMs / 1000);
|
|
1089
|
+
setMessages((prev) => [...prev, createSystemMessage(`Worktree creation took ${secs}s. For large repos, set \`worktree.sparsePaths\` in .claude/settings.json to check out only the directories you need — e.g. \`{"worktree": {"sparsePaths": ["src", "packages/foo"]}}\`.`, "info")]);
|
|
1090
|
+
}, [setMessages]);
|
|
1091
|
+
const onlySleepToolActive = useMemo(() => {
|
|
1092
|
+
const lastAssistant = messages.findLast((m) => m.type === "assistant");
|
|
1093
|
+
if (lastAssistant?.type !== "assistant")
|
|
1094
|
+
return false;
|
|
1095
|
+
const inProgressToolUses = lastAssistant.message.content.filter((b) => b.type === "tool_use" && inProgressToolUseIDs.has(b.id));
|
|
1096
|
+
return inProgressToolUses.length > 0 && inProgressToolUses.every((b) => b.type === "tool_use" && b.name === SLEEP_TOOL_NAME);
|
|
1097
|
+
}, [messages, inProgressToolUseIDs]);
|
|
1098
|
+
const {
|
|
1099
|
+
onBeforeQuery: mrOnBeforeQuery,
|
|
1100
|
+
onTurnComplete: mrOnTurnComplete,
|
|
1101
|
+
render: mrRender
|
|
1102
|
+
} = useMoreRight({
|
|
1103
|
+
enabled: moreRightEnabled,
|
|
1104
|
+
setMessages,
|
|
1105
|
+
inputValue,
|
|
1106
|
+
setInputValue,
|
|
1107
|
+
setToolJSX
|
|
1108
|
+
});
|
|
1109
|
+
const showSpinner = (!toolJSX || toolJSX.showSpinner === true) && toolUseConfirmQueue.length === 0 && promptQueue.length === 0 && (isLoading || userInputOnProcessing || hasRunningTeammates || getCommandQueueLength() > 0) && !pendingWorkerRequest && !onlySleepToolActive && (!visibleStreamingText || isBriefOnly);
|
|
1110
|
+
const hasActivePrompt = toolUseConfirmQueue.length > 0 || promptQueue.length > 0 || sandboxPermissionRequestQueue.length > 0 || elicitation.queue.length > 0 || workerSandboxPermissions.queue.length > 0;
|
|
1111
|
+
const feedbackSurveyOriginal = useFeedbackSurvey(messages, isLoading, submitCount, "session", hasActivePrompt);
|
|
1112
|
+
const skillImprovementSurvey = useSkillImprovementSurvey(setMessages);
|
|
1113
|
+
const showIssueFlagBanner = useIssueFlagBanner(messages, submitCount);
|
|
1114
|
+
const feedbackSurvey = useMemo(() => ({
|
|
1115
|
+
...feedbackSurveyOriginal,
|
|
1116
|
+
handleSelect: (selected) => {
|
|
1117
|
+
didAutoRunIssueRef.current = false;
|
|
1118
|
+
const showedTranscriptPrompt = feedbackSurveyOriginal.handleSelect(selected);
|
|
1119
|
+
if (selected === "bad" && !showedTranscriptPrompt && shouldAutoRunIssue("feedback_survey_bad")) {
|
|
1120
|
+
setAutoRunIssueReason("feedback_survey_bad");
|
|
1121
|
+
didAutoRunIssueRef.current = true;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}), [feedbackSurveyOriginal]);
|
|
1125
|
+
const postCompactSurvey = usePostCompactSurvey(messages, isLoading, hasActivePrompt, {
|
|
1126
|
+
enabled: !isRemoteSession
|
|
1127
|
+
});
|
|
1128
|
+
const memorySurvey = useMemorySurvey(messages, isLoading, hasActivePrompt, {
|
|
1129
|
+
enabled: !isRemoteSession
|
|
1130
|
+
});
|
|
1131
|
+
const frustrationDetection = useFrustrationDetection(messages, isLoading, hasActivePrompt, feedbackSurvey.state !== "closed" || postCompactSurvey.state !== "closed" || memorySurvey.state !== "closed");
|
|
1132
|
+
useIDEIntegration({
|
|
1133
|
+
autoConnectIdeFlag,
|
|
1134
|
+
ideToInstallExtension,
|
|
1135
|
+
setDynamicMcpConfig,
|
|
1136
|
+
setShowIdeOnboarding,
|
|
1137
|
+
setIDEInstallationState: setIDEInstallationStatus
|
|
1138
|
+
});
|
|
1139
|
+
useFileHistorySnapshotInit(initialFileHistorySnapshots, fileHistory, (fileHistoryState) => setAppState((prev) => ({
|
|
1140
|
+
...prev,
|
|
1141
|
+
fileHistory: fileHistoryState
|
|
1142
|
+
})));
|
|
1143
|
+
const resume = useCallback(async (sessionId, log, entrypoint) => {
|
|
1144
|
+
const resumeStart = performance.now();
|
|
1145
|
+
try {
|
|
1146
|
+
const messages = deserializeMessages(log.messages);
|
|
1147
|
+
if (false) {}
|
|
1148
|
+
const sessionEndTimeoutMs = getSessionEndHookTimeoutMs();
|
|
1149
|
+
await executeSessionEndHooks("resume", {
|
|
1150
|
+
getAppState: () => store.getState(),
|
|
1151
|
+
setAppState,
|
|
1152
|
+
signal: AbortSignal.timeout(sessionEndTimeoutMs),
|
|
1153
|
+
timeoutMs: sessionEndTimeoutMs
|
|
1154
|
+
});
|
|
1155
|
+
const hookMessages = await processSessionStartHooks("resume", {
|
|
1156
|
+
sessionId,
|
|
1157
|
+
agentType: mainThreadAgentDefinition?.agentType,
|
|
1158
|
+
model: mainLoopModel
|
|
1159
|
+
});
|
|
1160
|
+
messages.push(...hookMessages);
|
|
1161
|
+
if (entrypoint === "fork") {
|
|
1162
|
+
copyPlanForFork(log, asSessionId(sessionId));
|
|
1163
|
+
} else {
|
|
1164
|
+
copyPlanForResume(log, asSessionId(sessionId));
|
|
1165
|
+
}
|
|
1166
|
+
restoreSessionStateFromLog(log, setAppState);
|
|
1167
|
+
if (log.fileHistorySnapshots) {
|
|
1168
|
+
copyFileHistoryForResume(log);
|
|
1169
|
+
}
|
|
1170
|
+
const {
|
|
1171
|
+
agentDefinition: restoredAgent
|
|
1172
|
+
} = restoreAgentFromSession(log.agentSetting, initialMainThreadAgentDefinition, agentDefinitions);
|
|
1173
|
+
setMainThreadAgentDefinition(restoredAgent);
|
|
1174
|
+
setAppState((prev) => ({
|
|
1175
|
+
...prev,
|
|
1176
|
+
agent: restoredAgent?.agentType
|
|
1177
|
+
}));
|
|
1178
|
+
setAppState((prev) => ({
|
|
1179
|
+
...prev,
|
|
1180
|
+
standaloneAgentContext: computeStandaloneAgentContext(log.agentName, log.agentColor)
|
|
1181
|
+
}));
|
|
1182
|
+
updateSessionName(log.agentName);
|
|
1183
|
+
restoreReadFileState(messages, log.projectPath ?? getOriginalCwd());
|
|
1184
|
+
resetLoadingState();
|
|
1185
|
+
setAbortController(null);
|
|
1186
|
+
setConversationId(sessionId);
|
|
1187
|
+
const targetSessionCosts = getStoredSessionCosts(sessionId);
|
|
1188
|
+
saveCurrentSessionCosts();
|
|
1189
|
+
resetCostState();
|
|
1190
|
+
switchSession(asSessionId(sessionId), log.fullPath ? dirname(log.fullPath) : null);
|
|
1191
|
+
const {
|
|
1192
|
+
renameRecordingForSession
|
|
1193
|
+
} = await import("../utils/asciicast.js");
|
|
1194
|
+
await renameRecordingForSession();
|
|
1195
|
+
await resetSessionFilePointer();
|
|
1196
|
+
clearSessionMetadata();
|
|
1197
|
+
restoreSessionMetadata(log);
|
|
1198
|
+
haikuTitleAttemptedRef.current = true;
|
|
1199
|
+
setHaikuTitle(undefined);
|
|
1200
|
+
if (entrypoint !== "fork") {
|
|
1201
|
+
exitRestoredWorktree();
|
|
1202
|
+
restoreWorktreeForResume(log.worktreeSession);
|
|
1203
|
+
adoptResumedSessionFile();
|
|
1204
|
+
restoreRemoteAgentTasks({
|
|
1205
|
+
abortController: new AbortController,
|
|
1206
|
+
getAppState: () => store.getState(),
|
|
1207
|
+
setAppState
|
|
1208
|
+
});
|
|
1209
|
+
} else {
|
|
1210
|
+
const ws = getCurrentWorktreeSession();
|
|
1211
|
+
if (ws)
|
|
1212
|
+
saveWorktreeState(ws);
|
|
1213
|
+
}
|
|
1214
|
+
if (false) {}
|
|
1215
|
+
if (targetSessionCosts) {
|
|
1216
|
+
setCostStateForRestore(targetSessionCosts);
|
|
1217
|
+
}
|
|
1218
|
+
if (contentReplacementStateRef.current && entrypoint !== "fork") {
|
|
1219
|
+
contentReplacementStateRef.current = reconstructContentReplacementState(messages, log.contentReplacements ?? []);
|
|
1220
|
+
}
|
|
1221
|
+
setMessages(() => messages);
|
|
1222
|
+
setToolJSX(null);
|
|
1223
|
+
setInputValue("");
|
|
1224
|
+
logEvent("tengu_session_resumed", {
|
|
1225
|
+
entrypoint,
|
|
1226
|
+
success: true,
|
|
1227
|
+
resume_duration_ms: Math.round(performance.now() - resumeStart)
|
|
1228
|
+
});
|
|
1229
|
+
} catch (error) {
|
|
1230
|
+
logEvent("tengu_session_resumed", {
|
|
1231
|
+
entrypoint,
|
|
1232
|
+
success: false
|
|
1233
|
+
});
|
|
1234
|
+
throw error;
|
|
1235
|
+
}
|
|
1236
|
+
}, [resetLoadingState, setAppState]);
|
|
1237
|
+
const [initialReadFileState] = useState(() => createFileStateCacheWithSizeLimit(READ_FILE_STATE_CACHE_SIZE));
|
|
1238
|
+
const readFileState = useRef(initialReadFileState);
|
|
1239
|
+
const bashTools = useRef(new Set);
|
|
1240
|
+
const bashToolsProcessedIdx = useRef(0);
|
|
1241
|
+
const discoveredSkillNamesRef = useRef(new Set);
|
|
1242
|
+
const loadedNestedMemoryPathsRef = useRef(new Set);
|
|
1243
|
+
const restoreReadFileState = useCallback((messages, cwd) => {
|
|
1244
|
+
const extracted = extractReadFilesFromMessages(messages, cwd, READ_FILE_STATE_CACHE_SIZE);
|
|
1245
|
+
readFileState.current = mergeFileStateCaches(readFileState.current, extracted);
|
|
1246
|
+
for (const tool of extractBashToolsFromMessages(messages)) {
|
|
1247
|
+
bashTools.current.add(tool);
|
|
1248
|
+
}
|
|
1249
|
+
}, []);
|
|
1250
|
+
useEffect(() => {
|
|
1251
|
+
if (initialMessages && initialMessages.length > 0) {
|
|
1252
|
+
restoreReadFileState(initialMessages, getOriginalCwd());
|
|
1253
|
+
restoreRemoteAgentTasks({
|
|
1254
|
+
abortController: new AbortController,
|
|
1255
|
+
getAppState: () => store.getState(),
|
|
1256
|
+
setAppState
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
}, []);
|
|
1260
|
+
const {
|
|
1261
|
+
status: apiKeyStatus,
|
|
1262
|
+
reverify
|
|
1263
|
+
} = useApiKeyVerification();
|
|
1264
|
+
const [autoRunIssueReason, setAutoRunIssueReason] = useState(null);
|
|
1265
|
+
const didAutoRunIssueRef = useRef(false);
|
|
1266
|
+
const [exitFlow, setExitFlow] = useState(null);
|
|
1267
|
+
const [isExiting, setIsExiting] = useState(false);
|
|
1268
|
+
const showingCostDialog = !isLoading && showCostDialog;
|
|
1269
|
+
function getFocusedInputDialog() {
|
|
1270
|
+
if (isExiting || exitFlow)
|
|
1271
|
+
return;
|
|
1272
|
+
if (isMessageSelectorVisible)
|
|
1273
|
+
return "message-selector";
|
|
1274
|
+
if (isPromptInputActive)
|
|
1275
|
+
return;
|
|
1276
|
+
if (sandboxPermissionRequestQueue[0])
|
|
1277
|
+
return "sandbox-permission";
|
|
1278
|
+
const allowDialogsWithAnimation = !toolJSX || toolJSX.shouldContinueAnimation;
|
|
1279
|
+
if (allowDialogsWithAnimation && toolUseConfirmQueue[0])
|
|
1280
|
+
return "tool-permission";
|
|
1281
|
+
if (allowDialogsWithAnimation && promptQueue[0])
|
|
1282
|
+
return "prompt";
|
|
1283
|
+
if (allowDialogsWithAnimation && workerSandboxPermissions.queue[0])
|
|
1284
|
+
return "worker-sandbox-permission";
|
|
1285
|
+
if (allowDialogsWithAnimation && elicitation.queue[0])
|
|
1286
|
+
return "elicitation";
|
|
1287
|
+
if (allowDialogsWithAnimation && showingCostDialog)
|
|
1288
|
+
return "cost";
|
|
1289
|
+
if (allowDialogsWithAnimation && idleReturnPending)
|
|
1290
|
+
return "idle-return";
|
|
1291
|
+
if (false)
|
|
1292
|
+
;
|
|
1293
|
+
if (false)
|
|
1294
|
+
;
|
|
1295
|
+
if (allowDialogsWithAnimation && showIdeOnboarding)
|
|
1296
|
+
return "ide-onboarding";
|
|
1297
|
+
if (false)
|
|
1298
|
+
;
|
|
1299
|
+
if (false)
|
|
1300
|
+
;
|
|
1301
|
+
if (allowDialogsWithAnimation && showEffortCallout)
|
|
1302
|
+
return "effort-callout";
|
|
1303
|
+
if (allowDialogsWithAnimation && showRemoteCallout)
|
|
1304
|
+
return "remote-callout";
|
|
1305
|
+
if (allowDialogsWithAnimation && lspRecommendation)
|
|
1306
|
+
return "lsp-recommendation";
|
|
1307
|
+
if (allowDialogsWithAnimation && hintRecommendation)
|
|
1308
|
+
return "plugin-hint";
|
|
1309
|
+
if (allowDialogsWithAnimation && showDesktopUpsellStartup)
|
|
1310
|
+
return "desktop-upsell";
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
const focusedInputDialog = getFocusedInputDialog();
|
|
1314
|
+
const hasSuppressedDialogs = isPromptInputActive && (sandboxPermissionRequestQueue[0] || toolUseConfirmQueue[0] || promptQueue[0] || workerSandboxPermissions.queue[0] || elicitation.queue[0] || showingCostDialog);
|
|
1315
|
+
focusedInputDialogRef.current = focusedInputDialog;
|
|
1316
|
+
useEffect(() => {
|
|
1317
|
+
if (!isLoading)
|
|
1318
|
+
return;
|
|
1319
|
+
const isPaused = focusedInputDialog === "tool-permission";
|
|
1320
|
+
const now = Date.now();
|
|
1321
|
+
if (isPaused && pauseStartTimeRef.current === null) {
|
|
1322
|
+
pauseStartTimeRef.current = now;
|
|
1323
|
+
} else if (!isPaused && pauseStartTimeRef.current !== null) {
|
|
1324
|
+
totalPausedMsRef.current += now - pauseStartTimeRef.current;
|
|
1325
|
+
pauseStartTimeRef.current = null;
|
|
1326
|
+
}
|
|
1327
|
+
}, [focusedInputDialog, isLoading]);
|
|
1328
|
+
const prevDialogRef = useRef(focusedInputDialog);
|
|
1329
|
+
useLayoutEffect(() => {
|
|
1330
|
+
const was = prevDialogRef.current === "tool-permission";
|
|
1331
|
+
const now = focusedInputDialog === "tool-permission";
|
|
1332
|
+
if (was !== now)
|
|
1333
|
+
repinScroll();
|
|
1334
|
+
prevDialogRef.current = focusedInputDialog;
|
|
1335
|
+
}, [focusedInputDialog, repinScroll]);
|
|
1336
|
+
function onCancel() {
|
|
1337
|
+
if (focusedInputDialog === "elicitation") {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
logForDebugging(`[onCancel] focusedInputDialog=${focusedInputDialog} streamMode=${streamMode}`);
|
|
1341
|
+
if (false) {}
|
|
1342
|
+
queryGuard.forceEnd();
|
|
1343
|
+
skipIdleCheckRef.current = false;
|
|
1344
|
+
if (streamingText?.trim()) {
|
|
1345
|
+
setMessages((prev) => [...prev, createAssistantMessage({
|
|
1346
|
+
content: streamingText
|
|
1347
|
+
})]);
|
|
1348
|
+
}
|
|
1349
|
+
resetLoadingState();
|
|
1350
|
+
if (false) {}
|
|
1351
|
+
if (focusedInputDialog === "tool-permission") {
|
|
1352
|
+
toolUseConfirmQueue[0]?.onAbort();
|
|
1353
|
+
setToolUseConfirmQueue([]);
|
|
1354
|
+
} else if (focusedInputDialog === "prompt") {
|
|
1355
|
+
for (const item of promptQueue) {
|
|
1356
|
+
item.reject(new Error("Prompt cancelled by user"));
|
|
1357
|
+
}
|
|
1358
|
+
setPromptQueue([]);
|
|
1359
|
+
abortController?.abort("user-cancel");
|
|
1360
|
+
} else if (activeRemote.isRemoteMode) {
|
|
1361
|
+
activeRemote.cancelRequest();
|
|
1362
|
+
} else {
|
|
1363
|
+
abortController?.abort("user-cancel");
|
|
1364
|
+
}
|
|
1365
|
+
setAbortController(null);
|
|
1366
|
+
mrOnTurnComplete(messagesRef.current, true);
|
|
1367
|
+
}
|
|
1368
|
+
const handleQueuedCommandOnCancel = useCallback(() => {
|
|
1369
|
+
const result = popAllEditable(inputValue, 0);
|
|
1370
|
+
if (!result)
|
|
1371
|
+
return;
|
|
1372
|
+
setInputValue(result.text);
|
|
1373
|
+
setInputMode("prompt");
|
|
1374
|
+
if (result.images.length > 0) {
|
|
1375
|
+
setPastedContents((prev) => {
|
|
1376
|
+
const newContents = {
|
|
1377
|
+
...prev
|
|
1378
|
+
};
|
|
1379
|
+
for (const image of result.images) {
|
|
1380
|
+
newContents[image.id] = image;
|
|
1381
|
+
}
|
|
1382
|
+
return newContents;
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
}, [setInputValue, setInputMode, inputValue, setPastedContents]);
|
|
1386
|
+
const cancelRequestProps = {
|
|
1387
|
+
setToolUseConfirmQueue,
|
|
1388
|
+
onCancel,
|
|
1389
|
+
onAgentsKilled: () => setMessages((prev) => [...prev, createAgentsKilledMessage()]),
|
|
1390
|
+
isMessageSelectorVisible: isMessageSelectorVisible || !!showBashesDialog,
|
|
1391
|
+
screen,
|
|
1392
|
+
abortSignal: abortController?.signal,
|
|
1393
|
+
popCommandFromQueue: handleQueuedCommandOnCancel,
|
|
1394
|
+
vimMode,
|
|
1395
|
+
isLocalJSXCommand: toolJSX?.isLocalJSXCommand,
|
|
1396
|
+
isSearchingHistory,
|
|
1397
|
+
isHelpOpen,
|
|
1398
|
+
inputMode,
|
|
1399
|
+
inputValue,
|
|
1400
|
+
streamMode
|
|
1401
|
+
};
|
|
1402
|
+
useEffect(() => {
|
|
1403
|
+
const totalCost = getTotalCost();
|
|
1404
|
+
if (totalCost >= 5 && !showCostDialog && !haveShownCostDialog) {
|
|
1405
|
+
logEvent("tengu_cost_threshold_reached", {});
|
|
1406
|
+
setHaveShownCostDialog(true);
|
|
1407
|
+
if (hasConsoleBillingAccess()) {
|
|
1408
|
+
setShowCostDialog(true);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}, [messages, showCostDialog, haveShownCostDialog]);
|
|
1412
|
+
const sandboxAskCallback = useCallback(async (hostPattern) => {
|
|
1413
|
+
if (isAgentSwarmsEnabled() && isSwarmWorker()) {
|
|
1414
|
+
const requestId = generateSandboxRequestId();
|
|
1415
|
+
const sent = await sendSandboxPermissionRequestViaMailbox(hostPattern.host, requestId);
|
|
1416
|
+
return new Promise((resolveShouldAllowHost) => {
|
|
1417
|
+
if (!sent) {
|
|
1418
|
+
setSandboxPermissionRequestQueue((prev) => [...prev, {
|
|
1419
|
+
hostPattern,
|
|
1420
|
+
resolvePromise: resolveShouldAllowHost
|
|
1421
|
+
}]);
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
registerSandboxPermissionCallback({
|
|
1425
|
+
requestId,
|
|
1426
|
+
host: hostPattern.host,
|
|
1427
|
+
resolve: resolveShouldAllowHost
|
|
1428
|
+
});
|
|
1429
|
+
setAppState((prev) => ({
|
|
1430
|
+
...prev,
|
|
1431
|
+
pendingSandboxRequest: {
|
|
1432
|
+
requestId,
|
|
1433
|
+
host: hostPattern.host
|
|
1434
|
+
}
|
|
1435
|
+
}));
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
return new Promise((resolveShouldAllowHost) => {
|
|
1439
|
+
let resolved = false;
|
|
1440
|
+
function resolveOnce(allow) {
|
|
1441
|
+
if (resolved)
|
|
1442
|
+
return;
|
|
1443
|
+
resolved = true;
|
|
1444
|
+
resolveShouldAllowHost(allow);
|
|
1445
|
+
}
|
|
1446
|
+
setSandboxPermissionRequestQueue((prev) => [...prev, {
|
|
1447
|
+
hostPattern,
|
|
1448
|
+
resolvePromise: resolveOnce
|
|
1449
|
+
}]);
|
|
1450
|
+
if (false) {}
|
|
1451
|
+
});
|
|
1452
|
+
}, [setAppState, store]);
|
|
1453
|
+
useEffect(() => {
|
|
1454
|
+
const reason = SandboxManager.getSandboxUnavailableReason();
|
|
1455
|
+
if (!reason)
|
|
1456
|
+
return;
|
|
1457
|
+
if (SandboxManager.isSandboxRequired()) {
|
|
1458
|
+
process.stderr.write(`
|
|
1459
|
+
Error: sandbox required but unavailable: ${reason}
|
|
1460
|
+
` + ` sandbox.failIfUnavailable is set — refusing to start without a working sandbox.
|
|
1461
|
+
|
|
1462
|
+
`);
|
|
1463
|
+
gracefulShutdownSync(1, "other");
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
logForDebugging(`sandbox disabled: ${reason}`, {
|
|
1467
|
+
level: "warn"
|
|
1468
|
+
});
|
|
1469
|
+
addNotification({
|
|
1470
|
+
key: "sandbox-unavailable",
|
|
1471
|
+
jsx: jsxDEV_7x81h0kn(Fragment_8vg9x3sq, {
|
|
1472
|
+
children: [
|
|
1473
|
+
jsxDEV_7x81h0kn(Text, {
|
|
1474
|
+
color: "warning",
|
|
1475
|
+
children: "sandbox disabled"
|
|
1476
|
+
}, undefined, false, undefined, this),
|
|
1477
|
+
jsxDEV_7x81h0kn(Text, {
|
|
1478
|
+
dimColor: true,
|
|
1479
|
+
children: " · /sandbox"
|
|
1480
|
+
}, undefined, false, undefined, this)
|
|
1481
|
+
]
|
|
1482
|
+
}, undefined, true, undefined, this),
|
|
1483
|
+
priority: "medium"
|
|
1484
|
+
});
|
|
1485
|
+
}, [addNotification]);
|
|
1486
|
+
if (SandboxManager.isSandboxingEnabled()) {
|
|
1487
|
+
SandboxManager.initialize(sandboxAskCallback).catch((err) => {
|
|
1488
|
+
process.stderr.write(`
|
|
1489
|
+
❌ Sandbox Error: ${errorMessage(err)}
|
|
1490
|
+
`);
|
|
1491
|
+
gracefulShutdownSync(1, "other");
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
const setToolPermissionContext = useCallback((context, options) => {
|
|
1495
|
+
setAppState((prev) => ({
|
|
1496
|
+
...prev,
|
|
1497
|
+
toolPermissionContext: {
|
|
1498
|
+
...context,
|
|
1499
|
+
mode: options?.preserveMode ? prev.toolPermissionContext.mode : context.mode
|
|
1500
|
+
}
|
|
1501
|
+
}));
|
|
1502
|
+
setImmediate((setToolUseConfirmQueue) => {
|
|
1503
|
+
setToolUseConfirmQueue((currentQueue) => {
|
|
1504
|
+
currentQueue.forEach((item) => {
|
|
1505
|
+
item.recheckPermission();
|
|
1506
|
+
});
|
|
1507
|
+
return currentQueue;
|
|
1508
|
+
});
|
|
1509
|
+
}, setToolUseConfirmQueue);
|
|
1510
|
+
}, [setAppState, setToolUseConfirmQueue]);
|
|
1511
|
+
useEffect(() => {
|
|
1512
|
+
registerLeaderSetToolPermissionContext(setToolPermissionContext);
|
|
1513
|
+
return () => unregisterLeaderSetToolPermissionContext();
|
|
1514
|
+
}, [setToolPermissionContext]);
|
|
1515
|
+
const canUseTool = useCanUseTool(setToolUseConfirmQueue, setToolPermissionContext);
|
|
1516
|
+
const requestPrompt = useCallback((title, toolInputSummary) => (request) => new Promise((resolve, reject) => {
|
|
1517
|
+
setPromptQueue((prev) => [...prev, {
|
|
1518
|
+
request,
|
|
1519
|
+
title,
|
|
1520
|
+
toolInputSummary,
|
|
1521
|
+
resolve,
|
|
1522
|
+
reject
|
|
1523
|
+
}]);
|
|
1524
|
+
}), []);
|
|
1525
|
+
const getToolUseContext = useCallback((messages, newMessages, abortController, mainLoopModel) => {
|
|
1526
|
+
const s = store.getState();
|
|
1527
|
+
const computeTools = () => {
|
|
1528
|
+
const state = store.getState();
|
|
1529
|
+
const assembled = assembleToolPool(state.toolPermissionContext, state.mcp.tools);
|
|
1530
|
+
const merged = mergeAndFilterTools(combinedInitialTools, assembled, state.toolPermissionContext.mode);
|
|
1531
|
+
if (!mainThreadAgentDefinition)
|
|
1532
|
+
return merged;
|
|
1533
|
+
return resolveAgentTools(mainThreadAgentDefinition, merged, false, true).resolvedTools;
|
|
1534
|
+
};
|
|
1535
|
+
return {
|
|
1536
|
+
abortController,
|
|
1537
|
+
options: {
|
|
1538
|
+
commands,
|
|
1539
|
+
tools: computeTools(),
|
|
1540
|
+
debug,
|
|
1541
|
+
verbose: s.verbose,
|
|
1542
|
+
mainLoopModel,
|
|
1543
|
+
thinkingConfig: s.thinkingEnabled !== false ? thinkingConfig : {
|
|
1544
|
+
type: "disabled"
|
|
1545
|
+
},
|
|
1546
|
+
mcpClients: mergeClients(initialMcpClients, s.mcp.clients),
|
|
1547
|
+
mcpResources: s.mcp.resources,
|
|
1548
|
+
ideInstallationStatus,
|
|
1549
|
+
isNonInteractiveSession: false,
|
|
1550
|
+
dynamicMcpConfig,
|
|
1551
|
+
theme,
|
|
1552
|
+
agentDefinitions: allowedAgentTypes ? {
|
|
1553
|
+
...s.agentDefinitions,
|
|
1554
|
+
allowedAgentTypes
|
|
1555
|
+
} : s.agentDefinitions,
|
|
1556
|
+
customSystemPrompt,
|
|
1557
|
+
appendSystemPrompt,
|
|
1558
|
+
refreshTools: computeTools
|
|
1559
|
+
},
|
|
1560
|
+
getAppState: () => store.getState(),
|
|
1561
|
+
setAppState,
|
|
1562
|
+
messages,
|
|
1563
|
+
setMessages,
|
|
1564
|
+
updateFileHistoryState(updater) {
|
|
1565
|
+
setAppState((prev) => {
|
|
1566
|
+
const updated = updater(prev.fileHistory);
|
|
1567
|
+
if (updated === prev.fileHistory)
|
|
1568
|
+
return prev;
|
|
1569
|
+
return {
|
|
1570
|
+
...prev,
|
|
1571
|
+
fileHistory: updated
|
|
1572
|
+
};
|
|
1573
|
+
});
|
|
1574
|
+
},
|
|
1575
|
+
updateAttributionState(updater) {
|
|
1576
|
+
setAppState((prev) => {
|
|
1577
|
+
const updated = updater(prev.attribution);
|
|
1578
|
+
if (updated === prev.attribution)
|
|
1579
|
+
return prev;
|
|
1580
|
+
return {
|
|
1581
|
+
...prev,
|
|
1582
|
+
attribution: updated
|
|
1583
|
+
};
|
|
1584
|
+
});
|
|
1585
|
+
},
|
|
1586
|
+
openMessageSelector: () => {
|
|
1587
|
+
if (!disabled) {
|
|
1588
|
+
setIsMessageSelectorVisible(true);
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
onChangeAPIKey: reverify,
|
|
1592
|
+
readFileState: readFileState.current,
|
|
1593
|
+
setToolJSX,
|
|
1594
|
+
addNotification,
|
|
1595
|
+
appendSystemMessage: (msg) => setMessages((prev) => [...prev, msg]),
|
|
1596
|
+
sendOSNotification: (opts) => {
|
|
1597
|
+
sendNotification(opts, terminal);
|
|
1598
|
+
},
|
|
1599
|
+
onChangeDynamicMcpConfig,
|
|
1600
|
+
onInstallIDEExtension: setIDEToInstallExtension,
|
|
1601
|
+
nestedMemoryAttachmentTriggers: new Set,
|
|
1602
|
+
loadedNestedMemoryPaths: loadedNestedMemoryPathsRef.current,
|
|
1603
|
+
dynamicSkillDirTriggers: new Set,
|
|
1604
|
+
discoveredSkillNames: discoveredSkillNamesRef.current,
|
|
1605
|
+
setResponseLength,
|
|
1606
|
+
pushApiMetricsEntry: undefined,
|
|
1607
|
+
setStreamMode,
|
|
1608
|
+
onCompactProgress: (event) => {
|
|
1609
|
+
switch (event.type) {
|
|
1610
|
+
case "hooks_start":
|
|
1611
|
+
setSpinnerColor("claudeBlue_FOR_SYSTEM_SPINNER");
|
|
1612
|
+
setSpinnerShimmerColor("claudeBlueShimmer_FOR_SYSTEM_SPINNER");
|
|
1613
|
+
setSpinnerMessage(event.hookType === "pre_compact" ? "Running PreCompact hooks…" : event.hookType === "post_compact" ? "Running PostCompact hooks…" : "Running SessionStart hooks…");
|
|
1614
|
+
break;
|
|
1615
|
+
case "compact_start":
|
|
1616
|
+
setSpinnerMessage("Compacting conversation");
|
|
1617
|
+
break;
|
|
1618
|
+
case "compact_end":
|
|
1619
|
+
setSpinnerMessage(null);
|
|
1620
|
+
setSpinnerColor(null);
|
|
1621
|
+
setSpinnerShimmerColor(null);
|
|
1622
|
+
break;
|
|
1623
|
+
}
|
|
1624
|
+
},
|
|
1625
|
+
setInProgressToolUseIDs,
|
|
1626
|
+
setHasInterruptibleToolInProgress: (v) => {
|
|
1627
|
+
hasInterruptibleToolInProgressRef.current = v;
|
|
1628
|
+
},
|
|
1629
|
+
resume,
|
|
1630
|
+
setConversationId,
|
|
1631
|
+
requestPrompt: undefined,
|
|
1632
|
+
contentReplacementState: contentReplacementStateRef.current
|
|
1633
|
+
};
|
|
1634
|
+
}, [commands, combinedInitialTools, mainThreadAgentDefinition, debug, initialMcpClients, ideInstallationStatus, dynamicMcpConfig, theme, allowedAgentTypes, store, setAppState, reverify, addNotification, setMessages, onChangeDynamicMcpConfig, resume, requestPrompt, disabled, customSystemPrompt, appendSystemPrompt, setConversationId]);
|
|
1635
|
+
const handleBackgroundQuery = useCallback(() => {
|
|
1636
|
+
abortController?.abort("background");
|
|
1637
|
+
const removedNotifications = removeByFilter((cmd) => cmd.mode === "task-notification");
|
|
1638
|
+
(async () => {
|
|
1639
|
+
const toolUseContext = getToolUseContext(messagesRef.current, [], new AbortController, mainLoopModel);
|
|
1640
|
+
const [defaultSystemPrompt, userContext, systemContext] = await Promise.all([getSystemPrompt(toolUseContext.options.tools, mainLoopModel, Array.from(toolPermissionContext.additionalWorkingDirectories.keys()), toolUseContext.options.mcpClients), getUserContext(), getSystemContext()]);
|
|
1641
|
+
const systemPrompt = buildEffectiveSystemPrompt({
|
|
1642
|
+
mainThreadAgentDefinition,
|
|
1643
|
+
toolUseContext,
|
|
1644
|
+
customSystemPrompt,
|
|
1645
|
+
defaultSystemPrompt,
|
|
1646
|
+
appendSystemPrompt
|
|
1647
|
+
});
|
|
1648
|
+
toolUseContext.renderedSystemPrompt = systemPrompt;
|
|
1649
|
+
const notificationAttachments = await getQueuedCommandAttachments(removedNotifications).catch(() => []);
|
|
1650
|
+
const notificationMessages = notificationAttachments.map(createAttachmentMessage);
|
|
1651
|
+
const existingPrompts = new Set;
|
|
1652
|
+
for (const m of messagesRef.current) {
|
|
1653
|
+
if (m.type === "attachment" && m.attachment.type === "queued_command" && m.attachment.commandMode === "task-notification" && typeof m.attachment.prompt === "string") {
|
|
1654
|
+
existingPrompts.add(m.attachment.prompt);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
const uniqueNotifications = notificationMessages.filter((m) => m.attachment.type === "queued_command" && (typeof m.attachment.prompt !== "string" || !existingPrompts.has(m.attachment.prompt)));
|
|
1658
|
+
startBackgroundSession({
|
|
1659
|
+
messages: [...messagesRef.current, ...uniqueNotifications],
|
|
1660
|
+
queryParams: {
|
|
1661
|
+
systemPrompt,
|
|
1662
|
+
userContext,
|
|
1663
|
+
systemContext,
|
|
1664
|
+
canUseTool,
|
|
1665
|
+
toolUseContext,
|
|
1666
|
+
querySource: getQuerySourceForREPL()
|
|
1667
|
+
},
|
|
1668
|
+
description: terminalTitle,
|
|
1669
|
+
setAppState,
|
|
1670
|
+
agentDefinition: mainThreadAgentDefinition
|
|
1671
|
+
});
|
|
1672
|
+
})();
|
|
1673
|
+
}, [abortController, mainLoopModel, toolPermissionContext, mainThreadAgentDefinition, getToolUseContext, customSystemPrompt, appendSystemPrompt, canUseTool, setAppState]);
|
|
1674
|
+
const {
|
|
1675
|
+
handleBackgroundSession
|
|
1676
|
+
} = useSessionBackgrounding({
|
|
1677
|
+
setMessages,
|
|
1678
|
+
setIsLoading: setIsExternalLoading,
|
|
1679
|
+
resetLoadingState,
|
|
1680
|
+
setAbortController,
|
|
1681
|
+
onBackgroundQuery: handleBackgroundQuery
|
|
1682
|
+
});
|
|
1683
|
+
const onQueryEvent = useCallback((event) => {
|
|
1684
|
+
handleMessageFromStream(event, (newMessage) => {
|
|
1685
|
+
if (isCompactBoundaryMessage(newMessage)) {
|
|
1686
|
+
if (isFullscreenEnvEnabled()) {
|
|
1687
|
+
setMessages((old) => [...getMessagesAfterCompactBoundary(old, {
|
|
1688
|
+
includeSnipped: true
|
|
1689
|
+
}), newMessage]);
|
|
1690
|
+
} else {
|
|
1691
|
+
setMessages(() => [newMessage]);
|
|
1692
|
+
}
|
|
1693
|
+
setConversationId(randomUUID());
|
|
1694
|
+
if (false) {}
|
|
1695
|
+
} else if (newMessage.type === "progress" && isEphemeralToolProgress(newMessage.data.type)) {
|
|
1696
|
+
setMessages((oldMessages) => {
|
|
1697
|
+
const last = oldMessages.at(-1);
|
|
1698
|
+
if (last?.type === "progress" && last.parentToolUseID === newMessage.parentToolUseID && last.data.type === newMessage.data.type) {
|
|
1699
|
+
const copy = oldMessages.slice();
|
|
1700
|
+
copy[copy.length - 1] = newMessage;
|
|
1701
|
+
return copy;
|
|
1702
|
+
}
|
|
1703
|
+
return [...oldMessages, newMessage];
|
|
1704
|
+
});
|
|
1705
|
+
} else {
|
|
1706
|
+
setMessages((oldMessages) => [...oldMessages, newMessage]);
|
|
1707
|
+
}
|
|
1708
|
+
if (false) {}
|
|
1709
|
+
}, (newContent) => {
|
|
1710
|
+
setResponseLength((length) => length + newContent.length);
|
|
1711
|
+
}, setStreamMode, setStreamingToolUses, (tombstonedMessage) => {
|
|
1712
|
+
setMessages((oldMessages) => oldMessages.filter((m) => m !== tombstonedMessage));
|
|
1713
|
+
removeTranscriptMessage(tombstonedMessage.uuid);
|
|
1714
|
+
}, setStreamingThinking, (metrics) => {
|
|
1715
|
+
const now = Date.now();
|
|
1716
|
+
const baseline = responseLengthRef.current;
|
|
1717
|
+
apiMetricsRef.current.push({
|
|
1718
|
+
...metrics,
|
|
1719
|
+
firstTokenTime: now,
|
|
1720
|
+
lastTokenTime: now,
|
|
1721
|
+
responseLengthBaseline: baseline,
|
|
1722
|
+
endResponseLength: baseline
|
|
1723
|
+
});
|
|
1724
|
+
}, onStreamingText);
|
|
1725
|
+
}, [setMessages, setResponseLength, setStreamMode, setStreamingToolUses, setStreamingThinking, onStreamingText]);
|
|
1726
|
+
const onQueryImpl = useCallback(async (messagesIncludingNewMessages, newMessages, abortController, shouldQuery, additionalAllowedTools, mainLoopModelParam, effort) => {
|
|
1727
|
+
if (shouldQuery) {
|
|
1728
|
+
const freshClients = mergeClients(initialMcpClients, store.getState().mcp.clients);
|
|
1729
|
+
diagnosticTracker.handleQueryStart(freshClients);
|
|
1730
|
+
const ideClient = getConnectedIdeClient(freshClients);
|
|
1731
|
+
if (ideClient) {
|
|
1732
|
+
closeOpenDiffs(ideClient);
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
maybeMarkProjectOnboardingComplete();
|
|
1736
|
+
if (!titleDisabled && !sessionTitle && !agentTitle && !haikuTitleAttemptedRef.current) {
|
|
1737
|
+
const firstUserMessage = newMessages.find((m) => m.type === "user" && !m.isMeta);
|
|
1738
|
+
const text = firstUserMessage?.type === "user" ? getContentText(firstUserMessage.message.content) : null;
|
|
1739
|
+
if (text && !text.startsWith(`<${LOCAL_COMMAND_STDOUT_TAG}>`) && !text.startsWith(`<${COMMAND_MESSAGE_TAG}>`) && !text.startsWith(`<${COMMAND_NAME_TAG}>`) && !text.startsWith(`<${BASH_INPUT_TAG}>`)) {
|
|
1740
|
+
haikuTitleAttemptedRef.current = true;
|
|
1741
|
+
generateSessionTitle(text, new AbortController().signal).then((title) => {
|
|
1742
|
+
if (title)
|
|
1743
|
+
setHaikuTitle(title);
|
|
1744
|
+
else
|
|
1745
|
+
haikuTitleAttemptedRef.current = false;
|
|
1746
|
+
}, () => {
|
|
1747
|
+
haikuTitleAttemptedRef.current = false;
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
store.setState((prev) => {
|
|
1752
|
+
const cur = prev.toolPermissionContext.alwaysAllowRules.command;
|
|
1753
|
+
if (cur === additionalAllowedTools || cur?.length === additionalAllowedTools.length && cur.every((v, i) => v === additionalAllowedTools[i])) {
|
|
1754
|
+
return prev;
|
|
1755
|
+
}
|
|
1756
|
+
return {
|
|
1757
|
+
...prev,
|
|
1758
|
+
toolPermissionContext: {
|
|
1759
|
+
...prev.toolPermissionContext,
|
|
1760
|
+
alwaysAllowRules: {
|
|
1761
|
+
...prev.toolPermissionContext.alwaysAllowRules,
|
|
1762
|
+
command: additionalAllowedTools
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
};
|
|
1766
|
+
});
|
|
1767
|
+
if (!shouldQuery) {
|
|
1768
|
+
if (newMessages.some(isCompactBoundaryMessage)) {
|
|
1769
|
+
setConversationId(randomUUID());
|
|
1770
|
+
if (false) {}
|
|
1771
|
+
}
|
|
1772
|
+
resetLoadingState();
|
|
1773
|
+
setAbortController(null);
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1776
|
+
const toolUseContext = getToolUseContext(messagesIncludingNewMessages, newMessages, abortController, mainLoopModelParam);
|
|
1777
|
+
const {
|
|
1778
|
+
tools: freshTools,
|
|
1779
|
+
mcpClients: freshMcpClients
|
|
1780
|
+
} = toolUseContext.options;
|
|
1781
|
+
if (effort !== undefined) {
|
|
1782
|
+
const previousGetAppState = toolUseContext.getAppState;
|
|
1783
|
+
toolUseContext.getAppState = () => ({
|
|
1784
|
+
...previousGetAppState(),
|
|
1785
|
+
effortValue: effort
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
queryCheckpoint("query_context_loading_start");
|
|
1789
|
+
const [, , defaultSystemPrompt, baseUserContext, systemContext] = await Promise.all([
|
|
1790
|
+
checkAndDisableBypassPermissionsIfNeeded(toolPermissionContext, setAppState),
|
|
1791
|
+
undefined,
|
|
1792
|
+
getSystemPrompt(freshTools, mainLoopModelParam, Array.from(toolPermissionContext.additionalWorkingDirectories.keys()), freshMcpClients),
|
|
1793
|
+
getUserContext(),
|
|
1794
|
+
getSystemContext()
|
|
1795
|
+
]);
|
|
1796
|
+
const userContext = {
|
|
1797
|
+
...baseUserContext,
|
|
1798
|
+
...getCoordinatorUserContext(freshMcpClients, isScratchpadEnabled() ? getScratchpadDir() : undefined),
|
|
1799
|
+
...{}
|
|
1800
|
+
};
|
|
1801
|
+
queryCheckpoint("query_context_loading_end");
|
|
1802
|
+
const systemPrompt = buildEffectiveSystemPrompt({
|
|
1803
|
+
mainThreadAgentDefinition,
|
|
1804
|
+
toolUseContext,
|
|
1805
|
+
customSystemPrompt,
|
|
1806
|
+
defaultSystemPrompt,
|
|
1807
|
+
appendSystemPrompt
|
|
1808
|
+
});
|
|
1809
|
+
toolUseContext.renderedSystemPrompt = systemPrompt;
|
|
1810
|
+
queryCheckpoint("query_query_start");
|
|
1811
|
+
resetTurnHookDuration();
|
|
1812
|
+
resetTurnToolDuration();
|
|
1813
|
+
resetTurnClassifierDuration();
|
|
1814
|
+
for await (const event of query({
|
|
1815
|
+
messages: messagesIncludingNewMessages,
|
|
1816
|
+
systemPrompt,
|
|
1817
|
+
userContext,
|
|
1818
|
+
systemContext,
|
|
1819
|
+
canUseTool,
|
|
1820
|
+
toolUseContext,
|
|
1821
|
+
querySource: getQuerySourceForREPL()
|
|
1822
|
+
})) {
|
|
1823
|
+
onQueryEvent(event);
|
|
1824
|
+
}
|
|
1825
|
+
if (false) {}
|
|
1826
|
+
queryCheckpoint("query_end");
|
|
1827
|
+
if (false) {}
|
|
1828
|
+
resetLoadingState();
|
|
1829
|
+
logQueryProfileReport();
|
|
1830
|
+
await onTurnComplete?.(messagesRef.current);
|
|
1831
|
+
}, [initialMcpClients, resetLoadingState, getToolUseContext, toolPermissionContext, setAppState, customSystemPrompt, onTurnComplete, appendSystemPrompt, canUseTool, mainThreadAgentDefinition, onQueryEvent, sessionTitle, titleDisabled]);
|
|
1832
|
+
const onQuery = useCallback(async (newMessages, abortController, shouldQuery, additionalAllowedTools, mainLoopModelParam, onBeforeQueryCallback, input, effort) => {
|
|
1833
|
+
if (isAgentSwarmsEnabled()) {
|
|
1834
|
+
const teamName = getTeamName();
|
|
1835
|
+
const agentName = getAgentName();
|
|
1836
|
+
if (teamName && agentName) {
|
|
1837
|
+
setMemberActive(teamName, agentName, true);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
const thisGeneration = queryGuard.tryStart();
|
|
1841
|
+
if (thisGeneration === null) {
|
|
1842
|
+
logEvent("tengu_concurrent_onquery_detected", {});
|
|
1843
|
+
newMessages.filter((m) => m.type === "user" && !m.isMeta).map((_) => getContentText(_.message.content)).filter((_) => _ !== null).forEach((msg, i) => {
|
|
1844
|
+
enqueue({
|
|
1845
|
+
value: msg,
|
|
1846
|
+
mode: "prompt"
|
|
1847
|
+
});
|
|
1848
|
+
if (i === 0) {
|
|
1849
|
+
logEvent("tengu_concurrent_onquery_enqueued", {});
|
|
1850
|
+
}
|
|
1851
|
+
});
|
|
1852
|
+
return;
|
|
1853
|
+
}
|
|
1854
|
+
try {
|
|
1855
|
+
resetTimingRefs();
|
|
1856
|
+
setMessages((oldMessages) => [...oldMessages, ...newMessages]);
|
|
1857
|
+
responseLengthRef.current = 0;
|
|
1858
|
+
if (false) {}
|
|
1859
|
+
apiMetricsRef.current = [];
|
|
1860
|
+
setStreamingToolUses([]);
|
|
1861
|
+
setStreamingText(null);
|
|
1862
|
+
const latestMessages = messagesRef.current;
|
|
1863
|
+
if (input) {
|
|
1864
|
+
await mrOnBeforeQuery(input, latestMessages, newMessages.length);
|
|
1865
|
+
}
|
|
1866
|
+
if (onBeforeQueryCallback && input) {
|
|
1867
|
+
const shouldProceed = await onBeforeQueryCallback(input, latestMessages);
|
|
1868
|
+
if (!shouldProceed) {
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
await onQueryImpl(latestMessages, newMessages, abortController, shouldQuery, additionalAllowedTools, mainLoopModelParam, effort);
|
|
1873
|
+
} finally {
|
|
1874
|
+
if (queryGuard.end(thisGeneration)) {
|
|
1875
|
+
setLastQueryCompletionTime(Date.now());
|
|
1876
|
+
skipIdleCheckRef.current = false;
|
|
1877
|
+
resetLoadingState();
|
|
1878
|
+
await mrOnTurnComplete(messagesRef.current, abortController.signal.aborted);
|
|
1879
|
+
sendBridgeResultRef.current();
|
|
1880
|
+
if (false) {}
|
|
1881
|
+
let budgetInfo;
|
|
1882
|
+
if (false) {}
|
|
1883
|
+
const turnDurationMs = Date.now() - loadingStartTimeRef.current - totalPausedMsRef.current;
|
|
1884
|
+
if ((turnDurationMs > 30000 || budgetInfo !== undefined) && !abortController.signal.aborted && !proactiveActive) {
|
|
1885
|
+
const hasRunningSwarmAgents = getAllInProcessTeammateTasks(store.getState().tasks).some((t) => t.status === "running");
|
|
1886
|
+
if (hasRunningSwarmAgents) {
|
|
1887
|
+
if (swarmStartTimeRef.current === null) {
|
|
1888
|
+
swarmStartTimeRef.current = loadingStartTimeRef.current;
|
|
1889
|
+
}
|
|
1890
|
+
if (budgetInfo) {
|
|
1891
|
+
swarmBudgetInfoRef.current = budgetInfo;
|
|
1892
|
+
}
|
|
1893
|
+
} else {
|
|
1894
|
+
setMessages((prev) => [...prev, createTurnDurationMessage(turnDurationMs, budgetInfo, count(prev, isLoggableMessage))]);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
setAbortController(null);
|
|
1898
|
+
}
|
|
1899
|
+
if (abortController.signal.reason === "user-cancel" && !queryGuard.isActive && inputValueRef.current === "" && getCommandQueueLength() === 0 && !store.getState().viewingAgentTaskId) {
|
|
1900
|
+
const msgs = messagesRef.current;
|
|
1901
|
+
const lastUserMsg = msgs.findLast(selectableUserMessagesFilter);
|
|
1902
|
+
if (lastUserMsg) {
|
|
1903
|
+
const idx = msgs.lastIndexOf(lastUserMsg);
|
|
1904
|
+
if (messagesAfterAreOnlySynthetic(msgs, idx)) {
|
|
1905
|
+
removeLastFromHistory();
|
|
1906
|
+
restoreMessageSyncRef.current(lastUserMsg);
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
}, [onQueryImpl, setAppState, resetLoadingState, queryGuard, mrOnBeforeQuery, mrOnTurnComplete]);
|
|
1912
|
+
const initialMessageRef = useRef(false);
|
|
1913
|
+
useEffect(() => {
|
|
1914
|
+
const pending = initialMessage;
|
|
1915
|
+
if (!pending || isLoading || initialMessageRef.current)
|
|
1916
|
+
return;
|
|
1917
|
+
initialMessageRef.current = true;
|
|
1918
|
+
async function processInitialMessage(initialMsg) {
|
|
1919
|
+
if (initialMsg.clearContext) {
|
|
1920
|
+
const oldPlanSlug = initialMsg.message.planContent ? getPlanSlug() : undefined;
|
|
1921
|
+
const {
|
|
1922
|
+
clearConversation
|
|
1923
|
+
} = await import("../commands/clear/conversation.js");
|
|
1924
|
+
await clearConversation({
|
|
1925
|
+
setMessages,
|
|
1926
|
+
readFileState: readFileState.current,
|
|
1927
|
+
discoveredSkillNames: discoveredSkillNamesRef.current,
|
|
1928
|
+
loadedNestedMemoryPaths: loadedNestedMemoryPathsRef.current,
|
|
1929
|
+
getAppState: () => store.getState(),
|
|
1930
|
+
setAppState,
|
|
1931
|
+
setConversationId
|
|
1932
|
+
});
|
|
1933
|
+
haikuTitleAttemptedRef.current = false;
|
|
1934
|
+
setHaikuTitle(undefined);
|
|
1935
|
+
bashTools.current.clear();
|
|
1936
|
+
bashToolsProcessedIdx.current = 0;
|
|
1937
|
+
if (oldPlanSlug) {
|
|
1938
|
+
setPlanSlug(getSessionId(), oldPlanSlug);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
const shouldStorePlanForVerification = initialMsg.message.planContent && false;
|
|
1942
|
+
setAppState((prev) => {
|
|
1943
|
+
let updatedToolPermissionContext = initialMsg.mode ? applyPermissionUpdates(prev.toolPermissionContext, buildPermissionUpdates(initialMsg.mode, initialMsg.allowedPrompts)) : prev.toolPermissionContext;
|
|
1944
|
+
if (false) {}
|
|
1945
|
+
return {
|
|
1946
|
+
...prev,
|
|
1947
|
+
initialMessage: null,
|
|
1948
|
+
toolPermissionContext: updatedToolPermissionContext,
|
|
1949
|
+
...shouldStorePlanForVerification && {
|
|
1950
|
+
pendingPlanVerification: {
|
|
1951
|
+
plan: initialMsg.message.planContent,
|
|
1952
|
+
verificationStarted: false,
|
|
1953
|
+
verificationCompleted: false
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
});
|
|
1958
|
+
if (fileHistoryEnabled()) {
|
|
1959
|
+
fileHistoryMakeSnapshot((updater) => {
|
|
1960
|
+
setAppState((prev) => ({
|
|
1961
|
+
...prev,
|
|
1962
|
+
fileHistory: updater(prev.fileHistory)
|
|
1963
|
+
}));
|
|
1964
|
+
}, initialMsg.message.uuid);
|
|
1965
|
+
}
|
|
1966
|
+
await awaitPendingHooks();
|
|
1967
|
+
const content = initialMsg.message.message.content;
|
|
1968
|
+
if (typeof content === "string" && !initialMsg.message.planContent) {
|
|
1969
|
+
onSubmit(content, {
|
|
1970
|
+
setCursorOffset: () => {},
|
|
1971
|
+
clearBuffer: () => {},
|
|
1972
|
+
resetHistory: () => {}
|
|
1973
|
+
});
|
|
1974
|
+
} else {
|
|
1975
|
+
const newAbortController = createAbortController();
|
|
1976
|
+
setAbortController(newAbortController);
|
|
1977
|
+
onQuery([initialMsg.message], newAbortController, true, [], mainLoopModel);
|
|
1978
|
+
}
|
|
1979
|
+
setTimeout((ref) => {
|
|
1980
|
+
ref.current = false;
|
|
1981
|
+
}, 100, initialMessageRef);
|
|
1982
|
+
}
|
|
1983
|
+
processInitialMessage(pending);
|
|
1984
|
+
}, [initialMessage, isLoading, setMessages, setAppState, onQuery, mainLoopModel, tools]);
|
|
1985
|
+
const onSubmit = useCallback(async (input, helpers, speculationAccept, options) => {
|
|
1986
|
+
repinScroll();
|
|
1987
|
+
if (false) {}
|
|
1988
|
+
if (!speculationAccept && input.trim().startsWith("/")) {
|
|
1989
|
+
const trimmedInput = expandPastedTextRefs(input, pastedContents).trim();
|
|
1990
|
+
const spaceIndex = trimmedInput.indexOf(" ");
|
|
1991
|
+
const commandName = spaceIndex === -1 ? trimmedInput.slice(1) : trimmedInput.slice(1, spaceIndex);
|
|
1992
|
+
const commandArgs = spaceIndex === -1 ? "" : trimmedInput.slice(spaceIndex + 1).trim();
|
|
1993
|
+
const matchingCommand = commands.find((cmd) => isCommandEnabled(cmd) && (cmd.name === commandName || cmd.aliases?.includes(commandName) || getCommandName(cmd) === commandName));
|
|
1994
|
+
if (matchingCommand?.name === "clear" && idleHintShownRef.current) {
|
|
1995
|
+
logEvent("tengu_idle_return_action", {
|
|
1996
|
+
action: "hint_converted",
|
|
1997
|
+
variant: idleHintShownRef.current,
|
|
1998
|
+
idleMinutes: Math.round((Date.now() - lastQueryCompletionTimeRef.current) / 60000),
|
|
1999
|
+
messageCount: messagesRef.current.length,
|
|
2000
|
+
totalInputTokens: getTotalInputTokens()
|
|
2001
|
+
});
|
|
2002
|
+
idleHintShownRef.current = false;
|
|
2003
|
+
}
|
|
2004
|
+
const shouldTreatAsImmediate = queryGuard.isActive && (matchingCommand?.immediate || options?.fromKeybinding);
|
|
2005
|
+
if (matchingCommand && shouldTreatAsImmediate && matchingCommand.type === "local-jsx") {
|
|
2006
|
+
if (input.trim() === inputValueRef.current.trim()) {
|
|
2007
|
+
setInputValue("");
|
|
2008
|
+
helpers.setCursorOffset(0);
|
|
2009
|
+
helpers.clearBuffer();
|
|
2010
|
+
setPastedContents({});
|
|
2011
|
+
}
|
|
2012
|
+
const pastedTextRefs = parseReferences(input).filter((r) => pastedContents[r.id]?.type === "text");
|
|
2013
|
+
const pastedTextCount = pastedTextRefs.length;
|
|
2014
|
+
const pastedTextBytes = pastedTextRefs.reduce((sum, r) => sum + (pastedContents[r.id]?.content.length ?? 0), 0);
|
|
2015
|
+
logEvent("tengu_paste_text", {
|
|
2016
|
+
pastedTextCount,
|
|
2017
|
+
pastedTextBytes
|
|
2018
|
+
});
|
|
2019
|
+
logEvent("tengu_immediate_command_executed", {
|
|
2020
|
+
commandName: matchingCommand.name,
|
|
2021
|
+
fromKeybinding: options?.fromKeybinding ?? false
|
|
2022
|
+
});
|
|
2023
|
+
const executeImmediateCommand = async () => {
|
|
2024
|
+
let doneWasCalled = false;
|
|
2025
|
+
const onDone = (result, doneOptions) => {
|
|
2026
|
+
doneWasCalled = true;
|
|
2027
|
+
setToolJSX({
|
|
2028
|
+
jsx: null,
|
|
2029
|
+
shouldHidePromptInput: false,
|
|
2030
|
+
clearLocalJSX: true
|
|
2031
|
+
});
|
|
2032
|
+
const newMessages = [];
|
|
2033
|
+
if (result && doneOptions?.display !== "skip") {
|
|
2034
|
+
addNotification({
|
|
2035
|
+
key: `immediate-${matchingCommand.name}`,
|
|
2036
|
+
text: result,
|
|
2037
|
+
priority: "immediate"
|
|
2038
|
+
});
|
|
2039
|
+
if (!isFullscreenEnvEnabled()) {
|
|
2040
|
+
newMessages.push(createCommandInputMessage(formatCommandInputTags(getCommandName(matchingCommand), commandArgs)), createCommandInputMessage(`<${LOCAL_COMMAND_STDOUT_TAG}>${escapeXml(result)}</${LOCAL_COMMAND_STDOUT_TAG}>`));
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
if (doneOptions?.metaMessages?.length) {
|
|
2044
|
+
newMessages.push(...doneOptions.metaMessages.map((content) => createUserMessage({
|
|
2045
|
+
content,
|
|
2046
|
+
isMeta: true
|
|
2047
|
+
})));
|
|
2048
|
+
}
|
|
2049
|
+
if (newMessages.length) {
|
|
2050
|
+
setMessages((prev) => [...prev, ...newMessages]);
|
|
2051
|
+
}
|
|
2052
|
+
if (stashedPrompt !== undefined) {
|
|
2053
|
+
setInputValue(stashedPrompt.text);
|
|
2054
|
+
helpers.setCursorOffset(stashedPrompt.cursorOffset);
|
|
2055
|
+
setPastedContents(stashedPrompt.pastedContents);
|
|
2056
|
+
setStashedPrompt(undefined);
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
const context = getToolUseContext(messagesRef.current, [], createAbortController(), mainLoopModel);
|
|
2060
|
+
const mod = await matchingCommand.load();
|
|
2061
|
+
const jsx = await mod.call(onDone, context, commandArgs);
|
|
2062
|
+
if (jsx && !doneWasCalled) {
|
|
2063
|
+
setToolJSX({
|
|
2064
|
+
jsx,
|
|
2065
|
+
shouldHidePromptInput: false,
|
|
2066
|
+
isLocalJSXCommand: true
|
|
2067
|
+
});
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
executeImmediateCommand();
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
if (activeRemote.isRemoteMode && !input.trim()) {
|
|
2075
|
+
return;
|
|
2076
|
+
}
|
|
2077
|
+
{
|
|
2078
|
+
const willowMode = getFeatureValue_CACHED_MAY_BE_STALE("tengu_willow_mode", "off");
|
|
2079
|
+
const idleThresholdMin = Number(process.env.CLAUDE_CODE_IDLE_THRESHOLD_MINUTES ?? 75);
|
|
2080
|
+
const tokenThreshold = Number(process.env.CLAUDE_CODE_IDLE_TOKEN_THRESHOLD ?? 1e5);
|
|
2081
|
+
if (willowMode !== "off" && !getGlobalConfig().idleReturnDismissed && !skipIdleCheckRef.current && !speculationAccept && !input.trim().startsWith("/") && lastQueryCompletionTimeRef.current > 0 && getTotalInputTokens() >= tokenThreshold) {
|
|
2082
|
+
const idleMs = Date.now() - lastQueryCompletionTimeRef.current;
|
|
2083
|
+
const idleMinutes = idleMs / 60000;
|
|
2084
|
+
if (idleMinutes >= idleThresholdMin && willowMode === "dialog") {
|
|
2085
|
+
setIdleReturnPending({
|
|
2086
|
+
input,
|
|
2087
|
+
idleMinutes
|
|
2088
|
+
});
|
|
2089
|
+
setInputValue("");
|
|
2090
|
+
helpers.setCursorOffset(0);
|
|
2091
|
+
helpers.clearBuffer();
|
|
2092
|
+
return;
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
if (!options?.fromKeybinding) {
|
|
2097
|
+
addToHistory({
|
|
2098
|
+
display: speculationAccept ? input : prependModeCharacterToInput(input, inputMode),
|
|
2099
|
+
pastedContents: speculationAccept ? {} : pastedContents
|
|
2100
|
+
});
|
|
2101
|
+
if (inputMode === "bash") {
|
|
2102
|
+
prependToShellHistoryCache(input.trim());
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
const isSlashCommand = !speculationAccept && input.trim().startsWith("/");
|
|
2106
|
+
const submitsNow = !isLoading || speculationAccept || activeRemote.isRemoteMode;
|
|
2107
|
+
if (stashedPrompt !== undefined && !isSlashCommand && submitsNow) {
|
|
2108
|
+
setInputValue(stashedPrompt.text);
|
|
2109
|
+
helpers.setCursorOffset(stashedPrompt.cursorOffset);
|
|
2110
|
+
setPastedContents(stashedPrompt.pastedContents);
|
|
2111
|
+
setStashedPrompt(undefined);
|
|
2112
|
+
} else if (submitsNow) {
|
|
2113
|
+
if (!options?.fromKeybinding) {
|
|
2114
|
+
setInputValue("");
|
|
2115
|
+
helpers.setCursorOffset(0);
|
|
2116
|
+
}
|
|
2117
|
+
setPastedContents({});
|
|
2118
|
+
}
|
|
2119
|
+
if (submitsNow) {
|
|
2120
|
+
setInputMode("prompt");
|
|
2121
|
+
setIDESelection(undefined);
|
|
2122
|
+
setSubmitCount((_) => _ + 1);
|
|
2123
|
+
helpers.clearBuffer();
|
|
2124
|
+
tipPickedThisTurnRef.current = false;
|
|
2125
|
+
if (!isSlashCommand && inputMode === "prompt" && !speculationAccept && !activeRemote.isRemoteMode) {
|
|
2126
|
+
setUserInputOnProcessing(input);
|
|
2127
|
+
resetTimingRefs();
|
|
2128
|
+
}
|
|
2129
|
+
if (false) {}
|
|
2130
|
+
}
|
|
2131
|
+
if (speculationAccept) {
|
|
2132
|
+
const {
|
|
2133
|
+
queryRequired
|
|
2134
|
+
} = await handleSpeculationAccept(speculationAccept.state, speculationAccept.speculationSessionTimeSavedMs, speculationAccept.setAppState, input, {
|
|
2135
|
+
setMessages,
|
|
2136
|
+
readFileState,
|
|
2137
|
+
cwd: getOriginalCwd()
|
|
2138
|
+
});
|
|
2139
|
+
if (queryRequired) {
|
|
2140
|
+
const newAbortController = createAbortController();
|
|
2141
|
+
setAbortController(newAbortController);
|
|
2142
|
+
onQuery([], newAbortController, true, [], mainLoopModel);
|
|
2143
|
+
}
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
if (activeRemote.isRemoteMode && !(isSlashCommand && commands.find((c) => {
|
|
2147
|
+
const name = input.trim().slice(1).split(/\s/)[0];
|
|
2148
|
+
return isCommandEnabled(c) && (c.name === name || c.aliases?.includes(name) || getCommandName(c) === name);
|
|
2149
|
+
})?.type === "local-jsx")) {
|
|
2150
|
+
const pastedValues = Object.values(pastedContents);
|
|
2151
|
+
const imageContents = pastedValues.filter((c) => c.type === "image");
|
|
2152
|
+
const imagePasteIds = imageContents.length > 0 ? imageContents.map((c) => c.id) : undefined;
|
|
2153
|
+
let messageContent = input.trim();
|
|
2154
|
+
let remoteContent = input.trim();
|
|
2155
|
+
if (pastedValues.length > 0) {
|
|
2156
|
+
const contentBlocks = [];
|
|
2157
|
+
const remoteBlocks = [];
|
|
2158
|
+
const trimmedInput = input.trim();
|
|
2159
|
+
if (trimmedInput) {
|
|
2160
|
+
contentBlocks.push({
|
|
2161
|
+
type: "text",
|
|
2162
|
+
text: trimmedInput
|
|
2163
|
+
});
|
|
2164
|
+
remoteBlocks.push({
|
|
2165
|
+
type: "text",
|
|
2166
|
+
text: trimmedInput
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
for (const pasted of pastedValues) {
|
|
2170
|
+
if (pasted.type === "image") {
|
|
2171
|
+
const source = {
|
|
2172
|
+
type: "base64",
|
|
2173
|
+
media_type: pasted.mediaType ?? "image/png",
|
|
2174
|
+
data: pasted.content
|
|
2175
|
+
};
|
|
2176
|
+
contentBlocks.push({
|
|
2177
|
+
type: "image",
|
|
2178
|
+
source
|
|
2179
|
+
});
|
|
2180
|
+
remoteBlocks.push({
|
|
2181
|
+
type: "image",
|
|
2182
|
+
source
|
|
2183
|
+
});
|
|
2184
|
+
} else {
|
|
2185
|
+
contentBlocks.push({
|
|
2186
|
+
type: "text",
|
|
2187
|
+
text: pasted.content
|
|
2188
|
+
});
|
|
2189
|
+
remoteBlocks.push({
|
|
2190
|
+
type: "text",
|
|
2191
|
+
text: pasted.content
|
|
2192
|
+
});
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
messageContent = contentBlocks;
|
|
2196
|
+
remoteContent = remoteBlocks;
|
|
2197
|
+
}
|
|
2198
|
+
const userMessage = createUserMessage({
|
|
2199
|
+
content: messageContent,
|
|
2200
|
+
imagePasteIds
|
|
2201
|
+
});
|
|
2202
|
+
setMessages((prev) => [...prev, userMessage]);
|
|
2203
|
+
await activeRemote.sendMessage(remoteContent, {
|
|
2204
|
+
uuid: userMessage.uuid
|
|
2205
|
+
});
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2208
|
+
await awaitPendingHooks();
|
|
2209
|
+
await handlePromptSubmit({
|
|
2210
|
+
input,
|
|
2211
|
+
helpers,
|
|
2212
|
+
queryGuard,
|
|
2213
|
+
isExternalLoading,
|
|
2214
|
+
mode: inputMode,
|
|
2215
|
+
commands,
|
|
2216
|
+
onInputChange: setInputValue,
|
|
2217
|
+
setPastedContents,
|
|
2218
|
+
setToolJSX,
|
|
2219
|
+
getToolUseContext,
|
|
2220
|
+
messages: messagesRef.current,
|
|
2221
|
+
mainLoopModel,
|
|
2222
|
+
pastedContents,
|
|
2223
|
+
ideSelection,
|
|
2224
|
+
setUserInputOnProcessing,
|
|
2225
|
+
setAbortController,
|
|
2226
|
+
abortController,
|
|
2227
|
+
onQuery,
|
|
2228
|
+
setAppState,
|
|
2229
|
+
querySource: getQuerySourceForREPL(),
|
|
2230
|
+
onBeforeQuery,
|
|
2231
|
+
canUseTool,
|
|
2232
|
+
addNotification,
|
|
2233
|
+
setMessages,
|
|
2234
|
+
streamMode: streamModeRef.current,
|
|
2235
|
+
hasInterruptibleToolInProgress: hasInterruptibleToolInProgressRef.current
|
|
2236
|
+
});
|
|
2237
|
+
if ((isSlashCommand || isLoading) && stashedPrompt !== undefined) {
|
|
2238
|
+
setInputValue(stashedPrompt.text);
|
|
2239
|
+
helpers.setCursorOffset(stashedPrompt.cursorOffset);
|
|
2240
|
+
setPastedContents(stashedPrompt.pastedContents);
|
|
2241
|
+
setStashedPrompt(undefined);
|
|
2242
|
+
}
|
|
2243
|
+
}, [
|
|
2244
|
+
queryGuard,
|
|
2245
|
+
isLoading,
|
|
2246
|
+
isExternalLoading,
|
|
2247
|
+
inputMode,
|
|
2248
|
+
commands,
|
|
2249
|
+
setInputValue,
|
|
2250
|
+
setInputMode,
|
|
2251
|
+
setPastedContents,
|
|
2252
|
+
setSubmitCount,
|
|
2253
|
+
setIDESelection,
|
|
2254
|
+
setToolJSX,
|
|
2255
|
+
getToolUseContext,
|
|
2256
|
+
mainLoopModel,
|
|
2257
|
+
pastedContents,
|
|
2258
|
+
ideSelection,
|
|
2259
|
+
setUserInputOnProcessing,
|
|
2260
|
+
setAbortController,
|
|
2261
|
+
addNotification,
|
|
2262
|
+
onQuery,
|
|
2263
|
+
stashedPrompt,
|
|
2264
|
+
setStashedPrompt,
|
|
2265
|
+
setAppState,
|
|
2266
|
+
onBeforeQuery,
|
|
2267
|
+
canUseTool,
|
|
2268
|
+
remoteSession,
|
|
2269
|
+
setMessages,
|
|
2270
|
+
awaitPendingHooks,
|
|
2271
|
+
repinScroll
|
|
2272
|
+
]);
|
|
2273
|
+
const onAgentSubmit = useCallback(async (input, task, helpers) => {
|
|
2274
|
+
if (isLocalAgentTask(task)) {
|
|
2275
|
+
appendMessageToLocalAgent(task.id, createUserMessage({
|
|
2276
|
+
content: input
|
|
2277
|
+
}), setAppState);
|
|
2278
|
+
if (task.status === "running") {
|
|
2279
|
+
queuePendingMessage(task.id, input, setAppState);
|
|
2280
|
+
} else {
|
|
2281
|
+
resumeAgentBackground({
|
|
2282
|
+
agentId: task.id,
|
|
2283
|
+
prompt: input,
|
|
2284
|
+
toolUseContext: getToolUseContext(messagesRef.current, [], new AbortController, mainLoopModel),
|
|
2285
|
+
canUseTool
|
|
2286
|
+
}).catch((err) => {
|
|
2287
|
+
logForDebugging(`resumeAgentBackground failed: ${errorMessage(err)}`);
|
|
2288
|
+
addNotification({
|
|
2289
|
+
key: `resume-agent-failed-${task.id}`,
|
|
2290
|
+
jsx: jsxDEV_7x81h0kn(Text, {
|
|
2291
|
+
color: "error",
|
|
2292
|
+
children: [
|
|
2293
|
+
"Failed to resume agent: ",
|
|
2294
|
+
errorMessage(err)
|
|
2295
|
+
]
|
|
2296
|
+
}, undefined, true, undefined, this),
|
|
2297
|
+
priority: "low"
|
|
2298
|
+
});
|
|
2299
|
+
});
|
|
2300
|
+
}
|
|
2301
|
+
} else {
|
|
2302
|
+
injectUserMessageToTeammate(task.id, input, setAppState);
|
|
2303
|
+
}
|
|
2304
|
+
setInputValue("");
|
|
2305
|
+
helpers.setCursorOffset(0);
|
|
2306
|
+
helpers.clearBuffer();
|
|
2307
|
+
}, [setAppState, setInputValue, getToolUseContext, canUseTool, mainLoopModel, addNotification]);
|
|
2308
|
+
const handleAutoRunIssue = useCallback(() => {
|
|
2309
|
+
const command = autoRunIssueReason ? getAutoRunCommand(autoRunIssueReason) : "/issue";
|
|
2310
|
+
setAutoRunIssueReason(null);
|
|
2311
|
+
onSubmit(command, {
|
|
2312
|
+
setCursorOffset: () => {},
|
|
2313
|
+
clearBuffer: () => {},
|
|
2314
|
+
resetHistory: () => {}
|
|
2315
|
+
}).catch((err) => {
|
|
2316
|
+
logForDebugging(`Auto-run ${command} failed: ${errorMessage(err)}`);
|
|
2317
|
+
});
|
|
2318
|
+
}, [onSubmit, autoRunIssueReason]);
|
|
2319
|
+
const handleCancelAutoRunIssue = useCallback(() => {
|
|
2320
|
+
setAutoRunIssueReason(null);
|
|
2321
|
+
}, []);
|
|
2322
|
+
const handleSurveyRequestFeedback = useCallback(() => {
|
|
2323
|
+
const command = "/feedback";
|
|
2324
|
+
onSubmit(command, {
|
|
2325
|
+
setCursorOffset: () => {},
|
|
2326
|
+
clearBuffer: () => {},
|
|
2327
|
+
resetHistory: () => {}
|
|
2328
|
+
}).catch((err) => {
|
|
2329
|
+
logForDebugging(`Survey feedback request failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
2330
|
+
});
|
|
2331
|
+
}, [onSubmit]);
|
|
2332
|
+
const onSubmitRef = useRef(onSubmit);
|
|
2333
|
+
onSubmitRef.current = onSubmit;
|
|
2334
|
+
const handleOpenRateLimitOptions = useCallback(() => {
|
|
2335
|
+
onSubmitRef.current("/rate-limit-options", {
|
|
2336
|
+
setCursorOffset: () => {},
|
|
2337
|
+
clearBuffer: () => {},
|
|
2338
|
+
resetHistory: () => {}
|
|
2339
|
+
});
|
|
2340
|
+
}, []);
|
|
2341
|
+
const handleExit = useCallback(async () => {
|
|
2342
|
+
setIsExiting(true);
|
|
2343
|
+
if (false) {}
|
|
2344
|
+
const showWorktree = getCurrentWorktreeSession() !== null;
|
|
2345
|
+
if (showWorktree) {
|
|
2346
|
+
setExitFlow(jsxDEV_7x81h0kn(ExitFlow, {
|
|
2347
|
+
showWorktree: true,
|
|
2348
|
+
onDone: () => {},
|
|
2349
|
+
onCancel: () => {
|
|
2350
|
+
setExitFlow(null);
|
|
2351
|
+
setIsExiting(false);
|
|
2352
|
+
}
|
|
2353
|
+
}, undefined, false, undefined, this));
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
const exitMod = await exit.load();
|
|
2357
|
+
const exitFlowResult = await exitMod.call(() => {});
|
|
2358
|
+
setExitFlow(exitFlowResult);
|
|
2359
|
+
if (exitFlowResult === null) {
|
|
2360
|
+
setIsExiting(false);
|
|
2361
|
+
}
|
|
2362
|
+
}, []);
|
|
2363
|
+
const handleShowMessageSelector = useCallback(() => {
|
|
2364
|
+
setIsMessageSelectorVisible((prev) => !prev);
|
|
2365
|
+
}, []);
|
|
2366
|
+
const rewindConversationTo = useCallback((message) => {
|
|
2367
|
+
const prev = messagesRef.current;
|
|
2368
|
+
const messageIndex = prev.lastIndexOf(message);
|
|
2369
|
+
if (messageIndex === -1)
|
|
2370
|
+
return;
|
|
2371
|
+
logEvent("tengu_conversation_rewind", {
|
|
2372
|
+
preRewindMessageCount: prev.length,
|
|
2373
|
+
postRewindMessageCount: messageIndex,
|
|
2374
|
+
messagesRemoved: prev.length - messageIndex,
|
|
2375
|
+
rewindToMessageIndex: messageIndex
|
|
2376
|
+
});
|
|
2377
|
+
setMessages(prev.slice(0, messageIndex));
|
|
2378
|
+
setConversationId(randomUUID());
|
|
2379
|
+
resetMicrocompactState();
|
|
2380
|
+
if (false) {}
|
|
2381
|
+
setAppState((prev) => ({
|
|
2382
|
+
...prev,
|
|
2383
|
+
toolPermissionContext: message.permissionMode && prev.toolPermissionContext.mode !== message.permissionMode ? {
|
|
2384
|
+
...prev.toolPermissionContext,
|
|
2385
|
+
mode: message.permissionMode
|
|
2386
|
+
} : prev.toolPermissionContext,
|
|
2387
|
+
promptSuggestion: {
|
|
2388
|
+
text: null,
|
|
2389
|
+
promptId: null,
|
|
2390
|
+
shownAt: 0,
|
|
2391
|
+
acceptedAt: 0,
|
|
2392
|
+
generationRequestId: null
|
|
2393
|
+
}
|
|
2394
|
+
}));
|
|
2395
|
+
}, [setMessages, setAppState]);
|
|
2396
|
+
const restoreMessageSync = useCallback((message) => {
|
|
2397
|
+
rewindConversationTo(message);
|
|
2398
|
+
const r = textForResubmit(message);
|
|
2399
|
+
if (r) {
|
|
2400
|
+
setInputValue(r.text);
|
|
2401
|
+
setInputMode(r.mode);
|
|
2402
|
+
}
|
|
2403
|
+
if (Array.isArray(message.message.content) && message.message.content.some((block) => block.type === "image")) {
|
|
2404
|
+
const imageBlocks = message.message.content.filter((block) => block.type === "image");
|
|
2405
|
+
if (imageBlocks.length > 0) {
|
|
2406
|
+
const newPastedContents = {};
|
|
2407
|
+
imageBlocks.forEach((block, index) => {
|
|
2408
|
+
if (block.source.type === "base64") {
|
|
2409
|
+
const id = message.imagePasteIds?.[index] ?? index + 1;
|
|
2410
|
+
newPastedContents[id] = {
|
|
2411
|
+
id,
|
|
2412
|
+
type: "image",
|
|
2413
|
+
content: block.source.data,
|
|
2414
|
+
mediaType: block.source.media_type
|
|
2415
|
+
};
|
|
2416
|
+
}
|
|
2417
|
+
});
|
|
2418
|
+
setPastedContents(newPastedContents);
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
}, [rewindConversationTo, setInputValue]);
|
|
2422
|
+
restoreMessageSyncRef.current = restoreMessageSync;
|
|
2423
|
+
const handleRestoreMessage = useCallback(async (message) => {
|
|
2424
|
+
setImmediate((restore, message) => restore(message), restoreMessageSync, message);
|
|
2425
|
+
}, [restoreMessageSync]);
|
|
2426
|
+
const findRawIndex = (uuid) => {
|
|
2427
|
+
const prefix = uuid.slice(0, 24);
|
|
2428
|
+
return messages.findIndex((m) => m.uuid.slice(0, 24) === prefix);
|
|
2429
|
+
};
|
|
2430
|
+
const messageActionCaps = {
|
|
2431
|
+
copy: (text) => void setClipboard(text).then((raw) => {
|
|
2432
|
+
if (raw)
|
|
2433
|
+
process.stdout.write(raw);
|
|
2434
|
+
addNotification({
|
|
2435
|
+
key: "selection-copied",
|
|
2436
|
+
text: "copied",
|
|
2437
|
+
color: "success",
|
|
2438
|
+
priority: "immediate",
|
|
2439
|
+
timeoutMs: 2000
|
|
2440
|
+
});
|
|
2441
|
+
}),
|
|
2442
|
+
edit: async (msg) => {
|
|
2443
|
+
const rawIdx = findRawIndex(msg.uuid);
|
|
2444
|
+
const raw = rawIdx >= 0 ? messages[rawIdx] : undefined;
|
|
2445
|
+
if (!raw || !selectableUserMessagesFilter(raw))
|
|
2446
|
+
return;
|
|
2447
|
+
const noFileChanges = !await fileHistoryHasAnyChanges(fileHistory, raw.uuid);
|
|
2448
|
+
const onlySynthetic = messagesAfterAreOnlySynthetic(messages, rawIdx);
|
|
2449
|
+
if (noFileChanges && onlySynthetic) {
|
|
2450
|
+
onCancel();
|
|
2451
|
+
handleRestoreMessage(raw);
|
|
2452
|
+
} else {
|
|
2453
|
+
setMessageSelectorPreselect(raw);
|
|
2454
|
+
setIsMessageSelectorVisible(true);
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
};
|
|
2458
|
+
const {
|
|
2459
|
+
enter: enterMessageActions,
|
|
2460
|
+
handlers: messageActionHandlers
|
|
2461
|
+
} = useMessageActions(cursor, setCursor, cursorNavRef, messageActionCaps);
|
|
2462
|
+
async function onInit() {
|
|
2463
|
+
reverify();
|
|
2464
|
+
const memoryFiles = await getMemoryFiles();
|
|
2465
|
+
if (memoryFiles.length > 0) {
|
|
2466
|
+
const fileList = memoryFiles.map((f) => ` [${f.type}] ${f.path} (${f.content.length} chars)${f.parent ? ` (included by ${f.parent})` : ""}`).join(`
|
|
2467
|
+
`);
|
|
2468
|
+
logForDebugging(`Loaded ${memoryFiles.length} CLAUDE.md/rules files:
|
|
2469
|
+
${fileList}`);
|
|
2470
|
+
} else {
|
|
2471
|
+
logForDebugging("No CLAUDE.md/rules files found");
|
|
2472
|
+
}
|
|
2473
|
+
for (const file of memoryFiles) {
|
|
2474
|
+
readFileState.current.set(file.path, {
|
|
2475
|
+
content: file.contentDiffersFromDisk ? file.rawContent ?? file.content : file.content,
|
|
2476
|
+
timestamp: Date.now(),
|
|
2477
|
+
offset: undefined,
|
|
2478
|
+
limit: undefined,
|
|
2479
|
+
isPartialView: file.contentDiffersFromDisk
|
|
2480
|
+
});
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
useCostSummary(useFpsMetrics());
|
|
2484
|
+
useLogMessages(messages, messages.length === initialMessages?.length);
|
|
2485
|
+
const {
|
|
2486
|
+
sendBridgeResult
|
|
2487
|
+
} = useReplBridge(messages, setMessages, abortControllerRef, commands, mainLoopModel);
|
|
2488
|
+
sendBridgeResultRef.current = sendBridgeResult;
|
|
2489
|
+
useAfterFirstRender();
|
|
2490
|
+
const hasCountedQueueUseRef = useRef(false);
|
|
2491
|
+
useEffect(() => {
|
|
2492
|
+
if (queuedCommands.length < 1) {
|
|
2493
|
+
hasCountedQueueUseRef.current = false;
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2496
|
+
if (hasCountedQueueUseRef.current)
|
|
2497
|
+
return;
|
|
2498
|
+
hasCountedQueueUseRef.current = true;
|
|
2499
|
+
saveGlobalConfig((current) => ({
|
|
2500
|
+
...current,
|
|
2501
|
+
promptQueueUseCount: (current.promptQueueUseCount ?? 0) + 1
|
|
2502
|
+
}));
|
|
2503
|
+
}, [queuedCommands.length]);
|
|
2504
|
+
const executeQueuedInput = useCallback(async (queuedCommands) => {
|
|
2505
|
+
await handlePromptSubmit({
|
|
2506
|
+
helpers: {
|
|
2507
|
+
setCursorOffset: () => {},
|
|
2508
|
+
clearBuffer: () => {},
|
|
2509
|
+
resetHistory: () => {}
|
|
2510
|
+
},
|
|
2511
|
+
queryGuard,
|
|
2512
|
+
commands,
|
|
2513
|
+
onInputChange: () => {},
|
|
2514
|
+
setPastedContents: () => {},
|
|
2515
|
+
setToolJSX,
|
|
2516
|
+
getToolUseContext,
|
|
2517
|
+
messages,
|
|
2518
|
+
mainLoopModel,
|
|
2519
|
+
ideSelection,
|
|
2520
|
+
setUserInputOnProcessing,
|
|
2521
|
+
setAbortController,
|
|
2522
|
+
onQuery,
|
|
2523
|
+
setAppState,
|
|
2524
|
+
querySource: getQuerySourceForREPL(),
|
|
2525
|
+
onBeforeQuery,
|
|
2526
|
+
canUseTool,
|
|
2527
|
+
addNotification,
|
|
2528
|
+
setMessages,
|
|
2529
|
+
queuedCommands
|
|
2530
|
+
});
|
|
2531
|
+
}, [queryGuard, commands, setToolJSX, getToolUseContext, messages, mainLoopModel, ideSelection, setUserInputOnProcessing, canUseTool, setAbortController, onQuery, addNotification, setAppState, onBeforeQuery]);
|
|
2532
|
+
useQueueProcessor({
|
|
2533
|
+
executeQueuedInput,
|
|
2534
|
+
hasActiveLocalJsxUI: isShowingLocalJSXCommand,
|
|
2535
|
+
queryGuard
|
|
2536
|
+
});
|
|
2537
|
+
useEffect(() => {
|
|
2538
|
+
activityManager.recordUserActivity();
|
|
2539
|
+
updateLastInteractionTime(true);
|
|
2540
|
+
}, [inputValue, submitCount]);
|
|
2541
|
+
useEffect(() => {
|
|
2542
|
+
if (submitCount === 1) {
|
|
2543
|
+
startBackgroundHousekeeping();
|
|
2544
|
+
}
|
|
2545
|
+
}, [submitCount]);
|
|
2546
|
+
useEffect(() => {
|
|
2547
|
+
if (isLoading)
|
|
2548
|
+
return;
|
|
2549
|
+
if (submitCount === 0)
|
|
2550
|
+
return;
|
|
2551
|
+
if (lastQueryCompletionTime === 0)
|
|
2552
|
+
return;
|
|
2553
|
+
const timer = setTimeout((lastQueryCompletionTime, isLoading, toolJSX, focusedInputDialogRef, terminal) => {
|
|
2554
|
+
const lastUserInteraction = getLastInteractionTime();
|
|
2555
|
+
if (lastUserInteraction > lastQueryCompletionTime) {
|
|
2556
|
+
return;
|
|
2557
|
+
}
|
|
2558
|
+
const idleTimeSinceResponse = Date.now() - lastQueryCompletionTime;
|
|
2559
|
+
if (!isLoading && !toolJSX && focusedInputDialogRef.current === undefined && idleTimeSinceResponse >= getGlobalConfig().messageIdleNotifThresholdMs) {
|
|
2560
|
+
sendNotification({
|
|
2561
|
+
message: "Claude is waiting for your input",
|
|
2562
|
+
notificationType: "idle_prompt"
|
|
2563
|
+
}, terminal);
|
|
2564
|
+
}
|
|
2565
|
+
}, getGlobalConfig().messageIdleNotifThresholdMs, lastQueryCompletionTime, isLoading, toolJSX, focusedInputDialogRef, terminal);
|
|
2566
|
+
return () => clearTimeout(timer);
|
|
2567
|
+
}, [isLoading, toolJSX, submitCount, lastQueryCompletionTime, terminal]);
|
|
2568
|
+
useEffect(() => {
|
|
2569
|
+
if (lastQueryCompletionTime === 0)
|
|
2570
|
+
return;
|
|
2571
|
+
if (isLoading)
|
|
2572
|
+
return;
|
|
2573
|
+
const willowMode = getFeatureValue_CACHED_MAY_BE_STALE("tengu_willow_mode", "off");
|
|
2574
|
+
if (willowMode !== "hint" && willowMode !== "hint_v2")
|
|
2575
|
+
return;
|
|
2576
|
+
if (getGlobalConfig().idleReturnDismissed)
|
|
2577
|
+
return;
|
|
2578
|
+
const tokenThreshold = Number(process.env.CLAUDE_CODE_IDLE_TOKEN_THRESHOLD ?? 1e5);
|
|
2579
|
+
if (getTotalInputTokens() < tokenThreshold)
|
|
2580
|
+
return;
|
|
2581
|
+
const idleThresholdMs = Number(process.env.CLAUDE_CODE_IDLE_THRESHOLD_MINUTES ?? 75) * 60000;
|
|
2582
|
+
const elapsed = Date.now() - lastQueryCompletionTime;
|
|
2583
|
+
const remaining = idleThresholdMs - elapsed;
|
|
2584
|
+
const timer = setTimeout((lqct, addNotif, msgsRef, mode, hintRef) => {
|
|
2585
|
+
if (msgsRef.current.length === 0)
|
|
2586
|
+
return;
|
|
2587
|
+
const totalTokens = getTotalInputTokens();
|
|
2588
|
+
const formattedTokens = formatTokens(totalTokens);
|
|
2589
|
+
const idleMinutes = (Date.now() - lqct) / 60000;
|
|
2590
|
+
addNotif({
|
|
2591
|
+
key: "idle-return-hint",
|
|
2592
|
+
jsx: mode === "hint_v2" ? jsxDEV_7x81h0kn(Fragment_8vg9x3sq, {
|
|
2593
|
+
children: [
|
|
2594
|
+
jsxDEV_7x81h0kn(Text, {
|
|
2595
|
+
dimColor: true,
|
|
2596
|
+
children: "new task? "
|
|
2597
|
+
}, undefined, false, undefined, this),
|
|
2598
|
+
jsxDEV_7x81h0kn(Text, {
|
|
2599
|
+
color: "suggestion",
|
|
2600
|
+
children: "/clear"
|
|
2601
|
+
}, undefined, false, undefined, this),
|
|
2602
|
+
jsxDEV_7x81h0kn(Text, {
|
|
2603
|
+
dimColor: true,
|
|
2604
|
+
children: " to save "
|
|
2605
|
+
}, undefined, false, undefined, this),
|
|
2606
|
+
jsxDEV_7x81h0kn(Text, {
|
|
2607
|
+
color: "suggestion",
|
|
2608
|
+
children: [
|
|
2609
|
+
formattedTokens,
|
|
2610
|
+
" tokens"
|
|
2611
|
+
]
|
|
2612
|
+
}, undefined, true, undefined, this)
|
|
2613
|
+
]
|
|
2614
|
+
}, undefined, true, undefined, this) : jsxDEV_7x81h0kn(Text, {
|
|
2615
|
+
color: "warning",
|
|
2616
|
+
children: [
|
|
2617
|
+
"new task? /clear to save ",
|
|
2618
|
+
formattedTokens,
|
|
2619
|
+
" tokens"
|
|
2620
|
+
]
|
|
2621
|
+
}, undefined, true, undefined, this),
|
|
2622
|
+
priority: "medium",
|
|
2623
|
+
timeoutMs: 2147483647
|
|
2624
|
+
});
|
|
2625
|
+
hintRef.current = mode;
|
|
2626
|
+
logEvent("tengu_idle_return_action", {
|
|
2627
|
+
action: "hint_shown",
|
|
2628
|
+
variant: mode,
|
|
2629
|
+
idleMinutes: Math.round(idleMinutes),
|
|
2630
|
+
messageCount: msgsRef.current.length,
|
|
2631
|
+
totalInputTokens: totalTokens
|
|
2632
|
+
});
|
|
2633
|
+
}, Math.max(0, remaining), lastQueryCompletionTime, addNotification, messagesRef, willowMode, idleHintShownRef);
|
|
2634
|
+
return () => {
|
|
2635
|
+
clearTimeout(timer);
|
|
2636
|
+
removeNotification("idle-return-hint");
|
|
2637
|
+
idleHintShownRef.current = false;
|
|
2638
|
+
};
|
|
2639
|
+
}, [lastQueryCompletionTime, isLoading, addNotification, removeNotification]);
|
|
2640
|
+
const handleIncomingPrompt = useCallback((content, options) => {
|
|
2641
|
+
if (queryGuard.isActive)
|
|
2642
|
+
return false;
|
|
2643
|
+
if (getCommandQueue().some((cmd) => cmd.mode === "prompt" || cmd.mode === "bash")) {
|
|
2644
|
+
return false;
|
|
2645
|
+
}
|
|
2646
|
+
const newAbortController = createAbortController();
|
|
2647
|
+
setAbortController(newAbortController);
|
|
2648
|
+
const userMessage = createUserMessage({
|
|
2649
|
+
content,
|
|
2650
|
+
isMeta: options?.isMeta ? true : undefined
|
|
2651
|
+
});
|
|
2652
|
+
onQuery([userMessage], newAbortController, true, [], mainLoopModel);
|
|
2653
|
+
return true;
|
|
2654
|
+
}, [onQuery, mainLoopModel, store]);
|
|
2655
|
+
const voice = {
|
|
2656
|
+
stripTrailing: () => 0,
|
|
2657
|
+
handleKeyEvent: () => {},
|
|
2658
|
+
resetAnchor: () => {},
|
|
2659
|
+
interimRange: null
|
|
2660
|
+
};
|
|
2661
|
+
useInboxPoller({
|
|
2662
|
+
enabled: isAgentSwarmsEnabled(),
|
|
2663
|
+
isLoading,
|
|
2664
|
+
focusedInputDialog,
|
|
2665
|
+
onSubmitMessage: handleIncomingPrompt
|
|
2666
|
+
});
|
|
2667
|
+
useMailboxBridge({
|
|
2668
|
+
isLoading,
|
|
2669
|
+
onSubmitMessage: handleIncomingPrompt
|
|
2670
|
+
});
|
|
2671
|
+
if (false) {}
|
|
2672
|
+
if (false) {}
|
|
2673
|
+
useEffect(() => {
|
|
2674
|
+
if (queuedCommands.some((cmd) => cmd.priority === "now")) {
|
|
2675
|
+
abortControllerRef.current?.abort("interrupt");
|
|
2676
|
+
}
|
|
2677
|
+
}, [queuedCommands]);
|
|
2678
|
+
useEffect(() => {
|
|
2679
|
+
onInit();
|
|
2680
|
+
return () => {
|
|
2681
|
+
diagnosticTracker.shutdown();
|
|
2682
|
+
};
|
|
2683
|
+
}, []);
|
|
2684
|
+
const {
|
|
2685
|
+
internal_eventEmitter
|
|
2686
|
+
} = useStdin();
|
|
2687
|
+
const [remountKey, setRemountKey] = useState(0);
|
|
2688
|
+
useEffect(() => {
|
|
2689
|
+
const handleSuspend = () => {
|
|
2690
|
+
process.stdout.write(`
|
|
2691
|
+
Claude Code has been suspended. Run \`fg\` to bring Claude Code back.
|
|
2692
|
+
Note: ctrl + z now suspends Claude Code, ctrl + _ undoes input.
|
|
2693
|
+
`);
|
|
2694
|
+
};
|
|
2695
|
+
const handleResume = () => {
|
|
2696
|
+
setRemountKey((prev) => prev + 1);
|
|
2697
|
+
};
|
|
2698
|
+
internal_eventEmitter?.on("suspend", handleSuspend);
|
|
2699
|
+
internal_eventEmitter?.on("resume", handleResume);
|
|
2700
|
+
return () => {
|
|
2701
|
+
internal_eventEmitter?.off("suspend", handleSuspend);
|
|
2702
|
+
internal_eventEmitter?.off("resume", handleResume);
|
|
2703
|
+
};
|
|
2704
|
+
}, [internal_eventEmitter]);
|
|
2705
|
+
const stopHookSpinnerSuffix = useMemo(() => {
|
|
2706
|
+
if (!isLoading)
|
|
2707
|
+
return null;
|
|
2708
|
+
const progressMsgs = messages.filter((m) => m.type === "progress" && m.data.type === "hook_progress" && (m.data.hookEvent === "Stop" || m.data.hookEvent === "SubagentStop"));
|
|
2709
|
+
if (progressMsgs.length === 0)
|
|
2710
|
+
return null;
|
|
2711
|
+
const currentToolUseID = progressMsgs.at(-1)?.toolUseID;
|
|
2712
|
+
if (!currentToolUseID)
|
|
2713
|
+
return null;
|
|
2714
|
+
const hasSummaryForCurrentExecution = messages.some((m) => m.type === "system" && m.subtype === "stop_hook_summary" && m.toolUseID === currentToolUseID);
|
|
2715
|
+
if (hasSummaryForCurrentExecution)
|
|
2716
|
+
return null;
|
|
2717
|
+
const currentHooks = progressMsgs.filter((p) => p.toolUseID === currentToolUseID);
|
|
2718
|
+
const total = currentHooks.length;
|
|
2719
|
+
const completedCount = count(messages, (m) => {
|
|
2720
|
+
if (m.type !== "attachment")
|
|
2721
|
+
return false;
|
|
2722
|
+
const attachment = m.attachment;
|
|
2723
|
+
return "hookEvent" in attachment && (attachment.hookEvent === "Stop" || attachment.hookEvent === "SubagentStop") && "toolUseID" in attachment && attachment.toolUseID === currentToolUseID;
|
|
2724
|
+
});
|
|
2725
|
+
const customMessage = currentHooks.find((p) => p.data.statusMessage)?.data.statusMessage;
|
|
2726
|
+
if (customMessage) {
|
|
2727
|
+
return total === 1 ? `${customMessage}…` : `${customMessage}… ${completedCount}/${total}`;
|
|
2728
|
+
}
|
|
2729
|
+
const hookType = currentHooks[0]?.data.hookEvent === "SubagentStop" ? "subagent stop" : "stop";
|
|
2730
|
+
if (false) {}
|
|
2731
|
+
return total === 1 ? `running ${hookType} hook` : `running stop hooks… ${completedCount}/${total}`;
|
|
2732
|
+
}, [messages, isLoading]);
|
|
2733
|
+
const handleEnterTranscript = useCallback(() => {
|
|
2734
|
+
setFrozenTranscriptState({
|
|
2735
|
+
messagesLength: messages.length,
|
|
2736
|
+
streamingToolUsesLength: streamingToolUses.length
|
|
2737
|
+
});
|
|
2738
|
+
}, [messages.length, streamingToolUses.length]);
|
|
2739
|
+
const handleExitTranscript = useCallback(() => {
|
|
2740
|
+
setFrozenTranscriptState(null);
|
|
2741
|
+
}, []);
|
|
2742
|
+
const virtualScrollActive = isFullscreenEnvEnabled() && !disableVirtualScroll;
|
|
2743
|
+
const jumpRef = useRef(null);
|
|
2744
|
+
const [searchOpen, setSearchOpen] = useState(false);
|
|
2745
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
2746
|
+
const [searchCount, setSearchCount] = useState(0);
|
|
2747
|
+
const [searchCurrent, setSearchCurrent] = useState(0);
|
|
2748
|
+
const onSearchMatchesChange = useCallback((count, current) => {
|
|
2749
|
+
setSearchCount(count);
|
|
2750
|
+
setSearchCurrent(current);
|
|
2751
|
+
}, []);
|
|
2752
|
+
useInput((input, key, event) => {
|
|
2753
|
+
if (key.ctrl || key.meta)
|
|
2754
|
+
return;
|
|
2755
|
+
if (input === "/") {
|
|
2756
|
+
jumpRef.current?.setAnchor();
|
|
2757
|
+
setSearchOpen(true);
|
|
2758
|
+
event.stopImmediatePropagation();
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
const c = input[0];
|
|
2762
|
+
if ((c === "n" || c === "N") && input === c.repeat(input.length) && searchCount > 0) {
|
|
2763
|
+
const fn = c === "n" ? jumpRef.current?.nextMatch : jumpRef.current?.prevMatch;
|
|
2764
|
+
if (fn)
|
|
2765
|
+
for (let i = 0;i < input.length; i++)
|
|
2766
|
+
fn();
|
|
2767
|
+
event.stopImmediatePropagation();
|
|
2768
|
+
}
|
|
2769
|
+
}, {
|
|
2770
|
+
isActive: screen === "transcript" && virtualScrollActive && !searchOpen && !dumpMode
|
|
2771
|
+
});
|
|
2772
|
+
const {
|
|
2773
|
+
setQuery: setHighlight,
|
|
2774
|
+
scanElement,
|
|
2775
|
+
setPositions
|
|
2776
|
+
} = useSearchHighlight();
|
|
2777
|
+
const transcriptCols = useTerminalSize().columns;
|
|
2778
|
+
const prevColsRef = React.useRef(transcriptCols);
|
|
2779
|
+
React.useEffect(() => {
|
|
2780
|
+
if (prevColsRef.current !== transcriptCols) {
|
|
2781
|
+
prevColsRef.current = transcriptCols;
|
|
2782
|
+
if (searchQuery || searchOpen) {
|
|
2783
|
+
setSearchOpen(false);
|
|
2784
|
+
setSearchQuery("");
|
|
2785
|
+
setSearchCount(0);
|
|
2786
|
+
setSearchCurrent(0);
|
|
2787
|
+
jumpRef.current?.disarmSearch();
|
|
2788
|
+
setHighlight("");
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
}, [transcriptCols, searchQuery, searchOpen, setHighlight]);
|
|
2792
|
+
useInput((input, key, event) => {
|
|
2793
|
+
if (key.ctrl || key.meta)
|
|
2794
|
+
return;
|
|
2795
|
+
if (input === "q") {
|
|
2796
|
+
handleExitTranscript();
|
|
2797
|
+
event.stopImmediatePropagation();
|
|
2798
|
+
return;
|
|
2799
|
+
}
|
|
2800
|
+
if (input === "[" && !dumpMode) {
|
|
2801
|
+
setDumpMode(true);
|
|
2802
|
+
setShowAllInTranscript(true);
|
|
2803
|
+
event.stopImmediatePropagation();
|
|
2804
|
+
} else if (input === "v") {
|
|
2805
|
+
event.stopImmediatePropagation();
|
|
2806
|
+
if (editorRenderingRef.current)
|
|
2807
|
+
return;
|
|
2808
|
+
editorRenderingRef.current = true;
|
|
2809
|
+
const gen = editorGenRef.current;
|
|
2810
|
+
const setStatus = (s) => {
|
|
2811
|
+
if (gen !== editorGenRef.current)
|
|
2812
|
+
return;
|
|
2813
|
+
clearTimeout(editorTimerRef.current);
|
|
2814
|
+
setEditorStatus(s);
|
|
2815
|
+
};
|
|
2816
|
+
setStatus(`rendering ${deferredMessages.length} messages…`);
|
|
2817
|
+
(async () => {
|
|
2818
|
+
try {
|
|
2819
|
+
const w = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
2820
|
+
const raw = await renderMessagesToPlainText(deferredMessages, tools, w);
|
|
2821
|
+
const text = raw.replace(/[ \t]+$/gm, "");
|
|
2822
|
+
const path = join(tmpdir(), `cc-transcript-${Date.now()}.txt`);
|
|
2823
|
+
await writeFile(path, text);
|
|
2824
|
+
const opened = openFileInExternalEditor(path);
|
|
2825
|
+
setStatus(opened ? `opening ${path}` : `wrote ${path} · no $VISUAL/$EDITOR set`);
|
|
2826
|
+
} catch (e) {
|
|
2827
|
+
setStatus(`render failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
2828
|
+
}
|
|
2829
|
+
editorRenderingRef.current = false;
|
|
2830
|
+
if (gen !== editorGenRef.current)
|
|
2831
|
+
return;
|
|
2832
|
+
editorTimerRef.current = setTimeout((s) => s(""), 4000, setEditorStatus);
|
|
2833
|
+
})();
|
|
2834
|
+
}
|
|
2835
|
+
}, {
|
|
2836
|
+
isActive: screen === "transcript" && virtualScrollActive && !searchOpen
|
|
2837
|
+
});
|
|
2838
|
+
const inTranscript = screen === "transcript" && virtualScrollActive;
|
|
2839
|
+
useEffect(() => {
|
|
2840
|
+
if (!inTranscript) {
|
|
2841
|
+
setSearchQuery("");
|
|
2842
|
+
setSearchCount(0);
|
|
2843
|
+
setSearchCurrent(0);
|
|
2844
|
+
setSearchOpen(false);
|
|
2845
|
+
editorGenRef.current++;
|
|
2846
|
+
clearTimeout(editorTimerRef.current);
|
|
2847
|
+
setDumpMode(false);
|
|
2848
|
+
setEditorStatus("");
|
|
2849
|
+
}
|
|
2850
|
+
}, [inTranscript]);
|
|
2851
|
+
useEffect(() => {
|
|
2852
|
+
setHighlight(inTranscript ? searchQuery : "");
|
|
2853
|
+
if (!inTranscript)
|
|
2854
|
+
setPositions(null);
|
|
2855
|
+
}, [inTranscript, searchQuery, setHighlight, setPositions]);
|
|
2856
|
+
const globalKeybindingProps = {
|
|
2857
|
+
screen,
|
|
2858
|
+
setScreen,
|
|
2859
|
+
showAllInTranscript,
|
|
2860
|
+
setShowAllInTranscript,
|
|
2861
|
+
messageCount: messages.length,
|
|
2862
|
+
onEnterTranscript: handleEnterTranscript,
|
|
2863
|
+
onExitTranscript: handleExitTranscript,
|
|
2864
|
+
virtualScrollActive,
|
|
2865
|
+
searchBarOpen: searchOpen
|
|
2866
|
+
};
|
|
2867
|
+
const transcriptMessages = frozenTranscriptState ? deferredMessages.slice(0, frozenTranscriptState.messagesLength) : deferredMessages;
|
|
2868
|
+
const transcriptStreamingToolUses = frozenTranscriptState ? streamingToolUses.slice(0, frozenTranscriptState.streamingToolUsesLength) : streamingToolUses;
|
|
2869
|
+
useBackgroundTaskNavigation({
|
|
2870
|
+
onOpenBackgroundTasks: isShowingLocalJSXCommand ? undefined : () => setShowBashesDialog(true)
|
|
2871
|
+
});
|
|
2872
|
+
useTeammateViewAutoExit();
|
|
2873
|
+
if (screen === "transcript") {
|
|
2874
|
+
const transcriptScrollRef = isFullscreenEnvEnabled() && !disableVirtualScroll && !dumpMode ? scrollRef : undefined;
|
|
2875
|
+
const transcriptMessagesElement = jsxDEV_7x81h0kn(Messages, {
|
|
2876
|
+
messages: transcriptMessages,
|
|
2877
|
+
tools,
|
|
2878
|
+
commands,
|
|
2879
|
+
verbose: true,
|
|
2880
|
+
toolJSX: null,
|
|
2881
|
+
toolUseConfirmQueue: [],
|
|
2882
|
+
inProgressToolUseIDs,
|
|
2883
|
+
isMessageSelectorVisible: false,
|
|
2884
|
+
conversationId,
|
|
2885
|
+
screen,
|
|
2886
|
+
agentDefinitions,
|
|
2887
|
+
streamingToolUses: transcriptStreamingToolUses,
|
|
2888
|
+
showAllInTranscript,
|
|
2889
|
+
onOpenRateLimitOptions: handleOpenRateLimitOptions,
|
|
2890
|
+
isLoading,
|
|
2891
|
+
hidePastThinking: true,
|
|
2892
|
+
streamingThinking,
|
|
2893
|
+
scrollRef: transcriptScrollRef,
|
|
2894
|
+
jumpRef,
|
|
2895
|
+
onSearchMatchesChange,
|
|
2896
|
+
scanElement,
|
|
2897
|
+
setPositions,
|
|
2898
|
+
disableRenderCap: dumpMode
|
|
2899
|
+
}, undefined, false, undefined, this);
|
|
2900
|
+
const transcriptToolJSX = toolJSX && jsxDEV_7x81h0kn(Box, {
|
|
2901
|
+
flexDirection: "column",
|
|
2902
|
+
width: "100%",
|
|
2903
|
+
children: toolJSX.jsx
|
|
2904
|
+
}, undefined, false, undefined, this);
|
|
2905
|
+
const transcriptReturn = jsxDEV_7x81h0kn(KeybindingSetup, {
|
|
2906
|
+
children: [
|
|
2907
|
+
jsxDEV_7x81h0kn(AnimatedTerminalTitle, {
|
|
2908
|
+
isAnimating: titleIsAnimating,
|
|
2909
|
+
title: terminalTitle,
|
|
2910
|
+
disabled: titleDisabled,
|
|
2911
|
+
noPrefix: showStatusInTerminalTab
|
|
2912
|
+
}, undefined, false, undefined, this),
|
|
2913
|
+
jsxDEV_7x81h0kn(GlobalKeybindingHandlers, {
|
|
2914
|
+
...globalKeybindingProps
|
|
2915
|
+
}, undefined, false, undefined, this),
|
|
2916
|
+
null,
|
|
2917
|
+
jsxDEV_7x81h0kn(CommandKeybindingHandlers, {
|
|
2918
|
+
onSubmit,
|
|
2919
|
+
isActive: !toolJSX?.isLocalJSXCommand
|
|
2920
|
+
}, undefined, false, undefined, this),
|
|
2921
|
+
transcriptScrollRef ? jsxDEV_7x81h0kn(ScrollKeybindingHandler, {
|
|
2922
|
+
scrollRef,
|
|
2923
|
+
isActive: focusedInputDialog !== "ultraplan-choice",
|
|
2924
|
+
isModal: !searchOpen,
|
|
2925
|
+
onScroll: () => jumpRef.current?.disarmSearch()
|
|
2926
|
+
}, undefined, false, undefined, this) : null,
|
|
2927
|
+
jsxDEV_7x81h0kn(CancelRequestHandler, {
|
|
2928
|
+
...cancelRequestProps
|
|
2929
|
+
}, undefined, false, undefined, this),
|
|
2930
|
+
transcriptScrollRef ? jsxDEV_7x81h0kn(FullscreenLayout, {
|
|
2931
|
+
scrollRef,
|
|
2932
|
+
scrollable: jsxDEV_7x81h0kn(Fragment_8vg9x3sq, {
|
|
2933
|
+
children: [
|
|
2934
|
+
transcriptMessagesElement,
|
|
2935
|
+
transcriptToolJSX,
|
|
2936
|
+
jsxDEV_7x81h0kn(SandboxViolationExpandedView, {}, undefined, false, undefined, this)
|
|
2937
|
+
]
|
|
2938
|
+
}, undefined, true, undefined, this),
|
|
2939
|
+
bottom: searchOpen ? jsxDEV_7x81h0kn(TranscriptSearchBar, {
|
|
2940
|
+
jumpRef,
|
|
2941
|
+
initialQuery: "",
|
|
2942
|
+
count: searchCount,
|
|
2943
|
+
current: searchCurrent,
|
|
2944
|
+
onClose: (q) => {
|
|
2945
|
+
setSearchQuery(searchCount > 0 ? q : "");
|
|
2946
|
+
setSearchOpen(false);
|
|
2947
|
+
if (!q) {
|
|
2948
|
+
setSearchCount(0);
|
|
2949
|
+
setSearchCurrent(0);
|
|
2950
|
+
jumpRef.current?.setSearchQuery("");
|
|
2951
|
+
}
|
|
2952
|
+
},
|
|
2953
|
+
onCancel: () => {
|
|
2954
|
+
setSearchOpen(false);
|
|
2955
|
+
jumpRef.current?.setSearchQuery("");
|
|
2956
|
+
jumpRef.current?.setSearchQuery(searchQuery);
|
|
2957
|
+
setHighlight(searchQuery);
|
|
2958
|
+
},
|
|
2959
|
+
setHighlight
|
|
2960
|
+
}, undefined, false, undefined, this) : jsxDEV_7x81h0kn(TranscriptModeFooter, {
|
|
2961
|
+
showAllInTranscript,
|
|
2962
|
+
virtualScroll: true,
|
|
2963
|
+
status: editorStatus || undefined,
|
|
2964
|
+
searchBadge: searchQuery && searchCount > 0 ? {
|
|
2965
|
+
current: searchCurrent,
|
|
2966
|
+
count: searchCount
|
|
2967
|
+
} : undefined
|
|
2968
|
+
}, undefined, false, undefined, this)
|
|
2969
|
+
}, undefined, false, undefined, this) : jsxDEV_7x81h0kn(Fragment_8vg9x3sq, {
|
|
2970
|
+
children: [
|
|
2971
|
+
transcriptMessagesElement,
|
|
2972
|
+
transcriptToolJSX,
|
|
2973
|
+
jsxDEV_7x81h0kn(SandboxViolationExpandedView, {}, undefined, false, undefined, this),
|
|
2974
|
+
jsxDEV_7x81h0kn(TranscriptModeFooter, {
|
|
2975
|
+
showAllInTranscript,
|
|
2976
|
+
virtualScroll: false,
|
|
2977
|
+
suppressShowAll: dumpMode,
|
|
2978
|
+
status: editorStatus || undefined
|
|
2979
|
+
}, undefined, false, undefined, this)
|
|
2980
|
+
]
|
|
2981
|
+
}, undefined, true, undefined, this)
|
|
2982
|
+
]
|
|
2983
|
+
}, undefined, true, undefined, this);
|
|
2984
|
+
if (transcriptScrollRef) {
|
|
2985
|
+
return jsxDEV_7x81h0kn(AlternateScreen, {
|
|
2986
|
+
mouseTracking: isMouseTrackingEnabled(),
|
|
2987
|
+
children: transcriptReturn
|
|
2988
|
+
}, undefined, false, undefined, this);
|
|
2989
|
+
}
|
|
2990
|
+
return transcriptReturn;
|
|
2991
|
+
}
|
|
2992
|
+
const viewedTask = viewingAgentTaskId ? tasks[viewingAgentTaskId] : undefined;
|
|
2993
|
+
const viewedTeammateTask = viewedTask && isInProcessTeammateTask(viewedTask) ? viewedTask : undefined;
|
|
2994
|
+
const viewedAgentTask = viewedTeammateTask ?? (viewedTask && isLocalAgentTask(viewedTask) ? viewedTask : undefined);
|
|
2995
|
+
const usesSyncMessages = showStreamingText || !isLoading;
|
|
2996
|
+
const displayedMessages = viewedAgentTask ? viewedAgentTask.messages ?? [] : usesSyncMessages ? messages : deferredMessages;
|
|
2997
|
+
const placeholderText = userInputOnProcessing && !viewedAgentTask && displayedMessages.length <= userInputBaselineRef.current ? userInputOnProcessing : undefined;
|
|
2998
|
+
const toolPermissionOverlay = focusedInputDialog === "tool-permission" ? jsxDEV_7x81h0kn(PermissionRequest, {
|
|
2999
|
+
onDone: () => setToolUseConfirmQueue(([_, ...tail]) => tail),
|
|
3000
|
+
onReject: handleQueuedCommandOnCancel,
|
|
3001
|
+
toolUseConfirm: toolUseConfirmQueue[0],
|
|
3002
|
+
toolUseContext: getToolUseContext(messages, messages, abortController ?? createAbortController(), mainLoopModel),
|
|
3003
|
+
verbose,
|
|
3004
|
+
workerBadge: toolUseConfirmQueue[0]?.workerBadge,
|
|
3005
|
+
setStickyFooter: isFullscreenEnvEnabled() ? setPermissionStickyFooter : undefined
|
|
3006
|
+
}, toolUseConfirmQueue[0]?.toolUseID, false, undefined, this) : null;
|
|
3007
|
+
const companionNarrow = transcriptCols < MIN_COLS_FOR_FULL_SPRITE;
|
|
3008
|
+
const companionVisible = !toolJSX?.shouldHidePromptInput && !focusedInputDialog && !showBashesDialog;
|
|
3009
|
+
const toolJsxCentered = isFullscreenEnvEnabled() && toolJSX?.isLocalJSXCommand === true;
|
|
3010
|
+
const centeredModal = toolJsxCentered ? toolJSX.jsx : null;
|
|
3011
|
+
const mainReturn = jsxDEV_7x81h0kn(KeybindingSetup, {
|
|
3012
|
+
children: [
|
|
3013
|
+
jsxDEV_7x81h0kn(AnimatedTerminalTitle, {
|
|
3014
|
+
isAnimating: titleIsAnimating,
|
|
3015
|
+
title: terminalTitle,
|
|
3016
|
+
disabled: titleDisabled,
|
|
3017
|
+
noPrefix: showStatusInTerminalTab
|
|
3018
|
+
}, undefined, false, undefined, this),
|
|
3019
|
+
jsxDEV_7x81h0kn(GlobalKeybindingHandlers, {
|
|
3020
|
+
...globalKeybindingProps
|
|
3021
|
+
}, undefined, false, undefined, this),
|
|
3022
|
+
null,
|
|
3023
|
+
jsxDEV_7x81h0kn(CommandKeybindingHandlers, {
|
|
3024
|
+
onSubmit,
|
|
3025
|
+
isActive: !toolJSX?.isLocalJSXCommand
|
|
3026
|
+
}, undefined, false, undefined, this),
|
|
3027
|
+
jsxDEV_7x81h0kn(ScrollKeybindingHandler, {
|
|
3028
|
+
scrollRef,
|
|
3029
|
+
isActive: isFullscreenEnvEnabled() && (centeredModal != null || !focusedInputDialog || focusedInputDialog === "tool-permission"),
|
|
3030
|
+
onScroll: centeredModal || toolPermissionOverlay || viewedAgentTask ? undefined : composedOnScroll
|
|
3031
|
+
}, undefined, false, undefined, this),
|
|
3032
|
+
null,
|
|
3033
|
+
jsxDEV_7x81h0kn(CancelRequestHandler, {
|
|
3034
|
+
...cancelRequestProps
|
|
3035
|
+
}, undefined, false, undefined, this),
|
|
3036
|
+
jsxDEV_7x81h0kn(MCPConnectionManager, {
|
|
3037
|
+
dynamicMcpConfig,
|
|
3038
|
+
isStrictMcpConfig: strictMcpConfig,
|
|
3039
|
+
children: jsxDEV_7x81h0kn(FullscreenLayout, {
|
|
3040
|
+
scrollRef,
|
|
3041
|
+
overlay: toolPermissionOverlay,
|
|
3042
|
+
bottomFloat: undefined,
|
|
3043
|
+
modal: centeredModal,
|
|
3044
|
+
modalScrollRef,
|
|
3045
|
+
dividerYRef,
|
|
3046
|
+
hidePill: !!viewedAgentTask,
|
|
3047
|
+
hideSticky: !!viewedTeammateTask,
|
|
3048
|
+
newMessageCount: unseenDivider?.count ?? 0,
|
|
3049
|
+
onPillClick: () => {
|
|
3050
|
+
setCursor(null);
|
|
3051
|
+
jumpToNew(scrollRef.current);
|
|
3052
|
+
},
|
|
3053
|
+
scrollable: jsxDEV_7x81h0kn(Fragment_8vg9x3sq, {
|
|
3054
|
+
children: [
|
|
3055
|
+
jsxDEV_7x81h0kn(TeammateViewHeader, {}, undefined, false, undefined, this),
|
|
3056
|
+
jsxDEV_7x81h0kn(Messages, {
|
|
3057
|
+
messages: displayedMessages,
|
|
3058
|
+
tools,
|
|
3059
|
+
commands,
|
|
3060
|
+
verbose,
|
|
3061
|
+
toolJSX,
|
|
3062
|
+
toolUseConfirmQueue,
|
|
3063
|
+
inProgressToolUseIDs: viewedTeammateTask ? viewedTeammateTask.inProgressToolUseIDs ?? new Set : inProgressToolUseIDs,
|
|
3064
|
+
isMessageSelectorVisible,
|
|
3065
|
+
conversationId,
|
|
3066
|
+
screen,
|
|
3067
|
+
streamingToolUses,
|
|
3068
|
+
showAllInTranscript,
|
|
3069
|
+
agentDefinitions,
|
|
3070
|
+
onOpenRateLimitOptions: handleOpenRateLimitOptions,
|
|
3071
|
+
isLoading,
|
|
3072
|
+
streamingText: isLoading && !viewedAgentTask ? visibleStreamingText : null,
|
|
3073
|
+
isBriefOnly: viewedAgentTask ? false : isBriefOnly,
|
|
3074
|
+
unseenDivider: viewedAgentTask ? undefined : unseenDivider,
|
|
3075
|
+
scrollRef: isFullscreenEnvEnabled() ? scrollRef : undefined,
|
|
3076
|
+
trackStickyPrompt: isFullscreenEnvEnabled() ? true : undefined,
|
|
3077
|
+
cursor,
|
|
3078
|
+
setCursor,
|
|
3079
|
+
cursorNavRef
|
|
3080
|
+
}, undefined, false, undefined, this),
|
|
3081
|
+
jsxDEV_7x81h0kn(AwsAuthStatusBox, {}, undefined, false, undefined, this),
|
|
3082
|
+
!disabled && placeholderText && !centeredModal && jsxDEV_7x81h0kn(UserTextMessage, {
|
|
3083
|
+
param: {
|
|
3084
|
+
text: placeholderText,
|
|
3085
|
+
type: "text"
|
|
3086
|
+
},
|
|
3087
|
+
addMargin: true,
|
|
3088
|
+
verbose
|
|
3089
|
+
}, undefined, false, undefined, this),
|
|
3090
|
+
toolJSX && !(toolJSX.isLocalJSXCommand && toolJSX.isImmediate) && !toolJsxCentered && jsxDEV_7x81h0kn(Box, {
|
|
3091
|
+
flexDirection: "column",
|
|
3092
|
+
width: "100%",
|
|
3093
|
+
children: toolJSX.jsx
|
|
3094
|
+
}, undefined, false, undefined, this),
|
|
3095
|
+
false,
|
|
3096
|
+
null,
|
|
3097
|
+
jsxDEV_7x81h0kn(Box, {
|
|
3098
|
+
flexGrow: 1
|
|
3099
|
+
}, undefined, false, undefined, this),
|
|
3100
|
+
showSpinner && jsxDEV_7x81h0kn(SpinnerWithVerb, {
|
|
3101
|
+
mode: streamMode,
|
|
3102
|
+
spinnerTip,
|
|
3103
|
+
responseLengthRef,
|
|
3104
|
+
apiMetricsRef,
|
|
3105
|
+
overrideMessage: spinnerMessage,
|
|
3106
|
+
spinnerSuffix: stopHookSpinnerSuffix,
|
|
3107
|
+
verbose,
|
|
3108
|
+
loadingStartTimeRef,
|
|
3109
|
+
totalPausedMsRef,
|
|
3110
|
+
pauseStartTimeRef,
|
|
3111
|
+
overrideColor: spinnerColor,
|
|
3112
|
+
overrideShimmerColor: spinnerShimmerColor,
|
|
3113
|
+
hasActiveTools: inProgressToolUseIDs.size > 0,
|
|
3114
|
+
leaderIsIdle: !isLoading
|
|
3115
|
+
}, undefined, false, undefined, this),
|
|
3116
|
+
!showSpinner && !isLoading && !userInputOnProcessing && !hasRunningTeammates && isBriefOnly && !viewedAgentTask && jsxDEV_7x81h0kn(BriefIdleStatus, {}, undefined, false, undefined, this),
|
|
3117
|
+
isFullscreenEnvEnabled() && jsxDEV_7x81h0kn(PromptInputQueuedCommands, {}, undefined, false, undefined, this)
|
|
3118
|
+
]
|
|
3119
|
+
}, undefined, true, undefined, this),
|
|
3120
|
+
bottom: jsxDEV_7x81h0kn(Box, {
|
|
3121
|
+
flexDirection: "row",
|
|
3122
|
+
width: "100%",
|
|
3123
|
+
alignItems: "flex-end",
|
|
3124
|
+
children: [
|
|
3125
|
+
null,
|
|
3126
|
+
jsxDEV_7x81h0kn(Box, {
|
|
3127
|
+
flexDirection: "column",
|
|
3128
|
+
flexGrow: 1,
|
|
3129
|
+
children: [
|
|
3130
|
+
permissionStickyFooter,
|
|
3131
|
+
toolJSX?.isLocalJSXCommand && toolJSX.isImmediate && !toolJsxCentered && jsxDEV_7x81h0kn(Box, {
|
|
3132
|
+
flexDirection: "column",
|
|
3133
|
+
width: "100%",
|
|
3134
|
+
children: toolJSX.jsx
|
|
3135
|
+
}, undefined, false, undefined, this),
|
|
3136
|
+
!showSpinner && !toolJSX?.isLocalJSXCommand && showExpandedTodos && tasksV2 && tasksV2.length > 0 && jsxDEV_7x81h0kn(Box, {
|
|
3137
|
+
width: "100%",
|
|
3138
|
+
flexDirection: "column",
|
|
3139
|
+
children: jsxDEV_7x81h0kn(TaskListV2, {
|
|
3140
|
+
tasks: tasksV2,
|
|
3141
|
+
isStandalone: true
|
|
3142
|
+
}, undefined, false, undefined, this)
|
|
3143
|
+
}, undefined, false, undefined, this),
|
|
3144
|
+
focusedInputDialog === "sandbox-permission" && jsxDEV_7x81h0kn(SandboxPermissionRequest, {
|
|
3145
|
+
hostPattern: sandboxPermissionRequestQueue[0].hostPattern,
|
|
3146
|
+
onUserResponse: (response) => {
|
|
3147
|
+
const {
|
|
3148
|
+
allow,
|
|
3149
|
+
persistToSettings
|
|
3150
|
+
} = response;
|
|
3151
|
+
const currentRequest = sandboxPermissionRequestQueue[0];
|
|
3152
|
+
if (!currentRequest)
|
|
3153
|
+
return;
|
|
3154
|
+
const approvedHost = currentRequest.hostPattern.host;
|
|
3155
|
+
if (persistToSettings) {
|
|
3156
|
+
const update = {
|
|
3157
|
+
type: "addRules",
|
|
3158
|
+
rules: [{
|
|
3159
|
+
toolName: WEB_FETCH_TOOL_NAME,
|
|
3160
|
+
ruleContent: `domain:${approvedHost}`
|
|
3161
|
+
}],
|
|
3162
|
+
behavior: allow ? "allow" : "deny",
|
|
3163
|
+
destination: "localSettings"
|
|
3164
|
+
};
|
|
3165
|
+
setAppState((prev) => ({
|
|
3166
|
+
...prev,
|
|
3167
|
+
toolPermissionContext: applyPermissionUpdate(prev.toolPermissionContext, update)
|
|
3168
|
+
}));
|
|
3169
|
+
persistPermissionUpdate(update);
|
|
3170
|
+
SandboxManager.refreshConfig();
|
|
3171
|
+
}
|
|
3172
|
+
setSandboxPermissionRequestQueue((queue) => {
|
|
3173
|
+
queue.filter((item) => item.hostPattern.host === approvedHost).forEach((item) => item.resolvePromise(allow));
|
|
3174
|
+
return queue.filter((item) => item.hostPattern.host !== approvedHost);
|
|
3175
|
+
});
|
|
3176
|
+
const cleanups = sandboxBridgeCleanupRef.current.get(approvedHost);
|
|
3177
|
+
if (cleanups) {
|
|
3178
|
+
for (const fn of cleanups) {
|
|
3179
|
+
fn();
|
|
3180
|
+
}
|
|
3181
|
+
sandboxBridgeCleanupRef.current.delete(approvedHost);
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
}, sandboxPermissionRequestQueue[0].hostPattern.host, false, undefined, this),
|
|
3185
|
+
focusedInputDialog === "prompt" && jsxDEV_7x81h0kn(PromptDialog, {
|
|
3186
|
+
title: promptQueue[0].title,
|
|
3187
|
+
toolInputSummary: promptQueue[0].toolInputSummary,
|
|
3188
|
+
request: promptQueue[0].request,
|
|
3189
|
+
onRespond: (selectedKey) => {
|
|
3190
|
+
const item = promptQueue[0];
|
|
3191
|
+
if (!item)
|
|
3192
|
+
return;
|
|
3193
|
+
item.resolve({
|
|
3194
|
+
prompt_response: item.request.prompt,
|
|
3195
|
+
selected: selectedKey
|
|
3196
|
+
});
|
|
3197
|
+
setPromptQueue(([, ...tail]) => tail);
|
|
3198
|
+
},
|
|
3199
|
+
onAbort: () => {
|
|
3200
|
+
const item = promptQueue[0];
|
|
3201
|
+
if (!item)
|
|
3202
|
+
return;
|
|
3203
|
+
item.reject(new Error("Prompt cancelled by user"));
|
|
3204
|
+
setPromptQueue(([, ...tail]) => tail);
|
|
3205
|
+
}
|
|
3206
|
+
}, promptQueue[0].request.prompt, false, undefined, this),
|
|
3207
|
+
pendingWorkerRequest && jsxDEV_7x81h0kn(WorkerPendingPermission, {
|
|
3208
|
+
toolName: pendingWorkerRequest.toolName,
|
|
3209
|
+
description: pendingWorkerRequest.description
|
|
3210
|
+
}, undefined, false, undefined, this),
|
|
3211
|
+
pendingSandboxRequest && jsxDEV_7x81h0kn(WorkerPendingPermission, {
|
|
3212
|
+
toolName: "Network Access",
|
|
3213
|
+
description: `Waiting for leader to approve network access to ${pendingSandboxRequest.host}`
|
|
3214
|
+
}, undefined, false, undefined, this),
|
|
3215
|
+
focusedInputDialog === "worker-sandbox-permission" && jsxDEV_7x81h0kn(SandboxPermissionRequest, {
|
|
3216
|
+
hostPattern: {
|
|
3217
|
+
host: workerSandboxPermissions.queue[0].host,
|
|
3218
|
+
port: undefined
|
|
3219
|
+
},
|
|
3220
|
+
onUserResponse: (response) => {
|
|
3221
|
+
const {
|
|
3222
|
+
allow,
|
|
3223
|
+
persistToSettings
|
|
3224
|
+
} = response;
|
|
3225
|
+
const currentRequest = workerSandboxPermissions.queue[0];
|
|
3226
|
+
if (!currentRequest)
|
|
3227
|
+
return;
|
|
3228
|
+
const approvedHost = currentRequest.host;
|
|
3229
|
+
sendSandboxPermissionResponseViaMailbox(currentRequest.workerName, currentRequest.requestId, approvedHost, allow, teamContext?.teamName);
|
|
3230
|
+
if (persistToSettings && allow) {
|
|
3231
|
+
const update = {
|
|
3232
|
+
type: "addRules",
|
|
3233
|
+
rules: [{
|
|
3234
|
+
toolName: WEB_FETCH_TOOL_NAME,
|
|
3235
|
+
ruleContent: `domain:${approvedHost}`
|
|
3236
|
+
}],
|
|
3237
|
+
behavior: "allow",
|
|
3238
|
+
destination: "localSettings"
|
|
3239
|
+
};
|
|
3240
|
+
setAppState((prev) => ({
|
|
3241
|
+
...prev,
|
|
3242
|
+
toolPermissionContext: applyPermissionUpdate(prev.toolPermissionContext, update)
|
|
3243
|
+
}));
|
|
3244
|
+
persistPermissionUpdate(update);
|
|
3245
|
+
SandboxManager.refreshConfig();
|
|
3246
|
+
}
|
|
3247
|
+
setAppState((prev) => ({
|
|
3248
|
+
...prev,
|
|
3249
|
+
workerSandboxPermissions: {
|
|
3250
|
+
...prev.workerSandboxPermissions,
|
|
3251
|
+
queue: prev.workerSandboxPermissions.queue.slice(1)
|
|
3252
|
+
}
|
|
3253
|
+
}));
|
|
3254
|
+
}
|
|
3255
|
+
}, workerSandboxPermissions.queue[0].requestId, false, undefined, this),
|
|
3256
|
+
focusedInputDialog === "elicitation" && jsxDEV_7x81h0kn(ElicitationDialog, {
|
|
3257
|
+
event: elicitation.queue[0],
|
|
3258
|
+
onResponse: (action, content) => {
|
|
3259
|
+
const currentRequest = elicitation.queue[0];
|
|
3260
|
+
if (!currentRequest)
|
|
3261
|
+
return;
|
|
3262
|
+
currentRequest.respond({
|
|
3263
|
+
action,
|
|
3264
|
+
content
|
|
3265
|
+
});
|
|
3266
|
+
const isUrlAccept = currentRequest.params.mode === "url" && action === "accept";
|
|
3267
|
+
if (!isUrlAccept) {
|
|
3268
|
+
setAppState((prev) => ({
|
|
3269
|
+
...prev,
|
|
3270
|
+
elicitation: {
|
|
3271
|
+
queue: prev.elicitation.queue.slice(1)
|
|
3272
|
+
}
|
|
3273
|
+
}));
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3276
|
+
onWaitingDismiss: (action) => {
|
|
3277
|
+
const currentRequest = elicitation.queue[0];
|
|
3278
|
+
setAppState((prev) => ({
|
|
3279
|
+
...prev,
|
|
3280
|
+
elicitation: {
|
|
3281
|
+
queue: prev.elicitation.queue.slice(1)
|
|
3282
|
+
}
|
|
3283
|
+
}));
|
|
3284
|
+
currentRequest?.onWaitingDismiss?.(action);
|
|
3285
|
+
}
|
|
3286
|
+
}, elicitation.queue[0].serverName + ":" + String(elicitation.queue[0].requestId), false, undefined, this),
|
|
3287
|
+
focusedInputDialog === "cost" && jsxDEV_7x81h0kn(CostThresholdDialog, {
|
|
3288
|
+
onDone: () => {
|
|
3289
|
+
setShowCostDialog(false);
|
|
3290
|
+
setHaveShownCostDialog(true);
|
|
3291
|
+
saveGlobalConfig((current) => ({
|
|
3292
|
+
...current,
|
|
3293
|
+
hasAcknowledgedCostThreshold: true
|
|
3294
|
+
}));
|
|
3295
|
+
logEvent("tengu_cost_threshold_acknowledged", {});
|
|
3296
|
+
}
|
|
3297
|
+
}, undefined, false, undefined, this),
|
|
3298
|
+
focusedInputDialog === "idle-return" && idleReturnPending && jsxDEV_7x81h0kn(IdleReturnDialog, {
|
|
3299
|
+
idleMinutes: idleReturnPending.idleMinutes,
|
|
3300
|
+
totalInputTokens: getTotalInputTokens(),
|
|
3301
|
+
onDone: async (action) => {
|
|
3302
|
+
const pending = idleReturnPending;
|
|
3303
|
+
setIdleReturnPending(null);
|
|
3304
|
+
logEvent("tengu_idle_return_action", {
|
|
3305
|
+
action,
|
|
3306
|
+
idleMinutes: Math.round(pending.idleMinutes),
|
|
3307
|
+
messageCount: messagesRef.current.length,
|
|
3308
|
+
totalInputTokens: getTotalInputTokens()
|
|
3309
|
+
});
|
|
3310
|
+
if (action === "dismiss") {
|
|
3311
|
+
setInputValue(pending.input);
|
|
3312
|
+
return;
|
|
3313
|
+
}
|
|
3314
|
+
if (action === "never") {
|
|
3315
|
+
saveGlobalConfig((current) => {
|
|
3316
|
+
if (current.idleReturnDismissed)
|
|
3317
|
+
return current;
|
|
3318
|
+
return {
|
|
3319
|
+
...current,
|
|
3320
|
+
idleReturnDismissed: true
|
|
3321
|
+
};
|
|
3322
|
+
});
|
|
3323
|
+
}
|
|
3324
|
+
if (action === "clear") {
|
|
3325
|
+
const {
|
|
3326
|
+
clearConversation
|
|
3327
|
+
} = await import("../commands/clear/conversation.js");
|
|
3328
|
+
await clearConversation({
|
|
3329
|
+
setMessages,
|
|
3330
|
+
readFileState: readFileState.current,
|
|
3331
|
+
discoveredSkillNames: discoveredSkillNamesRef.current,
|
|
3332
|
+
loadedNestedMemoryPaths: loadedNestedMemoryPathsRef.current,
|
|
3333
|
+
getAppState: () => store.getState(),
|
|
3334
|
+
setAppState,
|
|
3335
|
+
setConversationId
|
|
3336
|
+
});
|
|
3337
|
+
haikuTitleAttemptedRef.current = false;
|
|
3338
|
+
setHaikuTitle(undefined);
|
|
3339
|
+
bashTools.current.clear();
|
|
3340
|
+
bashToolsProcessedIdx.current = 0;
|
|
3341
|
+
}
|
|
3342
|
+
skipIdleCheckRef.current = true;
|
|
3343
|
+
onSubmitRef.current(pending.input, {
|
|
3344
|
+
setCursorOffset: () => {},
|
|
3345
|
+
clearBuffer: () => {},
|
|
3346
|
+
resetHistory: () => {}
|
|
3347
|
+
});
|
|
3348
|
+
}
|
|
3349
|
+
}, undefined, false, undefined, this),
|
|
3350
|
+
focusedInputDialog === "ide-onboarding" && jsxDEV_7x81h0kn(IdeOnboardingDialog, {
|
|
3351
|
+
onDone: () => setShowIdeOnboarding(false),
|
|
3352
|
+
installationStatus: ideInstallationStatus
|
|
3353
|
+
}, undefined, false, undefined, this),
|
|
3354
|
+
false,
|
|
3355
|
+
false,
|
|
3356
|
+
focusedInputDialog === "effort-callout" && jsxDEV_7x81h0kn(EffortCallout, {
|
|
3357
|
+
model: mainLoopModel,
|
|
3358
|
+
onDone: (selection) => {
|
|
3359
|
+
setShowEffortCallout(false);
|
|
3360
|
+
if (selection !== "dismiss") {
|
|
3361
|
+
setAppState((prev) => ({
|
|
3362
|
+
...prev,
|
|
3363
|
+
effortValue: selection
|
|
3364
|
+
}));
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
}, undefined, false, undefined, this),
|
|
3368
|
+
focusedInputDialog === "remote-callout" && jsxDEV_7x81h0kn(RemoteCallout, {
|
|
3369
|
+
onDone: (selection) => {
|
|
3370
|
+
setAppState((prev) => {
|
|
3371
|
+
if (!prev.showRemoteCallout)
|
|
3372
|
+
return prev;
|
|
3373
|
+
return {
|
|
3374
|
+
...prev,
|
|
3375
|
+
showRemoteCallout: false,
|
|
3376
|
+
...selection === "enable" && {
|
|
3377
|
+
replBridgeEnabled: true,
|
|
3378
|
+
replBridgeExplicit: true,
|
|
3379
|
+
replBridgeOutboundOnly: false
|
|
3380
|
+
}
|
|
3381
|
+
};
|
|
3382
|
+
});
|
|
3383
|
+
}
|
|
3384
|
+
}, undefined, false, undefined, this),
|
|
3385
|
+
exitFlow,
|
|
3386
|
+
focusedInputDialog === "plugin-hint" && hintRecommendation && jsxDEV_7x81h0kn(PluginHintMenu, {
|
|
3387
|
+
pluginName: hintRecommendation.pluginName,
|
|
3388
|
+
pluginDescription: hintRecommendation.pluginDescription,
|
|
3389
|
+
marketplaceName: hintRecommendation.marketplaceName,
|
|
3390
|
+
sourceCommand: hintRecommendation.sourceCommand,
|
|
3391
|
+
onResponse: handleHintResponse
|
|
3392
|
+
}, undefined, false, undefined, this),
|
|
3393
|
+
focusedInputDialog === "lsp-recommendation" && lspRecommendation && jsxDEV_7x81h0kn(LspRecommendationMenu, {
|
|
3394
|
+
pluginName: lspRecommendation.pluginName,
|
|
3395
|
+
pluginDescription: lspRecommendation.pluginDescription,
|
|
3396
|
+
fileExtension: lspRecommendation.fileExtension,
|
|
3397
|
+
onResponse: handleLspResponse
|
|
3398
|
+
}, undefined, false, undefined, this),
|
|
3399
|
+
focusedInputDialog === "desktop-upsell" && jsxDEV_7x81h0kn(DesktopUpsellStartup, {
|
|
3400
|
+
onDone: () => setShowDesktopUpsellStartup(false)
|
|
3401
|
+
}, undefined, false, undefined, this),
|
|
3402
|
+
null,
|
|
3403
|
+
null,
|
|
3404
|
+
mrRender(),
|
|
3405
|
+
!toolJSX?.shouldHidePromptInput && !focusedInputDialog && !isExiting && !disabled && !cursor && jsxDEV_7x81h0kn(Fragment_8vg9x3sq, {
|
|
3406
|
+
children: [
|
|
3407
|
+
autoRunIssueReason && jsxDEV_7x81h0kn(AutoRunIssueNotification, {
|
|
3408
|
+
onRun: handleAutoRunIssue,
|
|
3409
|
+
onCancel: handleCancelAutoRunIssue,
|
|
3410
|
+
reason: getAutoRunIssueReasonText(autoRunIssueReason)
|
|
3411
|
+
}, undefined, false, undefined, this),
|
|
3412
|
+
postCompactSurvey.state !== "closed" ? jsxDEV_7x81h0kn(FeedbackSurvey, {
|
|
3413
|
+
state: postCompactSurvey.state,
|
|
3414
|
+
lastResponse: postCompactSurvey.lastResponse,
|
|
3415
|
+
handleSelect: postCompactSurvey.handleSelect,
|
|
3416
|
+
inputValue,
|
|
3417
|
+
setInputValue,
|
|
3418
|
+
onRequestFeedback: handleSurveyRequestFeedback
|
|
3419
|
+
}, undefined, false, undefined, this) : memorySurvey.state !== "closed" ? jsxDEV_7x81h0kn(FeedbackSurvey, {
|
|
3420
|
+
state: memorySurvey.state,
|
|
3421
|
+
lastResponse: memorySurvey.lastResponse,
|
|
3422
|
+
handleSelect: memorySurvey.handleSelect,
|
|
3423
|
+
handleTranscriptSelect: memorySurvey.handleTranscriptSelect,
|
|
3424
|
+
inputValue,
|
|
3425
|
+
setInputValue,
|
|
3426
|
+
onRequestFeedback: handleSurveyRequestFeedback,
|
|
3427
|
+
message: "How well did Claude use its memory? (optional)"
|
|
3428
|
+
}, undefined, false, undefined, this) : jsxDEV_7x81h0kn(FeedbackSurvey, {
|
|
3429
|
+
state: feedbackSurvey.state,
|
|
3430
|
+
lastResponse: feedbackSurvey.lastResponse,
|
|
3431
|
+
handleSelect: feedbackSurvey.handleSelect,
|
|
3432
|
+
handleTranscriptSelect: feedbackSurvey.handleTranscriptSelect,
|
|
3433
|
+
inputValue,
|
|
3434
|
+
setInputValue,
|
|
3435
|
+
onRequestFeedback: didAutoRunIssueRef.current ? undefined : handleSurveyRequestFeedback
|
|
3436
|
+
}, undefined, false, undefined, this),
|
|
3437
|
+
frustrationDetection.state !== "closed" && jsxDEV_7x81h0kn(FeedbackSurvey, {
|
|
3438
|
+
state: frustrationDetection.state,
|
|
3439
|
+
lastResponse: null,
|
|
3440
|
+
handleSelect: () => {},
|
|
3441
|
+
handleTranscriptSelect: frustrationDetection.handleTranscriptSelect,
|
|
3442
|
+
inputValue,
|
|
3443
|
+
setInputValue
|
|
3444
|
+
}, undefined, false, undefined, this),
|
|
3445
|
+
false,
|
|
3446
|
+
showIssueFlagBanner && jsxDEV_7x81h0kn(IssueFlagBanner, {}, undefined, false, undefined, this),
|
|
3447
|
+
jsxDEV_7x81h0kn(PromptInput, {
|
|
3448
|
+
debug,
|
|
3449
|
+
ideSelection,
|
|
3450
|
+
hasSuppressedDialogs: !!hasSuppressedDialogs,
|
|
3451
|
+
isLocalJSXCommandActive: isShowingLocalJSXCommand,
|
|
3452
|
+
getToolUseContext,
|
|
3453
|
+
toolPermissionContext,
|
|
3454
|
+
setToolPermissionContext,
|
|
3455
|
+
apiKeyStatus,
|
|
3456
|
+
commands,
|
|
3457
|
+
agents: agentDefinitions.activeAgents,
|
|
3458
|
+
isLoading,
|
|
3459
|
+
onExit: handleExit,
|
|
3460
|
+
verbose,
|
|
3461
|
+
messages,
|
|
3462
|
+
onAutoUpdaterResult: setAutoUpdaterResult,
|
|
3463
|
+
autoUpdaterResult,
|
|
3464
|
+
input: inputValue,
|
|
3465
|
+
onInputChange: setInputValue,
|
|
3466
|
+
mode: inputMode,
|
|
3467
|
+
onModeChange: setInputMode,
|
|
3468
|
+
stashedPrompt,
|
|
3469
|
+
setStashedPrompt,
|
|
3470
|
+
submitCount,
|
|
3471
|
+
onShowMessageSelector: handleShowMessageSelector,
|
|
3472
|
+
onMessageActionsEnter: undefined,
|
|
3473
|
+
mcpClients,
|
|
3474
|
+
pastedContents,
|
|
3475
|
+
setPastedContents,
|
|
3476
|
+
vimMode,
|
|
3477
|
+
setVimMode,
|
|
3478
|
+
showBashesDialog,
|
|
3479
|
+
setShowBashesDialog,
|
|
3480
|
+
onSubmit,
|
|
3481
|
+
onAgentSubmit,
|
|
3482
|
+
isSearchingHistory,
|
|
3483
|
+
setIsSearchingHistory,
|
|
3484
|
+
helpOpen: isHelpOpen,
|
|
3485
|
+
setHelpOpen: setIsHelpOpen,
|
|
3486
|
+
insertTextRef: undefined,
|
|
3487
|
+
voiceInterimRange: voice.interimRange
|
|
3488
|
+
}, undefined, false, undefined, this),
|
|
3489
|
+
jsxDEV_7x81h0kn(SessionBackgroundHint, {
|
|
3490
|
+
onBackgroundSession: handleBackgroundSession,
|
|
3491
|
+
isLoading
|
|
3492
|
+
}, undefined, false, undefined, this)
|
|
3493
|
+
]
|
|
3494
|
+
}, undefined, true, undefined, this),
|
|
3495
|
+
cursor && jsxDEV_7x81h0kn(MessageActionsBar, {
|
|
3496
|
+
cursor
|
|
3497
|
+
}, undefined, false, undefined, this),
|
|
3498
|
+
focusedInputDialog === "message-selector" && jsxDEV_7x81h0kn(MessageSelector, {
|
|
3499
|
+
messages,
|
|
3500
|
+
preselectedMessage: messageSelectorPreselect,
|
|
3501
|
+
onPreRestore: onCancel,
|
|
3502
|
+
onRestoreCode: async (message) => {
|
|
3503
|
+
await fileHistoryRewind((updater) => {
|
|
3504
|
+
setAppState((prev) => ({
|
|
3505
|
+
...prev,
|
|
3506
|
+
fileHistory: updater(prev.fileHistory)
|
|
3507
|
+
}));
|
|
3508
|
+
}, message.uuid);
|
|
3509
|
+
},
|
|
3510
|
+
onSummarize: async (message, feedback, direction = "from") => {
|
|
3511
|
+
const compactMessages = getMessagesAfterCompactBoundary(messages);
|
|
3512
|
+
const messageIndex = compactMessages.indexOf(message);
|
|
3513
|
+
if (messageIndex === -1) {
|
|
3514
|
+
setMessages((prev) => [...prev, createSystemMessage("That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.", "warning")]);
|
|
3515
|
+
return;
|
|
3516
|
+
}
|
|
3517
|
+
const newAbortController = createAbortController();
|
|
3518
|
+
const context = getToolUseContext(compactMessages, [], newAbortController, mainLoopModel);
|
|
3519
|
+
const appState = context.getAppState();
|
|
3520
|
+
const defaultSysPrompt = await getSystemPrompt(context.options.tools, context.options.mainLoopModel, Array.from(appState.toolPermissionContext.additionalWorkingDirectories.keys()), context.options.mcpClients);
|
|
3521
|
+
const systemPrompt = buildEffectiveSystemPrompt({
|
|
3522
|
+
mainThreadAgentDefinition: undefined,
|
|
3523
|
+
toolUseContext: context,
|
|
3524
|
+
customSystemPrompt: context.options.customSystemPrompt,
|
|
3525
|
+
defaultSystemPrompt: defaultSysPrompt,
|
|
3526
|
+
appendSystemPrompt: context.options.appendSystemPrompt
|
|
3527
|
+
});
|
|
3528
|
+
const [userContext, systemContext] = await Promise.all([getUserContext(), getSystemContext()]);
|
|
3529
|
+
const result = await partialCompactConversation(compactMessages, messageIndex, context, {
|
|
3530
|
+
systemPrompt,
|
|
3531
|
+
userContext,
|
|
3532
|
+
systemContext,
|
|
3533
|
+
toolUseContext: context,
|
|
3534
|
+
forkContextMessages: compactMessages
|
|
3535
|
+
}, feedback, direction);
|
|
3536
|
+
const kept = result.messagesToKeep ?? [];
|
|
3537
|
+
const ordered = direction === "up_to" ? [...result.summaryMessages, ...kept] : [...kept, ...result.summaryMessages];
|
|
3538
|
+
const postCompact = [result.boundaryMarker, ...ordered, ...result.attachments, ...result.hookResults];
|
|
3539
|
+
if (isFullscreenEnvEnabled() && direction === "from") {
|
|
3540
|
+
setMessages((old) => {
|
|
3541
|
+
const rawIdx = old.findIndex((m) => m.uuid === message.uuid);
|
|
3542
|
+
return [...old.slice(0, rawIdx === -1 ? 0 : rawIdx), ...postCompact];
|
|
3543
|
+
});
|
|
3544
|
+
} else {
|
|
3545
|
+
setMessages(postCompact);
|
|
3546
|
+
}
|
|
3547
|
+
if (false) {}
|
|
3548
|
+
setConversationId(randomUUID());
|
|
3549
|
+
runPostCompactCleanup(context.options.querySource);
|
|
3550
|
+
if (direction === "from") {
|
|
3551
|
+
const r = textForResubmit(message);
|
|
3552
|
+
if (r) {
|
|
3553
|
+
setInputValue(r.text);
|
|
3554
|
+
setInputMode(r.mode);
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
const historyShortcut = getShortcutDisplay("app:toggleTranscript", "Global", "ctrl+o");
|
|
3558
|
+
addNotification({
|
|
3559
|
+
key: "summarize-ctrl-o-hint",
|
|
3560
|
+
text: `Conversation summarized (${historyShortcut} for history)`,
|
|
3561
|
+
priority: "medium",
|
|
3562
|
+
timeoutMs: 8000
|
|
3563
|
+
});
|
|
3564
|
+
},
|
|
3565
|
+
onRestoreMessage: handleRestoreMessage,
|
|
3566
|
+
onClose: () => {
|
|
3567
|
+
setIsMessageSelectorVisible(false);
|
|
3568
|
+
setMessageSelectorPreselect(undefined);
|
|
3569
|
+
}
|
|
3570
|
+
}, undefined, false, undefined, this),
|
|
3571
|
+
false
|
|
3572
|
+
]
|
|
3573
|
+
}, undefined, true, undefined, this),
|
|
3574
|
+
null
|
|
3575
|
+
]
|
|
3576
|
+
}, undefined, true, undefined, this)
|
|
3577
|
+
}, undefined, false, undefined, this)
|
|
3578
|
+
}, remountKey, false, undefined, this)
|
|
3579
|
+
]
|
|
3580
|
+
}, undefined, true, undefined, this);
|
|
3581
|
+
if (isFullscreenEnvEnabled()) {
|
|
3582
|
+
return jsxDEV_7x81h0kn(AlternateScreen, {
|
|
3583
|
+
mouseTracking: isMouseTrackingEnabled(),
|
|
3584
|
+
children: mainReturn
|
|
3585
|
+
}, undefined, false, undefined, this);
|
|
3586
|
+
}
|
|
3587
|
+
return mainReturn;
|
|
3588
|
+
}
|