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,1309 @@
|
|
|
1
|
+
import { feature } from 'bun:bundle';
|
|
2
|
+
import { logEvent, } from 'src/services/analytics/index.js';
|
|
3
|
+
import { extractMcpToolDetails, extractSkillName, extractToolInputForTelemetry, getFileExtensionForAnalytics, getFileExtensionsFromBashCommand, isToolDetailsLoggingEnabled, mcpToolDetailsForAnalytics, sanitizeToolNameForAnalytics, } from 'src/services/analytics/metadata.js';
|
|
4
|
+
import { addToToolDuration, getCodeEditToolDecisionCounter, getStatsStore, } from '../../bootstrap/state.js';
|
|
5
|
+
import { buildCodeEditToolAttributes, isCodeEditingTool, } from '../../hooks/toolPermission/permissionLogging.js';
|
|
6
|
+
import { findToolByName, } from '../../Tool.js';
|
|
7
|
+
import { startSpeculativeClassifierCheck } from '../../tools/BashTool/bashPermissions.js';
|
|
8
|
+
import { BASH_TOOL_NAME } from '../../tools/BashTool/toolName.js';
|
|
9
|
+
import { FILE_EDIT_TOOL_NAME } from '../../tools/FileEditTool/constants.js';
|
|
10
|
+
import { FILE_READ_TOOL_NAME } from '../../tools/FileReadTool/prompt.js';
|
|
11
|
+
import { FILE_WRITE_TOOL_NAME } from '../../tools/FileWriteTool/prompt.js';
|
|
12
|
+
import { NOTEBOOK_EDIT_TOOL_NAME } from '../../tools/NotebookEditTool/constants.js';
|
|
13
|
+
import { POWERSHELL_TOOL_NAME } from '../../tools/PowerShellTool/toolName.js';
|
|
14
|
+
import { parseGitCommitId } from '../../tools/shared/gitOperationTracking.js';
|
|
15
|
+
import { isDeferredTool, TOOL_SEARCH_TOOL_NAME, } from '../../tools/ToolSearchTool/prompt.js';
|
|
16
|
+
import { getAllBaseTools } from '../../tools.js';
|
|
17
|
+
import { count } from '../../utils/array.js';
|
|
18
|
+
import { getGuardrails } from '../../infrastructure/guardrails.js';
|
|
19
|
+
import { getAuditTrail } from '../../infrastructure/audit.js';
|
|
20
|
+
import { createAttachmentMessage } from '../../utils/attachments.js';
|
|
21
|
+
import { logForDebugging } from '../../utils/debug.js';
|
|
22
|
+
import { AbortError, errorMessage, getErrnoCode, ShellError, TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, } from '../../utils/errors.js';
|
|
23
|
+
import { executePermissionDeniedHooks } from '../../utils/hooks.js';
|
|
24
|
+
import { logError } from '../../utils/log.js';
|
|
25
|
+
import { CANCEL_MESSAGE, createProgressMessage, createStopHookSummaryMessage, createToolResultStopMessage, createUserMessage, withMemoryCorrectionHint, } from '../../utils/messages.js';
|
|
26
|
+
import { startSessionActivity, stopSessionActivity, } from '../../utils/sessionActivity.js';
|
|
27
|
+
import { jsonStringify } from '../../utils/slowOperations.js';
|
|
28
|
+
import { Stream } from '../../utils/stream.js';
|
|
29
|
+
import { logOTelEvent } from '../../utils/telemetry/events.js';
|
|
30
|
+
import { addToolContentEvent, endToolBlockedOnUserSpan, endToolExecutionSpan, endToolSpan, isBetaTracingEnabled, startToolBlockedOnUserSpan, startToolExecutionSpan, startToolSpan, } from '../../utils/telemetry/sessionTracing.js';
|
|
31
|
+
import { formatError, formatZodValidationError, } from '../../utils/toolErrors.js';
|
|
32
|
+
import { processPreMappedToolResultBlock, processToolResultBlock, } from '../../utils/toolResultStorage.js';
|
|
33
|
+
import { extractDiscoveredToolNames, isToolSearchEnabledOptimistic, isToolSearchToolAvailable, } from '../../utils/toolSearch.js';
|
|
34
|
+
import { McpAuthError, McpToolCallError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, } from '../mcp/client.js';
|
|
35
|
+
import { mcpInfoFromString } from '../mcp/mcpStringUtils.js';
|
|
36
|
+
import { normalizeNameForMCP } from '../mcp/normalization.js';
|
|
37
|
+
import { getLoggingSafeMcpBaseUrl, getMcpServerScopeFromToolName, isMcpTool, } from '../mcp/utils.js';
|
|
38
|
+
import { resolveHookPermissionDecision, runPostToolUseFailureHooks, runPostToolUseHooks, runPreToolUseHooks, } from './toolHooks.js';
|
|
39
|
+
/** Minimum total hook duration (ms) to show inline timing summary */
|
|
40
|
+
export const HOOK_TIMING_DISPLAY_THRESHOLD_MS = 500;
|
|
41
|
+
/** Log a debug warning when hooks/permission-decision block for this long. Matches
|
|
42
|
+
* BashTool's PROGRESS_THRESHOLD_MS — the collapsed view feels stuck past this. */
|
|
43
|
+
const SLOW_PHASE_LOG_THRESHOLD_MS = 2000;
|
|
44
|
+
/**
|
|
45
|
+
* Classify a tool execution error into a telemetry-safe string.
|
|
46
|
+
*
|
|
47
|
+
* In minified/external builds, `error.constructor.name` is mangled into
|
|
48
|
+
* short identifiers like "nJT" or "Chq" — useless for diagnostics.
|
|
49
|
+
* This function extracts structured, telemetry-safe information instead:
|
|
50
|
+
* - TelemetrySafeError: use its telemetryMessage (already vetted)
|
|
51
|
+
* - Node.js fs errors: log the error code (ENOENT, EACCES, etc.)
|
|
52
|
+
* - Known error types: use their unminified name
|
|
53
|
+
* - Fallback: "Error" (better than a mangled 3-char identifier)
|
|
54
|
+
*/
|
|
55
|
+
export function classifyToolError(error) {
|
|
56
|
+
if (error instanceof TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS) {
|
|
57
|
+
return error.telemetryMessage.slice(0, 200);
|
|
58
|
+
}
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
// Node.js filesystem errors have a `code` property (ENOENT, EACCES, etc.)
|
|
61
|
+
// These are safe to log and much more useful than the constructor name.
|
|
62
|
+
const errnoCode = getErrnoCode(error);
|
|
63
|
+
if (typeof errnoCode === 'string') {
|
|
64
|
+
return `Error:${errnoCode}`;
|
|
65
|
+
}
|
|
66
|
+
// ShellError, ImageSizeError, etc. have stable `.name` properties
|
|
67
|
+
// that survive minification (they're set in the constructor).
|
|
68
|
+
if (error.name && error.name !== 'Error' && error.name.length > 3) {
|
|
69
|
+
return error.name.slice(0, 60);
|
|
70
|
+
}
|
|
71
|
+
return 'Error';
|
|
72
|
+
}
|
|
73
|
+
return 'UnknownError';
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Map a rule's origin to the documented OTel `source` vocabulary, matching
|
|
77
|
+
* the interactive path's semantics (permissionLogging.ts:81): session-scoped
|
|
78
|
+
* grants are temporary, on-disk grants are permanent, and user-authored
|
|
79
|
+
* denies are user_reject regardless of persistence. Everything the user
|
|
80
|
+
* didn't write (cliArg, policySettings, projectSettings, flagSettings) is
|
|
81
|
+
* config.
|
|
82
|
+
*/
|
|
83
|
+
function ruleSourceToOTelSource(ruleSource, behavior) {
|
|
84
|
+
switch (ruleSource) {
|
|
85
|
+
case 'session':
|
|
86
|
+
return behavior === 'allow' ? 'user_temporary' : 'user_reject';
|
|
87
|
+
case 'localSettings':
|
|
88
|
+
case 'userSettings':
|
|
89
|
+
return behavior === 'allow' ? 'user_permanent' : 'user_reject';
|
|
90
|
+
default:
|
|
91
|
+
return 'config';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Map a PermissionDecisionReason to the OTel `source` label for the
|
|
96
|
+
* non-interactive tool_decision path, staying within the documented
|
|
97
|
+
* vocabulary (config, hook, user_permanent, user_temporary, user_reject).
|
|
98
|
+
*
|
|
99
|
+
* For permissionPromptTool, the SDK host may set decisionClassification on
|
|
100
|
+
* the PermissionResult to tell us exactly what happened (once vs always vs
|
|
101
|
+
* cache hit — the host knows, we can't tell from {behavior:'allow'} alone).
|
|
102
|
+
* Without it, we fall back conservatively: allow → user_temporary,
|
|
103
|
+
* deny → user_reject.
|
|
104
|
+
*/
|
|
105
|
+
function decisionReasonToOTelSource(reason, behavior) {
|
|
106
|
+
if (!reason) {
|
|
107
|
+
return 'config';
|
|
108
|
+
}
|
|
109
|
+
switch (reason.type) {
|
|
110
|
+
case 'permissionPromptTool': {
|
|
111
|
+
// toolResult is typed `unknown` on PermissionDecisionReason but carries
|
|
112
|
+
// the parsed Output from PermissionPromptToolResultSchema. Narrow at
|
|
113
|
+
// runtime rather than widen the cross-file type.
|
|
114
|
+
const toolResult = reason.toolResult;
|
|
115
|
+
const classified = toolResult?.decisionClassification;
|
|
116
|
+
if (classified === 'user_temporary' ||
|
|
117
|
+
classified === 'user_permanent' ||
|
|
118
|
+
classified === 'user_reject') {
|
|
119
|
+
return classified;
|
|
120
|
+
}
|
|
121
|
+
return behavior === 'allow' ? 'user_temporary' : 'user_reject';
|
|
122
|
+
}
|
|
123
|
+
case 'rule':
|
|
124
|
+
return ruleSourceToOTelSource(reason.rule.source, behavior);
|
|
125
|
+
case 'hook':
|
|
126
|
+
return 'hook';
|
|
127
|
+
case 'mode':
|
|
128
|
+
case 'classifier':
|
|
129
|
+
case 'subcommandResults':
|
|
130
|
+
case 'asyncAgent':
|
|
131
|
+
case 'sandboxOverride':
|
|
132
|
+
case 'workingDir':
|
|
133
|
+
case 'safetyCheck':
|
|
134
|
+
case 'other':
|
|
135
|
+
return 'config';
|
|
136
|
+
default: {
|
|
137
|
+
const _exhaustive = reason;
|
|
138
|
+
return 'config';
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function getNextImagePasteId(messages) {
|
|
143
|
+
let maxId = 0;
|
|
144
|
+
for (const message of messages) {
|
|
145
|
+
if (message.type === 'user' && message.imagePasteIds) {
|
|
146
|
+
for (const id of message.imagePasteIds) {
|
|
147
|
+
if (id > maxId)
|
|
148
|
+
maxId = id;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return maxId + 1;
|
|
153
|
+
}
|
|
154
|
+
function findMcpServerConnection(toolName, mcpClients) {
|
|
155
|
+
if (!toolName.startsWith('mcp__')) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
const mcpInfo = mcpInfoFromString(toolName);
|
|
159
|
+
if (!mcpInfo) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
// mcpInfo.serverName is normalized (e.g., "claude_ai_Slack"), but client.name
|
|
163
|
+
// is the original name (e.g., "claude.ai Slack"). Normalize both for comparison.
|
|
164
|
+
return mcpClients.find(client => normalizeNameForMCP(client.name) === mcpInfo.serverName);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Extracts the MCP server transport type from a tool name.
|
|
168
|
+
* Returns the server type (stdio, sse, http, ws, sdk, etc.) for MCP tools,
|
|
169
|
+
* or undefined for built-in tools.
|
|
170
|
+
*/
|
|
171
|
+
function getMcpServerType(toolName, mcpClients) {
|
|
172
|
+
const serverConnection = findMcpServerConnection(toolName, mcpClients);
|
|
173
|
+
if (serverConnection?.type === 'connected') {
|
|
174
|
+
// Handle stdio configs where type field is optional (defaults to 'stdio')
|
|
175
|
+
return serverConnection.config.type ?? 'stdio';
|
|
176
|
+
}
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Extracts the MCP server base URL for a tool by looking up its server connection.
|
|
181
|
+
* Returns undefined for stdio servers, built-in tools, or if the server is not connected.
|
|
182
|
+
*/
|
|
183
|
+
function getMcpServerBaseUrlFromToolName(toolName, mcpClients) {
|
|
184
|
+
const serverConnection = findMcpServerConnection(toolName, mcpClients);
|
|
185
|
+
if (serverConnection?.type !== 'connected') {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
return getLoggingSafeMcpBaseUrl(serverConnection.config);
|
|
189
|
+
}
|
|
190
|
+
export async function* runToolUse(toolUse, assistantMessage, canUseTool, toolUseContext) {
|
|
191
|
+
const toolName = toolUse.name;
|
|
192
|
+
// First try to find in the available tools (what the model sees)
|
|
193
|
+
let tool = findToolByName(toolUseContext.options.tools, toolName);
|
|
194
|
+
// If not found, check if it's a deprecated tool being called by alias
|
|
195
|
+
// (e.g., old transcripts calling "KillShell" which is now an alias for "TaskStop")
|
|
196
|
+
// Only fall back for tools where the name matches an alias, not the primary name
|
|
197
|
+
if (!tool) {
|
|
198
|
+
const fallbackTool = findToolByName(getAllBaseTools(), toolName);
|
|
199
|
+
// Only use fallback if the tool was found via alias (deprecated name)
|
|
200
|
+
if (fallbackTool && fallbackTool.aliases?.includes(toolName)) {
|
|
201
|
+
tool = fallbackTool;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const messageId = assistantMessage.message.id;
|
|
205
|
+
const requestId = assistantMessage.requestId;
|
|
206
|
+
const mcpServerType = getMcpServerType(toolName, toolUseContext.options.mcpClients);
|
|
207
|
+
const mcpServerBaseUrl = getMcpServerBaseUrlFromToolName(toolName, toolUseContext.options.mcpClients);
|
|
208
|
+
// Check if the tool exists
|
|
209
|
+
if (!tool) {
|
|
210
|
+
const sanitizedToolName = sanitizeToolNameForAnalytics(toolName);
|
|
211
|
+
logForDebugging(`Unknown tool ${toolName}: ${toolUse.id}`);
|
|
212
|
+
logEvent('thaddeus_tool_use_error', {
|
|
213
|
+
error: `No such tool available: ${sanitizedToolName}`,
|
|
214
|
+
toolName: sanitizedToolName,
|
|
215
|
+
toolUseID: toolUse.id,
|
|
216
|
+
isMcp: toolName.startsWith('mcp__'),
|
|
217
|
+
queryChainId: toolUseContext.queryTracking
|
|
218
|
+
?.chainId,
|
|
219
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
220
|
+
...(mcpServerType && {
|
|
221
|
+
mcpServerType: mcpServerType,
|
|
222
|
+
}),
|
|
223
|
+
...(mcpServerBaseUrl && {
|
|
224
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
225
|
+
}),
|
|
226
|
+
...(requestId && {
|
|
227
|
+
requestId: requestId,
|
|
228
|
+
}),
|
|
229
|
+
...mcpToolDetailsForAnalytics(toolName, mcpServerType, mcpServerBaseUrl),
|
|
230
|
+
});
|
|
231
|
+
yield {
|
|
232
|
+
message: createUserMessage({
|
|
233
|
+
content: [
|
|
234
|
+
{
|
|
235
|
+
type: 'tool_result',
|
|
236
|
+
content: `<tool_use_error>Error: No such tool available: ${toolName}</tool_use_error>`,
|
|
237
|
+
is_error: true,
|
|
238
|
+
tool_use_id: toolUse.id,
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
toolUseResult: `Error: No such tool available: ${toolName}`,
|
|
242
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
243
|
+
}),
|
|
244
|
+
};
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const toolInput = toolUse.input;
|
|
248
|
+
try {
|
|
249
|
+
if (toolUseContext.abortController.signal.aborted) {
|
|
250
|
+
logEvent('thaddeus_tool_use_cancelled', {
|
|
251
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
252
|
+
toolUseID: toolUse.id,
|
|
253
|
+
isMcp: tool.isMcp ?? false,
|
|
254
|
+
queryChainId: toolUseContext.queryTracking
|
|
255
|
+
?.chainId,
|
|
256
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
257
|
+
...(mcpServerType && {
|
|
258
|
+
mcpServerType: mcpServerType,
|
|
259
|
+
}),
|
|
260
|
+
...(mcpServerBaseUrl && {
|
|
261
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
262
|
+
}),
|
|
263
|
+
...(requestId && {
|
|
264
|
+
requestId: requestId,
|
|
265
|
+
}),
|
|
266
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl),
|
|
267
|
+
});
|
|
268
|
+
const content = createToolResultStopMessage(toolUse.id);
|
|
269
|
+
content.content = withMemoryCorrectionHint(CANCEL_MESSAGE);
|
|
270
|
+
yield {
|
|
271
|
+
message: createUserMessage({
|
|
272
|
+
content: [content],
|
|
273
|
+
toolUseResult: CANCEL_MESSAGE,
|
|
274
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
275
|
+
}),
|
|
276
|
+
};
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
for await (const update of streamedCheckPermissionsAndCallTool(tool, toolUse.id, toolInput, toolUseContext, canUseTool, assistantMessage, messageId, requestId, mcpServerType, mcpServerBaseUrl)) {
|
|
280
|
+
yield update;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
logError(error);
|
|
285
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
286
|
+
const toolInfo = tool ? ` (${tool.name})` : '';
|
|
287
|
+
const detailedError = `Error calling tool${toolInfo}: ${errorMessage}`;
|
|
288
|
+
yield {
|
|
289
|
+
message: createUserMessage({
|
|
290
|
+
content: [
|
|
291
|
+
{
|
|
292
|
+
type: 'tool_result',
|
|
293
|
+
content: `<tool_use_error>${detailedError}</tool_use_error>`,
|
|
294
|
+
is_error: true,
|
|
295
|
+
tool_use_id: toolUse.id,
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
toolUseResult: detailedError,
|
|
299
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
300
|
+
}),
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
function streamedCheckPermissionsAndCallTool(tool, toolUseID, input, toolUseContext, canUseTool, assistantMessage, messageId, requestId, mcpServerType, mcpServerBaseUrl) {
|
|
305
|
+
// This is a bit of a hack to get progress events and final results
|
|
306
|
+
// into a single async iterable.
|
|
307
|
+
//
|
|
308
|
+
// Ideally the progress reporting and tool call reporting would
|
|
309
|
+
// be via separate mechanisms.
|
|
310
|
+
const stream = new Stream();
|
|
311
|
+
checkPermissionsAndCallTool(tool, toolUseID, input, toolUseContext, canUseTool, assistantMessage, messageId, requestId, mcpServerType, mcpServerBaseUrl, progress => {
|
|
312
|
+
logEvent('thaddeus_tool_use_progress', {
|
|
313
|
+
messageID: messageId,
|
|
314
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
315
|
+
isMcp: tool.isMcp ?? false,
|
|
316
|
+
queryChainId: toolUseContext.queryTracking
|
|
317
|
+
?.chainId,
|
|
318
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
319
|
+
...(mcpServerType && {
|
|
320
|
+
mcpServerType: mcpServerType,
|
|
321
|
+
}),
|
|
322
|
+
...(mcpServerBaseUrl && {
|
|
323
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
324
|
+
}),
|
|
325
|
+
...(requestId && {
|
|
326
|
+
requestId: requestId,
|
|
327
|
+
}),
|
|
328
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl),
|
|
329
|
+
});
|
|
330
|
+
stream.enqueue({
|
|
331
|
+
message: createProgressMessage({
|
|
332
|
+
toolUseID: progress.toolUseID,
|
|
333
|
+
parentToolUseID: toolUseID,
|
|
334
|
+
data: progress.data,
|
|
335
|
+
}),
|
|
336
|
+
});
|
|
337
|
+
})
|
|
338
|
+
.then(results => {
|
|
339
|
+
for (const result of results) {
|
|
340
|
+
stream.enqueue(result);
|
|
341
|
+
}
|
|
342
|
+
})
|
|
343
|
+
.catch(error => {
|
|
344
|
+
stream.error(error);
|
|
345
|
+
})
|
|
346
|
+
.finally(() => {
|
|
347
|
+
stream.done();
|
|
348
|
+
});
|
|
349
|
+
return stream;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Appended to Zod errors when a deferred tool wasn't in the discovered-tool
|
|
353
|
+
* set — re-runs the claude.ts schema-filter scan dispatch-time to detect the
|
|
354
|
+
* mismatch. The raw Zod error ("expected array, got string") doesn't tell the
|
|
355
|
+
* model to re-load the tool; this hint does. Null if the schema was sent.
|
|
356
|
+
*/
|
|
357
|
+
export function buildSchemaNotSentHint(tool, messages, tools) {
|
|
358
|
+
// Optimistic gating — reconstructing claude.ts's full useToolSearch
|
|
359
|
+
// computation is fragile. These two gates prevent pointing at a ToolSearch
|
|
360
|
+
// that isn't callable; occasional misfires (Haiku, tst-auto below threshold)
|
|
361
|
+
// cost one extra round-trip on an already-failing path.
|
|
362
|
+
if (!isToolSearchEnabledOptimistic())
|
|
363
|
+
return null;
|
|
364
|
+
if (!isToolSearchToolAvailable(tools))
|
|
365
|
+
return null;
|
|
366
|
+
if (!isDeferredTool(tool))
|
|
367
|
+
return null;
|
|
368
|
+
const discovered = extractDiscoveredToolNames(messages);
|
|
369
|
+
if (discovered.has(tool.name))
|
|
370
|
+
return null;
|
|
371
|
+
return (`\n\nThis tool's schema was not sent to the API — it was not in the discovered-tool set derived from message history. ` +
|
|
372
|
+
`Without the schema in your prompt, typed parameters (arrays, numbers, booleans) get emitted as strings and the client-side parser rejects them. ` +
|
|
373
|
+
`Load the tool first: call ${TOOL_SEARCH_TOOL_NAME} with query "select:${tool.name}", then retry this call.`);
|
|
374
|
+
}
|
|
375
|
+
async function checkPermissionsAndCallTool(tool, toolUseID, input, toolUseContext, canUseTool, assistantMessage, messageId, requestId, mcpServerType, mcpServerBaseUrl, onToolProgress) {
|
|
376
|
+
// Validate input types with zod (surprisingly, the model is not great at generating valid input)
|
|
377
|
+
const parsedInput = tool.inputSchema.safeParse(input);
|
|
378
|
+
if (!parsedInput.success) {
|
|
379
|
+
let errorContent = formatZodValidationError(tool.name, parsedInput.error);
|
|
380
|
+
const schemaHint = buildSchemaNotSentHint(tool, toolUseContext.messages, toolUseContext.options.tools);
|
|
381
|
+
if (schemaHint) {
|
|
382
|
+
logEvent('thaddeus_deferred_tool_schema_not_sent', {
|
|
383
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
384
|
+
isMcp: tool.isMcp ?? false,
|
|
385
|
+
});
|
|
386
|
+
errorContent += schemaHint;
|
|
387
|
+
}
|
|
388
|
+
logForDebugging(`${tool.name} tool input error: ${errorContent.slice(0, 200)}`);
|
|
389
|
+
logEvent('thaddeus_tool_use_error', {
|
|
390
|
+
error: 'InputValidationError',
|
|
391
|
+
errorDetails: errorContent.slice(0, 2000),
|
|
392
|
+
messageID: messageId,
|
|
393
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
394
|
+
isMcp: tool.isMcp ?? false,
|
|
395
|
+
queryChainId: toolUseContext.queryTracking
|
|
396
|
+
?.chainId,
|
|
397
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
398
|
+
...(mcpServerType && {
|
|
399
|
+
mcpServerType: mcpServerType,
|
|
400
|
+
}),
|
|
401
|
+
...(mcpServerBaseUrl && {
|
|
402
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
403
|
+
}),
|
|
404
|
+
...(requestId && {
|
|
405
|
+
requestId: requestId,
|
|
406
|
+
}),
|
|
407
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl),
|
|
408
|
+
});
|
|
409
|
+
return [
|
|
410
|
+
{
|
|
411
|
+
message: createUserMessage({
|
|
412
|
+
content: [
|
|
413
|
+
{
|
|
414
|
+
type: 'tool_result',
|
|
415
|
+
content: `<tool_use_error>InputValidationError: ${errorContent}</tool_use_error>`,
|
|
416
|
+
is_error: true,
|
|
417
|
+
tool_use_id: toolUseID,
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
toolUseResult: `InputValidationError: ${parsedInput.error.message}`,
|
|
421
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
422
|
+
}),
|
|
423
|
+
},
|
|
424
|
+
];
|
|
425
|
+
}
|
|
426
|
+
// Validate input values. Each tool has its own validation logic
|
|
427
|
+
const isValidCall = await tool.validateInput?.(parsedInput.data, toolUseContext);
|
|
428
|
+
if (isValidCall?.result === false) {
|
|
429
|
+
logForDebugging(`${tool.name} tool validation error: ${isValidCall.message?.slice(0, 200)}`);
|
|
430
|
+
logEvent('thaddeus_tool_use_error', {
|
|
431
|
+
messageID: messageId,
|
|
432
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
433
|
+
error: isValidCall.message,
|
|
434
|
+
errorCode: isValidCall.errorCode,
|
|
435
|
+
isMcp: tool.isMcp ?? false,
|
|
436
|
+
queryChainId: toolUseContext.queryTracking
|
|
437
|
+
?.chainId,
|
|
438
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
439
|
+
...(mcpServerType && {
|
|
440
|
+
mcpServerType: mcpServerType,
|
|
441
|
+
}),
|
|
442
|
+
...(mcpServerBaseUrl && {
|
|
443
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
444
|
+
}),
|
|
445
|
+
...(requestId && {
|
|
446
|
+
requestId: requestId,
|
|
447
|
+
}),
|
|
448
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl),
|
|
449
|
+
});
|
|
450
|
+
return [
|
|
451
|
+
{
|
|
452
|
+
message: createUserMessage({
|
|
453
|
+
content: [
|
|
454
|
+
{
|
|
455
|
+
type: 'tool_result',
|
|
456
|
+
content: `<tool_use_error>${isValidCall.message}</tool_use_error>`,
|
|
457
|
+
is_error: true,
|
|
458
|
+
tool_use_id: toolUseID,
|
|
459
|
+
},
|
|
460
|
+
],
|
|
461
|
+
toolUseResult: `Error: ${isValidCall.message}`,
|
|
462
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
463
|
+
}),
|
|
464
|
+
},
|
|
465
|
+
];
|
|
466
|
+
}
|
|
467
|
+
// --- Guardrails check (2026-04-05) ---
|
|
468
|
+
// Run BEFORE permissions/hooks/tool.call(). Blocks catastrophic actions and
|
|
469
|
+
// gates approval-required actions. 99% of tool calls pass through instantly.
|
|
470
|
+
// Wrapped in try/catch: guardrails must NEVER crash the app — fail open.
|
|
471
|
+
try {
|
|
472
|
+
const guardrails = getGuardrails();
|
|
473
|
+
const guardrailCheck = guardrails.check(tool.name, parsedInput.data);
|
|
474
|
+
if (!guardrailCheck.allowed) {
|
|
475
|
+
if (!guardrailCheck.requiresApproval) {
|
|
476
|
+
// Hard-blocked action — return error immediately, do not proceed
|
|
477
|
+
getAuditTrail().logToolCall({
|
|
478
|
+
toolName: tool.name,
|
|
479
|
+
toolUseId: toolUseID,
|
|
480
|
+
input: parsedInput.data,
|
|
481
|
+
durationMs: 0,
|
|
482
|
+
outcome: 'blocked',
|
|
483
|
+
guardrailRule: guardrailCheck.reason,
|
|
484
|
+
isReadOnly: tool.isReadOnly(parsedInput.data),
|
|
485
|
+
agentId: toolUseContext.agentId,
|
|
486
|
+
});
|
|
487
|
+
logForDebugging(`[Guardrails] BLOCKED: ${tool.name} — ${guardrailCheck.reason}`);
|
|
488
|
+
return [
|
|
489
|
+
{
|
|
490
|
+
message: createUserMessage({
|
|
491
|
+
content: [
|
|
492
|
+
{
|
|
493
|
+
type: 'tool_result',
|
|
494
|
+
content: `<tool_use_error>Guardrail policy blocked this action: ${guardrailCheck.reason}</tool_use_error>`,
|
|
495
|
+
is_error: true,
|
|
496
|
+
tool_use_id: toolUseID,
|
|
497
|
+
},
|
|
498
|
+
],
|
|
499
|
+
toolUseResult: `Error: ${guardrailCheck.reason}`,
|
|
500
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
501
|
+
}),
|
|
502
|
+
},
|
|
503
|
+
];
|
|
504
|
+
}
|
|
505
|
+
// Approval-required — log and let the existing permission flow handle it.
|
|
506
|
+
// The guardrails audit captures the event; the tool proceeds to the normal
|
|
507
|
+
// permission/hook pipeline which will ask the user via canUseTool.
|
|
508
|
+
getAuditTrail().logToolCall({
|
|
509
|
+
toolName: tool.name,
|
|
510
|
+
toolUseId: toolUseID,
|
|
511
|
+
input: parsedInput.data,
|
|
512
|
+
durationMs: 0,
|
|
513
|
+
outcome: 'approval_required',
|
|
514
|
+
guardrailRule: guardrailCheck.rule?.pattern,
|
|
515
|
+
isReadOnly: tool.isReadOnly(parsedInput.data),
|
|
516
|
+
agentId: toolUseContext.agentId,
|
|
517
|
+
});
|
|
518
|
+
logForDebugging(`[Guardrails] Approval required: ${tool.name} — ${guardrailCheck.reason}`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
catch (guardrailError) {
|
|
522
|
+
// CRITICAL: guardrails must never block normal tool flow
|
|
523
|
+
logForDebugging(`[Guardrails] Error in guardrail check, failing open: ${guardrailError instanceof Error ? guardrailError.message : String(guardrailError)}`);
|
|
524
|
+
}
|
|
525
|
+
// Speculatively start the bash allow classifier check early so it runs in
|
|
526
|
+
// parallel with pre-tool hooks, deny/ask classifiers, and permission dialog
|
|
527
|
+
// setup. The UI indicator (setClassifierChecking) is NOT set here — it's
|
|
528
|
+
// set in interactiveHandler.ts only when the permission check returns `ask`
|
|
529
|
+
// with a pendingClassifierCheck. This avoids flashing "classifier running"
|
|
530
|
+
// for commands that auto-allow via prefix rules.
|
|
531
|
+
if (tool.name === BASH_TOOL_NAME &&
|
|
532
|
+
parsedInput.data &&
|
|
533
|
+
'command' in parsedInput.data) {
|
|
534
|
+
const appState = toolUseContext.getAppState();
|
|
535
|
+
startSpeculativeClassifierCheck(parsedInput.data.command, appState.toolPermissionContext, toolUseContext.abortController.signal, toolUseContext.options.isNonInteractiveSession);
|
|
536
|
+
}
|
|
537
|
+
const resultingMessages = [];
|
|
538
|
+
// Defense-in-depth: strip _simulatedSedEdit from model-provided Bash input.
|
|
539
|
+
// This field is internal-only — it must only be injected by the permission
|
|
540
|
+
// system (SedEditPermissionRequest) after user approval. If the model supplies
|
|
541
|
+
// it, the schema's strictObject should already reject it, but we strip here
|
|
542
|
+
// as a safeguard against future regressions.
|
|
543
|
+
let processedInput = parsedInput.data;
|
|
544
|
+
if (tool.name === BASH_TOOL_NAME &&
|
|
545
|
+
processedInput &&
|
|
546
|
+
typeof processedInput === 'object' &&
|
|
547
|
+
'_simulatedSedEdit' in processedInput) {
|
|
548
|
+
const { _simulatedSedEdit: _, ...rest } = processedInput;
|
|
549
|
+
processedInput = rest;
|
|
550
|
+
}
|
|
551
|
+
// Backfill legacy/derived fields on a shallow clone so hooks/canUseTool see
|
|
552
|
+
// them without affecting tool.call(). SendMessageTool adds fields; file
|
|
553
|
+
// tools overwrite file_path with expandPath — that mutation must not reach
|
|
554
|
+
// call() because tool results embed the input path verbatim (e.g. "File
|
|
555
|
+
// created successfully at: {path}"), and changing it alters the serialized
|
|
556
|
+
// transcript and VCR fixture hashes. If a hook/permission later returns a
|
|
557
|
+
// fresh updatedInput, callInput converges on it below — that replacement
|
|
558
|
+
// is intentional and should reach call().
|
|
559
|
+
let callInput = processedInput;
|
|
560
|
+
const backfilledClone = tool.backfillObservableInput &&
|
|
561
|
+
typeof processedInput === 'object' &&
|
|
562
|
+
processedInput !== null
|
|
563
|
+
? { ...processedInput }
|
|
564
|
+
: null;
|
|
565
|
+
if (backfilledClone) {
|
|
566
|
+
tool.backfillObservableInput(backfilledClone);
|
|
567
|
+
processedInput = backfilledClone;
|
|
568
|
+
}
|
|
569
|
+
let shouldPreventContinuation = false;
|
|
570
|
+
let stopReason;
|
|
571
|
+
let hookPermissionResult;
|
|
572
|
+
const preToolHookInfos = [];
|
|
573
|
+
const preToolHookStart = Date.now();
|
|
574
|
+
for await (const result of runPreToolUseHooks(toolUseContext, tool, processedInput, toolUseID, assistantMessage.message.id, requestId, mcpServerType, mcpServerBaseUrl)) {
|
|
575
|
+
switch (result.type) {
|
|
576
|
+
case 'message':
|
|
577
|
+
if (result.message.message.type === 'progress') {
|
|
578
|
+
onToolProgress(result.message.message);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
resultingMessages.push(result.message);
|
|
582
|
+
const att = result.message.message.attachment;
|
|
583
|
+
if (att &&
|
|
584
|
+
'command' in att &&
|
|
585
|
+
att.command !== undefined &&
|
|
586
|
+
'durationMs' in att &&
|
|
587
|
+
att.durationMs !== undefined) {
|
|
588
|
+
preToolHookInfos.push({
|
|
589
|
+
command: att.command,
|
|
590
|
+
durationMs: att.durationMs,
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
break;
|
|
595
|
+
case 'hookPermissionResult':
|
|
596
|
+
hookPermissionResult = result.hookPermissionResult;
|
|
597
|
+
break;
|
|
598
|
+
case 'hookUpdatedInput':
|
|
599
|
+
// Hook provided updatedInput without making a permission decision (passthrough)
|
|
600
|
+
// Update processedInput so it's used in the normal permission flow
|
|
601
|
+
processedInput = result.updatedInput;
|
|
602
|
+
break;
|
|
603
|
+
case 'preventContinuation':
|
|
604
|
+
shouldPreventContinuation = result.shouldPreventContinuation;
|
|
605
|
+
break;
|
|
606
|
+
case 'stopReason':
|
|
607
|
+
stopReason = result.stopReason;
|
|
608
|
+
break;
|
|
609
|
+
case 'additionalContext':
|
|
610
|
+
resultingMessages.push(result.message);
|
|
611
|
+
break;
|
|
612
|
+
case 'stop':
|
|
613
|
+
getStatsStore()?.observe('pre_tool_hook_duration_ms', Date.now() - preToolHookStart);
|
|
614
|
+
resultingMessages.push({
|
|
615
|
+
message: createUserMessage({
|
|
616
|
+
content: [createToolResultStopMessage(toolUseID)],
|
|
617
|
+
toolUseResult: `Error: ${stopReason}`,
|
|
618
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
619
|
+
}),
|
|
620
|
+
});
|
|
621
|
+
return resultingMessages;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
const preToolHookDurationMs = Date.now() - preToolHookStart;
|
|
625
|
+
getStatsStore()?.observe('pre_tool_hook_duration_ms', preToolHookDurationMs);
|
|
626
|
+
if (preToolHookDurationMs >= SLOW_PHASE_LOG_THRESHOLD_MS) {
|
|
627
|
+
logForDebugging(`Slow PreToolUse hooks: ${preToolHookDurationMs}ms for ${tool.name} (${preToolHookInfos.length} hooks)`, { level: 'info' });
|
|
628
|
+
}
|
|
629
|
+
// Emit PreToolUse summary immediately so it's visible while the tool executes.
|
|
630
|
+
// Use wall-clock time (not sum of individual durations) since hooks run in parallel.
|
|
631
|
+
if (process.env.USER_TYPE === 'ant' && preToolHookInfos.length > 0) {
|
|
632
|
+
if (preToolHookDurationMs > HOOK_TIMING_DISPLAY_THRESHOLD_MS) {
|
|
633
|
+
resultingMessages.push({
|
|
634
|
+
message: createStopHookSummaryMessage(preToolHookInfos.length, preToolHookInfos, [], false, undefined, false, 'suggestion', undefined, 'PreToolUse', preToolHookDurationMs),
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
const toolAttributes = {};
|
|
639
|
+
if (processedInput && typeof processedInput === 'object') {
|
|
640
|
+
if (tool.name === FILE_READ_TOOL_NAME && 'file_path' in processedInput) {
|
|
641
|
+
toolAttributes.file_path = String(processedInput.file_path);
|
|
642
|
+
}
|
|
643
|
+
else if ((tool.name === FILE_EDIT_TOOL_NAME ||
|
|
644
|
+
tool.name === FILE_WRITE_TOOL_NAME) &&
|
|
645
|
+
'file_path' in processedInput) {
|
|
646
|
+
toolAttributes.file_path = String(processedInput.file_path);
|
|
647
|
+
}
|
|
648
|
+
else if (tool.name === BASH_TOOL_NAME && 'command' in processedInput) {
|
|
649
|
+
const bashInput = processedInput;
|
|
650
|
+
toolAttributes.full_command = bashInput.command;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
startToolSpan(tool.name, toolAttributes, isBetaTracingEnabled() ? jsonStringify(processedInput) : undefined);
|
|
654
|
+
startToolBlockedOnUserSpan();
|
|
655
|
+
// Check whether we have permission to use the tool,
|
|
656
|
+
// and ask the user for permission if we don't
|
|
657
|
+
const permissionMode = toolUseContext.getAppState().toolPermissionContext.mode;
|
|
658
|
+
const permissionStart = Date.now();
|
|
659
|
+
const resolved = await resolveHookPermissionDecision(hookPermissionResult, tool, processedInput, toolUseContext, canUseTool, assistantMessage, toolUseID);
|
|
660
|
+
const permissionDecision = resolved.decision;
|
|
661
|
+
processedInput = resolved.input;
|
|
662
|
+
const permissionDurationMs = Date.now() - permissionStart;
|
|
663
|
+
// In auto mode, canUseTool awaits the classifier (side_query) — if that's
|
|
664
|
+
// slow the collapsed view shows "Running…" with no (Ns) tick since
|
|
665
|
+
// bash_progress hasn't started yet. Auto-only: in default mode this timer
|
|
666
|
+
// includes interactive-dialog wait (user think time), which is just noise.
|
|
667
|
+
if (permissionDurationMs >= SLOW_PHASE_LOG_THRESHOLD_MS &&
|
|
668
|
+
permissionMode === 'auto') {
|
|
669
|
+
logForDebugging(`Slow permission decision: ${permissionDurationMs}ms for ${tool.name} ` +
|
|
670
|
+
`(mode=${permissionMode}, behavior=${permissionDecision.behavior})`, { level: 'info' });
|
|
671
|
+
}
|
|
672
|
+
// Emit tool_decision OTel event and code-edit counter if the interactive
|
|
673
|
+
// permission path didn't already log it (headless mode bypasses permission
|
|
674
|
+
// logging, so we need to emit both the generic event and the code-edit
|
|
675
|
+
// counter here)
|
|
676
|
+
if (permissionDecision.behavior !== 'ask' &&
|
|
677
|
+
!toolUseContext.toolDecisions?.has(toolUseID)) {
|
|
678
|
+
const decision = permissionDecision.behavior === 'allow' ? 'accept' : 'reject';
|
|
679
|
+
const source = decisionReasonToOTelSource(permissionDecision.decisionReason, permissionDecision.behavior);
|
|
680
|
+
void logOTelEvent('tool_decision', {
|
|
681
|
+
decision,
|
|
682
|
+
source,
|
|
683
|
+
tool_name: sanitizeToolNameForAnalytics(tool.name),
|
|
684
|
+
});
|
|
685
|
+
// Increment code-edit tool decision counter for headless mode
|
|
686
|
+
if (isCodeEditingTool(tool.name)) {
|
|
687
|
+
void buildCodeEditToolAttributes(tool, processedInput, decision, source).then(attributes => getCodeEditToolDecisionCounter()?.add(1, attributes));
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
// Add message if permission was granted/denied by PermissionRequest hook
|
|
691
|
+
if (permissionDecision.decisionReason?.type === 'hook' &&
|
|
692
|
+
permissionDecision.decisionReason.hookName === 'PermissionRequest' &&
|
|
693
|
+
permissionDecision.behavior !== 'ask') {
|
|
694
|
+
resultingMessages.push({
|
|
695
|
+
message: createAttachmentMessage({
|
|
696
|
+
type: 'hook_permission_decision',
|
|
697
|
+
decision: permissionDecision.behavior,
|
|
698
|
+
toolUseID,
|
|
699
|
+
hookEvent: 'PermissionRequest',
|
|
700
|
+
}),
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
if (permissionDecision.behavior !== 'allow') {
|
|
704
|
+
logForDebugging(`${tool.name} tool permission denied`);
|
|
705
|
+
const decisionInfo = toolUseContext.toolDecisions?.get(toolUseID);
|
|
706
|
+
endToolBlockedOnUserSpan('reject', decisionInfo?.source || 'unknown');
|
|
707
|
+
endToolSpan();
|
|
708
|
+
logEvent('thaddeus_tool_use_can_use_tool_rejected', {
|
|
709
|
+
messageID: messageId,
|
|
710
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
711
|
+
queryChainId: toolUseContext.queryTracking
|
|
712
|
+
?.chainId,
|
|
713
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
714
|
+
...(mcpServerType && {
|
|
715
|
+
mcpServerType: mcpServerType,
|
|
716
|
+
}),
|
|
717
|
+
...(mcpServerBaseUrl && {
|
|
718
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
719
|
+
}),
|
|
720
|
+
...(requestId && {
|
|
721
|
+
requestId: requestId,
|
|
722
|
+
}),
|
|
723
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl),
|
|
724
|
+
});
|
|
725
|
+
let errorMessage = permissionDecision.message;
|
|
726
|
+
// Only use generic "Execution stopped" message if we don't have a detailed hook message
|
|
727
|
+
if (shouldPreventContinuation && !errorMessage) {
|
|
728
|
+
errorMessage = `Execution stopped by PreToolUse hook${stopReason ? `: ${stopReason}` : ''}`;
|
|
729
|
+
}
|
|
730
|
+
// Build top-level content: tool_result (text-only for is_error compatibility) + images alongside
|
|
731
|
+
const messageContent = [
|
|
732
|
+
{
|
|
733
|
+
type: 'tool_result',
|
|
734
|
+
content: errorMessage,
|
|
735
|
+
is_error: true,
|
|
736
|
+
tool_use_id: toolUseID,
|
|
737
|
+
},
|
|
738
|
+
];
|
|
739
|
+
// Add image blocks at top level (not inside tool_result, which rejects non-text with is_error)
|
|
740
|
+
const rejectContentBlocks = permissionDecision.behavior === 'ask'
|
|
741
|
+
? permissionDecision.contentBlocks
|
|
742
|
+
: undefined;
|
|
743
|
+
if (rejectContentBlocks?.length) {
|
|
744
|
+
messageContent.push(...rejectContentBlocks);
|
|
745
|
+
}
|
|
746
|
+
// Generate sequential imagePasteIds so each image renders with a distinct label
|
|
747
|
+
let rejectImageIds;
|
|
748
|
+
if (rejectContentBlocks?.length) {
|
|
749
|
+
const imageCount = count(rejectContentBlocks, (b) => b.type === 'image');
|
|
750
|
+
if (imageCount > 0) {
|
|
751
|
+
const startId = getNextImagePasteId(toolUseContext.messages);
|
|
752
|
+
rejectImageIds = Array.from({ length: imageCount }, (_, i) => startId + i);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
resultingMessages.push({
|
|
756
|
+
message: createUserMessage({
|
|
757
|
+
content: messageContent,
|
|
758
|
+
imagePasteIds: rejectImageIds,
|
|
759
|
+
toolUseResult: `Error: ${errorMessage}`,
|
|
760
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
761
|
+
}),
|
|
762
|
+
});
|
|
763
|
+
// Run PermissionDenied hooks for auto mode classifier denials.
|
|
764
|
+
// If a hook returns {retry: true}, tell the model it may retry.
|
|
765
|
+
if (feature('TRANSCRIPT_CLASSIFIER') &&
|
|
766
|
+
permissionDecision.decisionReason?.type === 'classifier' &&
|
|
767
|
+
permissionDecision.decisionReason.classifier === 'auto-mode') {
|
|
768
|
+
let hookSaysRetry = false;
|
|
769
|
+
for await (const result of executePermissionDeniedHooks(tool.name, toolUseID, processedInput, permissionDecision.decisionReason.reason ?? 'Permission denied', toolUseContext, permissionMode, toolUseContext.abortController.signal)) {
|
|
770
|
+
if (result.retry)
|
|
771
|
+
hookSaysRetry = true;
|
|
772
|
+
}
|
|
773
|
+
if (hookSaysRetry) {
|
|
774
|
+
resultingMessages.push({
|
|
775
|
+
message: createUserMessage({
|
|
776
|
+
content: 'The PermissionDenied hook indicated this command is now approved. You may retry it if you would like.',
|
|
777
|
+
isMeta: true,
|
|
778
|
+
}),
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
return resultingMessages;
|
|
783
|
+
}
|
|
784
|
+
logEvent('thaddeus_tool_use_can_use_tool_allowed', {
|
|
785
|
+
messageID: messageId,
|
|
786
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
787
|
+
queryChainId: toolUseContext.queryTracking
|
|
788
|
+
?.chainId,
|
|
789
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
790
|
+
...(mcpServerType && {
|
|
791
|
+
mcpServerType: mcpServerType,
|
|
792
|
+
}),
|
|
793
|
+
...(mcpServerBaseUrl && {
|
|
794
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
795
|
+
}),
|
|
796
|
+
...(requestId && {
|
|
797
|
+
requestId: requestId,
|
|
798
|
+
}),
|
|
799
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl),
|
|
800
|
+
});
|
|
801
|
+
// Use the updated input from permissions if provided
|
|
802
|
+
// (Don't overwrite if undefined - processedInput may have been modified by passthrough hooks)
|
|
803
|
+
if (permissionDecision.updatedInput !== undefined) {
|
|
804
|
+
processedInput = permissionDecision.updatedInput;
|
|
805
|
+
}
|
|
806
|
+
// Prepare tool parameters for logging in tool_result event.
|
|
807
|
+
// Gated by OTEL_LOG_TOOL_DETAILS — tool parameters can contain sensitive
|
|
808
|
+
// content (bash commands, MCP server names, etc.) so they're opt-in only.
|
|
809
|
+
const telemetryToolInput = extractToolInputForTelemetry(processedInput);
|
|
810
|
+
let toolParameters = {};
|
|
811
|
+
if (isToolDetailsLoggingEnabled()) {
|
|
812
|
+
if (tool.name === BASH_TOOL_NAME && 'command' in processedInput) {
|
|
813
|
+
const bashInput = processedInput;
|
|
814
|
+
const commandParts = bashInput.command.trim().split(/\s+/);
|
|
815
|
+
const bashCommand = commandParts[0] || '';
|
|
816
|
+
toolParameters = {
|
|
817
|
+
bash_command: bashCommand,
|
|
818
|
+
full_command: bashInput.command,
|
|
819
|
+
...(bashInput.timeout !== undefined && {
|
|
820
|
+
timeout: bashInput.timeout,
|
|
821
|
+
}),
|
|
822
|
+
...(bashInput.description !== undefined && {
|
|
823
|
+
description: bashInput.description,
|
|
824
|
+
}),
|
|
825
|
+
...('dangerouslyDisableSandbox' in bashInput && {
|
|
826
|
+
dangerouslyDisableSandbox: bashInput.dangerouslyDisableSandbox,
|
|
827
|
+
}),
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
const mcpDetails = extractMcpToolDetails(tool.name);
|
|
831
|
+
if (mcpDetails) {
|
|
832
|
+
toolParameters.mcp_server_name = mcpDetails.serverName;
|
|
833
|
+
toolParameters.mcp_tool_name = mcpDetails.mcpToolName;
|
|
834
|
+
}
|
|
835
|
+
const skillName = extractSkillName(tool.name, processedInput);
|
|
836
|
+
if (skillName) {
|
|
837
|
+
toolParameters.skill_name = skillName;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
const decisionInfo = toolUseContext.toolDecisions?.get(toolUseID);
|
|
841
|
+
endToolBlockedOnUserSpan(decisionInfo?.decision || 'unknown', decisionInfo?.source || 'unknown');
|
|
842
|
+
startToolExecutionSpan();
|
|
843
|
+
const startTime = Date.now();
|
|
844
|
+
startSessionActivity('tool_exec');
|
|
845
|
+
// If processedInput still points at the backfill clone, no hook/permission
|
|
846
|
+
// replaced it — pass the pre-backfill callInput so call() sees the model's
|
|
847
|
+
// original field values. Otherwise converge on the hook-supplied input.
|
|
848
|
+
// Permission/hook flows may return a fresh object derived from the
|
|
849
|
+
// backfilled clone (e.g. via inputSchema.parse). If its file_path matches
|
|
850
|
+
// the backfill-expanded value, restore the model's original so the tool
|
|
851
|
+
// result string embeds the path the model emitted — keeps transcript/VCR
|
|
852
|
+
// hashes stable. Other hook modifications flow through unchanged.
|
|
853
|
+
if (backfilledClone &&
|
|
854
|
+
processedInput !== callInput &&
|
|
855
|
+
typeof processedInput === 'object' &&
|
|
856
|
+
processedInput !== null &&
|
|
857
|
+
'file_path' in processedInput &&
|
|
858
|
+
'file_path' in callInput &&
|
|
859
|
+
processedInput.file_path ===
|
|
860
|
+
backfilledClone.file_path) {
|
|
861
|
+
callInput = {
|
|
862
|
+
...processedInput,
|
|
863
|
+
file_path: callInput.file_path,
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
else if (processedInput !== backfilledClone) {
|
|
867
|
+
callInput = processedInput;
|
|
868
|
+
}
|
|
869
|
+
try {
|
|
870
|
+
const result = await tool.call(callInput, {
|
|
871
|
+
...toolUseContext,
|
|
872
|
+
toolUseId: toolUseID,
|
|
873
|
+
userModified: permissionDecision.userModified ?? false,
|
|
874
|
+
}, canUseTool, assistantMessage, progress => {
|
|
875
|
+
onToolProgress({
|
|
876
|
+
toolUseID: progress.toolUseID,
|
|
877
|
+
data: progress.data,
|
|
878
|
+
});
|
|
879
|
+
});
|
|
880
|
+
const durationMs = Date.now() - startTime;
|
|
881
|
+
addToToolDuration(durationMs);
|
|
882
|
+
// --- Audit trail: log successful tool call (2026-04-05) ---
|
|
883
|
+
try {
|
|
884
|
+
getAuditTrail().logToolCall({
|
|
885
|
+
toolName: tool.name,
|
|
886
|
+
toolUseId: toolUseID,
|
|
887
|
+
input: processedInput ?? {},
|
|
888
|
+
durationMs,
|
|
889
|
+
outcome: 'success',
|
|
890
|
+
isReadOnly: tool.isReadOnly(callInput),
|
|
891
|
+
agentId: toolUseContext.agentId,
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
catch {
|
|
895
|
+
// Never crash for audit logging
|
|
896
|
+
}
|
|
897
|
+
// Log tool content/output as span event if enabled
|
|
898
|
+
if (result.data && typeof result.data === 'object') {
|
|
899
|
+
const contentAttributes = {};
|
|
900
|
+
// Read tool: capture file_path and content
|
|
901
|
+
if (tool.name === FILE_READ_TOOL_NAME && 'content' in result.data) {
|
|
902
|
+
if ('file_path' in processedInput) {
|
|
903
|
+
contentAttributes.file_path = String(processedInput.file_path);
|
|
904
|
+
}
|
|
905
|
+
contentAttributes.content = String(result.data.content);
|
|
906
|
+
}
|
|
907
|
+
// Edit/Write tools: capture file_path and diff
|
|
908
|
+
if ((tool.name === FILE_EDIT_TOOL_NAME ||
|
|
909
|
+
tool.name === FILE_WRITE_TOOL_NAME) &&
|
|
910
|
+
'file_path' in processedInput) {
|
|
911
|
+
contentAttributes.file_path = String(processedInput.file_path);
|
|
912
|
+
// For Edit, capture the actual changes made
|
|
913
|
+
if (tool.name === FILE_EDIT_TOOL_NAME && 'diff' in result.data) {
|
|
914
|
+
contentAttributes.diff = String(result.data.diff);
|
|
915
|
+
}
|
|
916
|
+
// For Write, capture the written content
|
|
917
|
+
if (tool.name === FILE_WRITE_TOOL_NAME && 'content' in processedInput) {
|
|
918
|
+
contentAttributes.content = String(processedInput.content);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
// Bash tool: capture command
|
|
922
|
+
if (tool.name === BASH_TOOL_NAME && 'command' in processedInput) {
|
|
923
|
+
const bashInput = processedInput;
|
|
924
|
+
contentAttributes.bash_command = bashInput.command;
|
|
925
|
+
// Also capture output if available
|
|
926
|
+
if ('output' in result.data) {
|
|
927
|
+
contentAttributes.output = String(result.data.output);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
if (Object.keys(contentAttributes).length > 0) {
|
|
931
|
+
addToolContentEvent('tool.output', contentAttributes);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
// Capture structured output from tool result if present
|
|
935
|
+
if (typeof result === 'object' && 'structured_output' in result) {
|
|
936
|
+
// Store the structured output in an attachment message
|
|
937
|
+
resultingMessages.push({
|
|
938
|
+
message: createAttachmentMessage({
|
|
939
|
+
type: 'structured_output',
|
|
940
|
+
data: result.structured_output,
|
|
941
|
+
}),
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
endToolExecutionSpan({ success: true });
|
|
945
|
+
// Pass tool result for new_context logging
|
|
946
|
+
const toolResultStr = result.data && typeof result.data === 'object'
|
|
947
|
+
? jsonStringify(result.data)
|
|
948
|
+
: String(result.data ?? '');
|
|
949
|
+
endToolSpan(toolResultStr);
|
|
950
|
+
// Map the tool result to API format once and cache it. This block is reused
|
|
951
|
+
// by addToolResult (skipping the remap) and measured here for analytics.
|
|
952
|
+
const mappedToolResultBlock = tool.mapToolResultToToolResultBlockParam(result.data, toolUseID);
|
|
953
|
+
const mappedContent = mappedToolResultBlock.content;
|
|
954
|
+
const toolResultSizeBytes = !mappedContent
|
|
955
|
+
? 0
|
|
956
|
+
: typeof mappedContent === 'string'
|
|
957
|
+
? mappedContent.length
|
|
958
|
+
: jsonStringify(mappedContent).length;
|
|
959
|
+
// Extract file extension for file-related tools
|
|
960
|
+
let fileExtension;
|
|
961
|
+
if (processedInput && typeof processedInput === 'object') {
|
|
962
|
+
if ((tool.name === FILE_READ_TOOL_NAME ||
|
|
963
|
+
tool.name === FILE_EDIT_TOOL_NAME ||
|
|
964
|
+
tool.name === FILE_WRITE_TOOL_NAME) &&
|
|
965
|
+
'file_path' in processedInput) {
|
|
966
|
+
fileExtension = getFileExtensionForAnalytics(String(processedInput.file_path));
|
|
967
|
+
}
|
|
968
|
+
else if (tool.name === NOTEBOOK_EDIT_TOOL_NAME &&
|
|
969
|
+
'notebook_path' in processedInput) {
|
|
970
|
+
fileExtension = getFileExtensionForAnalytics(String(processedInput.notebook_path));
|
|
971
|
+
}
|
|
972
|
+
else if (tool.name === BASH_TOOL_NAME && 'command' in processedInput) {
|
|
973
|
+
const bashInput = processedInput;
|
|
974
|
+
fileExtension = getFileExtensionsFromBashCommand(bashInput.command, bashInput._simulatedSedEdit?.filePath);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
logEvent('thaddeus_tool_use_success', {
|
|
978
|
+
messageID: messageId,
|
|
979
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
980
|
+
isMcp: tool.isMcp ?? false,
|
|
981
|
+
durationMs,
|
|
982
|
+
preToolHookDurationMs,
|
|
983
|
+
toolResultSizeBytes,
|
|
984
|
+
...(fileExtension !== undefined && { fileExtension }),
|
|
985
|
+
queryChainId: toolUseContext.queryTracking
|
|
986
|
+
?.chainId,
|
|
987
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
988
|
+
...(mcpServerType && {
|
|
989
|
+
mcpServerType: mcpServerType,
|
|
990
|
+
}),
|
|
991
|
+
...(mcpServerBaseUrl && {
|
|
992
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
993
|
+
}),
|
|
994
|
+
...(requestId && {
|
|
995
|
+
requestId: requestId,
|
|
996
|
+
}),
|
|
997
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl),
|
|
998
|
+
});
|
|
999
|
+
// Enrich tool parameters with git commit ID from successful git commit output
|
|
1000
|
+
if (isToolDetailsLoggingEnabled() &&
|
|
1001
|
+
(tool.name === BASH_TOOL_NAME || tool.name === POWERSHELL_TOOL_NAME) &&
|
|
1002
|
+
'command' in processedInput &&
|
|
1003
|
+
typeof processedInput.command === 'string' &&
|
|
1004
|
+
processedInput.command.match(/\bgit\s+commit\b/) &&
|
|
1005
|
+
result.data &&
|
|
1006
|
+
typeof result.data === 'object' &&
|
|
1007
|
+
'stdout' in result.data) {
|
|
1008
|
+
const gitCommitId = parseGitCommitId(String(result.data.stdout));
|
|
1009
|
+
if (gitCommitId) {
|
|
1010
|
+
toolParameters.git_commit_id = gitCommitId;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
// Log tool result event for OTLP with tool parameters and decision context
|
|
1014
|
+
const mcpServerScope = isMcpTool(tool)
|
|
1015
|
+
? getMcpServerScopeFromToolName(tool.name)
|
|
1016
|
+
: null;
|
|
1017
|
+
void logOTelEvent('tool_result', {
|
|
1018
|
+
tool_name: sanitizeToolNameForAnalytics(tool.name),
|
|
1019
|
+
success: 'true',
|
|
1020
|
+
duration_ms: String(durationMs),
|
|
1021
|
+
...(Object.keys(toolParameters).length > 0 && {
|
|
1022
|
+
tool_parameters: jsonStringify(toolParameters),
|
|
1023
|
+
}),
|
|
1024
|
+
...(telemetryToolInput && { tool_input: telemetryToolInput }),
|
|
1025
|
+
tool_result_size_bytes: String(toolResultSizeBytes),
|
|
1026
|
+
...(decisionInfo && {
|
|
1027
|
+
decision_source: decisionInfo.source,
|
|
1028
|
+
decision_type: decisionInfo.decision,
|
|
1029
|
+
}),
|
|
1030
|
+
...(mcpServerScope && { mcp_server_scope: mcpServerScope }),
|
|
1031
|
+
});
|
|
1032
|
+
// Run PostToolUse hooks
|
|
1033
|
+
let toolOutput = result.data;
|
|
1034
|
+
const hookResults = [];
|
|
1035
|
+
const toolContextModifier = result.contextModifier;
|
|
1036
|
+
const mcpMeta = result.mcpMeta;
|
|
1037
|
+
async function addToolResult(toolUseResult, preMappedBlock) {
|
|
1038
|
+
// Use the pre-mapped block when available (non-MCP tools where hooks
|
|
1039
|
+
// don't modify the output), otherwise map from scratch.
|
|
1040
|
+
const toolResultBlock = preMappedBlock
|
|
1041
|
+
? await processPreMappedToolResultBlock(preMappedBlock, tool.name, tool.maxResultSizeChars)
|
|
1042
|
+
: await processToolResultBlock(tool, toolUseResult, toolUseID);
|
|
1043
|
+
// Build content blocks - tool result first, then optional feedback
|
|
1044
|
+
const contentBlocks = [toolResultBlock];
|
|
1045
|
+
// Add accept feedback if user provided feedback when approving
|
|
1046
|
+
// (acceptFeedback only exists on PermissionAllowDecision, which is guaranteed here)
|
|
1047
|
+
if ('acceptFeedback' in permissionDecision &&
|
|
1048
|
+
permissionDecision.acceptFeedback) {
|
|
1049
|
+
contentBlocks.push({
|
|
1050
|
+
type: 'text',
|
|
1051
|
+
text: permissionDecision.acceptFeedback,
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
// Add content blocks (e.g., pasted images) from the permission decision
|
|
1055
|
+
const allowContentBlocks = 'contentBlocks' in permissionDecision
|
|
1056
|
+
? permissionDecision.contentBlocks
|
|
1057
|
+
: undefined;
|
|
1058
|
+
if (allowContentBlocks?.length) {
|
|
1059
|
+
contentBlocks.push(...allowContentBlocks);
|
|
1060
|
+
}
|
|
1061
|
+
// Generate sequential imagePasteIds so each image renders with a distinct label
|
|
1062
|
+
let allowImageIds;
|
|
1063
|
+
if (allowContentBlocks?.length) {
|
|
1064
|
+
const imageCount = count(allowContentBlocks, (b) => b.type === 'image');
|
|
1065
|
+
if (imageCount > 0) {
|
|
1066
|
+
const startId = getNextImagePasteId(toolUseContext.messages);
|
|
1067
|
+
allowImageIds = Array.from({ length: imageCount }, (_, i) => startId + i);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
resultingMessages.push({
|
|
1071
|
+
message: createUserMessage({
|
|
1072
|
+
content: contentBlocks,
|
|
1073
|
+
imagePasteIds: allowImageIds,
|
|
1074
|
+
toolUseResult: toolUseContext.agentId && !toolUseContext.preserveToolUseResults
|
|
1075
|
+
? undefined
|
|
1076
|
+
: toolUseResult,
|
|
1077
|
+
mcpMeta: toolUseContext.agentId ? undefined : mcpMeta,
|
|
1078
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
1079
|
+
}),
|
|
1080
|
+
contextModifier: toolContextModifier
|
|
1081
|
+
? {
|
|
1082
|
+
toolUseID: toolUseID,
|
|
1083
|
+
modifyContext: toolContextModifier,
|
|
1084
|
+
}
|
|
1085
|
+
: undefined,
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
// TOOD(hackyon): refactor so we don't have different experiences for MCP tools
|
|
1089
|
+
if (!isMcpTool(tool)) {
|
|
1090
|
+
await addToolResult(toolOutput, mappedToolResultBlock);
|
|
1091
|
+
}
|
|
1092
|
+
const postToolHookInfos = [];
|
|
1093
|
+
const postToolHookStart = Date.now();
|
|
1094
|
+
for await (const hookResult of runPostToolUseHooks(toolUseContext, tool, toolUseID, assistantMessage.message.id, processedInput, toolOutput, requestId, mcpServerType, mcpServerBaseUrl)) {
|
|
1095
|
+
if ('updatedMCPToolOutput' in hookResult) {
|
|
1096
|
+
if (isMcpTool(tool)) {
|
|
1097
|
+
toolOutput = hookResult.updatedMCPToolOutput;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
else if (isMcpTool(tool)) {
|
|
1101
|
+
hookResults.push(hookResult);
|
|
1102
|
+
if (hookResult.message.type === 'attachment') {
|
|
1103
|
+
const att = hookResult.message.attachment;
|
|
1104
|
+
if ('command' in att &&
|
|
1105
|
+
att.command !== undefined &&
|
|
1106
|
+
'durationMs' in att &&
|
|
1107
|
+
att.durationMs !== undefined) {
|
|
1108
|
+
postToolHookInfos.push({
|
|
1109
|
+
command: att.command,
|
|
1110
|
+
durationMs: att.durationMs,
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
else {
|
|
1116
|
+
resultingMessages.push(hookResult);
|
|
1117
|
+
if (hookResult.message.type === 'attachment') {
|
|
1118
|
+
const att = hookResult.message.attachment;
|
|
1119
|
+
if ('command' in att &&
|
|
1120
|
+
att.command !== undefined &&
|
|
1121
|
+
'durationMs' in att &&
|
|
1122
|
+
att.durationMs !== undefined) {
|
|
1123
|
+
postToolHookInfos.push({
|
|
1124
|
+
command: att.command,
|
|
1125
|
+
durationMs: att.durationMs,
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
const postToolHookDurationMs = Date.now() - postToolHookStart;
|
|
1132
|
+
if (postToolHookDurationMs >= SLOW_PHASE_LOG_THRESHOLD_MS) {
|
|
1133
|
+
logForDebugging(`Slow PostToolUse hooks: ${postToolHookDurationMs}ms for ${tool.name} (${postToolHookInfos.length} hooks)`, { level: 'info' });
|
|
1134
|
+
}
|
|
1135
|
+
if (isMcpTool(tool)) {
|
|
1136
|
+
await addToolResult(toolOutput);
|
|
1137
|
+
}
|
|
1138
|
+
// Show PostToolUse hook timing inline below tool result when > 500ms.
|
|
1139
|
+
// Use wall-clock time (not sum of individual durations) since hooks run in parallel.
|
|
1140
|
+
if (process.env.USER_TYPE === 'ant' && postToolHookInfos.length > 0) {
|
|
1141
|
+
if (postToolHookDurationMs > HOOK_TIMING_DISPLAY_THRESHOLD_MS) {
|
|
1142
|
+
resultingMessages.push({
|
|
1143
|
+
message: createStopHookSummaryMessage(postToolHookInfos.length, postToolHookInfos, [], false, undefined, false, 'suggestion', undefined, 'PostToolUse', postToolHookDurationMs),
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
// If the tool provided new messages, add them to the list to return.
|
|
1148
|
+
if (result.newMessages && result.newMessages.length > 0) {
|
|
1149
|
+
for (const message of result.newMessages) {
|
|
1150
|
+
resultingMessages.push({ message });
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
// If hook indicated to prevent continuation after successful execution, yield a stop reason message
|
|
1154
|
+
if (shouldPreventContinuation) {
|
|
1155
|
+
resultingMessages.push({
|
|
1156
|
+
message: createAttachmentMessage({
|
|
1157
|
+
type: 'hook_stopped_continuation',
|
|
1158
|
+
message: stopReason || 'Execution stopped by hook',
|
|
1159
|
+
hookName: `PreToolUse:${tool.name}`,
|
|
1160
|
+
toolUseID: toolUseID,
|
|
1161
|
+
hookEvent: 'PreToolUse',
|
|
1162
|
+
}),
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
// Yield the remaining hook results after the other messages are sent
|
|
1166
|
+
for (const hookResult of hookResults) {
|
|
1167
|
+
resultingMessages.push(hookResult);
|
|
1168
|
+
}
|
|
1169
|
+
return resultingMessages;
|
|
1170
|
+
}
|
|
1171
|
+
catch (error) {
|
|
1172
|
+
const durationMs = Date.now() - startTime;
|
|
1173
|
+
addToToolDuration(durationMs);
|
|
1174
|
+
// --- Audit trail: log failed tool call (2026-04-05) ---
|
|
1175
|
+
try {
|
|
1176
|
+
getAuditTrail().logToolCall({
|
|
1177
|
+
toolName: tool.name,
|
|
1178
|
+
toolUseId: toolUseID,
|
|
1179
|
+
input: processedInput ?? {},
|
|
1180
|
+
durationMs,
|
|
1181
|
+
outcome: error instanceof AbortError ? 'cancelled' : 'error',
|
|
1182
|
+
errorMessage: error instanceof Error ? error.message.slice(0, 500) : String(error).slice(0, 500),
|
|
1183
|
+
isReadOnly: tool.isReadOnly(callInput),
|
|
1184
|
+
agentId: toolUseContext.agentId,
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
catch {
|
|
1188
|
+
// Never crash for audit logging
|
|
1189
|
+
}
|
|
1190
|
+
endToolExecutionSpan({
|
|
1191
|
+
success: false,
|
|
1192
|
+
error: errorMessage(error),
|
|
1193
|
+
});
|
|
1194
|
+
endToolSpan();
|
|
1195
|
+
// Handle MCP auth errors by updating the client status to 'needs-auth'
|
|
1196
|
+
// This updates the /mcp display to show the server needs re-authorization
|
|
1197
|
+
if (error instanceof McpAuthError) {
|
|
1198
|
+
toolUseContext.setAppState(prevState => {
|
|
1199
|
+
const serverName = error.serverName;
|
|
1200
|
+
const existingClientIndex = prevState.mcp.clients.findIndex(c => c.name === serverName);
|
|
1201
|
+
if (existingClientIndex === -1) {
|
|
1202
|
+
return prevState;
|
|
1203
|
+
}
|
|
1204
|
+
const existingClient = prevState.mcp.clients[existingClientIndex];
|
|
1205
|
+
// Only update if client was connected (don't overwrite other states)
|
|
1206
|
+
if (!existingClient || existingClient.type !== 'connected') {
|
|
1207
|
+
return prevState;
|
|
1208
|
+
}
|
|
1209
|
+
const updatedClients = [...prevState.mcp.clients];
|
|
1210
|
+
updatedClients[existingClientIndex] = {
|
|
1211
|
+
name: serverName,
|
|
1212
|
+
type: 'needs-auth',
|
|
1213
|
+
config: existingClient.config,
|
|
1214
|
+
};
|
|
1215
|
+
return {
|
|
1216
|
+
...prevState,
|
|
1217
|
+
mcp: {
|
|
1218
|
+
...prevState.mcp,
|
|
1219
|
+
clients: updatedClients,
|
|
1220
|
+
},
|
|
1221
|
+
};
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
if (!(error instanceof AbortError)) {
|
|
1225
|
+
const errorMsg = errorMessage(error);
|
|
1226
|
+
logForDebugging(`${tool.name} tool error (${durationMs}ms): ${errorMsg.slice(0, 200)}`);
|
|
1227
|
+
if (!(error instanceof ShellError)) {
|
|
1228
|
+
logError(error);
|
|
1229
|
+
}
|
|
1230
|
+
logEvent('thaddeus_tool_use_error', {
|
|
1231
|
+
messageID: messageId,
|
|
1232
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
1233
|
+
error: classifyToolError(error),
|
|
1234
|
+
isMcp: tool.isMcp ?? false,
|
|
1235
|
+
queryChainId: toolUseContext.queryTracking
|
|
1236
|
+
?.chainId,
|
|
1237
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
1238
|
+
...(mcpServerType && {
|
|
1239
|
+
mcpServerType: mcpServerType,
|
|
1240
|
+
}),
|
|
1241
|
+
...(mcpServerBaseUrl && {
|
|
1242
|
+
mcpServerBaseUrl: mcpServerBaseUrl,
|
|
1243
|
+
}),
|
|
1244
|
+
...(requestId && {
|
|
1245
|
+
requestId: requestId,
|
|
1246
|
+
}),
|
|
1247
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl),
|
|
1248
|
+
});
|
|
1249
|
+
// Log tool result error event for OTLP with tool parameters and decision context
|
|
1250
|
+
const mcpServerScope = isMcpTool(tool)
|
|
1251
|
+
? getMcpServerScopeFromToolName(tool.name)
|
|
1252
|
+
: null;
|
|
1253
|
+
void logOTelEvent('tool_result', {
|
|
1254
|
+
tool_name: sanitizeToolNameForAnalytics(tool.name),
|
|
1255
|
+
use_id: toolUseID,
|
|
1256
|
+
success: 'false',
|
|
1257
|
+
duration_ms: String(durationMs),
|
|
1258
|
+
error: errorMessage(error),
|
|
1259
|
+
...(Object.keys(toolParameters).length > 0 && {
|
|
1260
|
+
tool_parameters: jsonStringify(toolParameters),
|
|
1261
|
+
}),
|
|
1262
|
+
...(telemetryToolInput && { tool_input: telemetryToolInput }),
|
|
1263
|
+
...(decisionInfo && {
|
|
1264
|
+
decision_source: decisionInfo.source,
|
|
1265
|
+
decision_type: decisionInfo.decision,
|
|
1266
|
+
}),
|
|
1267
|
+
...(mcpServerScope && { mcp_server_scope: mcpServerScope }),
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
const content = formatError(error);
|
|
1271
|
+
// Determine if this was a user interrupt
|
|
1272
|
+
const isInterrupt = error instanceof AbortError;
|
|
1273
|
+
// Run PostToolUseFailure hooks
|
|
1274
|
+
const hookMessages = [];
|
|
1275
|
+
for await (const hookResult of runPostToolUseFailureHooks(toolUseContext, tool, toolUseID, messageId, processedInput, content, isInterrupt, requestId, mcpServerType, mcpServerBaseUrl)) {
|
|
1276
|
+
hookMessages.push(hookResult);
|
|
1277
|
+
}
|
|
1278
|
+
return [
|
|
1279
|
+
{
|
|
1280
|
+
message: createUserMessage({
|
|
1281
|
+
content: [
|
|
1282
|
+
{
|
|
1283
|
+
type: 'tool_result',
|
|
1284
|
+
content,
|
|
1285
|
+
is_error: true,
|
|
1286
|
+
tool_use_id: toolUseID,
|
|
1287
|
+
},
|
|
1288
|
+
],
|
|
1289
|
+
toolUseResult: `Error: ${content}`,
|
|
1290
|
+
mcpMeta: toolUseContext.agentId
|
|
1291
|
+
? undefined
|
|
1292
|
+
: error instanceof
|
|
1293
|
+
McpToolCallError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
|
|
1294
|
+
? error.mcpMeta
|
|
1295
|
+
: undefined,
|
|
1296
|
+
sourceToolAssistantUUID: assistantMessage.uuid,
|
|
1297
|
+
}),
|
|
1298
|
+
},
|
|
1299
|
+
...hookMessages,
|
|
1300
|
+
];
|
|
1301
|
+
}
|
|
1302
|
+
finally {
|
|
1303
|
+
stopSessionActivity('tool_exec');
|
|
1304
|
+
// Clean up decision info after logging
|
|
1305
|
+
if (decisionInfo) {
|
|
1306
|
+
toolUseContext.toolDecisions?.delete(toolUseID);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|