lcclaude 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +21 -0
- package/README.en.md +333 -0
- package/README.md +333 -0
- package/bin/lcclaude.js +30 -0
- package/dist/preload.js +15 -0
- package/dist/runtime/bun-bundle-shim.js +10 -0
- package/dist/runtime/bun-wrap-shim.js +63 -0
- package/dist/src/QueryEngine.js +804 -0
- package/dist/src/Task.js +40 -0
- package/dist/src/Tool.js +33 -0
- package/dist/src/assistant/sessionHistory.js +39 -0
- package/dist/src/bootstrap/state.js +985 -0
- package/dist/src/bridge/bridgeApi.js +254 -0
- package/dist/src/bridge/bridgeConfig.js +14 -0
- package/dist/src/bridge/bridgeDebug.js +64 -0
- package/dist/src/bridge/bridgeEnabled.js +55 -0
- package/dist/src/bridge/bridgeMain.js +1547 -0
- package/dist/src/bridge/bridgeMessaging.js +249 -0
- package/dist/src/bridge/bridgePermissionCallbacks.js +7 -0
- package/dist/src/bridge/bridgePointer.js +105 -0
- package/dist/src/bridge/bridgeStatusUtil.js +81 -0
- package/dist/src/bridge/bridgeUI.js +375 -0
- package/dist/src/bridge/capacityWake.js +26 -0
- package/dist/src/bridge/codeSessionApi.js +78 -0
- package/dist/src/bridge/createSession.js +227 -0
- package/dist/src/bridge/debugUtils.js +80 -0
- package/dist/src/bridge/envLessBridgeConfig.js +61 -0
- package/dist/src/bridge/flushGate.js +32 -0
- package/dist/src/bridge/inboundAttachments.js +106 -0
- package/dist/src/bridge/inboundMessages.js +38 -0
- package/dist/src/bridge/initReplBridge.js +276 -0
- package/dist/src/bridge/jwtUtils.js +131 -0
- package/dist/src/bridge/pollConfig.js +28 -0
- package/dist/src/bridge/pollConfigDefaults.js +15 -0
- package/dist/src/bridge/remoteBridgeCore.js +511 -0
- package/dist/src/bridge/replBridge.js +1098 -0
- package/dist/src/bridge/replBridgeHandle.js +14 -0
- package/dist/src/bridge/replBridgeTransport.js +147 -0
- package/dist/src/bridge/sessionIdCompat.js +16 -0
- package/dist/src/bridge/sessionRunner.js +349 -0
- package/dist/src/bridge/trustedDevice.js +113 -0
- package/dist/src/bridge/types.js +6 -0
- package/dist/src/bridge/workSecret.js +51 -0
- package/dist/src/buddy/CompanionSprite.js +435 -0
- package/dist/src/buddy/companion.js +104 -0
- package/dist/src/buddy/prompt.js +31 -0
- package/dist/src/buddy/sprites.js +500 -0
- package/dist/src/buddy/types.js +85 -0
- package/dist/src/buddy/useBuddyNotification.js +93 -0
- package/dist/src/cli/exit.js +13 -0
- package/dist/src/cli/handlers/agents.js +55 -0
- package/dist/src/cli/handlers/auth.js +255 -0
- package/dist/src/cli/handlers/autoMode.js +117 -0
- package/dist/src/cli/handlers/mcp.js +304 -0
- package/dist/src/cli/handlers/plugins.js +538 -0
- package/dist/src/cli/handlers/util.js +119 -0
- package/dist/src/cli/ndjsonSafeStringify.js +8 -0
- package/dist/src/cli/print.js +3112 -0
- package/dist/src/cli/remoteIO.js +161 -0
- package/dist/src/cli/structuredIO.js +489 -0
- package/dist/src/cli/transports/HybridTransport.js +145 -0
- package/dist/src/cli/transports/SSETransport.js +403 -0
- package/dist/src/cli/transports/SerialBatchEventUploader.js +154 -0
- package/dist/src/cli/transports/WebSocketTransport.js +497 -0
- package/dist/src/cli/transports/WorkerStateUploader.js +69 -0
- package/dist/src/cli/transports/ccrClient.js +522 -0
- package/dist/src/cli/transports/transportUtils.js +25 -0
- package/dist/src/cli/update.js +361 -0
- package/dist/src/commands/add-dir/add-dir.js +140 -0
- package/dist/src/commands/add-dir/index.js +8 -0
- package/dist/src/commands/add-dir/validation.js +67 -0
- package/dist/src/commands/advisor.js +96 -0
- package/dist/src/commands/agents/agents.js +12 -0
- package/dist/src/commands/agents/index.js +7 -0
- package/dist/src/commands/ant-trace/index.js +1 -0
- package/dist/src/commands/autofix-pr/index.js +1 -0
- package/dist/src/commands/backfill-sessions/index.js +1 -0
- package/dist/src/commands/branch/branch.js +168 -0
- package/dist/src/commands/branch/index.js +9 -0
- package/dist/src/commands/break-cache/index.js +1 -0
- package/dist/src/commands/bridge/bridge.js +519 -0
- package/dist/src/commands/bridge/index.js +21 -0
- package/dist/src/commands/bridge-kick.js +145 -0
- package/dist/src/commands/brief.js +66 -0
- package/dist/src/commands/btw/btw.js +281 -0
- package/dist/src/commands/btw/index.js +9 -0
- package/dist/src/commands/bughunter/index.js +1 -0
- package/dist/src/commands/chrome/chrome.js +394 -0
- package/dist/src/commands/chrome/index.js +10 -0
- package/dist/src/commands/clear/caches.js +69 -0
- package/dist/src/commands/clear/clear.js +5 -0
- package/dist/src/commands/clear/conversation.js +156 -0
- package/dist/src/commands/clear/index.js +9 -0
- package/dist/src/commands/color/color.js +57 -0
- package/dist/src/commands/color/index.js +9 -0
- package/dist/src/commands/commit-push-pr.js +145 -0
- package/dist/src/commands/commit.js +83 -0
- package/dist/src/commands/compact/compact.js +161 -0
- package/dist/src/commands/compact/index.js +11 -0
- package/dist/src/commands/config/config.js +9 -0
- package/dist/src/commands/config/index.js +8 -0
- package/dist/src/commands/context/context-noninteractive.js +256 -0
- package/dist/src/commands/context/context.js +33 -0
- package/dist/src/commands/context/index.js +21 -0
- package/dist/src/commands/copy/copy.js +397 -0
- package/dist/src/commands/copy/index.js +7 -0
- package/dist/src/commands/cost/cost.js +21 -0
- package/dist/src/commands/cost/index.js +15 -0
- package/dist/src/commands/createMovedToPluginCommand.js +40 -0
- package/dist/src/commands/ctx_viz/index.js +1 -0
- package/dist/src/commands/debug-tool-call/index.js +1 -0
- package/dist/src/commands/desktop/desktop.js +7 -0
- package/dist/src/commands/desktop/index.js +22 -0
- package/dist/src/commands/diff/diff.js +10 -0
- package/dist/src/commands/diff/index.js +6 -0
- package/dist/src/commands/doctor/doctor.js +7 -0
- package/dist/src/commands/doctor/index.js +9 -0
- package/dist/src/commands/effort/effort.js +181 -0
- package/dist/src/commands/effort/index.js +11 -0
- package/dist/src/commands/env/index.js +1 -0
- package/dist/src/commands/exit/exit.js +25 -0
- package/dist/src/commands/exit/index.js +9 -0
- package/dist/src/commands/export/export.js +79 -0
- package/dist/src/commands/export/index.js +8 -0
- package/dist/src/commands/extra-usage/extra-usage-core.js +85 -0
- package/dist/src/commands/extra-usage/extra-usage-noninteractive.js +11 -0
- package/dist/src/commands/extra-usage/extra-usage.js +17 -0
- package/dist/src/commands/extra-usage/index.js +27 -0
- package/dist/src/commands/fast/fast.js +345 -0
- package/dist/src/commands/fast/index.js +23 -0
- package/dist/src/commands/feedback/feedback.js +15 -0
- package/dist/src/commands/feedback/index.js +13 -0
- package/dist/src/commands/files/files.js +13 -0
- package/dist/src/commands/files/index.js +9 -0
- package/dist/src/commands/good-claude/index.js +1 -0
- package/dist/src/commands/heapdump/heapdump.js +15 -0
- package/dist/src/commands/heapdump/index.js +9 -0
- package/dist/src/commands/help/help.js +12 -0
- package/dist/src/commands/help/index.js +7 -0
- package/dist/src/commands/hooks/hooks.js +14 -0
- package/dist/src/commands/hooks/index.js +8 -0
- package/dist/src/commands/ide/ide.js +702 -0
- package/dist/src/commands/ide/index.js +8 -0
- package/dist/src/commands/init-verifiers.js +258 -0
- package/dist/src/commands/init.js +240 -0
- package/dist/src/commands/insights.js +2212 -0
- package/dist/src/commands/install-github-app/ApiKeyStep.js +290 -0
- package/dist/src/commands/install-github-app/CheckExistingSecretStep.js +265 -0
- package/dist/src/commands/install-github-app/CheckGitHubStep.js +16 -0
- package/dist/src/commands/install-github-app/ChooseRepoStep.js +282 -0
- package/dist/src/commands/install-github-app/CreatingStep.js +87 -0
- package/dist/src/commands/install-github-app/ErrorStep.js +157 -0
- package/dist/src/commands/install-github-app/ExistingWorkflowStep.js +164 -0
- package/dist/src/commands/install-github-app/InstallAppStep.js +166 -0
- package/dist/src/commands/install-github-app/OAuthFlowStep.js +335 -0
- package/dist/src/commands/install-github-app/SuccessStep.js +173 -0
- package/dist/src/commands/install-github-app/WarningsStep.js +140 -0
- package/dist/src/commands/install-github-app/index.js +10 -0
- package/dist/src/commands/install-github-app/install-github-app.js +612 -0
- package/dist/src/commands/install-github-app/setupGitHubActions.js +223 -0
- package/dist/src/commands/install-slack-app/index.js +9 -0
- package/dist/src/commands/install-slack-app/install-slack-app.js +23 -0
- package/dist/src/commands/install.js +348 -0
- package/dist/src/commands/issue/index.js +1 -0
- package/dist/src/commands/keybindings/index.js +10 -0
- package/dist/src/commands/keybindings/keybindings.js +43 -0
- package/dist/src/commands/login/index.js +9 -0
- package/dist/src/commands/login/login.js +105 -0
- package/dist/src/commands/logout/index.js +8 -0
- package/dist/src/commands/logout/logout.js +68 -0
- package/dist/src/commands/mcp/addCommand.js +157 -0
- package/dist/src/commands/mcp/index.js +9 -0
- package/dist/src/commands/mcp/mcp.js +85 -0
- package/dist/src/commands/mcp/xaaIdpCommand.js +135 -0
- package/dist/src/commands/memory/index.js +7 -0
- package/dist/src/commands/memory/memory.js +95 -0
- package/dist/src/commands/mobile/index.js +8 -0
- package/dist/src/commands/mobile/mobile.js +324 -0
- package/dist/src/commands/mock-limits/index.js +1 -0
- package/dist/src/commands/model/index.js +14 -0
- package/dist/src/commands/model/model.js +289 -0
- package/dist/src/commands/oauth-refresh/index.js +1 -0
- package/dist/src/commands/onboarding/index.js +1 -0
- package/dist/src/commands/output-style/index.js +8 -0
- package/dist/src/commands/output-style/output-style.js +5 -0
- package/dist/src/commands/passes/index.js +20 -0
- package/dist/src/commands/passes/passes.js +23 -0
- package/dist/src/commands/perf-issue/index.js +1 -0
- package/dist/src/commands/permissions/index.js +8 -0
- package/dist/src/commands/permissions/permissions.js +11 -0
- package/dist/src/commands/plan/index.js +8 -0
- package/dist/src/commands/plan/plan.js +151 -0
- package/dist/src/commands/plugin/AddMarketplace.js +202 -0
- package/dist/src/commands/plugin/BrowseMarketplace.js +918 -0
- package/dist/src/commands/plugin/DiscoverPlugins.js +935 -0
- package/dist/src/commands/plugin/ManageMarketplaces.js +1018 -0
- package/dist/src/commands/plugin/ManagePlugins.js +2230 -0
- package/dist/src/commands/plugin/PluginErrors.js +118 -0
- package/dist/src/commands/plugin/PluginOptionsDialog.js +396 -0
- package/dist/src/commands/plugin/PluginOptionsFlow.js +80 -0
- package/dist/src/commands/plugin/PluginSettings.js +1313 -0
- package/dist/src/commands/plugin/PluginTrustWarning.js +50 -0
- package/dist/src/commands/plugin/UnifiedInstalledCell.js +749 -0
- package/dist/src/commands/plugin/ValidatePlugin.js +113 -0
- package/dist/src/commands/plugin/index.js +9 -0
- package/dist/src/commands/plugin/parseArgs.js +61 -0
- package/dist/src/commands/plugin/plugin.js +8 -0
- package/dist/src/commands/plugin/pluginDetailsHelpers.js +114 -0
- package/dist/src/commands/plugin/usePagination.js +75 -0
- package/dist/src/commands/pr_comments/index.js +49 -0
- package/dist/src/commands/privacy-settings/index.js +11 -0
- package/dist/src/commands/privacy-settings/privacy-settings.js +58 -0
- package/dist/src/commands/rate-limit-options/index.js +15 -0
- package/dist/src/commands/rate-limit-options/rate-limit-options.js +211 -0
- package/dist/src/commands/release-notes/index.js +8 -0
- package/dist/src/commands/release-notes/release-notes.js +38 -0
- package/dist/src/commands/reload-plugins/index.js +8 -0
- package/dist/src/commands/reload-plugins/reload-plugins.js +27 -0
- package/dist/src/commands/remote-env/index.js +12 -0
- package/dist/src/commands/remote-env/remote-env.js +7 -0
- package/dist/src/commands/remote-setup/api.js +121 -0
- package/dist/src/commands/remote-setup/index.js +14 -0
- package/dist/src/commands/remote-setup/remote-setup.js +173 -0
- package/dist/src/commands/rename/generateSessionName.js +51 -0
- package/dist/src/commands/rename/index.js +9 -0
- package/dist/src/commands/rename/rename.js +52 -0
- package/dist/src/commands/reset-limits/index.js +4 -0
- package/dist/src/commands/resume/index.js +9 -0
- package/dist/src/commands/resume/resume.js +281 -0
- package/dist/src/commands/review/UltrareviewOverageDialog.js +112 -0
- package/dist/src/commands/review/reviewRemote.js +193 -0
- package/dist/src/commands/review/ultrareviewCommand.js +50 -0
- package/dist/src/commands/review/ultrareviewEnabled.js +5 -0
- package/dist/src/commands/review.js +45 -0
- package/dist/src/commands/rewind/index.js +10 -0
- package/dist/src/commands/rewind/rewind.js +6 -0
- package/dist/src/commands/sandbox-toggle/index.js +35 -0
- package/dist/src/commands/sandbox-toggle/sandbox-toggle.js +61 -0
- package/dist/src/commands/security-review.js +228 -0
- package/dist/src/commands/session/index.js +13 -0
- package/dist/src/commands/session/session.js +185 -0
- package/dist/src/commands/share/index.js +1 -0
- package/dist/src/commands/skills/index.js +7 -0
- package/dist/src/commands/skills/skills.js +8 -0
- package/dist/src/commands/stats/index.js +7 -0
- package/dist/src/commands/stats/stats.js +7 -0
- package/dist/src/commands/status/index.js +8 -0
- package/dist/src/commands/status/status.js +9 -0
- package/dist/src/commands/statusline.js +20 -0
- package/dist/src/commands/stickers/index.js +8 -0
- package/dist/src/commands/stickers/stickers.js +13 -0
- package/dist/src/commands/summary/index.js +1 -0
- package/dist/src/commands/tag/index.js +9 -0
- package/dist/src/commands/tag/tag.js +250 -0
- package/dist/src/commands/tasks/index.js +8 -0
- package/dist/src/commands/tasks/tasks.js +8 -0
- package/dist/src/commands/teleport/index.js +1 -0
- package/dist/src/commands/terminalSetup/index.js +15 -0
- package/dist/src/commands/terminalSetup/terminalSetup.js +425 -0
- package/dist/src/commands/theme/index.js +7 -0
- package/dist/src/commands/theme/theme.js +58 -0
- package/dist/src/commands/thinkback/index.js +9 -0
- package/dist/src/commands/thinkback/thinkback.js +569 -0
- package/dist/src/commands/thinkback-play/index.js +11 -0
- package/dist/src/commands/thinkback-play/thinkback-play.js +31 -0
- package/dist/src/commands/ultraplan.js +361 -0
- package/dist/src/commands/upgrade/index.js +11 -0
- package/dist/src/commands/upgrade/upgrade.js +37 -0
- package/dist/src/commands/usage/index.js +7 -0
- package/dist/src/commands/usage/usage.js +9 -0
- package/dist/src/commands/version.js +15 -0
- package/dist/src/commands/vim/index.js +8 -0
- package/dist/src/commands/vim/vim.js +24 -0
- package/dist/src/commands/voice/index.js +17 -0
- package/dist/src/commands/voice/voice.js +117 -0
- package/dist/src/commands.js +476 -0
- package/dist/src/components/AgentProgressLine.js +202 -0
- package/dist/src/components/App.js +53 -0
- package/dist/src/components/ApproveApiKey.js +156 -0
- package/dist/src/components/AutoModeOptInDialog.js +154 -0
- package/dist/src/components/AutoUpdater.js +178 -0
- package/dist/src/components/AutoUpdaterWrapper.js +91 -0
- package/dist/src/components/AwsAuthStatusBox.js +119 -0
- package/dist/src/components/BaseTextInput.js +158 -0
- package/dist/src/components/BashModeProgress.js +65 -0
- package/dist/src/components/BridgeDialog.js +460 -0
- package/dist/src/components/BypassPermissionsModeDialog.js +111 -0
- package/dist/src/components/ChannelDowngradeDialog.js +114 -0
- package/dist/src/components/ClaudeCodeHint/PluginHintMenu.js +120 -0
- package/dist/src/components/ClaudeInChromeOnboarding.js +176 -0
- package/dist/src/components/ClaudeMdExternalIncludesDialog.js +172 -0
- package/dist/src/components/ClickableImageRef.js +74 -0
- package/dist/src/components/CompactSummary.js +220 -0
- package/dist/src/components/ConfigurableShortcutHint.js +33 -0
- package/dist/src/components/ConsoleOAuthFlow.js +841 -0
- package/dist/src/components/ContextSuggestions.js +85 -0
- package/dist/src/components/ContextVisualization.js +878 -0
- package/dist/src/components/CoordinatorAgentStatus.js +304 -0
- package/dist/src/components/CostThresholdDialog.js +66 -0
- package/dist/src/components/CtrlOToExpand.js +56 -0
- package/dist/src/components/CustomSelect/SelectMulti.js +246 -0
- package/dist/src/components/CustomSelect/index.js +2 -0
- package/dist/src/components/CustomSelect/option-map.js +32 -0
- package/dist/src/components/CustomSelect/select-input-option.js +558 -0
- package/dist/src/components/CustomSelect/select-option.js +39 -0
- package/dist/src/components/CustomSelect/select.js +803 -0
- package/dist/src/components/CustomSelect/use-multi-select-state.js +175 -0
- package/dist/src/components/CustomSelect/use-select-input.js +163 -0
- package/dist/src/components/CustomSelect/use-select-navigation.js +334 -0
- package/dist/src/components/CustomSelect/use-select-state.js +30 -0
- package/dist/src/components/DesktopHandoff.js +214 -0
- package/dist/src/components/DesktopUpsell/DesktopUpsellStartup.js +185 -0
- package/dist/src/components/DevBar.js +53 -0
- package/dist/src/components/DevChannelsDialog.js +128 -0
- package/dist/src/components/DiagnosticsDisplay.js +149 -0
- package/dist/src/components/EffortCallout.js +302 -0
- package/dist/src/components/EffortIndicator.js +30 -0
- package/dist/src/components/ExitFlow.js +45 -0
- package/dist/src/components/ExportDialog.js +160 -0
- package/dist/src/components/FallbackToolUseErrorMessage.js +149 -0
- package/dist/src/components/FallbackToolUseRejectedMessage.js +18 -0
- package/dist/src/components/FastIcon.js +49 -0
- package/dist/src/components/Feedback.js +589 -0
- package/dist/src/components/FeedbackSurvey/FeedbackSurvey.js +219 -0
- package/dist/src/components/FeedbackSurvey/FeedbackSurveyView.js +168 -0
- package/dist/src/components/FeedbackSurvey/TranscriptSharePrompt.js +147 -0
- package/dist/src/components/FeedbackSurvey/submitTranscriptShare.js +70 -0
- package/dist/src/components/FeedbackSurvey/useDebouncedDigitInput.js +45 -0
- package/dist/src/components/FeedbackSurvey/useFeedbackSurvey.js +242 -0
- package/dist/src/components/FeedbackSurvey/useMemorySurvey.js +188 -0
- package/dist/src/components/FeedbackSurvey/usePostCompactSurvey.js +200 -0
- package/dist/src/components/FeedbackSurvey/useSurveyState.js +81 -0
- package/dist/src/components/FileEditToolDiff.js +193 -0
- package/dist/src/components/FileEditToolUpdatedMessage.js +162 -0
- package/dist/src/components/FileEditToolUseRejectedMessage.js +215 -0
- package/dist/src/components/FilePathLink.js +33 -0
- package/dist/src/components/FullscreenLayout.js +592 -0
- package/dist/src/components/GlobalSearchDialog.js +371 -0
- package/dist/src/components/HelpV2/Commands.js +99 -0
- package/dist/src/components/HelpV2/General.js +48 -0
- package/dist/src/components/HelpV2/HelpV2.js +231 -0
- package/dist/src/components/HighlightedCode/Fallback.js +200 -0
- package/dist/src/components/HighlightedCode.js +219 -0
- package/dist/src/components/HistorySearchDialog.js +144 -0
- package/dist/src/components/IdeAutoConnectDialog.js +172 -0
- package/dist/src/components/IdeOnboardingDialog.js +249 -0
- package/dist/src/components/IdeStatusIndicator.js +68 -0
- package/dist/src/components/IdleReturnDialog.js +126 -0
- package/dist/src/components/InterruptedByUser.js +25 -0
- package/dist/src/components/InvalidConfigDialog.js +173 -0
- package/dist/src/components/InvalidSettingsDialog.js +94 -0
- package/dist/src/components/KeybindingWarnings.js +144 -0
- package/dist/src/components/LanguagePicker.js +112 -0
- package/dist/src/components/LogSelector.js +1775 -0
- package/dist/src/components/LogoV2/AnimatedAsterisk.js +49 -0
- package/dist/src/components/LogoV2/AnimatedClawd.js +105 -0
- package/dist/src/components/LogoV2/ChannelsNotice.js +334 -0
- package/dist/src/components/LogoV2/Clawd.js +285 -0
- package/dist/src/components/LogoV2/CondensedLogo.js +218 -0
- package/dist/src/components/LogoV2/EmergencyTip.js +47 -0
- package/dist/src/components/LogoV2/Feed.js +140 -0
- package/dist/src/components/LogoV2/FeedColumn.js +67 -0
- package/dist/src/components/LogoV2/GuestPassesUpsell.js +90 -0
- package/dist/src/components/LogoV2/LogoV2.js +774 -0
- package/dist/src/components/LogoV2/Opus1mMergeNotice.js +68 -0
- package/dist/src/components/LogoV2/OverageCreditUpsell.js +154 -0
- package/dist/src/components/LogoV2/VoiceModeNotice.js +75 -0
- package/dist/src/components/LogoV2/WelcomeV2.js +976 -0
- package/dist/src/components/LogoV2/feedConfigs.js +89 -0
- package/dist/src/components/LspRecommendation/LspRecommendationMenu.js +128 -0
- package/dist/src/components/MCPServerApprovalDialog.js +121 -0
- package/dist/src/components/MCPServerDesktopImportDialog.js +249 -0
- package/dist/src/components/MCPServerDialogCopy.js +24 -0
- package/dist/src/components/MCPServerMultiselectDialog.js +173 -0
- package/dist/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +199 -0
- package/dist/src/components/ManagedSettingsSecurityDialog/utils.js +75 -0
- package/dist/src/components/Markdown.js +200 -0
- package/dist/src/components/MarkdownTable.js +215 -0
- package/dist/src/components/MemoryUsageIndicator.js +33 -0
- package/dist/src/components/Message.js +638 -0
- package/dist/src/components/MessageModel.js +43 -0
- package/dist/src/components/MessageResponse.js +99 -0
- package/dist/src/components/MessageRow.js +350 -0
- package/dist/src/components/MessageSelector.js +1021 -0
- package/dist/src/components/MessageTimestamp.js +63 -0
- package/dist/src/components/Messages.js +576 -0
- package/dist/src/components/ModelPicker.js +582 -0
- package/dist/src/components/NativeAutoUpdater.js +169 -0
- package/dist/src/components/NotebookEditToolUseRejectedMessage.js +123 -0
- package/dist/src/components/OffscreenFreeze.js +21 -0
- package/dist/src/components/Onboarding.js +307 -0
- package/dist/src/components/OutputStylePicker.js +128 -0
- package/dist/src/components/PackageManagerAutoUpdater.js +116 -0
- package/dist/src/components/Passes/Passes.js +242 -0
- package/dist/src/components/PrBadge.js +119 -0
- package/dist/src/components/PressEnterToContinue.js +24 -0
- package/dist/src/components/PromptInput/HistorySearchInput.js +64 -0
- package/dist/src/components/PromptInput/IssueFlagBanner.js +6 -0
- package/dist/src/components/PromptInput/Notifications.js +343 -0
- package/dist/src/components/PromptInput/PromptInput.js +1837 -0
- package/dist/src/components/PromptInput/PromptInputFooter.js +192 -0
- package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +504 -0
- package/dist/src/components/PromptInput/PromptInputFooterSuggestions.js +296 -0
- package/dist/src/components/PromptInput/PromptInputHelpMenu.js +508 -0
- package/dist/src/components/PromptInput/PromptInputModeIndicator.js +92 -0
- package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +90 -0
- package/dist/src/components/PromptInput/PromptInputStashNotice.js +30 -0
- package/dist/src/components/PromptInput/SandboxPromptFooterHint.js +80 -0
- package/dist/src/components/PromptInput/ShimmeredInput.js +157 -0
- package/dist/src/components/PromptInput/VoiceIndicator.js +138 -0
- package/dist/src/components/PromptInput/inputModes.js +24 -0
- package/dist/src/components/PromptInput/inputPaste.js +46 -0
- package/dist/src/components/PromptInput/useMaybeTruncateInput.js +36 -0
- package/dist/src/components/PromptInput/usePromptInputPlaceholder.js +39 -0
- package/dist/src/components/PromptInput/useShowFastIconHint.js +19 -0
- package/dist/src/components/PromptInput/useSwarmBanner.js +99 -0
- package/dist/src/components/PromptInput/utils.js +25 -0
- package/dist/src/components/QuickOpenDialog.js +272 -0
- package/dist/src/components/RemoteCallout.js +81 -0
- package/dist/src/components/RemoteEnvironmentDialog.js +451 -0
- package/dist/src/components/ResumeTask.js +361 -0
- package/dist/src/components/SandboxViolationExpandedView.js +134 -0
- package/dist/src/components/ScrollKeybindingHandler.js +589 -0
- package/dist/src/components/SearchBox.js +111 -0
- package/dist/src/components/SentryErrorBoundary.js +17 -0
- package/dist/src/components/SessionBackgroundHint.js +103 -0
- package/dist/src/components/SessionPreview.js +263 -0
- package/dist/src/components/Settings/Config.js +1776 -0
- package/dist/src/components/Settings/Settings.js +159 -0
- package/dist/src/components/Settings/Status.js +315 -0
- package/dist/src/components/Settings/Usage.js +503 -0
- package/dist/src/components/ShowInIDEPrompt.js +212 -0
- package/dist/src/components/SkillImprovementSurvey.js +204 -0
- package/dist/src/components/Spinner/FlashingChar.js +60 -0
- package/dist/src/components/Spinner/GlimmerMessage.js +391 -0
- package/dist/src/components/Spinner/ShimmerChar.js +30 -0
- package/dist/src/components/Spinner/SpinnerAnimationRow.js +248 -0
- package/dist/src/components/Spinner/SpinnerGlyph.js +105 -0
- package/dist/src/components/Spinner/TeammateSpinnerLine.js +243 -0
- package/dist/src/components/Spinner/TeammateSpinnerTree.js +360 -0
- package/dist/src/components/Spinner/index.js +7 -0
- package/dist/src/components/Spinner/teammateSelectHint.js +1 -0
- package/dist/src/components/Spinner/useShimmerAnimation.js +17 -0
- package/dist/src/components/Spinner/useStalledAnimation.js +47 -0
- package/dist/src/components/Spinner/utils.js +65 -0
- package/dist/src/components/Spinner.js +596 -0
- package/dist/src/components/Stats.js +1415 -0
- package/dist/src/components/StatusLine.js +264 -0
- package/dist/src/components/StatusNotices.js +50 -0
- package/dist/src/components/StructuredDiff/Fallback.js +379 -0
- package/dist/src/components/StructuredDiff/colorDiff.js +21 -0
- package/dist/src/components/StructuredDiff.js +170 -0
- package/dist/src/components/StructuredDiffList.js +30 -0
- package/dist/src/components/TagTabs.js +124 -0
- package/dist/src/components/TaskListV2.js +430 -0
- package/dist/src/components/TeammateViewHeader.js +112 -0
- package/dist/src/components/TeleportError.js +200 -0
- package/dist/src/components/TeleportProgress.js +175 -0
- package/dist/src/components/TeleportRepoMismatchDialog.js +160 -0
- package/dist/src/components/TeleportResumeWrapper.js +207 -0
- package/dist/src/components/TeleportStash.js +159 -0
- package/dist/src/components/TextInput.js +94 -0
- package/dist/src/components/ThemePicker.js +428 -0
- package/dist/src/components/ThinkingToggle.js +233 -0
- package/dist/src/components/TokenWarning.js +165 -0
- package/dist/src/components/ToolUseLoader.js +44 -0
- package/dist/src/components/TrustDialog/TrustDialog.js +337 -0
- package/dist/src/components/TrustDialog/utils.js +149 -0
- package/dist/src/components/ValidationErrorsList.js +169 -0
- package/dist/src/components/VimTextInput.js +142 -0
- package/dist/src/components/VirtualMessageList.js +745 -0
- package/dist/src/components/WorkflowMultiselectDialog.js +173 -0
- package/dist/src/components/WorktreeExitDialog.js +228 -0
- package/dist/src/components/agents/AgentDetail.js +371 -0
- package/dist/src/components/agents/AgentEditor.js +191 -0
- package/dist/src/components/agents/AgentNavigationFooter.js +28 -0
- package/dist/src/components/agents/AgentsList.js +623 -0
- package/dist/src/components/agents/AgentsMenu.js +897 -0
- package/dist/src/components/agents/ColorPicker.js +170 -0
- package/dist/src/components/agents/ModelSelector.js +79 -0
- package/dist/src/components/agents/ToolSelector.js +581 -0
- package/dist/src/components/agents/agentFileUtils.js +142 -0
- package/dist/src/components/agents/generateAgent.js +160 -0
- package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +101 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +108 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +551 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +73 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +176 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +176 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +104 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +136 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +105 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +75 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +185 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +81 -0
- package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +146 -0
- package/dist/src/components/agents/types.js +4 -0
- package/dist/src/components/agents/utils.js +14 -0
- package/dist/src/components/agents/validateAgent.js +66 -0
- package/dist/src/components/design-system/Byline.js +53 -0
- package/dist/src/components/design-system/Dialog.js +171 -0
- package/dist/src/components/design-system/Divider.js +107 -0
- package/dist/src/components/design-system/FuzzyPicker.js +316 -0
- package/dist/src/components/design-system/KeyboardShortcutHint.js +63 -0
- package/dist/src/components/design-system/ListItem.js +186 -0
- package/dist/src/components/design-system/LoadingState.js +72 -0
- package/dist/src/components/design-system/Pane.js +67 -0
- package/dist/src/components/design-system/ProgressBar.js +67 -0
- package/dist/src/components/design-system/Ratchet.js +83 -0
- package/dist/src/components/design-system/StatusIcon.js +60 -0
- package/dist/src/components/design-system/Tabs.js +332 -0
- package/dist/src/components/design-system/ThemeProvider.js +117 -0
- package/dist/src/components/design-system/ThemedBox.js +123 -0
- package/dist/src/components/design-system/ThemedText.js +68 -0
- package/dist/src/components/design-system/color.js +13 -0
- package/dist/src/components/diff/DiffDetailView.js +388 -0
- package/dist/src/components/diff/DiffDialog.js +489 -0
- package/dist/src/components/diff/DiffFileList.js +359 -0
- package/dist/src/components/grove/Grove.js +710 -0
- package/dist/src/components/hooks/HooksConfigMenu.js +626 -0
- package/dist/src/components/hooks/PromptDialog.js +96 -0
- package/dist/src/components/hooks/SelectEventMode.js +169 -0
- package/dist/src/components/hooks/SelectHookMode.js +127 -0
- package/dist/src/components/hooks/SelectMatcherMode.js +156 -0
- package/dist/src/components/hooks/ViewHookMode.js +275 -0
- package/dist/src/components/mcp/CapabilitiesSection.js +68 -0
- package/dist/src/components/mcp/ElicitationDialog.js +1330 -0
- package/dist/src/components/mcp/MCPAgentServerMenu.js +275 -0
- package/dist/src/components/mcp/MCPListPanel.js +671 -0
- package/dist/src/components/mcp/MCPReconnect.js +210 -0
- package/dist/src/components/mcp/MCPRemoteServerMenu.js +906 -0
- package/dist/src/components/mcp/MCPSettings.js +415 -0
- package/dist/src/components/mcp/MCPStdioServerMenu.js +276 -0
- package/dist/src/components/mcp/MCPToolDetailView.js +316 -0
- package/dist/src/components/mcp/MCPToolListView.js +169 -0
- package/dist/src/components/mcp/McpParsingWarnings.js +319 -0
- package/dist/src/components/mcp/index.js +8 -0
- package/dist/src/components/mcp/utils/reconnectHelpers.js +28 -0
- package/dist/src/components/memory/MemoryFileSelector.js +459 -0
- package/dist/src/components/memory/MemoryUpdateNotification.js +51 -0
- package/dist/src/components/messageActions.js +464 -0
- package/dist/src/components/messages/AdvisorMessage.js +202 -0
- package/dist/src/components/messages/AssistantRedactedThinkingMessage.js +34 -0
- package/dist/src/components/messages/AssistantTextMessage.js +373 -0
- package/dist/src/components/messages/AssistantThinkingMessage.js +105 -0
- package/dist/src/components/messages/AssistantToolUseMessage.js +414 -0
- package/dist/src/components/messages/AttachmentMessage.js +764 -0
- package/dist/src/components/messages/CollapsedReadSearchContent.js +651 -0
- package/dist/src/components/messages/CompactBoundaryMessage.js +27 -0
- package/dist/src/components/messages/GroupedToolUseContent.js +42 -0
- package/dist/src/components/messages/HighlightedThinkingText.js +215 -0
- package/dist/src/components/messages/HookProgressMessage.js +150 -0
- package/dist/src/components/messages/PlanApprovalMessage.js +294 -0
- package/dist/src/components/messages/RateLimitMessage.js +164 -0
- package/dist/src/components/messages/ShutdownMessage.js +180 -0
- package/dist/src/components/messages/SystemAPIErrorMessage.js +162 -0
- package/dist/src/components/messages/SystemTextMessage.js +1145 -0
- package/dist/src/components/messages/TaskAssignmentMessage.js +100 -0
- package/dist/src/components/messages/UserAgentNotificationMessage.js +89 -0
- package/dist/src/components/messages/UserBashInputMessage.js +67 -0
- package/dist/src/components/messages/UserBashOutputMessage.js +56 -0
- package/dist/src/components/messages/UserChannelMessage.js +145 -0
- package/dist/src/components/messages/UserCommandMessage.js +146 -0
- package/dist/src/components/messages/UserImageMessage.js +59 -0
- package/dist/src/components/messages/UserLocalCommandOutputMessage.js +226 -0
- package/dist/src/components/messages/UserMemoryInputMessage.js +101 -0
- package/dist/src/components/messages/UserPlanMessage.js +56 -0
- package/dist/src/components/messages/UserPromptMessage.js +54 -0
- package/dist/src/components/messages/UserResourceUpdateMessage.js +131 -0
- package/dist/src/components/messages/UserTeammateMessage.js +215 -0
- package/dist/src/components/messages/UserTextMessage.js +207 -0
- package/dist/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +46 -0
- package/dist/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +21 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +18 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +90 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +80 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +116 -0
- package/dist/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +73 -0
- package/dist/src/components/messages/UserToolResultMessage/utils.js +41 -0
- package/dist/src/components/messages/nullRenderingAttachments.js +40 -0
- package/dist/src/components/messages/teamMemCollapsed.js +160 -0
- package/dist/src/components/messages/teamMemSaved.js +9 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +696 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +263 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +384 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +228 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +611 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +218 -0
- package/dist/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +98 -0
- package/dist/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +458 -0
- package/dist/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +90 -0
- package/dist/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +567 -0
- package/dist/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +175 -0
- package/dist/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +728 -0
- package/dist/src/components/permissions/FallbackPermissionRequest.js +385 -0
- package/dist/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +205 -0
- package/dist/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +188 -0
- package/dist/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +13 -0
- package/dist/src/components/permissions/FilePermissionDialog/permissionOptions.js +159 -0
- package/dist/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +129 -0
- package/dist/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +100 -0
- package/dist/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +186 -0
- package/dist/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +110 -0
- package/dist/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +143 -0
- package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +194 -0
- package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +278 -0
- package/dist/src/components/permissions/PermissionDecisionDebugInfo.js +709 -0
- package/dist/src/components/permissions/PermissionDialog.js +90 -0
- package/dist/src/components/permissions/PermissionExplanation.js +298 -0
- package/dist/src/components/permissions/PermissionPrompt.js +327 -0
- package/dist/src/components/permissions/PermissionRequest.js +164 -0
- package/dist/src/components/permissions/PermissionRequestTitle.js +85 -0
- package/dist/src/components/permissions/PermissionRuleExplanation.js +112 -0
- package/dist/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +263 -0
- package/dist/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +70 -0
- package/dist/src/components/permissions/SandboxPermissionRequest.js +205 -0
- package/dist/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +259 -0
- package/dist/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +424 -0
- package/dist/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +299 -0
- package/dist/src/components/permissions/WorkerBadge.js +56 -0
- package/dist/src/components/permissions/WorkerPendingPermission.js +158 -0
- package/dist/src/components/permissions/hooks.js +128 -0
- package/dist/src/components/permissions/rules/AddPermissionRules.js +203 -0
- package/dist/src/components/permissions/rules/AddWorkspaceDirectory.js +437 -0
- package/dist/src/components/permissions/rules/PermissionRuleDescription.js +101 -0
- package/dist/src/components/permissions/rules/PermissionRuleInput.js +208 -0
- package/dist/src/components/permissions/rules/PermissionRuleList.js +1382 -0
- package/dist/src/components/permissions/rules/RecentDenialsTab.js +229 -0
- package/dist/src/components/permissions/rules/RemoveWorkspaceDirectory.js +123 -0
- package/dist/src/components/permissions/rules/WorkspaceTab.js +161 -0
- package/dist/src/components/permissions/shellPermissionHelpers.js +219 -0
- package/dist/src/components/permissions/useShellPermissionFeedback.js +98 -0
- package/dist/src/components/permissions/utils.js +18 -0
- package/dist/src/components/sandbox/SandboxConfigTab.js +195 -0
- package/dist/src/components/sandbox/SandboxDependenciesTab.js +265 -0
- package/dist/src/components/sandbox/SandboxDoctorSection.js +80 -0
- package/dist/src/components/sandbox/SandboxOverridesTab.js +272 -0
- package/dist/src/components/sandbox/SandboxSettings.js +374 -0
- package/dist/src/components/shell/ExpandShellOutputContext.js +25 -0
- package/dist/src/components/shell/OutputLine.js +107 -0
- package/dist/src/components/shell/ShellProgressMessage.js +189 -0
- package/dist/src/components/shell/ShellTimeDisplay.js +78 -0
- package/dist/src/components/skills/SkillsMenu.js +310 -0
- package/dist/src/components/tasks/AsyncAgentDetailDialog.js +353 -0
- package/dist/src/components/tasks/BackgroundTask.js +428 -0
- package/dist/src/components/tasks/BackgroundTaskStatus.js +522 -0
- package/dist/src/components/tasks/BackgroundTasksDialog.js +784 -0
- package/dist/src/components/tasks/DreamDetailDialog.js +353 -0
- package/dist/src/components/tasks/InProcessTeammateDetailDialog.js +393 -0
- package/dist/src/components/tasks/RemoteSessionDetailDialog.js +1188 -0
- package/dist/src/components/tasks/RemoteSessionProgress.js +310 -0
- package/dist/src/components/tasks/ShellDetailDialog.js +511 -0
- package/dist/src/components/tasks/ShellProgress.js +93 -0
- package/dist/src/components/tasks/renderToolActivity.js +34 -0
- package/dist/src/components/tasks/taskStatusUtils.js +77 -0
- package/dist/src/components/teams/TeamStatus.js +95 -0
- package/dist/src/components/teams/TeamsDialog.js +734 -0
- package/dist/src/components/ui/OrderedList.js +74 -0
- package/dist/src/components/ui/OrderedListItem.js +53 -0
- package/dist/src/components/ui/TreeSelect.js +307 -0
- package/dist/src/components/wizard/WizardDialogLayout.js +71 -0
- package/dist/src/components/wizard/WizardNavigationFooter.js +36 -0
- package/dist/src/components/wizard/WizardProvider.js +211 -0
- package/dist/src/components/wizard/index.js +4 -0
- package/dist/src/components/wizard/useWizard.js +9 -0
- package/dist/src/constants/apiLimits.js +11 -0
- package/dist/src/constants/betas.js +28 -0
- package/dist/src/constants/common.js +16 -0
- package/dist/src/constants/cyberRiskInstruction.js +1 -0
- package/dist/src/constants/errorIds.js +1 -0
- package/dist/src/constants/figures.js +31 -0
- package/dist/src/constants/files.js +115 -0
- package/dist/src/constants/github-app.js +139 -0
- package/dist/src/constants/keys.js +4 -0
- package/dist/src/constants/messages.js +1 -0
- package/dist/src/constants/oauth.js +141 -0
- package/dist/src/constants/outputStyles.js +155 -0
- package/dist/src/constants/product.js +25 -0
- package/dist/src/constants/prompts.js +544 -0
- package/dist/src/constants/spinnerVerbs.js +201 -0
- package/dist/src/constants/system.js +46 -0
- package/dist/src/constants/systemPromptSections.js +27 -0
- package/dist/src/constants/toolLimits.js +6 -0
- package/dist/src/constants/tools.js +75 -0
- package/dist/src/constants/turnCompletionVerbs.js +10 -0
- package/dist/src/constants/xml.js +54 -0
- package/dist/src/context/QueuedMessageContext.js +57 -0
- package/dist/src/context/fpsMetrics.js +26 -0
- package/dist/src/context/mailbox.js +37 -0
- package/dist/src/context/modalContext.js +26 -0
- package/dist/src/context/notifications.js +176 -0
- package/dist/src/context/overlayContext.js +92 -0
- package/dist/src/context/promptOverlayContext.js +99 -0
- package/dist/src/context/stats.js +203 -0
- package/dist/src/context/voice.js +62 -0
- package/dist/src/context.js +119 -0
- package/dist/src/coordinator/coordinatorMode.js +323 -0
- package/dist/src/cost-tracker.js +234 -0
- package/dist/src/costHook.js +19 -0
- package/dist/src/dialogLaunchers.js +92 -0
- package/dist/src/entrypoints/agentSdkTypes.js +51 -0
- package/dist/src/entrypoints/cli.js +92 -0
- package/dist/src/entrypoints/init.js +199 -0
- package/dist/src/entrypoints/mcp.js +132 -0
- package/dist/src/entrypoints/npm-bin.js +6 -0
- package/dist/src/entrypoints/sandboxTypes.js +34 -0
- package/dist/src/entrypoints/sdk/controlSchemas.js +347 -0
- package/dist/src/entrypoints/sdk/coreSchemas.js +1019 -0
- package/dist/src/entrypoints/sdk/coreTypes.generated.js +1 -0
- package/dist/src/entrypoints/sdk/coreTypes.js +38 -0
- package/dist/src/entrypoints/sdk/runtimeTypes.js +1 -0
- package/dist/src/entrypoints/sdk/settingsTypes.generated.js +1 -0
- package/dist/src/entrypoints/sdk/toolTypes.js +1 -0
- package/dist/src/history.js +297 -0
- package/dist/src/hooks/fileSuggestions.js +460 -0
- package/dist/src/hooks/notifs/useAutoModeUnavailableNotification.js +39 -0
- package/dist/src/hooks/notifs/useCanSwitchToExistingSubscription.js +64 -0
- package/dist/src/hooks/notifs/useDeprecationWarningNotification.js +43 -0
- package/dist/src/hooks/notifs/useFastModeNotification.js +161 -0
- package/dist/src/hooks/notifs/useIDEStatusIndicator.js +187 -0
- package/dist/src/hooks/notifs/useInstallMessages.js +25 -0
- package/dist/src/hooks/notifs/useLspInitializationNotification.js +147 -0
- package/dist/src/hooks/notifs/useMcpConnectivityStatus.js +154 -0
- package/dist/src/hooks/notifs/useModelMigrationNotifications.js +45 -0
- package/dist/src/hooks/notifs/useNpmDeprecationNotification.js +24 -0
- package/dist/src/hooks/notifs/usePluginAutoupdateNotification.js +93 -0
- package/dist/src/hooks/notifs/usePluginInstallationStatus.js +143 -0
- package/dist/src/hooks/notifs/useRateLimitWarningNotification.js +118 -0
- package/dist/src/hooks/notifs/useSettingsErrors.js +67 -0
- package/dist/src/hooks/notifs/useStartupNotification.js +24 -0
- package/dist/src/hooks/notifs/useTeammateShutdownNotification.js +61 -0
- package/dist/src/hooks/renderPlaceholder.js +27 -0
- package/dist/src/hooks/toolPermission/PermissionContext.js +186 -0
- package/dist/src/hooks/toolPermission/handlers/coordinatorHandler.js +22 -0
- package/dist/src/hooks/toolPermission/handlers/interactiveHandler.js +194 -0
- package/dist/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +79 -0
- package/dist/src/hooks/toolPermission/permissionLogging.js +114 -0
- package/dist/src/hooks/unifiedSuggestions.js +115 -0
- package/dist/src/hooks/useAfterFirstRender.js +12 -0
- package/dist/src/hooks/useApiKeyVerification.js +58 -0
- package/dist/src/hooks/useArrowKeyHistory.js +176 -0
- package/dist/src/hooks/useAssistantHistory.js +150 -0
- package/dist/src/hooks/useAwaySummary.js +95 -0
- package/dist/src/hooks/useBackgroundTaskNavigation.js +163 -0
- package/dist/src/hooks/useBlink.js +10 -0
- package/dist/src/hooks/useCanUseTool.js +144 -0
- package/dist/src/hooks/useCancelRequest.js +165 -0
- package/dist/src/hooks/useChromeExtensionNotification.js +55 -0
- package/dist/src/hooks/useClaudeCodeHintRecommendation.js +113 -0
- package/dist/src/hooks/useClipboardImageHint.js +45 -0
- package/dist/src/hooks/useCommandKeybindings.js +81 -0
- package/dist/src/hooks/useCommandQueue.js +8 -0
- package/dist/src/hooks/useCopyOnSelect.js +44 -0
- package/dist/src/hooks/useDeferredHookMessages.js +35 -0
- package/dist/src/hooks/useDiffData.js +62 -0
- package/dist/src/hooks/useDiffInIDE.js +197 -0
- package/dist/src/hooks/useDirectConnect.js +154 -0
- package/dist/src/hooks/useDoublePress.js +36 -0
- package/dist/src/hooks/useDynamicConfig.js +10 -0
- package/dist/src/hooks/useElapsedTime.js +12 -0
- package/dist/src/hooks/useExitOnCtrlCD.js +27 -0
- package/dist/src/hooks/useExitOnCtrlCDWithKeybindings.js +5 -0
- package/dist/src/hooks/useFileHistorySnapshotInit.js +17 -0
- package/dist/src/hooks/useGlobalKeybindings.js +132 -0
- package/dist/src/hooks/useHistorySearch.js +219 -0
- package/dist/src/hooks/useIDEIntegration.js +60 -0
- package/dist/src/hooks/useIdeAtMentioned.js +42 -0
- package/dist/src/hooks/useIdeConnectionStatus.js +18 -0
- package/dist/src/hooks/useIdeLogging.js +26 -0
- package/dist/src/hooks/useIdeSelection.js +78 -0
- package/dist/src/hooks/useInboxPoller.js +626 -0
- package/dist/src/hooks/useInputBuffer.js +69 -0
- package/dist/src/hooks/useIssueFlagBanner.js +101 -0
- package/dist/src/hooks/useLogMessages.js +47 -0
- package/dist/src/hooks/useLspPluginRecommendation.js +163 -0
- package/dist/src/hooks/useMailboxBridge.js +15 -0
- package/dist/src/hooks/useMainLoopModel.js +15 -0
- package/dist/src/hooks/useManagePlugins.js +195 -0
- package/dist/src/hooks/useMemoryUsage.js +17 -0
- package/dist/src/hooks/useMergedClients.js +11 -0
- package/dist/src/hooks/useMergedCommands.js +10 -0
- package/dist/src/hooks/useMergedTools.js +18 -0
- package/dist/src/hooks/useMinDisplayTime.js +19 -0
- package/dist/src/hooks/useNotifyAfterTimeout.js +34 -0
- package/dist/src/hooks/useOfficialMarketplaceNotification.js +50 -0
- package/dist/src/hooks/usePasteHandler.js +129 -0
- package/dist/src/hooks/usePluginRecommendationBase.js +98 -0
- package/dist/src/hooks/usePrStatus.js +77 -0
- package/dist/src/hooks/usePromptSuggestion.js +124 -0
- package/dist/src/hooks/usePromptsFromClaudeInChrome.js +60 -0
- package/dist/src/hooks/useQueueProcessor.js +29 -0
- package/dist/src/hooks/useRemoteSession.js +313 -0
- package/dist/src/hooks/useReplBridge.js +59 -0
- package/dist/src/hooks/useSSHSession.js +161 -0
- package/dist/src/hooks/useScheduledTasks.js +68 -0
- package/dist/src/hooks/useSearchInput.js +285 -0
- package/dist/src/hooks/useSessionBackgrounding.js +120 -0
- package/dist/src/hooks/useSettings.js +4 -0
- package/dist/src/hooks/useSettingsChange.js +10 -0
- package/dist/src/hooks/useSkillImprovementSurvey.js +61 -0
- package/dist/src/hooks/useSkillsChange.js +39 -0
- package/dist/src/hooks/useSwarmInitialization.js +39 -0
- package/dist/src/hooks/useSwarmPermissionPoller.js +141 -0
- package/dist/src/hooks/useTaskListWatcher.js +124 -0
- package/dist/src/hooks/useTasksV2.js +161 -0
- package/dist/src/hooks/useTeammateViewAutoExit.js +35 -0
- package/dist/src/hooks/useTeleportResume.js +75 -0
- package/dist/src/hooks/useTerminalSize.js +11 -0
- package/dist/src/hooks/useTextInput.js +353 -0
- package/dist/src/hooks/useTimeout.js +10 -0
- package/dist/src/hooks/useTurnDiffs.js +131 -0
- package/dist/src/hooks/useTypeahead.js +993 -0
- package/dist/src/hooks/useUpdateNotification.js +21 -0
- package/dist/src/hooks/useVimInput.js +210 -0
- package/dist/src/hooks/useVirtualScroll.js +282 -0
- package/dist/src/hooks/useVoice.js +675 -0
- package/dist/src/hooks/useVoiceEnabled.js +12 -0
- package/dist/src/hooks/useVoiceIntegration.js +391 -0
- package/dist/src/ink/Ansi.js +290 -0
- package/dist/src/ink/bidi.js +72 -0
- package/dist/src/ink/clearTerminal.js +42 -0
- package/dist/src/ink/colorize.js +119 -0
- package/dist/src/ink/components/AlternateScreen.js +60 -0
- package/dist/src/ink/components/App.js +375 -0
- package/dist/src/ink/components/AppContext.js +6 -0
- package/dist/src/ink/components/Box.js +181 -0
- package/dist/src/ink/components/Button.js +167 -0
- package/dist/src/ink/components/ClockContext.js +100 -0
- package/dist/src/ink/components/CursorDeclarationContext.js +3 -0
- package/dist/src/ink/components/ErrorOverview.js +152 -0
- package/dist/src/ink/components/Link.js +42 -0
- package/dist/src/ink/components/Newline.js +29 -0
- package/dist/src/ink/components/NoSelect.js +40 -0
- package/dist/src/ink/components/RawAnsi.js +36 -0
- package/dist/src/ink/components/ScrollBox.js +139 -0
- package/dist/src/ink/components/Spacer.js +16 -0
- package/dist/src/ink/components/StdinContext.js +12 -0
- package/dist/src/ink/components/TerminalFocusContext.js +43 -0
- package/dist/src/ink/components/TerminalSizeContext.js +2 -0
- package/dist/src/ink/components/Text.js +196 -0
- package/dist/src/ink/constants.js +1 -0
- package/dist/src/ink/dom.js +230 -0
- package/dist/src/ink/events/click-event.js +15 -0
- package/dist/src/ink/events/dispatcher.js +126 -0
- package/dist/src/ink/events/emitter.js +26 -0
- package/dist/src/ink/events/event-handlers.js +22 -0
- package/dist/src/ink/events/event.js +9 -0
- package/dist/src/ink/events/focus-event.js +9 -0
- package/dist/src/ink/events/input-event.js +83 -0
- package/dist/src/ink/events/keyboard-event.js +31 -0
- package/dist/src/ink/events/terminal-event.js +60 -0
- package/dist/src/ink/events/terminal-focus-event.js +9 -0
- package/dist/src/ink/focus.js +127 -0
- package/dist/src/ink/frame.js +22 -0
- package/dist/src/ink/get-max-width.js +5 -0
- package/dist/src/ink/hit-test.js +76 -0
- package/dist/src/ink/hooks/use-animation-frame.js +23 -0
- package/dist/src/ink/hooks/use-app.js +4 -0
- package/dist/src/ink/hooks/use-declared-cursor.js +27 -0
- package/dist/src/ink/hooks/use-input.js +31 -0
- package/dist/src/ink/hooks/use-interval.js +38 -0
- package/dist/src/ink/hooks/use-search-highlight.js +21 -0
- package/dist/src/ink/hooks/use-selection.js +47 -0
- package/dist/src/ink/hooks/use-stdin.js +4 -0
- package/dist/src/ink/hooks/use-tab-status.js +48 -0
- package/dist/src/ink/hooks/use-terminal-focus.js +6 -0
- package/dist/src/ink/hooks/use-terminal-title.js +17 -0
- package/dist/src/ink/hooks/use-terminal-viewport.js +40 -0
- package/dist/src/ink/ink.js +978 -0
- package/dist/src/ink/instances.js +2 -0
- package/dist/src/ink/layout/engine.js +4 -0
- package/dist/src/ink/layout/geometry.js +55 -0
- package/dist/src/ink/layout/node.js +60 -0
- package/dist/src/ink/layout/yoga.js +232 -0
- package/dist/src/ink/line-width-cache.js +14 -0
- package/dist/src/ink/log-update.js +408 -0
- package/dist/src/ink/measure-element.js +5 -0
- package/dist/src/ink/measure-text.js +30 -0
- package/dist/src/ink/node-cache.js +19 -0
- package/dist/src/ink/optimizer.js +52 -0
- package/dist/src/ink/output.js +399 -0
- package/dist/src/ink/parse-keypress.js +525 -0
- package/dist/src/ink/reconciler.js +359 -0
- package/dist/src/ink/render-border.js +110 -0
- package/dist/src/ink/render-node-to-output.js +710 -0
- package/dist/src/ink/render-to-screen.js +124 -0
- package/dist/src/ink/renderer.js +73 -0
- package/dist/src/ink/root.js +73 -0
- package/dist/src/ink/screen.js +823 -0
- package/dist/src/ink/searchHighlight.js +48 -0
- package/dist/src/ink/selection.js +507 -0
- package/dist/src/ink/squash-text-nodes.js +40 -0
- package/dist/src/ink/stringWidth.js +134 -0
- package/dist/src/ink/styles.js +279 -0
- package/dist/src/ink/supports-hyperlinks.js +29 -0
- package/dist/src/ink/tabstops.js +35 -0
- package/dist/src/ink/terminal-focus-state.js +33 -0
- package/dist/src/ink/terminal-querier.js +89 -0
- package/dist/src/ink/terminal.js +128 -0
- package/dist/src/ink/termio/ansi.js +53 -0
- package/dist/src/ink/termio/csi.js +158 -0
- package/dist/src/ink/termio/dec.js +31 -0
- package/dist/src/ink/termio/esc.js +36 -0
- package/dist/src/ink/termio/osc.js +275 -0
- package/dist/src/ink/termio/parser.js +293 -0
- package/dist/src/ink/termio/sgr.js +264 -0
- package/dist/src/ink/termio/tokenize.js +176 -0
- package/dist/src/ink/termio/types.js +33 -0
- package/dist/src/ink/termio.js +2 -0
- package/dist/src/ink/useTerminalNotification.js +61 -0
- package/dist/src/ink/warn.js +10 -0
- package/dist/src/ink/widest-line.js +15 -0
- package/dist/src/ink/wrap-text.js +50 -0
- package/dist/src/ink/wrapAnsi.js +5 -0
- package/dist/src/ink.js +55 -0
- package/dist/src/interactiveHelpers.js +231 -0
- package/dist/src/keybindings/KeybindingContext.js +170 -0
- package/dist/src/keybindings/KeybindingProviderSetup.js +225 -0
- package/dist/src/keybindings/defaultBindings.js +228 -0
- package/dist/src/keybindings/loadUserBindings.js +276 -0
- package/dist/src/keybindings/match.js +73 -0
- package/dist/src/keybindings/parser.js +152 -0
- package/dist/src/keybindings/reservedShortcuts.js +82 -0
- package/dist/src/keybindings/resolver.js +116 -0
- package/dist/src/keybindings/schema.js +143 -0
- package/dist/src/keybindings/shortcutFormat.js +24 -0
- package/dist/src/keybindings/template.js +28 -0
- package/dist/src/keybindings/useKeybinding.js +100 -0
- package/dist/src/keybindings/useShortcutDisplay.js +24 -0
- package/dist/src/keybindings/validate.js +313 -0
- package/dist/src/localRecoveryCli.js +256 -0
- package/dist/src/main.js +2489 -0
- package/dist/src/memdir/findRelevantMemories.js +76 -0
- package/dist/src/memdir/memdir.js +264 -0
- package/dist/src/memdir/memoryAge.js +24 -0
- package/dist/src/memdir/memoryScan.js +36 -0
- package/dist/src/memdir/memoryTypes.js +190 -0
- package/dist/src/memdir/paths.js +106 -0
- package/dist/src/memdir/teamMemPaths.js +133 -0
- package/dist/src/memdir/teamMemPrompts.js +87 -0
- package/dist/src/migrations/migrateAutoUpdatesToSettings.js +41 -0
- package/dist/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +29 -0
- package/dist/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +70 -0
- package/dist/src/migrations/migrateFennecToOpus.js +27 -0
- package/dist/src/migrations/migrateLegacyOpusToCurrent.js +30 -0
- package/dist/src/migrations/migrateOpusToOpus1m.js +23 -0
- package/dist/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +13 -0
- package/dist/src/migrations/migrateSonnet1mToSonnet45.js +29 -0
- package/dist/src/migrations/migrateSonnet45ToSonnet46.js +41 -0
- package/dist/src/migrations/resetAutoModeOptInForDefaultOffer.js +11 -0
- package/dist/src/migrations/resetProToOpusDefault.js +42 -0
- package/dist/src/moreright/useMoreRight.js +7 -0
- package/dist/src/native-ts/color-diff/index.js +729 -0
- package/dist/src/native-ts/file-index/index.js +246 -0
- package/dist/src/native-ts/yoga-layout/enums.js +96 -0
- package/dist/src/native-ts/yoga-layout/index.js +1638 -0
- package/dist/src/outputStyles/loadOutputStylesDir.js +47 -0
- package/dist/src/plugins/builtinPlugins.js +86 -0
- package/dist/src/plugins/bundled/index.js +1 -0
- package/dist/src/projectOnboardingState.js +56 -0
- package/dist/src/query/config.js +14 -0
- package/dist/src/query/deps.js +12 -0
- package/dist/src/query/stopHooks.js +251 -0
- package/dist/src/query/tokenBudget.js +47 -0
- package/dist/src/query.js +813 -0
- package/dist/src/remote/RemoteSessionManager.js +144 -0
- package/dist/src/remote/SessionsWebSocket.js +231 -0
- package/dist/src/remote/remotePermissionBridge.js +57 -0
- package/dist/src/remote/sdkMessageAdapter.js +161 -0
- package/dist/src/replLauncher.js +15 -0
- package/dist/src/schemas/hooks.js +71 -0
- package/dist/src/screens/Doctor.js +988 -0
- package/dist/src/screens/REPL.js +3588 -0
- package/dist/src/screens/ResumeConversation.js +396 -0
- package/dist/src/server/createDirectConnectSession.js +55 -0
- package/dist/src/server/directConnectManager.js +131 -0
- package/dist/src/server/types.js +7 -0
- package/dist/src/services/AgentSummary/agentSummary.js +114 -0
- package/dist/src/services/MagicDocs/magicDocs.js +151 -0
- package/dist/src/services/MagicDocs/prompts.js +85 -0
- package/dist/src/services/PromptSuggestion/promptSuggestion.js +350 -0
- package/dist/src/services/PromptSuggestion/speculation.js +590 -0
- package/dist/src/services/SessionMemory/prompts.js +220 -0
- package/dist/src/services/SessionMemory/sessionMemory.js +277 -0
- package/dist/src/services/SessionMemory/sessionMemoryUtils.js +94 -0
- package/dist/src/services/analytics/config.js +8 -0
- package/dist/src/services/analytics/datadog.js +217 -0
- package/dist/src/services/analytics/firstPartyEventLogger.js +223 -0
- package/dist/src/services/analytics/firstPartyEventLoggingExporter.js +500 -0
- package/dist/src/services/analytics/growthbook.js +597 -0
- package/dist/src/services/analytics/index.js +56 -0
- package/dist/src/services/analytics/metadata.js +507 -0
- package/dist/src/services/analytics/sink.js +44 -0
- package/dist/src/services/analytics/sinkKillswitch.js +6 -0
- package/dist/src/services/api/adminRequests.js +40 -0
- package/dist/src/services/api/bootstrap.js +104 -0
- package/dist/src/services/api/claude.js +1851 -0
- package/dist/src/services/api/client.js +209 -0
- package/dist/src/services/api/dumpPrompts.js +145 -0
- package/dist/src/services/api/emptyUsage.js +15 -0
- package/dist/src/services/api/errorUtils.js +137 -0
- package/dist/src/services/api/errors.js +641 -0
- package/dist/src/services/api/filesApi.js +409 -0
- package/dist/src/services/api/firstTokenDate.js +42 -0
- package/dist/src/services/api/grove.js +222 -0
- package/dist/src/services/api/logging.js +478 -0
- package/dist/src/services/api/metricsOptOut.js +87 -0
- package/dist/src/services/api/overageCreditGrant.js +83 -0
- package/dist/src/services/api/promptCacheBreakDetection.js +411 -0
- package/dist/src/services/api/referral.js +178 -0
- package/dist/src/services/api/sessionIngress.js +264 -0
- package/dist/src/services/api/ultrareviewQuota.js +23 -0
- package/dist/src/services/api/usage.js +34 -0
- package/dist/src/services/api/withRetry.js +454 -0
- package/dist/src/services/autoDream/autoDream.js +197 -0
- package/dist/src/services/autoDream/config.js +9 -0
- package/dist/src/services/autoDream/consolidationLock.js +76 -0
- package/dist/src/services/autoDream/consolidationPrompt.js +61 -0
- package/dist/src/services/awaySummary.js +58 -0
- package/dist/src/services/claudeAiLimits.js +269 -0
- package/dist/src/services/claudeAiLimitsHook.js +18 -0
- package/dist/src/services/compact/apiMicrocompact.js +82 -0
- package/dist/src/services/compact/autoCompact.js +151 -0
- package/dist/src/services/compact/compact.js +957 -0
- package/dist/src/services/compact/compactWarningHook.js +5 -0
- package/dist/src/services/compact/compactWarningState.js +8 -0
- package/dist/src/services/compact/grouping.js +20 -0
- package/dist/src/services/compact/microCompact.js +265 -0
- package/dist/src/services/compact/postCompactCleanup.js +23 -0
- package/dist/src/services/compact/prompt.js +303 -0
- package/dist/src/services/compact/sessionMemoryCompact.js +316 -0
- package/dist/src/services/compact/timeBasedMCConfig.js +9 -0
- package/dist/src/services/diagnosticTracking.js +195 -0
- package/dist/src/services/extractMemories/extractMemories.js +309 -0
- package/dist/src/services/extractMemories/prompts.js +113 -0
- package/dist/src/services/internalLogging.js +53 -0
- package/dist/src/services/lsp/LSPClient.js +252 -0
- package/dist/src/services/lsp/LSPDiagnosticRegistry.js +179 -0
- package/dist/src/services/lsp/LSPServerInstance.js +245 -0
- package/dist/src/services/lsp/LSPServerManager.js +217 -0
- package/dist/src/services/lsp/config.js +38 -0
- package/dist/src/services/lsp/manager.js +132 -0
- package/dist/src/services/lsp/passiveFeedback.js +150 -0
- package/dist/src/services/mcp/InProcessTransport.js +37 -0
- package/dist/src/services/mcp/MCPConnectionManager.js +56 -0
- package/dist/src/services/mcp/SdkControlTransport.js +54 -0
- package/dist/src/services/mcp/auth.js +1419 -0
- package/dist/src/services/mcp/channelAllowlist.js +24 -0
- package/dist/src/services/mcp/channelNotification.js +118 -0
- package/dist/src/services/mcp/channelPermissions.js +89 -0
- package/dist/src/services/mcp/claudeai.js +95 -0
- package/dist/src/services/mcp/client.js +1896 -0
- package/dist/src/services/mcp/config.js +942 -0
- package/dist/src/services/mcp/elicitationHandler.js +171 -0
- package/dist/src/services/mcp/envExpansion.js +19 -0
- package/dist/src/services/mcp/headersHelper.js +64 -0
- package/dist/src/services/mcp/mcpStringUtils.js +33 -0
- package/dist/src/services/mcp/normalization.js +8 -0
- package/dist/src/services/mcp/oauthPort.js +47 -0
- package/dist/src/services/mcp/officialRegistry.js +42 -0
- package/dist/src/services/mcp/types.js +82 -0
- package/dist/src/services/mcp/useManageMCPConnections.js +536 -0
- package/dist/src/services/mcp/utils.js +284 -0
- package/dist/src/services/mcp/vscodeSdkMcp.js +55 -0
- package/dist/src/services/mcp/xaa.js +237 -0
- package/dist/src/services/mcp/xaaIdpLogin.js +286 -0
- package/dist/src/services/mcpServerApproval.js +39 -0
- package/dist/src/services/mockRateLimits.js +548 -0
- package/dist/src/services/notifier.js +112 -0
- package/dist/src/services/oauth/auth-code-listener.js +129 -0
- package/dist/src/services/oauth/client.js +341 -0
- package/dist/src/services/oauth/crypto.js +15 -0
- package/dist/src/services/oauth/getOauthProfile.js +44 -0
- package/dist/src/services/oauth/index.js +98 -0
- package/dist/src/services/plugins/PluginInstallationManager.js +111 -0
- package/dist/src/services/plugins/pluginCliCommands.js +173 -0
- package/dist/src/services/plugins/pluginOperations.js +597 -0
- package/dist/src/services/policyLimits/index.js +418 -0
- package/dist/src/services/policyLimits/types.js +5 -0
- package/dist/src/services/preventSleep.js +95 -0
- package/dist/src/services/rateLimitMessages.js +194 -0
- package/dist/src/services/rateLimitMocking.js +58 -0
- package/dist/src/services/remoteManagedSettings/index.js +368 -0
- package/dist/src/services/remoteManagedSettings/securityCheck.js +52 -0
- package/dist/src/services/remoteManagedSettings/syncCache.js +50 -0
- package/dist/src/services/remoteManagedSettings/syncCacheState.js +48 -0
- package/dist/src/services/remoteManagedSettings/types.js +7 -0
- package/dist/src/services/settingsSync/index.js +368 -0
- package/dist/src/services/settingsSync/types.js +18 -0
- package/dist/src/services/teamMemorySync/index.js +731 -0
- package/dist/src/services/teamMemorySync/secretScanner.js +210 -0
- package/dist/src/services/teamMemorySync/teamMemSecretGuard.js +4 -0
- package/dist/src/services/teamMemorySync/types.js +23 -0
- package/dist/src/services/teamMemorySync/watcher.js +197 -0
- package/dist/src/services/tips/tipHistory.js +17 -0
- package/dist/src/services/tips/tipRegistry.js +578 -0
- package/dist/src/services/tips/tipScheduler.js +37 -0
- package/dist/src/services/tokenEstimation.js +283 -0
- package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +75 -0
- package/dist/src/services/tools/StreamingToolExecutor.js +311 -0
- package/dist/src/services/tools/toolExecution.js +1009 -0
- package/dist/src/services/tools/toolHooks.js +384 -0
- package/dist/src/services/tools/toolOrchestration.js +96 -0
- package/dist/src/services/vcr.js +233 -0
- package/dist/src/services/voice.js +315 -0
- package/dist/src/services/voiceKeyterms.js +57 -0
- package/dist/src/services/voiceStreamSTT.js +265 -0
- package/dist/src/setup.js +235 -0
- package/dist/src/skills/bundled/batch.js +114 -0
- package/dist/src/skills/bundled/claudeApi.js +149 -0
- package/dist/src/skills/bundled/claudeApiContent.js +63 -0
- package/dist/src/skills/bundled/claudeInChrome.js +31 -0
- package/dist/src/skills/bundled/debug.js +89 -0
- package/dist/src/skills/bundled/index.js +22 -0
- package/dist/src/skills/bundled/keybindings.js +303 -0
- package/dist/src/skills/bundled/loop.js +86 -0
- package/dist/src/skills/bundled/loremIpsum.js +257 -0
- package/dist/src/skills/bundled/remember.js +78 -0
- package/dist/src/skills/bundled/scheduleRemoteAgents.js +360 -0
- package/dist/src/skills/bundled/simplify.js +70 -0
- package/dist/src/skills/bundled/skillify.js +179 -0
- package/dist/src/skills/bundled/stuck.js +76 -0
- package/dist/src/skills/bundled/updateConfig.js +471 -0
- package/dist/src/skills/bundled/verify/SKILL.md.js +1 -0
- package/dist/src/skills/bundled/verify/examples/cli.md.js +1 -0
- package/dist/src/skills/bundled/verify/examples/server.md.js +1 -0
- package/dist/src/skills/bundled/verify.js +27 -0
- package/dist/src/skills/bundled/verifyContent.js +8 -0
- package/dist/src/skills/bundledSkills.js +114 -0
- package/dist/src/skills/loadSkillsDir.js +583 -0
- package/dist/src/skills/mcpSkillBuilders.js +10 -0
- package/dist/src/state/AppState.js +153 -0
- package/dist/src/state/AppStateStore.js +115 -0
- package/dist/src/state/onChangeAppState.js +94 -0
- package/dist/src/state/selectors.js +29 -0
- package/dist/src/state/store.js +21 -0
- package/dist/src/state/teammateViewHelpers.js +89 -0
- package/dist/src/tasks/DreamTask/DreamTask.js +79 -0
- package/dist/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +70 -0
- package/dist/src/tasks/InProcessTeammateTask/types.js +15 -0
- package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +444 -0
- package/dist/src/tasks/LocalMainSessionTask.js +262 -0
- package/dist/src/tasks/LocalShellTask/LocalShellTask.js +419 -0
- package/dist/src/tasks/LocalShellTask/guards.js +3 -0
- package/dist/src/tasks/LocalShellTask/killShellTasks.js +44 -0
- package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +550 -0
- package/dist/src/tasks/pillLabel.js +53 -0
- package/dist/src/tasks/stopTask.js +53 -0
- package/dist/src/tasks/types.js +9 -0
- package/dist/src/tasks.js +22 -0
- package/dist/src/tools/AgentTool/AgentTool.js +919 -0
- package/dist/src/tools/AgentTool/UI.js +912 -0
- package/dist/src/tools/AgentTool/agentColorManager.js +42 -0
- package/dist/src/tools/AgentTool/agentDisplay.js +45 -0
- package/dist/src/tools/AgentTool/agentMemory.js +85 -0
- package/dist/src/tools/AgentTool/agentMemorySnapshot.js +109 -0
- package/dist/src/tools/AgentTool/agentToolUtils.js +387 -0
- package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +159 -0
- package/dist/src/tools/AgentTool/built-in/exploreAgent.js +66 -0
- package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +26 -0
- package/dist/src/tools/AgentTool/built-in/planAgent.js +81 -0
- package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +140 -0
- package/dist/src/tools/AgentTool/built-in/verificationAgent.js +146 -0
- package/dist/src/tools/AgentTool/builtInAgents.js +32 -0
- package/dist/src/tools/AgentTool/constants.js +7 -0
- package/dist/src/tools/AgentTool/forkSubagent.js +108 -0
- package/dist/src/tools/AgentTool/loadAgentsDir.js +409 -0
- package/dist/src/tools/AgentTool/prompt.js +194 -0
- package/dist/src/tools/AgentTool/resumeAgent.js +169 -0
- package/dist/src/tools/AgentTool/runAgent.js +457 -0
- package/dist/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +282 -0
- package/dist/src/tools/AskUserQuestionTool/prompt.js +38 -0
- package/dist/src/tools/BashTool/BashTool.js +867 -0
- package/dist/src/tools/BashTool/BashToolResultMessage.js +208 -0
- package/dist/src/tools/BashTool/UI.js +189 -0
- package/dist/src/tools/BashTool/bashCommandHelpers.js +145 -0
- package/dist/src/tools/BashTool/bashPermissions.js +1193 -0
- package/dist/src/tools/BashTool/bashSecurity.js +1464 -0
- package/dist/src/tools/BashTool/commandSemantics.js +70 -0
- package/dist/src/tools/BashTool/commentLabel.js +8 -0
- package/dist/src/tools/BashTool/destructiveCommandWarning.js +74 -0
- package/dist/src/tools/BashTool/modeValidation.js +65 -0
- package/dist/src/tools/BashTool/pathValidation.js +771 -0
- package/dist/src/tools/BashTool/prompt.js +307 -0
- package/dist/src/tools/BashTool/readOnlyValidation.js +1312 -0
- package/dist/src/tools/BashTool/sedEditParser.js +179 -0
- package/dist/src/tools/BashTool/sedValidation.js +379 -0
- package/dist/src/tools/BashTool/shouldUseSandbox.js +102 -0
- package/dist/src/tools/BashTool/toolName.js +1 -0
- package/dist/src/tools/BashTool/utils.js +145 -0
- package/dist/src/tools/BriefTool/BriefTool.js +106 -0
- package/dist/src/tools/BriefTool/UI.js +158 -0
- package/dist/src/tools/BriefTool/attachments.js +54 -0
- package/dist/src/tools/BriefTool/prompt.js +19 -0
- package/dist/src/tools/BriefTool/upload.js +37 -0
- package/dist/src/tools/ConfigTool/ConfigTool.js +304 -0
- package/dist/src/tools/ConfigTool/UI.js +76 -0
- package/dist/src/tools/ConfigTool/constants.js +1 -0
- package/dist/src/tools/ConfigTool/prompt.js +76 -0
- package/dist/src/tools/ConfigTool/supportedSettings.js +141 -0
- package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +91 -0
- package/dist/src/tools/EnterPlanModeTool/UI.js +49 -0
- package/dist/src/tools/EnterPlanModeTool/constants.js +1 -0
- package/dist/src/tools/EnterPlanModeTool/prompt.js +154 -0
- package/dist/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +97 -0
- package/dist/src/tools/EnterWorktreeTool/UI.js +25 -0
- package/dist/src/tools/EnterWorktreeTool/constants.js +1 -0
- package/dist/src/tools/EnterWorktreeTool/prompt.js +30 -0
- package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +287 -0
- package/dist/src/tools/ExitPlanModeTool/UI.js +128 -0
- package/dist/src/tools/ExitPlanModeTool/constants.js +2 -0
- package/dist/src/tools/ExitPlanModeTool/prompt.js +25 -0
- package/dist/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +217 -0
- package/dist/src/tools/ExitWorktreeTool/UI.js +36 -0
- package/dist/src/tools/ExitWorktreeTool/constants.js +1 -0
- package/dist/src/tools/ExitWorktreeTool/prompt.js +32 -0
- package/dist/src/tools/FileEditTool/FileEditTool.js +447 -0
- package/dist/src/tools/FileEditTool/UI.js +289 -0
- package/dist/src/tools/FileEditTool/constants.js +4 -0
- package/dist/src/tools/FileEditTool/prompt.js +22 -0
- package/dist/src/tools/FileEditTool/types.js +37 -0
- package/dist/src/tools/FileEditTool/utils.js +411 -0
- package/dist/src/tools/FileReadTool/FileReadTool.js +759 -0
- package/dist/src/tools/FileReadTool/UI.js +232 -0
- package/dist/src/tools/FileReadTool/imageProcessor.js +34 -0
- package/dist/src/tools/FileReadTool/limits.js +28 -0
- package/dist/src/tools/FileReadTool/prompt.js +25 -0
- package/dist/src/tools/FileWriteTool/FileWriteTool.js +300 -0
- package/dist/src/tools/FileWriteTool/UI.js +460 -0
- package/dist/src/tools/FileWriteTool/prompt.js +16 -0
- package/dist/src/tools/GlobTool/GlobTool.js +155 -0
- package/dist/src/tools/GlobTool/UI.js +58 -0
- package/dist/src/tools/GlobTool/prompt.js +6 -0
- package/dist/src/tools/GrepTool/GrepTool.js +390 -0
- package/dist/src/tools/GrepTool/UI.js +254 -0
- package/dist/src/tools/GrepTool/prompt.js +16 -0
- package/dist/src/tools/LSPTool/LSPTool.js +541 -0
- package/dist/src/tools/LSPTool/UI.js +275 -0
- package/dist/src/tools/LSPTool/formatters.js +353 -0
- package/dist/src/tools/LSPTool/prompt.js +20 -0
- package/dist/src/tools/LSPTool/schemas.js +82 -0
- package/dist/src/tools/LSPTool/symbolContext.js +43 -0
- package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +91 -0
- package/dist/src/tools/ListMcpResourcesTool/UI.js +26 -0
- package/dist/src/tools/ListMcpResourcesTool/prompt.js +18 -0
- package/dist/src/tools/MCPTool/MCPTool.js +57 -0
- package/dist/src/tools/MCPTool/UI.js +433 -0
- package/dist/src/tools/MCPTool/classifyForCollapse.js +509 -0
- package/dist/src/tools/MCPTool/prompt.js +2 -0
- package/dist/src/tools/McpAuthTool/McpAuthTool.js +139 -0
- package/dist/src/tools/NotebookEditTool/NotebookEditTool.js +364 -0
- package/dist/src/tools/NotebookEditTool/UI.js +115 -0
- package/dist/src/tools/NotebookEditTool/constants.js +1 -0
- package/dist/src/tools/NotebookEditTool/prompt.js +2 -0
- package/dist/src/tools/PowerShellTool/PowerShellTool.js +700 -0
- package/dist/src/tools/PowerShellTool/UI.js +154 -0
- package/dist/src/tools/PowerShellTool/clmTypes.js +147 -0
- package/dist/src/tools/PowerShellTool/commandSemantics.js +37 -0
- package/dist/src/tools/PowerShellTool/commonParameters.js +17 -0
- package/dist/src/tools/PowerShellTool/destructiveCommandWarning.js +70 -0
- package/dist/src/tools/PowerShellTool/gitSafety.js +102 -0
- package/dist/src/tools/PowerShellTool/modeValidation.js +203 -0
- package/dist/src/tools/PowerShellTool/pathValidation.js +1259 -0
- package/dist/src/tools/PowerShellTool/powershellPermissions.js +791 -0
- package/dist/src/tools/PowerShellTool/powershellSecurity.js +612 -0
- package/dist/src/tools/PowerShellTool/prompt.js +130 -0
- package/dist/src/tools/PowerShellTool/readOnlyValidation.js +1000 -0
- package/dist/src/tools/PowerShellTool/toolName.js +1 -0
- package/dist/src/tools/REPLTool/constants.js +27 -0
- package/dist/src/tools/REPLTool/primitiveTools.js +21 -0
- package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +115 -0
- package/dist/src/tools/ReadMcpResourceTool/UI.js +37 -0
- package/dist/src/tools/ReadMcpResourceTool/prompt.js +15 -0
- package/dist/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +138 -0
- package/dist/src/tools/RemoteTriggerTool/UI.js +28 -0
- package/dist/src/tools/RemoteTriggerTool/prompt.js +12 -0
- package/dist/src/tools/ScheduleCronTool/CronCreateTool.js +117 -0
- package/dist/src/tools/ScheduleCronTool/CronDeleteTool.js +83 -0
- package/dist/src/tools/ScheduleCronTool/CronListTool.js +77 -0
- package/dist/src/tools/ScheduleCronTool/UI.js +73 -0
- package/dist/src/tools/ScheduleCronTool/prompt.js +67 -0
- package/dist/src/tools/SendMessageTool/SendMessageTool.js +561 -0
- package/dist/src/tools/SendMessageTool/UI.js +30 -0
- package/dist/src/tools/SendMessageTool/constants.js +1 -0
- package/dist/src/tools/SendMessageTool/prompt.js +32 -0
- package/dist/src/tools/SkillTool/SkillTool.js +614 -0
- package/dist/src/tools/SkillTool/UI.js +141 -0
- package/dist/src/tools/SkillTool/constants.js +1 -0
- package/dist/src/tools/SkillTool/prompt.js +161 -0
- package/dist/src/tools/SleepTool/prompt.js +14 -0
- package/dist/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +120 -0
- package/dist/src/tools/TaskCreateTool/TaskCreateTool.js +106 -0
- package/dist/src/tools/TaskCreateTool/constants.js +1 -0
- package/dist/src/tools/TaskCreateTool/prompt.js +48 -0
- package/dist/src/tools/TaskGetTool/TaskGetTool.js +110 -0
- package/dist/src/tools/TaskGetTool/constants.js +1 -0
- package/dist/src/tools/TaskGetTool/prompt.js +23 -0
- package/dist/src/tools/TaskListTool/TaskListTool.js +92 -0
- package/dist/src/tools/TaskListTool/constants.js +1 -0
- package/dist/src/tools/TaskListTool/prompt.js +38 -0
- package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +688 -0
- package/dist/src/tools/TaskOutputTool/constants.js +1 -0
- package/dist/src/tools/TaskStopTool/TaskStopTool.js +97 -0
- package/dist/src/tools/TaskStopTool/UI.js +39 -0
- package/dist/src/tools/TaskStopTool/prompt.js +7 -0
- package/dist/src/tools/TaskUpdateTool/TaskUpdateTool.js +279 -0
- package/dist/src/tools/TaskUpdateTool/constants.js +1 -0
- package/dist/src/tools/TaskUpdateTool/prompt.js +76 -0
- package/dist/src/tools/TeamCreateTool/TeamCreateTool.js +161 -0
- package/dist/src/tools/TeamCreateTool/UI.js +4 -0
- package/dist/src/tools/TeamCreateTool/constants.js +1 -0
- package/dist/src/tools/TeamCreateTool/prompt.js +113 -0
- package/dist/src/tools/TeamDeleteTool/TeamDeleteTool.js +96 -0
- package/dist/src/tools/TeamDeleteTool/UI.js +14 -0
- package/dist/src/tools/TeamDeleteTool/constants.js +1 -0
- package/dist/src/tools/TeamDeleteTool/prompt.js +16 -0
- package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +86 -0
- package/dist/src/tools/TodoWriteTool/constants.js +1 -0
- package/dist/src/tools/TodoWriteTool/prompt.js +181 -0
- package/dist/src/tools/ToolSearchTool/ToolSearchTool.js +266 -0
- package/dist/src/tools/ToolSearchTool/constants.js +1 -0
- package/dist/src/tools/ToolSearchTool/prompt.js +40 -0
- package/dist/src/tools/TungstenTool/TungstenLiveMonitor.js +4 -0
- package/dist/src/tools/TungstenTool/TungstenTool.js +39 -0
- package/dist/src/tools/WebFetchTool/UI.js +91 -0
- package/dist/src/tools/WebFetchTool/WebFetchTool.js +234 -0
- package/dist/src/tools/WebFetchTool/preapproved.js +122 -0
- package/dist/src/tools/WebFetchTool/prompt.js +37 -0
- package/dist/src/tools/WebFetchTool/utils.js +303 -0
- package/dist/src/tools/WebSearchTool/UI.js +109 -0
- package/dist/src/tools/WebSearchTool/WebSearchTool.js +313 -0
- package/dist/src/tools/WebSearchTool/prompt.js +32 -0
- package/dist/src/tools/WorkflowTool/constants.js +1 -0
- package/dist/src/tools/shared/gitOperationTracking.js +158 -0
- package/dist/src/tools/shared/spawnMultiAgent.js +630 -0
- package/dist/src/tools/testing/TestingPermissionTool.js +66 -0
- package/dist/src/tools/utils.js +15 -0
- package/dist/src/tools.js +184 -0
- package/dist/src/types/command.js +6 -0
- package/dist/src/types/connectorText.js +3 -0
- package/dist/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +525 -0
- package/dist/src/types/generated/events_mono/common/v1/auth.js +38 -0
- package/dist/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +112 -0
- package/dist/src/types/generated/google/protobuf/timestamp.js +33 -0
- package/dist/src/types/hooks.js +121 -0
- package/dist/src/types/ids.js +10 -0
- package/dist/src/types/logs.js +9 -0
- package/dist/src/types/permissions.js +12 -0
- package/dist/src/types/plugin.js +64 -0
- package/dist/src/types/textInputTypes.js +10 -0
- package/dist/src/upstreamproxy/relay.js +274 -0
- package/dist/src/upstreamproxy/upstreamproxy.js +161 -0
- package/dist/src/utils/CircularBuffer.js +51 -0
- package/dist/src/utils/Cursor.js +1006 -0
- package/dist/src/utils/QueryGuard.js +57 -0
- package/dist/src/utils/Shell.js +260 -0
- package/dist/src/utils/ShellCommand.js +277 -0
- package/dist/src/utils/abortController.js +31 -0
- package/dist/src/utils/activityManager.js +91 -0
- package/dist/src/utils/advisor.js +63 -0
- package/dist/src/utils/agentContext.js +36 -0
- package/dist/src/utils/agentId.js +36 -0
- package/dist/src/utils/agentSwarmsEnabled.js +17 -0
- package/dist/src/utils/agenticSessionSearch.js +194 -0
- package/dist/src/utils/analyzeContext.js +692 -0
- package/dist/src/utils/ansiToPng.js +211 -0
- package/dist/src/utils/ansiToSvg.js +171 -0
- package/dist/src/utils/api.js +435 -0
- package/dist/src/utils/apiPreconnect.js +19 -0
- package/dist/src/utils/appleTerminalBackup.js +91 -0
- package/dist/src/utils/argumentSubstitution.js +58 -0
- package/dist/src/utils/array.js +12 -0
- package/dist/src/utils/asciicast.js +149 -0
- package/dist/src/utils/attachments.js +1854 -0
- package/dist/src/utils/attribution.js +215 -0
- package/dist/src/utils/auth.js +1197 -0
- package/dist/src/utils/authFileDescriptor.js +106 -0
- package/dist/src/utils/authPortable.js +14 -0
- package/dist/src/utils/autoModeDenials.js +10 -0
- package/dist/src/utils/autoRunIssue.js +126 -0
- package/dist/src/utils/autoUpdater.js +339 -0
- package/dist/src/utils/aws.js +30 -0
- package/dist/src/utils/awsAuthStatusManager.js +55 -0
- package/dist/src/utils/background/remote/preconditions.js +134 -0
- package/dist/src/utils/background/remote/remoteSession.js +42 -0
- package/dist/src/utils/backgroundHousekeeping.js +47 -0
- package/dist/src/utils/bash/ParsedCommand.js +194 -0
- package/dist/src/utils/bash/ShellSnapshot.js +333 -0
- package/dist/src/utils/bash/ast.js +1422 -0
- package/dist/src/utils/bash/bashParser.js +3625 -0
- package/dist/src/utils/bash/bashPipeCommand.js +138 -0
- package/dist/src/utils/bash/commands.js +668 -0
- package/dist/src/utils/bash/heredoc.js +288 -0
- package/dist/src/utils/bash/parser.js +110 -0
- package/dist/src/utils/bash/prefix.js +119 -0
- package/dist/src/utils/bash/registry.js +20 -0
- package/dist/src/utils/bash/shellCompletion.js +127 -0
- package/dist/src/utils/bash/shellPrefix.js +11 -0
- package/dist/src/utils/bash/shellQuote.js +159 -0
- package/dist/src/utils/bash/shellQuoting.js +43 -0
- package/dist/src/utils/bash/specs/alias.js +11 -0
- package/dist/src/utils/bash/specs/index.js +16 -0
- package/dist/src/utils/bash/specs/nohup.js +10 -0
- package/dist/src/utils/bash/specs/pyright.js +88 -0
- package/dist/src/utils/bash/specs/sleep.js +10 -0
- package/dist/src/utils/bash/specs/srun.js +28 -0
- package/dist/src/utils/bash/specs/time.js +10 -0
- package/dist/src/utils/bash/specs/timeout.js +17 -0
- package/dist/src/utils/bash/treeSitterAnalysis.js +259 -0
- package/dist/src/utils/betas.js +199 -0
- package/dist/src/utils/billing.js +47 -0
- package/dist/src/utils/binaryCheck.js +25 -0
- package/dist/src/utils/browser.js +47 -0
- package/dist/src/utils/bufferedWriter.js +73 -0
- package/dist/src/utils/bundledMode.js +6 -0
- package/dist/src/utils/caCerts.js +47 -0
- package/dist/src/utils/caCertsConfig.js +32 -0
- package/dist/src/utils/cachePaths.js +22 -0
- package/dist/src/utils/classifierApprovals.js +61 -0
- package/dist/src/utils/classifierApprovalsHook.js +8 -0
- package/dist/src/utils/claudeCodeHints.js +83 -0
- package/dist/src/utils/claudeDesktop.js +87 -0
- package/dist/src/utils/claudeInChrome/chromeNativeHost.js +353 -0
- package/dist/src/utils/claudeInChrome/common.js +416 -0
- package/dist/src/utils/claudeInChrome/mcpServer.js +190 -0
- package/dist/src/utils/claudeInChrome/prompt.js +60 -0
- package/dist/src/utils/claudeInChrome/setup.js +239 -0
- package/dist/src/utils/claudeInChrome/setupPortable.js +133 -0
- package/dist/src/utils/claudeInChrome/toolRendering.js +224 -0
- package/dist/src/utils/claudemd.js +727 -0
- package/dist/src/utils/cleanup.js +423 -0
- package/dist/src/utils/cleanupRegistry.js +8 -0
- package/dist/src/utils/cliArgs.js +21 -0
- package/dist/src/utils/cliHighlight.js +27 -0
- package/dist/src/utils/codeIndexing.js +92 -0
- package/dist/src/utils/collapseBackgroundBashNotifications.js +58 -0
- package/dist/src/utils/collapseHookSummaries.js +38 -0
- package/dist/src/utils/collapseReadSearch.js +569 -0
- package/dist/src/utils/collapseTeammateShutdowns.js +34 -0
- package/dist/src/utils/combinedAbortSignal.js +28 -0
- package/dist/src/utils/commandLifecycle.js +7 -0
- package/dist/src/utils/commitAttribution.js +510 -0
- package/dist/src/utils/completionCache.js +126 -0
- package/dist/src/utils/computerUse/appNames.js +104 -0
- package/dist/src/utils/computerUse/cleanup.js +37 -0
- package/dist/src/utils/computerUse/common.js +25 -0
- package/dist/src/utils/computerUse/computerUseLock.js +117 -0
- package/dist/src/utils/computerUse/drainRunLoop.js +44 -0
- package/dist/src/utils/computerUse/escHotkey.js +33 -0
- package/dist/src/utils/computerUse/executor.js +303 -0
- package/dist/src/utils/computerUse/gates.js +40 -0
- package/dist/src/utils/computerUse/hostAdapter.js +48 -0
- package/dist/src/utils/computerUse/inputLoader.js +10 -0
- package/dist/src/utils/computerUse/mcpServer.js +61 -0
- package/dist/src/utils/computerUse/setup.js +25 -0
- package/dist/src/utils/computerUse/swiftLoader.js +7 -0
- package/dist/src/utils/computerUse/toolRendering.js +96 -0
- package/dist/src/utils/computerUse/wrapper.js +242 -0
- package/dist/src/utils/concurrentSessions.js +108 -0
- package/dist/src/utils/config.js +801 -0
- package/dist/src/utils/configConstants.js +11 -0
- package/dist/src/utils/contentArray.js +19 -0
- package/dist/src/utils/context.js +135 -0
- package/dist/src/utils/contextAnalysis.js +152 -0
- package/dist/src/utils/contextSuggestions.js +141 -0
- package/dist/src/utils/controlMessageCompat.js +17 -0
- package/dist/src/utils/conversationRecovery.js +278 -0
- package/dist/src/utils/cron.js +182 -0
- package/dist/src/utils/cronJitterConfig.js +22 -0
- package/dist/src/utils/cronScheduler.js +295 -0
- package/dist/src/utils/cronTasks.js +183 -0
- package/dist/src/utils/cronTasksLock.js +116 -0
- package/dist/src/utils/crossProjectResume.js +36 -0
- package/dist/src/utils/crypto.js +3 -0
- package/dist/src/utils/cwd.js +16 -0
- package/dist/src/utils/debug.js +170 -0
- package/dist/src/utils/debugFilter.js +69 -0
- package/dist/src/utils/deepLink/banner.js +52 -0
- package/dist/src/utils/deepLink/parseDeepLink.js +68 -0
- package/dist/src/utils/deepLink/protocolHandler.js +66 -0
- package/dist/src/utils/deepLink/registerProtocol.js +206 -0
- package/dist/src/utils/deepLink/terminalLauncher.js +321 -0
- package/dist/src/utils/deepLink/terminalPreference.js +26 -0
- package/dist/src/utils/desktopDeepLink.js +154 -0
- package/dist/src/utils/detectRepository.js +98 -0
- package/dist/src/utils/diagLogs.js +47 -0
- package/dist/src/utils/diff.js +92 -0
- package/dist/src/utils/directMemberMessage.js +27 -0
- package/dist/src/utils/displayTags.js +12 -0
- package/dist/src/utils/doctorContextWarnings.js +151 -0
- package/dist/src/utils/doctorDiagnostic.js +388 -0
- package/dist/src/utils/dxt/helpers.js +36 -0
- package/dist/src/utils/dxt/zip.js +112 -0
- package/dist/src/utils/earlyInput.js +98 -0
- package/dist/src/utils/editor.js +105 -0
- package/dist/src/utils/effort.js +188 -0
- package/dist/src/utils/embeddedTools.js +10 -0
- package/dist/src/utils/env.js +284 -0
- package/dist/src/utils/envDynamic.js +91 -0
- package/dist/src/utils/envUtils.js +88 -0
- package/dist/src/utils/envValidation.js +26 -0
- package/dist/src/utils/errorLogSink.js +142 -0
- package/dist/src/utils/errors.js +123 -0
- package/dist/src/utils/exampleCommands.js +133 -0
- package/dist/src/utils/execFileNoThrow.js +82 -0
- package/dist/src/utils/execFileNoThrowPortable.js +52 -0
- package/dist/src/utils/execSyncWrapper.js +16 -0
- package/dist/src/utils/exportRenderer.js +78 -0
- package/dist/src/utils/extraUsage.js +16 -0
- package/dist/src/utils/fastMode.js +331 -0
- package/dist/src/utils/file.js +318 -0
- package/dist/src/utils/fileHistory.js +662 -0
- package/dist/src/utils/fileOperationAnalytics.js +23 -0
- package/dist/src/utils/filePersistence/filePersistence.js +165 -0
- package/dist/src/utils/filePersistence/outputsScanner.js +72 -0
- package/dist/src/utils/filePersistence/types.js +3 -0
- package/dist/src/utils/fileRead.js +53 -0
- package/dist/src/utils/fileReadCache.js +54 -0
- package/dist/src/utils/fileStateCache.js +79 -0
- package/dist/src/utils/findExecutable.js +5 -0
- package/dist/src/utils/fingerprint.js +30 -0
- package/dist/src/utils/forkedAgent.js +253 -0
- package/dist/src/utils/format.js +200 -0
- package/dist/src/utils/formatBriefTimestamp.js +49 -0
- package/dist/src/utils/fpsTracker.js +32 -0
- package/dist/src/utils/frontmatterParser.js +159 -0
- package/dist/src/utils/fsOperations.js +548 -0
- package/dist/src/utils/fullscreen.js +83 -0
- package/dist/src/utils/generatedFiles.js +96 -0
- package/dist/src/utils/generators.js +60 -0
- package/dist/src/utils/genericProcessUtils.js +96 -0
- package/dist/src/utils/getWorktreePaths.js +30 -0
- package/dist/src/utils/getWorktreePathsPortable.js +14 -0
- package/dist/src/utils/ghPrStatus.js +51 -0
- package/dist/src/utils/git/gitConfigParser.js +166 -0
- package/dist/src/utils/git/gitFilesystem.js +413 -0
- package/dist/src/utils/git/gitignore.js +52 -0
- package/dist/src/utils/git.js +520 -0
- package/dist/src/utils/gitDiff.js +291 -0
- package/dist/src/utils/gitSettings.js +10 -0
- package/dist/src/utils/github/ghAuthStatus.js +15 -0
- package/dist/src/utils/githubRepoPathMapping.js +92 -0
- package/dist/src/utils/glob.js +65 -0
- package/dist/src/utils/gracefulShutdown.js +274 -0
- package/dist/src/utils/groupToolUses.js +107 -0
- package/dist/src/utils/handlePromptSubmit.js +323 -0
- package/dist/src/utils/hash.js +21 -0
- package/dist/src/utils/headlessProfiler.js +95 -0
- package/dist/src/utils/heapDumpService.js +157 -0
- package/dist/src/utils/heatmap.js +118 -0
- package/dist/src/utils/highlightMatch.js +28 -0
- package/dist/src/utils/hooks/AsyncHookRegistry.js +190 -0
- package/dist/src/utils/hooks/apiQueryHookHelper.js +67 -0
- package/dist/src/utils/hooks/execAgentHook.js +216 -0
- package/dist/src/utils/hooks/execHttpHook.js +106 -0
- package/dist/src/utils/hooks/execPromptHook.js +153 -0
- package/dist/src/utils/hooks/fileChangedWatcher.js +154 -0
- package/dist/src/utils/hooks/hookEvents.js +92 -0
- package/dist/src/utils/hooks/hookHelpers.js +43 -0
- package/dist/src/utils/hooks/hooksConfigManager.js +386 -0
- package/dist/src/utils/hooks/hooksConfigSnapshot.js +52 -0
- package/dist/src/utils/hooks/hooksSettings.js +175 -0
- package/dist/src/utils/hooks/postSamplingHooks.js +26 -0
- package/dist/src/utils/hooks/registerFrontmatterHooks.js +34 -0
- package/dist/src/utils/hooks/registerSkillHooks.js +24 -0
- package/dist/src/utils/hooks/sessionHooks.js +176 -0
- package/dist/src/utils/hooks/skillImprovement.js +200 -0
- package/dist/src/utils/hooks/ssrfGuard.js +157 -0
- package/dist/src/utils/hooks.js +2879 -0
- package/dist/src/utils/horizontalScroll.js +72 -0
- package/dist/src/utils/http.js +80 -0
- package/dist/src/utils/hyperlink.js +13 -0
- package/dist/src/utils/iTermBackup.js +46 -0
- package/dist/src/utils/ide.js +938 -0
- package/dist/src/utils/idePathConversion.js +47 -0
- package/dist/src/utils/idleTimeout.js +33 -0
- package/dist/src/utils/imagePaste.js +190 -0
- package/dist/src/utils/imageResizer.js +459 -0
- package/dist/src/utils/imageStore.js +109 -0
- package/dist/src/utils/imageValidation.js +61 -0
- package/dist/src/utils/immediateCommand.js +4 -0
- package/dist/src/utils/inProcessTeammateHelpers.js +28 -0
- package/dist/src/utils/ink.js +14 -0
- package/dist/src/utils/intl.js +61 -0
- package/dist/src/utils/jetbrains.js +130 -0
- package/dist/src/utils/json.js +182 -0
- package/dist/src/utils/jsonRead.js +4 -0
- package/dist/src/utils/keyboardShortcuts.js +8 -0
- package/dist/src/utils/lazySchema.js +4 -0
- package/dist/src/utils/listSessionsImpl.js +219 -0
- package/dist/src/utils/localInstaller.js +86 -0
- package/dist/src/utils/lockfile.js +19 -0
- package/dist/src/utils/log.js +164 -0
- package/dist/src/utils/logoV2Utils.js +192 -0
- package/dist/src/utils/mailbox.js +51 -0
- package/dist/src/utils/managedEnv.js +90 -0
- package/dist/src/utils/managedEnvConstants.js +136 -0
- package/dist/src/utils/markdown.js +216 -0
- package/dist/src/utils/markdownConfigLoader.js +293 -0
- package/dist/src/utils/mcp/dateTimeParser.js +73 -0
- package/dist/src/utils/mcp/elicitationValidation.js +208 -0
- package/dist/src/utils/mcpInstructionsDelta.js +71 -0
- package/dist/src/utils/mcpOutputStorage.js +124 -0
- package/dist/src/utils/mcpValidation.js +138 -0
- package/dist/src/utils/mcpWebSocketTransport.js +152 -0
- package/dist/src/utils/memoize.js +125 -0
- package/dist/src/utils/memory/types.js +8 -0
- package/dist/src/utils/memory/versions.js +4 -0
- package/dist/src/utils/memoryFileDetection.js +151 -0
- package/dist/src/utils/messagePredicates.js +3 -0
- package/dist/src/utils/messageQueueManager.js +267 -0
- package/dist/src/utils/messages/mappers.js +198 -0
- package/dist/src/utils/messages/systemInit.js +47 -0
- package/dist/src/utils/messages.js +3450 -0
- package/dist/src/utils/model/agent.js +91 -0
- package/dist/src/utils/model/aliases.js +16 -0
- package/dist/src/utils/model/antModels.js +23 -0
- package/dist/src/utils/model/bedrock.js +158 -0
- package/dist/src/utils/model/check1mAccess.js +49 -0
- package/dist/src/utils/model/configs.js +81 -0
- package/dist/src/utils/model/contextWindowUpgradeCheck.js +32 -0
- package/dist/src/utils/model/deprecation.js +56 -0
- package/dist/src/utils/model/model.js +377 -0
- package/dist/src/utils/model/modelAllowlist.js +91 -0
- package/dist/src/utils/model/modelCapabilities.js +97 -0
- package/dist/src/utils/model/modelOptions.js +403 -0
- package/dist/src/utils/model/modelStrings.js +112 -0
- package/dist/src/utils/model/modelSupportOverrides.js +32 -0
- package/dist/src/utils/model/providers.js +23 -0
- package/dist/src/utils/model/validateModel.js +108 -0
- package/dist/src/utils/modelCost.js +135 -0
- package/dist/src/utils/modifiers.js +22 -0
- package/dist/src/utils/mtls.js +101 -0
- package/dist/src/utils/nativeInstaller/download.js +309 -0
- package/dist/src/utils/nativeInstaller/index.js +9 -0
- package/dist/src/utils/nativeInstaller/installer.js +1104 -0
- package/dist/src/utils/nativeInstaller/packageManagers.js +174 -0
- package/dist/src/utils/nativeInstaller/pidLock.js +230 -0
- package/dist/src/utils/notebook.js +170 -0
- package/dist/src/utils/objectGroupBy.js +12 -0
- package/dist/src/utils/pasteStore.js +61 -0
- package/dist/src/utils/path.js +65 -0
- package/dist/src/utils/pdf.js +199 -0
- package/dist/src/utils/pdfUtils.js +36 -0
- package/dist/src/utils/peerAddress.js +9 -0
- package/dist/src/utils/permissions/PermissionMode.js +82 -0
- package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +62 -0
- package/dist/src/utils/permissions/PermissionResult.js +10 -0
- package/dist/src/utils/permissions/PermissionRule.js +7 -0
- package/dist/src/utils/permissions/PermissionUpdate.js +219 -0
- package/dist/src/utils/permissions/PermissionUpdateSchema.js +49 -0
- package/dist/src/utils/permissions/autoModeState.js +26 -0
- package/dist/src/utils/permissions/bashClassifier.js +29 -0
- package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +69 -0
- package/dist/src/utils/permissions/classifierDecision.js +56 -0
- package/dist/src/utils/permissions/classifierShared.js +14 -0
- package/dist/src/utils/permissions/dangerousPatterns.js +44 -0
- package/dist/src/utils/permissions/denialTracking.js +28 -0
- package/dist/src/utils/permissions/filesystem.js +889 -0
- package/dist/src/utils/permissions/getNextPermissionMode.js +51 -0
- package/dist/src/utils/permissions/pathValidation.js +230 -0
- package/dist/src/utils/permissions/permissionExplainer.js +162 -0
- package/dist/src/utils/permissions/permissionRuleParser.js +90 -0
- package/dist/src/utils/permissions/permissionSetup.js +770 -0
- package/dist/src/utils/permissions/permissions.js +585 -0
- package/dist/src/utils/permissions/permissionsLoader.js +160 -0
- package/dist/src/utils/permissions/shadowedRuleDetection.js +81 -0
- package/dist/src/utils/permissions/shellRuleMatching.js +108 -0
- package/dist/src/utils/permissions/yoloClassifier.js +868 -0
- package/dist/src/utils/planModeV2.js +45 -0
- package/dist/src/utils/plans.js +232 -0
- package/dist/src/utils/platform.js +102 -0
- package/dist/src/utils/plugins/addDirPluginSettings.js +30 -0
- package/dist/src/utils/plugins/cacheUtils.js +144 -0
- package/dist/src/utils/plugins/dependencyResolver.js +118 -0
- package/dist/src/utils/plugins/fetchTelemetry.js +65 -0
- package/dist/src/utils/plugins/gitAvailability.js +18 -0
- package/dist/src/utils/plugins/headlessPluginInstall.js +92 -0
- package/dist/src/utils/plugins/hintRecommendation.js +95 -0
- package/dist/src/utils/plugins/installCounts.js +144 -0
- package/dist/src/utils/plugins/installedPluginsManager.js +645 -0
- package/dist/src/utils/plugins/loadPluginAgents.js +197 -0
- package/dist/src/utils/plugins/loadPluginCommands.js +488 -0
- package/dist/src/utils/plugins/loadPluginHooks.js +170 -0
- package/dist/src/utils/plugins/loadPluginOutputStyles.js +98 -0
- package/dist/src/utils/plugins/lspPluginIntegration.js +216 -0
- package/dist/src/utils/plugins/lspRecommendation.js +193 -0
- package/dist/src/utils/plugins/managedPlugins.js +18 -0
- package/dist/src/utils/plugins/marketplaceHelpers.js +309 -0
- package/dist/src/utils/plugins/marketplaceManager.js +1225 -0
- package/dist/src/utils/plugins/mcpPluginIntegration.js +336 -0
- package/dist/src/utils/plugins/mcpbHandler.js +487 -0
- package/dist/src/utils/plugins/officialMarketplace.js +5 -0
- package/dist/src/utils/plugins/officialMarketplaceGcs.js +118 -0
- package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +267 -0
- package/dist/src/utils/plugins/orphanedPluginFilter.js +47 -0
- package/dist/src/utils/plugins/parseMarketplaceInput.js +75 -0
- package/dist/src/utils/plugins/performStartupChecks.js +34 -0
- package/dist/src/utils/plugins/pluginAutoupdate.js +130 -0
- package/dist/src/utils/plugins/pluginBlocklist.js +66 -0
- package/dist/src/utils/plugins/pluginDirectories.js +78 -0
- package/dist/src/utils/plugins/pluginFlagging.js +122 -0
- package/dist/src/utils/plugins/pluginIdentifier.js +37 -0
- package/dist/src/utils/plugins/pluginInstallationHelpers.js +281 -0
- package/dist/src/utils/plugins/pluginLoader.js +1596 -0
- package/dist/src/utils/plugins/pluginOptionsStorage.js +162 -0
- package/dist/src/utils/plugins/pluginPolicy.js +5 -0
- package/dist/src/utils/plugins/pluginStartupCheck.js +176 -0
- package/dist/src/utils/plugins/pluginVersioning.js +53 -0
- package/dist/src/utils/plugins/reconciler.js +133 -0
- package/dist/src/utils/plugins/refresh.js +96 -0
- package/dist/src/utils/plugins/schemas.js +411 -0
- package/dist/src/utils/plugins/validatePlugin.js +573 -0
- package/dist/src/utils/plugins/walkPluginMarkdown.js +30 -0
- package/dist/src/utils/plugins/zipCache.js +211 -0
- package/dist/src/utils/plugins/zipCacheAdapters.js +93 -0
- package/dist/src/utils/powershell/dangerousCmdlets.js +97 -0
- package/dist/src/utils/powershell/parser.js +929 -0
- package/dist/src/utils/powershell/staticPrefix.js +142 -0
- package/dist/src/utils/preflightChecks.js +196 -0
- package/dist/src/utils/privacyLevel.js +21 -0
- package/dist/src/utils/process.js +42 -0
- package/dist/src/utils/processUserInput/processBashCommand.js +109 -0
- package/dist/src/utils/processUserInput/processSlashCommand.js +600 -0
- package/dist/src/utils/processUserInput/processTextPrompt.js +54 -0
- package/dist/src/utils/processUserInput/processUserInput.js +272 -0
- package/dist/src/utils/profilerBase.js +15 -0
- package/dist/src/utils/promptCategory.js +21 -0
- package/dist/src/utils/promptEditor.js +115 -0
- package/dist/src/utils/promptShellExecution.js +76 -0
- package/dist/src/utils/proxy.js +228 -0
- package/dist/src/utils/queryContext.js +83 -0
- package/dist/src/utils/queryHelpers.js +329 -0
- package/dist/src/utils/queryProfiler.js +177 -0
- package/dist/src/utils/queueProcessor.js +41 -0
- package/dist/src/utils/readEditContext.js +131 -0
- package/dist/src/utils/readFileInRange.js +212 -0
- package/dist/src/utils/releaseNotes.js +186 -0
- package/dist/src/utils/renderOptions.js +45 -0
- package/dist/src/utils/ripgrep.js +383 -0
- package/dist/src/utils/sandbox/sandbox-adapter.js +505 -0
- package/dist/src/utils/sandbox/sandbox-ui-utils.js +3 -0
- package/dist/src/utils/sanitization.js +33 -0
- package/dist/src/utils/screenshotClipboard.js +73 -0
- package/dist/src/utils/sdkEventQueue.js +36 -0
- package/dist/src/utils/secureStorage/fallbackStorage.js +45 -0
- package/dist/src/utils/secureStorage/index.js +9 -0
- package/dist/src/utils/secureStorage/keychainPrefetch.js +43 -0
- package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +42 -0
- package/dist/src/utils/secureStorage/macOsKeychainStorage.js +147 -0
- package/dist/src/utils/secureStorage/plainTextStorage.js +77 -0
- package/dist/src/utils/semanticBoolean.js +4 -0
- package/dist/src/utils/semanticNumber.js +11 -0
- package/dist/src/utils/semver.js +43 -0
- package/dist/src/utils/sequential.js +30 -0
- package/dist/src/utils/sessionActivity.js +95 -0
- package/dist/src/utils/sessionEnvVars.js +13 -0
- package/dist/src/utils/sessionEnvironment.js +113 -0
- package/dist/src/utils/sessionFileAccessHooks.js +150 -0
- package/dist/src/utils/sessionIngressAuth.js +79 -0
- package/dist/src/utils/sessionRestore.js +205 -0
- package/dist/src/utils/sessionStart.js +119 -0
- package/dist/src/utils/sessionState.js +48 -0
- package/dist/src/utils/sessionStorage.js +2891 -0
- package/dist/src/utils/sessionStoragePortable.js +486 -0
- package/dist/src/utils/sessionTitle.js +89 -0
- package/dist/src/utils/sessionUrl.js +33 -0
- package/dist/src/utils/set.js +38 -0
- package/dist/src/utils/settings/allErrors.js +11 -0
- package/dist/src/utils/settings/applySettingsChange.js +40 -0
- package/dist/src/utils/settings/changeDetector.js +279 -0
- package/dist/src/utils/settings/constants.js +119 -0
- package/dist/src/utils/settings/internalWrites.js +15 -0
- package/dist/src/utils/settings/managedPath.js +19 -0
- package/dist/src/utils/settings/mdm/constants.js +33 -0
- package/dist/src/utils/settings/mdm/rawRead.js +72 -0
- package/dist/src/utils/settings/mdm/settings.js +160 -0
- package/dist/src/utils/settings/permissionValidation.js +169 -0
- package/dist/src/utils/settings/pluginOnlyPolicy.js +19 -0
- package/dist/src/utils/settings/schemaOutput.js +7 -0
- package/dist/src/utils/settings/settings.js +530 -0
- package/dist/src/utils/settings/settingsCache.js +36 -0
- package/dist/src/utils/settings/toolValidationConfig.js +58 -0
- package/dist/src/utils/settings/types.js +224 -0
- package/dist/src/utils/settings/validateEditTool.js +26 -0
- package/dist/src/utils/settings/validation.js +160 -0
- package/dist/src/utils/settings/validationTips.js +94 -0
- package/dist/src/utils/shell/bashProvider.js +123 -0
- package/dist/src/utils/shell/outputLimits.js +7 -0
- package/dist/src/utils/shell/powershellDetection.js +50 -0
- package/dist/src/utils/shell/powershellProvider.js +50 -0
- package/dist/src/utils/shell/prefix.js +183 -0
- package/dist/src/utils/shell/readOnlyCommandValidation.js +1347 -0
- package/dist/src/utils/shell/resolveDefaultShell.js +4 -0
- package/dist/src/utils/shell/shellProvider.js +2 -0
- package/dist/src/utils/shell/shellToolUtils.js +10 -0
- package/dist/src/utils/shell/specPrefix.js +152 -0
- package/dist/src/utils/shellConfig.js +88 -0
- package/dist/src/utils/sideQuery.js +108 -0
- package/dist/src/utils/sideQuestion.js +78 -0
- package/dist/src/utils/signal.js +18 -0
- package/dist/src/utils/sinks.js +6 -0
- package/dist/src/utils/skills/skillChangeDetector.js +184 -0
- package/dist/src/utils/slashCommandParsing.js +25 -0
- package/dist/src/utils/sleep.js +43 -0
- package/dist/src/utils/sliceAnsi.js +48 -0
- package/dist/src/utils/slowOperations.js +165 -0
- package/dist/src/utils/standaloneAgent.js +7 -0
- package/dist/src/utils/startupProfiler.js +106 -0
- package/dist/src/utils/staticRender.js +78 -0
- package/dist/src/utils/stats.js +598 -0
- package/dist/src/utils/statsCache.js +223 -0
- package/dist/src/utils/status.js +361 -0
- package/dist/src/utils/statusNoticeDefinitions.js +280 -0
- package/dist/src/utils/statusNoticeHelpers.js +10 -0
- package/dist/src/utils/stream.js +72 -0
- package/dist/src/utils/streamJsonStdoutGuard.js +73 -0
- package/dist/src/utils/streamlinedTransform.js +130 -0
- package/dist/src/utils/stringUtils.js +108 -0
- package/dist/src/utils/subprocessEnv.js +42 -0
- package/dist/src/utils/suggestions/commandSuggestions.js +301 -0
- package/dist/src/utils/suggestions/directoryCompletion.js +134 -0
- package/dist/src/utils/suggestions/shellHistoryCompletion.js +65 -0
- package/dist/src/utils/suggestions/skillUsageTracking.js +33 -0
- package/dist/src/utils/suggestions/slackChannelSuggestions.js +141 -0
- package/dist/src/utils/swarm/It2SetupPrompt.js +537 -0
- package/dist/src/utils/swarm/backends/ITermBackend.js +153 -0
- package/dist/src/utils/swarm/backends/InProcessBackend.js +160 -0
- package/dist/src/utils/swarm/backends/PaneBackendExecutor.js +171 -0
- package/dist/src/utils/swarm/backends/TmuxBackend.js +458 -0
- package/dist/src/utils/swarm/backends/detection.js +43 -0
- package/dist/src/utils/swarm/backends/it2Setup.js +134 -0
- package/dist/src/utils/swarm/backends/registry.js +220 -0
- package/dist/src/utils/swarm/backends/teammateModeSnapshot.js +33 -0
- package/dist/src/utils/swarm/backends/types.js +3 -0
- package/dist/src/utils/swarm/constants.js +11 -0
- package/dist/src/utils/swarm/inProcessRunner.js +818 -0
- package/dist/src/utils/swarm/leaderPermissionBridge.js +20 -0
- package/dist/src/utils/swarm/permissionSync.js +474 -0
- package/dist/src/utils/swarm/reconnection.js +55 -0
- package/dist/src/utils/swarm/spawnInProcess.js +164 -0
- package/dist/src/utils/swarm/spawnUtils.js +76 -0
- package/dist/src/utils/swarm/teamHelpers.js +320 -0
- package/dist/src/utils/swarm/teammateInit.js +65 -0
- package/dist/src/utils/swarm/teammateLayoutManager.js +40 -0
- package/dist/src/utils/swarm/teammateModel.js +5 -0
- package/dist/src/utils/swarm/teammatePromptAddendum.js +11 -0
- package/dist/src/utils/systemDirectories.js +42 -0
- package/dist/src/utils/systemPrompt.js +41 -0
- package/dist/src/utils/systemPromptType.js +3 -0
- package/dist/src/utils/systemTheme.js +61 -0
- package/dist/src/utils/taggedId.js +27 -0
- package/dist/src/utils/task/TaskOutput.js +244 -0
- package/dist/src/utils/task/diskOutput.js +267 -0
- package/dist/src/utils/task/framework.js +178 -0
- package/dist/src/utils/task/outputFormatting.js +21 -0
- package/dist/src/utils/task/sdkProgress.js +18 -0
- package/dist/src/utils/tasks.js +481 -0
- package/dist/src/utils/teamDiscovery.js +33 -0
- package/dist/src/utils/teamMemoryOps.js +40 -0
- package/dist/src/utils/teammate.js +132 -0
- package/dist/src/utils/teammateContext.js +17 -0
- package/dist/src/utils/teammateMailbox.js +541 -0
- package/dist/src/utils/telemetry/betaSessionTracing.js +255 -0
- package/dist/src/utils/telemetry/bigqueryExporter.js +162 -0
- package/dist/src/utils/telemetry/events.js +46 -0
- package/dist/src/utils/telemetry/instrumentation.js +534 -0
- package/dist/src/utils/telemetry/logger.js +26 -0
- package/dist/src/utils/telemetry/perfettoTracing.js +636 -0
- package/dist/src/utils/telemetry/pluginTelemetry.js +99 -0
- package/dist/src/utils/telemetry/sessionTracing.js +564 -0
- package/dist/src/utils/telemetry/skillLoadedEvent.js +22 -0
- package/dist/src/utils/telemetryAttributes.js +50 -0
- package/dist/src/utils/teleport/api.js +236 -0
- package/dist/src/utils/teleport/environmentSelection.js +42 -0
- package/dist/src/utils/teleport/environments.js +74 -0
- package/dist/src/utils/teleport/gitBundle.js +153 -0
- package/dist/src/utils/teleport.js +856 -0
- package/dist/src/utils/tempfile.js +7 -0
- package/dist/src/utils/terminal.js +65 -0
- package/dist/src/utils/terminalPanel.js +133 -0
- package/dist/src/utils/textHighlighting.js +109 -0
- package/dist/src/utils/theme.js +465 -0
- package/dist/src/utils/thinking.js +92 -0
- package/dist/src/utils/timeouts.js +22 -0
- package/dist/src/utils/tmuxSocket.js +216 -0
- package/dist/src/utils/todo/types.js +9 -0
- package/dist/src/utils/tokenBudget.js +54 -0
- package/dist/src/utils/tokens.js +123 -0
- package/dist/src/utils/toolErrors.js +87 -0
- package/dist/src/utils/toolPool.js +22 -0
- package/dist/src/utils/toolResultStorage.js +444 -0
- package/dist/src/utils/toolSchemaCache.js +7 -0
- package/dist/src/utils/toolSearch.js +314 -0
- package/dist/src/utils/transcriptSearch.js +143 -0
- package/dist/src/utils/treeify.js +89 -0
- package/dist/src/utils/truncate.js +113 -0
- package/dist/src/utils/ultraplan/ccrSession.js +187 -0
- package/dist/src/utils/ultraplan/keyword.js +81 -0
- package/dist/src/utils/ultraplan/prompt.txt.js +1 -0
- package/dist/src/utils/unaryLogging.js +15 -0
- package/dist/src/utils/undercover.js +57 -0
- package/dist/src/utils/user.js +111 -0
- package/dist/src/utils/userAgent.js +3 -0
- package/dist/src/utils/userPromptKeywords.js +13 -0
- package/dist/src/utils/uuid.js +11 -0
- package/dist/src/utils/warningHandler.js +74 -0
- package/dist/src/utils/which.js +50 -0
- package/dist/src/utils/windowsPaths.js +104 -0
- package/dist/src/utils/withResolvers.js +9 -0
- package/dist/src/utils/words.js +763 -0
- package/dist/src/utils/workloadContext.js +9 -0
- package/dist/src/utils/worktree.js +841 -0
- package/dist/src/utils/worktreeModeEnabled.js +3 -0
- package/dist/src/utils/xdg.js +24 -0
- package/dist/src/utils/xml.js +6 -0
- package/dist/src/utils/yaml.js +6 -0
- package/dist/src/utils/zodToJsonSchema.js +10 -0
- package/dist/src/vim/motions.js +54 -0
- package/dist/src/vim/operators.js +329 -0
- package/dist/src/vim/textObjects.js +137 -0
- package/dist/src/vim/transitions.js +324 -0
- package/dist/src/vim/types.js +60 -0
- package/dist/src/voice/voiceModeEnabled.js +18 -0
- package/dist/stubs/ant-claude-for-chrome-mcp.js +6 -0
- package/dist/stubs/color-diff-napi.js +30 -0
- package/litellm.yaml +25 -0
- package/package.json +93 -0
package/dist/src/main.js
ADDED
|
@@ -0,0 +1,2489 @@
|
|
|
1
|
+
import { profileCheckpoint, profileReport } from "./utils/startupProfiler.js";
|
|
2
|
+
profileCheckpoint("main_tsx_entry");
|
|
3
|
+
import { startMdmRawRead } from "./utils/settings/mdm/rawRead.js";
|
|
4
|
+
startMdmRawRead();
|
|
5
|
+
import { ensureKeychainPrefetchCompleted, startKeychainPrefetch } from "./utils/secureStorage/keychainPrefetch.js";
|
|
6
|
+
startKeychainPrefetch();
|
|
7
|
+
import { Command as CommanderCommand, InvalidArgumentError, Option } from "@commander-js/extra-typings";
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
import { readFileSync } from "fs";
|
|
10
|
+
import mapValues from "lodash-es/mapValues.js";
|
|
11
|
+
import pickBy from "lodash-es/pickBy.js";
|
|
12
|
+
import uniqBy from "lodash-es/uniqBy.js";
|
|
13
|
+
import React from "react";
|
|
14
|
+
import { getOauthConfig } from "./constants/oauth.js";
|
|
15
|
+
import { getRemoteSessionUrl } from "./constants/product.js";
|
|
16
|
+
import { getSystemContext, getUserContext } from "./context.js";
|
|
17
|
+
import { init, initializeTelemetryAfterTrust } from "./entrypoints/init.js";
|
|
18
|
+
import { addToHistory } from "./history.js";
|
|
19
|
+
import { launchRepl } from "./replLauncher.js";
|
|
20
|
+
import { hasGrowthBookEnvOverride, initializeGrowthBook, refreshGrowthBookAfterAuthChange } from "./services/analytics/growthbook.js";
|
|
21
|
+
import { fetchBootstrapData } from "./services/api/bootstrap.js";
|
|
22
|
+
import { downloadSessionFiles, parseFileSpecs } from "./services/api/filesApi.js";
|
|
23
|
+
import { prefetchPassesEligibility } from "./services/api/referral.js";
|
|
24
|
+
import { prefetchOfficialMcpUrls } from "./services/mcp/officialRegistry.js";
|
|
25
|
+
import { isPolicyAllowed, loadPolicyLimits, refreshPolicyLimits, waitForPolicyLimitsToLoad } from "./services/policyLimits/index.js";
|
|
26
|
+
import { loadRemoteManagedSettings, refreshRemoteManagedSettings } from "./services/remoteManagedSettings/index.js";
|
|
27
|
+
import { createSyntheticOutputTool, isSyntheticOutputToolEnabled } from "./tools/SyntheticOutputTool/SyntheticOutputTool.js";
|
|
28
|
+
import { getTools } from "./tools.js";
|
|
29
|
+
import { canUserConfigureAdvisor, getInitialAdvisorSetting, isAdvisorEnabled, isValidAdvisorModel, modelSupportsAdvisor } from "./utils/advisor.js";
|
|
30
|
+
import { isAgentSwarmsEnabled } from "./utils/agentSwarmsEnabled.js";
|
|
31
|
+
import { count, uniq } from "./utils/array.js";
|
|
32
|
+
import { installAsciicastRecorder } from "./utils/asciicast.js";
|
|
33
|
+
import { getSubscriptionType, isClaudeAISubscriber, prefetchAwsCredentialsAndBedRockInfoIfSafe, prefetchGcpCredentialsIfSafe, validateForceLoginOrg } from "./utils/auth.js";
|
|
34
|
+
import { checkHasTrustDialogAccepted, getGlobalConfig, getRemoteControlAtStartup, isAutoUpdaterDisabled, saveGlobalConfig } from "./utils/config.js";
|
|
35
|
+
import { seedEarlyInput, stopCapturingEarlyInput } from "./utils/earlyInput.js";
|
|
36
|
+
import { getInitialEffortSetting, parseEffortValue } from "./utils/effort.js";
|
|
37
|
+
import { getInitialFastModeSetting, isFastModeEnabled, prefetchFastModeStatus, resolveFastModeStatusFromCache } from "./utils/fastMode.js";
|
|
38
|
+
import { applyConfigEnvironmentVariables } from "./utils/managedEnv.js";
|
|
39
|
+
import { createSystemMessage, createUserMessage } from "./utils/messages.js";
|
|
40
|
+
import { getPlatform } from "./utils/platform.js";
|
|
41
|
+
import { getBaseRenderOptions } from "./utils/renderOptions.js";
|
|
42
|
+
import { getSessionIngressAuthToken } from "./utils/sessionIngressAuth.js";
|
|
43
|
+
import { settingsChangeDetector } from "./utils/settings/changeDetector.js";
|
|
44
|
+
import { skillChangeDetector } from "./utils/skills/skillChangeDetector.js";
|
|
45
|
+
import { jsonParse, writeFileSync_DEPRECATED } from "./utils/slowOperations.js";
|
|
46
|
+
import { computeInitialTeamContext } from "./utils/swarm/reconnection.js";
|
|
47
|
+
import { initializeWarningHandler } from "./utils/warningHandler.js";
|
|
48
|
+
import { isWorktreeModeEnabled } from "./utils/worktreeModeEnabled.js";
|
|
49
|
+
const getTeammateUtils = () => require("./utils/teammate.js");
|
|
50
|
+
const getTeammatePromptAddendum = () => require("./utils/swarm/teammatePromptAddendum.js");
|
|
51
|
+
const getTeammateModeSnapshot = () => require("./utils/swarm/backends/teammateModeSnapshot.js");
|
|
52
|
+
const coordinatorModeModule = null;
|
|
53
|
+
const assistantModule = null;
|
|
54
|
+
const kairosGate = null;
|
|
55
|
+
import { relative, resolve } from "path";
|
|
56
|
+
import { isAnalyticsDisabled } from "./services/analytics/config.js";
|
|
57
|
+
import { getFeatureValue_CACHED_MAY_BE_STALE } from "./services/analytics/growthbook.js";
|
|
58
|
+
import { logEvent } from "./services/analytics/index.js";
|
|
59
|
+
import { initializeAnalyticsGates } from "./services/analytics/sink.js";
|
|
60
|
+
import { getOriginalCwd, setAdditionalDirectoriesForClaudeMd, setIsRemoteMode, setMainLoopModelOverride, setMainThreadAgentType, setTeleportedSessionInfo } from "./bootstrap/state.js";
|
|
61
|
+
import { filterCommandsForRemoteMode, getCommands } from "./commands.js";
|
|
62
|
+
import { launchAssistantInstallWizard, launchAssistantSessionChooser, launchInvalidSettingsDialog, launchResumeChooser, launchSnapshotUpdateDialog, launchTeleportRepoMismatchDialog, launchTeleportResumeWrapper } from "./dialogLaunchers.js";
|
|
63
|
+
import { SHOW_CURSOR } from "./ink/termio/dec.js";
|
|
64
|
+
import { exitWithError, exitWithMessage, getRenderContext, renderAndRun, showSetupScreens } from "./interactiveHelpers.js";
|
|
65
|
+
import { initBuiltinPlugins } from "./plugins/bundled/index.js";
|
|
66
|
+
import { checkQuotaStatus } from "./services/claudeAiLimits.js";
|
|
67
|
+
import { getMcpToolsCommandsAndResources, prefetchAllMcpResources } from "./services/mcp/client.js";
|
|
68
|
+
import { VALID_INSTALLABLE_SCOPES, VALID_UPDATE_SCOPES } from "./services/plugins/pluginCliCommands.js";
|
|
69
|
+
import { initBundledSkills } from "./skills/bundled/index.js";
|
|
70
|
+
import { getActiveAgentsFromList, getAgentDefinitionsWithOverrides, isBuiltInAgent, isCustomAgent, parseAgentsFromJson } from "./tools/AgentTool/loadAgentsDir.js";
|
|
71
|
+
import { assertMinVersion } from "./utils/autoUpdater.js";
|
|
72
|
+
import { CLAUDE_IN_CHROME_SKILL_HINT, CLAUDE_IN_CHROME_SKILL_HINT_WITH_WEBBROWSER } from "./utils/claudeInChrome/prompt.js";
|
|
73
|
+
import { setupClaudeInChrome, shouldAutoEnableClaudeInChrome, shouldEnableClaudeInChrome } from "./utils/claudeInChrome/setup.js";
|
|
74
|
+
import { getContextWindowForModel } from "./utils/context.js";
|
|
75
|
+
import { loadConversationForResume } from "./utils/conversationRecovery.js";
|
|
76
|
+
import { buildDeepLinkBanner } from "./utils/deepLink/banner.js";
|
|
77
|
+
import { hasNodeOption, isBareMode, isEnvTruthy, isInProtectedNamespace } from "./utils/envUtils.js";
|
|
78
|
+
import { refreshExampleCommands } from "./utils/exampleCommands.js";
|
|
79
|
+
import { getWorktreePaths } from "./utils/getWorktreePaths.js";
|
|
80
|
+
import { findGitRoot, getBranch, getIsGit, getWorktreeCount } from "./utils/git.js";
|
|
81
|
+
import { getGhAuthStatus } from "./utils/github/ghAuthStatus.js";
|
|
82
|
+
import { safeParseJSON } from "./utils/json.js";
|
|
83
|
+
import { logError } from "./utils/log.js";
|
|
84
|
+
import { getModelDeprecationWarning } from "./utils/model/deprecation.js";
|
|
85
|
+
import { getDefaultMainLoopModel, getUserSpecifiedModelSetting, normalizeModelStringForAPI, parseUserSpecifiedModel } from "./utils/model/model.js";
|
|
86
|
+
import { ensureModelStringsInitialized } from "./utils/model/modelStrings.js";
|
|
87
|
+
import { PERMISSION_MODES } from "./utils/permissions/PermissionMode.js";
|
|
88
|
+
import { checkAndDisableBypassPermissions, getAutoModeEnabledStateIfCached, initializeToolPermissionContext, initialPermissionModeFromCLI, isDefaultPermissionModeAuto, parseToolListFromCLI, removeDangerousPermissions, stripDangerousPermissionsForAutoMode, verifyAutoModeGateAccess } from "./utils/permissions/permissionSetup.js";
|
|
89
|
+
import { cleanupOrphanedPluginVersionsInBackground } from "./utils/plugins/cacheUtils.js";
|
|
90
|
+
import { initializeVersionedPlugins } from "./utils/plugins/installedPluginsManager.js";
|
|
91
|
+
import { getManagedPluginNames } from "./utils/plugins/managedPlugins.js";
|
|
92
|
+
import { getGlobExclusionsForPluginCache } from "./utils/plugins/orphanedPluginFilter.js";
|
|
93
|
+
import { getPluginSeedDirs } from "./utils/plugins/pluginDirectories.js";
|
|
94
|
+
import { countFilesRoundedRg } from "./utils/ripgrep.js";
|
|
95
|
+
import { processSessionStartHooks, processSetupHooks } from "./utils/sessionStart.js";
|
|
96
|
+
import { cacheSessionTitle, getSessionIdFromLog, loadTranscriptFromFile, saveAgentSetting, saveMode, searchSessionsByCustomTitle, sessionIdExists } from "./utils/sessionStorage.js";
|
|
97
|
+
import { ensureMdmSettingsLoaded } from "./utils/settings/mdm/settings.js";
|
|
98
|
+
import { getInitialSettings, getManagedSettingsKeysForLogging, getSettingsForSource, getSettingsWithErrors } from "./utils/settings/settings.js";
|
|
99
|
+
import { resetSettingsCache } from "./utils/settings/settingsCache.js";
|
|
100
|
+
import { DEFAULT_TASKS_MODE_TASK_LIST_ID, TASK_STATUSES } from "./utils/tasks.js";
|
|
101
|
+
import { logPluginLoadErrors, logPluginsEnabledForSession } from "./utils/telemetry/pluginTelemetry.js";
|
|
102
|
+
import { logSkillsLoaded } from "./utils/telemetry/skillLoadedEvent.js";
|
|
103
|
+
import { generateTempFilePath } from "./utils/tempfile.js";
|
|
104
|
+
import { validateUuid } from "./utils/uuid.js";
|
|
105
|
+
import { registerMcpAddCommand } from "./commands/mcp/addCommand.js";
|
|
106
|
+
import { registerMcpXaaIdpCommand } from "./commands/mcp/xaaIdpCommand.js";
|
|
107
|
+
import { logPermissionContextForAnts } from "./services/internalLogging.js";
|
|
108
|
+
import { fetchClaudeAIMcpConfigsIfEligible } from "./services/mcp/claudeai.js";
|
|
109
|
+
import { clearServerCache } from "./services/mcp/client.js";
|
|
110
|
+
import { areMcpConfigsAllowedWithEnterpriseMcpConfig, dedupClaudeAiMcpServers, doesEnterpriseMcpConfigExist, filterMcpServersByPolicy, getClaudeCodeMcpConfigs, getMcpServerSignature, parseMcpConfig, parseMcpConfigFromFilePath } from "./services/mcp/config.js";
|
|
111
|
+
import { excludeCommandsByServer, excludeResourcesByServer } from "./services/mcp/utils.js";
|
|
112
|
+
import { isXaaEnabled } from "./services/mcp/xaaIdpLogin.js";
|
|
113
|
+
import { getRelevantTips } from "./services/tips/tipRegistry.js";
|
|
114
|
+
import { logContextMetrics } from "./utils/api.js";
|
|
115
|
+
import { CLAUDE_IN_CHROME_MCP_SERVER_NAME, isClaudeInChromeMCPServer } from "./utils/claudeInChrome/common.js";
|
|
116
|
+
import { registerCleanup } from "./utils/cleanupRegistry.js";
|
|
117
|
+
import { eagerParseCliFlag } from "./utils/cliArgs.js";
|
|
118
|
+
import { createEmptyAttributionState } from "./utils/commitAttribution.js";
|
|
119
|
+
import { countConcurrentSessions, registerSession, updateSessionName } from "./utils/concurrentSessions.js";
|
|
120
|
+
import { getCwd } from "./utils/cwd.js";
|
|
121
|
+
import { logForDebugging, setHasFormattedOutput } from "./utils/debug.js";
|
|
122
|
+
import { errorMessage, getErrnoCode, isENOENT, TeleportOperationError, toError } from "./utils/errors.js";
|
|
123
|
+
import { getFsImplementation, safeResolvePath } from "./utils/fsOperations.js";
|
|
124
|
+
import { gracefulShutdown, gracefulShutdownSync } from "./utils/gracefulShutdown.js";
|
|
125
|
+
import { setAllHookEventsEnabled } from "./utils/hooks/hookEvents.js";
|
|
126
|
+
import { refreshModelCapabilities } from "./utils/model/modelCapabilities.js";
|
|
127
|
+
import { peekForStdinData, writeToStderr } from "./utils/process.js";
|
|
128
|
+
import { setCwd } from "./utils/Shell.js";
|
|
129
|
+
import { processResumedConversation } from "./utils/sessionRestore.js";
|
|
130
|
+
import { parseSettingSourcesFlag } from "./utils/settings/constants.js";
|
|
131
|
+
import { plural } from "./utils/stringUtils.js";
|
|
132
|
+
import { getInitialMainLoopModel, getIsNonInteractiveSession, getSdkBetas, getSessionId, getUserMsgOptIn, setAllowedChannels, setAllowedSettingSources, setChromeFlagOverride, setClientType, setCwdState, setDirectConnectServerUrl, setFlagSettingsPath, setInitialMainLoopModel, setInlinePlugins, setIsInteractive, setKairosActive, setOriginalCwd, setProjectRoot, setQuestionPreviewFormat, setSdkBetas, setSessionBypassPermissionsMode, setSessionPersistenceDisabled, setSessionSource, setUserMsgOptIn, switchSession } from "./bootstrap/state.js";
|
|
133
|
+
const autoModeStateModule = null;
|
|
134
|
+
import { migrateAutoUpdatesToSettings } from "./migrations/migrateAutoUpdatesToSettings.js";
|
|
135
|
+
import { migrateBypassPermissionsAcceptedToSettings } from "./migrations/migrateBypassPermissionsAcceptedToSettings.js";
|
|
136
|
+
import { migrateEnableAllProjectMcpServersToSettings } from "./migrations/migrateEnableAllProjectMcpServersToSettings.js";
|
|
137
|
+
import { migrateFennecToOpus } from "./migrations/migrateFennecToOpus.js";
|
|
138
|
+
import { migrateLegacyOpusToCurrent } from "./migrations/migrateLegacyOpusToCurrent.js";
|
|
139
|
+
import { migrateOpusToOpus1m } from "./migrations/migrateOpusToOpus1m.js";
|
|
140
|
+
import { migrateReplBridgeEnabledToRemoteControlAtStartup } from "./migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js";
|
|
141
|
+
import { migrateSonnet1mToSonnet45 } from "./migrations/migrateSonnet1mToSonnet45.js";
|
|
142
|
+
import { migrateSonnet45ToSonnet46 } from "./migrations/migrateSonnet45ToSonnet46.js";
|
|
143
|
+
import { resetAutoModeOptInForDefaultOffer } from "./migrations/resetAutoModeOptInForDefaultOffer.js";
|
|
144
|
+
import { resetProToOpusDefault } from "./migrations/resetProToOpusDefault.js";
|
|
145
|
+
import { createRemoteSessionConfig } from "./remote/RemoteSessionManager.js";
|
|
146
|
+
import { createDirectConnectSession, DirectConnectError } from "./server/createDirectConnectSession.js";
|
|
147
|
+
import { initializeLspServerManager } from "./services/lsp/manager.js";
|
|
148
|
+
import { shouldEnablePromptSuggestion } from "./services/PromptSuggestion/promptSuggestion.js";
|
|
149
|
+
import { getDefaultAppState, IDLE_SPECULATION_STATE } from "./state/AppStateStore.js";
|
|
150
|
+
import { onChangeAppState } from "./state/onChangeAppState.js";
|
|
151
|
+
import { createStore } from "./state/store.js";
|
|
152
|
+
import { asSessionId } from "./types/ids.js";
|
|
153
|
+
import { filterAllowedSdkBetas } from "./utils/betas.js";
|
|
154
|
+
import { isInBundledMode, isRunningWithBun } from "./utils/bundledMode.js";
|
|
155
|
+
import { logForDiagnosticsNoPII } from "./utils/diagLogs.js";
|
|
156
|
+
import { filterExistingPaths, getKnownPathsForRepo } from "./utils/githubRepoPathMapping.js";
|
|
157
|
+
import { clearPluginCache, loadAllPluginsCacheOnly } from "./utils/plugins/pluginLoader.js";
|
|
158
|
+
import { migrateChangelogFromConfig } from "./utils/releaseNotes.js";
|
|
159
|
+
import { SandboxManager } from "./utils/sandbox/sandbox-adapter.js";
|
|
160
|
+
import { fetchSession, prepareApiRequest } from "./utils/teleport/api.js";
|
|
161
|
+
import { checkOutTeleportedSessionBranch, processMessagesForTeleportResume, teleportToRemoteWithErrorHandling, validateGitState, validateSessionRepository } from "./utils/teleport.js";
|
|
162
|
+
import { shouldEnableThinkingByDefault } from "./utils/thinking.js";
|
|
163
|
+
import { initUser, resetUserCache } from "./utils/user.js";
|
|
164
|
+
import { getTmuxInstallInstructions, isTmuxAvailable, parsePRReference } from "./utils/worktree.js";
|
|
165
|
+
profileCheckpoint("main_tsx_imports_loaded");
|
|
166
|
+
function logManagedSettings() {
|
|
167
|
+
try {
|
|
168
|
+
const policySettings = getSettingsForSource("policySettings");
|
|
169
|
+
if (policySettings) {
|
|
170
|
+
const allKeys = getManagedSettingsKeysForLogging(policySettings);
|
|
171
|
+
logEvent("tengu_managed_settings_loaded", {
|
|
172
|
+
keyCount: allKeys.length,
|
|
173
|
+
keys: allKeys.join(",")
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
} catch {}
|
|
177
|
+
}
|
|
178
|
+
function isBeingDebugged() {
|
|
179
|
+
const isBun = isRunningWithBun();
|
|
180
|
+
const hasInspectArg = process.execArgv.some((arg) => {
|
|
181
|
+
if (isBun) {
|
|
182
|
+
return /--inspect(-brk)?/.test(arg);
|
|
183
|
+
} else {
|
|
184
|
+
return /--inspect(-brk)?|--debug(-brk)?/.test(arg);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
const hasInspectEnv = process.env.NODE_OPTIONS && /--inspect(-brk)?|--debug(-brk)?/.test(process.env.NODE_OPTIONS);
|
|
188
|
+
try {
|
|
189
|
+
const inspector = global.require("inspector");
|
|
190
|
+
const hasInspectorUrl = !!inspector.url();
|
|
191
|
+
return hasInspectorUrl || hasInspectArg || hasInspectEnv;
|
|
192
|
+
} catch {
|
|
193
|
+
return hasInspectArg || hasInspectEnv;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (isBeingDebugged()) {
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
function logSessionTelemetry() {
|
|
200
|
+
const model = parseUserSpecifiedModel(getInitialMainLoopModel() ?? getDefaultMainLoopModel());
|
|
201
|
+
logSkillsLoaded(getCwd(), getContextWindowForModel(model, getSdkBetas()));
|
|
202
|
+
loadAllPluginsCacheOnly().then(({
|
|
203
|
+
enabled,
|
|
204
|
+
errors
|
|
205
|
+
}) => {
|
|
206
|
+
const managedNames = getManagedPluginNames();
|
|
207
|
+
logPluginsEnabledForSession(enabled, managedNames, getPluginSeedDirs());
|
|
208
|
+
logPluginLoadErrors(errors, managedNames);
|
|
209
|
+
}).catch((err) => logError(err));
|
|
210
|
+
}
|
|
211
|
+
function getCertEnvVarTelemetry() {
|
|
212
|
+
const result = {};
|
|
213
|
+
if (process.env.NODE_EXTRA_CA_CERTS) {
|
|
214
|
+
result.has_node_extra_ca_certs = true;
|
|
215
|
+
}
|
|
216
|
+
if (process.env.CLAUDE_CODE_CLIENT_CERT) {
|
|
217
|
+
result.has_client_cert = true;
|
|
218
|
+
}
|
|
219
|
+
if (hasNodeOption("--use-system-ca")) {
|
|
220
|
+
result.has_use_system_ca = true;
|
|
221
|
+
}
|
|
222
|
+
if (hasNodeOption("--use-openssl-ca")) {
|
|
223
|
+
result.has_use_openssl_ca = true;
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
227
|
+
async function logStartupTelemetry() {
|
|
228
|
+
if (isAnalyticsDisabled())
|
|
229
|
+
return;
|
|
230
|
+
const [isGit, worktreeCount, ghAuthStatus] = await Promise.all([getIsGit(), getWorktreeCount(), getGhAuthStatus()]);
|
|
231
|
+
logEvent("tengu_startup_telemetry", {
|
|
232
|
+
is_git: isGit,
|
|
233
|
+
worktree_count: worktreeCount,
|
|
234
|
+
gh_auth_status: ghAuthStatus,
|
|
235
|
+
sandbox_enabled: SandboxManager.isSandboxingEnabled(),
|
|
236
|
+
are_unsandboxed_commands_allowed: SandboxManager.areUnsandboxedCommandsAllowed(),
|
|
237
|
+
is_auto_bash_allowed_if_sandbox_enabled: SandboxManager.isAutoAllowBashIfSandboxedEnabled(),
|
|
238
|
+
auto_updater_disabled: isAutoUpdaterDisabled(),
|
|
239
|
+
prefers_reduced_motion: getInitialSettings().prefersReducedMotion ?? false,
|
|
240
|
+
...getCertEnvVarTelemetry()
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
const CURRENT_MIGRATION_VERSION = 11;
|
|
244
|
+
function runMigrations() {
|
|
245
|
+
if (getGlobalConfig().migrationVersion !== CURRENT_MIGRATION_VERSION) {
|
|
246
|
+
migrateAutoUpdatesToSettings();
|
|
247
|
+
migrateBypassPermissionsAcceptedToSettings();
|
|
248
|
+
migrateEnableAllProjectMcpServersToSettings();
|
|
249
|
+
resetProToOpusDefault();
|
|
250
|
+
migrateSonnet1mToSonnet45();
|
|
251
|
+
migrateLegacyOpusToCurrent();
|
|
252
|
+
migrateSonnet45ToSonnet46();
|
|
253
|
+
migrateOpusToOpus1m();
|
|
254
|
+
migrateReplBridgeEnabledToRemoteControlAtStartup();
|
|
255
|
+
if (false) {}
|
|
256
|
+
if (false) {}
|
|
257
|
+
saveGlobalConfig((prev) => prev.migrationVersion === CURRENT_MIGRATION_VERSION ? prev : {
|
|
258
|
+
...prev,
|
|
259
|
+
migrationVersion: CURRENT_MIGRATION_VERSION
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
migrateChangelogFromConfig().catch(() => {});
|
|
263
|
+
}
|
|
264
|
+
function prefetchSystemContextIfSafe() {
|
|
265
|
+
const isNonInteractiveSession = getIsNonInteractiveSession();
|
|
266
|
+
if (isNonInteractiveSession) {
|
|
267
|
+
logForDiagnosticsNoPII("info", "prefetch_system_context_non_interactive");
|
|
268
|
+
getSystemContext();
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const hasTrust = checkHasTrustDialogAccepted();
|
|
272
|
+
if (hasTrust) {
|
|
273
|
+
logForDiagnosticsNoPII("info", "prefetch_system_context_has_trust");
|
|
274
|
+
getSystemContext();
|
|
275
|
+
} else {
|
|
276
|
+
logForDiagnosticsNoPII("info", "prefetch_system_context_skipped_no_trust");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
export function startDeferredPrefetches() {
|
|
280
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER) || isBareMode()) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
initUser();
|
|
284
|
+
getUserContext();
|
|
285
|
+
prefetchSystemContextIfSafe();
|
|
286
|
+
getRelevantTips();
|
|
287
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) && !isEnvTruthy(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)) {
|
|
288
|
+
prefetchAwsCredentialsAndBedRockInfoIfSafe();
|
|
289
|
+
}
|
|
290
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) && !isEnvTruthy(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)) {
|
|
291
|
+
prefetchGcpCredentialsIfSafe();
|
|
292
|
+
}
|
|
293
|
+
countFilesRoundedRg(getCwd(), AbortSignal.timeout(3000), []);
|
|
294
|
+
initializeAnalyticsGates();
|
|
295
|
+
prefetchOfficialMcpUrls();
|
|
296
|
+
refreshModelCapabilities();
|
|
297
|
+
settingsChangeDetector.initialize();
|
|
298
|
+
if (!isBareMode()) {
|
|
299
|
+
skillChangeDetector.initialize();
|
|
300
|
+
}
|
|
301
|
+
if (false) {}
|
|
302
|
+
}
|
|
303
|
+
function loadSettingsFromFlag(settingsFile) {
|
|
304
|
+
try {
|
|
305
|
+
const trimmedSettings = settingsFile.trim();
|
|
306
|
+
const looksLikeJson = trimmedSettings.startsWith("{") && trimmedSettings.endsWith("}");
|
|
307
|
+
let settingsPath;
|
|
308
|
+
if (looksLikeJson) {
|
|
309
|
+
const parsedJson = safeParseJSON(trimmedSettings);
|
|
310
|
+
if (!parsedJson) {
|
|
311
|
+
process.stderr.write(chalk.red(`Error: Invalid JSON provided to --settings
|
|
312
|
+
`));
|
|
313
|
+
process.exit(1);
|
|
314
|
+
}
|
|
315
|
+
settingsPath = generateTempFilePath("claude-settings", ".json", {
|
|
316
|
+
contentHash: trimmedSettings
|
|
317
|
+
});
|
|
318
|
+
writeFileSync_DEPRECATED(settingsPath, trimmedSettings, "utf8");
|
|
319
|
+
} else {
|
|
320
|
+
const {
|
|
321
|
+
resolvedPath: resolvedSettingsPath
|
|
322
|
+
} = safeResolvePath(getFsImplementation(), settingsFile);
|
|
323
|
+
try {
|
|
324
|
+
readFileSync(resolvedSettingsPath, "utf8");
|
|
325
|
+
} catch (e) {
|
|
326
|
+
if (isENOENT(e)) {
|
|
327
|
+
process.stderr.write(chalk.red(`Error: Settings file not found: ${resolvedSettingsPath}
|
|
328
|
+
`));
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
throw e;
|
|
332
|
+
}
|
|
333
|
+
settingsPath = resolvedSettingsPath;
|
|
334
|
+
}
|
|
335
|
+
setFlagSettingsPath(settingsPath);
|
|
336
|
+
resetSettingsCache();
|
|
337
|
+
} catch (error) {
|
|
338
|
+
if (error instanceof Error) {
|
|
339
|
+
logError(error);
|
|
340
|
+
}
|
|
341
|
+
process.stderr.write(chalk.red(`Error processing settings: ${errorMessage(error)}
|
|
342
|
+
`));
|
|
343
|
+
process.exit(1);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
function loadSettingSourcesFromFlag(settingSourcesArg) {
|
|
347
|
+
try {
|
|
348
|
+
const sources = parseSettingSourcesFlag(settingSourcesArg);
|
|
349
|
+
setAllowedSettingSources(sources);
|
|
350
|
+
resetSettingsCache();
|
|
351
|
+
} catch (error) {
|
|
352
|
+
if (error instanceof Error) {
|
|
353
|
+
logError(error);
|
|
354
|
+
}
|
|
355
|
+
process.stderr.write(chalk.red(`Error processing --setting-sources: ${errorMessage(error)}
|
|
356
|
+
`));
|
|
357
|
+
process.exit(1);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function eagerLoadSettings() {
|
|
361
|
+
profileCheckpoint("eagerLoadSettings_start");
|
|
362
|
+
const settingsFile = eagerParseCliFlag("--settings");
|
|
363
|
+
if (settingsFile) {
|
|
364
|
+
loadSettingsFromFlag(settingsFile);
|
|
365
|
+
}
|
|
366
|
+
const settingSourcesArg = eagerParseCliFlag("--setting-sources");
|
|
367
|
+
if (settingSourcesArg !== undefined) {
|
|
368
|
+
loadSettingSourcesFromFlag(settingSourcesArg);
|
|
369
|
+
}
|
|
370
|
+
profileCheckpoint("eagerLoadSettings_end");
|
|
371
|
+
}
|
|
372
|
+
function initializeEntrypoint(isNonInteractive) {
|
|
373
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const cliArgs = process.argv.slice(2);
|
|
377
|
+
const mcpIndex = cliArgs.indexOf("mcp");
|
|
378
|
+
if (mcpIndex !== -1 && cliArgs[mcpIndex + 1] === "serve") {
|
|
379
|
+
process.env.CLAUDE_CODE_ENTRYPOINT = "mcp";
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_ACTION)) {
|
|
383
|
+
process.env.CLAUDE_CODE_ENTRYPOINT = "claude-code-github-action";
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
process.env.CLAUDE_CODE_ENTRYPOINT = isNonInteractive ? "sdk-cli" : "cli";
|
|
387
|
+
}
|
|
388
|
+
const _pendingConnect = undefined;
|
|
389
|
+
const _pendingAssistantChat = undefined;
|
|
390
|
+
const _pendingSSH = undefined;
|
|
391
|
+
export async function main() {
|
|
392
|
+
profileCheckpoint("main_function_start");
|
|
393
|
+
process.env.NoDefaultCurrentDirectoryInExePath = "1";
|
|
394
|
+
initializeWarningHandler();
|
|
395
|
+
process.on("exit", () => {
|
|
396
|
+
resetCursor();
|
|
397
|
+
});
|
|
398
|
+
process.on("SIGINT", () => {
|
|
399
|
+
if (process.argv.includes("-p") || process.argv.includes("--print")) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
process.exit(0);
|
|
403
|
+
});
|
|
404
|
+
profileCheckpoint("main_warning_handler_initialized");
|
|
405
|
+
if (false) {}
|
|
406
|
+
if (false) {}
|
|
407
|
+
if (false) {}
|
|
408
|
+
if (false) {}
|
|
409
|
+
const cliArgs = process.argv.slice(2);
|
|
410
|
+
const hasPrintFlag = cliArgs.includes("-p") || cliArgs.includes("--print");
|
|
411
|
+
const hasInitOnlyFlag = cliArgs.includes("--init-only");
|
|
412
|
+
const hasSdkUrl = cliArgs.some((arg) => arg.startsWith("--sdk-url"));
|
|
413
|
+
const isNonInteractive = hasPrintFlag || hasInitOnlyFlag || hasSdkUrl || !process.stdout.isTTY;
|
|
414
|
+
if (isNonInteractive) {
|
|
415
|
+
stopCapturingEarlyInput();
|
|
416
|
+
}
|
|
417
|
+
const isInteractive = !isNonInteractive;
|
|
418
|
+
setIsInteractive(isInteractive);
|
|
419
|
+
initializeEntrypoint(isNonInteractive);
|
|
420
|
+
const clientType = (() => {
|
|
421
|
+
if (isEnvTruthy(process.env.GITHUB_ACTIONS))
|
|
422
|
+
return "github-action";
|
|
423
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT === "sdk-ts")
|
|
424
|
+
return "sdk-typescript";
|
|
425
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT === "sdk-py")
|
|
426
|
+
return "sdk-python";
|
|
427
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT === "sdk-cli")
|
|
428
|
+
return "sdk-cli";
|
|
429
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT === "claude-vscode")
|
|
430
|
+
return "claude-vscode";
|
|
431
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT === "local-agent")
|
|
432
|
+
return "local-agent";
|
|
433
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop")
|
|
434
|
+
return "claude-desktop";
|
|
435
|
+
const hasSessionIngressToken = process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN || process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;
|
|
436
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT === "remote" || hasSessionIngressToken) {
|
|
437
|
+
return "remote";
|
|
438
|
+
}
|
|
439
|
+
return "cli";
|
|
440
|
+
})();
|
|
441
|
+
setClientType(clientType);
|
|
442
|
+
const previewFormat = process.env.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT;
|
|
443
|
+
if (previewFormat === "markdown" || previewFormat === "html") {
|
|
444
|
+
setQuestionPreviewFormat(previewFormat);
|
|
445
|
+
} else if (!clientType.startsWith("sdk-") && clientType !== "claude-desktop" && clientType !== "local-agent" && clientType !== "remote") {
|
|
446
|
+
setQuestionPreviewFormat("markdown");
|
|
447
|
+
}
|
|
448
|
+
if (process.env.CLAUDE_CODE_ENVIRONMENT_KIND === "bridge") {
|
|
449
|
+
setSessionSource("remote-control");
|
|
450
|
+
}
|
|
451
|
+
profileCheckpoint("main_client_type_determined");
|
|
452
|
+
eagerLoadSettings();
|
|
453
|
+
profileCheckpoint("main_before_run");
|
|
454
|
+
await run();
|
|
455
|
+
profileCheckpoint("main_after_run");
|
|
456
|
+
}
|
|
457
|
+
async function getInputPrompt(prompt, inputFormat) {
|
|
458
|
+
if (!process.stdin.isTTY && !process.argv.includes("mcp")) {
|
|
459
|
+
if (inputFormat === "stream-json") {
|
|
460
|
+
return process.stdin;
|
|
461
|
+
}
|
|
462
|
+
process.stdin.setEncoding("utf8");
|
|
463
|
+
let data = "";
|
|
464
|
+
const onData = (chunk) => {
|
|
465
|
+
data += chunk;
|
|
466
|
+
};
|
|
467
|
+
process.stdin.on("data", onData);
|
|
468
|
+
const timedOut = await peekForStdinData(process.stdin, 3000);
|
|
469
|
+
process.stdin.off("data", onData);
|
|
470
|
+
if (timedOut) {
|
|
471
|
+
process.stderr.write(`Warning: no stdin data received in 3s, proceeding without it. If piping from a slow command, redirect stdin explicitly: < /dev/null to skip, or wait longer.
|
|
472
|
+
`);
|
|
473
|
+
}
|
|
474
|
+
return [prompt, data].filter(Boolean).join(`
|
|
475
|
+
`);
|
|
476
|
+
}
|
|
477
|
+
return prompt;
|
|
478
|
+
}
|
|
479
|
+
async function run() {
|
|
480
|
+
profileCheckpoint("run_function_start");
|
|
481
|
+
function createSortedHelpConfig() {
|
|
482
|
+
const getOptionSortKey = (opt) => opt.long?.replace(/^--/, "") ?? opt.short?.replace(/^-/, "") ?? "";
|
|
483
|
+
return Object.assign({
|
|
484
|
+
sortSubcommands: true,
|
|
485
|
+
sortOptions: true
|
|
486
|
+
}, {
|
|
487
|
+
compareOptions: (a, b) => getOptionSortKey(a).localeCompare(getOptionSortKey(b))
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
const program = new CommanderCommand().configureHelp(createSortedHelpConfig()).enablePositionalOptions();
|
|
491
|
+
profileCheckpoint("run_commander_initialized");
|
|
492
|
+
program.hook("preAction", async (thisCommand) => {
|
|
493
|
+
profileCheckpoint("preAction_start");
|
|
494
|
+
await Promise.all([ensureMdmSettingsLoaded(), ensureKeychainPrefetchCompleted()]);
|
|
495
|
+
profileCheckpoint("preAction_after_mdm");
|
|
496
|
+
await init();
|
|
497
|
+
profileCheckpoint("preAction_after_init");
|
|
498
|
+
if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)) {
|
|
499
|
+
process.title = "claude";
|
|
500
|
+
}
|
|
501
|
+
const {
|
|
502
|
+
initSinks
|
|
503
|
+
} = await import("./utils/sinks.js");
|
|
504
|
+
initSinks();
|
|
505
|
+
profileCheckpoint("preAction_after_sinks");
|
|
506
|
+
const pluginDir = thisCommand.getOptionValue("pluginDir");
|
|
507
|
+
if (Array.isArray(pluginDir) && pluginDir.length > 0 && pluginDir.every((p) => typeof p === "string")) {
|
|
508
|
+
setInlinePlugins(pluginDir);
|
|
509
|
+
clearPluginCache("preAction: --plugin-dir inline plugins");
|
|
510
|
+
}
|
|
511
|
+
runMigrations();
|
|
512
|
+
profileCheckpoint("preAction_after_migrations");
|
|
513
|
+
loadRemoteManagedSettings();
|
|
514
|
+
loadPolicyLimits();
|
|
515
|
+
profileCheckpoint("preAction_after_remote_settings");
|
|
516
|
+
if (false) {}
|
|
517
|
+
profileCheckpoint("preAction_after_settings_sync");
|
|
518
|
+
});
|
|
519
|
+
program.name("lcclaude").description(`Claude Code - starts an interactive session by default, use -p/--print for non-interactive output`).argument("[prompt]", "Your prompt", String).helpOption("-h, --help", "Display help for command").option("-d, --debug [filter]", 'Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")', (_value) => {
|
|
520
|
+
return true;
|
|
521
|
+
}).addOption(new Option("--debug-to-stderr", "Enable debug mode (to stderr)").argParser(Boolean).hideHelp()).option("--debug-file <path>", "Write debug logs to a specific file path (implicitly enables debug mode)", () => true).option("--verbose", "Override verbose mode setting from config", () => true).option("-p, --print", "Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.", () => true).option("--bare", "Minimal mode: skip hooks, LSP, plugin sync, attribution, auto-memory, background prefetches, keychain reads, and CLAUDE.md auto-discovery. Sets CLAUDE_CODE_SIMPLE=1. Anthropic auth is strictly ANTHROPIC_API_KEY or apiKeyHelper via --settings (OAuth and keychain are never read). 3P providers (Bedrock/Vertex/Foundry) use their own credentials. Skills still resolve via /skill-name. Explicitly provide context via: --system-prompt[-file], --append-system-prompt[-file], --add-dir (CLAUDE.md dirs), --mcp-config, --settings, --agents, --plugin-dir.", () => true).addOption(new Option("--init", "Run Setup hooks with init trigger, then continue").hideHelp()).addOption(new Option("--init-only", "Run Setup and SessionStart:startup hooks, then exit").hideHelp()).addOption(new Option("--maintenance", "Run Setup hooks with maintenance trigger, then continue").hideHelp()).addOption(new Option("--output-format <format>", 'Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming)').choices(["text", "json", "stream-json"])).addOption(new Option("--json-schema <schema>", 'JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}').argParser(String)).option("--include-hook-events", "Include all hook lifecycle events in the output stream (only works with --output-format=stream-json)", () => true).option("--include-partial-messages", "Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)", () => true).addOption(new Option("--input-format <format>", 'Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input)').choices(["text", "stream-json"])).option("--mcp-debug", "[DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)", () => true).option("--dangerously-skip-permissions", "Bypass all permission checks. Recommended only for sandboxes with no internet access.", () => true).option("--allow-dangerously-skip-permissions", "Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.", () => true).addOption(new Option("--thinking <mode>", "Thinking mode: enabled (equivalent to adaptive), disabled").choices(["enabled", "adaptive", "disabled"]).hideHelp()).addOption(new Option("--max-thinking-tokens <tokens>", "[DEPRECATED. Use --thinking instead for newer models] Maximum number of thinking tokens (only works with --print)").argParser(Number).hideHelp()).addOption(new Option("--max-turns <turns>", "Maximum number of agentic turns in non-interactive mode. This will early exit the conversation after the specified number of turns. (only works with --print)").argParser(Number).hideHelp()).addOption(new Option("--max-budget-usd <amount>", "Maximum dollar amount to spend on API calls (only works with --print)").argParser((value) => {
|
|
522
|
+
const amount = Number(value);
|
|
523
|
+
if (isNaN(amount) || amount <= 0) {
|
|
524
|
+
throw new Error("--max-budget-usd must be a positive number greater than 0");
|
|
525
|
+
}
|
|
526
|
+
return amount;
|
|
527
|
+
})).addOption(new Option("--task-budget <tokens>", "API-side task budget in tokens (output_config.task_budget)").argParser((value) => {
|
|
528
|
+
const tokens = Number(value);
|
|
529
|
+
if (isNaN(tokens) || tokens <= 0 || !Number.isInteger(tokens)) {
|
|
530
|
+
throw new Error("--task-budget must be a positive integer");
|
|
531
|
+
}
|
|
532
|
+
return tokens;
|
|
533
|
+
}).hideHelp()).option("--replay-user-messages", "Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)", () => true).addOption(new Option("--enable-auth-status", "Enable auth status messages in SDK mode").default(false).hideHelp()).option("--allowedTools, --allowed-tools <tools...>", 'Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")').option("--tools <tools...>", 'Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").').option("--disallowedTools, --disallowed-tools <tools...>", 'Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")').option("--mcp-config <configs...>", "Load MCP servers from JSON files or strings (space-separated)").addOption(new Option("--permission-prompt-tool <tool>", "MCP tool to use for permission prompts (only works with --print)").argParser(String).hideHelp()).addOption(new Option("--system-prompt <prompt>", "System prompt to use for the session").argParser(String)).addOption(new Option("--system-prompt-file <file>", "Read system prompt from a file").argParser(String).hideHelp()).addOption(new Option("--append-system-prompt <prompt>", "Append a system prompt to the default system prompt").argParser(String)).addOption(new Option("--append-system-prompt-file <file>", "Read system prompt from a file and append to the default system prompt").argParser(String).hideHelp()).addOption(new Option("--permission-mode <mode>", "Permission mode to use for the session").argParser(String).choices(PERMISSION_MODES)).option("-c, --continue", "Continue the most recent conversation in the current directory", () => true).option("-r, --resume [value]", "Resume a conversation by session ID, or open interactive picker with optional search term", (value) => value || true).option("--fork-session", "When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)", () => true).addOption(new Option("--prefill <text>", "Pre-fill the prompt input with text without submitting it").hideHelp()).addOption(new Option("--deep-link-origin", "Signal that this session was launched from a deep link").hideHelp()).addOption(new Option("--deep-link-repo <slug>", "Repo slug the deep link ?repo= parameter resolved to the current cwd").hideHelp()).addOption(new Option("--deep-link-last-fetch <ms>", "FETCH_HEAD mtime in epoch ms, precomputed by the deep link trampoline").argParser((v) => {
|
|
534
|
+
const n = Number(v);
|
|
535
|
+
return Number.isFinite(n) ? n : undefined;
|
|
536
|
+
}).hideHelp()).option("--from-pr [value]", "Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term", (value) => value || true).option("--no-session-persistence", "Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)").addOption(new Option("--resume-session-at <message id>", "When resuming, only messages up to and including the assistant message with <message.id> (use with --resume in print mode)").argParser(String).hideHelp()).addOption(new Option("--rewind-files <user-message-id>", "Restore files to state at the specified user message and exit (requires --resume)").hideHelp()).option("--model <model>", `Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').`).addOption(new Option("--effort <level>", `Effort level for the current session (low, medium, high, max)`).argParser((rawValue) => {
|
|
537
|
+
const value = rawValue.toLowerCase();
|
|
538
|
+
const allowed = ["low", "medium", "high", "max"];
|
|
539
|
+
if (!allowed.includes(value)) {
|
|
540
|
+
throw new InvalidArgumentError(`It must be one of: ${allowed.join(", ")}`);
|
|
541
|
+
}
|
|
542
|
+
return value;
|
|
543
|
+
})).option("--agent <agent>", `Agent for the current session. Overrides the 'agent' setting.`).option("--betas <betas...>", "Beta headers to include in API requests (API key users only)").option("--fallback-model <model>", "Enable automatic fallback to specified model when default model is overloaded (only works with --print)").addOption(new Option("--workload <tag>", "Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)").hideHelp()).option("--settings <file-or-json>", "Path to a settings JSON file or a JSON string to load additional settings from").option("--add-dir <directories...>", "Additional directories to allow tool access to").option("--ide", "Automatically connect to IDE on startup if exactly one valid IDE is available", () => true).option("--strict-mcp-config", "Only use MCP servers from --mcp-config, ignoring all other MCP configurations", () => true).option("--session-id <uuid>", "Use a specific session ID for the conversation (must be a valid UUID)").option("-n, --name <name>", "Set a display name for this session (shown in /resume and terminal title)").option("--agents <json>", `JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option("--setting-sources <sources>", "Comma-separated list of setting sources to load (user, project, local).").option("--plugin-dir <path>", "Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)", (val, prev) => [...prev, val], []).option("--disable-slash-commands", "Disable all skills", () => true).option("--chrome", "Enable Claude in Chrome integration").option("--no-chrome", "Disable Claude in Chrome integration").option("--file <specs...>", "File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)").action(async (prompt, options) => {
|
|
544
|
+
profileCheckpoint("action_handler_start");
|
|
545
|
+
if (options.bare) {
|
|
546
|
+
process.env.CLAUDE_CODE_SIMPLE = "1";
|
|
547
|
+
}
|
|
548
|
+
if (prompt === "code") {
|
|
549
|
+
logEvent("tengu_code_prompt_ignored", {});
|
|
550
|
+
console.warn(chalk.yellow("Tip: You can launch Claude Code with just `lcclaude`"));
|
|
551
|
+
prompt = undefined;
|
|
552
|
+
}
|
|
553
|
+
if (prompt && typeof prompt === "string" && !/\s/.test(prompt) && prompt.length > 0) {
|
|
554
|
+
logEvent("tengu_single_word_prompt", {
|
|
555
|
+
length: prompt.length
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
let kairosEnabled = false;
|
|
559
|
+
let assistantTeamContext;
|
|
560
|
+
if (false) {}
|
|
561
|
+
if (false) {}
|
|
562
|
+
const {
|
|
563
|
+
debug = false,
|
|
564
|
+
debugToStderr = false,
|
|
565
|
+
dangerouslySkipPermissions,
|
|
566
|
+
allowDangerouslySkipPermissions = false,
|
|
567
|
+
tools: baseTools = [],
|
|
568
|
+
allowedTools = [],
|
|
569
|
+
disallowedTools = [],
|
|
570
|
+
mcpConfig = [],
|
|
571
|
+
permissionMode: permissionModeCli,
|
|
572
|
+
addDir = [],
|
|
573
|
+
fallbackModel,
|
|
574
|
+
betas = [],
|
|
575
|
+
ide = false,
|
|
576
|
+
sessionId,
|
|
577
|
+
includeHookEvents,
|
|
578
|
+
includePartialMessages
|
|
579
|
+
} = options;
|
|
580
|
+
if (options.prefill) {
|
|
581
|
+
seedEarlyInput(options.prefill);
|
|
582
|
+
}
|
|
583
|
+
let fileDownloadPromise;
|
|
584
|
+
const agentsJson = options.agents;
|
|
585
|
+
const agentCli = options.agent;
|
|
586
|
+
if (false) {}
|
|
587
|
+
let outputFormat = options.outputFormat;
|
|
588
|
+
let inputFormat = options.inputFormat;
|
|
589
|
+
let verbose = options.verbose ?? getGlobalConfig().verbose;
|
|
590
|
+
let print = options.print;
|
|
591
|
+
const init = options.init ?? false;
|
|
592
|
+
const initOnly = options.initOnly ?? false;
|
|
593
|
+
const maintenance = options.maintenance ?? false;
|
|
594
|
+
const disableSlashCommands = options.disableSlashCommands || false;
|
|
595
|
+
const tasksOption = false;
|
|
596
|
+
const taskListId = tasksOption ? typeof tasksOption === "string" ? tasksOption : DEFAULT_TASKS_MODE_TASK_LIST_ID : undefined;
|
|
597
|
+
if (false) {}
|
|
598
|
+
const worktreeOption = isWorktreeModeEnabled() ? options.worktree : undefined;
|
|
599
|
+
let worktreeName = typeof worktreeOption === "string" ? worktreeOption : undefined;
|
|
600
|
+
const worktreeEnabled = worktreeOption !== undefined;
|
|
601
|
+
let worktreePRNumber;
|
|
602
|
+
if (worktreeName) {
|
|
603
|
+
const prNum = parsePRReference(worktreeName);
|
|
604
|
+
if (prNum !== null) {
|
|
605
|
+
worktreePRNumber = prNum;
|
|
606
|
+
worktreeName = undefined;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
const tmuxEnabled = isWorktreeModeEnabled() && options.tmux === true;
|
|
610
|
+
if (tmuxEnabled) {
|
|
611
|
+
if (!worktreeEnabled) {
|
|
612
|
+
process.stderr.write(chalk.red(`Error: --tmux requires --worktree
|
|
613
|
+
`));
|
|
614
|
+
process.exit(1);
|
|
615
|
+
}
|
|
616
|
+
if (getPlatform() === "windows") {
|
|
617
|
+
process.stderr.write(chalk.red(`Error: --tmux is not supported on Windows
|
|
618
|
+
`));
|
|
619
|
+
process.exit(1);
|
|
620
|
+
}
|
|
621
|
+
if (!await isTmuxAvailable()) {
|
|
622
|
+
process.stderr.write(chalk.red(`Error: tmux is not installed.
|
|
623
|
+
${getTmuxInstallInstructions()}
|
|
624
|
+
`));
|
|
625
|
+
process.exit(1);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
let storedTeammateOpts;
|
|
629
|
+
if (isAgentSwarmsEnabled()) {
|
|
630
|
+
const teammateOpts = extractTeammateOptions(options);
|
|
631
|
+
storedTeammateOpts = teammateOpts;
|
|
632
|
+
const hasAnyTeammateOpt = teammateOpts.agentId || teammateOpts.agentName || teammateOpts.teamName;
|
|
633
|
+
const hasAllRequiredTeammateOpts = teammateOpts.agentId && teammateOpts.agentName && teammateOpts.teamName;
|
|
634
|
+
if (hasAnyTeammateOpt && !hasAllRequiredTeammateOpts) {
|
|
635
|
+
process.stderr.write(chalk.red(`Error: --agent-id, --agent-name, and --team-name must all be provided together
|
|
636
|
+
`));
|
|
637
|
+
process.exit(1);
|
|
638
|
+
}
|
|
639
|
+
if (teammateOpts.agentId && teammateOpts.agentName && teammateOpts.teamName) {
|
|
640
|
+
getTeammateUtils().setDynamicTeamContext?.({
|
|
641
|
+
agentId: teammateOpts.agentId,
|
|
642
|
+
agentName: teammateOpts.agentName,
|
|
643
|
+
teamName: teammateOpts.teamName,
|
|
644
|
+
color: teammateOpts.agentColor,
|
|
645
|
+
planModeRequired: teammateOpts.planModeRequired ?? false,
|
|
646
|
+
parentSessionId: teammateOpts.parentSessionId
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
if (teammateOpts.teammateMode) {
|
|
650
|
+
getTeammateModeSnapshot().setCliTeammateModeOverride?.(teammateOpts.teammateMode);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
const sdkUrl = options.sdkUrl ?? undefined;
|
|
654
|
+
const effectiveIncludePartialMessages = includePartialMessages || isEnvTruthy(process.env.CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES);
|
|
655
|
+
if (includeHookEvents || isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
656
|
+
setAllHookEventsEnabled(true);
|
|
657
|
+
}
|
|
658
|
+
if (sdkUrl) {
|
|
659
|
+
if (!inputFormat) {
|
|
660
|
+
inputFormat = "stream-json";
|
|
661
|
+
}
|
|
662
|
+
if (!outputFormat) {
|
|
663
|
+
outputFormat = "stream-json";
|
|
664
|
+
}
|
|
665
|
+
if (options.verbose === undefined) {
|
|
666
|
+
verbose = true;
|
|
667
|
+
}
|
|
668
|
+
if (!options.print) {
|
|
669
|
+
print = true;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
const teleport = options.teleport ?? null;
|
|
673
|
+
const remoteOption = options.remote;
|
|
674
|
+
const remote = remoteOption === true ? "" : remoteOption ?? null;
|
|
675
|
+
const remoteControlOption = options.remoteControl ?? options.rc;
|
|
676
|
+
let remoteControl = false;
|
|
677
|
+
const remoteControlName = typeof remoteControlOption === "string" && remoteControlOption.length > 0 ? remoteControlOption : undefined;
|
|
678
|
+
if (sessionId) {
|
|
679
|
+
if ((options.continue || options.resume) && !options.forkSession) {
|
|
680
|
+
process.stderr.write(chalk.red(`Error: --session-id can only be used with --continue or --resume if --fork-session is also specified.
|
|
681
|
+
`));
|
|
682
|
+
process.exit(1);
|
|
683
|
+
}
|
|
684
|
+
if (!sdkUrl) {
|
|
685
|
+
const validatedSessionId = validateUuid(sessionId);
|
|
686
|
+
if (!validatedSessionId) {
|
|
687
|
+
process.stderr.write(chalk.red(`Error: Invalid session ID. Must be a valid UUID.
|
|
688
|
+
`));
|
|
689
|
+
process.exit(1);
|
|
690
|
+
}
|
|
691
|
+
if (sessionIdExists(validatedSessionId)) {
|
|
692
|
+
process.stderr.write(chalk.red(`Error: Session ID ${validatedSessionId} is already in use.
|
|
693
|
+
`));
|
|
694
|
+
process.exit(1);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
const fileSpecs = options.file;
|
|
699
|
+
if (fileSpecs && fileSpecs.length > 0) {
|
|
700
|
+
const sessionToken = getSessionIngressAuthToken();
|
|
701
|
+
if (!sessionToken) {
|
|
702
|
+
process.stderr.write(chalk.red(`Error: Session token required for file downloads. CLAUDE_CODE_SESSION_ACCESS_TOKEN must be set.
|
|
703
|
+
`));
|
|
704
|
+
process.exit(1);
|
|
705
|
+
}
|
|
706
|
+
const fileSessionId = process.env.CLAUDE_CODE_REMOTE_SESSION_ID || getSessionId();
|
|
707
|
+
const files = parseFileSpecs(fileSpecs);
|
|
708
|
+
if (files.length > 0) {
|
|
709
|
+
const config = {
|
|
710
|
+
baseUrl: process.env.ANTHROPIC_BASE_URL || getOauthConfig().BASE_API_URL,
|
|
711
|
+
oauthToken: sessionToken,
|
|
712
|
+
sessionId: fileSessionId
|
|
713
|
+
};
|
|
714
|
+
fileDownloadPromise = downloadSessionFiles(files, config);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
const isNonInteractiveSession = getIsNonInteractiveSession();
|
|
718
|
+
if (fallbackModel && options.model && fallbackModel === options.model) {
|
|
719
|
+
process.stderr.write(chalk.red(`Error: Fallback model cannot be the same as the main model. Please specify a different model for --fallback-model.
|
|
720
|
+
`));
|
|
721
|
+
process.exit(1);
|
|
722
|
+
}
|
|
723
|
+
let systemPrompt = options.systemPrompt;
|
|
724
|
+
if (options.systemPromptFile) {
|
|
725
|
+
if (options.systemPrompt) {
|
|
726
|
+
process.stderr.write(chalk.red(`Error: Cannot use both --system-prompt and --system-prompt-file. Please use only one.
|
|
727
|
+
`));
|
|
728
|
+
process.exit(1);
|
|
729
|
+
}
|
|
730
|
+
try {
|
|
731
|
+
const filePath = resolve(options.systemPromptFile);
|
|
732
|
+
systemPrompt = readFileSync(filePath, "utf8");
|
|
733
|
+
} catch (error) {
|
|
734
|
+
const code = getErrnoCode(error);
|
|
735
|
+
if (code === "ENOENT") {
|
|
736
|
+
process.stderr.write(chalk.red(`Error: System prompt file not found: ${resolve(options.systemPromptFile)}
|
|
737
|
+
`));
|
|
738
|
+
process.exit(1);
|
|
739
|
+
}
|
|
740
|
+
process.stderr.write(chalk.red(`Error reading system prompt file: ${errorMessage(error)}
|
|
741
|
+
`));
|
|
742
|
+
process.exit(1);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
let appendSystemPrompt = options.appendSystemPrompt;
|
|
746
|
+
if (options.appendSystemPromptFile) {
|
|
747
|
+
if (options.appendSystemPrompt) {
|
|
748
|
+
process.stderr.write(chalk.red(`Error: Cannot use both --append-system-prompt and --append-system-prompt-file. Please use only one.
|
|
749
|
+
`));
|
|
750
|
+
process.exit(1);
|
|
751
|
+
}
|
|
752
|
+
try {
|
|
753
|
+
const filePath = resolve(options.appendSystemPromptFile);
|
|
754
|
+
appendSystemPrompt = readFileSync(filePath, "utf8");
|
|
755
|
+
} catch (error) {
|
|
756
|
+
const code = getErrnoCode(error);
|
|
757
|
+
if (code === "ENOENT") {
|
|
758
|
+
process.stderr.write(chalk.red(`Error: Append system prompt file not found: ${resolve(options.appendSystemPromptFile)}
|
|
759
|
+
`));
|
|
760
|
+
process.exit(1);
|
|
761
|
+
}
|
|
762
|
+
process.stderr.write(chalk.red(`Error reading append system prompt file: ${errorMessage(error)}
|
|
763
|
+
`));
|
|
764
|
+
process.exit(1);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
if (isAgentSwarmsEnabled() && storedTeammateOpts?.agentId && storedTeammateOpts?.agentName && storedTeammateOpts?.teamName) {
|
|
768
|
+
const addendum = getTeammatePromptAddendum().TEAMMATE_SYSTEM_PROMPT_ADDENDUM;
|
|
769
|
+
appendSystemPrompt = appendSystemPrompt ? `${appendSystemPrompt}
|
|
770
|
+
|
|
771
|
+
${addendum}` : addendum;
|
|
772
|
+
}
|
|
773
|
+
const {
|
|
774
|
+
mode: permissionMode,
|
|
775
|
+
notification: permissionModeNotification
|
|
776
|
+
} = initialPermissionModeFromCLI({
|
|
777
|
+
permissionModeCli,
|
|
778
|
+
dangerouslySkipPermissions
|
|
779
|
+
});
|
|
780
|
+
setSessionBypassPermissionsMode(permissionMode === "bypassPermissions");
|
|
781
|
+
if (false) {}
|
|
782
|
+
let dynamicMcpConfig = {};
|
|
783
|
+
if (mcpConfig && mcpConfig.length > 0) {
|
|
784
|
+
const processedConfigs = mcpConfig.map((config) => config.trim()).filter((config) => config.length > 0);
|
|
785
|
+
let allConfigs = {};
|
|
786
|
+
const allErrors = [];
|
|
787
|
+
for (const configItem of processedConfigs) {
|
|
788
|
+
let configs = null;
|
|
789
|
+
let errors = [];
|
|
790
|
+
const parsedJson = safeParseJSON(configItem);
|
|
791
|
+
if (parsedJson) {
|
|
792
|
+
const result = parseMcpConfig({
|
|
793
|
+
configObject: parsedJson,
|
|
794
|
+
filePath: "command line",
|
|
795
|
+
expandVars: true,
|
|
796
|
+
scope: "dynamic"
|
|
797
|
+
});
|
|
798
|
+
if (result.config) {
|
|
799
|
+
configs = result.config.mcpServers;
|
|
800
|
+
} else {
|
|
801
|
+
errors = result.errors;
|
|
802
|
+
}
|
|
803
|
+
} else {
|
|
804
|
+
const configPath = resolve(configItem);
|
|
805
|
+
const result = parseMcpConfigFromFilePath({
|
|
806
|
+
filePath: configPath,
|
|
807
|
+
expandVars: true,
|
|
808
|
+
scope: "dynamic"
|
|
809
|
+
});
|
|
810
|
+
if (result.config) {
|
|
811
|
+
configs = result.config.mcpServers;
|
|
812
|
+
} else {
|
|
813
|
+
errors = result.errors;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
if (errors.length > 0) {
|
|
817
|
+
allErrors.push(...errors);
|
|
818
|
+
} else if (configs) {
|
|
819
|
+
allConfigs = {
|
|
820
|
+
...allConfigs,
|
|
821
|
+
...configs
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
if (allErrors.length > 0) {
|
|
826
|
+
const formattedErrors = allErrors.map((err) => `${err.path ? err.path + ": " : ""}${err.message}`).join(`
|
|
827
|
+
`);
|
|
828
|
+
logForDebugging(`--mcp-config validation failed (${allErrors.length} errors): ${formattedErrors}`, {
|
|
829
|
+
level: "error"
|
|
830
|
+
});
|
|
831
|
+
process.stderr.write(`Error: Invalid MCP configuration:
|
|
832
|
+
${formattedErrors}
|
|
833
|
+
`);
|
|
834
|
+
process.exit(1);
|
|
835
|
+
}
|
|
836
|
+
if (Object.keys(allConfigs).length > 0) {
|
|
837
|
+
const nonSdkConfigNames = Object.entries(allConfigs).filter(([, config]) => config.type !== "sdk").map(([name]) => name);
|
|
838
|
+
let reservedNameError = null;
|
|
839
|
+
if (nonSdkConfigNames.some(isClaudeInChromeMCPServer)) {
|
|
840
|
+
reservedNameError = `Invalid MCP configuration: "${CLAUDE_IN_CHROME_MCP_SERVER_NAME}" is a reserved MCP name.`;
|
|
841
|
+
} else if (false) {}
|
|
842
|
+
if (reservedNameError) {
|
|
843
|
+
process.stderr.write(`Error: ${reservedNameError}
|
|
844
|
+
`);
|
|
845
|
+
process.exit(1);
|
|
846
|
+
}
|
|
847
|
+
const scopedConfigs = mapValues(allConfigs, (config) => ({
|
|
848
|
+
...config,
|
|
849
|
+
scope: "dynamic"
|
|
850
|
+
}));
|
|
851
|
+
const {
|
|
852
|
+
allowed,
|
|
853
|
+
blocked
|
|
854
|
+
} = filterMcpServersByPolicy(scopedConfigs);
|
|
855
|
+
if (blocked.length > 0) {
|
|
856
|
+
process.stderr.write(`Warning: MCP ${plural(blocked.length, "server")} blocked by enterprise policy: ${blocked.join(", ")}
|
|
857
|
+
`);
|
|
858
|
+
}
|
|
859
|
+
dynamicMcpConfig = {
|
|
860
|
+
...dynamicMcpConfig,
|
|
861
|
+
...allowed
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
const chromeOpts = options;
|
|
866
|
+
setChromeFlagOverride(chromeOpts.chrome);
|
|
867
|
+
const enableClaudeInChrome = shouldEnableClaudeInChrome(chromeOpts.chrome) && isClaudeAISubscriber();
|
|
868
|
+
const autoEnableClaudeInChrome = !enableClaudeInChrome && shouldAutoEnableClaudeInChrome();
|
|
869
|
+
if (enableClaudeInChrome) {
|
|
870
|
+
const platform = getPlatform();
|
|
871
|
+
try {
|
|
872
|
+
logEvent("tengu_claude_in_chrome_setup", {
|
|
873
|
+
platform
|
|
874
|
+
});
|
|
875
|
+
const {
|
|
876
|
+
mcpConfig: chromeMcpConfig,
|
|
877
|
+
allowedTools: chromeMcpTools,
|
|
878
|
+
systemPrompt: chromeSystemPrompt
|
|
879
|
+
} = setupClaudeInChrome();
|
|
880
|
+
dynamicMcpConfig = {
|
|
881
|
+
...dynamicMcpConfig,
|
|
882
|
+
...chromeMcpConfig
|
|
883
|
+
};
|
|
884
|
+
allowedTools.push(...chromeMcpTools);
|
|
885
|
+
if (chromeSystemPrompt) {
|
|
886
|
+
appendSystemPrompt = appendSystemPrompt ? `${chromeSystemPrompt}
|
|
887
|
+
|
|
888
|
+
${appendSystemPrompt}` : chromeSystemPrompt;
|
|
889
|
+
}
|
|
890
|
+
} catch (error) {
|
|
891
|
+
logEvent("tengu_claude_in_chrome_setup_failed", {
|
|
892
|
+
platform
|
|
893
|
+
});
|
|
894
|
+
logForDebugging(`[Claude in Chrome] Error: ${error}`);
|
|
895
|
+
logError(error);
|
|
896
|
+
console.error(`Error: Failed to run with Claude in Chrome.`);
|
|
897
|
+
process.exit(1);
|
|
898
|
+
}
|
|
899
|
+
} else if (autoEnableClaudeInChrome) {
|
|
900
|
+
try {
|
|
901
|
+
const {
|
|
902
|
+
mcpConfig: chromeMcpConfig
|
|
903
|
+
} = setupClaudeInChrome();
|
|
904
|
+
dynamicMcpConfig = {
|
|
905
|
+
...dynamicMcpConfig,
|
|
906
|
+
...chromeMcpConfig
|
|
907
|
+
};
|
|
908
|
+
const hint = CLAUDE_IN_CHROME_SKILL_HINT;
|
|
909
|
+
appendSystemPrompt = appendSystemPrompt ? `${appendSystemPrompt}
|
|
910
|
+
|
|
911
|
+
${hint}` : hint;
|
|
912
|
+
} catch (error) {
|
|
913
|
+
logForDebugging(`[Claude in Chrome] Error (auto-enable): ${error}`);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
const strictMcpConfig = options.strictMcpConfig || false;
|
|
917
|
+
if (doesEnterpriseMcpConfigExist()) {
|
|
918
|
+
if (strictMcpConfig) {
|
|
919
|
+
process.stderr.write(chalk.red("You cannot use --strict-mcp-config when an enterprise MCP config is present"));
|
|
920
|
+
process.exit(1);
|
|
921
|
+
}
|
|
922
|
+
if (dynamicMcpConfig && !areMcpConfigsAllowedWithEnterpriseMcpConfig(dynamicMcpConfig)) {
|
|
923
|
+
process.stderr.write(chalk.red("You cannot dynamically configure MCP servers when an enterprise MCP config is present"));
|
|
924
|
+
process.exit(1);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
if (false) {}
|
|
928
|
+
setAdditionalDirectoriesForClaudeMd(addDir);
|
|
929
|
+
let devChannels;
|
|
930
|
+
if (false) {}
|
|
931
|
+
if (false) {}
|
|
932
|
+
const initResult = await initializeToolPermissionContext({
|
|
933
|
+
allowedToolsCli: allowedTools,
|
|
934
|
+
disallowedToolsCli: disallowedTools,
|
|
935
|
+
baseToolsCli: baseTools,
|
|
936
|
+
permissionMode,
|
|
937
|
+
allowDangerouslySkipPermissions,
|
|
938
|
+
addDirs: addDir
|
|
939
|
+
});
|
|
940
|
+
let toolPermissionContext = initResult.toolPermissionContext;
|
|
941
|
+
const {
|
|
942
|
+
warnings,
|
|
943
|
+
dangerousPermissions,
|
|
944
|
+
overlyBroadBashPermissions
|
|
945
|
+
} = initResult;
|
|
946
|
+
if (false) {}
|
|
947
|
+
if (false) {}
|
|
948
|
+
warnings.forEach((warning) => {
|
|
949
|
+
console.error(warning);
|
|
950
|
+
});
|
|
951
|
+
assertMinVersion();
|
|
952
|
+
const claudeaiConfigPromise = isNonInteractiveSession && !strictMcpConfig && !doesEnterpriseMcpConfigExist() && !isBareMode() ? fetchClaudeAIMcpConfigsIfEligible().then((configs) => {
|
|
953
|
+
const {
|
|
954
|
+
allowed,
|
|
955
|
+
blocked
|
|
956
|
+
} = filterMcpServersByPolicy(configs);
|
|
957
|
+
if (blocked.length > 0) {
|
|
958
|
+
process.stderr.write(`Warning: claude.ai MCP ${plural(blocked.length, "server")} blocked by enterprise policy: ${blocked.join(", ")}
|
|
959
|
+
`);
|
|
960
|
+
}
|
|
961
|
+
return allowed;
|
|
962
|
+
}) : Promise.resolve({});
|
|
963
|
+
logForDebugging("[STARTUP] Loading MCP configs...");
|
|
964
|
+
const mcpConfigStart = Date.now();
|
|
965
|
+
let mcpConfigResolvedMs;
|
|
966
|
+
const mcpConfigPromise = (strictMcpConfig || isBareMode() ? Promise.resolve({
|
|
967
|
+
servers: {}
|
|
968
|
+
}) : getClaudeCodeMcpConfigs(dynamicMcpConfig)).then((result) => {
|
|
969
|
+
mcpConfigResolvedMs = Date.now() - mcpConfigStart;
|
|
970
|
+
return result;
|
|
971
|
+
});
|
|
972
|
+
if (inputFormat && inputFormat !== "text" && inputFormat !== "stream-json") {
|
|
973
|
+
console.error(`Error: Invalid input format "${inputFormat}".`);
|
|
974
|
+
process.exit(1);
|
|
975
|
+
}
|
|
976
|
+
if (inputFormat === "stream-json" && outputFormat !== "stream-json") {
|
|
977
|
+
console.error(`Error: --input-format=stream-json requires output-format=stream-json.`);
|
|
978
|
+
process.exit(1);
|
|
979
|
+
}
|
|
980
|
+
if (sdkUrl) {
|
|
981
|
+
if (inputFormat !== "stream-json" || outputFormat !== "stream-json") {
|
|
982
|
+
console.error(`Error: --sdk-url requires both --input-format=stream-json and --output-format=stream-json.`);
|
|
983
|
+
process.exit(1);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
if (options.replayUserMessages) {
|
|
987
|
+
if (inputFormat !== "stream-json" || outputFormat !== "stream-json") {
|
|
988
|
+
console.error(`Error: --replay-user-messages requires both --input-format=stream-json and --output-format=stream-json.`);
|
|
989
|
+
process.exit(1);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
if (effectiveIncludePartialMessages) {
|
|
993
|
+
if (!isNonInteractiveSession || outputFormat !== "stream-json") {
|
|
994
|
+
writeToStderr(`Error: --include-partial-messages requires --print and --output-format=stream-json.`);
|
|
995
|
+
process.exit(1);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
if (options.sessionPersistence === false && !isNonInteractiveSession) {
|
|
999
|
+
writeToStderr(`Error: --no-session-persistence can only be used with --print mode.`);
|
|
1000
|
+
process.exit(1);
|
|
1001
|
+
}
|
|
1002
|
+
const effectivePrompt = prompt || "";
|
|
1003
|
+
let inputPrompt = await getInputPrompt(effectivePrompt, inputFormat ?? "text");
|
|
1004
|
+
profileCheckpoint("action_after_input_prompt");
|
|
1005
|
+
maybeActivateProactive(options);
|
|
1006
|
+
let tools = getTools(toolPermissionContext);
|
|
1007
|
+
if (false) {}
|
|
1008
|
+
profileCheckpoint("action_tools_loaded");
|
|
1009
|
+
let jsonSchema;
|
|
1010
|
+
if (isSyntheticOutputToolEnabled({
|
|
1011
|
+
isNonInteractiveSession
|
|
1012
|
+
}) && options.jsonSchema) {
|
|
1013
|
+
jsonSchema = jsonParse(options.jsonSchema);
|
|
1014
|
+
}
|
|
1015
|
+
if (jsonSchema) {
|
|
1016
|
+
const syntheticOutputResult = createSyntheticOutputTool(jsonSchema);
|
|
1017
|
+
if ("tool" in syntheticOutputResult) {
|
|
1018
|
+
tools = [...tools, syntheticOutputResult.tool];
|
|
1019
|
+
logEvent("tengu_structured_output_enabled", {
|
|
1020
|
+
schema_property_count: Object.keys(jsonSchema.properties || {}).length,
|
|
1021
|
+
has_required_fields: Boolean(jsonSchema.required)
|
|
1022
|
+
});
|
|
1023
|
+
} else {
|
|
1024
|
+
logEvent("tengu_structured_output_failure", {
|
|
1025
|
+
error: "Invalid JSON schema"
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
profileCheckpoint("action_before_setup");
|
|
1030
|
+
logForDebugging("[STARTUP] Running setup()...");
|
|
1031
|
+
const setupStart = Date.now();
|
|
1032
|
+
const messagingSocketPath = undefined;
|
|
1033
|
+
const preSetupCwd = getCwd();
|
|
1034
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT !== "local-agent") {
|
|
1035
|
+
initBuiltinPlugins();
|
|
1036
|
+
initBundledSkills();
|
|
1037
|
+
}
|
|
1038
|
+
const setupPromise = process.env.CLAUDE_CODE_LOCAL_RECOVERY === "1" ? (async () => {
|
|
1039
|
+
setOriginalCwd(preSetupCwd);
|
|
1040
|
+
setProjectRoot(preSetupCwd);
|
|
1041
|
+
logForDebugging("[STARTUP] setup() skipped in local recovery mode");
|
|
1042
|
+
})() : (async () => {
|
|
1043
|
+
const {
|
|
1044
|
+
setup
|
|
1045
|
+
} = await import("./setup.js");
|
|
1046
|
+
await setup(preSetupCwd, permissionMode, allowDangerouslySkipPermissions, worktreeEnabled, worktreeName, tmuxEnabled, sessionId ? validateUuid(sessionId) : undefined, worktreePRNumber, messagingSocketPath);
|
|
1047
|
+
})();
|
|
1048
|
+
const commandsPromise = worktreeEnabled ? null : getCommands(preSetupCwd);
|
|
1049
|
+
const agentDefsPromise = worktreeEnabled ? null : getAgentDefinitionsWithOverrides(preSetupCwd);
|
|
1050
|
+
commandsPromise?.catch(() => {});
|
|
1051
|
+
agentDefsPromise?.catch(() => {});
|
|
1052
|
+
await setupPromise;
|
|
1053
|
+
logForDebugging(`[STARTUP] setup() completed in ${Date.now() - setupStart}ms`);
|
|
1054
|
+
profileCheckpoint("action_after_setup");
|
|
1055
|
+
let effectiveReplayUserMessages = !!options.replayUserMessages;
|
|
1056
|
+
if (false) {}
|
|
1057
|
+
if (getIsNonInteractiveSession()) {
|
|
1058
|
+
applyConfigEnvironmentVariables();
|
|
1059
|
+
getSystemContext();
|
|
1060
|
+
getUserContext();
|
|
1061
|
+
ensureModelStringsInitialized();
|
|
1062
|
+
}
|
|
1063
|
+
const sessionNameArg = options.name?.trim();
|
|
1064
|
+
if (sessionNameArg) {
|
|
1065
|
+
cacheSessionTitle(sessionNameArg);
|
|
1066
|
+
}
|
|
1067
|
+
const explicitModel = options.model || process.env.ANTHROPIC_MODEL;
|
|
1068
|
+
if (false) {}
|
|
1069
|
+
const userSpecifiedModel = options.model === "default" ? getDefaultMainLoopModel() : options.model;
|
|
1070
|
+
const userSpecifiedFallbackModel = fallbackModel === "default" ? getDefaultMainLoopModel() : fallbackModel;
|
|
1071
|
+
const currentCwd = worktreeEnabled ? getCwd() : preSetupCwd;
|
|
1072
|
+
logForDebugging("[STARTUP] Loading commands and agents...");
|
|
1073
|
+
const commandsStart = Date.now();
|
|
1074
|
+
const [commands, agentDefinitionsResult] = await Promise.all([commandsPromise ?? getCommands(currentCwd), agentDefsPromise ?? getAgentDefinitionsWithOverrides(currentCwd)]);
|
|
1075
|
+
logForDebugging(`[STARTUP] Commands and agents loaded in ${Date.now() - commandsStart}ms`);
|
|
1076
|
+
profileCheckpoint("action_commands_loaded");
|
|
1077
|
+
let cliAgents = [];
|
|
1078
|
+
if (agentsJson) {
|
|
1079
|
+
try {
|
|
1080
|
+
const parsedAgents = safeParseJSON(agentsJson);
|
|
1081
|
+
if (parsedAgents) {
|
|
1082
|
+
cliAgents = parseAgentsFromJson(parsedAgents, "flagSettings");
|
|
1083
|
+
}
|
|
1084
|
+
} catch (error) {
|
|
1085
|
+
logError(error);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
const allAgents = [...agentDefinitionsResult.allAgents, ...cliAgents];
|
|
1089
|
+
const agentDefinitions = {
|
|
1090
|
+
...agentDefinitionsResult,
|
|
1091
|
+
allAgents,
|
|
1092
|
+
activeAgents: getActiveAgentsFromList(allAgents)
|
|
1093
|
+
};
|
|
1094
|
+
const agentSetting = agentCli ?? getInitialSettings().agent;
|
|
1095
|
+
let mainThreadAgentDefinition;
|
|
1096
|
+
if (agentSetting) {
|
|
1097
|
+
mainThreadAgentDefinition = agentDefinitions.activeAgents.find((agent) => agent.agentType === agentSetting);
|
|
1098
|
+
if (!mainThreadAgentDefinition) {
|
|
1099
|
+
logForDebugging(`Warning: agent "${agentSetting}" not found. Available agents: ${agentDefinitions.activeAgents.map((a) => a.agentType).join(", ")}. Using default behavior.`);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
setMainThreadAgentType(mainThreadAgentDefinition?.agentType);
|
|
1103
|
+
if (mainThreadAgentDefinition) {
|
|
1104
|
+
logEvent("tengu_agent_flag", {
|
|
1105
|
+
agentType: isBuiltInAgent(mainThreadAgentDefinition) ? mainThreadAgentDefinition.agentType : "custom",
|
|
1106
|
+
...agentCli && {
|
|
1107
|
+
source: "cli"
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
if (mainThreadAgentDefinition?.agentType) {
|
|
1112
|
+
saveAgentSetting(mainThreadAgentDefinition.agentType);
|
|
1113
|
+
}
|
|
1114
|
+
if (isNonInteractiveSession && mainThreadAgentDefinition && !systemPrompt && !isBuiltInAgent(mainThreadAgentDefinition)) {
|
|
1115
|
+
const agentSystemPrompt = mainThreadAgentDefinition.getSystemPrompt();
|
|
1116
|
+
if (agentSystemPrompt) {
|
|
1117
|
+
systemPrompt = agentSystemPrompt;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
if (mainThreadAgentDefinition?.initialPrompt) {
|
|
1121
|
+
if (typeof inputPrompt === "string") {
|
|
1122
|
+
inputPrompt = inputPrompt ? `${mainThreadAgentDefinition.initialPrompt}
|
|
1123
|
+
|
|
1124
|
+
${inputPrompt}` : mainThreadAgentDefinition.initialPrompt;
|
|
1125
|
+
} else if (!inputPrompt) {
|
|
1126
|
+
inputPrompt = mainThreadAgentDefinition.initialPrompt;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
let effectiveModel = userSpecifiedModel;
|
|
1130
|
+
if (!effectiveModel && mainThreadAgentDefinition?.model && mainThreadAgentDefinition.model !== "inherit") {
|
|
1131
|
+
effectiveModel = parseUserSpecifiedModel(mainThreadAgentDefinition.model);
|
|
1132
|
+
}
|
|
1133
|
+
setMainLoopModelOverride(effectiveModel);
|
|
1134
|
+
setInitialMainLoopModel(getUserSpecifiedModelSetting() || null);
|
|
1135
|
+
const initialMainLoopModel = getInitialMainLoopModel();
|
|
1136
|
+
const resolvedInitialModel = parseUserSpecifiedModel(initialMainLoopModel ?? getDefaultMainLoopModel());
|
|
1137
|
+
let advisorModel;
|
|
1138
|
+
if (isAdvisorEnabled()) {
|
|
1139
|
+
const advisorOption = canUserConfigureAdvisor() ? options.advisor : undefined;
|
|
1140
|
+
if (advisorOption) {
|
|
1141
|
+
logForDebugging(`[AdvisorTool] --advisor ${advisorOption}`);
|
|
1142
|
+
if (!modelSupportsAdvisor(resolvedInitialModel)) {
|
|
1143
|
+
process.stderr.write(chalk.red(`Error: The model "${resolvedInitialModel}" does not support the advisor tool.
|
|
1144
|
+
`));
|
|
1145
|
+
process.exit(1);
|
|
1146
|
+
}
|
|
1147
|
+
const normalizedAdvisorModel = normalizeModelStringForAPI(parseUserSpecifiedModel(advisorOption));
|
|
1148
|
+
if (!isValidAdvisorModel(normalizedAdvisorModel)) {
|
|
1149
|
+
process.stderr.write(chalk.red(`Error: The model "${advisorOption}" cannot be used as an advisor.
|
|
1150
|
+
`));
|
|
1151
|
+
process.exit(1);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
advisorModel = canUserConfigureAdvisor() ? advisorOption ?? getInitialAdvisorSetting() : advisorOption;
|
|
1155
|
+
if (advisorModel) {
|
|
1156
|
+
logForDebugging(`[AdvisorTool] Advisor model: ${advisorModel}`);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
if (isAgentSwarmsEnabled() && storedTeammateOpts?.agentId && storedTeammateOpts?.agentName && storedTeammateOpts?.teamName && storedTeammateOpts?.agentType) {
|
|
1160
|
+
const customAgent = agentDefinitions.activeAgents.find((a) => a.agentType === storedTeammateOpts.agentType);
|
|
1161
|
+
if (customAgent) {
|
|
1162
|
+
let customPrompt;
|
|
1163
|
+
if (customAgent.source === "built-in") {
|
|
1164
|
+
logForDebugging(`[teammate] Built-in agent ${storedTeammateOpts.agentType} - skipping custom prompt (not supported)`);
|
|
1165
|
+
} else {
|
|
1166
|
+
customPrompt = customAgent.getSystemPrompt();
|
|
1167
|
+
}
|
|
1168
|
+
if (customAgent.memory) {
|
|
1169
|
+
logEvent("tengu_agent_memory_loaded", {
|
|
1170
|
+
...false,
|
|
1171
|
+
scope: customAgent.memory,
|
|
1172
|
+
source: "teammate"
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
if (customPrompt) {
|
|
1176
|
+
const customInstructions = `
|
|
1177
|
+
# Custom Agent Instructions
|
|
1178
|
+
${customPrompt}`;
|
|
1179
|
+
appendSystemPrompt = appendSystemPrompt ? `${appendSystemPrompt}
|
|
1180
|
+
|
|
1181
|
+
${customInstructions}` : customInstructions;
|
|
1182
|
+
}
|
|
1183
|
+
} else {
|
|
1184
|
+
logForDebugging(`[teammate] Custom agent ${storedTeammateOpts.agentType} not found in available agents`);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
maybeActivateBrief(options);
|
|
1188
|
+
if (false) {}
|
|
1189
|
+
if (false) {}
|
|
1190
|
+
if (false) {}
|
|
1191
|
+
let root;
|
|
1192
|
+
let getFpsMetrics;
|
|
1193
|
+
let stats;
|
|
1194
|
+
if (!isNonInteractiveSession) {
|
|
1195
|
+
const ctx = getRenderContext(false);
|
|
1196
|
+
getFpsMetrics = ctx.getFpsMetrics;
|
|
1197
|
+
stats = ctx.stats;
|
|
1198
|
+
if (false) {}
|
|
1199
|
+
const {
|
|
1200
|
+
createRoot
|
|
1201
|
+
} = await import("./ink.js");
|
|
1202
|
+
root = await createRoot(ctx.renderOptions);
|
|
1203
|
+
logEvent("tengu_timer", {
|
|
1204
|
+
event: "startup",
|
|
1205
|
+
durationMs: Math.round(process.uptime() * 1000)
|
|
1206
|
+
});
|
|
1207
|
+
logForDebugging("[STARTUP] Running showSetupScreens()...");
|
|
1208
|
+
const setupScreensStart = Date.now();
|
|
1209
|
+
const onboardingShown = await showSetupScreens(root, permissionMode, allowDangerouslySkipPermissions, commands, enableClaudeInChrome, devChannels);
|
|
1210
|
+
logForDebugging(`[STARTUP] showSetupScreens() completed in ${Date.now() - setupScreensStart}ms`);
|
|
1211
|
+
if (false) {}
|
|
1212
|
+
if (false) {}
|
|
1213
|
+
if (onboardingShown && prompt?.trim().toLowerCase() === "/login") {
|
|
1214
|
+
prompt = "";
|
|
1215
|
+
}
|
|
1216
|
+
if (onboardingShown) {
|
|
1217
|
+
refreshRemoteManagedSettings();
|
|
1218
|
+
refreshPolicyLimits();
|
|
1219
|
+
resetUserCache();
|
|
1220
|
+
refreshGrowthBookAfterAuthChange();
|
|
1221
|
+
import("./bridge/trustedDevice.js").then((m) => {
|
|
1222
|
+
m.clearTrustedDeviceToken();
|
|
1223
|
+
return m.enrollTrustedDevice();
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
const orgValidation = await validateForceLoginOrg();
|
|
1227
|
+
if (!orgValidation.valid) {
|
|
1228
|
+
await exitWithError(root, orgValidation.message);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
if (process.exitCode !== undefined) {
|
|
1232
|
+
logForDebugging("Graceful shutdown initiated, skipping further initialization");
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
initializeLspServerManager();
|
|
1236
|
+
if (!isNonInteractiveSession) {
|
|
1237
|
+
const {
|
|
1238
|
+
errors
|
|
1239
|
+
} = getSettingsWithErrors();
|
|
1240
|
+
const nonMcpErrors = errors.filter((e) => !e.mcpErrorMetadata);
|
|
1241
|
+
if (nonMcpErrors.length > 0) {
|
|
1242
|
+
await launchInvalidSettingsDialog(root, {
|
|
1243
|
+
settingsErrors: nonMcpErrors,
|
|
1244
|
+
onExit: () => gracefulShutdownSync(1)
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
const bgRefreshThrottleMs = getFeatureValue_CACHED_MAY_BE_STALE("tengu_cicada_nap_ms", 0);
|
|
1249
|
+
const lastPrefetched = getGlobalConfig().startupPrefetchedAt ?? 0;
|
|
1250
|
+
const skipStartupPrefetches = isBareMode() || bgRefreshThrottleMs > 0 && Date.now() - lastPrefetched < bgRefreshThrottleMs;
|
|
1251
|
+
if (!skipStartupPrefetches) {
|
|
1252
|
+
const lastPrefetchedInfo = lastPrefetched > 0 ? ` last ran ${Math.round((Date.now() - lastPrefetched) / 1000)}s ago` : "";
|
|
1253
|
+
logForDebugging(`Starting background startup prefetches${lastPrefetchedInfo}`);
|
|
1254
|
+
checkQuotaStatus().catch((error) => logError(error));
|
|
1255
|
+
fetchBootstrapData();
|
|
1256
|
+
prefetchPassesEligibility();
|
|
1257
|
+
if (!getFeatureValue_CACHED_MAY_BE_STALE("tengu_miraculo_the_bard", false)) {
|
|
1258
|
+
prefetchFastModeStatus();
|
|
1259
|
+
} else {
|
|
1260
|
+
resolveFastModeStatusFromCache();
|
|
1261
|
+
}
|
|
1262
|
+
if (bgRefreshThrottleMs > 0) {
|
|
1263
|
+
saveGlobalConfig((current) => ({
|
|
1264
|
+
...current,
|
|
1265
|
+
startupPrefetchedAt: Date.now()
|
|
1266
|
+
}));
|
|
1267
|
+
}
|
|
1268
|
+
} else {
|
|
1269
|
+
logForDebugging(`Skipping startup prefetches, last ran ${Math.round((Date.now() - lastPrefetched) / 1000)}s ago`);
|
|
1270
|
+
resolveFastModeStatusFromCache();
|
|
1271
|
+
}
|
|
1272
|
+
if (!isNonInteractiveSession) {
|
|
1273
|
+
refreshExampleCommands();
|
|
1274
|
+
}
|
|
1275
|
+
const {
|
|
1276
|
+
servers: existingMcpConfigs
|
|
1277
|
+
} = await mcpConfigPromise;
|
|
1278
|
+
logForDebugging(`[STARTUP] MCP configs resolved in ${mcpConfigResolvedMs}ms (awaited at +${Date.now() - mcpConfigStart}ms)`);
|
|
1279
|
+
const allMcpConfigs = {
|
|
1280
|
+
...existingMcpConfigs,
|
|
1281
|
+
...dynamicMcpConfig
|
|
1282
|
+
};
|
|
1283
|
+
const sdkMcpConfigs = {};
|
|
1284
|
+
const regularMcpConfigs = {};
|
|
1285
|
+
for (const [name, config] of Object.entries(allMcpConfigs)) {
|
|
1286
|
+
const typedConfig = config;
|
|
1287
|
+
if (typedConfig.type === "sdk") {
|
|
1288
|
+
sdkMcpConfigs[name] = typedConfig;
|
|
1289
|
+
} else {
|
|
1290
|
+
regularMcpConfigs[name] = typedConfig;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
profileCheckpoint("action_mcp_configs_loaded");
|
|
1294
|
+
const localMcpPromise = isNonInteractiveSession ? Promise.resolve({
|
|
1295
|
+
clients: [],
|
|
1296
|
+
tools: [],
|
|
1297
|
+
commands: []
|
|
1298
|
+
}) : prefetchAllMcpResources(regularMcpConfigs);
|
|
1299
|
+
const claudeaiMcpPromise = isNonInteractiveSession ? Promise.resolve({
|
|
1300
|
+
clients: [],
|
|
1301
|
+
tools: [],
|
|
1302
|
+
commands: []
|
|
1303
|
+
}) : claudeaiConfigPromise.then((configs) => Object.keys(configs).length > 0 ? prefetchAllMcpResources(configs) : {
|
|
1304
|
+
clients: [],
|
|
1305
|
+
tools: [],
|
|
1306
|
+
commands: []
|
|
1307
|
+
});
|
|
1308
|
+
const mcpPromise = Promise.all([localMcpPromise, claudeaiMcpPromise]).then(([local, claudeai]) => ({
|
|
1309
|
+
clients: [...local.clients, ...claudeai.clients],
|
|
1310
|
+
tools: uniqBy([...local.tools, ...claudeai.tools], "name"),
|
|
1311
|
+
commands: uniqBy([...local.commands, ...claudeai.commands], "name")
|
|
1312
|
+
}));
|
|
1313
|
+
const hooksPromise = initOnly || init || maintenance || isNonInteractiveSession || options.continue || options.resume ? null : processSessionStartHooks("startup", {
|
|
1314
|
+
agentType: mainThreadAgentDefinition?.agentType,
|
|
1315
|
+
model: resolvedInitialModel
|
|
1316
|
+
});
|
|
1317
|
+
const hookMessages = [];
|
|
1318
|
+
mcpPromise.catch(() => {});
|
|
1319
|
+
const mcpClients = [];
|
|
1320
|
+
const mcpTools = [];
|
|
1321
|
+
const mcpCommands = [];
|
|
1322
|
+
let thinkingEnabled = shouldEnableThinkingByDefault();
|
|
1323
|
+
let thinkingConfig = thinkingEnabled !== false ? {
|
|
1324
|
+
type: "adaptive"
|
|
1325
|
+
} : {
|
|
1326
|
+
type: "disabled"
|
|
1327
|
+
};
|
|
1328
|
+
if (options.thinking === "adaptive" || options.thinking === "enabled") {
|
|
1329
|
+
thinkingEnabled = true;
|
|
1330
|
+
thinkingConfig = {
|
|
1331
|
+
type: "adaptive"
|
|
1332
|
+
};
|
|
1333
|
+
} else if (options.thinking === "disabled") {
|
|
1334
|
+
thinkingEnabled = false;
|
|
1335
|
+
thinkingConfig = {
|
|
1336
|
+
type: "disabled"
|
|
1337
|
+
};
|
|
1338
|
+
} else {
|
|
1339
|
+
const maxThinkingTokens = process.env.MAX_THINKING_TOKENS ? parseInt(process.env.MAX_THINKING_TOKENS, 10) : options.maxThinkingTokens;
|
|
1340
|
+
if (maxThinkingTokens !== undefined) {
|
|
1341
|
+
if (maxThinkingTokens > 0) {
|
|
1342
|
+
thinkingEnabled = true;
|
|
1343
|
+
thinkingConfig = {
|
|
1344
|
+
type: "enabled",
|
|
1345
|
+
budgetTokens: maxThinkingTokens
|
|
1346
|
+
};
|
|
1347
|
+
} else if (maxThinkingTokens === 0) {
|
|
1348
|
+
thinkingEnabled = false;
|
|
1349
|
+
thinkingConfig = {
|
|
1350
|
+
type: "disabled"
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
logForDiagnosticsNoPII("info", "started", {
|
|
1356
|
+
version: MACRO.VERSION,
|
|
1357
|
+
is_native_binary: isInBundledMode()
|
|
1358
|
+
});
|
|
1359
|
+
registerCleanup(async () => {
|
|
1360
|
+
logForDiagnosticsNoPII("info", "exited");
|
|
1361
|
+
});
|
|
1362
|
+
logTenguInit({
|
|
1363
|
+
hasInitialPrompt: Boolean(prompt),
|
|
1364
|
+
hasStdin: Boolean(inputPrompt),
|
|
1365
|
+
verbose,
|
|
1366
|
+
debug,
|
|
1367
|
+
debugToStderr,
|
|
1368
|
+
print: print ?? false,
|
|
1369
|
+
outputFormat: outputFormat ?? "text",
|
|
1370
|
+
inputFormat: inputFormat ?? "text",
|
|
1371
|
+
numAllowedTools: allowedTools.length,
|
|
1372
|
+
numDisallowedTools: disallowedTools.length,
|
|
1373
|
+
mcpClientCount: Object.keys(allMcpConfigs).length,
|
|
1374
|
+
worktreeEnabled,
|
|
1375
|
+
skipWebFetchPreflight: getInitialSettings().skipWebFetchPreflight,
|
|
1376
|
+
githubActionInputs: process.env.GITHUB_ACTION_INPUTS,
|
|
1377
|
+
dangerouslySkipPermissionsPassed: dangerouslySkipPermissions ?? false,
|
|
1378
|
+
permissionMode,
|
|
1379
|
+
modeIsBypass: permissionMode === "bypassPermissions",
|
|
1380
|
+
allowDangerouslySkipPermissionsPassed: allowDangerouslySkipPermissions,
|
|
1381
|
+
systemPromptFlag: systemPrompt ? options.systemPromptFile ? "file" : "flag" : undefined,
|
|
1382
|
+
appendSystemPromptFlag: appendSystemPrompt ? options.appendSystemPromptFile ? "file" : "flag" : undefined,
|
|
1383
|
+
thinkingConfig,
|
|
1384
|
+
assistantActivationPath: undefined
|
|
1385
|
+
});
|
|
1386
|
+
logContextMetrics(regularMcpConfigs, toolPermissionContext);
|
|
1387
|
+
logPermissionContextForAnts(null, "initialization");
|
|
1388
|
+
logManagedSettings();
|
|
1389
|
+
registerSession().then((registered) => {
|
|
1390
|
+
if (!registered)
|
|
1391
|
+
return;
|
|
1392
|
+
if (sessionNameArg) {
|
|
1393
|
+
updateSessionName(sessionNameArg);
|
|
1394
|
+
}
|
|
1395
|
+
countConcurrentSessions().then((count) => {
|
|
1396
|
+
if (count >= 2) {
|
|
1397
|
+
logEvent("tengu_concurrent_sessions", {
|
|
1398
|
+
num_sessions: count
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
});
|
|
1403
|
+
if (isBareMode()) {} else if (isNonInteractiveSession) {
|
|
1404
|
+
await initializeVersionedPlugins();
|
|
1405
|
+
profileCheckpoint("action_after_plugins_init");
|
|
1406
|
+
cleanupOrphanedPluginVersionsInBackground().then(() => getGlobExclusionsForPluginCache());
|
|
1407
|
+
} else {
|
|
1408
|
+
initializeVersionedPlugins().then(async () => {
|
|
1409
|
+
profileCheckpoint("action_after_plugins_init");
|
|
1410
|
+
await cleanupOrphanedPluginVersionsInBackground();
|
|
1411
|
+
getGlobExclusionsForPluginCache();
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
const setupTrigger = initOnly || init ? "init" : maintenance ? "maintenance" : null;
|
|
1415
|
+
if (initOnly) {
|
|
1416
|
+
applyConfigEnvironmentVariables();
|
|
1417
|
+
await processSetupHooks("init", {
|
|
1418
|
+
forceSyncExecution: true
|
|
1419
|
+
});
|
|
1420
|
+
await processSessionStartHooks("startup", {
|
|
1421
|
+
forceSyncExecution: true
|
|
1422
|
+
});
|
|
1423
|
+
gracefulShutdownSync(0);
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
if (isNonInteractiveSession) {
|
|
1427
|
+
if (outputFormat === "stream-json" || outputFormat === "json") {
|
|
1428
|
+
setHasFormattedOutput(true);
|
|
1429
|
+
}
|
|
1430
|
+
applyConfigEnvironmentVariables();
|
|
1431
|
+
initializeTelemetryAfterTrust();
|
|
1432
|
+
const sessionStartHooksPromise = options.continue || options.resume || teleport || setupTrigger ? undefined : processSessionStartHooks("startup");
|
|
1433
|
+
sessionStartHooksPromise?.catch(() => {});
|
|
1434
|
+
profileCheckpoint("before_validateForceLoginOrg");
|
|
1435
|
+
const orgValidation = await validateForceLoginOrg();
|
|
1436
|
+
if (!orgValidation.valid) {
|
|
1437
|
+
process.stderr.write(orgValidation.message + `
|
|
1438
|
+
`);
|
|
1439
|
+
process.exit(1);
|
|
1440
|
+
}
|
|
1441
|
+
const commandsHeadless = disableSlashCommands ? [] : commands.filter((command) => command.type === "prompt" && !command.disableNonInteractive || command.type === "local" && command.supportsNonInteractive);
|
|
1442
|
+
const defaultState = getDefaultAppState();
|
|
1443
|
+
const headlessInitialState = {
|
|
1444
|
+
...defaultState,
|
|
1445
|
+
mcp: {
|
|
1446
|
+
...defaultState.mcp,
|
|
1447
|
+
clients: mcpClients,
|
|
1448
|
+
commands: mcpCommands,
|
|
1449
|
+
tools: mcpTools
|
|
1450
|
+
},
|
|
1451
|
+
toolPermissionContext,
|
|
1452
|
+
effortValue: parseEffortValue(options.effort) ?? getInitialEffortSetting(),
|
|
1453
|
+
...isFastModeEnabled() && {
|
|
1454
|
+
fastMode: getInitialFastModeSetting(effectiveModel ?? null)
|
|
1455
|
+
},
|
|
1456
|
+
...isAdvisorEnabled() && advisorModel && {
|
|
1457
|
+
advisorModel
|
|
1458
|
+
},
|
|
1459
|
+
...{}
|
|
1460
|
+
};
|
|
1461
|
+
const headlessStore = createStore(headlessInitialState, onChangeAppState);
|
|
1462
|
+
if (toolPermissionContext.mode === "bypassPermissions" || allowDangerouslySkipPermissions) {
|
|
1463
|
+
checkAndDisableBypassPermissions(toolPermissionContext);
|
|
1464
|
+
}
|
|
1465
|
+
if (false) {}
|
|
1466
|
+
if (options.sessionPersistence === false) {
|
|
1467
|
+
setSessionPersistenceDisabled(true);
|
|
1468
|
+
}
|
|
1469
|
+
setSdkBetas(filterAllowedSdkBetas(betas));
|
|
1470
|
+
const connectMcpBatch = (configs, label) => {
|
|
1471
|
+
if (Object.keys(configs).length === 0)
|
|
1472
|
+
return Promise.resolve();
|
|
1473
|
+
headlessStore.setState((prev) => ({
|
|
1474
|
+
...prev,
|
|
1475
|
+
mcp: {
|
|
1476
|
+
...prev.mcp,
|
|
1477
|
+
clients: [...prev.mcp.clients, ...Object.entries(configs).map(([name, config]) => ({
|
|
1478
|
+
name,
|
|
1479
|
+
type: "pending",
|
|
1480
|
+
config
|
|
1481
|
+
}))]
|
|
1482
|
+
}
|
|
1483
|
+
}));
|
|
1484
|
+
return getMcpToolsCommandsAndResources(({
|
|
1485
|
+
client,
|
|
1486
|
+
tools,
|
|
1487
|
+
commands
|
|
1488
|
+
}) => {
|
|
1489
|
+
headlessStore.setState((prev) => ({
|
|
1490
|
+
...prev,
|
|
1491
|
+
mcp: {
|
|
1492
|
+
...prev.mcp,
|
|
1493
|
+
clients: prev.mcp.clients.some((c) => c.name === client.name) ? prev.mcp.clients.map((c) => c.name === client.name ? client : c) : [...prev.mcp.clients, client],
|
|
1494
|
+
tools: uniqBy([...prev.mcp.tools, ...tools], "name"),
|
|
1495
|
+
commands: uniqBy([...prev.mcp.commands, ...commands], "name")
|
|
1496
|
+
}
|
|
1497
|
+
}));
|
|
1498
|
+
}, configs).catch((err) => logForDebugging(`[MCP] ${label} connect error: ${err}`));
|
|
1499
|
+
};
|
|
1500
|
+
profileCheckpoint("before_connectMcp");
|
|
1501
|
+
await connectMcpBatch(regularMcpConfigs, "regular");
|
|
1502
|
+
profileCheckpoint("after_connectMcp");
|
|
1503
|
+
const CLAUDE_AI_MCP_TIMEOUT_MS = 5000;
|
|
1504
|
+
const claudeaiConnect = claudeaiConfigPromise.then((claudeaiConfigs) => {
|
|
1505
|
+
if (Object.keys(claudeaiConfigs).length > 0) {
|
|
1506
|
+
const claudeaiSigs = new Set;
|
|
1507
|
+
for (const config of Object.values(claudeaiConfigs)) {
|
|
1508
|
+
const sig = getMcpServerSignature(config);
|
|
1509
|
+
if (sig)
|
|
1510
|
+
claudeaiSigs.add(sig);
|
|
1511
|
+
}
|
|
1512
|
+
const suppressed = new Set;
|
|
1513
|
+
for (const [name, config] of Object.entries(regularMcpConfigs)) {
|
|
1514
|
+
if (!name.startsWith("plugin:"))
|
|
1515
|
+
continue;
|
|
1516
|
+
const sig = getMcpServerSignature(config);
|
|
1517
|
+
if (sig && claudeaiSigs.has(sig))
|
|
1518
|
+
suppressed.add(name);
|
|
1519
|
+
}
|
|
1520
|
+
if (suppressed.size > 0) {
|
|
1521
|
+
logForDebugging(`[MCP] Lazy dedup: suppressing ${suppressed.size} plugin server(s) that duplicate claude.ai connectors: ${[...suppressed].join(", ")}`);
|
|
1522
|
+
for (const c of headlessStore.getState().mcp.clients) {
|
|
1523
|
+
if (!suppressed.has(c.name) || c.type !== "connected")
|
|
1524
|
+
continue;
|
|
1525
|
+
c.client.onclose = undefined;
|
|
1526
|
+
clearServerCache(c.name, c.config).catch(() => {});
|
|
1527
|
+
}
|
|
1528
|
+
headlessStore.setState((prev) => {
|
|
1529
|
+
let {
|
|
1530
|
+
clients,
|
|
1531
|
+
tools,
|
|
1532
|
+
commands,
|
|
1533
|
+
resources
|
|
1534
|
+
} = prev.mcp;
|
|
1535
|
+
clients = clients.filter((c) => !suppressed.has(c.name));
|
|
1536
|
+
tools = tools.filter((t) => !t.mcpInfo || !suppressed.has(t.mcpInfo.serverName));
|
|
1537
|
+
for (const name of suppressed) {
|
|
1538
|
+
commands = excludeCommandsByServer(commands, name);
|
|
1539
|
+
resources = excludeResourcesByServer(resources, name);
|
|
1540
|
+
}
|
|
1541
|
+
return {
|
|
1542
|
+
...prev,
|
|
1543
|
+
mcp: {
|
|
1544
|
+
...prev.mcp,
|
|
1545
|
+
clients,
|
|
1546
|
+
tools,
|
|
1547
|
+
commands,
|
|
1548
|
+
resources
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
const nonPluginConfigs = pickBy(regularMcpConfigs, (_, n) => !n.startsWith("plugin:"));
|
|
1555
|
+
const {
|
|
1556
|
+
servers: dedupedClaudeAi
|
|
1557
|
+
} = dedupClaudeAiMcpServers(claudeaiConfigs, nonPluginConfigs);
|
|
1558
|
+
return connectMcpBatch(dedupedClaudeAi, "claudeai");
|
|
1559
|
+
});
|
|
1560
|
+
let claudeaiTimer;
|
|
1561
|
+
const claudeaiTimedOut = await Promise.race([claudeaiConnect.then(() => false), new Promise((resolve) => {
|
|
1562
|
+
claudeaiTimer = setTimeout((r) => r(true), CLAUDE_AI_MCP_TIMEOUT_MS, resolve);
|
|
1563
|
+
})]);
|
|
1564
|
+
if (claudeaiTimer)
|
|
1565
|
+
clearTimeout(claudeaiTimer);
|
|
1566
|
+
if (claudeaiTimedOut) {
|
|
1567
|
+
logForDebugging(`[MCP] claude.ai connectors not ready after ${CLAUDE_AI_MCP_TIMEOUT_MS}ms — proceeding; background connection continues`);
|
|
1568
|
+
}
|
|
1569
|
+
profileCheckpoint("after_connectMcp_claudeai");
|
|
1570
|
+
if (!isBareMode()) {
|
|
1571
|
+
startDeferredPrefetches();
|
|
1572
|
+
import("./utils/backgroundHousekeeping.js").then((m) => m.startBackgroundHousekeeping());
|
|
1573
|
+
if (false) {}
|
|
1574
|
+
}
|
|
1575
|
+
logSessionTelemetry();
|
|
1576
|
+
profileCheckpoint("before_print_import");
|
|
1577
|
+
const {
|
|
1578
|
+
runHeadless
|
|
1579
|
+
} = await import("./cli/print.js");
|
|
1580
|
+
profileCheckpoint("after_print_import");
|
|
1581
|
+
runHeadless(inputPrompt, () => headlessStore.getState(), headlessStore.setState, commandsHeadless, tools, sdkMcpConfigs, agentDefinitions.activeAgents, {
|
|
1582
|
+
continue: options.continue,
|
|
1583
|
+
resume: options.resume,
|
|
1584
|
+
verbose,
|
|
1585
|
+
outputFormat,
|
|
1586
|
+
jsonSchema,
|
|
1587
|
+
permissionPromptToolName: options.permissionPromptTool,
|
|
1588
|
+
allowedTools,
|
|
1589
|
+
thinkingConfig,
|
|
1590
|
+
maxTurns: options.maxTurns,
|
|
1591
|
+
maxBudgetUsd: options.maxBudgetUsd,
|
|
1592
|
+
taskBudget: options.taskBudget ? {
|
|
1593
|
+
total: options.taskBudget
|
|
1594
|
+
} : undefined,
|
|
1595
|
+
systemPrompt,
|
|
1596
|
+
appendSystemPrompt,
|
|
1597
|
+
userSpecifiedModel: effectiveModel,
|
|
1598
|
+
fallbackModel: userSpecifiedFallbackModel,
|
|
1599
|
+
teleport,
|
|
1600
|
+
sdkUrl,
|
|
1601
|
+
replayUserMessages: effectiveReplayUserMessages,
|
|
1602
|
+
includePartialMessages: effectiveIncludePartialMessages,
|
|
1603
|
+
forkSession: options.forkSession || false,
|
|
1604
|
+
resumeSessionAt: options.resumeSessionAt || undefined,
|
|
1605
|
+
rewindFiles: options.rewindFiles,
|
|
1606
|
+
enableAuthStatus: options.enableAuthStatus,
|
|
1607
|
+
agent: agentCli,
|
|
1608
|
+
workload: options.workload,
|
|
1609
|
+
setupTrigger: setupTrigger ?? undefined,
|
|
1610
|
+
sessionStartHooksPromise
|
|
1611
|
+
});
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
logEvent("tengu_startup_manual_model_config", {
|
|
1615
|
+
cli_flag: options.model,
|
|
1616
|
+
env_var: process.env.ANTHROPIC_MODEL,
|
|
1617
|
+
settings_file: (getInitialSettings() || {}).model,
|
|
1618
|
+
subscriptionType: getSubscriptionType(),
|
|
1619
|
+
agent: agentSetting
|
|
1620
|
+
});
|
|
1621
|
+
const deprecationWarning = getModelDeprecationWarning(resolvedInitialModel);
|
|
1622
|
+
const initialNotifications = [];
|
|
1623
|
+
if (permissionModeNotification) {
|
|
1624
|
+
initialNotifications.push({
|
|
1625
|
+
key: "permission-mode-notification",
|
|
1626
|
+
text: permissionModeNotification,
|
|
1627
|
+
priority: "high"
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
if (deprecationWarning) {
|
|
1631
|
+
initialNotifications.push({
|
|
1632
|
+
key: "model-deprecation-warning",
|
|
1633
|
+
text: deprecationWarning,
|
|
1634
|
+
color: "warning",
|
|
1635
|
+
priority: "high"
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
if (overlyBroadBashPermissions.length > 0) {
|
|
1639
|
+
const displayList = uniq(overlyBroadBashPermissions.map((p) => p.ruleDisplay));
|
|
1640
|
+
const displays = displayList.join(", ");
|
|
1641
|
+
const sources = uniq(overlyBroadBashPermissions.map((p) => p.sourceDisplay)).join(", ");
|
|
1642
|
+
const n = displayList.length;
|
|
1643
|
+
initialNotifications.push({
|
|
1644
|
+
key: "overly-broad-bash-notification",
|
|
1645
|
+
text: `${displays} allow ${plural(n, "rule")} from ${sources} ${plural(n, "was", "were")} ignored — not available for Ants, please use auto-mode instead`,
|
|
1646
|
+
color: "warning",
|
|
1647
|
+
priority: "high"
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
const effectiveToolPermissionContext = {
|
|
1651
|
+
...toolPermissionContext,
|
|
1652
|
+
mode: isAgentSwarmsEnabled() && getTeammateUtils().isPlanModeRequired() ? "plan" : toolPermissionContext.mode
|
|
1653
|
+
};
|
|
1654
|
+
const initialIsBriefOnly = false;
|
|
1655
|
+
const fullRemoteControl = remoteControl || getRemoteControlAtStartup() || kairosEnabled;
|
|
1656
|
+
let ccrMirrorEnabled = false;
|
|
1657
|
+
if (false) {}
|
|
1658
|
+
const initialState = {
|
|
1659
|
+
settings: getInitialSettings(),
|
|
1660
|
+
tasks: {},
|
|
1661
|
+
agentNameRegistry: new Map,
|
|
1662
|
+
verbose: verbose ?? getGlobalConfig().verbose ?? false,
|
|
1663
|
+
mainLoopModel: initialMainLoopModel,
|
|
1664
|
+
mainLoopModelForSession: null,
|
|
1665
|
+
isBriefOnly: initialIsBriefOnly,
|
|
1666
|
+
expandedView: getGlobalConfig().showSpinnerTree ? "teammates" : getGlobalConfig().showExpandedTodos ? "tasks" : "none",
|
|
1667
|
+
showTeammateMessagePreview: isAgentSwarmsEnabled() ? false : undefined,
|
|
1668
|
+
selectedIPAgentIndex: -1,
|
|
1669
|
+
coordinatorTaskIndex: -1,
|
|
1670
|
+
viewSelectionMode: "none",
|
|
1671
|
+
footerSelection: null,
|
|
1672
|
+
toolPermissionContext: effectiveToolPermissionContext,
|
|
1673
|
+
agent: mainThreadAgentDefinition?.agentType,
|
|
1674
|
+
agentDefinitions,
|
|
1675
|
+
mcp: {
|
|
1676
|
+
clients: [],
|
|
1677
|
+
tools: [],
|
|
1678
|
+
commands: [],
|
|
1679
|
+
resources: {},
|
|
1680
|
+
pluginReconnectKey: 0
|
|
1681
|
+
},
|
|
1682
|
+
plugins: {
|
|
1683
|
+
enabled: [],
|
|
1684
|
+
disabled: [],
|
|
1685
|
+
commands: [],
|
|
1686
|
+
errors: [],
|
|
1687
|
+
installationStatus: {
|
|
1688
|
+
marketplaces: [],
|
|
1689
|
+
plugins: []
|
|
1690
|
+
},
|
|
1691
|
+
needsRefresh: false
|
|
1692
|
+
},
|
|
1693
|
+
statusLineText: undefined,
|
|
1694
|
+
kairosEnabled,
|
|
1695
|
+
remoteSessionUrl: undefined,
|
|
1696
|
+
remoteConnectionStatus: "connecting",
|
|
1697
|
+
remoteBackgroundTaskCount: 0,
|
|
1698
|
+
replBridgeEnabled: fullRemoteControl || ccrMirrorEnabled,
|
|
1699
|
+
replBridgeExplicit: remoteControl,
|
|
1700
|
+
replBridgeOutboundOnly: ccrMirrorEnabled,
|
|
1701
|
+
replBridgeConnected: false,
|
|
1702
|
+
replBridgeSessionActive: false,
|
|
1703
|
+
replBridgeReconnecting: false,
|
|
1704
|
+
replBridgeConnectUrl: undefined,
|
|
1705
|
+
replBridgeSessionUrl: undefined,
|
|
1706
|
+
replBridgeEnvironmentId: undefined,
|
|
1707
|
+
replBridgeSessionId: undefined,
|
|
1708
|
+
replBridgeError: undefined,
|
|
1709
|
+
replBridgeInitialName: remoteControlName,
|
|
1710
|
+
showRemoteCallout: false,
|
|
1711
|
+
notifications: {
|
|
1712
|
+
current: null,
|
|
1713
|
+
queue: initialNotifications
|
|
1714
|
+
},
|
|
1715
|
+
elicitation: {
|
|
1716
|
+
queue: []
|
|
1717
|
+
},
|
|
1718
|
+
todos: {},
|
|
1719
|
+
remoteAgentTaskSuggestions: [],
|
|
1720
|
+
fileHistory: {
|
|
1721
|
+
snapshots: [],
|
|
1722
|
+
trackedFiles: new Set,
|
|
1723
|
+
snapshotSequence: 0
|
|
1724
|
+
},
|
|
1725
|
+
attribution: createEmptyAttributionState(),
|
|
1726
|
+
thinkingEnabled,
|
|
1727
|
+
promptSuggestionEnabled: shouldEnablePromptSuggestion(),
|
|
1728
|
+
sessionHooks: new Map,
|
|
1729
|
+
inbox: {
|
|
1730
|
+
messages: []
|
|
1731
|
+
},
|
|
1732
|
+
promptSuggestion: {
|
|
1733
|
+
text: null,
|
|
1734
|
+
promptId: null,
|
|
1735
|
+
shownAt: 0,
|
|
1736
|
+
acceptedAt: 0,
|
|
1737
|
+
generationRequestId: null
|
|
1738
|
+
},
|
|
1739
|
+
speculation: IDLE_SPECULATION_STATE,
|
|
1740
|
+
speculationSessionTimeSavedMs: 0,
|
|
1741
|
+
skillImprovement: {
|
|
1742
|
+
suggestion: null
|
|
1743
|
+
},
|
|
1744
|
+
workerSandboxPermissions: {
|
|
1745
|
+
queue: [],
|
|
1746
|
+
selectedIndex: 0
|
|
1747
|
+
},
|
|
1748
|
+
pendingWorkerRequest: null,
|
|
1749
|
+
pendingSandboxRequest: null,
|
|
1750
|
+
authVersion: 0,
|
|
1751
|
+
initialMessage: inputPrompt ? {
|
|
1752
|
+
message: createUserMessage({
|
|
1753
|
+
content: String(inputPrompt)
|
|
1754
|
+
})
|
|
1755
|
+
} : null,
|
|
1756
|
+
effortValue: parseEffortValue(options.effort) ?? getInitialEffortSetting(),
|
|
1757
|
+
activeOverlays: new Set,
|
|
1758
|
+
fastMode: getInitialFastModeSetting(resolvedInitialModel),
|
|
1759
|
+
...isAdvisorEnabled() && advisorModel && {
|
|
1760
|
+
advisorModel
|
|
1761
|
+
},
|
|
1762
|
+
teamContext: computeInitialTeamContext?.()
|
|
1763
|
+
};
|
|
1764
|
+
if (inputPrompt) {
|
|
1765
|
+
addToHistory(String(inputPrompt));
|
|
1766
|
+
}
|
|
1767
|
+
const initialTools = mcpTools;
|
|
1768
|
+
saveGlobalConfig((current) => ({
|
|
1769
|
+
...current,
|
|
1770
|
+
numStartups: (current.numStartups ?? 0) + 1
|
|
1771
|
+
}));
|
|
1772
|
+
setImmediate(() => {
|
|
1773
|
+
logStartupTelemetry();
|
|
1774
|
+
logSessionTelemetry();
|
|
1775
|
+
});
|
|
1776
|
+
const sessionUploaderPromise = null;
|
|
1777
|
+
const uploaderReady = sessionUploaderPromise ? sessionUploaderPromise.then((mod) => mod.createSessionTurnUploader()).catch(() => null) : null;
|
|
1778
|
+
const sessionConfig = {
|
|
1779
|
+
debug: debug || debugToStderr,
|
|
1780
|
+
commands: [...commands, ...mcpCommands],
|
|
1781
|
+
initialTools,
|
|
1782
|
+
mcpClients,
|
|
1783
|
+
autoConnectIdeFlag: ide,
|
|
1784
|
+
mainThreadAgentDefinition,
|
|
1785
|
+
disableSlashCommands,
|
|
1786
|
+
dynamicMcpConfig,
|
|
1787
|
+
strictMcpConfig,
|
|
1788
|
+
systemPrompt,
|
|
1789
|
+
appendSystemPrompt,
|
|
1790
|
+
taskListId,
|
|
1791
|
+
thinkingConfig,
|
|
1792
|
+
...uploaderReady && {
|
|
1793
|
+
onTurnComplete: (messages) => {
|
|
1794
|
+
uploaderReady.then((uploader) => uploader?.(messages));
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
};
|
|
1798
|
+
const resumeContext = {
|
|
1799
|
+
modeApi: coordinatorModeModule,
|
|
1800
|
+
mainThreadAgentDefinition,
|
|
1801
|
+
agentDefinitions,
|
|
1802
|
+
currentCwd,
|
|
1803
|
+
cliAgents,
|
|
1804
|
+
initialState
|
|
1805
|
+
};
|
|
1806
|
+
if (options.continue) {
|
|
1807
|
+
let resumeSucceeded = false;
|
|
1808
|
+
try {
|
|
1809
|
+
const resumeStart = performance.now();
|
|
1810
|
+
const {
|
|
1811
|
+
clearSessionCaches
|
|
1812
|
+
} = await import("./commands/clear/caches.js");
|
|
1813
|
+
clearSessionCaches();
|
|
1814
|
+
const result = await loadConversationForResume(undefined, undefined);
|
|
1815
|
+
if (!result) {
|
|
1816
|
+
logEvent("tengu_continue", {
|
|
1817
|
+
success: false
|
|
1818
|
+
});
|
|
1819
|
+
return await exitWithError(root, "No conversation found to continue");
|
|
1820
|
+
}
|
|
1821
|
+
const loaded = await processResumedConversation(result, {
|
|
1822
|
+
forkSession: !!options.forkSession,
|
|
1823
|
+
includeAttribution: true,
|
|
1824
|
+
transcriptPath: result.fullPath
|
|
1825
|
+
}, resumeContext);
|
|
1826
|
+
if (loaded.restoredAgentDef) {
|
|
1827
|
+
mainThreadAgentDefinition = loaded.restoredAgentDef;
|
|
1828
|
+
}
|
|
1829
|
+
maybeActivateProactive(options);
|
|
1830
|
+
maybeActivateBrief(options);
|
|
1831
|
+
logEvent("tengu_continue", {
|
|
1832
|
+
success: true,
|
|
1833
|
+
resume_duration_ms: Math.round(performance.now() - resumeStart)
|
|
1834
|
+
});
|
|
1835
|
+
resumeSucceeded = true;
|
|
1836
|
+
await launchRepl(root, {
|
|
1837
|
+
getFpsMetrics,
|
|
1838
|
+
stats,
|
|
1839
|
+
initialState: loaded.initialState
|
|
1840
|
+
}, {
|
|
1841
|
+
...sessionConfig,
|
|
1842
|
+
mainThreadAgentDefinition: loaded.restoredAgentDef ?? mainThreadAgentDefinition,
|
|
1843
|
+
initialMessages: loaded.messages,
|
|
1844
|
+
initialFileHistorySnapshots: loaded.fileHistorySnapshots,
|
|
1845
|
+
initialContentReplacements: loaded.contentReplacements,
|
|
1846
|
+
initialAgentName: loaded.agentName,
|
|
1847
|
+
initialAgentColor: loaded.agentColor
|
|
1848
|
+
}, renderAndRun);
|
|
1849
|
+
} catch (error) {
|
|
1850
|
+
if (!resumeSucceeded) {
|
|
1851
|
+
logEvent("tengu_continue", {
|
|
1852
|
+
success: false
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
logError(error);
|
|
1856
|
+
process.exit(1);
|
|
1857
|
+
}
|
|
1858
|
+
} else if (false) {} else if (false) {} else if (false) {} else if (options.resume || options.fromPr || teleport || remote !== null) {
|
|
1859
|
+
const {
|
|
1860
|
+
clearSessionCaches
|
|
1861
|
+
} = await import("./commands/clear/caches.js");
|
|
1862
|
+
clearSessionCaches();
|
|
1863
|
+
let messages = null;
|
|
1864
|
+
let processedResume = undefined;
|
|
1865
|
+
let maybeSessionId = validateUuid(options.resume);
|
|
1866
|
+
let searchTerm = undefined;
|
|
1867
|
+
let matchedLog = null;
|
|
1868
|
+
let filterByPr = undefined;
|
|
1869
|
+
if (options.fromPr) {
|
|
1870
|
+
if (options.fromPr === true) {
|
|
1871
|
+
filterByPr = true;
|
|
1872
|
+
} else if (typeof options.fromPr === "string") {
|
|
1873
|
+
filterByPr = options.fromPr;
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
if (options.resume && typeof options.resume === "string" && !maybeSessionId) {
|
|
1877
|
+
const trimmedValue = options.resume.trim();
|
|
1878
|
+
if (trimmedValue) {
|
|
1879
|
+
const matches = await searchSessionsByCustomTitle(trimmedValue, {
|
|
1880
|
+
exact: true
|
|
1881
|
+
});
|
|
1882
|
+
if (matches.length === 1) {
|
|
1883
|
+
matchedLog = matches[0];
|
|
1884
|
+
maybeSessionId = getSessionIdFromLog(matchedLog) ?? null;
|
|
1885
|
+
} else {
|
|
1886
|
+
searchTerm = trimmedValue;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
if (remote !== null || teleport) {
|
|
1891
|
+
await waitForPolicyLimitsToLoad();
|
|
1892
|
+
if (!isPolicyAllowed("allow_remote_sessions")) {
|
|
1893
|
+
return await exitWithError(root, "Error: Remote sessions are disabled by your organization's policy.", () => gracefulShutdown(1));
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
if (remote !== null) {
|
|
1897
|
+
const hasInitialPrompt = remote.length > 0;
|
|
1898
|
+
const isRemoteTuiEnabled = getFeatureValue_CACHED_MAY_BE_STALE("tengu_remote_backend", false);
|
|
1899
|
+
if (!isRemoteTuiEnabled && !hasInitialPrompt) {
|
|
1900
|
+
return await exitWithError(root, `Error: --remote requires a description.
|
|
1901
|
+
Usage: lcclaude --remote "your task description"`, () => gracefulShutdown(1));
|
|
1902
|
+
}
|
|
1903
|
+
logEvent("tengu_remote_create_session", {
|
|
1904
|
+
has_initial_prompt: String(hasInitialPrompt)
|
|
1905
|
+
});
|
|
1906
|
+
const currentBranch = await getBranch();
|
|
1907
|
+
const createdSession = await teleportToRemoteWithErrorHandling(root, hasInitialPrompt ? remote : null, new AbortController().signal, currentBranch || undefined);
|
|
1908
|
+
if (!createdSession) {
|
|
1909
|
+
logEvent("tengu_remote_create_session_error", {
|
|
1910
|
+
error: "unable_to_create_session"
|
|
1911
|
+
});
|
|
1912
|
+
return await exitWithError(root, "Error: Unable to create remote session", () => gracefulShutdown(1));
|
|
1913
|
+
}
|
|
1914
|
+
logEvent("tengu_remote_create_session_success", {
|
|
1915
|
+
session_id: createdSession.id
|
|
1916
|
+
});
|
|
1917
|
+
if (!isRemoteTuiEnabled) {
|
|
1918
|
+
process.stdout.write(`Created remote session: ${createdSession.title}
|
|
1919
|
+
`);
|
|
1920
|
+
process.stdout.write(`View: ${getRemoteSessionUrl(createdSession.id)}?m=0
|
|
1921
|
+
`);
|
|
1922
|
+
process.stdout.write(`Resume with: claude --teleport ${createdSession.id}
|
|
1923
|
+
`);
|
|
1924
|
+
await gracefulShutdown(0);
|
|
1925
|
+
process.exit(0);
|
|
1926
|
+
}
|
|
1927
|
+
setIsRemoteMode(true);
|
|
1928
|
+
switchSession(asSessionId(createdSession.id));
|
|
1929
|
+
let apiCreds;
|
|
1930
|
+
try {
|
|
1931
|
+
apiCreds = await prepareApiRequest();
|
|
1932
|
+
} catch (error) {
|
|
1933
|
+
logError(toError(error));
|
|
1934
|
+
return await exitWithError(root, `Error: ${errorMessage(error) || "Failed to authenticate"}`, () => gracefulShutdown(1));
|
|
1935
|
+
}
|
|
1936
|
+
const {
|
|
1937
|
+
getClaudeAIOAuthTokens: getTokensForRemote
|
|
1938
|
+
} = await import("./utils/auth.js");
|
|
1939
|
+
const getAccessTokenForRemote = () => getTokensForRemote()?.accessToken ?? apiCreds.accessToken;
|
|
1940
|
+
const remoteSessionConfig = createRemoteSessionConfig(createdSession.id, getAccessTokenForRemote, apiCreds.orgUUID, hasInitialPrompt);
|
|
1941
|
+
const remoteSessionUrl = `${getRemoteSessionUrl(createdSession.id)}?m=0`;
|
|
1942
|
+
const remoteInfoMessage = createSystemMessage(`/remote-control is active. Code in CLI or at ${remoteSessionUrl}`, "info");
|
|
1943
|
+
const initialUserMessage = hasInitialPrompt ? createUserMessage({
|
|
1944
|
+
content: remote
|
|
1945
|
+
}) : null;
|
|
1946
|
+
const remoteInitialState = {
|
|
1947
|
+
...initialState,
|
|
1948
|
+
remoteSessionUrl
|
|
1949
|
+
};
|
|
1950
|
+
const remoteCommands = filterCommandsForRemoteMode(commands);
|
|
1951
|
+
await launchRepl(root, {
|
|
1952
|
+
getFpsMetrics,
|
|
1953
|
+
stats,
|
|
1954
|
+
initialState: remoteInitialState
|
|
1955
|
+
}, {
|
|
1956
|
+
debug: debug || debugToStderr,
|
|
1957
|
+
commands: remoteCommands,
|
|
1958
|
+
initialTools: [],
|
|
1959
|
+
initialMessages: initialUserMessage ? [remoteInfoMessage, initialUserMessage] : [remoteInfoMessage],
|
|
1960
|
+
mcpClients: [],
|
|
1961
|
+
autoConnectIdeFlag: ide,
|
|
1962
|
+
mainThreadAgentDefinition,
|
|
1963
|
+
disableSlashCommands,
|
|
1964
|
+
remoteSessionConfig,
|
|
1965
|
+
thinkingConfig
|
|
1966
|
+
}, renderAndRun);
|
|
1967
|
+
return;
|
|
1968
|
+
} else if (teleport) {
|
|
1969
|
+
if (teleport === true || teleport === "") {
|
|
1970
|
+
logEvent("tengu_teleport_interactive_mode", {});
|
|
1971
|
+
logForDebugging("selectAndResumeTeleportTask: Starting teleport flow...");
|
|
1972
|
+
const teleportResult = await launchTeleportResumeWrapper(root);
|
|
1973
|
+
if (!teleportResult) {
|
|
1974
|
+
await gracefulShutdown(0);
|
|
1975
|
+
process.exit(0);
|
|
1976
|
+
}
|
|
1977
|
+
const {
|
|
1978
|
+
branchError
|
|
1979
|
+
} = await checkOutTeleportedSessionBranch(teleportResult.branch);
|
|
1980
|
+
messages = processMessagesForTeleportResume(teleportResult.log, branchError);
|
|
1981
|
+
} else if (typeof teleport === "string") {
|
|
1982
|
+
logEvent("tengu_teleport_resume_session", {
|
|
1983
|
+
mode: "direct"
|
|
1984
|
+
});
|
|
1985
|
+
try {
|
|
1986
|
+
const sessionData = await fetchSession(teleport);
|
|
1987
|
+
const repoValidation = await validateSessionRepository(sessionData);
|
|
1988
|
+
if (repoValidation.status === "mismatch" || repoValidation.status === "not_in_repo") {
|
|
1989
|
+
const sessionRepo = repoValidation.sessionRepo;
|
|
1990
|
+
if (sessionRepo) {
|
|
1991
|
+
const knownPaths = getKnownPathsForRepo(sessionRepo);
|
|
1992
|
+
const existingPaths = await filterExistingPaths(knownPaths);
|
|
1993
|
+
if (existingPaths.length > 0) {
|
|
1994
|
+
const selectedPath = await launchTeleportRepoMismatchDialog(root, {
|
|
1995
|
+
targetRepo: sessionRepo,
|
|
1996
|
+
initialPaths: existingPaths
|
|
1997
|
+
});
|
|
1998
|
+
if (selectedPath) {
|
|
1999
|
+
process.chdir(selectedPath);
|
|
2000
|
+
setCwd(selectedPath);
|
|
2001
|
+
setOriginalCwd(selectedPath);
|
|
2002
|
+
} else {
|
|
2003
|
+
await gracefulShutdown(0);
|
|
2004
|
+
}
|
|
2005
|
+
} else {
|
|
2006
|
+
throw new TeleportOperationError(`You must run claude --teleport ${teleport} from a checkout of ${sessionRepo}.`, chalk.red(`You must run claude --teleport ${teleport} from a checkout of ${chalk.bold(sessionRepo)}.
|
|
2007
|
+
`));
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
} else if (repoValidation.status === "error") {
|
|
2011
|
+
throw new TeleportOperationError(repoValidation.errorMessage || "Failed to validate session", chalk.red(`Error: ${repoValidation.errorMessage || "Failed to validate session"}
|
|
2012
|
+
`));
|
|
2013
|
+
}
|
|
2014
|
+
await validateGitState();
|
|
2015
|
+
const {
|
|
2016
|
+
teleportWithProgress
|
|
2017
|
+
} = await import("./components/TeleportProgress.js");
|
|
2018
|
+
const result = await teleportWithProgress(root, teleport);
|
|
2019
|
+
setTeleportedSessionInfo({
|
|
2020
|
+
sessionId: teleport
|
|
2021
|
+
});
|
|
2022
|
+
messages = result.messages;
|
|
2023
|
+
} catch (error) {
|
|
2024
|
+
if (error instanceof TeleportOperationError) {
|
|
2025
|
+
process.stderr.write(error.formattedMessage + `
|
|
2026
|
+
`);
|
|
2027
|
+
} else {
|
|
2028
|
+
logError(error);
|
|
2029
|
+
process.stderr.write(chalk.red(`Error: ${errorMessage(error)}
|
|
2030
|
+
`));
|
|
2031
|
+
}
|
|
2032
|
+
await gracefulShutdown(1);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
if (false) {}
|
|
2037
|
+
if (maybeSessionId) {
|
|
2038
|
+
const sessionId = maybeSessionId;
|
|
2039
|
+
try {
|
|
2040
|
+
const resumeStart = performance.now();
|
|
2041
|
+
const result = await loadConversationForResume(matchedLog ?? sessionId, undefined);
|
|
2042
|
+
if (!result) {
|
|
2043
|
+
logEvent("tengu_session_resumed", {
|
|
2044
|
+
entrypoint: "cli_flag",
|
|
2045
|
+
success: false
|
|
2046
|
+
});
|
|
2047
|
+
return await exitWithError(root, `No conversation found with session ID: ${sessionId}`);
|
|
2048
|
+
}
|
|
2049
|
+
const fullPath = matchedLog?.fullPath ?? result.fullPath;
|
|
2050
|
+
processedResume = await processResumedConversation(result, {
|
|
2051
|
+
forkSession: !!options.forkSession,
|
|
2052
|
+
sessionIdOverride: sessionId,
|
|
2053
|
+
transcriptPath: fullPath
|
|
2054
|
+
}, resumeContext);
|
|
2055
|
+
if (processedResume.restoredAgentDef) {
|
|
2056
|
+
mainThreadAgentDefinition = processedResume.restoredAgentDef;
|
|
2057
|
+
}
|
|
2058
|
+
logEvent("tengu_session_resumed", {
|
|
2059
|
+
entrypoint: "cli_flag",
|
|
2060
|
+
success: true,
|
|
2061
|
+
resume_duration_ms: Math.round(performance.now() - resumeStart)
|
|
2062
|
+
});
|
|
2063
|
+
} catch (error) {
|
|
2064
|
+
logEvent("tengu_session_resumed", {
|
|
2065
|
+
entrypoint: "cli_flag",
|
|
2066
|
+
success: false
|
|
2067
|
+
});
|
|
2068
|
+
logError(error);
|
|
2069
|
+
await exitWithError(root, `Failed to resume session ${sessionId}`);
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
if (fileDownloadPromise) {
|
|
2073
|
+
try {
|
|
2074
|
+
const results = await fileDownloadPromise;
|
|
2075
|
+
const failedCount = count(results, (r) => !r.success);
|
|
2076
|
+
if (failedCount > 0) {
|
|
2077
|
+
process.stderr.write(chalk.yellow(`Warning: ${failedCount}/${results.length} file(s) failed to download.
|
|
2078
|
+
`));
|
|
2079
|
+
}
|
|
2080
|
+
} catch (error) {
|
|
2081
|
+
return await exitWithError(root, `Error downloading files: ${errorMessage(error)}`);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
const resumeData = processedResume ?? (Array.isArray(messages) ? {
|
|
2085
|
+
messages,
|
|
2086
|
+
fileHistorySnapshots: undefined,
|
|
2087
|
+
agentName: undefined,
|
|
2088
|
+
agentColor: undefined,
|
|
2089
|
+
restoredAgentDef: mainThreadAgentDefinition,
|
|
2090
|
+
initialState,
|
|
2091
|
+
contentReplacements: undefined
|
|
2092
|
+
} : undefined);
|
|
2093
|
+
if (resumeData) {
|
|
2094
|
+
maybeActivateProactive(options);
|
|
2095
|
+
maybeActivateBrief(options);
|
|
2096
|
+
await launchRepl(root, {
|
|
2097
|
+
getFpsMetrics,
|
|
2098
|
+
stats,
|
|
2099
|
+
initialState: resumeData.initialState
|
|
2100
|
+
}, {
|
|
2101
|
+
...sessionConfig,
|
|
2102
|
+
mainThreadAgentDefinition: resumeData.restoredAgentDef ?? mainThreadAgentDefinition,
|
|
2103
|
+
initialMessages: resumeData.messages,
|
|
2104
|
+
initialFileHistorySnapshots: resumeData.fileHistorySnapshots,
|
|
2105
|
+
initialContentReplacements: resumeData.contentReplacements,
|
|
2106
|
+
initialAgentName: resumeData.agentName,
|
|
2107
|
+
initialAgentColor: resumeData.agentColor
|
|
2108
|
+
}, renderAndRun);
|
|
2109
|
+
} else {
|
|
2110
|
+
await launchResumeChooser(root, {
|
|
2111
|
+
getFpsMetrics,
|
|
2112
|
+
stats,
|
|
2113
|
+
initialState
|
|
2114
|
+
}, getWorktreePaths(getOriginalCwd()), {
|
|
2115
|
+
...sessionConfig,
|
|
2116
|
+
initialSearchQuery: searchTerm,
|
|
2117
|
+
forkSession: options.forkSession,
|
|
2118
|
+
filterByPr
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
} else {
|
|
2122
|
+
const pendingHookMessages = hooksPromise && hookMessages.length === 0 ? hooksPromise : undefined;
|
|
2123
|
+
profileCheckpoint("action_after_hooks");
|
|
2124
|
+
maybeActivateProactive(options);
|
|
2125
|
+
maybeActivateBrief(options);
|
|
2126
|
+
if (false) {}
|
|
2127
|
+
let deepLinkBanner = null;
|
|
2128
|
+
if (false) {}
|
|
2129
|
+
const initialMessages = deepLinkBanner ? [deepLinkBanner, ...hookMessages] : hookMessages.length > 0 ? hookMessages : undefined;
|
|
2130
|
+
await launchRepl(root, {
|
|
2131
|
+
getFpsMetrics,
|
|
2132
|
+
stats,
|
|
2133
|
+
initialState
|
|
2134
|
+
}, {
|
|
2135
|
+
...sessionConfig,
|
|
2136
|
+
initialMessages,
|
|
2137
|
+
pendingHookMessages
|
|
2138
|
+
}, renderAndRun);
|
|
2139
|
+
}
|
|
2140
|
+
}).version(`${MACRO.VERSION} (Claude Code)`, "-v, --version", "Output the version number");
|
|
2141
|
+
program.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
2142
|
+
program.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
2143
|
+
if (canUserConfigureAdvisor()) {
|
|
2144
|
+
program.addOption(new Option("--advisor <model>", "Enable the server-side advisor tool with the specified model (alias or full ID).").hideHelp());
|
|
2145
|
+
}
|
|
2146
|
+
if (false) {}
|
|
2147
|
+
if (false) {}
|
|
2148
|
+
if (false) {}
|
|
2149
|
+
if (false) {}
|
|
2150
|
+
if (false) {}
|
|
2151
|
+
if (false) {}
|
|
2152
|
+
if (false) {}
|
|
2153
|
+
program.addOption(new Option("--agent-id <id>", "Teammate agent ID").hideHelp());
|
|
2154
|
+
program.addOption(new Option("--agent-name <name>", "Teammate display name").hideHelp());
|
|
2155
|
+
program.addOption(new Option("--team-name <name>", "Team name for swarm coordination").hideHelp());
|
|
2156
|
+
program.addOption(new Option("--agent-color <color>", "Teammate UI color").hideHelp());
|
|
2157
|
+
program.addOption(new Option("--plan-mode-required", "Require plan mode before implementation").hideHelp());
|
|
2158
|
+
program.addOption(new Option("--parent-session-id <id>", "Parent session ID for analytics correlation").hideHelp());
|
|
2159
|
+
program.addOption(new Option("--teammate-mode <mode>", 'How to spawn teammates: "tmux", "in-process", or "auto"').choices(["auto", "tmux", "in-process"]).hideHelp());
|
|
2160
|
+
program.addOption(new Option("--agent-type <type>", "Custom agent type for this teammate").hideHelp());
|
|
2161
|
+
program.addOption(new Option("--sdk-url <url>", "Use remote WebSocket endpoint for SDK I/O streaming (only with -p and stream-json format)").hideHelp());
|
|
2162
|
+
program.addOption(new Option("--teleport [session]", "Resume a teleport session, optionally specify session ID").hideHelp());
|
|
2163
|
+
program.addOption(new Option("--remote [description]", "Create a remote session with the given description").hideHelp());
|
|
2164
|
+
if (false) {}
|
|
2165
|
+
if (false) {}
|
|
2166
|
+
profileCheckpoint("run_main_options_built");
|
|
2167
|
+
const isPrintMode = process.argv.includes("-p") || process.argv.includes("--print");
|
|
2168
|
+
const isCcUrl = process.argv.some((a) => a.startsWith("cc://") || a.startsWith("cc+unix://"));
|
|
2169
|
+
if (isPrintMode && !isCcUrl) {
|
|
2170
|
+
profileCheckpoint("run_before_parse");
|
|
2171
|
+
await program.parseAsync(process.argv);
|
|
2172
|
+
profileCheckpoint("run_after_parse");
|
|
2173
|
+
return program;
|
|
2174
|
+
}
|
|
2175
|
+
const mcp = program.command("mcp").description("Configure and manage MCP servers").configureHelp(createSortedHelpConfig()).enablePositionalOptions();
|
|
2176
|
+
mcp.command("serve").description(`Start the Claude Code MCP server`).option("-d, --debug", "Enable debug mode", () => true).option("--verbose", "Override verbose mode setting from config", () => true).action(async ({
|
|
2177
|
+
debug,
|
|
2178
|
+
verbose
|
|
2179
|
+
}) => {
|
|
2180
|
+
const {
|
|
2181
|
+
mcpServeHandler
|
|
2182
|
+
} = await import("./cli/handlers/mcp.js");
|
|
2183
|
+
await mcpServeHandler({
|
|
2184
|
+
debug,
|
|
2185
|
+
verbose
|
|
2186
|
+
});
|
|
2187
|
+
});
|
|
2188
|
+
registerMcpAddCommand(mcp);
|
|
2189
|
+
if (isXaaEnabled()) {
|
|
2190
|
+
registerMcpXaaIdpCommand(mcp);
|
|
2191
|
+
}
|
|
2192
|
+
mcp.command("remove <name>").description("Remove an MCP server").option("-s, --scope <scope>", "Configuration scope (local, user, or project) - if not specified, removes from whichever scope it exists in").action(async (name, options) => {
|
|
2193
|
+
const {
|
|
2194
|
+
mcpRemoveHandler
|
|
2195
|
+
} = await import("./cli/handlers/mcp.js");
|
|
2196
|
+
await mcpRemoveHandler(name, options);
|
|
2197
|
+
});
|
|
2198
|
+
mcp.command("list").description("List configured MCP servers. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async () => {
|
|
2199
|
+
const {
|
|
2200
|
+
mcpListHandler
|
|
2201
|
+
} = await import("./cli/handlers/mcp.js");
|
|
2202
|
+
await mcpListHandler();
|
|
2203
|
+
});
|
|
2204
|
+
mcp.command("get <name>").description("Get details about an MCP server. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async (name) => {
|
|
2205
|
+
const {
|
|
2206
|
+
mcpGetHandler
|
|
2207
|
+
} = await import("./cli/handlers/mcp.js");
|
|
2208
|
+
await mcpGetHandler(name);
|
|
2209
|
+
});
|
|
2210
|
+
mcp.command("add-json <name> <json>").description("Add an MCP server (stdio or SSE) with a JSON string").option("-s, --scope <scope>", "Configuration scope (local, user, or project)", "local").option("--client-secret", "Prompt for OAuth client secret (or set MCP_CLIENT_SECRET env var)").action(async (name, json, options) => {
|
|
2211
|
+
const {
|
|
2212
|
+
mcpAddJsonHandler
|
|
2213
|
+
} = await import("./cli/handlers/mcp.js");
|
|
2214
|
+
await mcpAddJsonHandler(name, json, options);
|
|
2215
|
+
});
|
|
2216
|
+
mcp.command("add-from-claude-desktop").description("Import MCP servers from Claude Desktop (Mac and WSL only)").option("-s, --scope <scope>", "Configuration scope (local, user, or project)", "local").action(async (options) => {
|
|
2217
|
+
const {
|
|
2218
|
+
mcpAddFromDesktopHandler
|
|
2219
|
+
} = await import("./cli/handlers/mcp.js");
|
|
2220
|
+
await mcpAddFromDesktopHandler(options);
|
|
2221
|
+
});
|
|
2222
|
+
mcp.command("reset-project-choices").description("Reset all approved and rejected project-scoped (.mcp.json) servers within this project").action(async () => {
|
|
2223
|
+
const {
|
|
2224
|
+
mcpResetChoicesHandler
|
|
2225
|
+
} = await import("./cli/handlers/mcp.js");
|
|
2226
|
+
await mcpResetChoicesHandler();
|
|
2227
|
+
});
|
|
2228
|
+
if (false) {}
|
|
2229
|
+
if (false) {}
|
|
2230
|
+
if (false) {}
|
|
2231
|
+
const auth = program.command("auth").description("Manage authentication").configureHelp(createSortedHelpConfig());
|
|
2232
|
+
auth.command("login").description("Sign in to your Anthropic account").option("--email <email>", "Pre-populate email address on the login page").option("--sso", "Force SSO login flow").option("--console", "Use Anthropic Console (API usage billing) instead of Claude subscription").option("--claudeai", "Use Claude subscription (default)").action(async ({
|
|
2233
|
+
email,
|
|
2234
|
+
sso,
|
|
2235
|
+
console: useConsole,
|
|
2236
|
+
claudeai
|
|
2237
|
+
}) => {
|
|
2238
|
+
const {
|
|
2239
|
+
authLogin
|
|
2240
|
+
} = await import("./cli/handlers/auth.js");
|
|
2241
|
+
await authLogin({
|
|
2242
|
+
email,
|
|
2243
|
+
sso,
|
|
2244
|
+
console: useConsole,
|
|
2245
|
+
claudeai
|
|
2246
|
+
});
|
|
2247
|
+
});
|
|
2248
|
+
auth.command("status").description("Show authentication status").option("--json", "Output as JSON (default)").option("--text", "Output as human-readable text").action(async (opts) => {
|
|
2249
|
+
const {
|
|
2250
|
+
authStatus
|
|
2251
|
+
} = await import("./cli/handlers/auth.js");
|
|
2252
|
+
await authStatus(opts);
|
|
2253
|
+
});
|
|
2254
|
+
auth.command("logout").description("Log out from your Anthropic account").action(async () => {
|
|
2255
|
+
const {
|
|
2256
|
+
authLogout
|
|
2257
|
+
} = await import("./cli/handlers/auth.js");
|
|
2258
|
+
await authLogout();
|
|
2259
|
+
});
|
|
2260
|
+
const coworkOption = () => new Option("--cowork", "Use cowork_plugins directory").hideHelp();
|
|
2261
|
+
const pluginCmd = program.command("plugin").alias("plugins").description("Manage Claude Code plugins").configureHelp(createSortedHelpConfig());
|
|
2262
|
+
pluginCmd.command("validate <path>").description("Validate a plugin or marketplace manifest").addOption(coworkOption()).action(async (manifestPath, options) => {
|
|
2263
|
+
const {
|
|
2264
|
+
pluginValidateHandler
|
|
2265
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2266
|
+
await pluginValidateHandler(manifestPath, options);
|
|
2267
|
+
});
|
|
2268
|
+
pluginCmd.command("list").description("List installed plugins").option("--json", "Output as JSON").option("--available", "Include available plugins from marketplaces (requires --json)").addOption(coworkOption()).action(async (options) => {
|
|
2269
|
+
const {
|
|
2270
|
+
pluginListHandler
|
|
2271
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2272
|
+
await pluginListHandler(options);
|
|
2273
|
+
});
|
|
2274
|
+
const marketplaceCmd = pluginCmd.command("marketplace").description("Manage Claude Code marketplaces").configureHelp(createSortedHelpConfig());
|
|
2275
|
+
marketplaceCmd.command("add <source>").description("Add a marketplace from a URL, path, or GitHub repo").addOption(coworkOption()).option("--sparse <paths...>", "Limit checkout to specific directories via git sparse-checkout (for monorepos). Example: --sparse .claude-plugin plugins").option("--scope <scope>", "Where to declare the marketplace: user (default), project, or local").action(async (source, options) => {
|
|
2276
|
+
const {
|
|
2277
|
+
marketplaceAddHandler
|
|
2278
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2279
|
+
await marketplaceAddHandler(source, options);
|
|
2280
|
+
});
|
|
2281
|
+
marketplaceCmd.command("list").description("List all configured marketplaces").option("--json", "Output as JSON").addOption(coworkOption()).action(async (options) => {
|
|
2282
|
+
const {
|
|
2283
|
+
marketplaceListHandler
|
|
2284
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2285
|
+
await marketplaceListHandler(options);
|
|
2286
|
+
});
|
|
2287
|
+
marketplaceCmd.command("remove <name>").alias("rm").description("Remove a configured marketplace").addOption(coworkOption()).action(async (name, options) => {
|
|
2288
|
+
const {
|
|
2289
|
+
marketplaceRemoveHandler
|
|
2290
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2291
|
+
await marketplaceRemoveHandler(name, options);
|
|
2292
|
+
});
|
|
2293
|
+
marketplaceCmd.command("update [name]").description("Update marketplace(s) from their source - updates all if no name specified").addOption(coworkOption()).action(async (name, options) => {
|
|
2294
|
+
const {
|
|
2295
|
+
marketplaceUpdateHandler
|
|
2296
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2297
|
+
await marketplaceUpdateHandler(name, options);
|
|
2298
|
+
});
|
|
2299
|
+
pluginCmd.command("install <plugin>").alias("i").description("Install a plugin from available marketplaces (use plugin@marketplace for specific marketplace)").option("-s, --scope <scope>", "Installation scope: user, project, or local", "user").addOption(coworkOption()).action(async (plugin, options) => {
|
|
2300
|
+
const {
|
|
2301
|
+
pluginInstallHandler
|
|
2302
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2303
|
+
await pluginInstallHandler(plugin, options);
|
|
2304
|
+
});
|
|
2305
|
+
pluginCmd.command("uninstall <plugin>").alias("remove").alias("rm").description("Uninstall an installed plugin").option("-s, --scope <scope>", "Uninstall from scope: user, project, or local", "user").option("--keep-data", "Preserve the plugin's persistent data directory (~/.claude/plugins/data/{id}/)").addOption(coworkOption()).action(async (plugin, options) => {
|
|
2306
|
+
const {
|
|
2307
|
+
pluginUninstallHandler
|
|
2308
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2309
|
+
await pluginUninstallHandler(plugin, options);
|
|
2310
|
+
});
|
|
2311
|
+
pluginCmd.command("enable <plugin>").description("Enable a disabled plugin").option("-s, --scope <scope>", `Installation scope: ${VALID_INSTALLABLE_SCOPES.join(", ")} (default: auto-detect)`).addOption(coworkOption()).action(async (plugin, options) => {
|
|
2312
|
+
const {
|
|
2313
|
+
pluginEnableHandler
|
|
2314
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2315
|
+
await pluginEnableHandler(plugin, options);
|
|
2316
|
+
});
|
|
2317
|
+
pluginCmd.command("disable [plugin]").description("Disable an enabled plugin").option("-a, --all", "Disable all enabled plugins").option("-s, --scope <scope>", `Installation scope: ${VALID_INSTALLABLE_SCOPES.join(", ")} (default: auto-detect)`).addOption(coworkOption()).action(async (plugin, options) => {
|
|
2318
|
+
const {
|
|
2319
|
+
pluginDisableHandler
|
|
2320
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2321
|
+
await pluginDisableHandler(plugin, options);
|
|
2322
|
+
});
|
|
2323
|
+
pluginCmd.command("update <plugin>").description("Update a plugin to the latest version (restart required to apply)").option("-s, --scope <scope>", `Installation scope: ${VALID_UPDATE_SCOPES.join(", ")} (default: user)`).addOption(coworkOption()).action(async (plugin, options) => {
|
|
2324
|
+
const {
|
|
2325
|
+
pluginUpdateHandler
|
|
2326
|
+
} = await import("./cli/handlers/plugins.js");
|
|
2327
|
+
await pluginUpdateHandler(plugin, options);
|
|
2328
|
+
});
|
|
2329
|
+
program.command("setup-token").description("Set up a long-lived authentication token (requires Claude subscription)").action(async () => {
|
|
2330
|
+
const [{
|
|
2331
|
+
setupTokenHandler
|
|
2332
|
+
}, {
|
|
2333
|
+
createRoot
|
|
2334
|
+
}] = await Promise.all([import("./cli/handlers/util.js"), import("./ink.js")]);
|
|
2335
|
+
const root = await createRoot(getBaseRenderOptions(false));
|
|
2336
|
+
await setupTokenHandler(root);
|
|
2337
|
+
});
|
|
2338
|
+
program.command("agents").description("List configured agents").option("--setting-sources <sources>", "Comma-separated list of setting sources to load (user, project, local).").action(async () => {
|
|
2339
|
+
const {
|
|
2340
|
+
agentsHandler
|
|
2341
|
+
} = await import("./cli/handlers/agents.js");
|
|
2342
|
+
await agentsHandler();
|
|
2343
|
+
process.exit(0);
|
|
2344
|
+
});
|
|
2345
|
+
if (false) {}
|
|
2346
|
+
if (false) {}
|
|
2347
|
+
if (false) {}
|
|
2348
|
+
program.command("doctor").description("Check the health of your Claude Code auto-updater. Note: The workspace trust dialog is skipped and stdio servers from .mcp.json are spawned for health checks. Only use this command in directories you trust.").action(async () => {
|
|
2349
|
+
const [{
|
|
2350
|
+
doctorHandler
|
|
2351
|
+
}, {
|
|
2352
|
+
createRoot
|
|
2353
|
+
}] = await Promise.all([import("./cli/handlers/util.js"), import("./ink.js")]);
|
|
2354
|
+
const root = await createRoot(getBaseRenderOptions(false));
|
|
2355
|
+
await doctorHandler(root);
|
|
2356
|
+
});
|
|
2357
|
+
program.command("update").alias("upgrade").description("Check for updates and install if available").action(async () => {
|
|
2358
|
+
const {
|
|
2359
|
+
update
|
|
2360
|
+
} = await import("./cli/update.js");
|
|
2361
|
+
await update();
|
|
2362
|
+
});
|
|
2363
|
+
if (false) {}
|
|
2364
|
+
if (false) {}
|
|
2365
|
+
program.command("install [target]").description("Install Claude Code native build. Use [target] to specify version (stable, latest, or specific version)").option("--force", "Force installation even if already installed").action(async (target, options) => {
|
|
2366
|
+
const {
|
|
2367
|
+
installHandler
|
|
2368
|
+
} = await import("./cli/handlers/util.js");
|
|
2369
|
+
await installHandler(target, options);
|
|
2370
|
+
});
|
|
2371
|
+
if (false) {}
|
|
2372
|
+
profileCheckpoint("run_before_parse");
|
|
2373
|
+
await program.parseAsync(process.argv);
|
|
2374
|
+
profileCheckpoint("run_after_parse");
|
|
2375
|
+
profileCheckpoint("main_after_run");
|
|
2376
|
+
profileReport();
|
|
2377
|
+
return program;
|
|
2378
|
+
}
|
|
2379
|
+
async function logTenguInit({
|
|
2380
|
+
hasInitialPrompt,
|
|
2381
|
+
hasStdin,
|
|
2382
|
+
verbose,
|
|
2383
|
+
debug,
|
|
2384
|
+
debugToStderr,
|
|
2385
|
+
print,
|
|
2386
|
+
outputFormat,
|
|
2387
|
+
inputFormat,
|
|
2388
|
+
numAllowedTools,
|
|
2389
|
+
numDisallowedTools,
|
|
2390
|
+
mcpClientCount,
|
|
2391
|
+
worktreeEnabled,
|
|
2392
|
+
skipWebFetchPreflight,
|
|
2393
|
+
githubActionInputs,
|
|
2394
|
+
dangerouslySkipPermissionsPassed,
|
|
2395
|
+
permissionMode,
|
|
2396
|
+
modeIsBypass,
|
|
2397
|
+
allowDangerouslySkipPermissionsPassed,
|
|
2398
|
+
systemPromptFlag,
|
|
2399
|
+
appendSystemPromptFlag,
|
|
2400
|
+
thinkingConfig,
|
|
2401
|
+
assistantActivationPath
|
|
2402
|
+
}) {
|
|
2403
|
+
try {
|
|
2404
|
+
logEvent("tengu_init", {
|
|
2405
|
+
entrypoint: "claude",
|
|
2406
|
+
hasInitialPrompt,
|
|
2407
|
+
hasStdin,
|
|
2408
|
+
verbose,
|
|
2409
|
+
debug,
|
|
2410
|
+
debugToStderr,
|
|
2411
|
+
print,
|
|
2412
|
+
outputFormat,
|
|
2413
|
+
inputFormat,
|
|
2414
|
+
numAllowedTools,
|
|
2415
|
+
numDisallowedTools,
|
|
2416
|
+
mcpClientCount,
|
|
2417
|
+
worktree: worktreeEnabled,
|
|
2418
|
+
skipWebFetchPreflight,
|
|
2419
|
+
...githubActionInputs && {
|
|
2420
|
+
githubActionInputs
|
|
2421
|
+
},
|
|
2422
|
+
dangerouslySkipPermissionsPassed,
|
|
2423
|
+
permissionMode,
|
|
2424
|
+
modeIsBypass,
|
|
2425
|
+
inProtectedNamespace: isInProtectedNamespace(),
|
|
2426
|
+
allowDangerouslySkipPermissionsPassed,
|
|
2427
|
+
thinkingType: thinkingConfig.type,
|
|
2428
|
+
...systemPromptFlag && {
|
|
2429
|
+
systemPromptFlag
|
|
2430
|
+
},
|
|
2431
|
+
...appendSystemPromptFlag && {
|
|
2432
|
+
appendSystemPromptFlag
|
|
2433
|
+
},
|
|
2434
|
+
is_simple: isBareMode() || undefined,
|
|
2435
|
+
is_coordinator: undefined,
|
|
2436
|
+
...assistantActivationPath && {
|
|
2437
|
+
assistantActivationPath
|
|
2438
|
+
},
|
|
2439
|
+
autoUpdatesChannel: getInitialSettings().autoUpdatesChannel ?? "latest",
|
|
2440
|
+
...{}
|
|
2441
|
+
});
|
|
2442
|
+
} catch (error) {
|
|
2443
|
+
logError(error);
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
function maybeActivateProactive(options) {
|
|
2447
|
+
if (false) {}
|
|
2448
|
+
}
|
|
2449
|
+
function maybeActivateBrief(options) {
|
|
2450
|
+
if (true)
|
|
2451
|
+
return;
|
|
2452
|
+
const briefFlag = options.brief;
|
|
2453
|
+
const briefEnv = isEnvTruthy(process.env.CLAUDE_CODE_BRIEF);
|
|
2454
|
+
if (!briefFlag && !briefEnv)
|
|
2455
|
+
return;
|
|
2456
|
+
const {
|
|
2457
|
+
isBriefEntitled
|
|
2458
|
+
} = require("./tools/BriefTool/BriefTool.js");
|
|
2459
|
+
const entitled = isBriefEntitled();
|
|
2460
|
+
if (entitled) {
|
|
2461
|
+
setUserMsgOptIn(true);
|
|
2462
|
+
}
|
|
2463
|
+
logEvent("tengu_brief_mode_enabled", {
|
|
2464
|
+
enabled: entitled,
|
|
2465
|
+
gated: !entitled,
|
|
2466
|
+
source: briefEnv ? "env" : "flag"
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
function resetCursor() {
|
|
2470
|
+
const terminal = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : undefined;
|
|
2471
|
+
terminal?.write(SHOW_CURSOR);
|
|
2472
|
+
}
|
|
2473
|
+
function extractTeammateOptions(options) {
|
|
2474
|
+
if (typeof options !== "object" || options === null) {
|
|
2475
|
+
return {};
|
|
2476
|
+
}
|
|
2477
|
+
const opts = options;
|
|
2478
|
+
const teammateMode = opts.teammateMode;
|
|
2479
|
+
return {
|
|
2480
|
+
agentId: typeof opts.agentId === "string" ? opts.agentId : undefined,
|
|
2481
|
+
agentName: typeof opts.agentName === "string" ? opts.agentName : undefined,
|
|
2482
|
+
teamName: typeof opts.teamName === "string" ? opts.teamName : undefined,
|
|
2483
|
+
agentColor: typeof opts.agentColor === "string" ? opts.agentColor : undefined,
|
|
2484
|
+
planModeRequired: typeof opts.planModeRequired === "boolean" ? opts.planModeRequired : undefined,
|
|
2485
|
+
parentSessionId: typeof opts.parentSessionId === "string" ? opts.parentSessionId : undefined,
|
|
2486
|
+
teammateMode: teammateMode === "auto" || teammateMode === "tmux" || teammateMode === "in-process" ? teammateMode : undefined,
|
|
2487
|
+
agentType: typeof opts.agentType === "string" ? opts.agentType : undefined
|
|
2488
|
+
};
|
|
2489
|
+
}
|