thaddeus 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +14 -5
- package/src/QueryEngine.js +926 -0
- package/src/Task.js +49 -0
- package/src/Tool.js +61 -0
- package/src/assistant/gate.js +5 -0
- package/src/assistant/index.js +106 -0
- package/src/assistant/sessionHistory.js +145 -0
- package/src/bootstrap/state.js +1163 -0
- package/src/bridge/bridgeApi.js +304 -0
- package/src/bridge/bridgeConfig.js +39 -0
- package/src/bridge/bridgeDebug.js +73 -0
- package/src/bridge/bridgeEnabled.js +185 -0
- package/src/bridge/bridgeMain.js +2289 -0
- package/src/bridge/bridgeMessaging.js +353 -0
- package/src/bridge/bridgePermissionCallbacks.js +10 -0
- package/src/bridge/bridgePointer.js +175 -0
- package/src/bridge/bridgeStatusUtil.js +105 -0
- package/src/bridge/bridgeUI.js +411 -0
- package/src/bridge/capacityWake.js +35 -0
- package/src/bridge/codeSessionApi.js +111 -0
- package/src/bridge/createSession.js +273 -0
- package/src/bridge/debugUtils.js +115 -0
- package/src/bridge/envLessBridgeConfig.js +120 -0
- package/src/bridge/flushGate.js +65 -0
- package/src/bridge/inboundAttachments.js +152 -0
- package/src/bridge/inboundMessages.js +63 -0
- package/src/bridge/initReplBridge.js +431 -0
- package/src/bridge/jwtUtils.js +185 -0
- package/src/bridge/peerSessions.js +5 -0
- package/src/bridge/pollConfig.js +85 -0
- package/src/bridge/pollConfigDefaults.js +62 -0
- package/src/bridge/remoteBridgeCore.js +712 -0
- package/src/bridge/replBridge.js +1719 -0
- package/src/bridge/replBridgeHandle.js +30 -0
- package/src/bridge/replBridgeTransport.js +236 -0
- package/src/bridge/sessionIdCompat.js +56 -0
- package/src/bridge/sessionRunner.js +421 -0
- package/src/bridge/trustedDevice.js +170 -0
- package/src/bridge/types.js +9 -0
- package/src/bridge/webhookSanitizer.js +6 -0
- package/src/bridge/workSecret.js +99 -0
- package/src/buddy/CompanionSprite.js +348 -0
- package/src/buddy/companion.js +107 -0
- package/src/buddy/prompt.js +33 -0
- package/src/buddy/sprites.js +488 -0
- package/src/buddy/types.js +90 -0
- package/src/buddy/useBuddyNotification.js +85 -0
- package/src/cli/bg.js +17 -0
- package/src/cli/exit.js +30 -0
- package/src/cli/handlers/agents.js +55 -0
- package/src/cli/handlers/auth.js +249 -0
- package/src/cli/handlers/autoMode.js +128 -0
- package/src/cli/handlers/mcp.js +335 -0
- package/src/cli/handlers/plugins.js +634 -0
- package/src/cli/handlers/templateJobs.js +19 -0
- package/src/cli/handlers/util.js +76 -0
- package/src/cli/ndjsonSafeStringify.js +27 -0
- package/src/cli/print.js +4294 -0
- package/src/cli/remoteIO.js +208 -0
- package/src/cli/structuredIO.js +644 -0
- package/src/cli/transports/HybridTransport.js +233 -0
- package/src/cli/transports/SSETransport.js +538 -0
- package/src/cli/transports/SerialBatchEventUploader.js +224 -0
- package/src/cli/transports/WebSocketTransport.js +613 -0
- package/src/cli/transports/WorkerStateUploader.js +88 -0
- package/src/cli/transports/ccrClient.js +711 -0
- package/src/cli/transports/transportUtils.js +39 -0
- package/src/cli/update.js +314 -0
- package/src/commandCenter/launch.js +39 -0
- package/src/commandCenter/phoneApi.js +168 -0
- package/src/commandCenter/phoneStore.js +159 -0
- package/src/commandCenter/reactorBus.js +130 -0
- package/src/commandCenter/server.js +288 -0
- package/src/commandCenter/server.ts +42 -7
- package/src/commandCenter/tunnel.js +199 -0
- package/src/commands/add-dir/add-dir.js +121 -0
- package/src/commands/add-dir/index.js +8 -0
- package/src/commands/add-dir/validation.js +76 -0
- package/src/commands/advisor.js +88 -0
- package/src/commands/agents/agents.js +10 -0
- package/src/commands/agents/index.js +7 -0
- package/src/commands/agents-platform/index.js +2 -0
- package/src/commands/assistant/index.js +86 -0
- package/src/commands/backup/index.js +31 -0
- package/src/commands/branch/branch.js +205 -0
- package/src/commands/branch/index.js +11 -0
- package/src/commands/bridge/bridge.js +513 -0
- package/src/commands/bridge/index.js +22 -0
- package/src/commands/bridge-kick.js +179 -0
- package/src/commands/brief.js +89 -0
- package/src/commands/btw/btw.js +235 -0
- package/src/commands/btw/index.js +9 -0
- package/src/commands/buddy/buddy.js +100 -0
- package/src/commands/buddy/index.js +11 -0
- package/src/commands/chrome/chrome.js +291 -0
- package/src/commands/chrome/index.js +10 -0
- package/src/commands/clear/caches.js +116 -0
- package/src/commands/clear/clear.js +5 -0
- package/src/commands/clear/conversation.js +189 -0
- package/src/commands/clear/index.js +9 -0
- package/src/commands/color/color.js +58 -0
- package/src/commands/color/index.js +9 -0
- package/src/commands/commit-push-pr.js +137 -0
- package/src/commands/commit.js +80 -0
- package/src/commands/compact/compact.js +194 -0
- package/src/commands/compact/index.js +11 -0
- package/src/commands/config/config.js +6 -0
- package/src/commands/config/index.js +8 -0
- package/src/commands/context/context-noninteractive.js +219 -0
- package/src/commands/context/context.js +45 -0
- package/src/commands/context/index.js +21 -0
- package/src/commands/coordinator.js +34 -0
- package/src/commands/copy/copy.js +366 -0
- package/src/commands/copy/index.js +7 -0
- package/src/commands/cost/cost.js +21 -0
- package/src/commands/cost/index.js +16 -0
- package/src/commands/createMovedToPluginCommand.js +33 -0
- package/src/commands/desktop/desktop.js +6 -0
- package/src/commands/desktop/index.js +22 -0
- package/src/commands/diff/diff.js +6 -0
- package/src/commands/diff/index.js +6 -0
- package/src/commands/doctor/doctor.js +6 -0
- package/src/commands/doctor/index.js +9 -0
- package/src/commands/effort/effort.js +166 -0
- package/src/commands/effort/index.js +11 -0
- package/src/commands/exit/exit.js +32 -0
- package/src/commands/exit/index.js +9 -0
- package/src/commands/export/export.js +87 -0
- package/src/commands/export/index.js +8 -0
- package/src/commands/extra-usage/extra-usage-core.js +99 -0
- package/src/commands/extra-usage/extra-usage-noninteractive.js +13 -0
- package/src/commands/extra-usage/extra-usage.js +15 -0
- package/src/commands/extra-usage/index.js +29 -0
- package/src/commands/fast/fast.js +276 -0
- package/src/commands/fast/index.js +19 -0
- package/src/commands/feedback/feedback.js +11 -0
- package/src/commands/feedback/index.js +20 -0
- package/src/commands/files/files.js +11 -0
- package/src/commands/files/index.js +9 -0
- package/src/commands/force-snip.js +19 -0
- package/src/commands/fork/index.js +67 -0
- package/src/commands/heapdump/heapdump.js +14 -0
- package/src/commands/heapdump/index.js +9 -0
- package/src/commands/help/help.js +6 -0
- package/src/commands/help/index.js +7 -0
- package/src/commands/hooks/hooks.js +12 -0
- package/src/commands/hooks/index.js +8 -0
- package/src/commands/ide/ide.js +615 -0
- package/src/commands/ide/index.js +8 -0
- package/src/commands/init-verifiers.js +258 -0
- package/src/commands/init.js +248 -0
- package/src/commands/insights.js +2554 -0
- package/src/commands/install-github-app/ApiKeyStep.js +230 -0
- package/src/commands/install-github-app/CheckExistingSecretStep.js +194 -0
- package/src/commands/install-github-app/CheckGitHubStep.js +16 -0
- package/src/commands/install-github-app/ChooseRepoStep.js +211 -0
- package/src/commands/install-github-app/CreatingStep.js +53 -0
- package/src/commands/install-github-app/ErrorStep.js +84 -0
- package/src/commands/install-github-app/ExistingWorkflowStep.js +105 -0
- package/src/commands/install-github-app/InstallAppStep.js +97 -0
- package/src/commands/install-github-app/OAuthFlowStep.js +190 -0
- package/src/commands/install-github-app/SuccessStep.js +94 -0
- package/src/commands/install-github-app/WarningsStep.js +71 -0
- package/src/commands/install-github-app/index.js +10 -0
- package/src/commands/install-github-app/install-github-app.js +593 -0
- package/src/commands/install-github-app/setupGitHubActions.js +227 -0
- package/src/commands/install-slack-app/index.js +9 -0
- package/src/commands/install-slack-app/install-slack-app.js +25 -0
- package/src/commands/install.js +198 -0
- package/src/commands/keybindings/index.js +10 -0
- package/src/commands/keybindings/keybindings.js +47 -0
- package/src/commands/login/index.js +21 -0
- package/src/commands/login/login.js +135 -0
- package/src/commands/logout/index.js +11 -0
- package/src/commands/logout/logout.js +75 -0
- package/src/commands/mcp/addCommand.js +183 -0
- package/src/commands/mcp/index.js +9 -0
- package/src/commands/mcp/mcp.js +78 -0
- package/src/commands/mcp/xaaIdpCommand.js +193 -0
- package/src/commands/memories/index.js +9 -0
- package/src/commands/memories/index.ts +12 -0
- package/src/commands/memories/memories.tsx +949 -0
- package/src/commands/memory/index.js +7 -0
- package/src/commands/memory/memory.js +71 -0
- package/src/commands/mobile/index.js +9 -0
- package/src/commands/mobile/mobile.js +279 -0
- package/src/commands/model/index.js +14 -0
- package/src/commands/model/model.js +284 -0
- package/src/commands/output-style/index.js +8 -0
- package/src/commands/output-style/output-style.js +6 -0
- package/src/commands/passes/index.js +17 -0
- package/src/commands/passes/passes.js +23 -0
- package/src/commands/peers/index.js +68 -0
- package/src/commands/permissions/index.js +8 -0
- package/src/commands/permissions/permissions.js +9 -0
- package/src/commands/plan/index.js +8 -0
- package/src/commands/plan/plan.js +116 -0
- package/src/commands/plugin/AddMarketplace.js +96 -0
- package/src/commands/plugin/BrowseMarketplace.js +582 -0
- package/src/commands/plugin/DiscoverPlugins.js +613 -0
- package/src/commands/plugin/ManageMarketplaces.js +583 -0
- package/src/commands/plugin/ManagePlugins.js +1783 -0
- package/src/commands/plugin/PluginErrors.js +124 -0
- package/src/commands/plugin/PluginOptionsDialog.js +367 -0
- package/src/commands/plugin/PluginOptionsFlow.js +97 -0
- package/src/commands/plugin/PluginSettings.js +1041 -0
- package/src/commands/plugin/PluginTrustWarning.js +35 -0
- package/src/commands/plugin/UnifiedInstalledCell.js +616 -0
- package/src/commands/plugin/ValidatePlugin.js +96 -0
- package/src/commands/plugin/index.js +10 -0
- package/src/commands/plugin/parseArgs.js +71 -0
- package/src/commands/plugin/plugin.js +6 -0
- package/src/commands/plugin/pluginDetailsHelpers.js +95 -0
- package/src/commands/plugin/usePagination.js +89 -0
- package/src/commands/pr_comments/index.js +49 -0
- package/src/commands/privacy-settings/index.js +11 -0
- package/src/commands/privacy-settings/privacy-settings.js +55 -0
- package/src/commands/proactive.js +29 -0
- package/src/commands/rate-limit-options/index.js +15 -0
- package/src/commands/rate-limit-options/rate-limit-options.js +213 -0
- package/src/commands/release-notes/index.js +8 -0
- package/src/commands/release-notes/release-notes.js +38 -0
- package/src/commands/reload-plugins/index.js +11 -0
- package/src/commands/reload-plugins/reload-plugins.js +52 -0
- package/src/commands/remote-env/index.js +12 -0
- package/src/commands/remote-env/remote-env.js +6 -0
- package/src/commands/remote-setup/api.js +155 -0
- package/src/commands/remote-setup/index.js +15 -0
- package/src/commands/remote-setup/remote-setup.js +150 -0
- package/src/commands/remoteControlServer/index.js +58 -0
- package/src/commands/rename/generateSessionName.js +58 -0
- package/src/commands/rename/index.js +9 -0
- package/src/commands/rename/rename.js +52 -0
- package/src/commands/resume/index.js +9 -0
- package/src/commands/resume/resume.js +239 -0
- package/src/commands/review/UltrareviewOverageDialog.js +97 -0
- package/src/commands/review/reviewRemote.js +259 -0
- package/src/commands/review/ultrareviewCommand.js +58 -0
- package/src/commands/review/ultrareviewEnabled.js +10 -0
- package/src/commands/review.js +53 -0
- package/src/commands/rewind/index.js +10 -0
- package/src/commands/rewind/rewind.js +7 -0
- package/src/commands/sandbox-toggle/index.js +41 -0
- package/src/commands/sandbox-toggle/sandbox-toggle.js +73 -0
- package/src/commands/security-review.js +231 -0
- package/src/commands/session/index.js +13 -0
- package/src/commands/session/session.js +143 -0
- package/src/commands/skills/index.js +7 -0
- package/src/commands/skills/skills.js +6 -0
- package/src/commands/speak.js +21 -0
- package/src/commands/start-business.js +1575 -0
- package/src/commands/start-business.ts +1581 -0
- package/src/commands/stats/index.js +7 -0
- package/src/commands/stats/stats.js +6 -0
- package/src/commands/status/index.js +8 -0
- package/src/commands/status/status.js +6 -0
- package/src/commands/statusline.js +22 -0
- package/src/commands/stickers/index.js +8 -0
- package/src/commands/stickers/stickers.js +14 -0
- package/src/commands/subscribe-pr.js +131 -0
- package/src/commands/tag/index.js +9 -0
- package/src/commands/tag/tag.js +215 -0
- package/src/commands/tasks/index.js +8 -0
- package/src/commands/tasks/tasks.js +6 -0
- package/src/commands/terminalSetup/index.js +18 -0
- package/src/commands/terminalSetup/terminalSetup.js +491 -0
- package/src/commands/thaddeus-usage/index.js +17 -0
- package/src/commands/theme/index.js +7 -0
- package/src/commands/theme/theme.js +51 -0
- package/src/commands/thinkback/index.js +9 -0
- package/src/commands/thinkback/thinkback.js +528 -0
- package/src/commands/thinkback-play/index.js +13 -0
- package/src/commands/thinkback-play/thinkback-play.js +34 -0
- package/src/commands/torch.js +122 -0
- package/src/commands/ultraplan.js +416 -0
- package/src/commands/upgrade/index.js +12 -0
- package/src/commands/upgrade/upgrade.js +38 -0
- package/src/commands/usage/index.js +7 -0
- package/src/commands/usage/usage.js +6 -0
- package/src/commands/version.js +17 -0
- package/src/commands/vim/index.js +8 -0
- package/src/commands/vim/vim.js +25 -0
- package/src/commands/voice/index.js +13 -0
- package/src/commands/voice/voice.js +44 -0
- package/src/commands/workflows/index.js +123 -0
- package/src/commands.js +614 -0
- package/src/commands.ts +4 -0
- package/src/components/AgentProgressLine.js +112 -0
- package/src/components/AntModelSwitchCallout.js +8 -0
- package/src/components/App.js +46 -0
- package/src/components/ApproveApiKey.js +125 -0
- package/src/components/AutoModeOptInDialog.js +140 -0
- package/src/components/AutoUpdater.js +156 -0
- package/src/components/AutoUpdaterWrapper.js +78 -0
- package/src/components/AwsAuthStatusBox.js +88 -0
- package/src/components/BaseTextInput.js +105 -0
- package/src/components/BashModeProgress.js +49 -0
- package/src/components/BridgeDialog.js +415 -0
- package/src/components/BypassPermissionsModeDialog.js +87 -0
- package/src/components/ChannelDowngradeDialog.js +101 -0
- package/src/components/ClaudeInChromeOnboarding.js +126 -0
- package/src/components/ClaudeMdExternalIncludesDialog.js +137 -0
- package/src/components/ClickableImageRef.js +65 -0
- package/src/components/CompactSummary.js +120 -0
- package/src/components/ConfigurableShortcutHint.js +35 -0
- package/src/components/ConsoleOAuthFlow.js +554 -0
- package/src/components/ContextSuggestions.js +44 -0
- package/src/components/ContextVisualization.js +482 -0
- package/src/components/CoordinatorAgentStatus.js +261 -0
- package/src/components/CostThresholdDialog.js +49 -0
- package/src/components/CtrlOToExpand.js +50 -0
- package/src/components/CustomSelect/SelectMulti.js +150 -0
- package/src/components/CustomSelect/index.js +2 -0
- package/src/components/CustomSelect/option-map.js +32 -0
- package/src/components/CustomSelect/select-input-option.js +426 -0
- package/src/components/CustomSelect/select-option.js +24 -0
- package/src/components/CustomSelect/select.js +518 -0
- package/src/components/CustomSelect/use-multi-select-state.js +214 -0
- package/src/components/CustomSelect/use-select-input.js +170 -0
- package/src/components/CustomSelect/use-select-navigation.js +366 -0
- package/src/components/CustomSelect/use-select-state.js +22 -0
- package/src/components/DesktopHandoff.js +195 -0
- package/src/components/DesktopUpsell/DesktopUpsellStartup.js +174 -0
- package/src/components/DevBar.js +51 -0
- package/src/components/DevChannelsDialog.js +104 -0
- package/src/components/DiagnosticsDisplay.js +91 -0
- package/src/components/EffortCallout.js +264 -0
- package/src/components/EffortIndicator.js +28 -0
- package/src/components/ExitFlow.js +41 -0
- package/src/components/ExportDialog.js +101 -0
- package/src/components/FallbackToolUseErrorMessage.js +116 -0
- package/src/components/FallbackToolUseRejectedMessage.js +17 -0
- package/src/components/FastIcon.js +43 -0
- package/src/components/Feedback.js +369 -0
- package/src/components/FeedbackSurvey/FeedbackSurvey.js +151 -0
- package/src/components/FeedbackSurvey/FeedbackSurveyView.js +104 -0
- package/src/components/FeedbackSurvey/TranscriptSharePrompt.js +84 -0
- package/src/components/FeedbackSurvey/submitTranscriptShare.js +10 -0
- package/src/components/FeedbackSurvey/useDebouncedDigitInput.js +51 -0
- package/src/components/FeedbackSurvey/useFeedbackSurvey.js +258 -0
- package/src/components/FeedbackSurvey/useFrustrationDetection.js +8 -0
- package/src/components/FeedbackSurvey/useMemorySurvey.js +191 -0
- package/src/components/FeedbackSurvey/usePostCompactSurvey.js +202 -0
- package/src/components/FeedbackSurvey/useSurveyState.js +80 -0
- package/src/components/FileEditToolDiff.js +167 -0
- package/src/components/FileEditToolUpdatedMessage.js +112 -0
- package/src/components/FileEditToolUseRejectedMessage.js +158 -0
- package/src/components/FilePathLink.js +35 -0
- package/src/components/FullscreenLayout.js +578 -0
- package/src/components/GlobalSearchDialog.js +340 -0
- package/src/components/HelpV2/Commands.js +66 -0
- package/src/components/HelpV2/General.js +25 -0
- package/src/components/HelpV2/HelpV2.js +186 -0
- package/src/components/HighlightedCode/Fallback.js +193 -0
- package/src/components/HighlightedCode.js +185 -0
- package/src/components/HistorySearchDialog.js +93 -0
- package/src/components/IdeAutoConnectDialog.js +154 -0
- package/src/components/IdeOnboardingDialog.js +175 -0
- package/src/components/IdeStatusIndicator.js +50 -0
- package/src/components/IdleReturnDialog.js +117 -0
- package/src/components/InterruptedByUser.js +16 -0
- package/src/components/InvalidConfigDialog.js +135 -0
- package/src/components/InvalidSettingsDialog.js +85 -0
- package/src/components/KeybindingWarnings.js +55 -0
- package/src/components/LanguagePicker.js +84 -0
- package/src/components/LogSelector.js +1579 -0
- package/src/components/LogoV2/AnimatedAsterisk.js +43 -0
- package/src/components/LogoV2/AnimatedClawd.js +64 -0
- package/src/components/LogoV2/ChannelsNotice.js +262 -0
- package/src/components/LogoV2/Clawd.js +33 -0
- package/src/components/LogoV2/CondensedLogo.js +160 -0
- package/src/components/LogoV2/EmergencyTip.js +48 -0
- package/src/components/LogoV2/Feed.js +85 -0
- package/src/components/LogoV2/FeedColumn.js +55 -0
- package/src/components/LogoV2/GuestPassesUpsell.js +71 -0
- package/src/components/LogoV2/LogoV2.js +565 -0
- package/src/components/LogoV2/Opus1mMergeNotice.js +57 -0
- package/src/components/LogoV2/OverageCreditUpsell.js +161 -0
- package/src/components/LogoV2/VoiceModeNotice.js +71 -0
- package/src/components/LogoV2/WelcomeV2.js +14 -0
- package/src/components/LogoV2/feedConfigs.js +79 -0
- package/src/components/LspRecommendation/LspRecommendationMenu.js +46 -0
- package/src/components/MCPServerApprovalDialog.js +114 -0
- package/src/components/MCPServerDesktopImportDialog.js +206 -0
- package/src/components/MCPServerDialogCopy.js +16 -0
- package/src/components/MCPServerMultiselectDialog.js +134 -0
- package/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +150 -0
- package/src/components/ManagedSettingsSecurityDialog/utils.js +105 -0
- package/src/components/Markdown.js +233 -0
- package/src/components/MarkdownTable.js +280 -0
- package/src/components/MemoryUsageIndicator.js +28 -0
- package/src/components/Message.js +564 -0
- package/src/components/MessageModel.js +37 -0
- package/src/components/MessageResponse.js +73 -0
- package/src/components/MessageRow.js +346 -0
- package/src/components/MessageSelector.js +744 -0
- package/src/components/MessageTimestamp.js +58 -0
- package/src/components/Messages.js +645 -0
- package/src/components/ModelPicker.js +452 -0
- package/src/components/NativeAutoUpdater.js +152 -0
- package/src/components/NotebookEditToolUseRejectedMessage.js +84 -0
- package/src/components/OffscreenFreeze.js +35 -0
- package/src/components/Onboarding.js +174 -0
- package/src/components/OutputStylePicker.js +103 -0
- package/src/components/PackageManagerAutoUpdater.js +99 -0
- package/src/components/Passes/Passes.js +114 -0
- package/src/components/PrBadge.js +91 -0
- package/src/components/PressEnterToContinue.js +16 -0
- package/src/components/PromptInput/HistorySearchInput.js +45 -0
- package/src/components/PromptInput/IssueFlagBanner.js +8 -0
- package/src/components/PromptInput/Notifications.js +220 -0
- package/src/components/PromptInput/PromptInput.js +2014 -0
- package/src/components/PromptInput/PromptInputFooter.js +85 -0
- package/src/components/PromptInput/PromptInputFooterLeftSide.js +408 -0
- package/src/components/PromptInput/PromptInputFooterSuggestions.js +281 -0
- package/src/components/PromptInput/PromptInputHelpMenu.js +380 -0
- package/src/components/PromptInput/PromptInputModeIndicator.js +73 -0
- package/src/components/PromptInput/PromptInputQueuedCommands.js +105 -0
- package/src/components/PromptInput/PromptInputStashNotice.js +21 -0
- package/src/components/PromptInput/SandboxPromptFooterHint.js +66 -0
- package/src/components/PromptInput/ShimmeredInput.js +133 -0
- package/src/components/PromptInput/VoiceIndicator.js +137 -0
- package/src/components/PromptInput/inputModes.js +24 -0
- package/src/components/PromptInput/inputPaste.js +62 -0
- package/src/components/PromptInput/useMaybeTruncateInput.js +33 -0
- package/src/components/PromptInput/usePromptInputPlaceholder.js +53 -0
- package/src/components/PromptInput/useShowFastIconHint.js +23 -0
- package/src/components/PromptInput/useSwarmBanner.js +112 -0
- package/src/components/PromptInput/utils.js +50 -0
- package/src/components/QuickOpenDialog.js +244 -0
- package/src/components/RemoteCallout.js +53 -0
- package/src/components/RemoteEnvironmentDialog.js +346 -0
- package/src/components/ResumeTask.js +173 -0
- package/src/components/SandboxViolationExpandedView.js +106 -0
- package/src/components/ScrollKeybindingHandler.js +982 -0
- package/src/components/SearchBox.js +56 -0
- package/src/components/SentryErrorBoundary.js +16 -0
- package/src/components/SessionBackgroundHint.js +105 -0
- package/src/components/SessionPreview.js +200 -0
- package/src/components/Settings/Config.js +1626 -0
- package/src/components/Settings/Settings.js +131 -0
- package/src/components/Settings/Status.js +230 -0
- package/src/components/Settings/Usage.js +341 -0
- package/src/components/ShowInIDEPrompt.js +152 -0
- package/src/components/SkillImprovementSurvey.js +130 -0
- package/src/components/Spinner/FlashingChar.js +52 -0
- package/src/components/Spinner/GlimmerMessage.js +329 -0
- package/src/components/Spinner/ShimmerChar.js +23 -0
- package/src/components/Spinner/SpinnerAnimationRow.js +170 -0
- package/src/components/Spinner/SpinnerGlyph.js +70 -0
- package/src/components/Spinner/TeammateSpinnerLine.js +171 -0
- package/src/components/Spinner/TeammateSpinnerTree.js +269 -0
- package/src/components/Spinner/index.js +9 -0
- package/src/components/Spinner/teammateSelectHint.js +1 -0
- package/src/components/Spinner/useShimmerAnimation.js +22 -0
- package/src/components/Spinner/useStalledAnimation.js +63 -0
- package/src/components/Spinner/utils.js +78 -0
- package/src/components/Spinner.js +474 -0
- package/src/components/Stats.js +1000 -0
- package/src/components/StatusLine.js +286 -0
- package/src/components/StatusNotices.js +50 -0
- package/src/components/StructuredDiff/Fallback.js +336 -0
- package/src/components/StructuredDiff/colorDiff.js +37 -0
- package/src/components/StructuredDiff.js +153 -0
- package/src/components/StructuredDiffList.js +9 -0
- package/src/components/TagTabs.js +101 -0
- package/src/components/TaskListV2.js +333 -0
- package/src/components/TeammateViewHeader.js +88 -0
- package/src/components/TeleportError.js +191 -0
- package/src/components/TeleportProgress.js +131 -0
- package/src/components/TeleportRepoMismatchDialog.js +98 -0
- package/src/components/TeleportResumeWrapper.js +158 -0
- package/src/components/TeleportStash.js +82 -0
- package/src/components/TextInput.js +108 -0
- package/src/components/ThaddeusHint/PluginHintMenu.js +37 -0
- package/src/components/ThemePicker.js +331 -0
- package/src/components/ThinkingToggle.js +154 -0
- package/src/components/TokenWarning.js +171 -0
- package/src/components/ToolUseLoader.js +35 -0
- package/src/components/TrustDialog/TrustDialog.js +301 -0
- package/src/components/TrustDialog/utils.js +199 -0
- package/src/components/UndercoverAutoCallout.js +5 -0
- package/src/components/ValidationErrorsList.js +147 -0
- package/src/components/VimTextInput.js +136 -0
- package/src/components/VirtualMessageList.js +893 -0
- package/src/components/WorkflowMultiselectDialog.js +118 -0
- package/src/components/WorktreeExitDialog.js +220 -0
- package/src/components/agents/AgentDetail.js +227 -0
- package/src/components/agents/AgentEditor.js +147 -0
- package/src/components/agents/AgentNavigationFooter.js +22 -0
- package/src/components/agents/AgentsList.js +436 -0
- package/src/components/agents/AgentsMenu.js +849 -0
- package/src/components/agents/ColorPicker.js +110 -0
- package/src/components/agents/ModelSelector.js +63 -0
- package/src/components/agents/SnapshotUpdateDialog.js +14 -0
- package/src/components/agents/ToolSelector.js +557 -0
- package/src/components/agents/agentFileUtils.js +179 -0
- package/src/components/agents/generateAgent.js +161 -0
- package/src/components/agents/new-agent-creation/CreateAgentWizard.js +89 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +81 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +387 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +63 -0
- package/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +126 -0
- package/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +118 -0
- package/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +80 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +108 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +80 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +49 -0
- package/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +131 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +52 -0
- package/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +100 -0
- package/src/components/agents/types.js +4 -0
- package/src/components/agents/utils.js +14 -0
- package/src/components/agents/validateAgent.js +79 -0
- package/src/components/design-system/Byline.js +72 -0
- package/src/components/design-system/Dialog.js +117 -0
- package/src/components/design-system/Divider.js +110 -0
- package/src/components/design-system/FuzzyPicker.js +191 -0
- package/src/components/design-system/KeyboardShortcutHint.js +68 -0
- package/src/components/design-system/ListItem.js +184 -0
- package/src/components/design-system/LoadingState.js +69 -0
- package/src/components/design-system/Pane.js +69 -0
- package/src/components/design-system/ProgressBar.js +63 -0
- package/src/components/design-system/Ratchet.js +71 -0
- package/src/components/design-system/StatusIcon.js +70 -0
- package/src/components/design-system/Tabs.js +269 -0
- package/src/components/design-system/ThemeProvider.js +137 -0
- package/src/components/design-system/ThemedBox.js +126 -0
- package/src/components/design-system/ThemedText.js +60 -0
- package/src/components/design-system/color.js +22 -0
- package/src/components/diff/DiffDetailView.js +285 -0
- package/src/components/diff/DiffDialog.js +387 -0
- package/src/components/diff/DiffFileList.js +292 -0
- package/src/components/grove/Grove.js +483 -0
- package/src/components/hooks/HooksConfigMenu.js +583 -0
- package/src/components/hooks/PromptDialog.js +82 -0
- package/src/components/hooks/SelectEventMode.js +118 -0
- package/src/components/hooks/SelectHookMode.js +101 -0
- package/src/components/hooks/SelectMatcherMode.js +131 -0
- package/src/components/hooks/ViewHookMode.js +204 -0
- package/src/components/mcp/CapabilitiesSection.js +56 -0
- package/src/components/mcp/ElicitationDialog.js +945 -0
- package/src/components/mcp/MCPAgentServerMenu.js +95 -0
- package/src/components/mcp/MCPListPanel.js +505 -0
- package/src/components/mcp/MCPReconnect.js +168 -0
- package/src/components/mcp/MCPRemoteServerMenu.js +460 -0
- package/src/components/mcp/MCPSettings.js +414 -0
- package/src/components/mcp/MCPStdioServerMenu.js +95 -0
- package/src/components/mcp/MCPToolDetailView.js +219 -0
- package/src/components/mcp/MCPToolListView.js +137 -0
- package/src/components/mcp/McpParsingWarnings.js +212 -0
- package/src/components/mcp/index.js +8 -0
- package/src/components/mcp/utils/reconnectHelpers.js +35 -0
- package/src/components/memory/MemoryFileSelector.js +454 -0
- package/src/components/memory/MemoryUpdateNotification.js +43 -0
- package/src/components/messageActions.js +418 -0
- package/src/components/messages/AdvisorMessage.js +152 -0
- package/src/components/messages/AssistantRedactedThinkingMessage.js +28 -0
- package/src/components/messages/AssistantTextMessage.js +287 -0
- package/src/components/messages/AssistantThinkingMessage.js +70 -0
- package/src/components/messages/AssistantToolUseMessage.js +324 -0
- package/src/components/messages/AttachmentMessage.js +418 -0
- package/src/components/messages/CollapsedReadSearchContent.js +363 -0
- package/src/components/messages/CompactBoundaryMessage.js +19 -0
- package/src/components/messages/GroupedToolUseContent.js +37 -0
- package/src/components/messages/HighlightedThinkingText.js +165 -0
- package/src/components/messages/HookProgressMessage.js +111 -0
- package/src/components/messages/PlanApprovalMessage.js +213 -0
- package/src/components/messages/RateLimitMessage.js +149 -0
- package/src/components/messages/ShutdownMessage.js +124 -0
- package/src/components/messages/SnipBoundaryMessage.js +7 -0
- package/src/components/messages/SystemAPIErrorMessage.js +136 -0
- package/src/components/messages/SystemTextMessage.js +842 -0
- package/src/components/messages/TaskAssignmentMessage.js +72 -0
- package/src/components/messages/UserAgentNotificationMessage.js +78 -0
- package/src/components/messages/UserBashInputMessage.js +52 -0
- package/src/components/messages/UserBashOutputMessage.js +55 -0
- package/src/components/messages/UserChannelMessage.js +130 -0
- package/src/components/messages/UserCommandMessage.js +107 -0
- package/src/components/messages/UserCrossSessionMessage.js +11 -0
- package/src/components/messages/UserForkBoilerplateMessage.js +11 -0
- package/src/components/messages/UserGitHubWebhookMessage.js +12 -0
- package/src/components/messages/UserImageMessage.js +54 -0
- package/src/components/messages/UserLocalCommandOutputMessage.js +170 -0
- package/src/components/messages/UserMemoryInputMessage.js +73 -0
- package/src/components/messages/UserPlanMessage.js +38 -0
- package/src/components/messages/UserPromptMessage.js +63 -0
- package/src/components/messages/UserResourceUpdateMessage.js +102 -0
- package/src/components/messages/UserTeammateMessage.js +156 -0
- package/src/components/messages/UserTextMessage.js +270 -0
- package/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +28 -0
- package/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +17 -0
- package/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +17 -0
- package/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +92 -0
- package/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +74 -0
- package/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +84 -0
- package/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +58 -0
- package/src/components/messages/UserToolResultMessage/utils.js +43 -0
- package/src/components/messages/nullRenderingAttachments.js +58 -0
- package/src/components/messages/teamMemCollapsed.js +142 -0
- package/src/components/messages/teamMemSaved.js +16 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +659 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +219 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +227 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +175 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +444 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +137 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +100 -0
- package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +404 -0
- package/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +110 -0
- package/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +449 -0
- package/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +126 -0
- package/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +653 -0
- package/src/components/permissions/FallbackPermissionRequest.js +349 -0
- package/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +185 -0
- package/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +108 -0
- package/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +13 -0
- package/src/components/permissions/FilePermissionDialog/permissionOptions.js +137 -0
- package/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +131 -0
- package/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +86 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +164 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +79 -0
- package/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +113 -0
- package/src/components/permissions/MonitorPermissionRequest/MonitorPermissionRequest.js +7 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +164 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +218 -0
- package/src/components/permissions/PermissionDecisionDebugInfo.js +467 -0
- package/src/components/permissions/PermissionDialog.js +55 -0
- package/src/components/permissions/PermissionExplanation.js +269 -0
- package/src/components/permissions/PermissionPrompt.js +316 -0
- package/src/components/permissions/PermissionRequest.js +159 -0
- package/src/components/permissions/PermissionRequestTitle.js +58 -0
- package/src/components/permissions/PermissionRuleExplanation.js +110 -0
- package/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +178 -0
- package/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +73 -0
- package/src/components/permissions/ReviewArtifactPermissionRequest/ReviewArtifactPermissionRequest.js +7 -0
- package/src/components/permissions/SandboxPermissionRequest.js +162 -0
- package/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +228 -0
- package/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +385 -0
- package/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +259 -0
- package/src/components/permissions/WorkerBadge.js +44 -0
- package/src/components/permissions/WorkerPendingPermission.js +107 -0
- package/src/components/permissions/hooks.js +163 -0
- package/src/components/permissions/rules/AddPermissionRules.js +171 -0
- package/src/components/permissions/rules/AddWorkspaceDirectory.js +335 -0
- package/src/components/permissions/rules/PermissionRuleDescription.js +78 -0
- package/src/components/permissions/rules/PermissionRuleInput.js +136 -0
- package/src/components/permissions/rules/PermissionRuleList.js +1190 -0
- package/src/components/permissions/rules/RecentDenialsTab.js +205 -0
- package/src/components/permissions/rules/RemoveWorkspaceDirectory.js +103 -0
- package/src/components/permissions/rules/WorkspaceTab.js +133 -0
- package/src/components/permissions/shellPermissionHelpers.js +112 -0
- package/src/components/permissions/useShellPermissionFeedback.js +108 -0
- package/src/components/permissions/utils.js +14 -0
- package/src/components/sandbox/SandboxConfigTab.js +48 -0
- package/src/components/sandbox/SandboxDependenciesTab.js +123 -0
- package/src/components/sandbox/SandboxDoctorSection.js +47 -0
- package/src/components/sandbox/SandboxOverridesTab.js +193 -0
- package/src/components/sandbox/SandboxSettings.js +297 -0
- package/src/components/shell/ExpandShellOutputContext.js +33 -0
- package/src/components/shell/OutputLine.js +110 -0
- package/src/components/shell/ShellProgressMessage.js +144 -0
- package/src/components/shell/ShellTimeDisplay.js +72 -0
- package/src/components/skills/SkillsMenu.js +239 -0
- package/src/components/tasks/AsyncAgentDetailDialog.js +235 -0
- package/src/components/tasks/BackgroundTask.js +364 -0
- package/src/components/tasks/BackgroundTaskStatus.js +419 -0
- package/src/components/tasks/BackgroundTasksDialog.js +494 -0
- package/src/components/tasks/DreamDetailDialog.js +251 -0
- package/src/components/tasks/InProcessTeammateDetailDialog.js +275 -0
- package/src/components/tasks/MonitorMcpDetailDialog.js +7 -0
- package/src/components/tasks/RemoteSessionDetailDialog.js +868 -0
- package/src/components/tasks/RemoteSessionProgress.js +249 -0
- package/src/components/tasks/ShellDetailDialog.js +403 -0
- package/src/components/tasks/ShellProgress.js +77 -0
- package/src/components/tasks/WorkflowDetailDialog.js +7 -0
- package/src/components/tasks/renderToolActivity.js +29 -0
- package/src/components/tasks/taskStatusUtils.js +94 -0
- package/src/components/teams/TeamStatus.js +77 -0
- package/src/components/teams/TeamsDialog.js +673 -0
- package/src/components/ui/OrderedList.js +66 -0
- package/src/components/ui/OrderedListItem.js +41 -0
- package/src/components/ui/TreeSelect.js +300 -0
- package/src/components/wizard/WizardDialogLayout.js +48 -0
- package/src/components/wizard/WizardNavigationFooter.js +11 -0
- package/src/components/wizard/WizardProvider.js +217 -0
- package/src/components/wizard/index.js +4 -0
- package/src/components/wizard/useWizard.js +9 -0
- package/src/constants/apiLimits.js +81 -0
- package/src/constants/betas.js +45 -0
- package/src/constants/common.js +29 -0
- package/src/constants/cyberRiskInstruction.js +23 -0
- package/src/constants/errorIds.js +14 -0
- package/src/constants/figures.js +38 -0
- package/src/constants/files.js +150 -0
- package/src/constants/github-app.js +139 -0
- package/src/constants/identity.js +112 -0
- package/src/constants/keys.js +10 -0
- package/src/constants/messages.js +1 -0
- package/src/constants/oauth.js +175 -0
- package/src/constants/outputStyles.js +162 -0
- package/src/constants/product.js +54 -0
- package/src/constants/prompts.js +994 -0
- package/src/constants/spinnerVerbs.js +98 -0
- package/src/constants/system.js +77 -0
- package/src/constants/systemPromptSections.js +39 -0
- package/src/constants/toolLimits.js +50 -0
- package/src/constants/tools.js +103 -0
- package/src/constants/turnCompletionVerbs.js +12 -0
- package/src/constants/xml.js +73 -0
- package/src/context/QueuedMessageContext.js +51 -0
- package/src/context/fpsMetrics.js +22 -0
- package/src/context/mailbox.js +35 -0
- package/src/context/modalContext.js +34 -0
- package/src/context/notifications.js +199 -0
- package/src/context/overlayContext.js +149 -0
- package/src/context/promptOverlayContext.js +118 -0
- package/src/context/stats.js +207 -0
- package/src/context/voice.js +74 -0
- package/src/context.js +146 -0
- package/src/coordinator/coordinatorMode.js +345 -0
- package/src/coordinator/workerAgent.js +24 -0
- package/src/cost-tracker.js +208 -0
- package/src/costHook.js +17 -0
- package/src/daemon/main.js +19 -0
- package/src/dialogLaunchers.js +77 -0
- package/src/entrypoints/agentSdkTypes.js +202 -0
- package/src/entrypoints/cli.js +226 -0
- package/src/entrypoints/init.js +265 -0
- package/src/entrypoints/mcp.js +141 -0
- package/src/entrypoints/sandboxTypes.js +112 -0
- package/src/entrypoints/sdk/controlSchemas.js +452 -0
- package/src/entrypoints/sdk/controlTypes.js +1 -0
- package/src/entrypoints/sdk/coreSchemas.js +1331 -0
- package/src/entrypoints/sdk/coreTypes.generated.js +3 -0
- package/src/entrypoints/sdk/coreTypes.js +49 -0
- package/src/entrypoints/sdk/runtimeTypes.js +1 -0
- package/src/entrypoints/sdk/sdkUtilityTypes.js +1 -0
- package/src/entrypoints/sdk/settingsTypes.generated.js +1 -0
- package/src/entrypoints/sdk/toolTypes.js +1 -0
- package/src/environment-runner/main.js +8 -0
- package/src/history.js +386 -0
- package/src/hooks/fileSuggestions.js +635 -0
- package/src/hooks/notifs/useAntOrgWarningNotification.js +5 -0
- package/src/hooks/notifs/useAutoModeUnavailableNotification.js +47 -0
- package/src/hooks/notifs/useCanSwitchToExistingSubscription.js +58 -0
- package/src/hooks/notifs/useDeprecationWarningNotification.js +43 -0
- package/src/hooks/notifs/useFastModeNotification.js +164 -0
- package/src/hooks/notifs/useIDEStatusIndicator.js +174 -0
- package/src/hooks/notifs/useInstallMessages.js +27 -0
- package/src/hooks/notifs/useLspInitializationNotification.js +144 -0
- package/src/hooks/notifs/useMcpConnectivityStatus.js +81 -0
- package/src/hooks/notifs/useModelMigrationNotifications.js +53 -0
- package/src/hooks/notifs/useNpmDeprecationNotification.js +25 -0
- package/src/hooks/notifs/usePluginAutoupdateNotification.js +83 -0
- package/src/hooks/notifs/usePluginInstallationStatus.js +128 -0
- package/src/hooks/notifs/useRateLimitWarningNotification.js +119 -0
- package/src/hooks/notifs/useSettingsErrors.js +64 -0
- package/src/hooks/notifs/useStartupNotification.js +33 -0
- package/src/hooks/notifs/useTeammateShutdownNotification.js +64 -0
- package/src/hooks/renderPlaceholder.js +26 -0
- package/src/hooks/toolPermission/PermissionContext.js +211 -0
- package/src/hooks/toolPermission/handlers/coordinatorHandler.js +44 -0
- package/src/hooks/toolPermission/handlers/interactiveHandler.js +397 -0
- package/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +108 -0
- package/src/hooks/toolPermission/permissionLogging.js +145 -0
- package/src/hooks/unifiedSuggestions.js +130 -0
- package/src/hooks/useAfterFirstRender.js +12 -0
- package/src/hooks/useApiKeyVerification.js +63 -0
- package/src/hooks/useArrowKeyHistory.js +203 -0
- package/src/hooks/useAssistantHistory.js +193 -0
- package/src/hooks/useAwaySummary.js +105 -0
- package/src/hooks/useBackgroundTaskNavigation.js +204 -0
- package/src/hooks/useBlink.js +28 -0
- package/src/hooks/useCanUseTool.js +193 -0
- package/src/hooks/useCancelRequest.js +195 -0
- package/src/hooks/useChromeExtensionNotification.js +50 -0
- package/src/hooks/useClipboardImageHint.js +59 -0
- package/src/hooks/useCommandKeybindings.js +87 -0
- package/src/hooks/useCommandQueue.js +10 -0
- package/src/hooks/useCopyOnSelect.js +88 -0
- package/src/hooks/useDeferredHookMessages.js +43 -0
- package/src/hooks/useDiffData.js +69 -0
- package/src/hooks/useDiffInIDE.js +252 -0
- package/src/hooks/useDirectConnect.js +150 -0
- package/src/hooks/useDoublePress.js +44 -0
- package/src/hooks/useDynamicConfig.js +17 -0
- package/src/hooks/useElapsedTime.js +25 -0
- package/src/hooks/useExitOnCtrlCD.js +57 -0
- package/src/hooks/useExitOnCtrlCDWithKeybindings.js +17 -0
- package/src/hooks/useFileHistorySnapshotInit.js +14 -0
- package/src/hooks/useGlobalKeybindings.js +213 -0
- package/src/hooks/useHistorySearch.js +241 -0
- package/src/hooks/useIDEIntegration.js +56 -0
- package/src/hooks/useIdeAtMentioned.js +51 -0
- package/src/hooks/useIdeConnectionStatus.js +21 -0
- package/src/hooks/useIdeLogging.js +29 -0
- package/src/hooks/useIdeSelection.js +106 -0
- package/src/hooks/useInboxPoller.js +709 -0
- package/src/hooks/useInputBuffer.js +73 -0
- package/src/hooks/useIssueFlagBanner.js +115 -0
- package/src/hooks/useLogMessages.js +98 -0
- package/src/hooks/useLspPluginRecommendation.js +176 -0
- package/src/hooks/useMailboxBridge.js +15 -0
- package/src/hooks/useMainLoopModel.js +25 -0
- package/src/hooks/useManagePlugins.js +261 -0
- package/src/hooks/useMemoryUsage.js +28 -0
- package/src/hooks/useMergedClients.js +11 -0
- package/src/hooks/useMergedCommands.js +10 -0
- package/src/hooks/useMergedTools.js +32 -0
- package/src/hooks/useMinDisplayTime.js +26 -0
- package/src/hooks/useNotifyAfterTimeout.js +51 -0
- package/src/hooks/useOfficialMarketplaceNotification.js +47 -0
- package/src/hooks/usePasteHandler.js +195 -0
- package/src/hooks/usePluginRecommendationBase.js +101 -0
- package/src/hooks/usePrStatus.js +91 -0
- package/src/hooks/usePromptSuggestion.js +128 -0
- package/src/hooks/usePromptsFromClaudeInChrome.js +66 -0
- package/src/hooks/useQueueProcessor.js +46 -0
- package/src/hooks/useRemoteSession.js +431 -0
- package/src/hooks/useReplBridge.js +715 -0
- package/src/hooks/useSSHSession.js +167 -0
- package/src/hooks/useScheduledTasks.js +104 -0
- package/src/hooks/useSearchInput.js +302 -0
- package/src/hooks/useSessionBackgrounding.js +132 -0
- package/src/hooks/useSettings.js +10 -0
- package/src/hooks/useSettingsChange.js +13 -0
- package/src/hooks/useSkillImprovementSurvey.js +69 -0
- package/src/hooks/useSkillsChange.js +51 -0
- package/src/hooks/useSwarmInitialization.js +67 -0
- package/src/hooks/useSwarmPermissionPoller.js +215 -0
- package/src/hooks/useTaskListWatcher.js +157 -0
- package/src/hooks/useTasksV2.js +220 -0
- package/src/hooks/useTeammateViewAutoExit.js +55 -0
- package/src/hooks/useTeleportResume.js +81 -0
- package/src/hooks/useTerminalSize.js +9 -0
- package/src/hooks/useTextInput.js +397 -0
- package/src/hooks/useThaddeusHintRecommendation.js +117 -0
- package/src/hooks/useTimeout.js +10 -0
- package/src/hooks/useTurnDiffs.js +160 -0
- package/src/hooks/useTypeahead.js +1250 -0
- package/src/hooks/useUpdateNotification.js +21 -0
- package/src/hooks/useVimInput.js +232 -0
- package/src/hooks/useVirtualScroll.js +627 -0
- package/src/hooks/useVoice.js +952 -0
- package/src/hooks/useVoiceEnabled.js +21 -0
- package/src/hooks/useVoiceIntegration.js +629 -0
- package/src/infrastructure/audit.js +210 -0
- package/src/infrastructure/guardrails.js +513 -0
- package/src/infrastructure/index.js +11 -0
- package/src/ink/Ansi.js +269 -0
- package/src/ink/bidi.js +117 -0
- package/src/ink/clearTerminal.js +58 -0
- package/src/ink/colorize.js +198 -0
- package/src/ink/components/AlternateScreen.js +74 -0
- package/src/ink/components/App.js +562 -0
- package/src/ink/components/AppContext.js +11 -0
- package/src/ink/components/Box.js +155 -0
- package/src/ink/components/Button.js +166 -0
- package/src/ink/components/ClockContext.js +108 -0
- package/src/ink/components/CursorDeclarationContext.js +3 -0
- package/src/ink/components/ErrorOverview.js +50 -0
- package/src/ink/components/Link.js +34 -0
- package/src/ink/components/Newline.js +30 -0
- package/src/ink/components/NoSelect.js +57 -0
- package/src/ink/components/RawAnsi.js +46 -0
- package/src/ink/components/ScrollBox.js +171 -0
- package/src/ink/components/Spacer.js +20 -0
- package/src/ink/components/StdinContext.js +16 -0
- package/src/ink/components/TerminalFocusContext.js +45 -0
- package/src/ink/components/TerminalSizeContext.js +3 -0
- package/src/ink/components/Text.js +195 -0
- package/src/ink/constants.js +2 -0
- package/src/ink/dom.js +298 -0
- package/src/ink/events/click-event.js +36 -0
- package/src/ink/events/dispatcher.js +172 -0
- package/src/ink/events/emitter.js +31 -0
- package/src/ink/events/event-handlers.js +30 -0
- package/src/ink/events/event.js +9 -0
- package/src/ink/events/focus-event.js +16 -0
- package/src/ink/events/input-event.js +161 -0
- package/src/ink/events/keyboard-event.js +46 -0
- package/src/ink/events/terminal-event.js +78 -0
- package/src/ink/events/terminal-focus-event.js +15 -0
- package/src/ink/focus.js +158 -0
- package/src/ink/frame.js +30 -0
- package/src/ink/get-max-width.js +23 -0
- package/src/ink/hit-test.js +113 -0
- package/src/ink/hooks/use-animation-frame.js +48 -0
- package/src/ink/hooks/use-app.js +7 -0
- package/src/ink/hooks/use-declared-cursor.js +60 -0
- package/src/ink/hooks/use-input.js +70 -0
- package/src/ink/hooks/use-interval.js +54 -0
- package/src/ink/hooks/use-search-highlight.js +32 -0
- package/src/ink/hooks/use-selection.js +60 -0
- package/src/ink/hooks/use-stdin.js +7 -0
- package/src/ink/hooks/use-tab-status.js +57 -0
- package/src/ink/hooks/use-terminal-focus.js +15 -0
- package/src/ink/hooks/use-terminal-title.js +29 -0
- package/src/ink/hooks/use-terminal-viewport.js +77 -0
- package/src/ink/ink.js +1645 -0
- package/src/ink/instances.js +7 -0
- package/src/ink/layout/engine.js +4 -0
- package/src/ink/layout/geometry.js +61 -0
- package/src/ink/layout/node.js +62 -0
- package/src/ink/layout/yoga.js +237 -0
- package/src/ink/line-width-cache.js +19 -0
- package/src/ink/log-update.js +583 -0
- package/src/ink/measure-element.js +8 -0
- package/src/ink/measure-text.js +35 -0
- package/src/ink/node-cache.js +30 -0
- package/src/ink/optimizer.js +81 -0
- package/src/ink/output.js +556 -0
- package/src/ink/parse-keypress.js +695 -0
- package/src/ink/reconciler.js +384 -0
- package/src/ink/render-border.js +134 -0
- package/src/ink/render-node-to-output.js +1216 -0
- package/src/ink/render-to-screen.js +171 -0
- package/src/ink/renderer.js +129 -0
- package/src/ink/root.js +80 -0
- package/src/ink/screen.js +1132 -0
- package/src/ink/searchHighlight.js +78 -0
- package/src/ink/selection.js +792 -0
- package/src/ink/squash-text-nodes.js +56 -0
- package/src/ink/stringWidth.js +200 -0
- package/src/ink/styles.js +299 -0
- package/src/ink/supports-hyperlinks.js +40 -0
- package/src/ink/tabstops.js +39 -0
- package/src/ink/terminal-focus-state.js +35 -0
- package/src/ink/terminal-querier.js +173 -0
- package/src/ink/terminal.js +208 -0
- package/src/ink/termio/ansi.js +70 -0
- package/src/ink/termio/csi.js +260 -0
- package/src/ink/termio/dec.js +53 -0
- package/src/ink/termio/esc.js +55 -0
- package/src/ink/termio/osc.js +432 -0
- package/src/ink/termio/parser.js +356 -0
- package/src/ink/termio/sgr.js +292 -0
- package/src/ink/termio/tokenize.js +264 -0
- package/src/ink/termio/types.js +55 -0
- package/src/ink/termio.js +24 -0
- package/src/ink/useTerminalNotification.js +57 -0
- package/src/ink/warn.js +10 -0
- package/src/ink/widest-line.js +14 -0
- package/src/ink/wrap-text.js +54 -0
- package/src/ink/wrapAnsi.js +6 -0
- package/src/ink.js +50 -0
- package/src/integrations/credentialStore.js +176 -0
- package/src/integrations/index.js +5 -0
- package/src/integrations/integrationManager.js +180 -0
- package/src/integrations/providers/BaseProvider.js +180 -0
- package/src/integrations/providers/GitHubProvider.js +217 -0
- package/src/integrations/providers/GmailProvider.js +204 -0
- package/src/integrations/providers/GoogleCalendarProvider.js +113 -0
- package/src/integrations/providers/HubSpotProvider.js +159 -0
- package/src/integrations/providers/JiraProvider.js +216 -0
- package/src/integrations/providers/NotionProvider.js +221 -0
- package/src/integrations/providers/QuickBooksProvider.js +176 -0
- package/src/integrations/providers/SlackProvider.js +174 -0
- package/src/integrations/providers/StripeProvider.js +206 -0
- package/src/integrations/providers/TwilioProvider.js +239 -0
- package/src/integrations/providers/_template.js +112 -0
- package/src/integrations/types.js +7 -0
- package/src/interactiveHelpers.js +308 -0
- package/src/jobs/classifier.js +6 -0
- package/src/keybindings/KeybindingContext.js +184 -0
- package/src/keybindings/KeybindingProviderSetup.js +259 -0
- package/src/keybindings/defaultBindings.js +333 -0
- package/src/keybindings/loadUserBindings.js +393 -0
- package/src/keybindings/match.js +111 -0
- package/src/keybindings/parser.js +184 -0
- package/src/keybindings/reservedShortcuts.js +109 -0
- package/src/keybindings/resolver.js +182 -0
- package/src/keybindings/schema.js +205 -0
- package/src/keybindings/shortcutFormat.js +48 -0
- package/src/keybindings/template.js +40 -0
- package/src/keybindings/useKeybinding.js +161 -0
- package/src/keybindings/useShortcutDisplay.js +43 -0
- package/src/keybindings/validate.js +395 -0
- package/src/main.js +4128 -0
- package/src/memdir/findRelevantMemories.js +99 -0
- package/src/memdir/memdir.js +406 -0
- package/src/memdir/memoryAge.js +52 -0
- package/src/memdir/memoryScan.js +65 -0
- package/src/memdir/memoryShapeTelemetry.js +8 -0
- package/src/memdir/memoryTypes.js +260 -0
- package/src/memdir/paths.js +235 -0
- package/src/memdir/teamMemPaths.js +261 -0
- package/src/memdir/teamMemPrompts.js +82 -0
- package/src/migrations/migrateAutoUpdatesToSettings.js +47 -0
- package/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +32 -0
- package/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +83 -0
- package/src/migrations/migrateFennecToOpus.js +39 -0
- package/src/migrations/migrateLegacyOpusToCurrent.js +44 -0
- package/src/migrations/migrateOpusToOpus1m.js +31 -0
- package/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +23 -0
- package/src/migrations/migrateSonnet1mToSonnet45.js +38 -0
- package/src/migrations/migrateSonnet45ToSonnet46.js +48 -0
- package/src/migrations/resetAutoModeOptInForDefaultOffer.js +47 -0
- package/src/migrations/resetProToOpusDefault.js +46 -0
- package/src/moreright/useMoreRight.js +13 -0
- package/src/native-ts/color-diff/index.js +819 -0
- package/src/native-ts/file-index/index.js +328 -0
- package/src/native-ts/yoga-layout/enums.js +101 -0
- package/src/native-ts/yoga-layout/index.js +2113 -0
- package/src/outputStyles/loadOutputStylesDir.js +71 -0
- package/src/plugins/builtinPlugins.js +132 -0
- package/src/plugins/bundled/index.js +22 -0
- package/src/proactive/index.js +138 -0
- package/src/proactive/useProactive.js +82 -0
- package/src/projectOnboardingState.js +61 -0
- package/src/query/config.js +17 -0
- package/src/query/deps.js +12 -0
- package/src/query/stopHooks.js +332 -0
- package/src/query/tokenBudget.js +49 -0
- package/src/query.js +1264 -0
- package/src/remote/RemoteSessionManager.js +172 -0
- package/src/remote/SessionsWebSocket.js +308 -0
- package/src/remote/remotePermissionBridge.js +70 -0
- package/src/remote/sdkMessageAdapter.js +227 -0
- package/src/replLauncher.js +7 -0
- package/src/schemas/hooks.js +174 -0
- package/src/screens/Doctor.js +580 -0
- package/src/screens/REPL.js +4500 -0
- package/src/screens/ResumeConversation.js +339 -0
- package/src/self-hosted-runner/main.js +8 -0
- package/src/server/backends/dangerousBackend.js +8 -0
- package/src/server/connectHeadless.js +6 -0
- package/src/server/createDirectConnectSession.js +62 -0
- package/src/server/directConnectManager.js +153 -0
- package/src/server/lockfile.js +11 -0
- package/src/server/parseConnectUrl.js +20 -0
- package/src/server/server.js +12 -0
- package/src/server/serverBanner.js +9 -0
- package/src/server/serverLog.js +11 -0
- package/src/server/sessionManager.js +19 -0
- package/src/server/types.js +7 -0
- package/src/services/AgentSummary/agentSummary.js +147 -0
- package/src/services/MagicDocs/magicDocs.js +193 -0
- package/src/services/MagicDocs/prompts.js +110 -0
- package/src/services/PromptSuggestion/promptSuggestion.js +402 -0
- package/src/services/PromptSuggestion/speculation.js +643 -0
- package/src/services/SessionMemory/prompts.js +254 -0
- package/src/services/SessionMemory/sessionMemory.js +358 -0
- package/src/services/SessionMemory/sessionMemoryUtils.js +157 -0
- package/src/services/analytics/config.js +27 -0
- package/src/services/analytics/datadog.js +26 -0
- package/src/services/analytics/firstPartyEventLogger.js +65 -0
- package/src/services/analytics/firstPartyEventLoggingExporter.js +595 -0
- package/src/services/analytics/growthbook.js +103 -0
- package/src/services/analytics/index.js +91 -0
- package/src/services/analytics/metadata.js +696 -0
- package/src/services/analytics/sink.js +19 -0
- package/src/services/analytics/sinkKillswitch.js +19 -0
- package/src/services/api/adminRequests.js +57 -0
- package/src/services/api/bootstrap.js +118 -0
- package/src/services/api/claude.js +2466 -0
- package/src/services/api/client.js +335 -0
- package/src/services/api/dumpPrompts.js +174 -0
- package/src/services/api/emptyUsage.js +20 -0
- package/src/services/api/errorUtils.js +203 -0
- package/src/services/api/errors.js +926 -0
- package/src/services/api/filesApi.js +523 -0
- package/src/services/api/firstTokenDate.js +49 -0
- package/src/services/api/grove.js +44 -0
- package/src/services/api/logging.js +484 -0
- package/src/services/api/metricsOptOut.js +15 -0
- package/src/services/api/overageCreditGrant.js +123 -0
- package/src/services/api/promptCacheBreakDetection.js +510 -0
- package/src/services/api/referral.js +219 -0
- package/src/services/api/sessionIngress.js +358 -0
- package/src/services/api/ultrareviewQuota.js +29 -0
- package/src/services/api/usage.js +31 -0
- package/src/services/api/withRetry.js +587 -0
- package/src/services/api/xai/anthropic-shim.js +885 -0
- package/src/services/api/xai/brightDataSearch.js +161 -0
- package/src/services/api/xai/thaddeus-engine.js +605 -0
- package/src/services/api/xai/xai-client.js +276 -0
- package/src/services/autoDream/autoDream.js +244 -0
- package/src/services/autoDream/config.js +17 -0
- package/src/services/autoDream/consolidationLock.js +122 -0
- package/src/services/autoDream/consolidationPrompt.js +55 -0
- package/src/services/awaySummary.js +61 -0
- package/src/services/claudeAiLimits.js +331 -0
- package/src/services/claudeAiLimitsHook.js +15 -0
- package/src/services/compact/apiMicrocompact.js +97 -0
- package/src/services/compact/autoCompact.js +234 -0
- package/src/services/compact/cachedMCConfig.js +5 -0
- package/src/services/compact/compact.js +1256 -0
- package/src/services/compact/compactWarningHook.js +12 -0
- package/src/services/compact/compactWarningState.js +15 -0
- package/src/services/compact/grouping.js +58 -0
- package/src/services/compact/microCompact.js +414 -0
- package/src/services/compact/postCompactCleanup.js +70 -0
- package/src/services/compact/prompt.js +325 -0
- package/src/services/compact/reactiveCompact.js +20 -0
- package/src/services/compact/sessionMemoryCompact.js +467 -0
- package/src/services/compact/snipCompact.js +23 -0
- package/src/services/compact/snipProjection.js +11 -0
- package/src/services/compact/timeBasedMCConfig.js +11 -0
- package/src/services/contextCollapse/index.js +33 -0
- package/src/services/contextCollapse/operations.js +5 -0
- package/src/services/contextCollapse/persist.js +5 -0
- package/src/services/diagnosticTracking.js +282 -0
- package/src/services/elevenlabsTTS.js +245 -0
- package/src/services/extractMemories/extractMemories.js +442 -0
- package/src/services/extractMemories/prompts.js +129 -0
- package/src/services/internalLogging.js +68 -0
- package/src/services/lsp/LSPClient.js +306 -0
- package/src/services/lsp/LSPDiagnosticRegistry.js +277 -0
- package/src/services/lsp/LSPServerInstance.js +388 -0
- package/src/services/lsp/LSPServerManager.js +305 -0
- package/src/services/lsp/config.js +57 -0
- package/src/services/lsp/manager.js +246 -0
- package/src/services/lsp/passiveFeedback.js +226 -0
- package/src/services/mcp/InProcessTransport.js +54 -0
- package/src/services/mcp/MCPConnectionManager.js +50 -0
- package/src/services/mcp/SdkControlTransport.js +115 -0
- package/src/services/mcp/auth.js +1882 -0
- package/src/services/mcp/channelAllowlist.js +57 -0
- package/src/services/mcp/channelNotification.js +235 -0
- package/src/services/mcp/channelPermissions.js +192 -0
- package/src/services/mcp/claudeai.js +123 -0
- package/src/services/mcp/client.js +2478 -0
- package/src/services/mcp/config.js +1271 -0
- package/src/services/mcp/elicitationHandler.js +192 -0
- package/src/services/mcp/envExpansion.js +30 -0
- package/src/services/mcp/headersHelper.js +93 -0
- package/src/services/mcp/mcpStringUtils.js +85 -0
- package/src/services/mcp/normalization.js +21 -0
- package/src/services/mcp/oauthPort.js +69 -0
- package/src/services/mcp/officialRegistry.js +20 -0
- package/src/services/mcp/types.js +94 -0
- package/src/services/mcp/useManageMCPConnections.js +818 -0
- package/src/services/mcp/utils.js +433 -0
- package/src/services/mcp/vscodeSdkMcp.js +69 -0
- package/src/services/mcp/xaa.js +342 -0
- package/src/services/mcp/xaaIdpLogin.js +377 -0
- package/src/services/mcpServerApproval.js +30 -0
- package/src/services/mockRateLimits.js +666 -0
- package/src/services/notifier.js +114 -0
- package/src/services/oauth/auth-code-listener.js +165 -0
- package/src/services/oauth/client.js +397 -0
- package/src/services/oauth/crypto.js +19 -0
- package/src/services/oauth/getOauthProfile.js +48 -0
- package/src/services/oauth/index.js +133 -0
- package/src/services/plugins/PluginInstallationManager.js +139 -0
- package/src/services/plugins/pluginCliCommands.js +230 -0
- package/src/services/plugins/pluginOperations.js +826 -0
- package/src/services/policyLimits/index.js +547 -0
- package/src/services/policyLimits/types.js +9 -0
- package/src/services/preventSleep.js +143 -0
- package/src/services/rateLimitMessages.js +271 -0
- package/src/services/rateLimitMocking.js +91 -0
- package/src/services/remoteManagedSettings/index.js +534 -0
- package/src/services/remoteManagedSettings/securityCheck.js +60 -0
- package/src/services/remoteManagedSettings/syncCache.js +90 -0
- package/src/services/remoteManagedSettings/syncCacheState.js +89 -0
- package/src/services/remoteManagedSettings/types.js +12 -0
- package/src/services/sessionTranscript/sessionTranscript.js +5 -0
- package/src/services/settingsSync/index.js +478 -0
- package/src/services/settingsSync/types.js +35 -0
- package/src/services/skillSearch/featureCheck.js +8 -0
- package/src/services/skillSearch/localSearch.js +5 -0
- package/src/services/skillSearch/prefetch.js +8 -0
- package/src/services/skillSearch/remoteSkillLoader.js +8 -0
- package/src/services/skillSearch/remoteSkillState.js +11 -0
- package/src/services/skillSearch/signals.js +3 -0
- package/src/services/skillSearch/telemetry.js +8 -0
- package/src/services/teamMemorySync/index.js +976 -0
- package/src/services/teamMemorySync/secretScanner.js +275 -0
- package/src/services/teamMemorySync/teamMemSecretGuard.js +33 -0
- package/src/services/teamMemorySync/types.js +47 -0
- package/src/services/teamMemorySync/watcher.js +326 -0
- package/src/services/thaddeusAuth.js +485 -0
- package/src/services/thaddeusAuthTypes.js +9 -0
- package/src/services/thaddeusLoginFlow.js +236 -0
- package/src/services/tips/tipHistory.js +17 -0
- package/src/services/tips/tipRegistry.js +593 -0
- package/src/services/tips/tipScheduler.js +40 -0
- package/src/services/tokenEstimation.js +365 -0
- package/src/services/toolUseSummary/toolUseSummaryGenerator.js +87 -0
- package/src/services/tools/StreamingToolExecutor.js +413 -0
- package/src/services/tools/toolExecution.js +1309 -0
- package/src/services/tools/toolHooks.js +454 -0
- package/src/services/tools/toolOrchestration.js +110 -0
- package/src/services/vcr.js +291 -0
- package/src/services/voice.js +392 -0
- package/src/services/voiceKeyterms.js +94 -0
- package/src/services/voiceStreamSTT.js +405 -0
- package/src/setup.js +310 -0
- package/src/skills/bundled/batch.js +114 -0
- package/src/skills/bundled/claudeApi.js +145 -0
- package/src/skills/bundled/claudeApiContent.js +71 -0
- package/src/skills/bundled/claudeInChrome.js +27 -0
- package/src/skills/bundled/debug.js +99 -0
- package/src/skills/bundled/dream.js +49 -0
- package/src/skills/bundled/emailSetup.js +196 -0
- package/src/skills/bundled/hunter.js +28 -0
- package/src/skills/bundled/index.js +80 -0
- package/src/skills/bundled/keybindings.js +292 -0
- package/src/skills/bundled/loop.js +81 -0
- package/src/skills/bundled/loremIpsum.js +264 -0
- package/src/skills/bundled/reactor.js +31 -0
- package/src/skills/bundled/remember.js +73 -0
- package/src/skills/bundled/runSkillGenerator.js +12 -0
- package/src/skills/bundled/scheduleRemoteAgents.js +373 -0
- package/src/skills/bundled/simplify.js +66 -0
- package/src/skills/bundled/skillify.js +182 -0
- package/src/skills/bundled/stuck.js +69 -0
- package/src/skills/bundled/updateConfig.js +463 -0
- package/src/skills/bundled/verify.js +23 -0
- package/src/skills/bundled/verifyContent.js +10 -0
- package/src/skills/bundledSkills.js +159 -0
- package/src/skills/loadSkillsDir.js +736 -0
- package/src/skills/mcpSkillBuilders.js +10 -0
- package/src/skills/mcpSkills.js +5 -0
- package/src/state/AppState.js +182 -0
- package/src/state/AppStateStore.js +117 -0
- package/src/state/onChangeAppState.js +132 -0
- package/src/state/selectors.js +51 -0
- package/src/state/store.js +21 -0
- package/src/state/teammateViewHelpers.js +124 -0
- package/src/stubs/ant-chrome-mcp/index.js +4 -0
- package/src/stubs/ant-computer-use-input/index.js +2 -0
- package/src/stubs/ant-computer-use-mcp/index.js +7 -0
- package/src/stubs/ant-computer-use-mcp/sentinelApps.js +2 -0
- package/src/stubs/ant-computer-use-mcp/types.js +3 -0
- package/src/stubs/ant-computer-use-swift/index.js +1 -0
- package/src/stubs/anthropic-sandbox/index.js +34 -0
- package/src/tasks/DreamTask/DreamTask.js +99 -0
- package/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +116 -0
- package/src/tasks/InProcessTeammateTask/types.js +35 -0
- package/src/tasks/LocalAgentTask/LocalAgentTask.js +507 -0
- package/src/tasks/LocalMainSessionTask.js +338 -0
- package/src/tasks/LocalShellTask/LocalShellTask.js +475 -0
- package/src/tasks/LocalShellTask/guards.js +9 -0
- package/src/tasks/LocalShellTask/killShellTasks.js +59 -0
- package/src/tasks/LocalWorkflowTask/LocalWorkflowTask.js +7 -0
- package/src/tasks/MonitorMcpTask/MonitorMcpTask.js +20 -0
- package/src/tasks/RemoteAgentTask/RemoteAgentTask.js +742 -0
- package/src/tasks/pillLabel.js +69 -0
- package/src/tasks/stopTask.js +67 -0
- package/src/tasks/types.js +18 -0
- package/src/tasks.js +37 -0
- package/src/tools/AIEmployeesTool/AIEmployeesTool.js +674 -0
- package/src/tools/AIEmployeesTool/constants.js +1 -0
- package/src/tools/AIEmployeesTool/prompt.js +56 -0
- package/src/tools/AgentTool/AgentTool.js +1221 -0
- package/src/tools/AgentTool/UI.js +593 -0
- package/src/tools/AgentTool/agentColorManager.js +43 -0
- package/src/tools/AgentTool/agentDisplay.js +72 -0
- package/src/tools/AgentTool/agentMemory.js +125 -0
- package/src/tools/AgentTool/agentMemorySnapshot.js +136 -0
- package/src/tools/AgentTool/agentToolUtils.js +456 -0
- package/src/tools/AgentTool/built-in/exploreAgent.js +76 -0
- package/src/tools/AgentTool/built-in/generalPurposeAgent.js +28 -0
- package/src/tools/AgentTool/built-in/planAgent.js +87 -0
- package/src/tools/AgentTool/built-in/statuslineSetup.js +140 -0
- package/src/tools/AgentTool/built-in/thaddeusGuideAgent.js +174 -0
- package/src/tools/AgentTool/built-in/verificationAgent.js +146 -0
- package/src/tools/AgentTool/builtInAgents.js +56 -0
- package/src/tools/AgentTool/constants.js +11 -0
- package/src/tools/AgentTool/forkSubagent.js +177 -0
- package/src/tools/AgentTool/loadAgentsDir.js +497 -0
- package/src/tools/AgentTool/prompt.js +260 -0
- package/src/tools/AgentTool/resumeAgent.js +182 -0
- package/src/tools/AgentTool/runAgent.js +627 -0
- package/src/tools/AppointmentsTool/AppointmentsTool.js +628 -0
- package/src/tools/AppointmentsTool/constants.js +1 -0
- package/src/tools/AppointmentsTool/prompt.js +15 -0
- package/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +238 -0
- package/src/tools/AskUserQuestionTool/prompt.js +38 -0
- package/src/tools/BashTool/BashTool.js +1009 -0
- package/src/tools/BashTool/BashToolResultMessage.js +169 -0
- package/src/tools/BashTool/UI.js +134 -0
- package/src/tools/BashTool/bashCommandHelpers.js +184 -0
- package/src/tools/BashTool/bashPermissions.js +2023 -0
- package/src/tools/BashTool/bashSecurity.js +2267 -0
- package/src/tools/BashTool/commandSemantics.js +105 -0
- package/src/tools/BashTool/commentLabel.js +14 -0
- package/src/tools/BashTool/destructiveCommandWarning.js +88 -0
- package/src/tools/BashTool/modeValidation.js +86 -0
- package/src/tools/BashTool/pathValidation.js +1079 -0
- package/src/tools/BashTool/prompt.js +333 -0
- package/src/tools/BashTool/readOnlyValidation.js +1794 -0
- package/src/tools/BashTool/sedEditParser.js +282 -0
- package/src/tools/BashTool/sedValidation.js +580 -0
- package/src/tools/BashTool/shouldUseSandbox.js +125 -0
- package/src/tools/BashTool/toolName.js +2 -0
- package/src/tools/BashTool/utils.js +180 -0
- package/src/tools/BriefTool/BriefTool.js +173 -0
- package/src/tools/BriefTool/UI.js +67 -0
- package/src/tools/BriefTool/attachments.js +86 -0
- package/src/tools/BriefTool/prompt.js +19 -0
- package/src/tools/BriefTool/upload.js +136 -0
- package/src/tools/CalendarTool/CalendarTool.js +498 -0
- package/src/tools/CalendarTool/constants.js +1 -0
- package/src/tools/CalendarTool/prompt.js +11 -0
- package/src/tools/ConfigTool/ConfigTool.js +398 -0
- package/src/tools/ConfigTool/UI.js +25 -0
- package/src/tools/ConfigTool/constants.js +1 -0
- package/src/tools/ConfigTool/prompt.js +82 -0
- package/src/tools/ConfigTool/supportedSettings.js +180 -0
- package/src/tools/ContactsTool/ContactsTool.js +648 -0
- package/src/tools/ContactsTool/constants.js +1 -0
- package/src/tools/ContactsTool/prompt.js +15 -0
- package/src/tools/CtxInspectTool/CtxInspectTool.js +44 -0
- package/src/tools/DiscoverSkillsTool/prompt.js +4 -0
- package/src/tools/EmailReadTool/index.js +410 -0
- package/src/tools/EmailSendTool/index.js +178 -0
- package/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +98 -0
- package/src/tools/EnterPlanModeTool/UI.js +14 -0
- package/src/tools/EnterPlanModeTool/constants.js +1 -0
- package/src/tools/EnterPlanModeTool/prompt.js +164 -0
- package/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +104 -0
- package/src/tools/EnterWorktreeTool/UI.js +9 -0
- package/src/tools/EnterWorktreeTool/constants.js +1 -0
- package/src/tools/EnterWorktreeTool/prompt.js +30 -0
- package/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +383 -0
- package/src/tools/ExitPlanModeTool/UI.js +32 -0
- package/src/tools/ExitPlanModeTool/constants.js +2 -0
- package/src/tools/ExitPlanModeTool/prompt.js +27 -0
- package/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +257 -0
- package/src/tools/ExitWorktreeTool/UI.js +10 -0
- package/src/tools/ExitWorktreeTool/constants.js +1 -0
- package/src/tools/ExitWorktreeTool/prompt.js +32 -0
- package/src/tools/FileEditTool/FileEditTool.js +480 -0
- package/src/tools/FileEditTool/UI.js +202 -0
- package/src/tools/FileEditTool/constants.js +7 -0
- package/src/tools/FileEditTool/prompt.js +24 -0
- package/src/tools/FileEditTool/types.js +50 -0
- package/src/tools/FileEditTool/utils.js +579 -0
- package/src/tools/FileReadTool/FileReadTool.js +889 -0
- package/src/tools/FileReadTool/UI.js +126 -0
- package/src/tools/FileReadTool/imageProcessor.js +46 -0
- package/src/tools/FileReadTool/limits.js +70 -0
- package/src/tools/FileReadTool/prompt.js +31 -0
- package/src/tools/FileWriteTool/FileWriteTool.js +341 -0
- package/src/tools/FileWriteTool/UI.js +339 -0
- package/src/tools/FileWriteTool/prompt.js +15 -0
- package/src/tools/GlobTool/GlobTool.js +161 -0
- package/src/tools/GlobTool/UI.js +40 -0
- package/src/tools/GlobTool/prompt.js +6 -0
- package/src/tools/GrepTool/GrepTool.js +439 -0
- package/src/tools/GrepTool/UI.js +155 -0
- package/src/tools/GrepTool/prompt.js +16 -0
- package/src/tools/IntegrationsTool/IntegrationsTool.js +217 -0
- package/src/tools/IntegrationsTool/constants.js +1 -0
- package/src/tools/IntegrationsTool/prompt.js +41 -0
- package/src/tools/InteractionsTool/InteractionsTool.js +525 -0
- package/src/tools/InteractionsTool/constants.js +1 -0
- package/src/tools/InteractionsTool/prompt.js +14 -0
- package/src/tools/InvoicesTool/InvoicesTool.js +581 -0
- package/src/tools/InvoicesTool/constants.js +1 -0
- package/src/tools/InvoicesTool/prompt.js +15 -0
- package/src/tools/LSPTool/LSPTool.js +660 -0
- package/src/tools/LSPTool/UI.js +205 -0
- package/src/tools/LSPTool/formatters.js +445 -0
- package/src/tools/LSPTool/prompt.js +20 -0
- package/src/tools/LSPTool/schemas.js +197 -0
- package/src/tools/LSPTool/symbolContext.js +75 -0
- package/src/tools/LeadScorerTool/LeadScorerTool.js +509 -0
- package/src/tools/LeadScorerTool/constants.js +1 -0
- package/src/tools/LeadScorerTool/prompt.js +11 -0
- package/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +100 -0
- package/src/tools/ListMcpResourcesTool/UI.js +17 -0
- package/src/tools/ListMcpResourcesTool/prompt.js +18 -0
- package/src/tools/ListPeersTool/ListPeersTool.js +45 -0
- package/src/tools/MCPTool/MCPTool.js +60 -0
- package/src/tools/MCPTool/UI.js +343 -0
- package/src/tools/MCPTool/classifyForCollapse.js +597 -0
- package/src/tools/MCPTool/prompt.js +3 -0
- package/src/tools/McpAuthTool/McpAuthTool.js +162 -0
- package/src/tools/MonitorTool/MonitorTool.js +55 -0
- package/src/tools/NotebookEditTool/NotebookEditTool.js +421 -0
- package/src/tools/NotebookEditTool/UI.js +41 -0
- package/src/tools/NotebookEditTool/constants.js +2 -0
- package/src/tools/NotebookEditTool/prompt.js +2 -0
- package/src/tools/OverflowTestTool/OverflowTestTool.js +51 -0
- package/src/tools/PhoneBridgeTool/PhoneBridgeTool.js +301 -0
- package/src/tools/PhoneBridgeTool/constants.js +1 -0
- package/src/tools/PhoneBridgeTool/prompt.js +26 -0
- package/src/tools/PowerShellTool/PowerShellTool.js +900 -0
- package/src/tools/PowerShellTool/UI.js +58 -0
- package/src/tools/PowerShellTool/clmTypes.js +207 -0
- package/src/tools/PowerShellTool/commandSemantics.js +115 -0
- package/src/tools/PowerShellTool/commonParameters.js +27 -0
- package/src/tools/PowerShellTool/destructiveCommandWarning.js +92 -0
- package/src/tools/PowerShellTool/gitSafety.js +185 -0
- package/src/tools/PowerShellTool/modeValidation.js +357 -0
- package/src/tools/PowerShellTool/pathValidation.js +1712 -0
- package/src/tools/PowerShellTool/powershellPermissions.js +1351 -0
- package/src/tools/PowerShellTool/powershellSecurity.js +942 -0
- package/src/tools/PowerShellTool/prompt.js +132 -0
- package/src/tools/PowerShellTool/readOnlyValidation.js +1633 -0
- package/src/tools/PowerShellTool/toolName.js +2 -0
- package/src/tools/PushNotificationTool/PushNotificationTool.js +35 -0
- package/src/tools/REPLTool/REPLTool.js +44 -0
- package/src/tools/REPLTool/constants.js +43 -0
- package/src/tools/REPLTool/primitiveTools.js +36 -0
- package/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +112 -0
- package/src/tools/ReadMcpResourceTool/UI.js +24 -0
- package/src/tools/ReadMcpResourceTool/prompt.js +15 -0
- package/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +142 -0
- package/src/tools/RemoteTriggerTool/UI.js +12 -0
- package/src/tools/RemoteTriggerTool/prompt.js +12 -0
- package/src/tools/ReviewArtifactTool/ReviewArtifactTool.js +51 -0
- package/src/tools/ScheduleCronTool/CronCreateTool.js +120 -0
- package/src/tools/ScheduleCronTool/CronDeleteTool.js +74 -0
- package/src/tools/ScheduleCronTool/CronListTool.js +77 -0
- package/src/tools/ScheduleCronTool/UI.js +29 -0
- package/src/tools/ScheduleCronTool/prompt.js +115 -0
- package/src/tools/SendMessageTool/SendMessageTool.js +673 -0
- package/src/tools/SendMessageTool/UI.js +24 -0
- package/src/tools/SendMessageTool/constants.js +1 -0
- package/src/tools/SendMessageTool/prompt.js +47 -0
- package/src/tools/SendUserFileTool/SendUserFileTool.js +35 -0
- package/src/tools/SendUserFileTool/prompt.js +5 -0
- package/src/tools/SkillTool/SkillTool.js +825 -0
- package/src/tools/SkillTool/UI.js +61 -0
- package/src/tools/SkillTool/constants.js +1 -0
- package/src/tools/SkillTool/prompt.js +184 -0
- package/src/tools/SleepTool/SleepTool.js +42 -0
- package/src/tools/SleepTool/prompt.js +14 -0
- package/src/tools/SnipTool/SnipTool.js +47 -0
- package/src/tools/SnipTool/prompt.js +5 -0
- package/src/tools/SubscribePRTool/SubscribePRTool.js +49 -0
- package/src/tools/SuggestBackgroundPRTool/SuggestBackgroundPRTool.js +44 -0
- package/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +138 -0
- package/src/tools/SyntheticOutputTool/SyntheticOutputTool.ts +1 -1
- package/src/tools/TaskCreateTool/TaskCreateTool.js +104 -0
- package/src/tools/TaskCreateTool/constants.js +1 -0
- package/src/tools/TaskCreateTool/prompt.js +52 -0
- package/src/tools/TaskGetTool/TaskGetTool.js +106 -0
- package/src/tools/TaskGetTool/constants.js +1 -0
- package/src/tools/TaskGetTool/prompt.js +23 -0
- package/src/tools/TaskListTool/TaskListTool.js +89 -0
- package/src/tools/TaskListTool/constants.js +1 -0
- package/src/tools/TaskListTool/prompt.js +44 -0
- package/src/tools/TaskOutputTool/TaskOutputTool.js +536 -0
- package/src/tools/TaskOutputTool/constants.js +1 -0
- package/src/tools/TaskStopTool/TaskStopTool.js +110 -0
- package/src/tools/TaskStopTool/UI.js +31 -0
- package/src/tools/TaskStopTool/prompt.js +7 -0
- package/src/tools/TaskUpdateTool/TaskUpdateTool.js +301 -0
- package/src/tools/TaskUpdateTool/constants.js +1 -0
- package/src/tools/TaskUpdateTool/prompt.js +76 -0
- package/src/tools/TeamCreateTool/TeamCreateTool.js +177 -0
- package/src/tools/TeamCreateTool/UI.js +4 -0
- package/src/tools/TeamCreateTool/constants.js +1 -0
- package/src/tools/TeamCreateTool/prompt.js +113 -0
- package/src/tools/TeamDeleteTool/TeamDeleteTool.js +102 -0
- package/src/tools/TeamDeleteTool/UI.js +13 -0
- package/src/tools/TeamDeleteTool/constants.js +1 -0
- package/src/tools/TeamDeleteTool/prompt.js +16 -0
- package/src/tools/TerminalCaptureTool/TerminalCaptureTool.js +47 -0
- package/src/tools/TerminalCaptureTool/prompt.js +11 -0
- package/src/tools/TodoWriteTool/TodoWriteTool.js +99 -0
- package/src/tools/TodoWriteTool/constants.js +1 -0
- package/src/tools/TodoWriteTool/prompt.js +181 -0
- package/src/tools/ToolSearchTool/ToolSearchTool.js +357 -0
- package/src/tools/ToolSearchTool/constants.js +1 -0
- package/src/tools/ToolSearchTool/prompt.js +97 -0
- package/src/tools/TungstenTool/TungstenLiveMonitor.js +7 -0
- package/src/tools/TungstenTool/TungstenTool.js +3 -0
- package/src/tools/VerifyPlanExecutionTool/VerifyPlanExecutionTool.js +45 -0
- package/src/tools/VerifyPlanExecutionTool/constants.js +2 -0
- package/src/tools/WebBrowserTool/WebBrowserPanel.js +5 -0
- package/src/tools/WebBrowserTool/WebBrowserTool.js +58 -0
- package/src/tools/WebFetchTool/UI.js +31 -0
- package/src/tools/WebFetchTool/WebFetchTool.js +246 -0
- package/src/tools/WebFetchTool/preapproved.js +154 -0
- package/src/tools/WebFetchTool/prompt.js +39 -0
- package/src/tools/WebFetchTool/utils.js +368 -0
- package/src/tools/WebSearchTool/UI.js +67 -0
- package/src/tools/WebSearchTool/WebSearchTool.js +396 -0
- package/src/tools/WebSearchTool/prompt.js +32 -0
- package/src/tools/WorkflowTool/WorkflowPermissionRequest.js +7 -0
- package/src/tools/WorkflowTool/WorkflowTool.js +51 -0
- package/src/tools/WorkflowTool/bundled/index.js +5 -0
- package/src/tools/WorkflowTool/constants.js +1 -0
- package/src/tools/WorkflowTool/createWorkflowCommand.js +5 -0
- package/src/tools/shared/gitOperationTracking.js +220 -0
- package/src/tools/shared/spawnMultiAgent.js +805 -0
- package/src/tools/testing/TestingPermissionTool.js +72 -0
- package/src/tools/utils.js +24 -0
- package/src/tools.js +365 -0
- package/src/types/command.js +8 -0
- package/src/types/connectorText.js +3 -0
- package/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +673 -0
- package/src/types/generated/events_mono/common/v1/auth.js +49 -0
- package/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +147 -0
- package/src/types/generated/google/protobuf/timestamp.js +38 -0
- package/src/types/hooks.js +153 -0
- package/src/types/ids.js +27 -0
- package/src/types/logs.js +11 -0
- package/src/types/permissions.js +25 -0
- package/src/types/plugin.js +72 -0
- package/src/types/textInputTypes.js +20 -0
- package/src/upstreamproxy/relay.js +346 -0
- package/src/upstreamproxy/upstreamproxy.js +234 -0
- package/src/utils/CircularBuffer.js +75 -0
- package/src/utils/Cursor.js +1229 -0
- package/src/utils/QueryGuard.js +115 -0
- package/src/utils/Shell.js +374 -0
- package/src/utils/ShellCommand.js +336 -0
- package/src/utils/abortController.js +74 -0
- package/src/utils/activityManager.js +127 -0
- package/src/utils/advisor.js +77 -0
- package/src/utils/agentContext.js +91 -0
- package/src/utils/agentId.js +83 -0
- package/src/utils/agentSwarmsEnabled.js +37 -0
- package/src/utils/agenticSessionSearch.js +255 -0
- package/src/utils/analyzeContext.js +846 -0
- package/src/utils/ansiToPng.js +259 -0
- package/src/utils/ansiToSvg.js +207 -0
- package/src/utils/api.js +555 -0
- package/src/utils/apiPreconnect.js +62 -0
- package/src/utils/appleTerminalBackup.js +95 -0
- package/src/utils/argumentSubstitution.js +114 -0
- package/src/utils/array.js +12 -0
- package/src/utils/asciicast.js +200 -0
- package/src/utils/attachments.js +2518 -0
- package/src/utils/attribution.js +308 -0
- package/src/utils/auth.js +1598 -0
- package/src/utils/authFileDescriptor.js +152 -0
- package/src/utils/authPortable.js +14 -0
- package/src/utils/autoModeDenials.js +15 -0
- package/src/utils/autoRunIssue.js +113 -0
- package/src/utils/autoUpdater.js +457 -0
- package/src/utils/aws.js +44 -0
- package/src/utils/awsAuthStatusManager.js +66 -0
- package/src/utils/background/remote/preconditions.js +175 -0
- package/src/utils/background/remote/remoteSession.js +53 -0
- package/src/utils/backgroundHousekeeping.js +64 -0
- package/src/utils/bash/ParsedCommand.js +241 -0
- package/src/utils/bash/ShellSnapshot.js +489 -0
- package/src/utils/bash/ast.js +2590 -0
- package/src/utils/bash/bashParser.js +4355 -0
- package/src/utils/bash/bashPipeCommand.js +249 -0
- package/src/utils/bash/commands.js +1131 -0
- package/src/utils/bash/heredoc.js +647 -0
- package/src/utils/bash/parser.js +195 -0
- package/src/utils/bash/prefix.js +154 -0
- package/src/utils/bash/registry.js +23 -0
- package/src/utils/bash/shellCompletion.js +196 -0
- package/src/utils/bash/shellPrefix.js +25 -0
- package/src/utils/bash/shellQuote.js +253 -0
- package/src/utils/bash/shellQuoting.js +106 -0
- package/src/utils/bash/specs/alias.js +11 -0
- package/src/utils/bash/specs/index.js +16 -0
- package/src/utils/bash/specs/nohup.js +10 -0
- package/src/utils/bash/specs/pyright.js +88 -0
- package/src/utils/bash/specs/sleep.js +10 -0
- package/src/utils/bash/specs/srun.js +28 -0
- package/src/utils/bash/specs/time.js +10 -0
- package/src/utils/bash/specs/timeout.js +17 -0
- package/src/utils/bash/treeSitterAnalysis.js +407 -0
- package/src/utils/betas.js +331 -0
- package/src/utils/billing.js +54 -0
- package/src/utils/binaryCheck.js +40 -0
- package/src/utils/browser.js +58 -0
- package/src/utils/bufferedWriter.js +77 -0
- package/src/utils/bundledMode.js +19 -0
- package/src/utils/businessDb.js +390 -0
- package/src/utils/caCerts.js +91 -0
- package/src/utils/caCertsConfig.js +77 -0
- package/src/utils/cachePaths.js +28 -0
- package/src/utils/classifierApprovals.js +66 -0
- package/src/utils/classifierApprovalsHook.js +10 -0
- package/src/utils/claudeDesktop.js +108 -0
- package/src/utils/claudeInChrome/chromeNativeHost.js +416 -0
- package/src/utils/claudeInChrome/common.js +466 -0
- package/src/utils/claudeInChrome/mcpServer.js +237 -0
- package/src/utils/claudeInChrome/prompt.js +79 -0
- package/src/utils/claudeInChrome/setup.js +304 -0
- package/src/utils/claudeInChrome/setupPortable.js +172 -0
- package/src/utils/claudeInChrome/toolRendering.js +235 -0
- package/src/utils/claudemd.js +1052 -0
- package/src/utils/cleanup.js +514 -0
- package/src/utils/cleanupRegistry.js +22 -0
- package/src/utils/cliArgs.js +53 -0
- package/src/utils/cliHighlight.js +45 -0
- package/src/utils/codeIndexing.js +149 -0
- package/src/utils/collapseBackgroundBashNotifications.js +70 -0
- package/src/utils/collapseHookSummaries.js +48 -0
- package/src/utils/collapseReadSearch.js +869 -0
- package/src/utils/collapseTeammateShutdowns.js +44 -0
- package/src/utils/combinedAbortSignal.js +40 -0
- package/src/utils/commandLifecycle.js +7 -0
- package/src/utils/commitAttribution.js +718 -0
- package/src/utils/completionCache.js +138 -0
- package/src/utils/computerUse/appNames.js +170 -0
- package/src/utils/computerUse/cleanup.js +65 -0
- package/src/utils/computerUse/common.js +56 -0
- package/src/utils/computerUse/computerUseLock.js +183 -0
- package/src/utils/computerUse/drainRunLoop.js +71 -0
- package/src/utils/computerUse/escHotkey.js +53 -0
- package/src/utils/computerUse/executor.js +480 -0
- package/src/utils/computerUse/gates.js +55 -0
- package/src/utils/computerUse/hostAdapter.js +62 -0
- package/src/utils/computerUse/inputLoader.js +25 -0
- package/src/utils/computerUse/mcpServer.js +84 -0
- package/src/utils/computerUse/setup.js +42 -0
- package/src/utils/computerUse/swiftLoader.js +18 -0
- package/src/utils/computerUse/toolRendering.js +101 -0
- package/src/utils/computerUse/wrapper.js +317 -0
- package/src/utils/concurrentSessions.js +179 -0
- package/src/utils/config.js +1078 -0
- package/src/utils/configConstants.js +18 -0
- package/src/utils/contentArray.js +45 -0
- package/src/utils/context.js +185 -0
- package/src/utils/contextAnalysis.js +171 -0
- package/src/utils/contextSuggestions.js +158 -0
- package/src/utils/controlMessageCompat.js +31 -0
- package/src/utils/conversationRecovery.js +434 -0
- package/src/utils/cron.js +260 -0
- package/src/utils/cronJitterConfig.js +62 -0
- package/src/utils/cronScheduler.js +388 -0
- package/src/utils/cronTasks.js +328 -0
- package/src/utils/cronTasksLock.js +159 -0
- package/src/utils/crossProjectResume.js +46 -0
- package/src/utils/crypto.js +13 -0
- package/src/utils/cwd.js +29 -0
- package/src/utils/debug.js +220 -0
- package/src/utils/debugFilter.js +125 -0
- package/src/utils/deepLink/banner.js +103 -0
- package/src/utils/deepLink/parseDeepLink.js +138 -0
- package/src/utils/deepLink/protocolHandler.js +119 -0
- package/src/utils/deepLink/registerProtocol.js +291 -0
- package/src/utils/deepLink/terminalLauncher.js +455 -0
- package/src/utils/deepLink/terminalPreference.js +51 -0
- package/src/utils/desktopDeepLink.js +208 -0
- package/src/utils/detectRepository.js +157 -0
- package/src/utils/diagLogs.js +74 -0
- package/src/utils/diff.js +108 -0
- package/src/utils/directMemberMessage.js +34 -0
- package/src/utils/displayTags.js +46 -0
- package/src/utils/doctorContextWarnings.js +179 -0
- package/src/utils/doctorDiagnostic.js +494 -0
- package/src/utils/dxt/helpers.js +64 -0
- package/src/utils/dxt/zip.js +167 -0
- package/src/utils/earlyInput.js +166 -0
- package/src/utils/editor.js +163 -0
- package/src/utils/effort.js +271 -0
- package/src/utils/embeddedTools.js +26 -0
- package/src/utils/employeeChat.js +271 -0
- package/src/utils/employeeDb.js +326 -0
- package/src/utils/env.js +358 -0
- package/src/utils/envDynamic.js +130 -0
- package/src/utils/envUtils.js +161 -0
- package/src/utils/envValidation.js +26 -0
- package/src/utils/errorLogSink.js +196 -0
- package/src/utils/errors.js +207 -0
- package/src/utils/exampleCommands.js +165 -0
- package/src/utils/execFileNoThrow.js +93 -0
- package/src/utils/execFileNoThrowPortable.js +49 -0
- package/src/utils/execSyncWrapper.js +6 -0
- package/src/utils/exportRenderer.js +71 -0
- package/src/utils/extraUsage.js +19 -0
- package/src/utils/fastMode.js +393 -0
- package/src/utils/file.js +467 -0
- package/src/utils/fileHistory.js +851 -0
- package/src/utils/fileOperationAnalytics.js +45 -0
- package/src/utils/filePersistence/filePersistence.js +212 -0
- package/src/utils/filePersistence/outputsScanner.js +104 -0
- package/src/utils/filePersistence/types.js +4 -0
- package/src/utils/fileRead.js +81 -0
- package/src/utils/fileReadCache.js +78 -0
- package/src/utils/fileStateCache.js +99 -0
- package/src/utils/findExecutable.js +13 -0
- package/src/utils/fingerprint.js +58 -0
- package/src/utils/forkedAgent.js +410 -0
- package/src/utils/format.js +238 -0
- package/src/utils/formatBriefTimestamp.js +72 -0
- package/src/utils/fpsTracker.js +34 -0
- package/src/utils/frontmatterParser.js +260 -0
- package/src/utils/fsOperations.js +555 -0
- package/src/utils/fullscreen.js +194 -0
- package/src/utils/generatedFiles.js +122 -0
- package/src/utils/generators.js +67 -0
- package/src/utils/genericProcessUtils.js +155 -0
- package/src/utils/getWorktreePaths.js +56 -0
- package/src/utils/getWorktreePathsPortable.js +23 -0
- package/src/utils/ghPrStatus.js +71 -0
- package/src/utils/git/gitConfigParser.js +226 -0
- package/src/utils/git/gitFilesystem.js +606 -0
- package/src/utils/git/gitignore.js +84 -0
- package/src/utils/git.js +725 -0
- package/src/utils/gitDiff.js +395 -0
- package/src/utils/gitSettings.js +18 -0
- package/src/utils/github/ghAuthStatus.js +23 -0
- package/src/utils/githubRepoPathMapping.js +135 -0
- package/src/utils/glob.js +90 -0
- package/src/utils/gracefulShutdown.js +447 -0
- package/src/utils/groupToolUses.js +126 -0
- package/src/utils/handlePromptSubmit.js +398 -0
- package/src/utils/hash.js +44 -0
- package/src/utils/headlessProfiler.js +147 -0
- package/src/utils/heapDumpService.js +201 -0
- package/src/utils/heatmap.js +151 -0
- package/src/utils/highlightMatch.js +29 -0
- package/src/utils/hooks/AsyncHookRegistry.js +187 -0
- package/src/utils/hooks/apiQueryHookHelper.js +77 -0
- package/src/utils/hooks/execAgentHook.js +257 -0
- package/src/utils/hooks/execHttpHook.js +184 -0
- package/src/utils/hooks/execPromptHook.js +171 -0
- package/src/utils/hooks/fileChangedWatcher.js +161 -0
- package/src/utils/hooks/hookEvents.js +111 -0
- package/src/utils/hooks/hookHelpers.js +60 -0
- package/src/utils/hooks/hooksConfigManager.js +323 -0
- package/src/utils/hooks/hooksConfigSnapshot.js +114 -0
- package/src/utils/hooks/hooksSettings.js +204 -0
- package/src/utils/hooks/postSamplingHooks.js +39 -0
- package/src/utils/hooks/registerFrontmatterHooks.js +47 -0
- package/src/utils/hooks/registerSkillHooks.js +40 -0
- package/src/utils/hooks/sessionHooks.js +252 -0
- package/src/utils/hooks/skillImprovement.js +211 -0
- package/src/utils/hooks/ssrfGuard.js +258 -0
- package/src/utils/hooks.js +3668 -0
- package/src/utils/horizontalScroll.js +108 -0
- package/src/utils/http.js +120 -0
- package/src/utils/hyperlink.js +28 -0
- package/src/utils/iTermBackup.js +48 -0
- package/src/utils/ide.js +1195 -0
- package/src/utils/idePathConversion.js +66 -0
- package/src/utils/idleTimeout.js +44 -0
- package/src/utils/imagePaste.js +343 -0
- package/src/utils/imageResizer.js +664 -0
- package/src/utils/imageStore.js +150 -0
- package/src/utils/imageValidation.js +92 -0
- package/src/utils/immediateCommand.js +12 -0
- package/src/utils/inProcessTeammateHelpers.js +71 -0
- package/src/utils/ink.js +20 -0
- package/src/utils/intl.js +83 -0
- package/src/utils/jetbrains.js +152 -0
- package/src/utils/json.js +231 -0
- package/src/utils/jsonRead.js +14 -0
- package/src/utils/keyboardShortcuts.js +11 -0
- package/src/utils/lazySchema.js +8 -0
- package/src/utils/listSessionsImpl.js +332 -0
- package/src/utils/localInstaller.js +130 -0
- package/src/utils/lockfile.js +30 -0
- package/src/utils/log.js +280 -0
- package/src/utils/logoV2Utils.js +256 -0
- package/src/utils/mailbox.js +50 -0
- package/src/utils/managedEnv.js +160 -0
- package/src/utils/managedEnvConstants.js +185 -0
- package/src/utils/markdown.js +315 -0
- package/src/utils/markdownConfigLoader.js +480 -0
- package/src/utils/mcp/dateTimeParser.js +102 -0
- package/src/utils/mcp/elicitationValidation.js +259 -0
- package/src/utils/mcpInstructionsDelta.js +97 -0
- package/src/utils/mcpOutputStorage.js +159 -0
- package/src/utils/mcpValidation.js +165 -0
- package/src/utils/mcpWebSocketTransport.js +180 -0
- package/src/utils/memoize.js +205 -0
- package/src/utils/memory/types.js +9 -0
- package/src/utils/memory/versions.js +7 -0
- package/src/utils/memoryFileDetection.js +245 -0
- package/src/utils/messagePredicates.js +6 -0
- package/src/utils/messageQueueManager.js +430 -0
- package/src/utils/messages/mappers.js +240 -0
- package/src/utils/messages/systemInit.js +72 -0
- package/src/utils/messages.js +4286 -0
- package/src/utils/model/agent.js +128 -0
- package/src/utils/model/aliases.js +21 -0
- package/src/utils/model/antModels.js +25 -0
- package/src/utils/model/bedrock.js +220 -0
- package/src/utils/model/check1mAccess.js +64 -0
- package/src/utils/model/configs.js +86 -0
- package/src/utils/model/contextWindowUpgradeCheck.js +41 -0
- package/src/utils/model/deprecation.js +72 -0
- package/src/utils/model/model.js +533 -0
- package/src/utils/model/modelAllowlist.js +148 -0
- package/src/utils/model/modelCapabilities.js +105 -0
- package/src/utils/model/modelOptions.js +450 -0
- package/src/utils/model/modelStrings.js +144 -0
- package/src/utils/model/modelSupportOverrides.js +40 -0
- package/src/utils/model/providers.js +35 -0
- package/src/utils/model/validateModel.js +131 -0
- package/src/utils/modelCost.js +160 -0
- package/src/utils/modifiers.js +39 -0
- package/src/utils/mtls.js +132 -0
- package/src/utils/nativeInstaller/download.js +370 -0
- package/src/utils/nativeInstaller/index.js +8 -0
- package/src/utils/nativeInstaller/installer.js +1395 -0
- package/src/utils/nativeInstaller/packageManagers.js +258 -0
- package/src/utils/nativeInstaller/pidLock.js +347 -0
- package/src/utils/notebook.js +176 -0
- package/src/utils/objectGroupBy.js +15 -0
- package/src/utils/pasteStore.js +93 -0
- package/src/utils/path.js +140 -0
- package/src/utils/pdf.js +236 -0
- package/src/utils/pdfUtils.js +61 -0
- package/src/utils/peerAddress.js +20 -0
- package/src/utils/permissions/PermissionMode.js +95 -0
- package/src/utils/permissions/PermissionPromptToolResultSchema.js +85 -0
- package/src/utils/permissions/PermissionResult.js +11 -0
- package/src/utils/permissions/PermissionRule.js +19 -0
- package/src/utils/permissions/PermissionUpdate.js +268 -0
- package/src/utils/permissions/PermissionUpdateSchema.js +61 -0
- package/src/utils/permissions/autoModeState.js +31 -0
- package/src/utils/permissions/bashClassifier.js +30 -0
- package/src/utils/permissions/bypassPermissionsKillswitch.js +115 -0
- package/src/utils/permissions/classifierDecision.js +86 -0
- package/src/utils/permissions/classifierShared.js +28 -0
- package/src/utils/permissions/dangerousPatterns.js +78 -0
- package/src/utils/permissions/denialTracking.js +34 -0
- package/src/utils/permissions/filesystem.js +1411 -0
- package/src/utils/permissions/getNextPermissionMode.js +74 -0
- package/src/utils/permissions/pathValidation.js +351 -0
- package/src/utils/permissions/permissionExplainer.js +188 -0
- package/src/utils/permissions/permissionRuleParser.js +175 -0
- package/src/utils/permissions/permissionSetup.js +1162 -0
- package/src/utils/permissions/permissions.js +1063 -0
- package/src/utils/permissions/permissionsLoader.js +217 -0
- package/src/utils/permissions/shadowedRuleDetection.js +149 -0
- package/src/utils/permissions/shellRuleMatching.js +174 -0
- package/src/utils/permissions/yoloClassifier.js +1193 -0
- package/src/utils/planModeV2.js +75 -0
- package/src/utils/plans.js +334 -0
- package/src/utils/platform.js +122 -0
- package/src/utils/plugins/addDirPluginSettings.js +53 -0
- package/src/utils/plugins/cacheUtils.js +174 -0
- package/src/utils/plugins/dependencyResolver.js +244 -0
- package/src/utils/plugins/fetchTelemetry.js +108 -0
- package/src/utils/plugins/gitAvailability.js +65 -0
- package/src/utils/plugins/headlessPluginInstall.js +136 -0
- package/src/utils/plugins/hintRecommendation.js +136 -0
- package/src/utils/plugins/installCounts.js +221 -0
- package/src/utils/plugins/installedPluginsManager.js +1003 -0
- package/src/utils/plugins/loadPluginAgents.js +219 -0
- package/src/utils/plugins/loadPluginCommands.js +595 -0
- package/src/utils/plugins/loadPluginHooks.js +239 -0
- package/src/utils/plugins/loadPluginOutputStyles.js +112 -0
- package/src/utils/plugins/lspPluginIntegration.js +293 -0
- package/src/utils/plugins/lspRecommendation.js +278 -0
- package/src/utils/plugins/managedPlugins.js +26 -0
- package/src/utils/plugins/marketplaceHelpers.js +470 -0
- package/src/utils/plugins/marketplaceManager.js +1939 -0
- package/src/utils/plugins/mcpPluginIntegration.js +465 -0
- package/src/utils/plugins/mcpbHandler.js +708 -0
- package/src/utils/plugins/officialMarketplace.js +19 -0
- package/src/utils/plugins/officialMarketplaceGcs.js +202 -0
- package/src/utils/plugins/officialMarketplaceStartupCheck.js +344 -0
- package/src/utils/plugins/orphanedPluginFilter.js +96 -0
- package/src/utils/plugins/parseMarketplaceInput.js +143 -0
- package/src/utils/plugins/performStartupChecks.js +66 -0
- package/src/utils/plugins/pluginAutoupdate.js +210 -0
- package/src/utils/plugins/pluginBlocklist.js +93 -0
- package/src/utils/plugins/pluginDirectories.js +170 -0
- package/src/utils/plugins/pluginFlagging.js +173 -0
- package/src/utils/plugins/pluginIdentifier.js +78 -0
- package/src/utils/plugins/pluginInstallationHelpers.js +400 -0
- package/src/utils/plugins/pluginLoader.js +2426 -0
- package/src/utils/plugins/pluginOptionsStorage.js +311 -0
- package/src/utils/plugins/pluginPolicy.js +18 -0
- package/src/utils/plugins/pluginStartupCheck.js +261 -0
- package/src/utils/plugins/pluginVersioning.js +128 -0
- package/src/utils/plugins/reconciler.js +181 -0
- package/src/utils/plugins/refresh.js +162 -0
- package/src/utils/plugins/schemas.js +1283 -0
- package/src/utils/plugins/validatePlugin.js +765 -0
- package/src/utils/plugins/walkPluginMarkdown.js +49 -0
- package/src/utils/plugins/zipCache.js +346 -0
- package/src/utils/plugins/zipCacheAdapters.js +133 -0
- package/src/utils/powershell/dangerousCmdlets.js +174 -0
- package/src/utils/powershell/parser.js +1357 -0
- package/src/utils/powershell/staticPrefix.js +277 -0
- package/src/utils/preflightChecks.js +147 -0
- package/src/utils/privacyLevel.js +49 -0
- package/src/utils/process.js +56 -0
- package/src/utils/processUserInput/processBashCommand.js +118 -0
- package/src/utils/processUserInput/processSlashCommand.js +845 -0
- package/src/utils/processUserInput/processTextPrompt.js +68 -0
- package/src/utils/processUserInput/processUserInput.js +344 -0
- package/src/utils/profilerBase.js +32 -0
- package/src/utils/promptCategory.js +39 -0
- package/src/utils/promptEditor.js +151 -0
- package/src/utils/promptShellExecution.js +117 -0
- package/src/utils/protectedNamespace.js +4 -0
- package/src/utils/proxy.js +345 -0
- package/src/utils/queryContext.js +110 -0
- package/src/utils/queryHelpers.js +436 -0
- package/src/utils/queryProfiler.js +242 -0
- package/src/utils/queueProcessor.js +70 -0
- package/src/utils/readEditContext.js +176 -0
- package/src/utils/readFileInRange.js +278 -0
- package/src/utils/releaseNotes.js +307 -0
- package/src/utils/renderOptions.js +67 -0
- package/src/utils/ripgrep.js +521 -0
- package/src/utils/sandbox/sandbox-adapter.js +750 -0
- package/src/utils/sandbox/sandbox-ui-utils.js +11 -0
- package/src/utils/sanitization.js +72 -0
- package/src/utils/screenshotClipboard.js +89 -0
- package/src/utils/sdkEventQueue.js +49 -0
- package/src/utils/secureStorage/fallbackStorage.js +59 -0
- package/src/utils/secureStorage/index.js +13 -0
- package/src/utils/secureStorage/keychainPrefetch.js +91 -0
- package/src/utils/secureStorage/macOsKeychainHelpers.js +91 -0
- package/src/utils/secureStorage/macOsKeychainStorage.js +192 -0
- package/src/utils/secureStorage/plainTextStorage.js +81 -0
- package/src/utils/semanticBoolean.js +23 -0
- package/src/utils/semanticNumber.js +34 -0
- package/src/utils/semver.js +51 -0
- package/src/utils/sequential.js +43 -0
- package/src/utils/sessionActivity.js +120 -0
- package/src/utils/sessionEnvVars.js +18 -0
- package/src/utils/sessionEnvironment.js +131 -0
- package/src/utils/sessionFileAccessHooks.js +205 -0
- package/src/utils/sessionIngressAuth.js +113 -0
- package/src/utils/sessionRestore.js +357 -0
- package/src/utils/sessionStart.js +165 -0
- package/src/utils/sessionState.js +76 -0
- package/src/utils/sessionStorage.js +4162 -0
- package/src/utils/sessionStoragePortable.js +665 -0
- package/src/utils/sessionTitle.js +120 -0
- package/src/utils/sessionUrl.js +50 -0
- package/src/utils/set.js +50 -0
- package/src/utils/settings/allErrors.js +29 -0
- package/src/utils/settings/applySettingsChange.js +65 -0
- package/src/utils/settings/changeDetector.js +409 -0
- package/src/utils/settings/constants.js +166 -0
- package/src/utils/settings/internalWrites.js +33 -0
- package/src/utils/settings/managedPath.js +29 -0
- package/src/utils/settings/mdm/constants.js +62 -0
- package/src/utils/settings/mdm/rawRead.js +97 -0
- package/src/utils/settings/mdm/settings.js +254 -0
- package/src/utils/settings/permissionValidation.js +224 -0
- package/src/utils/settings/pluginOnlyPolicy.js +53 -0
- package/src/utils/settings/schemaOutput.js +7 -0
- package/src/utils/settings/settings.js +791 -0
- package/src/utils/settings/settingsCache.js +47 -0
- package/src/utils/settings/toolValidationConfig.js +76 -0
- package/src/utils/settings/types.js +846 -0
- package/src/utils/settings/validateEditTool.js +34 -0
- package/src/utils/settings/validation.js +192 -0
- package/src/utils/settings/validationTips.js +111 -0
- package/src/utils/shell/bashProvider.js +202 -0
- package/src/utils/shell/outputLimits.js +7 -0
- package/src/utils/shell/powershellDetection.js +96 -0
- package/src/utils/shell/powershellProvider.js +104 -0
- package/src/utils/shell/prefix.js +246 -0
- package/src/utils/shell/readOnlyCommandValidation.js +1776 -0
- package/src/utils/shell/resolveDefaultShell.js +13 -0
- package/src/utils/shell/shellProvider.js +2 -0
- package/src/utils/shell/shellToolUtils.js +21 -0
- package/src/utils/shell/specPrefix.js +198 -0
- package/src/utils/shellConfig.js +136 -0
- package/src/utils/sideQuery.js +134 -0
- package/src/utils/sideQuestion.js +121 -0
- package/src/utils/signal.js +34 -0
- package/src/utils/sinks.js +15 -0
- package/src/utils/skills/skillChangeDetector.js +264 -0
- package/src/utils/slashCommandParsing.js +46 -0
- package/src/utils/sleep.js +72 -0
- package/src/utils/sliceAnsi.js +74 -0
- package/src/utils/slowOperations.js +216 -0
- package/src/utils/standaloneAgent.js +20 -0
- package/src/utils/startupProfiler.js +149 -0
- package/src/utils/staticRender.js +104 -0
- package/src/utils/stats.js +802 -0
- package/src/utils/statsCache.js +330 -0
- package/src/utils/status.js +359 -0
- package/src/utils/statusNoticeDefinitions.js +123 -0
- package/src/utils/statusNoticeHelpers.js +15 -0
- package/src/utils/stream.js +73 -0
- package/src/utils/streamJsonStdoutGuard.js +107 -0
- package/src/utils/streamlinedTransform.js +162 -0
- package/src/utils/stringUtils.js +202 -0
- package/src/utils/subprocessEnv.js +87 -0
- package/src/utils/suggestions/commandSuggestions.js +458 -0
- package/src/utils/suggestions/directoryCompletion.js +191 -0
- package/src/utils/suggestions/shellHistoryCompletion.js +95 -0
- package/src/utils/suggestions/skillUsageTracking.js +50 -0
- package/src/utils/suggestions/slackChannelSuggestions.js +169 -0
- package/src/utils/swarm/It2SetupPrompt.js +386 -0
- package/src/utils/swarm/backends/ITermBackend.js +276 -0
- package/src/utils/swarm/backends/InProcessBackend.js +237 -0
- package/src/utils/swarm/backends/PaneBackendExecutor.js +250 -0
- package/src/utils/swarm/backends/TmuxBackend.js +574 -0
- package/src/utils/swarm/backends/detection.js +112 -0
- package/src/utils/swarm/backends/it2Setup.js +185 -0
- package/src/utils/swarm/backends/registry.js +369 -0
- package/src/utils/swarm/backends/teammateModeSnapshot.js +68 -0
- package/src/utils/swarm/backends/types.js +9 -0
- package/src/utils/swarm/constants.js +29 -0
- package/src/utils/swarm/inProcessRunner.js +1021 -0
- package/src/utils/swarm/leaderPermissionBridge.js +31 -0
- package/src/utils/swarm/permissionSync.js +667 -0
- package/src/utils/swarm/reconnection.js +82 -0
- package/src/utils/swarm/spawnInProcess.js +218 -0
- package/src/utils/swarm/spawnUtils.js +123 -0
- package/src/utils/swarm/teamHelpers.js +484 -0
- package/src/utils/swarm/teammateInit.js +87 -0
- package/src/utils/swarm/teammateLayoutManager.js +82 -0
- package/src/utils/swarm/teammateModel.js +9 -0
- package/src/utils/swarm/teammatePromptAddendum.js +17 -0
- package/src/utils/systemDirectories.js +51 -0
- package/src/utils/systemPrompt.js +88 -0
- package/src/utils/systemPromptType.js +9 -0
- package/src/utils/systemTheme.js +108 -0
- package/src/utils/taggedId.js +49 -0
- package/src/utils/task/TaskOutput.js +320 -0
- package/src/utils/task/diskOutput.js +387 -0
- package/src/utils/task/framework.js +236 -0
- package/src/utils/task/outputFormatting.js +24 -0
- package/src/utils/task/sdkProgress.js +24 -0
- package/src/utils/taskSummary.js +3 -0
- package/src/utils/tasks.js +672 -0
- package/src/utils/teamDiscovery.js +48 -0
- package/src/utils/teamMemoryOps.js +67 -0
- package/src/utils/teammate.js +237 -0
- package/src/utils/teammateContext.js +56 -0
- package/src/utils/teammateMailbox.js +793 -0
- package/src/utils/telemetry/betaSessionTracing.js +25 -0
- package/src/utils/telemetry/bigqueryExporter.js +17 -0
- package/src/utils/telemetry/events.js +7 -0
- package/src/utils/telemetry/instrumentation.js +16 -0
- package/src/utils/telemetry/logger.js +25 -0
- package/src/utils/telemetry/perfettoTracing.js +882 -0
- package/src/utils/telemetry/pluginTelemetry.js +76 -0
- package/src/utils/telemetry/sessionTracing.js +62 -0
- package/src/utils/telemetry/skillLoadedEvent.js +4 -0
- package/src/utils/telemetryAttributes.js +56 -0
- package/src/utils/teleport/api.js +299 -0
- package/src/utils/teleport/environmentSelection.js +55 -0
- package/src/utils/teleport/environments.js +84 -0
- package/src/utils/teleport/gitBundle.js +192 -0
- package/src/utils/teleport.js +1047 -0
- package/src/utils/tempfile.js +26 -0
- package/src/utils/terminal.js +105 -0
- package/src/utils/terminalPanel.js +155 -0
- package/src/utils/textHighlighting.js +113 -0
- package/src/utils/thaddeusHints.js +142 -0
- package/src/utils/theme.js +525 -0
- package/src/utils/thinking.js +130 -0
- package/src/utils/timeouts.js +35 -0
- package/src/utils/tmuxSocket.js +373 -0
- package/src/utils/todo/types.js +9 -0
- package/src/utils/tokenBudget.js +62 -0
- package/src/utils/tokens.js +223 -0
- package/src/utils/toolErrors.js +101 -0
- package/src/utils/toolPool.js +61 -0
- package/src/utils/toolResultStorage.js +768 -0
- package/src/utils/toolSchemaCache.js +7 -0
- package/src/utils/toolSearch.js +551 -0
- package/src/utils/transcriptSearch.js +200 -0
- package/src/utils/treeify.js +111 -0
- package/src/utils/truncate.js +164 -0
- package/src/utils/udsClient.js +5 -0
- package/src/utils/udsMessaging.js +23 -0
- package/src/utils/ultraplan/ccrSession.js +264 -0
- package/src/utils/ultraplan/keyword.js +122 -0
- package/src/utils/unaryLogging.js +16 -0
- package/src/utils/undercover.js +89 -0
- package/src/utils/user.js +137 -0
- package/src/utils/userAgent.js +9 -0
- package/src/utils/userPromptKeywords.js +21 -0
- package/src/utils/uuid.js +22 -0
- package/src/utils/warningHandler.js +97 -0
- package/src/utils/which.js +75 -0
- package/src/utils/windowsPaths.js +146 -0
- package/src/utils/withResolvers.js +13 -0
- package/src/utils/words.js +793 -0
- package/src/utils/workforceIntent.js +192 -0
- package/src/utils/workloadContext.js +42 -0
- package/src/utils/worktree.js +1142 -0
- package/src/utils/worktreeModeEnabled.js +11 -0
- package/src/utils/xdg.js +52 -0
- package/src/utils/xml.js +15 -0
- package/src/utils/yaml.js +14 -0
- package/src/utils/zodToJsonSchema.js +19 -0
- package/src/vim/motions.js +73 -0
- package/src/vim/operators.js +401 -0
- package/src/vim/textObjects.js +153 -0
- package/src/vim/transitions.js +340 -0
- package/src/vim/types.js +93 -0
- package/src/voice/voiceModeEnabled.js +20 -0
- package/thaddeus-terminal.ts +401 -3
|
@@ -0,0 +1,1221 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { feature } from 'bun:bundle';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { buildTool, toolMatchesName } from 'src/Tool.js';
|
|
5
|
+
import { getQuerySourceForAgent } from 'src/utils/promptCategory.js';
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
|
+
import { clearInvokedSkillsForAgent, getSdkAgentProgressSummariesEnabled } from '../../bootstrap/state.js';
|
|
8
|
+
import { enhanceSystemPromptWithEnvDetails, getSystemPrompt } from '../../constants/prompts.js';
|
|
9
|
+
import { isCoordinatorMode } from '../../coordinator/coordinatorMode.js';
|
|
10
|
+
import { startAgentSummarization } from '../../services/AgentSummary/agentSummary.js';
|
|
11
|
+
import { getFeatureValue_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js';
|
|
12
|
+
import { logEvent } from '../../services/analytics/index.js';
|
|
13
|
+
import { clearDumpState } from '../../services/api/dumpPrompts.js';
|
|
14
|
+
import { completeAgentTask as completeAsyncAgent, createActivityDescriptionResolver, createProgressTracker, enqueueAgentNotification, failAgentTask as failAsyncAgent, getProgressUpdate, getTokenCountFromTracker, isLocalAgentTask, killAsyncAgent, registerAgentForeground, registerAsyncAgent, unregisterAgentForeground, updateAgentProgress as updateAsyncAgentProgress, updateProgressFromMessage } from '../../tasks/LocalAgentTask/LocalAgentTask.js';
|
|
15
|
+
import { checkRemoteAgentEligibility, formatPreconditionError, getRemoteTaskSessionUrl, registerRemoteAgentTask } from '../../tasks/RemoteAgentTask/RemoteAgentTask.js';
|
|
16
|
+
import { assembleToolPool } from '../../tools.js';
|
|
17
|
+
import { asAgentId } from '../../types/ids.js';
|
|
18
|
+
import { runWithAgentContext } from '../../utils/agentContext.js';
|
|
19
|
+
import { isAgentSwarmsEnabled } from '../../utils/agentSwarmsEnabled.js';
|
|
20
|
+
import { getCwd, runWithCwdOverride } from '../../utils/cwd.js';
|
|
21
|
+
import { logForDebugging } from '../../utils/debug.js';
|
|
22
|
+
import { isEnvTruthy } from '../../utils/envUtils.js';
|
|
23
|
+
import { AbortError, errorMessage, toError } from '../../utils/errors.js';
|
|
24
|
+
import { lazySchema } from '../../utils/lazySchema.js';
|
|
25
|
+
import { createUserMessage, extractTextContent, isSyntheticMessage, normalizeMessages } from '../../utils/messages.js';
|
|
26
|
+
import { getAgentModel } from '../../utils/model/agent.js';
|
|
27
|
+
import { permissionModeSchema } from '../../utils/permissions/PermissionMode.js';
|
|
28
|
+
import { filterDeniedAgents, getDenyRuleForAgent } from '../../utils/permissions/permissions.js';
|
|
29
|
+
import { enqueueSdkEvent } from '../../utils/sdkEventQueue.js';
|
|
30
|
+
import { writeAgentMetadata } from '../../utils/sessionStorage.js';
|
|
31
|
+
import { sleep } from '../../utils/sleep.js';
|
|
32
|
+
import { buildEffectiveSystemPrompt } from '../../utils/systemPrompt.js';
|
|
33
|
+
import { asSystemPrompt } from '../../utils/systemPromptType.js';
|
|
34
|
+
import { getTaskOutputPath } from '../../utils/task/diskOutput.js';
|
|
35
|
+
import { getParentSessionId, isTeammate } from '../../utils/teammate.js';
|
|
36
|
+
import { isInProcessTeammate } from '../../utils/teammateContext.js';
|
|
37
|
+
import { teleportToRemote } from '../../utils/teleport.js';
|
|
38
|
+
import { getAssistantMessageContentLength } from '../../utils/tokens.js';
|
|
39
|
+
import { createAgentId } from '../../utils/uuid.js';
|
|
40
|
+
import { createAgentWorktree, hasWorktreeChanges, removeAgentWorktree } from '../../utils/worktree.js';
|
|
41
|
+
import { BASH_TOOL_NAME } from '../BashTool/toolName.js';
|
|
42
|
+
import { BackgroundHint } from '../BashTool/UI.js';
|
|
43
|
+
import { FILE_READ_TOOL_NAME } from '../FileReadTool/prompt.js';
|
|
44
|
+
import { spawnTeammate } from '../shared/spawnMultiAgent.js';
|
|
45
|
+
import { setAgentColor } from './agentColorManager.js';
|
|
46
|
+
import { agentToolResultSchema, classifyHandoffIfNeeded, emitTaskProgress, extractPartialResult, finalizeAgentTool, getLastToolUseName, runAsyncAgentLifecycle } from './agentToolUtils.js';
|
|
47
|
+
import { GENERAL_PURPOSE_AGENT } from './built-in/generalPurposeAgent.js';
|
|
48
|
+
import { AGENT_TOOL_NAME, LEGACY_AGENT_TOOL_NAME, ONE_SHOT_BUILTIN_AGENT_TYPES } from './constants.js';
|
|
49
|
+
import { buildForkedMessages, buildWorktreeNotice, FORK_AGENT, isForkSubagentEnabled, isInForkChild } from './forkSubagent.js';
|
|
50
|
+
import { filterAgentsByMcpRequirements, hasRequiredMcpServers, isBuiltInAgent } from './loadAgentsDir.js';
|
|
51
|
+
import { getPrompt } from './prompt.js';
|
|
52
|
+
import { runAgent } from './runAgent.js';
|
|
53
|
+
import { renderGroupedAgentToolUse, renderToolResultMessage, renderToolUseErrorMessage, renderToolUseMessage, renderToolUseProgressMessage, renderToolUseRejectedMessage, renderToolUseTag, userFacingName, userFacingNameBackgroundColor } from './UI.js';
|
|
54
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
55
|
+
const proactiveModule = feature('PROACTIVE') || feature('KAIROS') ? require('../../proactive/index.js') : null;
|
|
56
|
+
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
57
|
+
// Progress display constants (for showing background hint)
|
|
58
|
+
const PROGRESS_THRESHOLD_MS = 2000; // Show background hint after 2 seconds
|
|
59
|
+
// Check if background tasks are disabled at module load time
|
|
60
|
+
const isBackgroundTasksDisabled =
|
|
61
|
+
// eslint-disable-next-line custom-rules/no-process-env-top-level -- Intentional: schema must be defined at module load
|
|
62
|
+
isEnvTruthy(process.env.THADDEUS_DISABLE_BACKGROUND_TASKS);
|
|
63
|
+
// Auto-background agent tasks after this many ms (0 = disabled)
|
|
64
|
+
// Enabled by env var OR GrowthBook gate (checked lazily since GB may not be ready at module load)
|
|
65
|
+
function getAutoBackgroundMs() {
|
|
66
|
+
if (isEnvTruthy(process.env.CLAUDE_AUTO_BACKGROUND_TASKS) || getFeatureValue_CACHED_MAY_BE_STALE('thaddeus_auto_background_agents', false)) {
|
|
67
|
+
return 120_000;
|
|
68
|
+
}
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
// Multi-agent type constants are defined inline inside gated blocks to enable dead code elimination
|
|
72
|
+
// Base input schema without multi-agent parameters
|
|
73
|
+
const baseInputSchema = lazySchema(() => z.object({
|
|
74
|
+
description: z.string().describe('A short (3-5 word) description of the task'),
|
|
75
|
+
prompt: z.string().describe('The task for the agent to perform'),
|
|
76
|
+
subagent_type: z.string().optional().describe('The type of specialized agent to use for this task'),
|
|
77
|
+
model: z.enum(['sonnet', 'opus', 'haiku']).optional().describe("Optional model override for this agent. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model, or inherits from the parent."),
|
|
78
|
+
run_in_background: z.boolean().optional().describe('Set to true to run this agent in the background. You will be notified when it completes.')
|
|
79
|
+
}));
|
|
80
|
+
// Full schema combining base + multi-agent params + isolation
|
|
81
|
+
const fullInputSchema = lazySchema(() => {
|
|
82
|
+
// Multi-agent parameters
|
|
83
|
+
const multiAgentInputSchema = z.object({
|
|
84
|
+
name: z.string().optional().describe('Name for the spawned agent. Makes it addressable via SendMessage({to: name}) while running.'),
|
|
85
|
+
team_name: z.string().optional().describe('Team name for spawning. Uses current team context if omitted.'),
|
|
86
|
+
mode: permissionModeSchema().optional().describe('Permission mode for spawned teammate (e.g., "plan" to require plan approval).')
|
|
87
|
+
});
|
|
88
|
+
return baseInputSchema().merge(multiAgentInputSchema).extend({
|
|
89
|
+
isolation: ("external" === 'ant' ? z.enum(['worktree', 'remote']) : z.enum(['worktree'])).optional().describe("external" === 'ant' ? 'Isolation mode. "worktree" creates a temporary git worktree so the agent works on an isolated copy of the repo. "remote" launches the agent in a remote CCR environment (always runs in background).' : 'Isolation mode. "worktree" creates a temporary git worktree so the agent works on an isolated copy of the repo.'),
|
|
90
|
+
cwd: z.string().optional().describe('Absolute path to run the agent in. Overrides the working directory for all filesystem and shell operations within this agent. Mutually exclusive with isolation: "worktree".')
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
// Strip optional fields from the schema when the backing feature is off so
|
|
94
|
+
// the model never sees them. Done via .omit() rather than conditional spread
|
|
95
|
+
// inside .extend() because the spread-ternary breaks Zod's type inference
|
|
96
|
+
// (field type collapses to `unknown`). The ternary return produces a union
|
|
97
|
+
// type, but call() destructures via the explicit AgentToolInput type below
|
|
98
|
+
// which always includes all optional fields.
|
|
99
|
+
export const inputSchema = lazySchema(() => {
|
|
100
|
+
const schema = feature('KAIROS') ? fullInputSchema() : fullInputSchema().omit({
|
|
101
|
+
cwd: true
|
|
102
|
+
});
|
|
103
|
+
// GrowthBook-in-lazySchema is acceptable here (unlike subagent_type, which
|
|
104
|
+
// was removed in 906da6c723): the divergence window is one-session-per-
|
|
105
|
+
// gate-flip via _CACHED_MAY_BE_STALE disk read, and worst case is either
|
|
106
|
+
// "schema shows a no-op param" (gate flips on mid-session: param ignored
|
|
107
|
+
// by forceAsync) or "schema hides a param that would've worked" (gate
|
|
108
|
+
// flips off mid-session: everything still runs async via memoized
|
|
109
|
+
// forceAsync). No Zod rejection, no crash — unlike required→optional.
|
|
110
|
+
return isBackgroundTasksDisabled || isForkSubagentEnabled() ? schema.omit({
|
|
111
|
+
run_in_background: true
|
|
112
|
+
}) : schema;
|
|
113
|
+
});
|
|
114
|
+
// Output schema - multi-agent spawned schema added dynamically at runtime when enabled
|
|
115
|
+
export const outputSchema = lazySchema(() => {
|
|
116
|
+
const syncOutputSchema = agentToolResultSchema().extend({
|
|
117
|
+
status: z.literal('completed'),
|
|
118
|
+
prompt: z.string()
|
|
119
|
+
});
|
|
120
|
+
const asyncOutputSchema = z.object({
|
|
121
|
+
status: z.literal('async_launched'),
|
|
122
|
+
agentId: z.string().describe('The ID of the async agent'),
|
|
123
|
+
description: z.string().describe('The description of the task'),
|
|
124
|
+
prompt: z.string().describe('The prompt for the agent'),
|
|
125
|
+
outputFile: z.string().describe('Path to the output file for checking agent progress'),
|
|
126
|
+
canReadOutputFile: z.boolean().optional().describe('Whether the calling agent has Read/Bash tools to check progress')
|
|
127
|
+
});
|
|
128
|
+
return z.union([syncOutputSchema, asyncOutputSchema]);
|
|
129
|
+
});
|
|
130
|
+
export const AgentTool = buildTool({
|
|
131
|
+
async prompt({ agents, tools, getToolPermissionContext, allowedAgentTypes }) {
|
|
132
|
+
const toolPermissionContext = await getToolPermissionContext();
|
|
133
|
+
// Get MCP servers that have tools available
|
|
134
|
+
const mcpServersWithTools = [];
|
|
135
|
+
for (const tool of tools) {
|
|
136
|
+
if (tool.name?.startsWith('mcp__')) {
|
|
137
|
+
const parts = tool.name.split('__');
|
|
138
|
+
const serverName = parts[1];
|
|
139
|
+
if (serverName && !mcpServersWithTools.includes(serverName)) {
|
|
140
|
+
mcpServersWithTools.push(serverName);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Filter agents: first by MCP requirements, then by permission rules
|
|
145
|
+
const agentsWithMcpRequirementsMet = filterAgentsByMcpRequirements(agents, mcpServersWithTools);
|
|
146
|
+
const filteredAgents = filterDeniedAgents(agentsWithMcpRequirementsMet, toolPermissionContext, AGENT_TOOL_NAME);
|
|
147
|
+
// Use inline env check instead of coordinatorModule to avoid circular
|
|
148
|
+
// dependency issues during test module loading.
|
|
149
|
+
const isCoordinator = feature('COORDINATOR_MODE') ? isEnvTruthy(process.env.THADDEUS_COORDINATOR_MODE) : false;
|
|
150
|
+
return await getPrompt(filteredAgents, isCoordinator, allowedAgentTypes);
|
|
151
|
+
},
|
|
152
|
+
name: AGENT_TOOL_NAME,
|
|
153
|
+
searchHint: 'delegate work to a subagent',
|
|
154
|
+
aliases: [LEGACY_AGENT_TOOL_NAME],
|
|
155
|
+
maxResultSizeChars: 100_000,
|
|
156
|
+
async description() {
|
|
157
|
+
return 'Launch a new agent';
|
|
158
|
+
},
|
|
159
|
+
get inputSchema() {
|
|
160
|
+
return inputSchema();
|
|
161
|
+
},
|
|
162
|
+
get outputSchema() {
|
|
163
|
+
return outputSchema();
|
|
164
|
+
},
|
|
165
|
+
async call({ prompt, subagent_type, description, model: modelParam, run_in_background, name, team_name, mode: spawnMode, isolation, cwd }, toolUseContext, canUseTool, assistantMessage, onProgress) {
|
|
166
|
+
const startTime = Date.now();
|
|
167
|
+
const model = isCoordinatorMode() ? undefined : modelParam;
|
|
168
|
+
// Get app state for permission mode and agent filtering
|
|
169
|
+
const appState = toolUseContext.getAppState();
|
|
170
|
+
const permissionMode = appState.toolPermissionContext.mode;
|
|
171
|
+
// In-process teammates get a no-op setAppState; setAppStateForTasks
|
|
172
|
+
// reaches the root store so task registration/progress/kill stay visible.
|
|
173
|
+
const rootSetAppState = toolUseContext.setAppStateForTasks ?? toolUseContext.setAppState;
|
|
174
|
+
// Check if user is trying to use agent teams without access
|
|
175
|
+
if (team_name && !isAgentSwarmsEnabled()) {
|
|
176
|
+
throw new Error('Agent Teams is not yet available on your plan.');
|
|
177
|
+
}
|
|
178
|
+
// Teammates (in-process or tmux) passing `name` would trigger spawnTeammate()
|
|
179
|
+
// below, but TeamFile.members is a flat array with one leadAgentId — nested
|
|
180
|
+
// teammates land in the roster with no provenance and confuse the lead.
|
|
181
|
+
const teamName = resolveTeamName({
|
|
182
|
+
team_name
|
|
183
|
+
}, appState);
|
|
184
|
+
if (isTeammate() && teamName && name) {
|
|
185
|
+
throw new Error('Teammates cannot spawn other teammates — the team roster is flat. To spawn a subagent instead, omit the `name` parameter.');
|
|
186
|
+
}
|
|
187
|
+
// In-process teammates cannot spawn background agents (their lifecycle is
|
|
188
|
+
// tied to the leader's process). Tmux teammates are separate processes and
|
|
189
|
+
// can manage their own background agents.
|
|
190
|
+
if (isInProcessTeammate() && teamName && run_in_background === true) {
|
|
191
|
+
throw new Error('In-process teammates cannot spawn background agents. Use run_in_background=false for synchronous subagents.');
|
|
192
|
+
}
|
|
193
|
+
// Check if this is a multi-agent spawn request
|
|
194
|
+
// Spawn is triggered when team_name is set (from param or context) and name is provided
|
|
195
|
+
if (teamName && name) {
|
|
196
|
+
// Set agent definition color for grouped UI display before spawning
|
|
197
|
+
const agentDef = subagent_type ? toolUseContext.options.agentDefinitions.activeAgents.find(a => a.agentType === subagent_type) : undefined;
|
|
198
|
+
if (agentDef?.color) {
|
|
199
|
+
setAgentColor(subagent_type, agentDef.color);
|
|
200
|
+
}
|
|
201
|
+
const result = await spawnTeammate({
|
|
202
|
+
name,
|
|
203
|
+
prompt,
|
|
204
|
+
description,
|
|
205
|
+
team_name: teamName,
|
|
206
|
+
use_splitpane: true,
|
|
207
|
+
plan_mode_required: spawnMode === 'plan',
|
|
208
|
+
model: model ?? agentDef?.model,
|
|
209
|
+
agent_type: subagent_type,
|
|
210
|
+
invokingRequestId: assistantMessage?.requestId
|
|
211
|
+
}, toolUseContext);
|
|
212
|
+
// Type assertion uses TeammateSpawnedOutput (defined above) instead of any.
|
|
213
|
+
// This type is excluded from the exported outputSchema for dead code elimination.
|
|
214
|
+
// Cast through unknown because TeammateSpawnedOutput is intentionally
|
|
215
|
+
// not part of the exported Output union (for dead code elimination purposes).
|
|
216
|
+
const spawnResult = {
|
|
217
|
+
status: 'teammate_spawned',
|
|
218
|
+
prompt,
|
|
219
|
+
...result.data
|
|
220
|
+
};
|
|
221
|
+
return {
|
|
222
|
+
data: spawnResult
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
// Fork subagent experiment routing:
|
|
226
|
+
// - subagent_type set: use it (explicit wins)
|
|
227
|
+
// - subagent_type omitted, gate on: fork path (undefined)
|
|
228
|
+
// - subagent_type omitted, gate off: default general-purpose
|
|
229
|
+
const effectiveType = subagent_type ?? (isForkSubagentEnabled() ? undefined : GENERAL_PURPOSE_AGENT.agentType);
|
|
230
|
+
const isForkPath = effectiveType === undefined;
|
|
231
|
+
let selectedAgent;
|
|
232
|
+
if (isForkPath) {
|
|
233
|
+
// Recursive fork guard: fork children keep the Agent tool in their
|
|
234
|
+
// pool for cache-identical tool defs, so reject fork attempts at call
|
|
235
|
+
// time. Primary check is querySource (compaction-resistant — set on
|
|
236
|
+
// context.options at spawn time, survives autocompact's message
|
|
237
|
+
// rewrite). Message-scan fallback catches any path where querySource
|
|
238
|
+
// wasn't threaded.
|
|
239
|
+
if (toolUseContext.options.querySource === `agent:builtin:${FORK_AGENT.agentType}` || isInForkChild(toolUseContext.messages)) {
|
|
240
|
+
throw new Error('Fork is not available inside a forked worker. Complete your task directly using your tools.');
|
|
241
|
+
}
|
|
242
|
+
selectedAgent = FORK_AGENT;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
// Filter agents to exclude those denied via Agent(AgentName) syntax
|
|
246
|
+
const allAgents = toolUseContext.options.agentDefinitions.activeAgents;
|
|
247
|
+
const { allowedAgentTypes } = toolUseContext.options.agentDefinitions;
|
|
248
|
+
const agents = filterDeniedAgents(
|
|
249
|
+
// When allowedAgentTypes is set (from Agent(x,y) tool spec), restrict to those types
|
|
250
|
+
allowedAgentTypes ? allAgents.filter(a => allowedAgentTypes.includes(a.agentType)) : allAgents, appState.toolPermissionContext, AGENT_TOOL_NAME);
|
|
251
|
+
const found = agents.find(agent => agent.agentType === effectiveType);
|
|
252
|
+
if (!found) {
|
|
253
|
+
// Check if the agent exists but is denied by permission rules
|
|
254
|
+
const agentExistsButDenied = allAgents.find(agent => agent.agentType === effectiveType);
|
|
255
|
+
if (agentExistsButDenied) {
|
|
256
|
+
const denyRule = getDenyRuleForAgent(appState.toolPermissionContext, AGENT_TOOL_NAME, effectiveType);
|
|
257
|
+
throw new Error(`Agent type '${effectiveType}' has been denied by permission rule '${AGENT_TOOL_NAME}(${effectiveType})' from ${denyRule?.source ?? 'settings'}.`);
|
|
258
|
+
}
|
|
259
|
+
throw new Error(`Agent type '${effectiveType}' not found. Available agents: ${agents.map(a => a.agentType).join(', ')}`);
|
|
260
|
+
}
|
|
261
|
+
selectedAgent = found;
|
|
262
|
+
}
|
|
263
|
+
// Same lifecycle constraint as the run_in_background guard above, but for
|
|
264
|
+
// agent definitions that force background via `background: true`. Checked
|
|
265
|
+
// here because selectedAgent is only now resolved.
|
|
266
|
+
if (isInProcessTeammate() && teamName && selectedAgent.background === true) {
|
|
267
|
+
throw new Error(`In-process teammates cannot spawn background agents. Agent '${selectedAgent.agentType}' has background: true in its definition.`);
|
|
268
|
+
}
|
|
269
|
+
// Capture for type narrowing — `let selectedAgent` prevents TS from
|
|
270
|
+
// narrowing property types across the if-else assignment above.
|
|
271
|
+
const requiredMcpServers = selectedAgent.requiredMcpServers;
|
|
272
|
+
// Check if required MCP servers have tools available
|
|
273
|
+
// A server that's connected but not authenticated won't have any tools
|
|
274
|
+
if (requiredMcpServers?.length) {
|
|
275
|
+
// If any required servers are still pending (connecting), wait for them
|
|
276
|
+
// before checking tool availability. This avoids a race condition where
|
|
277
|
+
// the agent is invoked before MCP servers finish connecting.
|
|
278
|
+
const hasPendingRequiredServers = appState.mcp.clients.some(c => c.type === 'pending' && requiredMcpServers.some(pattern => c.name.toLowerCase().includes(pattern.toLowerCase())));
|
|
279
|
+
let currentAppState = appState;
|
|
280
|
+
if (hasPendingRequiredServers) {
|
|
281
|
+
const MAX_WAIT_MS = 30_000;
|
|
282
|
+
const POLL_INTERVAL_MS = 500;
|
|
283
|
+
const deadline = Date.now() + MAX_WAIT_MS;
|
|
284
|
+
while (Date.now() < deadline) {
|
|
285
|
+
await sleep(POLL_INTERVAL_MS);
|
|
286
|
+
currentAppState = toolUseContext.getAppState();
|
|
287
|
+
// Early exit: if any required server has already failed, no point
|
|
288
|
+
// waiting for other pending servers — the check will fail regardless.
|
|
289
|
+
const hasFailedRequiredServer = currentAppState.mcp.clients.some(c => c.type === 'failed' && requiredMcpServers.some(pattern => c.name.toLowerCase().includes(pattern.toLowerCase())));
|
|
290
|
+
if (hasFailedRequiredServer)
|
|
291
|
+
break;
|
|
292
|
+
const stillPending = currentAppState.mcp.clients.some(c => c.type === 'pending' && requiredMcpServers.some(pattern => c.name.toLowerCase().includes(pattern.toLowerCase())));
|
|
293
|
+
if (!stillPending)
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// Get servers that actually have tools (meaning they're connected AND authenticated)
|
|
298
|
+
const serversWithTools = [];
|
|
299
|
+
for (const tool of currentAppState.mcp.tools) {
|
|
300
|
+
if (tool.name?.startsWith('mcp__')) {
|
|
301
|
+
// Extract server name from tool name (format: mcp__serverName__toolName)
|
|
302
|
+
const parts = tool.name.split('__');
|
|
303
|
+
const serverName = parts[1];
|
|
304
|
+
if (serverName && !serversWithTools.includes(serverName)) {
|
|
305
|
+
serversWithTools.push(serverName);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (!hasRequiredMcpServers(selectedAgent, serversWithTools)) {
|
|
310
|
+
const missing = requiredMcpServers.filter(pattern => !serversWithTools.some(server => server.toLowerCase().includes(pattern.toLowerCase())));
|
|
311
|
+
throw new Error(`Agent '${selectedAgent.agentType}' requires MCP servers matching: ${missing.join(', ')}. ` + `MCP servers with tools: ${serversWithTools.length > 0 ? serversWithTools.join(', ') : 'none'}. ` + `Use /mcp to configure and authenticate the required MCP servers.`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// Initialize the color for this agent if it has a predefined one
|
|
315
|
+
if (selectedAgent.color) {
|
|
316
|
+
setAgentColor(selectedAgent.agentType, selectedAgent.color);
|
|
317
|
+
}
|
|
318
|
+
// Resolve agent params for logging (these are already resolved in runAgent)
|
|
319
|
+
const resolvedAgentModel = getAgentModel(selectedAgent.model, toolUseContext.options.mainLoopModel, isForkPath ? undefined : model, permissionMode);
|
|
320
|
+
logEvent('thaddeus_agent_tool_selected', {
|
|
321
|
+
agent_type: selectedAgent.agentType,
|
|
322
|
+
model: resolvedAgentModel,
|
|
323
|
+
source: selectedAgent.source,
|
|
324
|
+
color: selectedAgent.color,
|
|
325
|
+
is_built_in_agent: isBuiltInAgent(selectedAgent),
|
|
326
|
+
is_resume: false,
|
|
327
|
+
is_async: (run_in_background === true || selectedAgent.background === true) && !isBackgroundTasksDisabled,
|
|
328
|
+
is_fork: isForkPath
|
|
329
|
+
});
|
|
330
|
+
// Resolve effective isolation mode (explicit param overrides agent def)
|
|
331
|
+
const effectiveIsolation = isolation ?? selectedAgent.isolation;
|
|
332
|
+
// Remote isolation: delegate to CCR. Gated ant-only — the guard enables
|
|
333
|
+
// dead code elimination of the entire block for external builds.
|
|
334
|
+
if ("external" === 'ant' && effectiveIsolation === 'remote') {
|
|
335
|
+
const eligibility = await checkRemoteAgentEligibility();
|
|
336
|
+
if (!eligibility.eligible) {
|
|
337
|
+
const reasons = eligibility.errors.map(formatPreconditionError).join('\n');
|
|
338
|
+
throw new Error(`Cannot launch remote agent:\n${reasons}`);
|
|
339
|
+
}
|
|
340
|
+
let bundleFailHint;
|
|
341
|
+
const session = await teleportToRemote({
|
|
342
|
+
initialMessage: prompt,
|
|
343
|
+
description,
|
|
344
|
+
signal: toolUseContext.abortController.signal,
|
|
345
|
+
onBundleFail: msg => {
|
|
346
|
+
bundleFailHint = msg;
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
if (!session) {
|
|
350
|
+
throw new Error(bundleFailHint ?? 'Failed to create remote session');
|
|
351
|
+
}
|
|
352
|
+
const { taskId, sessionId } = registerRemoteAgentTask({
|
|
353
|
+
remoteTaskType: 'remote-agent',
|
|
354
|
+
session: {
|
|
355
|
+
id: session.id,
|
|
356
|
+
title: session.title || description
|
|
357
|
+
},
|
|
358
|
+
command: prompt,
|
|
359
|
+
context: toolUseContext,
|
|
360
|
+
toolUseId: toolUseContext.toolUseId
|
|
361
|
+
});
|
|
362
|
+
logEvent('thaddeus_agent_tool_remote_launched', {
|
|
363
|
+
agent_type: selectedAgent.agentType
|
|
364
|
+
});
|
|
365
|
+
const remoteResult = {
|
|
366
|
+
status: 'remote_launched',
|
|
367
|
+
taskId,
|
|
368
|
+
sessionUrl: getRemoteTaskSessionUrl(sessionId),
|
|
369
|
+
description,
|
|
370
|
+
prompt,
|
|
371
|
+
outputFile: getTaskOutputPath(taskId)
|
|
372
|
+
};
|
|
373
|
+
return {
|
|
374
|
+
data: remoteResult
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
// System prompt + prompt messages: branch on fork path.
|
|
378
|
+
//
|
|
379
|
+
// Fork path: child inherits the PARENT's system prompt (not FORK_AGENT's)
|
|
380
|
+
// for cache-identical API request prefixes. Prompt messages are built via
|
|
381
|
+
// buildForkedMessages() which clones the parent's full assistant message
|
|
382
|
+
// (all tool_use blocks) + placeholder tool_results + per-child directive.
|
|
383
|
+
//
|
|
384
|
+
// Normal path: build the selected agent's own system prompt with env
|
|
385
|
+
// details, and use a simple user message for the prompt.
|
|
386
|
+
let enhancedSystemPrompt;
|
|
387
|
+
let forkParentSystemPrompt;
|
|
388
|
+
let promptMessages;
|
|
389
|
+
if (isForkPath) {
|
|
390
|
+
if (toolUseContext.renderedSystemPrompt) {
|
|
391
|
+
forkParentSystemPrompt = toolUseContext.renderedSystemPrompt;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
// Fallback: recompute. May diverge from parent's cached bytes if
|
|
395
|
+
// GrowthBook state changed between parent turn-start and fork spawn.
|
|
396
|
+
const mainThreadAgentDefinition = appState.agent ? appState.agentDefinitions.activeAgents.find(a => a.agentType === appState.agent) : undefined;
|
|
397
|
+
const additionalWorkingDirectories = Array.from(appState.toolPermissionContext.additionalWorkingDirectories.keys());
|
|
398
|
+
const defaultSystemPrompt = await getSystemPrompt(toolUseContext.options.tools, toolUseContext.options.mainLoopModel, additionalWorkingDirectories, toolUseContext.options.mcpClients);
|
|
399
|
+
forkParentSystemPrompt = buildEffectiveSystemPrompt({
|
|
400
|
+
mainThreadAgentDefinition,
|
|
401
|
+
toolUseContext,
|
|
402
|
+
customSystemPrompt: toolUseContext.options.customSystemPrompt,
|
|
403
|
+
defaultSystemPrompt,
|
|
404
|
+
appendSystemPrompt: toolUseContext.options.appendSystemPrompt
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
promptMessages = buildForkedMessages(prompt, assistantMessage);
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
try {
|
|
411
|
+
const additionalWorkingDirectories = Array.from(appState.toolPermissionContext.additionalWorkingDirectories.keys());
|
|
412
|
+
// All agents have getSystemPrompt - pass toolUseContext to all
|
|
413
|
+
const agentPrompt = selectedAgent.getSystemPrompt({
|
|
414
|
+
toolUseContext
|
|
415
|
+
});
|
|
416
|
+
// Log agent memory loaded event for subagents
|
|
417
|
+
if (selectedAgent.memory) {
|
|
418
|
+
logEvent('thaddeus_agent_memory_loaded', {
|
|
419
|
+
...("external" === 'ant' && {
|
|
420
|
+
agent_type: selectedAgent.agentType
|
|
421
|
+
}),
|
|
422
|
+
scope: selectedAgent.memory,
|
|
423
|
+
source: 'subagent'
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
// Apply environment details enhancement
|
|
427
|
+
enhancedSystemPrompt = await enhanceSystemPromptWithEnvDetails([agentPrompt], resolvedAgentModel, additionalWorkingDirectories);
|
|
428
|
+
}
|
|
429
|
+
catch (error) {
|
|
430
|
+
logForDebugging(`Failed to get system prompt for agent ${selectedAgent.agentType}: ${errorMessage(error)}`);
|
|
431
|
+
}
|
|
432
|
+
promptMessages = [createUserMessage({
|
|
433
|
+
content: prompt
|
|
434
|
+
})];
|
|
435
|
+
}
|
|
436
|
+
const metadata = {
|
|
437
|
+
prompt,
|
|
438
|
+
resolvedAgentModel,
|
|
439
|
+
isBuiltInAgent: isBuiltInAgent(selectedAgent),
|
|
440
|
+
startTime,
|
|
441
|
+
agentType: selectedAgent.agentType,
|
|
442
|
+
isAsync: (run_in_background === true || selectedAgent.background === true) && !isBackgroundTasksDisabled
|
|
443
|
+
};
|
|
444
|
+
// Use inline env check instead of coordinatorModule to avoid circular
|
|
445
|
+
// dependency issues during test module loading.
|
|
446
|
+
const isCoordinator = feature('COORDINATOR_MODE') ? isEnvTruthy(process.env.THADDEUS_COORDINATOR_MODE) : false;
|
|
447
|
+
// Fork subagent experiment: force ALL spawns async for a unified
|
|
448
|
+
// <task-notification> interaction model (not just fork spawns — all of them).
|
|
449
|
+
const forceAsync = isForkSubagentEnabled();
|
|
450
|
+
// Assistant mode: force all agents async. Synchronous subagents hold the
|
|
451
|
+
// main loop's turn open until they complete — the daemon's inputQueue
|
|
452
|
+
// backs up, and the first overdue cron catch-up on spawn becomes N
|
|
453
|
+
// serial subagent turns blocking all user input. Same gate as
|
|
454
|
+
// executeForkedSlashCommand's fire-and-forget path; the
|
|
455
|
+
// <task-notification> re-entry there is handled by the else branch
|
|
456
|
+
// below (registerAsyncAgentTask + notifyOnCompletion).
|
|
457
|
+
const assistantForceAsync = feature('KAIROS') ? appState.kairosEnabled : false;
|
|
458
|
+
const shouldRunAsync = (run_in_background === true || selectedAgent.background === true || isCoordinator || forceAsync || assistantForceAsync || (proactiveModule?.isProactiveActive() ?? false)) && !isBackgroundTasksDisabled;
|
|
459
|
+
// Assemble the worker's tool pool independently of the parent's.
|
|
460
|
+
// Workers always get their tools from assembleToolPool with their own
|
|
461
|
+
// permission mode, so they aren't affected by the parent's tool
|
|
462
|
+
// restrictions. This is computed here so that runAgent doesn't need to
|
|
463
|
+
// import from tools.ts (which would create a circular dependency).
|
|
464
|
+
const workerPermissionContext = {
|
|
465
|
+
...appState.toolPermissionContext,
|
|
466
|
+
mode: selectedAgent.permissionMode ?? 'acceptEdits'
|
|
467
|
+
};
|
|
468
|
+
const workerTools = assembleToolPool(workerPermissionContext, appState.mcp.tools);
|
|
469
|
+
// Create a stable agent ID early so it can be used for worktree slug
|
|
470
|
+
const earlyAgentId = createAgentId();
|
|
471
|
+
// Set up worktree isolation if requested
|
|
472
|
+
let worktreeInfo = null;
|
|
473
|
+
if (effectiveIsolation === 'worktree') {
|
|
474
|
+
const slug = `agent-${earlyAgentId.slice(0, 8)}`;
|
|
475
|
+
worktreeInfo = await createAgentWorktree(slug);
|
|
476
|
+
}
|
|
477
|
+
// Fork + worktree: inject a notice telling the child to translate paths
|
|
478
|
+
// and re-read potentially stale files. Appended after the fork directive
|
|
479
|
+
// so it appears as the most recent guidance the child sees.
|
|
480
|
+
if (isForkPath && worktreeInfo) {
|
|
481
|
+
promptMessages.push(createUserMessage({
|
|
482
|
+
content: buildWorktreeNotice(getCwd(), worktreeInfo.worktreePath)
|
|
483
|
+
}));
|
|
484
|
+
}
|
|
485
|
+
const runAgentParams = {
|
|
486
|
+
agentDefinition: selectedAgent,
|
|
487
|
+
promptMessages,
|
|
488
|
+
toolUseContext,
|
|
489
|
+
canUseTool,
|
|
490
|
+
isAsync: shouldRunAsync,
|
|
491
|
+
querySource: toolUseContext.options.querySource ?? getQuerySourceForAgent(selectedAgent.agentType, isBuiltInAgent(selectedAgent)),
|
|
492
|
+
model: isForkPath ? undefined : model,
|
|
493
|
+
// Fork path: pass parent's system prompt AND parent's exact tool
|
|
494
|
+
// array (cache-identical prefix). workerTools is rebuilt under
|
|
495
|
+
// permissionMode 'bubble' which differs from the parent's mode, so
|
|
496
|
+
// its tool-def serialization diverges and breaks cache at the first
|
|
497
|
+
// differing tool. useExactTools also inherits the parent's
|
|
498
|
+
// thinkingConfig and isNonInteractiveSession (see runAgent.ts).
|
|
499
|
+
//
|
|
500
|
+
// Normal path: when a cwd override is in effect (worktree isolation
|
|
501
|
+
// or explicit cwd), skip the pre-built system prompt so runAgent's
|
|
502
|
+
// buildAgentSystemPrompt() runs inside wrapWithCwd where getCwd()
|
|
503
|
+
// returns the override path.
|
|
504
|
+
override: isForkPath ? {
|
|
505
|
+
systemPrompt: forkParentSystemPrompt
|
|
506
|
+
} : enhancedSystemPrompt && !worktreeInfo && !cwd ? {
|
|
507
|
+
systemPrompt: asSystemPrompt(enhancedSystemPrompt)
|
|
508
|
+
} : undefined,
|
|
509
|
+
availableTools: isForkPath ? toolUseContext.options.tools : workerTools,
|
|
510
|
+
// Pass parent conversation when the fork-subagent path needs full
|
|
511
|
+
// context. useExactTools inherits thinkingConfig (runAgent.ts:624).
|
|
512
|
+
forkContextMessages: isForkPath ? toolUseContext.messages : undefined,
|
|
513
|
+
...(isForkPath && {
|
|
514
|
+
useExactTools: true
|
|
515
|
+
}),
|
|
516
|
+
worktreePath: worktreeInfo?.worktreePath,
|
|
517
|
+
description
|
|
518
|
+
};
|
|
519
|
+
// Helper to wrap execution with a cwd override: explicit cwd arg (KAIROS)
|
|
520
|
+
// takes precedence over worktree isolation path.
|
|
521
|
+
const cwdOverridePath = cwd ?? worktreeInfo?.worktreePath;
|
|
522
|
+
const wrapWithCwd = (fn) => cwdOverridePath ? runWithCwdOverride(cwdOverridePath, fn) : fn();
|
|
523
|
+
// Helper to clean up worktree after agent completes
|
|
524
|
+
const cleanupWorktreeIfNeeded = async () => {
|
|
525
|
+
if (!worktreeInfo)
|
|
526
|
+
return {};
|
|
527
|
+
const { worktreePath, worktreeBranch, headCommit, gitRoot, hookBased } = worktreeInfo;
|
|
528
|
+
// Null out to make idempotent — guards against double-call if code
|
|
529
|
+
// between cleanup and end of try throws into catch
|
|
530
|
+
worktreeInfo = null;
|
|
531
|
+
if (hookBased) {
|
|
532
|
+
// Hook-based worktrees are always kept since we can't detect VCS changes
|
|
533
|
+
logForDebugging(`Hook-based agent worktree kept at: ${worktreePath}`);
|
|
534
|
+
return {
|
|
535
|
+
worktreePath
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
if (headCommit) {
|
|
539
|
+
const changed = await hasWorktreeChanges(worktreePath, headCommit);
|
|
540
|
+
if (!changed) {
|
|
541
|
+
await removeAgentWorktree(worktreePath, worktreeBranch, gitRoot);
|
|
542
|
+
// Clear worktreePath from metadata so resume doesn't try to use
|
|
543
|
+
// a deleted directory. Fire-and-forget to match runAgent's
|
|
544
|
+
// writeAgentMetadata handling.
|
|
545
|
+
void writeAgentMetadata(asAgentId(earlyAgentId), {
|
|
546
|
+
agentType: selectedAgent.agentType,
|
|
547
|
+
description
|
|
548
|
+
}).catch(_err => logForDebugging(`Failed to clear worktree metadata: ${_err}`));
|
|
549
|
+
return {};
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
logForDebugging(`Agent worktree has changes, keeping: ${worktreePath}`);
|
|
553
|
+
return {
|
|
554
|
+
worktreePath,
|
|
555
|
+
worktreeBranch
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
if (shouldRunAsync) {
|
|
559
|
+
const asyncAgentId = earlyAgentId;
|
|
560
|
+
const agentBackgroundTask = registerAsyncAgent({
|
|
561
|
+
agentId: asyncAgentId,
|
|
562
|
+
description,
|
|
563
|
+
prompt,
|
|
564
|
+
selectedAgent,
|
|
565
|
+
setAppState: rootSetAppState,
|
|
566
|
+
// Don't link to parent's abort controller -- background agents should
|
|
567
|
+
// survive when the user presses ESC to cancel the main thread.
|
|
568
|
+
// They are killed explicitly via chat:killAgents.
|
|
569
|
+
toolUseId: toolUseContext.toolUseId
|
|
570
|
+
});
|
|
571
|
+
// Register name → agentId for SendMessage routing. Post-registerAsyncAgent
|
|
572
|
+
// so we don't leave a stale entry if spawn fails. Sync agents skipped —
|
|
573
|
+
// coordinator is blocked, so SendMessage routing doesn't apply.
|
|
574
|
+
if (name) {
|
|
575
|
+
rootSetAppState(prev => {
|
|
576
|
+
const next = new Map(prev.agentNameRegistry);
|
|
577
|
+
next.set(name, asAgentId(asyncAgentId));
|
|
578
|
+
return {
|
|
579
|
+
...prev,
|
|
580
|
+
agentNameRegistry: next
|
|
581
|
+
};
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
// Wrap async agent execution in agent context for analytics attribution
|
|
585
|
+
const asyncAgentContext = {
|
|
586
|
+
agentId: asyncAgentId,
|
|
587
|
+
// For subagents from teammates: use team lead's session
|
|
588
|
+
// For subagents from main REPL: undefined (no parent session)
|
|
589
|
+
parentSessionId: getParentSessionId(),
|
|
590
|
+
agentType: 'subagent',
|
|
591
|
+
subagentName: selectedAgent.agentType,
|
|
592
|
+
isBuiltIn: isBuiltInAgent(selectedAgent),
|
|
593
|
+
invokingRequestId: assistantMessage?.requestId,
|
|
594
|
+
invocationKind: 'spawn',
|
|
595
|
+
invocationEmitted: false
|
|
596
|
+
};
|
|
597
|
+
// Workload propagation: handlePromptSubmit wraps the entire turn in
|
|
598
|
+
// runWithWorkload (AsyncLocalStorage). ALS context is captured at
|
|
599
|
+
// invocation time — when this `void` fires — and survives every await
|
|
600
|
+
// inside. No capture/restore needed; the detached closure sees the
|
|
601
|
+
// parent turn's workload automatically, isolated from its finally.
|
|
602
|
+
void runWithAgentContext(asyncAgentContext, () => wrapWithCwd(() => runAsyncAgentLifecycle({
|
|
603
|
+
taskId: agentBackgroundTask.agentId,
|
|
604
|
+
abortController: agentBackgroundTask.abortController,
|
|
605
|
+
makeStream: onCacheSafeParams => runAgent({
|
|
606
|
+
...runAgentParams,
|
|
607
|
+
override: {
|
|
608
|
+
...runAgentParams.override,
|
|
609
|
+
agentId: asAgentId(agentBackgroundTask.agentId),
|
|
610
|
+
abortController: agentBackgroundTask.abortController
|
|
611
|
+
},
|
|
612
|
+
onCacheSafeParams
|
|
613
|
+
}),
|
|
614
|
+
metadata,
|
|
615
|
+
description,
|
|
616
|
+
toolUseContext,
|
|
617
|
+
rootSetAppState,
|
|
618
|
+
agentIdForCleanup: asyncAgentId,
|
|
619
|
+
enableSummarization: isCoordinator || isForkSubagentEnabled() || getSdkAgentProgressSummariesEnabled(),
|
|
620
|
+
getWorktreeResult: cleanupWorktreeIfNeeded
|
|
621
|
+
})));
|
|
622
|
+
const canReadOutputFile = toolUseContext.options.tools.some(t => toolMatchesName(t, FILE_READ_TOOL_NAME) || toolMatchesName(t, BASH_TOOL_NAME));
|
|
623
|
+
return {
|
|
624
|
+
data: {
|
|
625
|
+
isAsync: true,
|
|
626
|
+
status: 'async_launched',
|
|
627
|
+
agentId: agentBackgroundTask.agentId,
|
|
628
|
+
description: description,
|
|
629
|
+
prompt: prompt,
|
|
630
|
+
outputFile: getTaskOutputPath(agentBackgroundTask.agentId),
|
|
631
|
+
canReadOutputFile
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
else {
|
|
636
|
+
// Create an explicit agentId for sync agents
|
|
637
|
+
const syncAgentId = asAgentId(earlyAgentId);
|
|
638
|
+
// Set up agent context for sync execution (for analytics attribution)
|
|
639
|
+
const syncAgentContext = {
|
|
640
|
+
agentId: syncAgentId,
|
|
641
|
+
// For subagents from teammates: use team lead's session
|
|
642
|
+
// For subagents from main REPL: undefined (no parent session)
|
|
643
|
+
parentSessionId: getParentSessionId(),
|
|
644
|
+
agentType: 'subagent',
|
|
645
|
+
subagentName: selectedAgent.agentType,
|
|
646
|
+
isBuiltIn: isBuiltInAgent(selectedAgent),
|
|
647
|
+
invokingRequestId: assistantMessage?.requestId,
|
|
648
|
+
invocationKind: 'spawn',
|
|
649
|
+
invocationEmitted: false
|
|
650
|
+
};
|
|
651
|
+
// Wrap entire sync agent execution in context for analytics attribution
|
|
652
|
+
// and optionally in a worktree cwd override for filesystem isolation
|
|
653
|
+
return runWithAgentContext(syncAgentContext, () => wrapWithCwd(async () => {
|
|
654
|
+
const agentMessages = [];
|
|
655
|
+
const agentStartTime = Date.now();
|
|
656
|
+
const syncTracker = createProgressTracker();
|
|
657
|
+
const syncResolveActivity = createActivityDescriptionResolver(toolUseContext.options.tools);
|
|
658
|
+
// Yield initial progress message to carry metadata (prompt)
|
|
659
|
+
if (promptMessages.length > 0) {
|
|
660
|
+
const normalizedPromptMessages = normalizeMessages(promptMessages);
|
|
661
|
+
const normalizedFirstMessage = normalizedPromptMessages.find((m) => m.type === 'user');
|
|
662
|
+
if (normalizedFirstMessage && normalizedFirstMessage.type === 'user' && onProgress) {
|
|
663
|
+
onProgress({
|
|
664
|
+
toolUseID: `agent_${assistantMessage.message.id}`,
|
|
665
|
+
data: {
|
|
666
|
+
message: normalizedFirstMessage,
|
|
667
|
+
type: 'agent_progress',
|
|
668
|
+
prompt,
|
|
669
|
+
agentId: syncAgentId
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
// Register as foreground task immediately so it can be backgrounded at any time
|
|
675
|
+
// Skip registration if background tasks are disabled
|
|
676
|
+
let foregroundTaskId;
|
|
677
|
+
// Create the background race promise once outside the loop — otherwise
|
|
678
|
+
// each iteration adds a new .then() reaction to the same pending
|
|
679
|
+
// promise, accumulating callbacks for the lifetime of the agent.
|
|
680
|
+
let backgroundPromise;
|
|
681
|
+
let cancelAutoBackground;
|
|
682
|
+
if (!isBackgroundTasksDisabled) {
|
|
683
|
+
const registration = registerAgentForeground({
|
|
684
|
+
agentId: syncAgentId,
|
|
685
|
+
description,
|
|
686
|
+
prompt,
|
|
687
|
+
selectedAgent,
|
|
688
|
+
setAppState: rootSetAppState,
|
|
689
|
+
toolUseId: toolUseContext.toolUseId,
|
|
690
|
+
autoBackgroundMs: getAutoBackgroundMs() || undefined
|
|
691
|
+
});
|
|
692
|
+
foregroundTaskId = registration.taskId;
|
|
693
|
+
backgroundPromise = registration.backgroundSignal.then(() => ({
|
|
694
|
+
type: 'background'
|
|
695
|
+
}));
|
|
696
|
+
cancelAutoBackground = registration.cancelAutoBackground;
|
|
697
|
+
}
|
|
698
|
+
// Track if we've shown the background hint UI
|
|
699
|
+
let backgroundHintShown = false;
|
|
700
|
+
// Track if the agent was backgrounded (cleanup handled by backgrounded finally)
|
|
701
|
+
let wasBackgrounded = false;
|
|
702
|
+
// Per-scope stop function — NOT shared with the backgrounded closure.
|
|
703
|
+
// idempotent: startAgentSummarization's stop() checks `stopped` flag.
|
|
704
|
+
let stopForegroundSummarization;
|
|
705
|
+
// const capture for sound type narrowing inside the callback below
|
|
706
|
+
const summaryTaskId = foregroundTaskId;
|
|
707
|
+
// Get async iterator for the agent
|
|
708
|
+
const agentIterator = runAgent({
|
|
709
|
+
...runAgentParams,
|
|
710
|
+
override: {
|
|
711
|
+
...runAgentParams.override,
|
|
712
|
+
agentId: syncAgentId
|
|
713
|
+
},
|
|
714
|
+
onCacheSafeParams: summaryTaskId && getSdkAgentProgressSummariesEnabled() ? (params) => {
|
|
715
|
+
const { stop } = startAgentSummarization(summaryTaskId, syncAgentId, params, rootSetAppState);
|
|
716
|
+
stopForegroundSummarization = stop;
|
|
717
|
+
} : undefined
|
|
718
|
+
})[Symbol.asyncIterator]();
|
|
719
|
+
// Track if an error occurred during iteration
|
|
720
|
+
let syncAgentError;
|
|
721
|
+
let wasAborted = false;
|
|
722
|
+
let worktreeResult = {};
|
|
723
|
+
try {
|
|
724
|
+
while (true) {
|
|
725
|
+
const elapsed = Date.now() - agentStartTime;
|
|
726
|
+
// Show background hint after threshold (but task is already registered)
|
|
727
|
+
// Skip if background tasks are disabled
|
|
728
|
+
if (!isBackgroundTasksDisabled && !backgroundHintShown && elapsed >= PROGRESS_THRESHOLD_MS && toolUseContext.setToolJSX) {
|
|
729
|
+
backgroundHintShown = true;
|
|
730
|
+
toolUseContext.setToolJSX({
|
|
731
|
+
jsx: _jsx(BackgroundHint, {}),
|
|
732
|
+
shouldHidePromptInput: false,
|
|
733
|
+
shouldContinueAnimation: true,
|
|
734
|
+
showSpinner: true
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
// Race between next message and background signal
|
|
738
|
+
// If background tasks are disabled, just await the next message directly
|
|
739
|
+
const nextMessagePromise = agentIterator.next();
|
|
740
|
+
const raceResult = backgroundPromise ? await Promise.race([nextMessagePromise.then(r => ({
|
|
741
|
+
type: 'message',
|
|
742
|
+
result: r
|
|
743
|
+
})), backgroundPromise]) : {
|
|
744
|
+
type: 'message',
|
|
745
|
+
result: await nextMessagePromise
|
|
746
|
+
};
|
|
747
|
+
// Check if we were backgrounded via backgroundAll()
|
|
748
|
+
// foregroundTaskId is guaranteed to be defined if raceResult.type is 'background'
|
|
749
|
+
// because backgroundPromise is only defined when foregroundTaskId is defined
|
|
750
|
+
if (raceResult.type === 'background' && foregroundTaskId) {
|
|
751
|
+
const appState = toolUseContext.getAppState();
|
|
752
|
+
const task = appState.tasks[foregroundTaskId];
|
|
753
|
+
if (isLocalAgentTask(task) && task.isBackgrounded) {
|
|
754
|
+
// Capture the taskId for use in the async callback
|
|
755
|
+
const backgroundedTaskId = foregroundTaskId;
|
|
756
|
+
wasBackgrounded = true;
|
|
757
|
+
// Stop foreground summarization; the backgrounded closure
|
|
758
|
+
// below owns its own independent stop function.
|
|
759
|
+
stopForegroundSummarization?.();
|
|
760
|
+
// Workload: inherited via ALS at `void` invocation time,
|
|
761
|
+
// same as the async-from-start path above.
|
|
762
|
+
// Continue agent in background and return async result
|
|
763
|
+
void runWithAgentContext(syncAgentContext, async () => {
|
|
764
|
+
let stopBackgroundedSummarization;
|
|
765
|
+
try {
|
|
766
|
+
// Clean up the foreground iterator so its finally block runs
|
|
767
|
+
// (releases MCP connections, session hooks, prompt cache tracking, etc.)
|
|
768
|
+
// Timeout prevents blocking if MCP server cleanup hangs.
|
|
769
|
+
// .catch() prevents unhandled rejection if timeout wins the race.
|
|
770
|
+
await Promise.race([agentIterator.return(undefined).catch(() => { }), sleep(1000)]);
|
|
771
|
+
// Initialize progress tracking from existing messages
|
|
772
|
+
const tracker = createProgressTracker();
|
|
773
|
+
const resolveActivity2 = createActivityDescriptionResolver(toolUseContext.options.tools);
|
|
774
|
+
for (const existingMsg of agentMessages) {
|
|
775
|
+
updateProgressFromMessage(tracker, existingMsg, resolveActivity2, toolUseContext.options.tools);
|
|
776
|
+
}
|
|
777
|
+
for await (const msg of runAgent({
|
|
778
|
+
...runAgentParams,
|
|
779
|
+
isAsync: true,
|
|
780
|
+
// Agent is now running in background
|
|
781
|
+
override: {
|
|
782
|
+
...runAgentParams.override,
|
|
783
|
+
agentId: asAgentId(backgroundedTaskId),
|
|
784
|
+
abortController: task.abortController
|
|
785
|
+
},
|
|
786
|
+
onCacheSafeParams: getSdkAgentProgressSummariesEnabled() ? (params) => {
|
|
787
|
+
const { stop } = startAgentSummarization(backgroundedTaskId, asAgentId(backgroundedTaskId), params, rootSetAppState);
|
|
788
|
+
stopBackgroundedSummarization = stop;
|
|
789
|
+
} : undefined
|
|
790
|
+
})) {
|
|
791
|
+
agentMessages.push(msg);
|
|
792
|
+
// Track progress for backgrounded agents
|
|
793
|
+
updateProgressFromMessage(tracker, msg, resolveActivity2, toolUseContext.options.tools);
|
|
794
|
+
updateAsyncAgentProgress(backgroundedTaskId, getProgressUpdate(tracker), rootSetAppState);
|
|
795
|
+
const lastToolName = getLastToolUseName(msg);
|
|
796
|
+
if (lastToolName) {
|
|
797
|
+
emitTaskProgress(tracker, backgroundedTaskId, toolUseContext.toolUseId, description, startTime, lastToolName);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
const agentResult = finalizeAgentTool(agentMessages, backgroundedTaskId, metadata);
|
|
801
|
+
// Mark task completed FIRST so TaskOutput(block=true)
|
|
802
|
+
// unblocks immediately. classifyHandoffIfNeeded and
|
|
803
|
+
// cleanupWorktreeIfNeeded can hang — they must not gate
|
|
804
|
+
// the status transition (gh-20236).
|
|
805
|
+
completeAsyncAgent(agentResult, rootSetAppState);
|
|
806
|
+
// Extract text from agent result content for the notification
|
|
807
|
+
let finalMessage = extractTextContent(agentResult.content, '\n');
|
|
808
|
+
if (feature('TRANSCRIPT_CLASSIFIER')) {
|
|
809
|
+
const backgroundedAppState = toolUseContext.getAppState();
|
|
810
|
+
const handoffWarning = await classifyHandoffIfNeeded({
|
|
811
|
+
agentMessages,
|
|
812
|
+
tools: toolUseContext.options.tools,
|
|
813
|
+
toolPermissionContext: backgroundedAppState.toolPermissionContext,
|
|
814
|
+
abortSignal: task.abortController.signal,
|
|
815
|
+
subagentType: selectedAgent.agentType,
|
|
816
|
+
totalToolUseCount: agentResult.totalToolUseCount
|
|
817
|
+
});
|
|
818
|
+
if (handoffWarning) {
|
|
819
|
+
finalMessage = `${handoffWarning}\n\n${finalMessage}`;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
// Clean up worktree before notification so we can include it
|
|
823
|
+
const worktreeResult = await cleanupWorktreeIfNeeded();
|
|
824
|
+
enqueueAgentNotification({
|
|
825
|
+
taskId: backgroundedTaskId,
|
|
826
|
+
description,
|
|
827
|
+
status: 'completed',
|
|
828
|
+
setAppState: rootSetAppState,
|
|
829
|
+
finalMessage,
|
|
830
|
+
usage: {
|
|
831
|
+
totalTokens: getTokenCountFromTracker(tracker),
|
|
832
|
+
toolUses: agentResult.totalToolUseCount,
|
|
833
|
+
durationMs: agentResult.totalDurationMs
|
|
834
|
+
},
|
|
835
|
+
toolUseId: toolUseContext.toolUseId,
|
|
836
|
+
...worktreeResult
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
catch (error) {
|
|
840
|
+
if (error instanceof AbortError) {
|
|
841
|
+
// Transition status BEFORE worktree cleanup so
|
|
842
|
+
// TaskOutput unblocks even if git hangs (gh-20236).
|
|
843
|
+
killAsyncAgent(backgroundedTaskId, rootSetAppState);
|
|
844
|
+
logEvent('thaddeus_agent_tool_terminated', {
|
|
845
|
+
agent_type: metadata.agentType,
|
|
846
|
+
model: metadata.resolvedAgentModel,
|
|
847
|
+
duration_ms: Date.now() - metadata.startTime,
|
|
848
|
+
is_async: true,
|
|
849
|
+
is_built_in_agent: metadata.isBuiltInAgent,
|
|
850
|
+
reason: 'user_cancel_background'
|
|
851
|
+
});
|
|
852
|
+
const worktreeResult = await cleanupWorktreeIfNeeded();
|
|
853
|
+
const partialResult = extractPartialResult(agentMessages);
|
|
854
|
+
enqueueAgentNotification({
|
|
855
|
+
taskId: backgroundedTaskId,
|
|
856
|
+
description,
|
|
857
|
+
status: 'killed',
|
|
858
|
+
setAppState: rootSetAppState,
|
|
859
|
+
toolUseId: toolUseContext.toolUseId,
|
|
860
|
+
finalMessage: partialResult,
|
|
861
|
+
...worktreeResult
|
|
862
|
+
});
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
const errMsg = errorMessage(error);
|
|
866
|
+
failAsyncAgent(backgroundedTaskId, errMsg, rootSetAppState);
|
|
867
|
+
const worktreeResult = await cleanupWorktreeIfNeeded();
|
|
868
|
+
enqueueAgentNotification({
|
|
869
|
+
taskId: backgroundedTaskId,
|
|
870
|
+
description,
|
|
871
|
+
status: 'failed',
|
|
872
|
+
error: errMsg,
|
|
873
|
+
setAppState: rootSetAppState,
|
|
874
|
+
toolUseId: toolUseContext.toolUseId,
|
|
875
|
+
...worktreeResult
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
finally {
|
|
879
|
+
stopBackgroundedSummarization?.();
|
|
880
|
+
clearInvokedSkillsForAgent(syncAgentId);
|
|
881
|
+
clearDumpState(syncAgentId);
|
|
882
|
+
// Note: worktree cleanup is done before enqueueAgentNotification
|
|
883
|
+
// in both try and catch paths so we can include worktree info
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
// Return async_launched result immediately
|
|
887
|
+
const canReadOutputFile = toolUseContext.options.tools.some(t => toolMatchesName(t, FILE_READ_TOOL_NAME) || toolMatchesName(t, BASH_TOOL_NAME));
|
|
888
|
+
return {
|
|
889
|
+
data: {
|
|
890
|
+
isAsync: true,
|
|
891
|
+
status: 'async_launched',
|
|
892
|
+
agentId: backgroundedTaskId,
|
|
893
|
+
description: description,
|
|
894
|
+
prompt: prompt,
|
|
895
|
+
outputFile: getTaskOutputPath(backgroundedTaskId),
|
|
896
|
+
canReadOutputFile
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
// Process the message from the race result
|
|
902
|
+
if (raceResult.type !== 'message') {
|
|
903
|
+
// This shouldn't happen - background case handled above
|
|
904
|
+
continue;
|
|
905
|
+
}
|
|
906
|
+
const { result } = raceResult;
|
|
907
|
+
if (result.done)
|
|
908
|
+
break;
|
|
909
|
+
const message = result.value;
|
|
910
|
+
agentMessages.push(message);
|
|
911
|
+
// Emit task_progress for the VS Code subagent panel
|
|
912
|
+
updateProgressFromMessage(syncTracker, message, syncResolveActivity, toolUseContext.options.tools);
|
|
913
|
+
if (foregroundTaskId) {
|
|
914
|
+
const lastToolName = getLastToolUseName(message);
|
|
915
|
+
if (lastToolName) {
|
|
916
|
+
emitTaskProgress(syncTracker, foregroundTaskId, toolUseContext.toolUseId, description, agentStartTime, lastToolName);
|
|
917
|
+
// Keep AppState task.progress in sync when SDK summaries are
|
|
918
|
+
// enabled, so updateAgentSummary reads correct token/tool counts
|
|
919
|
+
// instead of zeros.
|
|
920
|
+
if (getSdkAgentProgressSummariesEnabled()) {
|
|
921
|
+
updateAsyncAgentProgress(foregroundTaskId, getProgressUpdate(syncTracker), rootSetAppState);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
// Forward bash_progress events from sub-agent to parent so the SDK
|
|
926
|
+
// receives tool_progress events just as it does for the main agent.
|
|
927
|
+
if (message.type === 'progress' && (message.data.type === 'bash_progress' || message.data.type === 'powershell_progress') && onProgress) {
|
|
928
|
+
onProgress({
|
|
929
|
+
toolUseID: message.toolUseID,
|
|
930
|
+
data: message.data
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
if (message.type !== 'assistant' && message.type !== 'user') {
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
936
|
+
// Increment token count in spinner for assistant messages
|
|
937
|
+
// Subagent streaming events are filtered out in runAgent.ts, so we
|
|
938
|
+
// need to count tokens from completed messages here
|
|
939
|
+
if (message.type === 'assistant') {
|
|
940
|
+
const contentLength = getAssistantMessageContentLength(message);
|
|
941
|
+
if (contentLength > 0) {
|
|
942
|
+
toolUseContext.setResponseLength(len => len + contentLength);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
const normalizedNew = normalizeMessages([message]);
|
|
946
|
+
for (const m of normalizedNew) {
|
|
947
|
+
for (const content of m.message.content) {
|
|
948
|
+
if (content.type !== 'tool_use' && content.type !== 'tool_result') {
|
|
949
|
+
continue;
|
|
950
|
+
}
|
|
951
|
+
// Forward progress updates
|
|
952
|
+
if (onProgress) {
|
|
953
|
+
onProgress({
|
|
954
|
+
toolUseID: `agent_${assistantMessage.message.id}`,
|
|
955
|
+
data: {
|
|
956
|
+
message: m,
|
|
957
|
+
type: 'agent_progress',
|
|
958
|
+
// prompt only needed on first progress message (UI.tsx:624
|
|
959
|
+
// reads progressMessages[0]). Omit here to avoid duplication.
|
|
960
|
+
prompt: '',
|
|
961
|
+
agentId: syncAgentId
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
catch (error) {
|
|
970
|
+
// Handle errors from the sync agent loop
|
|
971
|
+
// AbortError should be re-thrown for proper interruption handling
|
|
972
|
+
if (error instanceof AbortError) {
|
|
973
|
+
wasAborted = true;
|
|
974
|
+
logEvent('thaddeus_agent_tool_terminated', {
|
|
975
|
+
agent_type: metadata.agentType,
|
|
976
|
+
model: metadata.resolvedAgentModel,
|
|
977
|
+
duration_ms: Date.now() - metadata.startTime,
|
|
978
|
+
is_async: false,
|
|
979
|
+
is_built_in_agent: metadata.isBuiltInAgent,
|
|
980
|
+
reason: 'user_cancel_sync'
|
|
981
|
+
});
|
|
982
|
+
throw error;
|
|
983
|
+
}
|
|
984
|
+
// Log the error for debugging
|
|
985
|
+
logForDebugging(`Sync agent error: ${errorMessage(error)}`, {
|
|
986
|
+
level: 'error'
|
|
987
|
+
});
|
|
988
|
+
// Store the error to handle after cleanup
|
|
989
|
+
syncAgentError = toError(error);
|
|
990
|
+
}
|
|
991
|
+
finally {
|
|
992
|
+
// Clear the background hint UI
|
|
993
|
+
if (toolUseContext.setToolJSX) {
|
|
994
|
+
toolUseContext.setToolJSX(null);
|
|
995
|
+
}
|
|
996
|
+
// Stop foreground summarization. Idempotent — if already stopped at
|
|
997
|
+
// the backgrounding transition, this is a no-op. The backgrounded
|
|
998
|
+
// closure owns a separate stop function (stopBackgroundedSummarization).
|
|
999
|
+
stopForegroundSummarization?.();
|
|
1000
|
+
// Unregister foreground task if agent completed without being backgrounded
|
|
1001
|
+
if (foregroundTaskId) {
|
|
1002
|
+
unregisterAgentForeground(foregroundTaskId, rootSetAppState);
|
|
1003
|
+
// Notify SDK consumers (e.g. VS Code subagent panel) that this
|
|
1004
|
+
// foreground agent is done. Goes through drainSdkEvents() — does
|
|
1005
|
+
// NOT trigger the print.ts XML task_notification parser or the LLM loop.
|
|
1006
|
+
if (!wasBackgrounded) {
|
|
1007
|
+
const progress = getProgressUpdate(syncTracker);
|
|
1008
|
+
enqueueSdkEvent({
|
|
1009
|
+
type: 'system',
|
|
1010
|
+
subtype: 'task_notification',
|
|
1011
|
+
task_id: foregroundTaskId,
|
|
1012
|
+
tool_use_id: toolUseContext.toolUseId,
|
|
1013
|
+
status: syncAgentError ? 'failed' : wasAborted ? 'stopped' : 'completed',
|
|
1014
|
+
output_file: '',
|
|
1015
|
+
summary: description,
|
|
1016
|
+
usage: {
|
|
1017
|
+
total_tokens: progress.tokenCount,
|
|
1018
|
+
tool_uses: progress.toolUseCount,
|
|
1019
|
+
duration_ms: Date.now() - agentStartTime
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
// Clean up scoped skills so they don't accumulate in the global map
|
|
1025
|
+
clearInvokedSkillsForAgent(syncAgentId);
|
|
1026
|
+
// Clean up dumpState entry for this agent to prevent unbounded growth
|
|
1027
|
+
// Skip if backgrounded — the backgrounded agent's finally handles cleanup
|
|
1028
|
+
if (!wasBackgrounded) {
|
|
1029
|
+
clearDumpState(syncAgentId);
|
|
1030
|
+
}
|
|
1031
|
+
// Cancel auto-background timer if agent completed before it fired
|
|
1032
|
+
cancelAutoBackground?.();
|
|
1033
|
+
// Clean up worktree if applicable (in finally to handle abort/error paths)
|
|
1034
|
+
// Skip if backgrounded — the background continuation is still running in it
|
|
1035
|
+
if (!wasBackgrounded) {
|
|
1036
|
+
worktreeResult = await cleanupWorktreeIfNeeded();
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
// Re-throw abort errors
|
|
1040
|
+
// TODO: Find a cleaner way to express this
|
|
1041
|
+
const lastMessage = agentMessages.findLast(_ => _.type !== 'system' && _.type !== 'progress');
|
|
1042
|
+
if (lastMessage && isSyntheticMessage(lastMessage)) {
|
|
1043
|
+
logEvent('thaddeus_agent_tool_terminated', {
|
|
1044
|
+
agent_type: metadata.agentType,
|
|
1045
|
+
model: metadata.resolvedAgentModel,
|
|
1046
|
+
duration_ms: Date.now() - metadata.startTime,
|
|
1047
|
+
is_async: false,
|
|
1048
|
+
is_built_in_agent: metadata.isBuiltInAgent,
|
|
1049
|
+
reason: 'user_cancel_sync'
|
|
1050
|
+
});
|
|
1051
|
+
throw new AbortError();
|
|
1052
|
+
}
|
|
1053
|
+
// If an error occurred during iteration, try to return a result with
|
|
1054
|
+
// whatever messages we have. If we have no assistant messages,
|
|
1055
|
+
// re-throw the error so it's properly handled by the tool framework.
|
|
1056
|
+
if (syncAgentError) {
|
|
1057
|
+
// Check if we have any assistant messages to return
|
|
1058
|
+
const hasAssistantMessages = agentMessages.some(msg => msg.type === 'assistant');
|
|
1059
|
+
if (!hasAssistantMessages) {
|
|
1060
|
+
// No messages collected, re-throw the error
|
|
1061
|
+
throw syncAgentError;
|
|
1062
|
+
}
|
|
1063
|
+
// We have some messages, try to finalize and return them
|
|
1064
|
+
// This allows the parent agent to see partial progress even after an error
|
|
1065
|
+
logForDebugging(`Sync agent recovering from error with ${agentMessages.length} messages`);
|
|
1066
|
+
}
|
|
1067
|
+
const agentResult = finalizeAgentTool(agentMessages, syncAgentId, metadata);
|
|
1068
|
+
if (feature('TRANSCRIPT_CLASSIFIER')) {
|
|
1069
|
+
const currentAppState = toolUseContext.getAppState();
|
|
1070
|
+
const handoffWarning = await classifyHandoffIfNeeded({
|
|
1071
|
+
agentMessages,
|
|
1072
|
+
tools: toolUseContext.options.tools,
|
|
1073
|
+
toolPermissionContext: currentAppState.toolPermissionContext,
|
|
1074
|
+
abortSignal: toolUseContext.abortController.signal,
|
|
1075
|
+
subagentType: selectedAgent.agentType,
|
|
1076
|
+
totalToolUseCount: agentResult.totalToolUseCount
|
|
1077
|
+
});
|
|
1078
|
+
if (handoffWarning) {
|
|
1079
|
+
agentResult.content = [{
|
|
1080
|
+
type: 'text',
|
|
1081
|
+
text: handoffWarning
|
|
1082
|
+
}, ...agentResult.content];
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return {
|
|
1086
|
+
data: {
|
|
1087
|
+
status: 'completed',
|
|
1088
|
+
prompt,
|
|
1089
|
+
...agentResult,
|
|
1090
|
+
...worktreeResult
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
}));
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
isReadOnly() {
|
|
1097
|
+
return true; // delegates permission checks to its underlying tools
|
|
1098
|
+
},
|
|
1099
|
+
toAutoClassifierInput(input) {
|
|
1100
|
+
const i = input;
|
|
1101
|
+
const tags = [i.subagent_type, i.mode ? `mode=${i.mode}` : undefined].filter((t) => t !== undefined);
|
|
1102
|
+
const prefix = tags.length > 0 ? `(${tags.join(', ')}): ` : ': ';
|
|
1103
|
+
return `${prefix}${i.prompt}`;
|
|
1104
|
+
},
|
|
1105
|
+
isConcurrencySafe() {
|
|
1106
|
+
return true;
|
|
1107
|
+
},
|
|
1108
|
+
userFacingName,
|
|
1109
|
+
userFacingNameBackgroundColor,
|
|
1110
|
+
getActivityDescription(input) {
|
|
1111
|
+
return input?.description ?? 'Running task';
|
|
1112
|
+
},
|
|
1113
|
+
async checkPermissions(input, context) {
|
|
1114
|
+
const appState = context.getAppState();
|
|
1115
|
+
// Only route through auto mode classifier when in auto mode
|
|
1116
|
+
// In all other modes, auto-approve sub-agent generation
|
|
1117
|
+
// Note: "external" === 'ant' guard enables dead code elimination for external builds
|
|
1118
|
+
if ("external" === 'ant' && appState.toolPermissionContext.mode === 'auto') {
|
|
1119
|
+
return {
|
|
1120
|
+
behavior: 'passthrough',
|
|
1121
|
+
message: 'Agent tool requires permission to spawn sub-agents.'
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
return {
|
|
1125
|
+
behavior: 'allow',
|
|
1126
|
+
updatedInput: input
|
|
1127
|
+
};
|
|
1128
|
+
},
|
|
1129
|
+
mapToolResultToToolResultBlockParam(data, toolUseID) {
|
|
1130
|
+
// Multi-agent spawn result
|
|
1131
|
+
const internalData = data;
|
|
1132
|
+
if (typeof internalData === 'object' && internalData !== null && 'status' in internalData && internalData.status === 'teammate_spawned') {
|
|
1133
|
+
const spawnData = internalData;
|
|
1134
|
+
return {
|
|
1135
|
+
tool_use_id: toolUseID,
|
|
1136
|
+
type: 'tool_result',
|
|
1137
|
+
content: [{
|
|
1138
|
+
type: 'text',
|
|
1139
|
+
text: `Spawned successfully.
|
|
1140
|
+
agent_id: ${spawnData.teammate_id}
|
|
1141
|
+
name: ${spawnData.name}
|
|
1142
|
+
team_name: ${spawnData.team_name}
|
|
1143
|
+
The agent is now running and will receive instructions via mailbox.`
|
|
1144
|
+
}]
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
if ('status' in internalData && internalData.status === 'remote_launched') {
|
|
1148
|
+
const r = internalData;
|
|
1149
|
+
return {
|
|
1150
|
+
tool_use_id: toolUseID,
|
|
1151
|
+
type: 'tool_result',
|
|
1152
|
+
content: [{
|
|
1153
|
+
type: 'text',
|
|
1154
|
+
text: `Remote agent launched in CCR.\ntaskId: ${r.taskId}\nsession_url: ${r.sessionUrl}\noutput_file: ${r.outputFile}\nThe agent is running remotely. You will be notified automatically when it completes.\nBriefly tell the user what you launched and end your response.`
|
|
1155
|
+
}]
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
if (data.status === 'async_launched') {
|
|
1159
|
+
const prefix = `Async agent launched successfully.\nagentId: ${data.agentId} (internal ID - do not mention to user. Use SendMessage with to: '${data.agentId}' to continue this agent.)\nThe agent is working in the background. You will be notified automatically when it completes.`;
|
|
1160
|
+
const instructions = data.canReadOutputFile ? `Do not duplicate this agent's work — avoid working with the same files or topics it is using. Work on non-overlapping tasks, or briefly tell the user what you launched and end your response.\noutput_file: ${data.outputFile}\nIf asked, you can check progress before completion by using ${FILE_READ_TOOL_NAME} or ${BASH_TOOL_NAME} tail on the output file.` : `Briefly tell the user what you launched and end your response. Do not generate any other text — agent results will arrive in a subsequent message.`;
|
|
1161
|
+
const text = `${prefix}\n${instructions}`;
|
|
1162
|
+
return {
|
|
1163
|
+
tool_use_id: toolUseID,
|
|
1164
|
+
type: 'tool_result',
|
|
1165
|
+
content: [{
|
|
1166
|
+
type: 'text',
|
|
1167
|
+
text
|
|
1168
|
+
}]
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
if (data.status === 'completed') {
|
|
1172
|
+
const worktreeData = data;
|
|
1173
|
+
const worktreeInfoText = worktreeData.worktreePath ? `\nworktreePath: ${worktreeData.worktreePath}\nworktreeBranch: ${worktreeData.worktreeBranch}` : '';
|
|
1174
|
+
// If the subagent completes with no content, the tool_result is just the
|
|
1175
|
+
// agentId/usage trailer below — a metadata-only block at the prompt tail.
|
|
1176
|
+
// Some models read that as "nothing to act on" and end their turn
|
|
1177
|
+
// immediately. Say so explicitly so the parent has something to react to.
|
|
1178
|
+
const contentOrMarker = data.content.length > 0 ? data.content : [{
|
|
1179
|
+
type: 'text',
|
|
1180
|
+
text: '(Subagent completed but returned no output.)'
|
|
1181
|
+
}];
|
|
1182
|
+
// One-shot built-ins (Explore, Plan) are never continued via SendMessage
|
|
1183
|
+
// — the agentId hint and <usage> block are dead weight (~135 chars ×
|
|
1184
|
+
// 34M Explore runs/week ≈ 1-2 Gtok/week). Telemetry doesn't parse this
|
|
1185
|
+
// block (it uses logEvent in finalizeAgentTool), so dropping is safe.
|
|
1186
|
+
// agentType is optional for resume compat — missing means show trailer.
|
|
1187
|
+
if (data.agentType && ONE_SHOT_BUILTIN_AGENT_TYPES.has(data.agentType) && !worktreeInfoText) {
|
|
1188
|
+
return {
|
|
1189
|
+
tool_use_id: toolUseID,
|
|
1190
|
+
type: 'tool_result',
|
|
1191
|
+
content: contentOrMarker
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
return {
|
|
1195
|
+
tool_use_id: toolUseID,
|
|
1196
|
+
type: 'tool_result',
|
|
1197
|
+
content: [...contentOrMarker, {
|
|
1198
|
+
type: 'text',
|
|
1199
|
+
text: `agentId: ${data.agentId} (use SendMessage with to: '${data.agentId}' to continue this agent)${worktreeInfoText}
|
|
1200
|
+
<usage>total_tokens: ${data.totalTokens}
|
|
1201
|
+
tool_uses: ${data.totalToolUseCount}
|
|
1202
|
+
duration_ms: ${data.totalDurationMs}</usage>`
|
|
1203
|
+
}]
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
data;
|
|
1207
|
+
throw new Error(`Unexpected agent tool result status: ${data.status}`);
|
|
1208
|
+
},
|
|
1209
|
+
renderToolResultMessage,
|
|
1210
|
+
renderToolUseMessage,
|
|
1211
|
+
renderToolUseTag,
|
|
1212
|
+
renderToolUseProgressMessage,
|
|
1213
|
+
renderToolUseRejectedMessage,
|
|
1214
|
+
renderToolUseErrorMessage,
|
|
1215
|
+
renderGroupedToolUse: renderGroupedAgentToolUse
|
|
1216
|
+
});
|
|
1217
|
+
function resolveTeamName(input, appState) {
|
|
1218
|
+
if (!isAgentSwarmsEnabled())
|
|
1219
|
+
return undefined;
|
|
1220
|
+
return input.team_name || appState.teamContext?.teamName;
|
|
1221
|
+
}
|