@xelauvas/xela-cli 0.1.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/README.md +200 -0
- package/bin/xela +100 -0
- package/package.json +88 -0
- package/src/QueryEngine.ts +1295 -0
- package/src/Task.ts +125 -0
- package/src/Tool.ts +792 -0
- package/src/_shims/_generated_stubs/_universal_stub.mjs +168 -0
- package/src/_shims/_generated_stubs/text_stub.mjs +1 -0
- package/src/_shims/bun_bundle.js +9 -0
- package/src/_shims/cjs_stub.cjs +23 -0
- package/src/_shims/empty_stub.js +33 -0
- package/src/_shims/loader.js +352 -0
- package/src/_shims/openai_adapter.ts +486 -0
- package/src/_shims/react_compiler_runtime.js +17 -0
- package/src/_shims/register.js +148 -0
- package/src/assistant/sessionHistory.ts +87 -0
- package/src/bootstrap/state.ts +1759 -0
- package/src/bridge/bridgeApi.ts +539 -0
- package/src/bridge/bridgeConfig.ts +48 -0
- package/src/bridge/bridgeDebug.ts +135 -0
- package/src/bridge/bridgeEnabled.ts +202 -0
- package/src/bridge/bridgeMain.ts +2999 -0
- package/src/bridge/bridgeMessaging.ts +461 -0
- package/src/bridge/bridgePermissionCallbacks.ts +43 -0
- package/src/bridge/bridgePointer.ts +210 -0
- package/src/bridge/bridgeStatusUtil.ts +163 -0
- package/src/bridge/bridgeUI.ts +530 -0
- package/src/bridge/capacityWake.ts +56 -0
- package/src/bridge/codeSessionApi.ts +168 -0
- package/src/bridge/createSession.ts +384 -0
- package/src/bridge/debugUtils.ts +141 -0
- package/src/bridge/envLessBridgeConfig.ts +165 -0
- package/src/bridge/flushGate.ts +71 -0
- package/src/bridge/inboundAttachments.ts +175 -0
- package/src/bridge/inboundMessages.ts +80 -0
- package/src/bridge/initReplBridge.ts +569 -0
- package/src/bridge/jwtUtils.ts +256 -0
- package/src/bridge/pollConfig.ts +110 -0
- package/src/bridge/pollConfigDefaults.ts +82 -0
- package/src/bridge/remoteBridgeCore.ts +1008 -0
- package/src/bridge/replBridge.ts +2406 -0
- package/src/bridge/replBridgeHandle.ts +36 -0
- package/src/bridge/replBridgeTransport.ts +370 -0
- package/src/bridge/sessionIdCompat.ts +57 -0
- package/src/bridge/sessionRunner.ts +550 -0
- package/src/bridge/trustedDevice.ts +210 -0
- package/src/bridge/types.ts +262 -0
- package/src/bridge/workSecret.ts +127 -0
- package/src/buddy/CompanionSprite.tsx +371 -0
- package/src/buddy/companion.ts +133 -0
- package/src/buddy/prompt.ts +36 -0
- package/src/buddy/sprites.ts +514 -0
- package/src/buddy/types.ts +148 -0
- package/src/buddy/useBuddyNotification.tsx +98 -0
- package/src/cli/exit.ts +31 -0
- package/src/cli/handlers/agents.ts +70 -0
- package/src/cli/handlers/auth.ts +330 -0
- package/src/cli/handlers/autoMode.ts +170 -0
- package/src/cli/handlers/mcp.tsx +362 -0
- package/src/cli/handlers/plugins.ts +878 -0
- package/src/cli/handlers/util.tsx +110 -0
- package/src/cli/ndjsonSafeStringify.ts +32 -0
- package/src/cli/print.ts +5594 -0
- package/src/cli/remoteIO.ts +255 -0
- package/src/cli/structuredIO.ts +859 -0
- package/src/cli/transports/HybridTransport.ts +282 -0
- package/src/cli/transports/SSETransport.ts +711 -0
- package/src/cli/transports/SerialBatchEventUploader.ts +275 -0
- package/src/cli/transports/WebSocketTransport.ts +800 -0
- package/src/cli/transports/WorkerStateUploader.ts +131 -0
- package/src/cli/transports/ccrClient.ts +998 -0
- package/src/cli/transports/transportUtils.ts +45 -0
- package/src/cli/update.ts +422 -0
- package/src/commands/add-dir/add-dir.tsx +126 -0
- package/src/commands/add-dir/index.ts +11 -0
- package/src/commands/add-dir/validation.ts +110 -0
- package/src/commands/advisor.ts +109 -0
- package/src/commands/agents/agents.tsx +12 -0
- package/src/commands/agents/index.ts +10 -0
- package/src/commands/ant-trace/index.js +1 -0
- package/src/commands/autofix-pr/index.js +1 -0
- package/src/commands/backfill-sessions/index.js +1 -0
- package/src/commands/branch/branch.ts +296 -0
- package/src/commands/branch/index.ts +14 -0
- package/src/commands/break-cache/index.js +1 -0
- package/src/commands/bridge/bridge.tsx +509 -0
- package/src/commands/bridge/index.ts +26 -0
- package/src/commands/bridge-kick.ts +200 -0
- package/src/commands/brief.ts +130 -0
- package/src/commands/btw/btw.tsx +243 -0
- package/src/commands/btw/index.ts +13 -0
- package/src/commands/bughunter/index.js +1 -0
- package/src/commands/chrome/chrome.tsx +285 -0
- package/src/commands/chrome/index.ts +13 -0
- package/src/commands/clear/caches.ts +144 -0
- package/src/commands/clear/clear.ts +7 -0
- package/src/commands/clear/conversation.ts +251 -0
- package/src/commands/clear/index.ts +19 -0
- package/src/commands/color/color.ts +93 -0
- package/src/commands/color/index.ts +16 -0
- package/src/commands/commit-push-pr.ts +158 -0
- package/src/commands/commit.ts +92 -0
- package/src/commands/compact/compact.ts +287 -0
- package/src/commands/compact/index.ts +15 -0
- package/src/commands/config/config.tsx +7 -0
- package/src/commands/config/index.ts +11 -0
- package/src/commands/context/context-noninteractive.ts +325 -0
- package/src/commands/context/context.tsx +64 -0
- package/src/commands/context/index.ts +24 -0
- package/src/commands/copy/copy.tsx +371 -0
- package/src/commands/copy/index.ts +15 -0
- package/src/commands/cost/cost.ts +24 -0
- package/src/commands/cost/index.ts +23 -0
- package/src/commands/createMovedToPluginCommand.ts +65 -0
- package/src/commands/ctx_viz/index.js +1 -0
- package/src/commands/debug-tool-call/index.js +1 -0
- package/src/commands/desktop/desktop.tsx +9 -0
- package/src/commands/desktop/index.ts +26 -0
- package/src/commands/diff/diff.tsx +9 -0
- package/src/commands/diff/index.ts +8 -0
- package/src/commands/doctor/doctor.tsx +7 -0
- package/src/commands/doctor/index.ts +12 -0
- package/src/commands/effort/effort.tsx +183 -0
- package/src/commands/effort/index.ts +13 -0
- package/src/commands/env/index.js +1 -0
- package/src/commands/exit/exit.tsx +33 -0
- package/src/commands/exit/index.ts +12 -0
- package/src/commands/export/export.tsx +91 -0
- package/src/commands/export/index.ts +11 -0
- package/src/commands/extra-usage/extra-usage-core.ts +118 -0
- package/src/commands/extra-usage/extra-usage-noninteractive.ts +16 -0
- package/src/commands/extra-usage/extra-usage.tsx +17 -0
- package/src/commands/extra-usage/index.ts +31 -0
- package/src/commands/fast/fast.tsx +269 -0
- package/src/commands/fast/index.ts +26 -0
- package/src/commands/feedback/feedback.tsx +25 -0
- package/src/commands/feedback/index.ts +26 -0
- package/src/commands/files/files.ts +19 -0
- package/src/commands/files/index.ts +12 -0
- package/src/commands/good-claude/index.js +1 -0
- package/src/commands/heapdump/heapdump.ts +17 -0
- package/src/commands/heapdump/index.ts +12 -0
- package/src/commands/help/help.tsx +11 -0
- package/src/commands/help/index.ts +10 -0
- package/src/commands/hooks/hooks.tsx +13 -0
- package/src/commands/hooks/index.ts +11 -0
- package/src/commands/ide/ide.tsx +646 -0
- package/src/commands/ide/index.ts +11 -0
- package/src/commands/init-verifiers.ts +262 -0
- package/src/commands/init.ts +256 -0
- package/src/commands/insights.ts +3200 -0
- package/src/commands/install-github-app/ApiKeyStep.tsx +231 -0
- package/src/commands/install-github-app/CheckExistingSecretStep.tsx +190 -0
- package/src/commands/install-github-app/CheckGitHubStep.tsx +15 -0
- package/src/commands/install-github-app/ChooseRepoStep.tsx +211 -0
- package/src/commands/install-github-app/CreatingStep.tsx +65 -0
- package/src/commands/install-github-app/ErrorStep.tsx +85 -0
- package/src/commands/install-github-app/ExistingWorkflowStep.tsx +103 -0
- package/src/commands/install-github-app/InstallAppStep.tsx +94 -0
- package/src/commands/install-github-app/OAuthFlowStep.tsx +276 -0
- package/src/commands/install-github-app/SuccessStep.tsx +96 -0
- package/src/commands/install-github-app/WarningsStep.tsx +73 -0
- package/src/commands/install-github-app/index.ts +13 -0
- package/src/commands/install-github-app/install-github-app.tsx +587 -0
- package/src/commands/install-github-app/setupGitHubActions.ts +325 -0
- package/src/commands/install-slack-app/index.ts +12 -0
- package/src/commands/install-slack-app/install-slack-app.ts +30 -0
- package/src/commands/install.tsx +300 -0
- package/src/commands/issue/index.js +1 -0
- package/src/commands/keybindings/index.ts +13 -0
- package/src/commands/keybindings/keybindings.ts +53 -0
- package/src/commands/login/index.ts +14 -0
- package/src/commands/login/login.tsx +104 -0
- package/src/commands/logout/index.ts +10 -0
- package/src/commands/logout/logout.tsx +82 -0
- package/src/commands/mcp/addCommand.ts +280 -0
- package/src/commands/mcp/index.ts +12 -0
- package/src/commands/mcp/mcp.tsx +85 -0
- package/src/commands/mcp/xaaIdpCommand.ts +266 -0
- package/src/commands/memory/index.ts +10 -0
- package/src/commands/memory/memory.tsx +90 -0
- package/src/commands/mobile/index.ts +11 -0
- package/src/commands/mobile/mobile.tsx +274 -0
- package/src/commands/mock-limits/index.js +1 -0
- package/src/commands/model/index.ts +16 -0
- package/src/commands/model/model.tsx +297 -0
- package/src/commands/oauth-refresh/index.js +1 -0
- package/src/commands/onboarding/index.js +1 -0
- package/src/commands/output-style/index.ts +11 -0
- package/src/commands/output-style/output-style.tsx +7 -0
- package/src/commands/passes/index.ts +22 -0
- package/src/commands/passes/passes.tsx +24 -0
- package/src/commands/perf-issue/index.js +1 -0
- package/src/commands/permissions/index.ts +11 -0
- package/src/commands/permissions/permissions.tsx +10 -0
- package/src/commands/plan/index.ts +11 -0
- package/src/commands/plan/plan.tsx +122 -0
- package/src/commands/plugin/AddMarketplace.tsx +162 -0
- package/src/commands/plugin/BrowseMarketplace.tsx +802 -0
- package/src/commands/plugin/DiscoverPlugins.tsx +781 -0
- package/src/commands/plugin/ManageMarketplaces.tsx +838 -0
- package/src/commands/plugin/ManagePlugins.tsx +2215 -0
- package/src/commands/plugin/PluginErrors.tsx +124 -0
- package/src/commands/plugin/PluginOptionsDialog.tsx +357 -0
- package/src/commands/plugin/PluginOptionsFlow.tsx +135 -0
- package/src/commands/plugin/PluginSettings.tsx +1072 -0
- package/src/commands/plugin/PluginTrustWarning.tsx +32 -0
- package/src/commands/plugin/UnifiedInstalledCell.tsx +565 -0
- package/src/commands/plugin/ValidatePlugin.tsx +98 -0
- package/src/commands/plugin/index.tsx +11 -0
- package/src/commands/plugin/parseArgs.ts +103 -0
- package/src/commands/plugin/plugin.tsx +7 -0
- package/src/commands/plugin/pluginDetailsHelpers.tsx +117 -0
- package/src/commands/plugin/usePagination.ts +171 -0
- package/src/commands/pr_comments/index.ts +50 -0
- package/src/commands/privacy-settings/index.ts +14 -0
- package/src/commands/privacy-settings/privacy-settings.tsx +58 -0
- package/src/commands/rate-limit-options/index.ts +19 -0
- package/src/commands/rate-limit-options/rate-limit-options.tsx +210 -0
- package/src/commands/release-notes/index.ts +11 -0
- package/src/commands/release-notes/release-notes.ts +50 -0
- package/src/commands/reload-plugins/index.ts +18 -0
- package/src/commands/reload-plugins/reload-plugins.ts +61 -0
- package/src/commands/remote-env/index.ts +15 -0
- package/src/commands/remote-env/remote-env.tsx +7 -0
- package/src/commands/remote-setup/api.ts +182 -0
- package/src/commands/remote-setup/index.ts +20 -0
- package/src/commands/remote-setup/remote-setup.tsx +187 -0
- package/src/commands/rename/generateSessionName.ts +67 -0
- package/src/commands/rename/index.ts +12 -0
- package/src/commands/rename/rename.ts +87 -0
- package/src/commands/reset-limits/index.js +4 -0
- package/src/commands/resume/index.ts +12 -0
- package/src/commands/resume/resume.tsx +275 -0
- package/src/commands/review/UltrareviewOverageDialog.tsx +96 -0
- package/src/commands/review/reviewRemote.ts +316 -0
- package/src/commands/review/ultrareviewCommand.tsx +58 -0
- package/src/commands/review/ultrareviewEnabled.ts +14 -0
- package/src/commands/review.ts +57 -0
- package/src/commands/rewind/index.ts +13 -0
- package/src/commands/rewind/rewind.ts +13 -0
- package/src/commands/sandbox-toggle/index.ts +50 -0
- package/src/commands/sandbox-toggle/sandbox-toggle.tsx +83 -0
- package/src/commands/security-review.ts +243 -0
- package/src/commands/session/index.ts +16 -0
- package/src/commands/session/session.tsx +140 -0
- package/src/commands/share/index.js +1 -0
- package/src/commands/skills/index.ts +10 -0
- package/src/commands/skills/skills.tsx +8 -0
- package/src/commands/stats/index.ts +10 -0
- package/src/commands/stats/stats.tsx +7 -0
- package/src/commands/status/index.ts +12 -0
- package/src/commands/status/status.tsx +8 -0
- package/src/commands/statusline.tsx +24 -0
- package/src/commands/stickers/index.ts +11 -0
- package/src/commands/stickers/stickers.ts +16 -0
- package/src/commands/summary/index.js +1 -0
- package/src/commands/tag/index.ts +12 -0
- package/src/commands/tag/tag.tsx +215 -0
- package/src/commands/tasks/index.ts +11 -0
- package/src/commands/tasks/tasks.tsx +8 -0
- package/src/commands/teleport/index.js +1 -0
- package/src/commands/terminalSetup/index.ts +23 -0
- package/src/commands/terminalSetup/terminalSetup.tsx +531 -0
- package/src/commands/theme/index.ts +10 -0
- package/src/commands/theme/theme.tsx +57 -0
- package/src/commands/thinkback/index.ts +13 -0
- package/src/commands/thinkback/thinkback.tsx +554 -0
- package/src/commands/thinkback-play/index.ts +17 -0
- package/src/commands/thinkback-play/thinkback-play.ts +43 -0
- package/src/commands/ultraplan.tsx +471 -0
- package/src/commands/upgrade/index.ts +16 -0
- package/src/commands/upgrade/upgrade.tsx +38 -0
- package/src/commands/usage/index.ts +9 -0
- package/src/commands/usage/usage.tsx +7 -0
- package/src/commands/version.ts +22 -0
- package/src/commands/vim/index.ts +11 -0
- package/src/commands/vim/vim.ts +38 -0
- package/src/commands/voice/index.ts +20 -0
- package/src/commands/voice/voice.ts +150 -0
- package/src/commands.ts +754 -0
- package/src/components/AgentProgressLine.tsx +136 -0
- package/src/components/App.tsx +56 -0
- package/src/components/ApproveApiKey.tsx +123 -0
- package/src/components/AutoModeOptInDialog.tsx +142 -0
- package/src/components/AutoUpdater.tsx +198 -0
- package/src/components/AutoUpdaterWrapper.tsx +91 -0
- package/src/components/AwsAuthStatusBox.tsx +82 -0
- package/src/components/BaseTextInput.tsx +136 -0
- package/src/components/BashModeProgress.tsx +56 -0
- package/src/components/BridgeDialog.tsx +401 -0
- package/src/components/BypassPermissionsModeDialog.tsx +87 -0
- package/src/components/ChannelDowngradeDialog.tsx +102 -0
- package/src/components/ClaudeCodeHint/PluginHintMenu.tsx +78 -0
- package/src/components/ClaudeInChromeOnboarding.tsx +121 -0
- package/src/components/ClaudeMdExternalIncludesDialog.tsx +137 -0
- package/src/components/ClickableImageRef.tsx +73 -0
- package/src/components/CompactSummary.tsx +118 -0
- package/src/components/ConfigurableShortcutHint.tsx +57 -0
- package/src/components/ConsoleOAuthFlow.tsx +631 -0
- package/src/components/ContextSuggestions.tsx +47 -0
- package/src/components/ContextVisualization.tsx +489 -0
- package/src/components/CoordinatorAgentStatus.tsx +273 -0
- package/src/components/CostThresholdDialog.tsx +50 -0
- package/src/components/CtrlOToExpand.tsx +51 -0
- package/src/components/CustomSelect/SelectMulti.tsx +213 -0
- package/src/components/CustomSelect/index.ts +3 -0
- package/src/components/CustomSelect/option-map.ts +50 -0
- package/src/components/CustomSelect/select-input-option.tsx +488 -0
- package/src/components/CustomSelect/select-option.tsx +68 -0
- package/src/components/CustomSelect/select.tsx +690 -0
- package/src/components/CustomSelect/use-multi-select-state.ts +414 -0
- package/src/components/CustomSelect/use-select-input.ts +287 -0
- package/src/components/CustomSelect/use-select-navigation.ts +653 -0
- package/src/components/CustomSelect/use-select-state.ts +157 -0
- package/src/components/DesktopHandoff.tsx +193 -0
- package/src/components/DesktopUpsell/DesktopUpsellStartup.tsx +171 -0
- package/src/components/DevBar.tsx +49 -0
- package/src/components/DevChannelsDialog.tsx +105 -0
- package/src/components/DiagnosticsDisplay.tsx +95 -0
- package/src/components/EffortCallout.tsx +265 -0
- package/src/components/EffortIndicator.ts +42 -0
- package/src/components/ExitFlow.tsx +48 -0
- package/src/components/ExportDialog.tsx +128 -0
- package/src/components/FallbackToolUseErrorMessage.tsx +116 -0
- package/src/components/FallbackToolUseRejectedMessage.tsx +16 -0
- package/src/components/FastIcon.tsx +46 -0
- package/src/components/Feedback.tsx +592 -0
- package/src/components/FeedbackSurvey/FeedbackSurvey.tsx +174 -0
- package/src/components/FeedbackSurvey/FeedbackSurveyView.tsx +108 -0
- package/src/components/FeedbackSurvey/TranscriptSharePrompt.tsx +88 -0
- package/src/components/FeedbackSurvey/submitTranscriptShare.ts +112 -0
- package/src/components/FeedbackSurvey/useDebouncedDigitInput.ts +82 -0
- package/src/components/FeedbackSurvey/useFeedbackSurvey.tsx +296 -0
- package/src/components/FeedbackSurvey/useMemorySurvey.tsx +213 -0
- package/src/components/FeedbackSurvey/usePostCompactSurvey.tsx +206 -0
- package/src/components/FeedbackSurvey/useSurveyState.tsx +100 -0
- package/src/components/FileEditToolDiff.tsx +181 -0
- package/src/components/FileEditToolUpdatedMessage.tsx +124 -0
- package/src/components/FileEditToolUseRejectedMessage.tsx +170 -0
- package/src/components/FilePathLink.tsx +43 -0
- package/src/components/FullscreenLayout.tsx +637 -0
- package/src/components/GlobalSearchDialog.tsx +343 -0
- package/src/components/HelpV2/Commands.tsx +82 -0
- package/src/components/HelpV2/General.tsx +23 -0
- package/src/components/HelpV2/HelpV2.tsx +184 -0
- package/src/components/HighlightedCode/Fallback.tsx +193 -0
- package/src/components/HighlightedCode.tsx +190 -0
- package/src/components/HistorySearchDialog.tsx +118 -0
- package/src/components/IdeAutoConnectDialog.tsx +154 -0
- package/src/components/IdeOnboardingDialog.tsx +167 -0
- package/src/components/IdeStatusIndicator.tsx +58 -0
- package/src/components/IdleReturnDialog.tsx +118 -0
- package/src/components/InterruptedByUser.tsx +15 -0
- package/src/components/InvalidConfigDialog.tsx +156 -0
- package/src/components/InvalidSettingsDialog.tsx +89 -0
- package/src/components/KeybindingWarnings.tsx +55 -0
- package/src/components/LanguagePicker.tsx +86 -0
- package/src/components/LogSelector.tsx +1575 -0
- package/src/components/LogoV2/AnimatedAsterisk.tsx +50 -0
- package/src/components/LogoV2/AnimatedClawd.tsx +124 -0
- package/src/components/LogoV2/ChannelsNotice.tsx +266 -0
- package/src/components/LogoV2/Clawd.tsx +240 -0
- package/src/components/LogoV2/CondensedLogo.tsx +161 -0
- package/src/components/LogoV2/EmergencyTip.tsx +58 -0
- package/src/components/LogoV2/Feed.tsx +112 -0
- package/src/components/LogoV2/FeedColumn.tsx +59 -0
- package/src/components/LogoV2/GuestPassesUpsell.tsx +70 -0
- package/src/components/LogoV2/LogoV2.tsx +543 -0
- package/src/components/LogoV2/Opus1mMergeNotice.tsx +55 -0
- package/src/components/LogoV2/OverageCreditUpsell.tsx +166 -0
- package/src/components/LogoV2/VoiceModeNotice.tsx +68 -0
- package/src/components/LogoV2/WelcomeV2.tsx +433 -0
- package/src/components/LogoV2/feedConfigs.tsx +92 -0
- package/src/components/LspRecommendation/LspRecommendationMenu.tsx +88 -0
- package/src/components/MCPServerApprovalDialog.tsx +115 -0
- package/src/components/MCPServerDesktopImportDialog.tsx +203 -0
- package/src/components/MCPServerDialogCopy.tsx +15 -0
- package/src/components/MCPServerMultiselectDialog.tsx +133 -0
- package/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.tsx +149 -0
- package/src/components/ManagedSettingsSecurityDialog/utils.ts +144 -0
- package/src/components/Markdown.tsx +236 -0
- package/src/components/MarkdownTable.tsx +322 -0
- package/src/components/MemoryUsageIndicator.tsx +37 -0
- package/src/components/Message.tsx +627 -0
- package/src/components/MessageModel.tsx +43 -0
- package/src/components/MessageResponse.tsx +78 -0
- package/src/components/MessageRow.tsx +383 -0
- package/src/components/MessageSelector.tsx +831 -0
- package/src/components/MessageTimestamp.tsx +63 -0
- package/src/components/Messages.tsx +834 -0
- package/src/components/ModelPicker.tsx +448 -0
- package/src/components/NativeAutoUpdater.tsx +193 -0
- package/src/components/NotebookEditToolUseRejectedMessage.tsx +92 -0
- package/src/components/OffscreenFreeze.tsx +44 -0
- package/src/components/Onboarding.tsx +244 -0
- package/src/components/OutputStylePicker.tsx +112 -0
- package/src/components/PackageManagerAutoUpdater.tsx +104 -0
- package/src/components/Passes/Passes.tsx +184 -0
- package/src/components/PrBadge.tsx +97 -0
- package/src/components/PressEnterToContinue.tsx +15 -0
- package/src/components/PromptInput/HistorySearchInput.tsx +51 -0
- package/src/components/PromptInput/IssueFlagBanner.tsx +12 -0
- package/src/components/PromptInput/Notifications.tsx +332 -0
- package/src/components/PromptInput/PromptInput.tsx +2339 -0
- package/src/components/PromptInput/PromptInputFooter.tsx +191 -0
- package/src/components/PromptInput/PromptInputFooterLeftSide.tsx +517 -0
- package/src/components/PromptInput/PromptInputFooterSuggestions.tsx +293 -0
- package/src/components/PromptInput/PromptInputHelpMenu.tsx +358 -0
- package/src/components/PromptInput/PromptInputModeIndicator.tsx +93 -0
- package/src/components/PromptInput/PromptInputQueuedCommands.tsx +117 -0
- package/src/components/PromptInput/PromptInputStashNotice.tsx +25 -0
- package/src/components/PromptInput/SandboxPromptFooterHint.tsx +64 -0
- package/src/components/PromptInput/ShimmeredInput.tsx +143 -0
- package/src/components/PromptInput/VoiceIndicator.tsx +137 -0
- package/src/components/PromptInput/inputModes.ts +33 -0
- package/src/components/PromptInput/inputPaste.ts +90 -0
- package/src/components/PromptInput/useMaybeTruncateInput.ts +58 -0
- package/src/components/PromptInput/usePromptInputPlaceholder.ts +76 -0
- package/src/components/PromptInput/useShowFastIconHint.ts +31 -0
- package/src/components/PromptInput/useSwarmBanner.ts +155 -0
- package/src/components/PromptInput/utils.ts +60 -0
- package/src/components/QuickOpenDialog.tsx +244 -0
- package/src/components/RemoteCallout.tsx +76 -0
- package/src/components/RemoteEnvironmentDialog.tsx +340 -0
- package/src/components/ResumeTask.tsx +268 -0
- package/src/components/SandboxViolationExpandedView.tsx +99 -0
- package/src/components/ScrollKeybindingHandler.tsx +1012 -0
- package/src/components/SearchBox.tsx +72 -0
- package/src/components/SentryErrorBoundary.ts +28 -0
- package/src/components/SessionBackgroundHint.tsx +108 -0
- package/src/components/SessionPreview.tsx +194 -0
- package/src/components/Settings/Config.tsx +1822 -0
- package/src/components/Settings/Settings.tsx +137 -0
- package/src/components/Settings/Status.tsx +241 -0
- package/src/components/Settings/Usage.tsx +377 -0
- package/src/components/ShowInIDEPrompt.tsx +170 -0
- package/src/components/SkillImprovementSurvey.tsx +152 -0
- package/src/components/Spinner/FlashingChar.tsx +61 -0
- package/src/components/Spinner/GlimmerMessage.tsx +328 -0
- package/src/components/Spinner/ShimmerChar.tsx +36 -0
- package/src/components/Spinner/SpinnerAnimationRow.tsx +265 -0
- package/src/components/Spinner/SpinnerGlyph.tsx +80 -0
- package/src/components/Spinner/TeammateSpinnerLine.tsx +233 -0
- package/src/components/Spinner/TeammateSpinnerTree.tsx +272 -0
- package/src/components/Spinner/index.ts +10 -0
- package/src/components/Spinner/teammateSelectHint.ts +1 -0
- package/src/components/Spinner/useShimmerAnimation.ts +31 -0
- package/src/components/Spinner/useStalledAnimation.ts +75 -0
- package/src/components/Spinner/utils.ts +84 -0
- package/src/components/Spinner.tsx +562 -0
- package/src/components/Stats.tsx +1228 -0
- package/src/components/StatusLine.tsx +324 -0
- package/src/components/StatusNotices.tsx +55 -0
- package/src/components/StructuredDiff/Fallback.tsx +487 -0
- package/src/components/StructuredDiff/colorDiff.ts +37 -0
- package/src/components/StructuredDiff.tsx +190 -0
- package/src/components/StructuredDiffList.tsx +30 -0
- package/src/components/TagTabs.tsx +139 -0
- package/src/components/TaskListV2.tsx +378 -0
- package/src/components/TeammateViewHeader.tsx +82 -0
- package/src/components/TeleportError.tsx +189 -0
- package/src/components/TeleportProgress.tsx +140 -0
- package/src/components/TeleportRepoMismatchDialog.tsx +104 -0
- package/src/components/TeleportResumeWrapper.tsx +167 -0
- package/src/components/TeleportStash.tsx +116 -0
- package/src/components/TextInput.tsx +124 -0
- package/src/components/ThemePicker.tsx +333 -0
- package/src/components/ThinkingToggle.tsx +153 -0
- package/src/components/TokenWarning.tsx +179 -0
- package/src/components/ToolUseLoader.tsx +42 -0
- package/src/components/TrustDialog/TrustDialog.tsx +290 -0
- package/src/components/TrustDialog/utils.ts +245 -0
- package/src/components/ValidationErrorsList.tsx +148 -0
- package/src/components/VimTextInput.tsx +140 -0
- package/src/components/VirtualMessageList.tsx +1082 -0
- package/src/components/WorkflowMultiselectDialog.tsx +128 -0
- package/src/components/WorktreeExitDialog.tsx +231 -0
- package/src/components/agents/AgentDetail.tsx +220 -0
- package/src/components/agents/AgentEditor.tsx +178 -0
- package/src/components/agents/AgentNavigationFooter.tsx +26 -0
- package/src/components/agents/AgentsList.tsx +440 -0
- package/src/components/agents/AgentsMenu.tsx +800 -0
- package/src/components/agents/ColorPicker.tsx +112 -0
- package/src/components/agents/ModelSelector.tsx +68 -0
- package/src/components/agents/ToolSelector.tsx +562 -0
- package/src/components/agents/agentFileUtils.ts +272 -0
- package/src/components/agents/generateAgent.ts +197 -0
- package/src/components/agents/new-agent-creation/CreateAgentWizard.tsx +97 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx +84 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx +378 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.tsx +74 -0
- package/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx +123 -0
- package/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.tsx +143 -0
- package/src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx +80 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx +113 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx +80 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx +52 -0
- package/src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx +128 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx +61 -0
- package/src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx +103 -0
- package/src/components/agents/types.ts +27 -0
- package/src/components/agents/utils.ts +18 -0
- package/src/components/agents/validateAgent.ts +109 -0
- package/src/components/design-system/Byline.tsx +77 -0
- package/src/components/design-system/Dialog.tsx +138 -0
- package/src/components/design-system/Divider.tsx +149 -0
- package/src/components/design-system/FuzzyPicker.tsx +312 -0
- package/src/components/design-system/KeyboardShortcutHint.tsx +81 -0
- package/src/components/design-system/ListItem.tsx +244 -0
- package/src/components/design-system/LoadingState.tsx +94 -0
- package/src/components/design-system/Pane.tsx +77 -0
- package/src/components/design-system/ProgressBar.tsx +86 -0
- package/src/components/design-system/Ratchet.tsx +80 -0
- package/src/components/design-system/StatusIcon.tsx +95 -0
- package/src/components/design-system/Tabs.tsx +340 -0
- package/src/components/design-system/ThemeProvider.tsx +174 -0
- package/src/components/design-system/ThemedBox.tsx +156 -0
- package/src/components/design-system/ThemedText.tsx +124 -0
- package/src/components/design-system/color.ts +30 -0
- package/src/components/diff/DiffDetailView.tsx +281 -0
- package/src/components/diff/DiffDialog.tsx +383 -0
- package/src/components/diff/DiffFileList.tsx +292 -0
- package/src/components/grove/Grove.tsx +463 -0
- package/src/components/hooks/HooksConfigMenu.tsx +578 -0
- package/src/components/hooks/PromptDialog.tsx +90 -0
- package/src/components/hooks/SelectEventMode.tsx +127 -0
- package/src/components/hooks/SelectHookMode.tsx +112 -0
- package/src/components/hooks/SelectMatcherMode.tsx +144 -0
- package/src/components/hooks/ViewHookMode.tsx +199 -0
- package/src/components/mcp/CapabilitiesSection.tsx +61 -0
- package/src/components/mcp/ElicitationDialog.tsx +1169 -0
- package/src/components/mcp/MCPAgentServerMenu.tsx +183 -0
- package/src/components/mcp/MCPListPanel.tsx +504 -0
- package/src/components/mcp/MCPReconnect.tsx +167 -0
- package/src/components/mcp/MCPRemoteServerMenu.tsx +649 -0
- package/src/components/mcp/MCPSettings.tsx +398 -0
- package/src/components/mcp/MCPStdioServerMenu.tsx +177 -0
- package/src/components/mcp/MCPToolDetailView.tsx +212 -0
- package/src/components/mcp/MCPToolListView.tsx +141 -0
- package/src/components/mcp/McpParsingWarnings.tsx +213 -0
- package/src/components/mcp/index.ts +9 -0
- package/src/components/mcp/utils/reconnectHelpers.tsx +49 -0
- package/src/components/memory/MemoryFileSelector.tsx +438 -0
- package/src/components/memory/MemoryUpdateNotification.tsx +45 -0
- package/src/components/messageActions.tsx +450 -0
- package/src/components/messages/AdvisorMessage.tsx +158 -0
- package/src/components/messages/AssistantRedactedThinkingMessage.tsx +31 -0
- package/src/components/messages/AssistantTextMessage.tsx +270 -0
- package/src/components/messages/AssistantThinkingMessage.tsx +86 -0
- package/src/components/messages/AssistantToolUseMessage.tsx +368 -0
- package/src/components/messages/AttachmentMessage.tsx +536 -0
- package/src/components/messages/CollapsedReadSearchContent.tsx +484 -0
- package/src/components/messages/CompactBoundaryMessage.tsx +18 -0
- package/src/components/messages/GroupedToolUseContent.tsx +58 -0
- package/src/components/messages/HighlightedThinkingText.tsx +162 -0
- package/src/components/messages/HookProgressMessage.tsx +116 -0
- package/src/components/messages/PlanApprovalMessage.tsx +222 -0
- package/src/components/messages/RateLimitMessage.tsx +161 -0
- package/src/components/messages/ShutdownMessage.tsx +132 -0
- package/src/components/messages/SystemAPIErrorMessage.tsx +141 -0
- package/src/components/messages/SystemTextMessage.tsx +827 -0
- package/src/components/messages/TaskAssignmentMessage.tsx +76 -0
- package/src/components/messages/UserAgentNotificationMessage.tsx +83 -0
- package/src/components/messages/UserBashInputMessage.tsx +58 -0
- package/src/components/messages/UserBashOutputMessage.tsx +54 -0
- package/src/components/messages/UserChannelMessage.tsx +137 -0
- package/src/components/messages/UserCommandMessage.tsx +108 -0
- package/src/components/messages/UserImageMessage.tsx +59 -0
- package/src/components/messages/UserLocalCommandOutputMessage.tsx +167 -0
- package/src/components/messages/UserMemoryInputMessage.tsx +75 -0
- package/src/components/messages/UserPlanMessage.tsx +42 -0
- package/src/components/messages/UserPromptMessage.tsx +80 -0
- package/src/components/messages/UserResourceUpdateMessage.tsx +121 -0
- package/src/components/messages/UserTeammateMessage.tsx +206 -0
- package/src/components/messages/UserTextMessage.tsx +275 -0
- package/src/components/messages/UserToolResultMessage/RejectedPlanMessage.tsx +31 -0
- package/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.tsx +16 -0
- package/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.tsx +16 -0
- package/src/components/messages/UserToolResultMessage/UserToolErrorMessage.tsx +103 -0
- package/src/components/messages/UserToolResultMessage/UserToolRejectMessage.tsx +95 -0
- package/src/components/messages/UserToolResultMessage/UserToolResultMessage.tsx +106 -0
- package/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.tsx +104 -0
- package/src/components/messages/UserToolResultMessage/utils.tsx +44 -0
- package/src/components/messages/nullRenderingAttachments.ts +70 -0
- package/src/components/messages/teamMemCollapsed.tsx +140 -0
- package/src/components/messages/teamMemSaved.ts +19 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.tsx +645 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.tsx +229 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.tsx +328 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.tsx +178 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.tsx +465 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.tsx +144 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.ts +179 -0
- package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.tsx +482 -0
- package/src/components/permissions/BashPermissionRequest/bashToolUseOptions.tsx +147 -0
- package/src/components/permissions/ComputerUseApproval/ComputerUseApproval.tsx +441 -0
- package/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.tsx +122 -0
- package/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.tsx +768 -0
- package/src/components/permissions/FallbackPermissionRequest.tsx +333 -0
- package/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx +182 -0
- package/src/components/permissions/FilePermissionDialog/FilePermissionDialog.tsx +204 -0
- package/src/components/permissions/FilePermissionDialog/ideDiffConfig.ts +42 -0
- package/src/components/permissions/FilePermissionDialog/permissionOptions.tsx +177 -0
- package/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.ts +212 -0
- package/src/components/permissions/FilePermissionDialog/usePermissionHandler.ts +185 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx +161 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.tsx +89 -0
- package/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.tsx +115 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.tsx +166 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.tsx +235 -0
- package/src/components/permissions/PermissionDecisionDebugInfo.tsx +460 -0
- package/src/components/permissions/PermissionDialog.tsx +72 -0
- package/src/components/permissions/PermissionExplanation.tsx +272 -0
- package/src/components/permissions/PermissionPrompt.tsx +336 -0
- package/src/components/permissions/PermissionRequest.tsx +217 -0
- package/src/components/permissions/PermissionRequestTitle.tsx +66 -0
- package/src/components/permissions/PermissionRuleExplanation.tsx +121 -0
- package/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.tsx +235 -0
- package/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.tsx +91 -0
- package/src/components/permissions/SandboxPermissionRequest.tsx +163 -0
- package/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.tsx +230 -0
- package/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.tsx +369 -0
- package/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.tsx +258 -0
- package/src/components/permissions/WorkerBadge.tsx +49 -0
- package/src/components/permissions/WorkerPendingPermission.tsx +105 -0
- package/src/components/permissions/hooks.ts +209 -0
- package/src/components/permissions/rules/AddPermissionRules.tsx +180 -0
- package/src/components/permissions/rules/AddWorkspaceDirectory.tsx +340 -0
- package/src/components/permissions/rules/PermissionRuleDescription.tsx +76 -0
- package/src/components/permissions/rules/PermissionRuleInput.tsx +138 -0
- package/src/components/permissions/rules/PermissionRuleList.tsx +1179 -0
- package/src/components/permissions/rules/RecentDenialsTab.tsx +207 -0
- package/src/components/permissions/rules/RemoveWorkspaceDirectory.tsx +110 -0
- package/src/components/permissions/rules/WorkspaceTab.tsx +150 -0
- package/src/components/permissions/shellPermissionHelpers.tsx +164 -0
- package/src/components/permissions/useShellPermissionFeedback.ts +148 -0
- package/src/components/permissions/utils.ts +25 -0
- package/src/components/sandbox/SandboxConfigTab.tsx +45 -0
- package/src/components/sandbox/SandboxDependenciesTab.tsx +120 -0
- package/src/components/sandbox/SandboxDoctorSection.tsx +46 -0
- package/src/components/sandbox/SandboxOverridesTab.tsx +193 -0
- package/src/components/sandbox/SandboxSettings.tsx +296 -0
- package/src/components/shell/ExpandShellOutputContext.tsx +36 -0
- package/src/components/shell/OutputLine.tsx +118 -0
- package/src/components/shell/ShellProgressMessage.tsx +150 -0
- package/src/components/shell/ShellTimeDisplay.tsx +74 -0
- package/src/components/skills/SkillsMenu.tsx +237 -0
- package/src/components/tasks/AsyncAgentDetailDialog.tsx +229 -0
- package/src/components/tasks/BackgroundTask.tsx +345 -0
- package/src/components/tasks/BackgroundTaskStatus.tsx +429 -0
- package/src/components/tasks/BackgroundTasksDialog.tsx +652 -0
- package/src/components/tasks/DreamDetailDialog.tsx +251 -0
- package/src/components/tasks/InProcessTeammateDetailDialog.tsx +266 -0
- package/src/components/tasks/RemoteSessionDetailDialog.tsx +904 -0
- package/src/components/tasks/RemoteSessionProgress.tsx +243 -0
- package/src/components/tasks/ShellDetailDialog.tsx +404 -0
- package/src/components/tasks/ShellProgress.tsx +87 -0
- package/src/components/tasks/renderToolActivity.tsx +33 -0
- package/src/components/tasks/taskStatusUtils.tsx +107 -0
- package/src/components/teams/TeamStatus.tsx +80 -0
- package/src/components/teams/TeamsDialog.tsx +715 -0
- package/src/components/ui/OrderedList.tsx +71 -0
- package/src/components/ui/OrderedListItem.tsx +45 -0
- package/src/components/ui/TreeSelect.tsx +397 -0
- package/src/components/wizard/WizardDialogLayout.tsx +65 -0
- package/src/components/wizard/WizardNavigationFooter.tsx +24 -0
- package/src/components/wizard/WizardProvider.tsx +213 -0
- package/src/components/wizard/index.ts +9 -0
- package/src/components/wizard/useWizard.ts +13 -0
- package/src/constants/apiLimits.ts +94 -0
- package/src/constants/betas.ts +52 -0
- package/src/constants/common.ts +33 -0
- package/src/constants/cyberRiskInstruction.ts +24 -0
- package/src/constants/errorIds.ts +15 -0
- package/src/constants/figures.ts +45 -0
- package/src/constants/files.ts +156 -0
- package/src/constants/github-app.ts +144 -0
- package/src/constants/keys.ts +11 -0
- package/src/constants/messages.ts +1 -0
- package/src/constants/oauth.ts +234 -0
- package/src/constants/outputStyles.ts +216 -0
- package/src/constants/product.ts +76 -0
- package/src/constants/prompts.ts +914 -0
- package/src/constants/spinnerVerbs.ts +204 -0
- package/src/constants/system.ts +95 -0
- package/src/constants/systemPromptSections.ts +68 -0
- package/src/constants/toolLimits.ts +56 -0
- package/src/constants/tools.ts +112 -0
- package/src/constants/turnCompletionVerbs.ts +12 -0
- package/src/constants/xml.ts +86 -0
- package/src/context/QueuedMessageContext.tsx +63 -0
- package/src/context/fpsMetrics.tsx +30 -0
- package/src/context/mailbox.tsx +38 -0
- package/src/context/modalContext.tsx +58 -0
- package/src/context/notifications.tsx +240 -0
- package/src/context/overlayContext.tsx +151 -0
- package/src/context/promptOverlayContext.tsx +125 -0
- package/src/context/stats.tsx +220 -0
- package/src/context/voice.tsx +88 -0
- package/src/context.ts +189 -0
- package/src/coordinator/coordinatorMode.ts +369 -0
- package/src/cost-tracker.ts +323 -0
- package/src/costHook.ts +22 -0
- package/src/dialogLaunchers.tsx +133 -0
- package/src/entrypoints/agentSdkTypes.ts +443 -0
- package/src/entrypoints/cli.tsx +303 -0
- package/src/entrypoints/init.ts +340 -0
- package/src/entrypoints/mcp.ts +196 -0
- package/src/entrypoints/sandboxTypes.ts +156 -0
- package/src/entrypoints/sdk/controlSchemas.ts +663 -0
- package/src/entrypoints/sdk/coreSchemas.ts +1889 -0
- package/src/entrypoints/sdk/coreTypes.ts +62 -0
- package/src/history.ts +464 -0
- package/src/hooks/fileSuggestions.ts +811 -0
- package/src/hooks/notifs/useAutoModeUnavailableNotification.ts +56 -0
- package/src/hooks/notifs/useCanSwitchToExistingSubscription.tsx +60 -0
- package/src/hooks/notifs/useDeprecationWarningNotification.tsx +44 -0
- package/src/hooks/notifs/useFastModeNotification.tsx +162 -0
- package/src/hooks/notifs/useIDEStatusIndicator.tsx +186 -0
- package/src/hooks/notifs/useInstallMessages.tsx +26 -0
- package/src/hooks/notifs/useLspInitializationNotification.tsx +143 -0
- package/src/hooks/notifs/useMcpConnectivityStatus.tsx +88 -0
- package/src/hooks/notifs/useModelMigrationNotifications.tsx +52 -0
- package/src/hooks/notifs/useNpmDeprecationNotification.tsx +25 -0
- package/src/hooks/notifs/usePluginAutoupdateNotification.tsx +83 -0
- package/src/hooks/notifs/usePluginInstallationStatus.tsx +128 -0
- package/src/hooks/notifs/useRateLimitWarningNotification.tsx +114 -0
- package/src/hooks/notifs/useSettingsErrors.tsx +69 -0
- package/src/hooks/notifs/useStartupNotification.ts +41 -0
- package/src/hooks/notifs/useTeammateShutdownNotification.ts +78 -0
- package/src/hooks/renderPlaceholder.ts +51 -0
- package/src/hooks/toolPermission/PermissionContext.ts +388 -0
- package/src/hooks/toolPermission/handlers/coordinatorHandler.ts +65 -0
- package/src/hooks/toolPermission/handlers/interactiveHandler.ts +536 -0
- package/src/hooks/toolPermission/handlers/swarmWorkerHandler.ts +159 -0
- package/src/hooks/toolPermission/permissionLogging.ts +238 -0
- package/src/hooks/unifiedSuggestions.ts +202 -0
- package/src/hooks/useAfterFirstRender.ts +17 -0
- package/src/hooks/useApiKeyVerification.ts +84 -0
- package/src/hooks/useArrowKeyHistory.tsx +229 -0
- package/src/hooks/useAssistantHistory.ts +250 -0
- package/src/hooks/useAwaySummary.ts +125 -0
- package/src/hooks/useBackgroundTaskNavigation.ts +251 -0
- package/src/hooks/useBlink.ts +34 -0
- package/src/hooks/useCanUseTool.tsx +204 -0
- package/src/hooks/useCancelRequest.ts +276 -0
- package/src/hooks/useChromeExtensionNotification.tsx +50 -0
- package/src/hooks/useClaudeCodeHintRecommendation.tsx +129 -0
- package/src/hooks/useClipboardImageHint.ts +77 -0
- package/src/hooks/useCommandKeybindings.tsx +108 -0
- package/src/hooks/useCommandQueue.ts +15 -0
- package/src/hooks/useCopyOnSelect.ts +98 -0
- package/src/hooks/useDeferredHookMessages.ts +46 -0
- package/src/hooks/useDiffData.ts +110 -0
- package/src/hooks/useDiffInIDE.ts +379 -0
- package/src/hooks/useDirectConnect.ts +229 -0
- package/src/hooks/useDoublePress.ts +62 -0
- package/src/hooks/useDynamicConfig.ts +22 -0
- package/src/hooks/useElapsedTime.ts +37 -0
- package/src/hooks/useExitOnCtrlCD.ts +95 -0
- package/src/hooks/useExitOnCtrlCDWithKeybindings.ts +24 -0
- package/src/hooks/useFileHistorySnapshotInit.ts +25 -0
- package/src/hooks/useGlobalKeybindings.tsx +249 -0
- package/src/hooks/useHistorySearch.ts +303 -0
- package/src/hooks/useIDEIntegration.tsx +70 -0
- package/src/hooks/useIdeAtMentioned.ts +76 -0
- package/src/hooks/useIdeConnectionStatus.ts +33 -0
- package/src/hooks/useIdeLogging.ts +41 -0
- package/src/hooks/useIdeSelection.ts +150 -0
- package/src/hooks/useInboxPoller.ts +969 -0
- package/src/hooks/useInputBuffer.ts +132 -0
- package/src/hooks/useIssueFlagBanner.ts +133 -0
- package/src/hooks/useLogMessages.ts +119 -0
- package/src/hooks/useLspPluginRecommendation.tsx +194 -0
- package/src/hooks/useMailboxBridge.ts +21 -0
- package/src/hooks/useMainLoopModel.ts +34 -0
- package/src/hooks/useManagePlugins.ts +304 -0
- package/src/hooks/useMemoryUsage.ts +39 -0
- package/src/hooks/useMergedClients.ts +23 -0
- package/src/hooks/useMergedCommands.ts +15 -0
- package/src/hooks/useMergedTools.ts +44 -0
- package/src/hooks/useMinDisplayTime.ts +35 -0
- package/src/hooks/useNotifyAfterTimeout.ts +65 -0
- package/src/hooks/useOfficialMarketplaceNotification.tsx +48 -0
- package/src/hooks/usePasteHandler.ts +285 -0
- package/src/hooks/usePluginRecommendationBase.tsx +105 -0
- package/src/hooks/usePrStatus.ts +106 -0
- package/src/hooks/usePromptSuggestion.ts +177 -0
- package/src/hooks/usePromptsFromClaudeInChrome.tsx +71 -0
- package/src/hooks/useQueueProcessor.ts +68 -0
- package/src/hooks/useRemoteSession.ts +605 -0
- package/src/hooks/useReplBridge.tsx +723 -0
- package/src/hooks/useSSHSession.ts +241 -0
- package/src/hooks/useScheduledTasks.ts +139 -0
- package/src/hooks/useSearchInput.ts +364 -0
- package/src/hooks/useSessionBackgrounding.ts +158 -0
- package/src/hooks/useSettings.ts +17 -0
- package/src/hooks/useSettingsChange.ts +25 -0
- package/src/hooks/useSkillImprovementSurvey.ts +105 -0
- package/src/hooks/useSkillsChange.ts +62 -0
- package/src/hooks/useSwarmInitialization.ts +81 -0
- package/src/hooks/useSwarmPermissionPoller.ts +330 -0
- package/src/hooks/useTaskListWatcher.ts +221 -0
- package/src/hooks/useTasksV2.ts +250 -0
- package/src/hooks/useTeammateViewAutoExit.ts +63 -0
- package/src/hooks/useTeleportResume.tsx +85 -0
- package/src/hooks/useTerminalSize.ts +15 -0
- package/src/hooks/useTextInput.ts +529 -0
- package/src/hooks/useTimeout.ts +14 -0
- package/src/hooks/useTurnDiffs.ts +213 -0
- package/src/hooks/useTypeahead.tsx +1385 -0
- package/src/hooks/useUpdateNotification.ts +34 -0
- package/src/hooks/useVimInput.ts +316 -0
- package/src/hooks/useVirtualScroll.ts +721 -0
- package/src/hooks/useVoice.ts +1144 -0
- package/src/hooks/useVoiceEnabled.ts +25 -0
- package/src/hooks/useVoiceIntegration.tsx +677 -0
- package/src/ink/Ansi.tsx +292 -0
- package/src/ink/bidi.ts +139 -0
- package/src/ink/clearTerminal.ts +74 -0
- package/src/ink/colorize.ts +231 -0
- package/src/ink/components/AlternateScreen.tsx +80 -0
- package/src/ink/components/App.tsx +659 -0
- package/src/ink/components/AppContext.ts +21 -0
- package/src/ink/components/Box.tsx +214 -0
- package/src/ink/components/Button.tsx +192 -0
- package/src/ink/components/ClockContext.tsx +112 -0
- package/src/ink/components/CursorDeclarationContext.ts +32 -0
- package/src/ink/components/ErrorOverview.tsx +109 -0
- package/src/ink/components/Link.tsx +42 -0
- package/src/ink/components/Newline.tsx +39 -0
- package/src/ink/components/NoSelect.tsx +68 -0
- package/src/ink/components/RawAnsi.tsx +57 -0
- package/src/ink/components/ScrollBox.tsx +237 -0
- package/src/ink/components/Spacer.tsx +20 -0
- package/src/ink/components/StdinContext.ts +49 -0
- package/src/ink/components/TerminalFocusContext.tsx +52 -0
- package/src/ink/components/TerminalSizeContext.tsx +7 -0
- package/src/ink/components/Text.tsx +254 -0
- package/src/ink/constants.ts +2 -0
- package/src/ink/dom.ts +484 -0
- package/src/ink/events/click-event.ts +38 -0
- package/src/ink/events/dispatcher.ts +233 -0
- package/src/ink/events/emitter.ts +39 -0
- package/src/ink/events/event-handlers.ts +73 -0
- package/src/ink/events/event.ts +11 -0
- package/src/ink/events/focus-event.ts +21 -0
- package/src/ink/events/input-event.ts +205 -0
- package/src/ink/events/keyboard-event.ts +51 -0
- package/src/ink/events/terminal-event.ts +107 -0
- package/src/ink/events/terminal-focus-event.ts +19 -0
- package/src/ink/focus.ts +181 -0
- package/src/ink/frame.ts +124 -0
- package/src/ink/get-max-width.ts +27 -0
- package/src/ink/hit-test.ts +130 -0
- package/src/ink/hooks/use-animation-frame.ts +57 -0
- package/src/ink/hooks/use-app.ts +8 -0
- package/src/ink/hooks/use-declared-cursor.ts +73 -0
- package/src/ink/hooks/use-input.ts +92 -0
- package/src/ink/hooks/use-interval.ts +67 -0
- package/src/ink/hooks/use-search-highlight.ts +53 -0
- package/src/ink/hooks/use-selection.ts +104 -0
- package/src/ink/hooks/use-stdin.ts +8 -0
- package/src/ink/hooks/use-tab-status.ts +72 -0
- package/src/ink/hooks/use-terminal-focus.ts +16 -0
- package/src/ink/hooks/use-terminal-title.ts +31 -0
- package/src/ink/hooks/use-terminal-viewport.ts +96 -0
- package/src/ink/ink.tsx +1728 -0
- package/src/ink/instances.ts +10 -0
- package/src/ink/layout/engine.ts +6 -0
- package/src/ink/layout/geometry.ts +97 -0
- package/src/ink/layout/node.ts +152 -0
- package/src/ink/layout/yoga.ts +308 -0
- package/src/ink/line-width-cache.ts +24 -0
- package/src/ink/log-update.ts +773 -0
- package/src/ink/measure-element.ts +23 -0
- package/src/ink/measure-text.ts +47 -0
- package/src/ink/node-cache.ts +54 -0
- package/src/ink/optimizer.ts +93 -0
- package/src/ink/output.ts +797 -0
- package/src/ink/parse-keypress.ts +801 -0
- package/src/ink/reconciler.ts +512 -0
- package/src/ink/render-border.ts +231 -0
- package/src/ink/render-node-to-output.ts +1462 -0
- package/src/ink/render-to-screen.ts +231 -0
- package/src/ink/renderer.ts +178 -0
- package/src/ink/root.ts +184 -0
- package/src/ink/screen.ts +1486 -0
- package/src/ink/searchHighlight.ts +93 -0
- package/src/ink/selection.ts +917 -0
- package/src/ink/squash-text-nodes.ts +92 -0
- package/src/ink/stringWidth.ts +222 -0
- package/src/ink/styles.ts +771 -0
- package/src/ink/supports-hyperlinks.ts +57 -0
- package/src/ink/tabstops.ts +46 -0
- package/src/ink/terminal-focus-state.ts +47 -0
- package/src/ink/terminal-querier.ts +212 -0
- package/src/ink/terminal.ts +248 -0
- package/src/ink/termio/ansi.ts +75 -0
- package/src/ink/termio/csi.ts +319 -0
- package/src/ink/termio/dec.ts +60 -0
- package/src/ink/termio/esc.ts +67 -0
- package/src/ink/termio/osc.ts +493 -0
- package/src/ink/termio/parser.ts +394 -0
- package/src/ink/termio/sgr.ts +308 -0
- package/src/ink/termio/tokenize.ts +319 -0
- package/src/ink/termio/types.ts +236 -0
- package/src/ink/termio.ts +42 -0
- package/src/ink/useTerminalNotification.ts +126 -0
- package/src/ink/warn.ts +9 -0
- package/src/ink/widest-line.ts +19 -0
- package/src/ink/wrap-text.ts +74 -0
- package/src/ink/wrapAnsi.ts +20 -0
- package/src/ink.ts +85 -0
- package/src/interactiveHelpers.tsx +367 -0
- package/src/keybindings/KeybindingContext.tsx +243 -0
- package/src/keybindings/KeybindingProviderSetup.tsx +308 -0
- package/src/keybindings/defaultBindings.ts +340 -0
- package/src/keybindings/loadUserBindings.ts +472 -0
- package/src/keybindings/match.ts +120 -0
- package/src/keybindings/parser.ts +203 -0
- package/src/keybindings/reservedShortcuts.ts +127 -0
- package/src/keybindings/resolver.ts +244 -0
- package/src/keybindings/schema.ts +236 -0
- package/src/keybindings/shortcutFormat.ts +63 -0
- package/src/keybindings/template.ts +52 -0
- package/src/keybindings/useKeybinding.ts +196 -0
- package/src/keybindings/useShortcutDisplay.ts +59 -0
- package/src/keybindings/validate.ts +498 -0
- package/src/main.tsx +4684 -0
- package/src/memdir/findRelevantMemories.ts +141 -0
- package/src/memdir/memdir.ts +507 -0
- package/src/memdir/memoryAge.ts +53 -0
- package/src/memdir/memoryScan.ts +94 -0
- package/src/memdir/memoryTypes.ts +271 -0
- package/src/memdir/paths.ts +278 -0
- package/src/memdir/teamMemPaths.ts +292 -0
- package/src/memdir/teamMemPrompts.ts +100 -0
- package/src/migrations/migrateAutoUpdatesToSettings.ts +61 -0
- package/src/migrations/migrateBypassPermissionsAcceptedToSettings.ts +40 -0
- package/src/migrations/migrateEnableAllProjectMcpServersToSettings.ts +118 -0
- package/src/migrations/migrateFennecToOpus.ts +45 -0
- package/src/migrations/migrateLegacyOpusToCurrent.ts +57 -0
- package/src/migrations/migrateOpusToOpus1m.ts +43 -0
- package/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts +22 -0
- package/src/migrations/migrateSonnet1mToSonnet45.ts +48 -0
- package/src/migrations/migrateSonnet45ToSonnet46.ts +67 -0
- package/src/migrations/resetAutoModeOptInForDefaultOffer.ts +51 -0
- package/src/migrations/resetProToOpusDefault.ts +51 -0
- package/src/moreright/useMoreRight.tsx +26 -0
- package/src/native-ts/color-diff/index.ts +999 -0
- package/src/native-ts/file-index/index.ts +370 -0
- package/src/native-ts/yoga-layout/enums.ts +134 -0
- package/src/native-ts/yoga-layout/index.ts +2578 -0
- package/src/outputStyles/loadOutputStylesDir.ts +98 -0
- package/src/plugins/builtinPlugins.ts +159 -0
- package/src/plugins/bundled/index.ts +23 -0
- package/src/projectOnboardingState.ts +83 -0
- package/src/query/config.ts +46 -0
- package/src/query/deps.ts +40 -0
- package/src/query/stopHooks.ts +473 -0
- package/src/query/tokenBudget.ts +93 -0
- package/src/query.ts +1729 -0
- package/src/remote/RemoteSessionManager.ts +343 -0
- package/src/remote/SessionsWebSocket.ts +404 -0
- package/src/remote/remotePermissionBridge.ts +78 -0
- package/src/remote/sdkMessageAdapter.ts +302 -0
- package/src/replLauncher.tsx +23 -0
- package/src/schemas/hooks.ts +222 -0
- package/src/screens/Doctor.tsx +575 -0
- package/src/screens/REPL.tsx +5006 -0
- package/src/screens/ResumeConversation.tsx +399 -0
- package/src/server/createDirectConnectSession.ts +88 -0
- package/src/server/directConnectManager.ts +213 -0
- package/src/server/types.ts +57 -0
- package/src/services/AgentSummary/agentSummary.ts +179 -0
- package/src/services/MagicDocs/magicDocs.ts +254 -0
- package/src/services/MagicDocs/prompts.ts +127 -0
- package/src/services/PromptSuggestion/promptSuggestion.ts +523 -0
- package/src/services/PromptSuggestion/speculation.ts +991 -0
- package/src/services/SessionMemory/prompts.ts +324 -0
- package/src/services/SessionMemory/sessionMemory.ts +495 -0
- package/src/services/SessionMemory/sessionMemoryUtils.ts +207 -0
- package/src/services/analytics/config.ts +38 -0
- package/src/services/analytics/datadog.ts +307 -0
- package/src/services/analytics/firstPartyEventLogger.ts +449 -0
- package/src/services/analytics/firstPartyEventLoggingExporter.ts +806 -0
- package/src/services/analytics/growthbook.ts +1157 -0
- package/src/services/analytics/index.ts +173 -0
- package/src/services/analytics/metadata.ts +973 -0
- package/src/services/analytics/sink.ts +114 -0
- package/src/services/analytics/sinkKillswitch.ts +25 -0
- package/src/services/api/adminRequests.ts +119 -0
- package/src/services/api/bootstrap.ts +142 -0
- package/src/services/api/claude.ts +3433 -0
- package/src/services/api/client.ts +395 -0
- package/src/services/api/dumpPrompts.ts +226 -0
- package/src/services/api/emptyUsage.ts +22 -0
- package/src/services/api/errorUtils.ts +260 -0
- package/src/services/api/errors.ts +1207 -0
- package/src/services/api/filesApi.ts +748 -0
- package/src/services/api/firstTokenDate.ts +60 -0
- package/src/services/api/grove.ts +357 -0
- package/src/services/api/logging.ts +788 -0
- package/src/services/api/metricsOptOut.ts +159 -0
- package/src/services/api/overageCreditGrant.ts +137 -0
- package/src/services/api/promptCacheBreakDetection.ts +727 -0
- package/src/services/api/referral.ts +281 -0
- package/src/services/api/sessionIngress.ts +514 -0
- package/src/services/api/ultrareviewQuota.ts +38 -0
- package/src/services/api/usage.ts +63 -0
- package/src/services/api/withRetry.ts +826 -0
- package/src/services/autoDream/autoDream.ts +324 -0
- package/src/services/autoDream/config.ts +21 -0
- package/src/services/autoDream/consolidationLock.ts +140 -0
- package/src/services/autoDream/consolidationPrompt.ts +65 -0
- package/src/services/awaySummary.ts +74 -0
- package/src/services/claudeAiLimits.ts +515 -0
- package/src/services/claudeAiLimitsHook.ts +23 -0
- package/src/services/compact/apiMicrocompact.ts +153 -0
- package/src/services/compact/autoCompact.ts +351 -0
- package/src/services/compact/compact.ts +1705 -0
- package/src/services/compact/compactWarningHook.ts +16 -0
- package/src/services/compact/compactWarningState.ts +18 -0
- package/src/services/compact/grouping.ts +63 -0
- package/src/services/compact/microCompact.ts +530 -0
- package/src/services/compact/postCompactCleanup.ts +77 -0
- package/src/services/compact/prompt.ts +374 -0
- package/src/services/compact/sessionMemoryCompact.ts +630 -0
- package/src/services/compact/timeBasedMCConfig.ts +43 -0
- package/src/services/diagnosticTracking.ts +397 -0
- package/src/services/extractMemories/extractMemories.ts +615 -0
- package/src/services/extractMemories/prompts.ts +154 -0
- package/src/services/internalLogging.ts +90 -0
- package/src/services/lsp/LSPClient.ts +447 -0
- package/src/services/lsp/LSPDiagnosticRegistry.ts +386 -0
- package/src/services/lsp/LSPServerInstance.ts +511 -0
- package/src/services/lsp/LSPServerManager.ts +420 -0
- package/src/services/lsp/config.ts +79 -0
- package/src/services/lsp/manager.ts +289 -0
- package/src/services/lsp/passiveFeedback.ts +328 -0
- package/src/services/mcp/InProcessTransport.ts +63 -0
- package/src/services/mcp/MCPConnectionManager.tsx +73 -0
- package/src/services/mcp/SdkControlTransport.ts +136 -0
- package/src/services/mcp/auth.ts +2465 -0
- package/src/services/mcp/channelAllowlist.ts +76 -0
- package/src/services/mcp/channelNotification.ts +316 -0
- package/src/services/mcp/channelPermissions.ts +240 -0
- package/src/services/mcp/claudeai.ts +164 -0
- package/src/services/mcp/client.ts +3348 -0
- package/src/services/mcp/config.ts +1578 -0
- package/src/services/mcp/elicitationHandler.ts +313 -0
- package/src/services/mcp/envExpansion.ts +38 -0
- package/src/services/mcp/headersHelper.ts +138 -0
- package/src/services/mcp/mcpStringUtils.ts +106 -0
- package/src/services/mcp/normalization.ts +23 -0
- package/src/services/mcp/oauthPort.ts +78 -0
- package/src/services/mcp/officialRegistry.ts +72 -0
- package/src/services/mcp/types.ts +258 -0
- package/src/services/mcp/useManageMCPConnections.ts +1141 -0
- package/src/services/mcp/utils.ts +575 -0
- package/src/services/mcp/vscodeSdkMcp.ts +112 -0
- package/src/services/mcp/xaa.ts +511 -0
- package/src/services/mcp/xaaIdpLogin.ts +487 -0
- package/src/services/mcpServerApproval.tsx +41 -0
- package/src/services/mockRateLimits.ts +882 -0
- package/src/services/notifier.ts +156 -0
- package/src/services/oauth/auth-code-listener.ts +211 -0
- package/src/services/oauth/client.ts +566 -0
- package/src/services/oauth/crypto.ts +23 -0
- package/src/services/oauth/getOauthProfile.ts +53 -0
- package/src/services/oauth/index.ts +198 -0
- package/src/services/plugins/PluginInstallationManager.ts +184 -0
- package/src/services/plugins/pluginCliCommands.ts +344 -0
- package/src/services/plugins/pluginOperations.ts +1088 -0
- package/src/services/policyLimits/index.ts +664 -0
- package/src/services/policyLimits/types.ts +27 -0
- package/src/services/preventSleep.ts +165 -0
- package/src/services/rateLimitMessages.ts +344 -0
- package/src/services/rateLimitMocking.ts +144 -0
- package/src/services/remoteManagedSettings/index.ts +639 -0
- package/src/services/remoteManagedSettings/securityCheck.tsx +74 -0
- package/src/services/remoteManagedSettings/syncCache.ts +112 -0
- package/src/services/remoteManagedSettings/syncCacheState.ts +96 -0
- package/src/services/remoteManagedSettings/types.ts +31 -0
- package/src/services/settingsSync/index.ts +581 -0
- package/src/services/settingsSync/types.ts +67 -0
- package/src/services/teamMemorySync/index.ts +1256 -0
- package/src/services/teamMemorySync/secretScanner.ts +324 -0
- package/src/services/teamMemorySync/teamMemSecretGuard.ts +44 -0
- package/src/services/teamMemorySync/types.ts +156 -0
- package/src/services/teamMemorySync/watcher.ts +387 -0
- package/src/services/tips/tipHistory.ts +17 -0
- package/src/services/tips/tipRegistry.ts +686 -0
- package/src/services/tips/tipScheduler.ts +58 -0
- package/src/services/tokenEstimation.ts +495 -0
- package/src/services/toolUseSummary/toolUseSummaryGenerator.ts +112 -0
- package/src/services/tools/StreamingToolExecutor.ts +530 -0
- package/src/services/tools/toolExecution.ts +1745 -0
- package/src/services/tools/toolHooks.ts +650 -0
- package/src/services/tools/toolOrchestration.ts +188 -0
- package/src/services/vcr.ts +406 -0
- package/src/services/voice.ts +525 -0
- package/src/services/voiceKeyterms.ts +106 -0
- package/src/services/voiceStreamSTT.ts +544 -0
- package/src/setup.ts +477 -0
- package/src/skills/bundled/batch.ts +124 -0
- package/src/skills/bundled/claudeApi.ts +196 -0
- package/src/skills/bundled/claudeApiContent.ts +75 -0
- package/src/skills/bundled/claudeInChrome.ts +34 -0
- package/src/skills/bundled/debug.ts +103 -0
- package/src/skills/bundled/index.ts +79 -0
- package/src/skills/bundled/keybindings.ts +339 -0
- package/src/skills/bundled/loop.ts +92 -0
- package/src/skills/bundled/loremIpsum.ts +282 -0
- package/src/skills/bundled/remember.ts +82 -0
- package/src/skills/bundled/scheduleRemoteAgents.ts +447 -0
- package/src/skills/bundled/simplify.ts +69 -0
- package/src/skills/bundled/skillify.ts +197 -0
- package/src/skills/bundled/stuck.ts +79 -0
- package/src/skills/bundled/updateConfig.ts +475 -0
- package/src/skills/bundled/verify.ts +30 -0
- package/src/skills/bundled/verifyContent.ts +13 -0
- package/src/skills/bundledSkills.ts +220 -0
- package/src/skills/loadSkillsDir.ts +1086 -0
- package/src/skills/mcpSkillBuilders.ts +44 -0
- package/src/state/AppState.tsx +200 -0
- package/src/state/AppStateStore.ts +569 -0
- package/src/state/onChangeAppState.ts +171 -0
- package/src/state/selectors.ts +76 -0
- package/src/state/store.ts +34 -0
- package/src/state/teammateViewHelpers.ts +141 -0
- package/src/tasks/DreamTask/DreamTask.ts +157 -0
- package/src/tasks/InProcessTeammateTask/InProcessTeammateTask.tsx +126 -0
- package/src/tasks/InProcessTeammateTask/types.ts +121 -0
- package/src/tasks/LocalAgentTask/LocalAgentTask.tsx +683 -0
- package/src/tasks/LocalMainSessionTask.ts +479 -0
- package/src/tasks/LocalShellTask/LocalShellTask.tsx +523 -0
- package/src/tasks/LocalShellTask/guards.ts +41 -0
- package/src/tasks/LocalShellTask/killShellTasks.ts +76 -0
- package/src/tasks/RemoteAgentTask/RemoteAgentTask.tsx +856 -0
- package/src/tasks/pillLabel.ts +82 -0
- package/src/tasks/stopTask.ts +100 -0
- package/src/tasks/types.ts +46 -0
- package/src/tasks.ts +39 -0
- package/src/tools/AgentTool/AgentTool.tsx +1398 -0
- package/src/tools/AgentTool/UI.tsx +872 -0
- package/src/tools/AgentTool/agentColorManager.ts +66 -0
- package/src/tools/AgentTool/agentDisplay.ts +104 -0
- package/src/tools/AgentTool/agentMemory.ts +177 -0
- package/src/tools/AgentTool/agentMemorySnapshot.ts +197 -0
- package/src/tools/AgentTool/agentToolUtils.ts +686 -0
- package/src/tools/AgentTool/built-in/claudeCodeGuideAgent.ts +205 -0
- package/src/tools/AgentTool/built-in/exploreAgent.ts +83 -0
- package/src/tools/AgentTool/built-in/generalPurposeAgent.ts +34 -0
- package/src/tools/AgentTool/built-in/planAgent.ts +92 -0
- package/src/tools/AgentTool/built-in/statuslineSetup.ts +144 -0
- package/src/tools/AgentTool/built-in/verificationAgent.ts +152 -0
- package/src/tools/AgentTool/builtInAgents.ts +72 -0
- package/src/tools/AgentTool/constants.ts +12 -0
- package/src/tools/AgentTool/forkSubagent.ts +210 -0
- package/src/tools/AgentTool/loadAgentsDir.ts +755 -0
- package/src/tools/AgentTool/prompt.ts +287 -0
- package/src/tools/AgentTool/resumeAgent.ts +265 -0
- package/src/tools/AgentTool/runAgent.ts +973 -0
- package/src/tools/AskUserQuestionTool/AskUserQuestionTool.tsx +266 -0
- package/src/tools/AskUserQuestionTool/prompt.ts +44 -0
- package/src/tools/BashTool/BashTool.tsx +1144 -0
- package/src/tools/BashTool/BashToolResultMessage.tsx +191 -0
- package/src/tools/BashTool/UI.tsx +185 -0
- package/src/tools/BashTool/bashCommandHelpers.ts +265 -0
- package/src/tools/BashTool/bashPermissions.ts +2621 -0
- package/src/tools/BashTool/bashSecurity.ts +2592 -0
- package/src/tools/BashTool/commandSemantics.ts +140 -0
- package/src/tools/BashTool/commentLabel.ts +13 -0
- package/src/tools/BashTool/destructiveCommandWarning.ts +102 -0
- package/src/tools/BashTool/modeValidation.ts +115 -0
- package/src/tools/BashTool/pathValidation.ts +1303 -0
- package/src/tools/BashTool/prompt.ts +369 -0
- package/src/tools/BashTool/readOnlyValidation.ts +1990 -0
- package/src/tools/BashTool/sedEditParser.ts +322 -0
- package/src/tools/BashTool/sedValidation.ts +684 -0
- package/src/tools/BashTool/shouldUseSandbox.ts +153 -0
- package/src/tools/BashTool/toolName.ts +2 -0
- package/src/tools/BashTool/utils.ts +223 -0
- package/src/tools/BriefTool/BriefTool.ts +204 -0
- package/src/tools/BriefTool/UI.tsx +101 -0
- package/src/tools/BriefTool/attachments.ts +110 -0
- package/src/tools/BriefTool/prompt.ts +22 -0
- package/src/tools/BriefTool/upload.ts +174 -0
- package/src/tools/ConfigTool/ConfigTool.ts +467 -0
- package/src/tools/ConfigTool/UI.tsx +38 -0
- package/src/tools/ConfigTool/constants.ts +1 -0
- package/src/tools/ConfigTool/prompt.ts +93 -0
- package/src/tools/ConfigTool/supportedSettings.ts +211 -0
- package/src/tools/EnterPlanModeTool/EnterPlanModeTool.ts +126 -0
- package/src/tools/EnterPlanModeTool/UI.tsx +33 -0
- package/src/tools/EnterPlanModeTool/constants.ts +1 -0
- package/src/tools/EnterPlanModeTool/prompt.ts +170 -0
- package/src/tools/EnterWorktreeTool/EnterWorktreeTool.ts +127 -0
- package/src/tools/EnterWorktreeTool/UI.tsx +20 -0
- package/src/tools/EnterWorktreeTool/constants.ts +1 -0
- package/src/tools/EnterWorktreeTool/prompt.ts +30 -0
- package/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.ts +493 -0
- package/src/tools/ExitPlanModeTool/UI.tsx +82 -0
- package/src/tools/ExitPlanModeTool/constants.ts +2 -0
- package/src/tools/ExitPlanModeTool/prompt.ts +29 -0
- package/src/tools/ExitWorktreeTool/ExitWorktreeTool.ts +329 -0
- package/src/tools/ExitWorktreeTool/UI.tsx +25 -0
- package/src/tools/ExitWorktreeTool/constants.ts +1 -0
- package/src/tools/ExitWorktreeTool/prompt.ts +32 -0
- package/src/tools/FileEditTool/FileEditTool.ts +625 -0
- package/src/tools/FileEditTool/UI.tsx +289 -0
- package/src/tools/FileEditTool/constants.ts +11 -0
- package/src/tools/FileEditTool/prompt.ts +28 -0
- package/src/tools/FileEditTool/types.ts +85 -0
- package/src/tools/FileEditTool/utils.ts +775 -0
- package/src/tools/FileReadTool/FileReadTool.ts +1183 -0
- package/src/tools/FileReadTool/UI.tsx +185 -0
- package/src/tools/FileReadTool/imageProcessor.ts +94 -0
- package/src/tools/FileReadTool/limits.ts +92 -0
- package/src/tools/FileReadTool/prompt.ts +49 -0
- package/src/tools/FileWriteTool/FileWriteTool.ts +434 -0
- package/src/tools/FileWriteTool/UI.tsx +405 -0
- package/src/tools/FileWriteTool/prompt.ts +18 -0
- package/src/tools/GlobTool/GlobTool.ts +198 -0
- package/src/tools/GlobTool/UI.tsx +63 -0
- package/src/tools/GlobTool/prompt.ts +7 -0
- package/src/tools/GrepTool/GrepTool.ts +577 -0
- package/src/tools/GrepTool/UI.tsx +201 -0
- package/src/tools/GrepTool/prompt.ts +18 -0
- package/src/tools/LSPTool/LSPTool.ts +860 -0
- package/src/tools/LSPTool/UI.tsx +228 -0
- package/src/tools/LSPTool/formatters.ts +592 -0
- package/src/tools/LSPTool/prompt.ts +21 -0
- package/src/tools/LSPTool/schemas.ts +215 -0
- package/src/tools/LSPTool/symbolContext.ts +90 -0
- package/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.ts +123 -0
- package/src/tools/ListMcpResourcesTool/UI.tsx +29 -0
- package/src/tools/ListMcpResourcesTool/prompt.ts +20 -0
- package/src/tools/MCPTool/MCPTool.ts +77 -0
- package/src/tools/MCPTool/UI.tsx +403 -0
- package/src/tools/MCPTool/classifyForCollapse.ts +604 -0
- package/src/tools/MCPTool/prompt.ts +3 -0
- package/src/tools/McpAuthTool/McpAuthTool.ts +215 -0
- package/src/tools/NotebookEditTool/NotebookEditTool.ts +490 -0
- package/src/tools/NotebookEditTool/UI.tsx +93 -0
- package/src/tools/NotebookEditTool/constants.ts +2 -0
- package/src/tools/NotebookEditTool/prompt.ts +3 -0
- package/src/tools/PowerShellTool/PowerShellTool.tsx +1001 -0
- package/src/tools/PowerShellTool/UI.tsx +131 -0
- package/src/tools/PowerShellTool/clmTypes.ts +211 -0
- package/src/tools/PowerShellTool/commandSemantics.ts +142 -0
- package/src/tools/PowerShellTool/commonParameters.ts +30 -0
- package/src/tools/PowerShellTool/destructiveCommandWarning.ts +109 -0
- package/src/tools/PowerShellTool/gitSafety.ts +176 -0
- package/src/tools/PowerShellTool/modeValidation.ts +404 -0
- package/src/tools/PowerShellTool/pathValidation.ts +2049 -0
- package/src/tools/PowerShellTool/powershellPermissions.ts +1648 -0
- package/src/tools/PowerShellTool/powershellSecurity.ts +1090 -0
- package/src/tools/PowerShellTool/prompt.ts +145 -0
- package/src/tools/PowerShellTool/readOnlyValidation.ts +1823 -0
- package/src/tools/PowerShellTool/toolName.ts +2 -0
- package/src/tools/REPLTool/constants.ts +46 -0
- package/src/tools/REPLTool/primitiveTools.ts +39 -0
- package/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.ts +158 -0
- package/src/tools/ReadMcpResourceTool/UI.tsx +37 -0
- package/src/tools/ReadMcpResourceTool/prompt.ts +16 -0
- package/src/tools/RemoteTriggerTool/RemoteTriggerTool.ts +161 -0
- package/src/tools/RemoteTriggerTool/UI.tsx +17 -0
- package/src/tools/RemoteTriggerTool/prompt.ts +15 -0
- package/src/tools/ScheduleCronTool/CronCreateTool.ts +157 -0
- package/src/tools/ScheduleCronTool/CronDeleteTool.ts +95 -0
- package/src/tools/ScheduleCronTool/CronListTool.ts +97 -0
- package/src/tools/ScheduleCronTool/UI.tsx +60 -0
- package/src/tools/ScheduleCronTool/prompt.ts +135 -0
- package/src/tools/SendMessageTool/SendMessageTool.ts +917 -0
- package/src/tools/SendMessageTool/UI.tsx +31 -0
- package/src/tools/SendMessageTool/constants.ts +1 -0
- package/src/tools/SendMessageTool/prompt.ts +49 -0
- package/src/tools/SkillTool/SkillTool.ts +1108 -0
- package/src/tools/SkillTool/UI.tsx +128 -0
- package/src/tools/SkillTool/constants.ts +1 -0
- package/src/tools/SkillTool/prompt.ts +241 -0
- package/src/tools/SleepTool/prompt.ts +17 -0
- package/src/tools/SyntheticOutputTool/SyntheticOutputTool.ts +163 -0
- package/src/tools/TaskCreateTool/TaskCreateTool.ts +138 -0
- package/src/tools/TaskCreateTool/constants.ts +1 -0
- package/src/tools/TaskCreateTool/prompt.ts +56 -0
- package/src/tools/TaskGetTool/TaskGetTool.ts +128 -0
- package/src/tools/TaskGetTool/constants.ts +1 -0
- package/src/tools/TaskGetTool/prompt.ts +24 -0
- package/src/tools/TaskListTool/TaskListTool.ts +116 -0
- package/src/tools/TaskListTool/constants.ts +1 -0
- package/src/tools/TaskListTool/prompt.ts +49 -0
- package/src/tools/TaskOutputTool/TaskOutputTool.tsx +584 -0
- package/src/tools/TaskOutputTool/constants.ts +1 -0
- package/src/tools/TaskStopTool/TaskStopTool.ts +131 -0
- package/src/tools/TaskStopTool/UI.tsx +41 -0
- package/src/tools/TaskStopTool/prompt.ts +8 -0
- package/src/tools/TaskUpdateTool/TaskUpdateTool.ts +406 -0
- package/src/tools/TaskUpdateTool/constants.ts +1 -0
- package/src/tools/TaskUpdateTool/prompt.ts +77 -0
- package/src/tools/TeamCreateTool/TeamCreateTool.ts +240 -0
- package/src/tools/TeamCreateTool/UI.tsx +6 -0
- package/src/tools/TeamCreateTool/constants.ts +1 -0
- package/src/tools/TeamCreateTool/prompt.ts +113 -0
- package/src/tools/TeamDeleteTool/TeamDeleteTool.ts +139 -0
- package/src/tools/TeamDeleteTool/UI.tsx +20 -0
- package/src/tools/TeamDeleteTool/constants.ts +1 -0
- package/src/tools/TeamDeleteTool/prompt.ts +16 -0
- package/src/tools/TodoWriteTool/TodoWriteTool.ts +115 -0
- package/src/tools/TodoWriteTool/constants.ts +1 -0
- package/src/tools/TodoWriteTool/prompt.ts +184 -0
- package/src/tools/ToolSearchTool/ToolSearchTool.ts +471 -0
- package/src/tools/ToolSearchTool/constants.ts +1 -0
- package/src/tools/ToolSearchTool/prompt.ts +121 -0
- package/src/tools/TungstenTool/TungstenTool.js +2 -0
- package/src/tools/TungstenTool/TungstenTool.ts +1 -0
- package/src/tools/WebFetchTool/UI.tsx +72 -0
- package/src/tools/WebFetchTool/WebFetchTool.ts +318 -0
- package/src/tools/WebFetchTool/preapproved.ts +166 -0
- package/src/tools/WebFetchTool/prompt.ts +46 -0
- package/src/tools/WebFetchTool/utils.ts +530 -0
- package/src/tools/WebSearchTool/UI.tsx +101 -0
- package/src/tools/WebSearchTool/WebSearchTool.ts +435 -0
- package/src/tools/WebSearchTool/prompt.ts +34 -0
- package/src/tools/shared/gitOperationTracking.ts +277 -0
- package/src/tools/shared/spawnMultiAgent.ts +1093 -0
- package/src/tools/testing/TestingPermissionTool.tsx +74 -0
- package/src/tools/utils.ts +40 -0
- package/src/tools.ts +389 -0
- package/src/types/command.ts +216 -0
- package/src/types/connectorText.js +5 -0
- package/src/types/connectorText.ts +1 -0
- package/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.ts +865 -0
- package/src/types/generated/events_mono/common/v1/auth.ts +100 -0
- package/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.ts +223 -0
- package/src/types/generated/google/protobuf/timestamp.ts +187 -0
- package/src/types/hooks.ts +290 -0
- package/src/types/ids.ts +44 -0
- package/src/types/logs.ts +330 -0
- package/src/types/permissions.ts +441 -0
- package/src/types/plugin.ts +363 -0
- package/src/types/textInputTypes.ts +387 -0
- package/src/upstreamproxy/relay.ts +455 -0
- package/src/upstreamproxy/upstreamproxy.ts +285 -0
- package/src/utils/CircularBuffer.ts +84 -0
- package/src/utils/Cursor.ts +1530 -0
- package/src/utils/QueryGuard.ts +121 -0
- package/src/utils/Shell.ts +474 -0
- package/src/utils/ShellCommand.ts +465 -0
- package/src/utils/abortController.ts +99 -0
- package/src/utils/activityManager.ts +164 -0
- package/src/utils/advisor.ts +145 -0
- package/src/utils/agentContext.ts +178 -0
- package/src/utils/agentId.ts +99 -0
- package/src/utils/agentSwarmsEnabled.ts +44 -0
- package/src/utils/agenticSessionSearch.ts +307 -0
- package/src/utils/analyzeContext.ts +1382 -0
- package/src/utils/ansiToPng.ts +334 -0
- package/src/utils/ansiToSvg.ts +272 -0
- package/src/utils/api.ts +718 -0
- package/src/utils/apiPreconnect.ts +72 -0
- package/src/utils/appleTerminalBackup.ts +124 -0
- package/src/utils/argumentSubstitution.ts +145 -0
- package/src/utils/array.ts +13 -0
- package/src/utils/asciicast.ts +239 -0
- package/src/utils/attachments.ts +3997 -0
- package/src/utils/attribution.ts +393 -0
- package/src/utils/auth.ts +2007 -0
- package/src/utils/authFileDescriptor.ts +196 -0
- package/src/utils/authPortable.ts +19 -0
- package/src/utils/autoModeDenials.ts +26 -0
- package/src/utils/autoRunIssue.tsx +122 -0
- package/src/utils/autoUpdater.ts +562 -0
- package/src/utils/aws.ts +74 -0
- package/src/utils/awsAuthStatusManager.ts +81 -0
- package/src/utils/background/remote/preconditions.ts +235 -0
- package/src/utils/background/remote/remoteSession.ts +98 -0
- package/src/utils/backgroundHousekeeping.ts +94 -0
- package/src/utils/bash/ParsedCommand.ts +318 -0
- package/src/utils/bash/ShellSnapshot.ts +582 -0
- package/src/utils/bash/ast.ts +2679 -0
- package/src/utils/bash/bashParser.ts +4436 -0
- package/src/utils/bash/bashPipeCommand.ts +294 -0
- package/src/utils/bash/commands.ts +1339 -0
- package/src/utils/bash/heredoc.ts +733 -0
- package/src/utils/bash/parser.ts +230 -0
- package/src/utils/bash/prefix.ts +204 -0
- package/src/utils/bash/registry.ts +53 -0
- package/src/utils/bash/shellCompletion.ts +259 -0
- package/src/utils/bash/shellPrefix.ts +28 -0
- package/src/utils/bash/shellQuote.ts +304 -0
- package/src/utils/bash/shellQuoting.ts +128 -0
- package/src/utils/bash/specs/alias.ts +14 -0
- package/src/utils/bash/specs/index.ts +18 -0
- package/src/utils/bash/specs/nohup.ts +13 -0
- package/src/utils/bash/specs/pyright.ts +91 -0
- package/src/utils/bash/specs/sleep.ts +13 -0
- package/src/utils/bash/specs/srun.ts +31 -0
- package/src/utils/bash/specs/time.ts +13 -0
- package/src/utils/bash/specs/timeout.ts +20 -0
- package/src/utils/bash/treeSitterAnalysis.ts +506 -0
- package/src/utils/betas.ts +438 -0
- package/src/utils/billing.ts +78 -0
- package/src/utils/binaryCheck.ts +53 -0
- package/src/utils/browser.ts +68 -0
- package/src/utils/bufferedWriter.ts +100 -0
- package/src/utils/bundledMode.ts +22 -0
- package/src/utils/caCerts.ts +115 -0
- package/src/utils/caCertsConfig.ts +88 -0
- package/src/utils/cachePaths.ts +38 -0
- package/src/utils/classifierApprovals.ts +88 -0
- package/src/utils/classifierApprovalsHook.ts +17 -0
- package/src/utils/claudeCodeHints.ts +193 -0
- package/src/utils/claudeDesktop.ts +152 -0
- package/src/utils/claudeInChrome/chromeNativeHost.ts +527 -0
- package/src/utils/claudeInChrome/common.ts +540 -0
- package/src/utils/claudeInChrome/mcpServer.ts +293 -0
- package/src/utils/claudeInChrome/prompt.ts +83 -0
- package/src/utils/claudeInChrome/setup.ts +400 -0
- package/src/utils/claudeInChrome/setupPortable.ts +233 -0
- package/src/utils/claudeInChrome/toolRendering.tsx +262 -0
- package/src/utils/claudemd.ts +1479 -0
- package/src/utils/cleanup.ts +602 -0
- package/src/utils/cleanupRegistry.ts +25 -0
- package/src/utils/cliArgs.ts +60 -0
- package/src/utils/cliHighlight.ts +54 -0
- package/src/utils/codeIndexing.ts +206 -0
- package/src/utils/collapseBackgroundBashNotifications.ts +84 -0
- package/src/utils/collapseHookSummaries.ts +59 -0
- package/src/utils/collapseReadSearch.ts +1109 -0
- package/src/utils/collapseTeammateShutdowns.ts +55 -0
- package/src/utils/combinedAbortSignal.ts +47 -0
- package/src/utils/commandLifecycle.ts +21 -0
- package/src/utils/commitAttribution.ts +961 -0
- package/src/utils/completionCache.ts +166 -0
- package/src/utils/computerUse/appNames.ts +196 -0
- package/src/utils/computerUse/cleanup.ts +86 -0
- package/src/utils/computerUse/common.ts +61 -0
- package/src/utils/computerUse/computerUseLock.ts +215 -0
- package/src/utils/computerUse/drainRunLoop.ts +79 -0
- package/src/utils/computerUse/escHotkey.ts +54 -0
- package/src/utils/computerUse/executor.ts +658 -0
- package/src/utils/computerUse/gates.ts +72 -0
- package/src/utils/computerUse/hostAdapter.ts +69 -0
- package/src/utils/computerUse/inputLoader.ts +30 -0
- package/src/utils/computerUse/mcpServer.ts +106 -0
- package/src/utils/computerUse/setup.ts +53 -0
- package/src/utils/computerUse/swiftLoader.ts +23 -0
- package/src/utils/computerUse/toolRendering.tsx +125 -0
- package/src/utils/computerUse/wrapper.tsx +336 -0
- package/src/utils/concurrentSessions.ts +204 -0
- package/src/utils/config.ts +1817 -0
- package/src/utils/configConstants.ts +21 -0
- package/src/utils/contentArray.ts +51 -0
- package/src/utils/context.ts +221 -0
- package/src/utils/contextAnalysis.ts +272 -0
- package/src/utils/contextSuggestions.ts +235 -0
- package/src/utils/controlMessageCompat.ts +32 -0
- package/src/utils/conversationRecovery.ts +597 -0
- package/src/utils/cron.ts +308 -0
- package/src/utils/cronJitterConfig.ts +75 -0
- package/src/utils/cronScheduler.ts +565 -0
- package/src/utils/cronTasks.ts +458 -0
- package/src/utils/cronTasksLock.ts +195 -0
- package/src/utils/crossProjectResume.ts +75 -0
- package/src/utils/crypto.ts +13 -0
- package/src/utils/cwd.ts +32 -0
- package/src/utils/debug.ts +268 -0
- package/src/utils/debugFilter.ts +157 -0
- package/src/utils/deepLink/banner.ts +123 -0
- package/src/utils/deepLink/parseDeepLink.ts +170 -0
- package/src/utils/deepLink/protocolHandler.ts +136 -0
- package/src/utils/deepLink/registerProtocol.ts +348 -0
- package/src/utils/deepLink/terminalLauncher.ts +557 -0
- package/src/utils/deepLink/terminalPreference.ts +54 -0
- package/src/utils/desktopDeepLink.ts +236 -0
- package/src/utils/detectRepository.ts +178 -0
- package/src/utils/diagLogs.ts +94 -0
- package/src/utils/diff.ts +177 -0
- package/src/utils/directMemberMessage.ts +69 -0
- package/src/utils/displayTags.ts +51 -0
- package/src/utils/doctorContextWarnings.ts +265 -0
- package/src/utils/doctorDiagnostic.ts +625 -0
- package/src/utils/dxt/helpers.ts +88 -0
- package/src/utils/dxt/zip.ts +226 -0
- package/src/utils/earlyInput.ts +191 -0
- package/src/utils/editor.ts +183 -0
- package/src/utils/effort.ts +329 -0
- package/src/utils/embeddedTools.ts +29 -0
- package/src/utils/env.ts +347 -0
- package/src/utils/envDynamic.ts +151 -0
- package/src/utils/envUtils.ts +183 -0
- package/src/utils/envValidation.ts +38 -0
- package/src/utils/errorLogSink.ts +235 -0
- package/src/utils/errors.ts +238 -0
- package/src/utils/exampleCommands.ts +184 -0
- package/src/utils/execFileNoThrow.ts +150 -0
- package/src/utils/execFileNoThrowPortable.ts +89 -0
- package/src/utils/execSyncWrapper.ts +38 -0
- package/src/utils/exportRenderer.tsx +98 -0
- package/src/utils/extraUsage.ts +23 -0
- package/src/utils/fastMode.ts +532 -0
- package/src/utils/file.ts +584 -0
- package/src/utils/fileHistory.ts +1115 -0
- package/src/utils/fileOperationAnalytics.ts +71 -0
- package/src/utils/filePersistence/filePersistence.ts +287 -0
- package/src/utils/filePersistence/outputsScanner.ts +126 -0
- package/src/utils/fileRead.ts +102 -0
- package/src/utils/fileReadCache.ts +96 -0
- package/src/utils/fileStateCache.ts +142 -0
- package/src/utils/findExecutable.ts +17 -0
- package/src/utils/fingerprint.ts +76 -0
- package/src/utils/forkedAgent.ts +689 -0
- package/src/utils/format.ts +308 -0
- package/src/utils/formatBriefTimestamp.ts +81 -0
- package/src/utils/fpsTracker.ts +47 -0
- package/src/utils/frontmatterParser.ts +370 -0
- package/src/utils/fsOperations.ts +770 -0
- package/src/utils/fullscreen.ts +202 -0
- package/src/utils/generatedFiles.ts +136 -0
- package/src/utils/generators.ts +88 -0
- package/src/utils/genericProcessUtils.ts +184 -0
- package/src/utils/getWorktreePaths.ts +70 -0
- package/src/utils/getWorktreePathsPortable.ts +27 -0
- package/src/utils/ghPrStatus.ts +106 -0
- package/src/utils/git/gitConfigParser.ts +277 -0
- package/src/utils/git/gitFilesystem.ts +699 -0
- package/src/utils/git/gitignore.ts +99 -0
- package/src/utils/git.ts +926 -0
- package/src/utils/gitDiff.ts +532 -0
- package/src/utils/gitSettings.ts +18 -0
- package/src/utils/github/ghAuthStatus.ts +29 -0
- package/src/utils/githubRepoPathMapping.ts +162 -0
- package/src/utils/glob.ts +130 -0
- package/src/utils/gracefulShutdown.ts +529 -0
- package/src/utils/groupToolUses.ts +182 -0
- package/src/utils/handlePromptSubmit.ts +610 -0
- package/src/utils/hash.ts +46 -0
- package/src/utils/headlessProfiler.ts +178 -0
- package/src/utils/heapDumpService.ts +303 -0
- package/src/utils/heatmap.ts +198 -0
- package/src/utils/highlightMatch.tsx +28 -0
- package/src/utils/hooks/AsyncHookRegistry.ts +309 -0
- package/src/utils/hooks/apiQueryHookHelper.ts +141 -0
- package/src/utils/hooks/execAgentHook.ts +339 -0
- package/src/utils/hooks/execHttpHook.ts +242 -0
- package/src/utils/hooks/execPromptHook.ts +211 -0
- package/src/utils/hooks/fileChangedWatcher.ts +191 -0
- package/src/utils/hooks/hookEvents.ts +192 -0
- package/src/utils/hooks/hookHelpers.ts +83 -0
- package/src/utils/hooks/hooksConfigManager.ts +400 -0
- package/src/utils/hooks/hooksConfigSnapshot.ts +133 -0
- package/src/utils/hooks/hooksSettings.ts +271 -0
- package/src/utils/hooks/postSamplingHooks.ts +70 -0
- package/src/utils/hooks/registerFrontmatterHooks.ts +67 -0
- package/src/utils/hooks/registerSkillHooks.ts +64 -0
- package/src/utils/hooks/sessionHooks.ts +447 -0
- package/src/utils/hooks/skillImprovement.ts +267 -0
- package/src/utils/hooks/ssrfGuard.ts +294 -0
- package/src/utils/hooks.ts +5022 -0
- package/src/utils/horizontalScroll.ts +137 -0
- package/src/utils/http.ts +136 -0
- package/src/utils/hyperlink.ts +39 -0
- package/src/utils/iTermBackup.ts +73 -0
- package/src/utils/ide.ts +1494 -0
- package/src/utils/idePathConversion.ts +90 -0
- package/src/utils/idleTimeout.ts +53 -0
- package/src/utils/imagePaste.ts +416 -0
- package/src/utils/imageResizer.ts +880 -0
- package/src/utils/imageStore.ts +167 -0
- package/src/utils/imageValidation.ts +104 -0
- package/src/utils/immediateCommand.ts +15 -0
- package/src/utils/inProcessTeammateHelpers.ts +102 -0
- package/src/utils/ink.ts +26 -0
- package/src/utils/intl.ts +94 -0
- package/src/utils/jetbrains.ts +191 -0
- package/src/utils/json.ts +277 -0
- package/src/utils/jsonRead.ts +16 -0
- package/src/utils/keyboardShortcuts.ts +14 -0
- package/src/utils/lazySchema.ts +8 -0
- package/src/utils/listSessionsImpl.ts +454 -0
- package/src/utils/localInstaller.ts +162 -0
- package/src/utils/lockfile.ts +43 -0
- package/src/utils/log.ts +362 -0
- package/src/utils/logoV2Utils.ts +350 -0
- package/src/utils/mailbox.ts +73 -0
- package/src/utils/managedEnv.ts +199 -0
- package/src/utils/managedEnvConstants.ts +191 -0
- package/src/utils/markdown.ts +381 -0
- package/src/utils/markdownConfigLoader.ts +600 -0
- package/src/utils/mcp/dateTimeParser.ts +121 -0
- package/src/utils/mcp/elicitationValidation.ts +336 -0
- package/src/utils/mcpInstructionsDelta.ts +130 -0
- package/src/utils/mcpOutputStorage.ts +189 -0
- package/src/utils/mcpValidation.ts +208 -0
- package/src/utils/mcpWebSocketTransport.ts +200 -0
- package/src/utils/memoize.ts +269 -0
- package/src/utils/memory/types.ts +12 -0
- package/src/utils/memory/versions.ts +8 -0
- package/src/utils/memoryFileDetection.ts +289 -0
- package/src/utils/messagePredicates.ts +8 -0
- package/src/utils/messageQueueManager.ts +547 -0
- package/src/utils/messages/mappers.ts +290 -0
- package/src/utils/messages/systemInit.ts +96 -0
- package/src/utils/messages.ts +5512 -0
- package/src/utils/model/agent.ts +157 -0
- package/src/utils/model/aliases.ts +25 -0
- package/src/utils/model/antModels.ts +64 -0
- package/src/utils/model/bedrock.ts +265 -0
- package/src/utils/model/check1mAccess.ts +72 -0
- package/src/utils/model/configs.ts +118 -0
- package/src/utils/model/contextWindowUpgradeCheck.ts +47 -0
- package/src/utils/model/deprecation.ts +101 -0
- package/src/utils/model/model.ts +634 -0
- package/src/utils/model/modelAllowlist.ts +170 -0
- package/src/utils/model/modelCapabilities.ts +118 -0
- package/src/utils/model/modelOptions.ts +540 -0
- package/src/utils/model/modelStrings.ts +166 -0
- package/src/utils/model/modelSupportOverrides.ts +50 -0
- package/src/utils/model/providers.ts +46 -0
- package/src/utils/model/validateModel.ts +159 -0
- package/src/utils/modelCost.ts +235 -0
- package/src/utils/modifiers.ts +36 -0
- package/src/utils/mtls.ts +179 -0
- package/src/utils/nativeInstaller/download.ts +523 -0
- package/src/utils/nativeInstaller/index.ts +18 -0
- package/src/utils/nativeInstaller/installer.ts +1708 -0
- package/src/utils/nativeInstaller/packageManagers.ts +336 -0
- package/src/utils/nativeInstaller/pidLock.ts +433 -0
- package/src/utils/notebook.ts +224 -0
- package/src/utils/objectGroupBy.ts +18 -0
- package/src/utils/pasteStore.ts +104 -0
- package/src/utils/path.ts +155 -0
- package/src/utils/pdf.ts +300 -0
- package/src/utils/pdfUtils.ts +70 -0
- package/src/utils/peerAddress.ts +21 -0
- package/src/utils/permissions/PermissionMode.ts +141 -0
- package/src/utils/permissions/PermissionPromptToolResultSchema.ts +127 -0
- package/src/utils/permissions/PermissionResult.ts +35 -0
- package/src/utils/permissions/PermissionRule.ts +40 -0
- package/src/utils/permissions/PermissionUpdate.ts +389 -0
- package/src/utils/permissions/PermissionUpdateSchema.ts +78 -0
- package/src/utils/permissions/autoModeState.ts +39 -0
- package/src/utils/permissions/bashClassifier.ts +61 -0
- package/src/utils/permissions/bypassPermissionsKillswitch.ts +155 -0
- package/src/utils/permissions/classifierDecision.ts +98 -0
- package/src/utils/permissions/classifierShared.ts +39 -0
- package/src/utils/permissions/dangerousPatterns.ts +80 -0
- package/src/utils/permissions/denialTracking.ts +45 -0
- package/src/utils/permissions/filesystem.ts +1777 -0
- package/src/utils/permissions/getNextPermissionMode.ts +101 -0
- package/src/utils/permissions/pathValidation.ts +485 -0
- package/src/utils/permissions/permissionExplainer.ts +250 -0
- package/src/utils/permissions/permissionRuleParser.ts +198 -0
- package/src/utils/permissions/permissionSetup.ts +1532 -0
- package/src/utils/permissions/permissions.ts +1486 -0
- package/src/utils/permissions/permissionsLoader.ts +296 -0
- package/src/utils/permissions/shadowedRuleDetection.ts +234 -0
- package/src/utils/permissions/shellRuleMatching.ts +228 -0
- package/src/utils/permissions/yoloClassifier.ts +1495 -0
- package/src/utils/planModeV2.ts +95 -0
- package/src/utils/plans.ts +397 -0
- package/src/utils/platform.ts +150 -0
- package/src/utils/plugins/addDirPluginSettings.ts +71 -0
- package/src/utils/plugins/cacheUtils.ts +196 -0
- package/src/utils/plugins/dependencyResolver.ts +305 -0
- package/src/utils/plugins/fetchTelemetry.ts +135 -0
- package/src/utils/plugins/gitAvailability.ts +69 -0
- package/src/utils/plugins/headlessPluginInstall.ts +174 -0
- package/src/utils/plugins/hintRecommendation.ts +164 -0
- package/src/utils/plugins/installCounts.ts +292 -0
- package/src/utils/plugins/installedPluginsManager.ts +1268 -0
- package/src/utils/plugins/loadPluginAgents.ts +348 -0
- package/src/utils/plugins/loadPluginCommands.ts +946 -0
- package/src/utils/plugins/loadPluginHooks.ts +287 -0
- package/src/utils/plugins/loadPluginOutputStyles.ts +178 -0
- package/src/utils/plugins/lspPluginIntegration.ts +387 -0
- package/src/utils/plugins/lspRecommendation.ts +374 -0
- package/src/utils/plugins/managedPlugins.ts +27 -0
- package/src/utils/plugins/marketplaceHelpers.ts +592 -0
- package/src/utils/plugins/marketplaceManager.ts +2643 -0
- package/src/utils/plugins/mcpPluginIntegration.ts +634 -0
- package/src/utils/plugins/mcpbHandler.ts +968 -0
- package/src/utils/plugins/officialMarketplace.ts +25 -0
- package/src/utils/plugins/officialMarketplaceGcs.ts +216 -0
- package/src/utils/plugins/officialMarketplaceStartupCheck.ts +439 -0
- package/src/utils/plugins/orphanedPluginFilter.ts +114 -0
- package/src/utils/plugins/parseMarketplaceInput.ts +162 -0
- package/src/utils/plugins/performStartupChecks.tsx +70 -0
- package/src/utils/plugins/pluginAutoupdate.ts +284 -0
- package/src/utils/plugins/pluginBlocklist.ts +127 -0
- package/src/utils/plugins/pluginDirectories.ts +178 -0
- package/src/utils/plugins/pluginFlagging.ts +208 -0
- package/src/utils/plugins/pluginIdentifier.ts +123 -0
- package/src/utils/plugins/pluginInstallationHelpers.ts +595 -0
- package/src/utils/plugins/pluginLoader.ts +3302 -0
- package/src/utils/plugins/pluginOptionsStorage.ts +400 -0
- package/src/utils/plugins/pluginPolicy.ts +20 -0
- package/src/utils/plugins/pluginStartupCheck.ts +341 -0
- package/src/utils/plugins/pluginVersioning.ts +157 -0
- package/src/utils/plugins/reconciler.ts +265 -0
- package/src/utils/plugins/refresh.ts +215 -0
- package/src/utils/plugins/schemas.ts +1681 -0
- package/src/utils/plugins/validatePlugin.ts +903 -0
- package/src/utils/plugins/walkPluginMarkdown.ts +69 -0
- package/src/utils/plugins/zipCache.ts +406 -0
- package/src/utils/plugins/zipCacheAdapters.ts +164 -0
- package/src/utils/powershell/dangerousCmdlets.ts +185 -0
- package/src/utils/powershell/parser.ts +1804 -0
- package/src/utils/powershell/staticPrefix.ts +316 -0
- package/src/utils/preflightChecks.tsx +151 -0
- package/src/utils/privacyLevel.ts +55 -0
- package/src/utils/process.ts +68 -0
- package/src/utils/processUserInput/processBashCommand.tsx +140 -0
- package/src/utils/processUserInput/processSlashCommand.tsx +922 -0
- package/src/utils/processUserInput/processTextPrompt.ts +100 -0
- package/src/utils/processUserInput/processUserInput.ts +605 -0
- package/src/utils/profilerBase.ts +46 -0
- package/src/utils/promptCategory.ts +49 -0
- package/src/utils/promptEditor.ts +188 -0
- package/src/utils/promptShellExecution.ts +183 -0
- package/src/utils/proxy.ts +426 -0
- package/src/utils/queryContext.ts +179 -0
- package/src/utils/queryHelpers.ts +552 -0
- package/src/utils/queryProfiler.ts +301 -0
- package/src/utils/queueProcessor.ts +95 -0
- package/src/utils/readEditContext.ts +227 -0
- package/src/utils/readFileInRange.ts +383 -0
- package/src/utils/releaseNotes.ts +360 -0
- package/src/utils/renderOptions.ts +77 -0
- package/src/utils/ripgrep.ts +679 -0
- package/src/utils/sandbox/sandbox-adapter.ts +985 -0
- package/src/utils/sandbox/sandbox-ui-utils.ts +12 -0
- package/src/utils/sanitization.ts +91 -0
- package/src/utils/screenshotClipboard.ts +121 -0
- package/src/utils/sdkEventQueue.ts +134 -0
- package/src/utils/secureStorage/fallbackStorage.ts +70 -0
- package/src/utils/secureStorage/index.ts +17 -0
- package/src/utils/secureStorage/keychainPrefetch.ts +116 -0
- package/src/utils/secureStorage/macOsKeychainHelpers.ts +111 -0
- package/src/utils/secureStorage/macOsKeychainStorage.ts +231 -0
- package/src/utils/secureStorage/plainTextStorage.ts +84 -0
- package/src/utils/semanticBoolean.ts +29 -0
- package/src/utils/semanticNumber.ts +36 -0
- package/src/utils/semver.ts +59 -0
- package/src/utils/sequential.ts +56 -0
- package/src/utils/sessionActivity.ts +133 -0
- package/src/utils/sessionEnvVars.ts +22 -0
- package/src/utils/sessionEnvironment.ts +166 -0
- package/src/utils/sessionFileAccessHooks.ts +250 -0
- package/src/utils/sessionIngressAuth.ts +140 -0
- package/src/utils/sessionRestore.ts +551 -0
- package/src/utils/sessionStart.ts +232 -0
- package/src/utils/sessionState.ts +150 -0
- package/src/utils/sessionStorage.ts +5105 -0
- package/src/utils/sessionStoragePortable.ts +793 -0
- package/src/utils/sessionTitle.ts +129 -0
- package/src/utils/sessionUrl.ts +64 -0
- package/src/utils/set.ts +53 -0
- package/src/utils/settings/allErrors.ts +32 -0
- package/src/utils/settings/applySettingsChange.ts +92 -0
- package/src/utils/settings/changeDetector.ts +488 -0
- package/src/utils/settings/constants.ts +202 -0
- package/src/utils/settings/internalWrites.ts +37 -0
- package/src/utils/settings/managedPath.ts +34 -0
- package/src/utils/settings/mdm/constants.ts +81 -0
- package/src/utils/settings/mdm/rawRead.ts +130 -0
- package/src/utils/settings/mdm/settings.ts +316 -0
- package/src/utils/settings/permissionValidation.ts +262 -0
- package/src/utils/settings/pluginOnlyPolicy.ts +60 -0
- package/src/utils/settings/schemaOutput.ts +8 -0
- package/src/utils/settings/settings.ts +1015 -0
- package/src/utils/settings/settingsCache.ts +80 -0
- package/src/utils/settings/toolValidationConfig.ts +103 -0
- package/src/utils/settings/types.ts +1148 -0
- package/src/utils/settings/validateEditTool.ts +45 -0
- package/src/utils/settings/validation.ts +265 -0
- package/src/utils/settings/validationTips.ts +164 -0
- package/src/utils/shell/bashProvider.ts +255 -0
- package/src/utils/shell/outputLimits.ts +14 -0
- package/src/utils/shell/powershellDetection.ts +107 -0
- package/src/utils/shell/powershellProvider.ts +123 -0
- package/src/utils/shell/prefix.ts +367 -0
- package/src/utils/shell/readOnlyCommandValidation.ts +1893 -0
- package/src/utils/shell/resolveDefaultShell.ts +14 -0
- package/src/utils/shell/shellProvider.ts +33 -0
- package/src/utils/shell/shellToolUtils.ts +22 -0
- package/src/utils/shell/specPrefix.ts +241 -0
- package/src/utils/shellConfig.ts +167 -0
- package/src/utils/sideQuery.ts +222 -0
- package/src/utils/sideQuestion.ts +155 -0
- package/src/utils/signal.ts +43 -0
- package/src/utils/sinks.ts +16 -0
- package/src/utils/skills/skillChangeDetector.ts +311 -0
- package/src/utils/slashCommandParsing.ts +60 -0
- package/src/utils/sleep.ts +84 -0
- package/src/utils/sliceAnsi.ts +91 -0
- package/src/utils/slowOperations.ts +286 -0
- package/src/utils/standaloneAgent.ts +23 -0
- package/src/utils/startupProfiler.ts +194 -0
- package/src/utils/staticRender.tsx +116 -0
- package/src/utils/stats.ts +1061 -0
- package/src/utils/statsCache.ts +434 -0
- package/src/utils/status.tsx +362 -0
- package/src/utils/statusNoticeDefinitions.tsx +198 -0
- package/src/utils/statusNoticeHelpers.ts +20 -0
- package/src/utils/stream.ts +76 -0
- package/src/utils/streamJsonStdoutGuard.ts +123 -0
- package/src/utils/streamlinedTransform.ts +201 -0
- package/src/utils/stringUtils.ts +235 -0
- package/src/utils/subprocessEnv.ts +99 -0
- package/src/utils/suggestions/commandSuggestions.ts +567 -0
- package/src/utils/suggestions/directoryCompletion.ts +263 -0
- package/src/utils/suggestions/shellHistoryCompletion.ts +119 -0
- package/src/utils/suggestions/skillUsageTracking.ts +55 -0
- package/src/utils/suggestions/slackChannelSuggestions.ts +209 -0
- package/src/utils/swarm/It2SetupPrompt.tsx +380 -0
- package/src/utils/swarm/backends/ITermBackend.ts +370 -0
- package/src/utils/swarm/backends/InProcessBackend.ts +339 -0
- package/src/utils/swarm/backends/PaneBackendExecutor.ts +354 -0
- package/src/utils/swarm/backends/TmuxBackend.ts +764 -0
- package/src/utils/swarm/backends/detection.ts +128 -0
- package/src/utils/swarm/backends/it2Setup.ts +245 -0
- package/src/utils/swarm/backends/registry.ts +464 -0
- package/src/utils/swarm/backends/teammateModeSnapshot.ts +87 -0
- package/src/utils/swarm/backends/types.ts +311 -0
- package/src/utils/swarm/constants.ts +33 -0
- package/src/utils/swarm/inProcessRunner.ts +1552 -0
- package/src/utils/swarm/leaderPermissionBridge.ts +54 -0
- package/src/utils/swarm/permissionSync.ts +928 -0
- package/src/utils/swarm/reconnection.ts +119 -0
- package/src/utils/swarm/spawnInProcess.ts +328 -0
- package/src/utils/swarm/spawnUtils.ts +146 -0
- package/src/utils/swarm/teamHelpers.ts +683 -0
- package/src/utils/swarm/teammateInit.ts +129 -0
- package/src/utils/swarm/teammateLayoutManager.ts +107 -0
- package/src/utils/swarm/teammateModel.ts +10 -0
- package/src/utils/swarm/teammatePromptAddendum.ts +18 -0
- package/src/utils/systemDirectories.ts +74 -0
- package/src/utils/systemPrompt.ts +123 -0
- package/src/utils/systemPromptType.ts +14 -0
- package/src/utils/systemTheme.ts +119 -0
- package/src/utils/taggedId.ts +54 -0
- package/src/utils/task/TaskOutput.ts +390 -0
- package/src/utils/task/diskOutput.ts +451 -0
- package/src/utils/task/framework.ts +308 -0
- package/src/utils/task/outputFormatting.ts +38 -0
- package/src/utils/task/sdkProgress.ts +36 -0
- package/src/utils/tasks.ts +862 -0
- package/src/utils/teamDiscovery.ts +81 -0
- package/src/utils/teamMemoryOps.ts +88 -0
- package/src/utils/teammate.ts +292 -0
- package/src/utils/teammateContext.ts +96 -0
- package/src/utils/teammateMailbox.ts +1183 -0
- package/src/utils/telemetry/betaSessionTracing.ts +491 -0
- package/src/utils/telemetry/bigqueryExporter.ts +252 -0
- package/src/utils/telemetry/events.ts +75 -0
- package/src/utils/telemetry/instrumentation.ts +825 -0
- package/src/utils/telemetry/logger.ts +26 -0
- package/src/utils/telemetry/perfettoTracing.ts +1120 -0
- package/src/utils/telemetry/pluginTelemetry.ts +289 -0
- package/src/utils/telemetry/sessionTracing.ts +927 -0
- package/src/utils/telemetry/skillLoadedEvent.ts +39 -0
- package/src/utils/telemetryAttributes.ts +71 -0
- package/src/utils/teleport/api.ts +466 -0
- package/src/utils/teleport/environmentSelection.ts +77 -0
- package/src/utils/teleport/environments.ts +120 -0
- package/src/utils/teleport/gitBundle.ts +292 -0
- package/src/utils/teleport.tsx +1226 -0
- package/src/utils/tempfile.ts +31 -0
- package/src/utils/terminal.ts +131 -0
- package/src/utils/terminalPanel.ts +191 -0
- package/src/utils/textHighlighting.ts +166 -0
- package/src/utils/theme.ts +639 -0
- package/src/utils/thinking.ts +162 -0
- package/src/utils/timeouts.ts +39 -0
- package/src/utils/tmuxSocket.ts +427 -0
- package/src/utils/todo/types.ts +18 -0
- package/src/utils/tokenBudget.ts +73 -0
- package/src/utils/tokens.ts +261 -0
- package/src/utils/toolErrors.ts +132 -0
- package/src/utils/toolPool.ts +79 -0
- package/src/utils/toolResultStorage.ts +1040 -0
- package/src/utils/toolSchemaCache.ts +26 -0
- package/src/utils/toolSearch.ts +756 -0
- package/src/utils/transcriptSearch.ts +202 -0
- package/src/utils/treeify.ts +170 -0
- package/src/utils/truncate.ts +179 -0
- package/src/utils/ultraplan/ccrSession.ts +349 -0
- package/src/utils/ultraplan/keyword.ts +127 -0
- package/src/utils/ultraplan/prompt.txt +1 -0
- package/src/utils/unaryLogging.ts +39 -0
- package/src/utils/undercover.ts +89 -0
- package/src/utils/user.ts +194 -0
- package/src/utils/userAgent.ts +10 -0
- package/src/utils/userPromptKeywords.ts +27 -0
- package/src/utils/uuid.ts +27 -0
- package/src/utils/warningHandler.ts +121 -0
- package/src/utils/which.ts +82 -0
- package/src/utils/windowsPaths.ts +173 -0
- package/src/utils/withResolvers.ts +13 -0
- package/src/utils/words.ts +800 -0
- package/src/utils/workloadContext.ts +57 -0
- package/src/utils/worktree.ts +1519 -0
- package/src/utils/worktreeModeEnabled.ts +11 -0
- package/src/utils/xdg.ts +65 -0
- package/src/utils/xml.ts +16 -0
- package/src/utils/yaml.ts +15 -0
- package/src/utils/zodToJsonSchema.ts +23 -0
- package/src/vim/motions.ts +82 -0
- package/src/vim/operators.ts +556 -0
- package/src/vim/textObjects.ts +186 -0
- package/src/vim/transitions.ts +490 -0
- package/src/vim/types.ts +199 -0
- package/src/voice/voiceModeEnabled.ts +54 -0
- package/start.js +1 -0
|
@@ -0,0 +1,1889 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Core Schemas - Zod schemas for serializable SDK data types.
|
|
3
|
+
*
|
|
4
|
+
* These schemas are the single source of truth for SDK data types.
|
|
5
|
+
* TypeScript types are generated from these schemas and committed for IDE support.
|
|
6
|
+
*
|
|
7
|
+
* @see scripts/generate-sdk-types.ts for type generation
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { z } from 'zod/v4'
|
|
11
|
+
import { lazySchema } from '../../utils/lazySchema.js'
|
|
12
|
+
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Usage & Model Types
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
export const ModelUsageSchema = lazySchema(() =>
|
|
18
|
+
z.object({
|
|
19
|
+
inputTokens: z.number(),
|
|
20
|
+
outputTokens: z.number(),
|
|
21
|
+
cacheReadInputTokens: z.number(),
|
|
22
|
+
cacheCreationInputTokens: z.number(),
|
|
23
|
+
webSearchRequests: z.number(),
|
|
24
|
+
costUSD: z.number(),
|
|
25
|
+
contextWindow: z.number(),
|
|
26
|
+
maxOutputTokens: z.number(),
|
|
27
|
+
}),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
// ============================================================================
|
|
31
|
+
// Output Format Types
|
|
32
|
+
// ============================================================================
|
|
33
|
+
|
|
34
|
+
export const OutputFormatTypeSchema = lazySchema(() => z.literal('json_schema'))
|
|
35
|
+
|
|
36
|
+
export const BaseOutputFormatSchema = lazySchema(() =>
|
|
37
|
+
z.object({
|
|
38
|
+
type: OutputFormatTypeSchema(),
|
|
39
|
+
}),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
export const JsonSchemaOutputFormatSchema = lazySchema(() =>
|
|
43
|
+
z.object({
|
|
44
|
+
type: z.literal('json_schema'),
|
|
45
|
+
schema: z.record(z.string(), z.unknown()),
|
|
46
|
+
}),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
export const OutputFormatSchema = lazySchema(() =>
|
|
50
|
+
JsonSchemaOutputFormatSchema(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// Config Types
|
|
55
|
+
// ============================================================================
|
|
56
|
+
|
|
57
|
+
export const ApiKeySourceSchema = lazySchema(() =>
|
|
58
|
+
z.enum(['user', 'project', 'org', 'temporary', 'oauth']),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
export const ConfigScopeSchema = lazySchema(() =>
|
|
62
|
+
z.enum(['local', 'user', 'project']).describe('Config scope for settings.'),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
export const SdkBetaSchema = lazySchema(() =>
|
|
66
|
+
z.literal('context-1m-2025-08-07'),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
export const ThinkingAdaptiveSchema = lazySchema(() =>
|
|
70
|
+
z
|
|
71
|
+
.object({
|
|
72
|
+
type: z.literal('adaptive'),
|
|
73
|
+
})
|
|
74
|
+
.describe('Claude decides when and how much to think (Opus 4.6+).'),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
export const ThinkingEnabledSchema = lazySchema(() =>
|
|
78
|
+
z
|
|
79
|
+
.object({
|
|
80
|
+
type: z.literal('enabled'),
|
|
81
|
+
budgetTokens: z.number().optional(),
|
|
82
|
+
})
|
|
83
|
+
.describe('Fixed thinking token budget (older models)'),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
export const ThinkingDisabledSchema = lazySchema(() =>
|
|
87
|
+
z
|
|
88
|
+
.object({
|
|
89
|
+
type: z.literal('disabled'),
|
|
90
|
+
})
|
|
91
|
+
.describe('No extended thinking'),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
export const ThinkingConfigSchema = lazySchema(() =>
|
|
95
|
+
z
|
|
96
|
+
.union([
|
|
97
|
+
ThinkingAdaptiveSchema(),
|
|
98
|
+
ThinkingEnabledSchema(),
|
|
99
|
+
ThinkingDisabledSchema(),
|
|
100
|
+
])
|
|
101
|
+
.describe(
|
|
102
|
+
"Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.",
|
|
103
|
+
),
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
// ============================================================================
|
|
107
|
+
// MCP Server Config Types (serializable only)
|
|
108
|
+
// ============================================================================
|
|
109
|
+
|
|
110
|
+
export const McpStdioServerConfigSchema = lazySchema(() =>
|
|
111
|
+
z.object({
|
|
112
|
+
type: z.literal('stdio').optional(), // Optional for backwards compatibility
|
|
113
|
+
command: z.string(),
|
|
114
|
+
args: z.array(z.string()).optional(),
|
|
115
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
116
|
+
}),
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
export const McpSSEServerConfigSchema = lazySchema(() =>
|
|
120
|
+
z.object({
|
|
121
|
+
type: z.literal('sse'),
|
|
122
|
+
url: z.string(),
|
|
123
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
124
|
+
}),
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
export const McpHttpServerConfigSchema = lazySchema(() =>
|
|
128
|
+
z.object({
|
|
129
|
+
type: z.literal('http'),
|
|
130
|
+
url: z.string(),
|
|
131
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
132
|
+
}),
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
export const McpSdkServerConfigSchema = lazySchema(() =>
|
|
136
|
+
z.object({
|
|
137
|
+
type: z.literal('sdk'),
|
|
138
|
+
name: z.string(),
|
|
139
|
+
}),
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
export const McpServerConfigForProcessTransportSchema = lazySchema(() =>
|
|
143
|
+
z.union([
|
|
144
|
+
McpStdioServerConfigSchema(),
|
|
145
|
+
McpSSEServerConfigSchema(),
|
|
146
|
+
McpHttpServerConfigSchema(),
|
|
147
|
+
McpSdkServerConfigSchema(),
|
|
148
|
+
]),
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
export const McpClaudeAIProxyServerConfigSchema = lazySchema(() =>
|
|
152
|
+
z.object({
|
|
153
|
+
type: z.literal('claudeai-proxy'),
|
|
154
|
+
url: z.string(),
|
|
155
|
+
id: z.string(),
|
|
156
|
+
}),
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
// Broader config type for status responses (includes claudeai-proxy which is output-only)
|
|
160
|
+
export const McpServerStatusConfigSchema = lazySchema(() =>
|
|
161
|
+
z.union([
|
|
162
|
+
McpServerConfigForProcessTransportSchema(),
|
|
163
|
+
McpClaudeAIProxyServerConfigSchema(),
|
|
164
|
+
]),
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
export const McpServerStatusSchema = lazySchema(() =>
|
|
168
|
+
z
|
|
169
|
+
.object({
|
|
170
|
+
name: z.string().describe('Server name as configured'),
|
|
171
|
+
status: z
|
|
172
|
+
.enum(['connected', 'failed', 'needs-auth', 'pending', 'disabled'])
|
|
173
|
+
.describe('Current connection status'),
|
|
174
|
+
serverInfo: z
|
|
175
|
+
.object({
|
|
176
|
+
name: z.string(),
|
|
177
|
+
version: z.string(),
|
|
178
|
+
})
|
|
179
|
+
.optional()
|
|
180
|
+
.describe('Server information (available when connected)'),
|
|
181
|
+
error: z
|
|
182
|
+
.string()
|
|
183
|
+
.optional()
|
|
184
|
+
.describe("Error message (available when status is 'failed')"),
|
|
185
|
+
config: McpServerStatusConfigSchema()
|
|
186
|
+
.optional()
|
|
187
|
+
.describe('Server configuration (includes URL for HTTP/SSE servers)'),
|
|
188
|
+
scope: z
|
|
189
|
+
.string()
|
|
190
|
+
.optional()
|
|
191
|
+
.describe(
|
|
192
|
+
'Configuration scope (e.g., project, user, local, claudeai, managed)',
|
|
193
|
+
),
|
|
194
|
+
tools: z
|
|
195
|
+
.array(
|
|
196
|
+
z.object({
|
|
197
|
+
name: z.string(),
|
|
198
|
+
description: z.string().optional(),
|
|
199
|
+
annotations: z
|
|
200
|
+
.object({
|
|
201
|
+
readOnly: z.boolean().optional(),
|
|
202
|
+
destructive: z.boolean().optional(),
|
|
203
|
+
openWorld: z.boolean().optional(),
|
|
204
|
+
})
|
|
205
|
+
.optional(),
|
|
206
|
+
}),
|
|
207
|
+
)
|
|
208
|
+
.optional()
|
|
209
|
+
.describe('Tools provided by this server (available when connected)'),
|
|
210
|
+
capabilities: z
|
|
211
|
+
.object({
|
|
212
|
+
experimental: z.record(z.string(), z.unknown()).optional(),
|
|
213
|
+
})
|
|
214
|
+
.optional()
|
|
215
|
+
.describe(
|
|
216
|
+
"@internal Server capabilities (available when connected). experimental['claude/channel'] is only present if the server's plugin is on the approved channels allowlist — use its presence to decide whether to show an Enable-channel prompt.",
|
|
217
|
+
),
|
|
218
|
+
})
|
|
219
|
+
.describe('Status information for an MCP server connection.'),
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
export const McpSetServersResultSchema = lazySchema(() =>
|
|
223
|
+
z
|
|
224
|
+
.object({
|
|
225
|
+
added: z.array(z.string()).describe('Names of servers that were added'),
|
|
226
|
+
removed: z
|
|
227
|
+
.array(z.string())
|
|
228
|
+
.describe('Names of servers that were removed'),
|
|
229
|
+
errors: z
|
|
230
|
+
.record(z.string(), z.string())
|
|
231
|
+
.describe(
|
|
232
|
+
'Map of server names to error messages for servers that failed to connect',
|
|
233
|
+
),
|
|
234
|
+
})
|
|
235
|
+
.describe('Result of a setMcpServers operation.'),
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
// ============================================================================
|
|
239
|
+
// Permission Types
|
|
240
|
+
// ============================================================================
|
|
241
|
+
|
|
242
|
+
export const PermissionUpdateDestinationSchema = lazySchema(() =>
|
|
243
|
+
z.enum([
|
|
244
|
+
'userSettings',
|
|
245
|
+
'projectSettings',
|
|
246
|
+
'localSettings',
|
|
247
|
+
'session',
|
|
248
|
+
'cliArg',
|
|
249
|
+
]),
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
export const PermissionBehaviorSchema = lazySchema(() =>
|
|
253
|
+
z.enum(['allow', 'deny', 'ask']),
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
export const PermissionRuleValueSchema = lazySchema(() =>
|
|
257
|
+
z.object({
|
|
258
|
+
toolName: z.string(),
|
|
259
|
+
ruleContent: z.string().optional(),
|
|
260
|
+
}),
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
export const PermissionUpdateSchema = lazySchema(() =>
|
|
264
|
+
z.discriminatedUnion('type', [
|
|
265
|
+
z.object({
|
|
266
|
+
type: z.literal('addRules'),
|
|
267
|
+
rules: z.array(PermissionRuleValueSchema()),
|
|
268
|
+
behavior: PermissionBehaviorSchema(),
|
|
269
|
+
destination: PermissionUpdateDestinationSchema(),
|
|
270
|
+
}),
|
|
271
|
+
z.object({
|
|
272
|
+
type: z.literal('replaceRules'),
|
|
273
|
+
rules: z.array(PermissionRuleValueSchema()),
|
|
274
|
+
behavior: PermissionBehaviorSchema(),
|
|
275
|
+
destination: PermissionUpdateDestinationSchema(),
|
|
276
|
+
}),
|
|
277
|
+
z.object({
|
|
278
|
+
type: z.literal('removeRules'),
|
|
279
|
+
rules: z.array(PermissionRuleValueSchema()),
|
|
280
|
+
behavior: PermissionBehaviorSchema(),
|
|
281
|
+
destination: PermissionUpdateDestinationSchema(),
|
|
282
|
+
}),
|
|
283
|
+
z.object({
|
|
284
|
+
type: z.literal('setMode'),
|
|
285
|
+
mode: z.lazy(() => PermissionModeSchema()),
|
|
286
|
+
destination: PermissionUpdateDestinationSchema(),
|
|
287
|
+
}),
|
|
288
|
+
z.object({
|
|
289
|
+
type: z.literal('addDirectories'),
|
|
290
|
+
directories: z.array(z.string()),
|
|
291
|
+
destination: PermissionUpdateDestinationSchema(),
|
|
292
|
+
}),
|
|
293
|
+
z.object({
|
|
294
|
+
type: z.literal('removeDirectories'),
|
|
295
|
+
directories: z.array(z.string()),
|
|
296
|
+
destination: PermissionUpdateDestinationSchema(),
|
|
297
|
+
}),
|
|
298
|
+
]),
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
export const PermissionDecisionClassificationSchema = lazySchema(() =>
|
|
302
|
+
z
|
|
303
|
+
.enum(['user_temporary', 'user_permanent', 'user_reject'])
|
|
304
|
+
.describe(
|
|
305
|
+
'Classification of this permission decision for telemetry. SDK hosts ' +
|
|
306
|
+
'that prompt users (desktop apps, IDEs) should set this to reflect ' +
|
|
307
|
+
'what actually happened: user_temporary for allow-once, user_permanent ' +
|
|
308
|
+
'for always-allow (both the click and later cache hits), user_reject ' +
|
|
309
|
+
'for deny. If unset, the CLI infers conservatively (temporary for ' +
|
|
310
|
+
'allow, reject for deny). The vocabulary matches tool_decision OTel ' +
|
|
311
|
+
'events (monitoring-usage docs).',
|
|
312
|
+
),
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
export const PermissionResultSchema = lazySchema(() =>
|
|
316
|
+
z.union([
|
|
317
|
+
z.object({
|
|
318
|
+
behavior: z.literal('allow'),
|
|
319
|
+
// Optional - may not be provided if hook sets permission without input modification
|
|
320
|
+
updatedInput: z.record(z.string(), z.unknown()).optional(),
|
|
321
|
+
updatedPermissions: z.array(PermissionUpdateSchema()).optional(),
|
|
322
|
+
toolUseID: z.string().optional(),
|
|
323
|
+
decisionClassification:
|
|
324
|
+
PermissionDecisionClassificationSchema().optional(),
|
|
325
|
+
}),
|
|
326
|
+
z.object({
|
|
327
|
+
behavior: z.literal('deny'),
|
|
328
|
+
message: z.string(),
|
|
329
|
+
interrupt: z.boolean().optional(),
|
|
330
|
+
toolUseID: z.string().optional(),
|
|
331
|
+
decisionClassification:
|
|
332
|
+
PermissionDecisionClassificationSchema().optional(),
|
|
333
|
+
}),
|
|
334
|
+
]),
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
export const PermissionModeSchema = lazySchema(() =>
|
|
338
|
+
z
|
|
339
|
+
.enum(['default', 'acceptEdits', 'bypassPermissions', 'plan', 'dontAsk'])
|
|
340
|
+
.describe(
|
|
341
|
+
'Permission mode for controlling how tool executions are handled. ' +
|
|
342
|
+
"'default' - Standard behavior, prompts for dangerous operations. " +
|
|
343
|
+
"'acceptEdits' - Auto-accept file edit operations. " +
|
|
344
|
+
"'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). " +
|
|
345
|
+
"'plan' - Planning mode, no actual tool execution. " +
|
|
346
|
+
"'dontAsk' - Don't prompt for permissions, deny if not pre-approved.",
|
|
347
|
+
),
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
// ============================================================================
|
|
352
|
+
// Hook Types
|
|
353
|
+
// ============================================================================
|
|
354
|
+
|
|
355
|
+
export const HOOK_EVENTS = [
|
|
356
|
+
'PreToolUse',
|
|
357
|
+
'PostToolUse',
|
|
358
|
+
'PostToolUseFailure',
|
|
359
|
+
'Notification',
|
|
360
|
+
'UserPromptSubmit',
|
|
361
|
+
'SessionStart',
|
|
362
|
+
'SessionEnd',
|
|
363
|
+
'Stop',
|
|
364
|
+
'StopFailure',
|
|
365
|
+
'SubagentStart',
|
|
366
|
+
'SubagentStop',
|
|
367
|
+
'PreCompact',
|
|
368
|
+
'PostCompact',
|
|
369
|
+
'PermissionRequest',
|
|
370
|
+
'PermissionDenied',
|
|
371
|
+
'Setup',
|
|
372
|
+
'TeammateIdle',
|
|
373
|
+
'TaskCreated',
|
|
374
|
+
'TaskCompleted',
|
|
375
|
+
'Elicitation',
|
|
376
|
+
'ElicitationResult',
|
|
377
|
+
'ConfigChange',
|
|
378
|
+
'WorktreeCreate',
|
|
379
|
+
'WorktreeRemove',
|
|
380
|
+
'InstructionsLoaded',
|
|
381
|
+
'CwdChanged',
|
|
382
|
+
'FileChanged',
|
|
383
|
+
] as const
|
|
384
|
+
|
|
385
|
+
export const HookEventSchema = lazySchema(() => z.enum(HOOK_EVENTS))
|
|
386
|
+
|
|
387
|
+
export const BaseHookInputSchema = lazySchema(() =>
|
|
388
|
+
z.object({
|
|
389
|
+
session_id: z.string(),
|
|
390
|
+
transcript_path: z.string(),
|
|
391
|
+
cwd: z.string(),
|
|
392
|
+
permission_mode: z.string().optional(),
|
|
393
|
+
agent_id: z
|
|
394
|
+
.string()
|
|
395
|
+
.optional()
|
|
396
|
+
.describe(
|
|
397
|
+
'Subagent identifier. Present only when the hook fires from within a subagent ' +
|
|
398
|
+
'(e.g., a tool called by an AgentTool worker). Absent for the main thread, ' +
|
|
399
|
+
'even in --agent sessions. Use this field (not agent_type) to distinguish ' +
|
|
400
|
+
'subagent calls from main-thread calls.',
|
|
401
|
+
),
|
|
402
|
+
agent_type: z
|
|
403
|
+
.string()
|
|
404
|
+
.optional()
|
|
405
|
+
.describe(
|
|
406
|
+
'Agent type name (e.g., "general-purpose", "code-reviewer"). Present when the ' +
|
|
407
|
+
'hook fires from within a subagent (alongside agent_id), or on the main thread ' +
|
|
408
|
+
'of a session started with --agent (without agent_id).',
|
|
409
|
+
),
|
|
410
|
+
}),
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
// Use .and() instead of .extend() to preserve BaseHookInput & {...} in generated types
|
|
414
|
+
export const PreToolUseHookInputSchema = lazySchema(() =>
|
|
415
|
+
BaseHookInputSchema().and(
|
|
416
|
+
z.object({
|
|
417
|
+
hook_event_name: z.literal('PreToolUse'),
|
|
418
|
+
tool_name: z.string(),
|
|
419
|
+
tool_input: z.unknown(),
|
|
420
|
+
tool_use_id: z.string(),
|
|
421
|
+
}),
|
|
422
|
+
),
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
export const PermissionRequestHookInputSchema = lazySchema(() =>
|
|
426
|
+
BaseHookInputSchema().and(
|
|
427
|
+
z.object({
|
|
428
|
+
hook_event_name: z.literal('PermissionRequest'),
|
|
429
|
+
tool_name: z.string(),
|
|
430
|
+
tool_input: z.unknown(),
|
|
431
|
+
permission_suggestions: z.array(PermissionUpdateSchema()).optional(),
|
|
432
|
+
}),
|
|
433
|
+
),
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
export const PostToolUseHookInputSchema = lazySchema(() =>
|
|
437
|
+
BaseHookInputSchema().and(
|
|
438
|
+
z.object({
|
|
439
|
+
hook_event_name: z.literal('PostToolUse'),
|
|
440
|
+
tool_name: z.string(),
|
|
441
|
+
tool_input: z.unknown(),
|
|
442
|
+
tool_response: z.unknown(),
|
|
443
|
+
tool_use_id: z.string(),
|
|
444
|
+
}),
|
|
445
|
+
),
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
export const PostToolUseFailureHookInputSchema = lazySchema(() =>
|
|
449
|
+
BaseHookInputSchema().and(
|
|
450
|
+
z.object({
|
|
451
|
+
hook_event_name: z.literal('PostToolUseFailure'),
|
|
452
|
+
tool_name: z.string(),
|
|
453
|
+
tool_input: z.unknown(),
|
|
454
|
+
tool_use_id: z.string(),
|
|
455
|
+
error: z.string(),
|
|
456
|
+
is_interrupt: z.boolean().optional(),
|
|
457
|
+
}),
|
|
458
|
+
),
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
export const PermissionDeniedHookInputSchema = lazySchema(() =>
|
|
462
|
+
BaseHookInputSchema().and(
|
|
463
|
+
z.object({
|
|
464
|
+
hook_event_name: z.literal('PermissionDenied'),
|
|
465
|
+
tool_name: z.string(),
|
|
466
|
+
tool_input: z.unknown(),
|
|
467
|
+
tool_use_id: z.string(),
|
|
468
|
+
reason: z.string(),
|
|
469
|
+
}),
|
|
470
|
+
),
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
export const NotificationHookInputSchema = lazySchema(() =>
|
|
474
|
+
BaseHookInputSchema().and(
|
|
475
|
+
z.object({
|
|
476
|
+
hook_event_name: z.literal('Notification'),
|
|
477
|
+
message: z.string(),
|
|
478
|
+
title: z.string().optional(),
|
|
479
|
+
notification_type: z.string(),
|
|
480
|
+
}),
|
|
481
|
+
),
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
export const UserPromptSubmitHookInputSchema = lazySchema(() =>
|
|
485
|
+
BaseHookInputSchema().and(
|
|
486
|
+
z.object({
|
|
487
|
+
hook_event_name: z.literal('UserPromptSubmit'),
|
|
488
|
+
prompt: z.string(),
|
|
489
|
+
}),
|
|
490
|
+
),
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
export const SessionStartHookInputSchema = lazySchema(() =>
|
|
494
|
+
BaseHookInputSchema().and(
|
|
495
|
+
z.object({
|
|
496
|
+
hook_event_name: z.literal('SessionStart'),
|
|
497
|
+
source: z.enum(['startup', 'resume', 'clear', 'compact']),
|
|
498
|
+
agent_type: z.string().optional(),
|
|
499
|
+
model: z.string().optional(),
|
|
500
|
+
}),
|
|
501
|
+
),
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
export const SetupHookInputSchema = lazySchema(() =>
|
|
505
|
+
BaseHookInputSchema().and(
|
|
506
|
+
z.object({
|
|
507
|
+
hook_event_name: z.literal('Setup'),
|
|
508
|
+
trigger: z.enum(['init', 'maintenance']),
|
|
509
|
+
}),
|
|
510
|
+
),
|
|
511
|
+
)
|
|
512
|
+
|
|
513
|
+
export const StopHookInputSchema = lazySchema(() =>
|
|
514
|
+
BaseHookInputSchema().and(
|
|
515
|
+
z.object({
|
|
516
|
+
hook_event_name: z.literal('Stop'),
|
|
517
|
+
stop_hook_active: z.boolean(),
|
|
518
|
+
last_assistant_message: z
|
|
519
|
+
.string()
|
|
520
|
+
.optional()
|
|
521
|
+
.describe(
|
|
522
|
+
'Text content of the last assistant message before stopping. ' +
|
|
523
|
+
'Avoids the need to read and parse the transcript file.',
|
|
524
|
+
),
|
|
525
|
+
}),
|
|
526
|
+
),
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
export const StopFailureHookInputSchema = lazySchema(() =>
|
|
530
|
+
BaseHookInputSchema().and(
|
|
531
|
+
z.object({
|
|
532
|
+
hook_event_name: z.literal('StopFailure'),
|
|
533
|
+
error: SDKAssistantMessageErrorSchema(),
|
|
534
|
+
error_details: z.string().optional(),
|
|
535
|
+
last_assistant_message: z.string().optional(),
|
|
536
|
+
}),
|
|
537
|
+
),
|
|
538
|
+
)
|
|
539
|
+
|
|
540
|
+
export const SubagentStartHookInputSchema = lazySchema(() =>
|
|
541
|
+
BaseHookInputSchema().and(
|
|
542
|
+
z.object({
|
|
543
|
+
hook_event_name: z.literal('SubagentStart'),
|
|
544
|
+
agent_id: z.string(),
|
|
545
|
+
agent_type: z.string(),
|
|
546
|
+
}),
|
|
547
|
+
),
|
|
548
|
+
)
|
|
549
|
+
|
|
550
|
+
export const SubagentStopHookInputSchema = lazySchema(() =>
|
|
551
|
+
BaseHookInputSchema().and(
|
|
552
|
+
z.object({
|
|
553
|
+
hook_event_name: z.literal('SubagentStop'),
|
|
554
|
+
stop_hook_active: z.boolean(),
|
|
555
|
+
agent_id: z.string(),
|
|
556
|
+
agent_transcript_path: z.string(),
|
|
557
|
+
agent_type: z.string(),
|
|
558
|
+
last_assistant_message: z
|
|
559
|
+
.string()
|
|
560
|
+
.optional()
|
|
561
|
+
.describe(
|
|
562
|
+
'Text content of the last assistant message before stopping. ' +
|
|
563
|
+
'Avoids the need to read and parse the transcript file.',
|
|
564
|
+
),
|
|
565
|
+
}),
|
|
566
|
+
),
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
export const PreCompactHookInputSchema = lazySchema(() =>
|
|
570
|
+
BaseHookInputSchema().and(
|
|
571
|
+
z.object({
|
|
572
|
+
hook_event_name: z.literal('PreCompact'),
|
|
573
|
+
trigger: z.enum(['manual', 'auto']),
|
|
574
|
+
custom_instructions: z.string().nullable(),
|
|
575
|
+
}),
|
|
576
|
+
),
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
export const PostCompactHookInputSchema = lazySchema(() =>
|
|
580
|
+
BaseHookInputSchema().and(
|
|
581
|
+
z.object({
|
|
582
|
+
hook_event_name: z.literal('PostCompact'),
|
|
583
|
+
trigger: z.enum(['manual', 'auto']),
|
|
584
|
+
compact_summary: z
|
|
585
|
+
.string()
|
|
586
|
+
.describe('The conversation summary produced by compaction'),
|
|
587
|
+
}),
|
|
588
|
+
),
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
export const TeammateIdleHookInputSchema = lazySchema(() =>
|
|
592
|
+
BaseHookInputSchema().and(
|
|
593
|
+
z.object({
|
|
594
|
+
hook_event_name: z.literal('TeammateIdle'),
|
|
595
|
+
teammate_name: z.string(),
|
|
596
|
+
team_name: z.string(),
|
|
597
|
+
}),
|
|
598
|
+
),
|
|
599
|
+
)
|
|
600
|
+
|
|
601
|
+
export const TaskCreatedHookInputSchema = lazySchema(() =>
|
|
602
|
+
BaseHookInputSchema().and(
|
|
603
|
+
z.object({
|
|
604
|
+
hook_event_name: z.literal('TaskCreated'),
|
|
605
|
+
task_id: z.string(),
|
|
606
|
+
task_subject: z.string(),
|
|
607
|
+
task_description: z.string().optional(),
|
|
608
|
+
teammate_name: z.string().optional(),
|
|
609
|
+
team_name: z.string().optional(),
|
|
610
|
+
}),
|
|
611
|
+
),
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
export const TaskCompletedHookInputSchema = lazySchema(() =>
|
|
615
|
+
BaseHookInputSchema().and(
|
|
616
|
+
z.object({
|
|
617
|
+
hook_event_name: z.literal('TaskCompleted'),
|
|
618
|
+
task_id: z.string(),
|
|
619
|
+
task_subject: z.string(),
|
|
620
|
+
task_description: z.string().optional(),
|
|
621
|
+
teammate_name: z.string().optional(),
|
|
622
|
+
team_name: z.string().optional(),
|
|
623
|
+
}),
|
|
624
|
+
),
|
|
625
|
+
)
|
|
626
|
+
|
|
627
|
+
export const ElicitationHookInputSchema = lazySchema(() =>
|
|
628
|
+
BaseHookInputSchema()
|
|
629
|
+
.and(
|
|
630
|
+
z.object({
|
|
631
|
+
hook_event_name: z.literal('Elicitation'),
|
|
632
|
+
mcp_server_name: z.string(),
|
|
633
|
+
message: z.string(),
|
|
634
|
+
mode: z.enum(['form', 'url']).optional(),
|
|
635
|
+
url: z.string().optional(),
|
|
636
|
+
elicitation_id: z.string().optional(),
|
|
637
|
+
requested_schema: z.record(z.string(), z.unknown()).optional(),
|
|
638
|
+
}),
|
|
639
|
+
)
|
|
640
|
+
.describe(
|
|
641
|
+
'Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog.',
|
|
642
|
+
),
|
|
643
|
+
)
|
|
644
|
+
|
|
645
|
+
export const ElicitationResultHookInputSchema = lazySchema(() =>
|
|
646
|
+
BaseHookInputSchema()
|
|
647
|
+
.and(
|
|
648
|
+
z.object({
|
|
649
|
+
hook_event_name: z.literal('ElicitationResult'),
|
|
650
|
+
mcp_server_name: z.string(),
|
|
651
|
+
elicitation_id: z.string().optional(),
|
|
652
|
+
mode: z.enum(['form', 'url']).optional(),
|
|
653
|
+
action: z.enum(['accept', 'decline', 'cancel']),
|
|
654
|
+
content: z.record(z.string(), z.unknown()).optional(),
|
|
655
|
+
}),
|
|
656
|
+
)
|
|
657
|
+
.describe(
|
|
658
|
+
'Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server.',
|
|
659
|
+
),
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
export const CONFIG_CHANGE_SOURCES = [
|
|
663
|
+
'user_settings',
|
|
664
|
+
'project_settings',
|
|
665
|
+
'local_settings',
|
|
666
|
+
'policy_settings',
|
|
667
|
+
'skills',
|
|
668
|
+
] as const
|
|
669
|
+
|
|
670
|
+
export const ConfigChangeHookInputSchema = lazySchema(() =>
|
|
671
|
+
BaseHookInputSchema().and(
|
|
672
|
+
z.object({
|
|
673
|
+
hook_event_name: z.literal('ConfigChange'),
|
|
674
|
+
source: z.enum(CONFIG_CHANGE_SOURCES),
|
|
675
|
+
file_path: z.string().optional(),
|
|
676
|
+
}),
|
|
677
|
+
),
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
export const INSTRUCTIONS_LOAD_REASONS = [
|
|
681
|
+
'session_start',
|
|
682
|
+
'nested_traversal',
|
|
683
|
+
'path_glob_match',
|
|
684
|
+
'include',
|
|
685
|
+
'compact',
|
|
686
|
+
] as const
|
|
687
|
+
|
|
688
|
+
export const INSTRUCTIONS_MEMORY_TYPES = [
|
|
689
|
+
'User',
|
|
690
|
+
'Project',
|
|
691
|
+
'Local',
|
|
692
|
+
'Managed',
|
|
693
|
+
] as const
|
|
694
|
+
|
|
695
|
+
export const InstructionsLoadedHookInputSchema = lazySchema(() =>
|
|
696
|
+
BaseHookInputSchema().and(
|
|
697
|
+
z.object({
|
|
698
|
+
hook_event_name: z.literal('InstructionsLoaded'),
|
|
699
|
+
file_path: z.string(),
|
|
700
|
+
memory_type: z.enum(INSTRUCTIONS_MEMORY_TYPES),
|
|
701
|
+
load_reason: z.enum(INSTRUCTIONS_LOAD_REASONS),
|
|
702
|
+
globs: z.array(z.string()).optional(),
|
|
703
|
+
trigger_file_path: z.string().optional(),
|
|
704
|
+
parent_file_path: z.string().optional(),
|
|
705
|
+
}),
|
|
706
|
+
),
|
|
707
|
+
)
|
|
708
|
+
|
|
709
|
+
export const WorktreeCreateHookInputSchema = lazySchema(() =>
|
|
710
|
+
BaseHookInputSchema().and(
|
|
711
|
+
z.object({
|
|
712
|
+
hook_event_name: z.literal('WorktreeCreate'),
|
|
713
|
+
name: z.string(),
|
|
714
|
+
}),
|
|
715
|
+
),
|
|
716
|
+
)
|
|
717
|
+
|
|
718
|
+
export const WorktreeRemoveHookInputSchema = lazySchema(() =>
|
|
719
|
+
BaseHookInputSchema().and(
|
|
720
|
+
z.object({
|
|
721
|
+
hook_event_name: z.literal('WorktreeRemove'),
|
|
722
|
+
worktree_path: z.string(),
|
|
723
|
+
}),
|
|
724
|
+
),
|
|
725
|
+
)
|
|
726
|
+
|
|
727
|
+
export const CwdChangedHookInputSchema = lazySchema(() =>
|
|
728
|
+
BaseHookInputSchema().and(
|
|
729
|
+
z.object({
|
|
730
|
+
hook_event_name: z.literal('CwdChanged'),
|
|
731
|
+
old_cwd: z.string(),
|
|
732
|
+
new_cwd: z.string(),
|
|
733
|
+
}),
|
|
734
|
+
),
|
|
735
|
+
)
|
|
736
|
+
|
|
737
|
+
export const FileChangedHookInputSchema = lazySchema(() =>
|
|
738
|
+
BaseHookInputSchema().and(
|
|
739
|
+
z.object({
|
|
740
|
+
hook_event_name: z.literal('FileChanged'),
|
|
741
|
+
file_path: z.string(),
|
|
742
|
+
event: z.enum(['change', 'add', 'unlink']),
|
|
743
|
+
}),
|
|
744
|
+
),
|
|
745
|
+
)
|
|
746
|
+
|
|
747
|
+
export const EXIT_REASONS = [
|
|
748
|
+
'clear',
|
|
749
|
+
'resume',
|
|
750
|
+
'logout',
|
|
751
|
+
'prompt_input_exit',
|
|
752
|
+
'other',
|
|
753
|
+
'bypass_permissions_disabled',
|
|
754
|
+
] as const
|
|
755
|
+
|
|
756
|
+
export const ExitReasonSchema = lazySchema(() => z.enum(EXIT_REASONS))
|
|
757
|
+
|
|
758
|
+
export const SessionEndHookInputSchema = lazySchema(() =>
|
|
759
|
+
BaseHookInputSchema().and(
|
|
760
|
+
z.object({
|
|
761
|
+
hook_event_name: z.literal('SessionEnd'),
|
|
762
|
+
reason: ExitReasonSchema(),
|
|
763
|
+
}),
|
|
764
|
+
),
|
|
765
|
+
)
|
|
766
|
+
|
|
767
|
+
export const HookInputSchema = lazySchema(() =>
|
|
768
|
+
z.union([
|
|
769
|
+
PreToolUseHookInputSchema(),
|
|
770
|
+
PostToolUseHookInputSchema(),
|
|
771
|
+
PostToolUseFailureHookInputSchema(),
|
|
772
|
+
PermissionDeniedHookInputSchema(),
|
|
773
|
+
NotificationHookInputSchema(),
|
|
774
|
+
UserPromptSubmitHookInputSchema(),
|
|
775
|
+
SessionStartHookInputSchema(),
|
|
776
|
+
SessionEndHookInputSchema(),
|
|
777
|
+
StopHookInputSchema(),
|
|
778
|
+
StopFailureHookInputSchema(),
|
|
779
|
+
SubagentStartHookInputSchema(),
|
|
780
|
+
SubagentStopHookInputSchema(),
|
|
781
|
+
PreCompactHookInputSchema(),
|
|
782
|
+
PostCompactHookInputSchema(),
|
|
783
|
+
PermissionRequestHookInputSchema(),
|
|
784
|
+
SetupHookInputSchema(),
|
|
785
|
+
TeammateIdleHookInputSchema(),
|
|
786
|
+
TaskCreatedHookInputSchema(),
|
|
787
|
+
TaskCompletedHookInputSchema(),
|
|
788
|
+
ElicitationHookInputSchema(),
|
|
789
|
+
ElicitationResultHookInputSchema(),
|
|
790
|
+
ConfigChangeHookInputSchema(),
|
|
791
|
+
InstructionsLoadedHookInputSchema(),
|
|
792
|
+
WorktreeCreateHookInputSchema(),
|
|
793
|
+
WorktreeRemoveHookInputSchema(),
|
|
794
|
+
CwdChangedHookInputSchema(),
|
|
795
|
+
FileChangedHookInputSchema(),
|
|
796
|
+
]),
|
|
797
|
+
)
|
|
798
|
+
|
|
799
|
+
export const AsyncHookJSONOutputSchema = lazySchema(() =>
|
|
800
|
+
z.object({
|
|
801
|
+
async: z.literal(true),
|
|
802
|
+
asyncTimeout: z.number().optional(),
|
|
803
|
+
}),
|
|
804
|
+
)
|
|
805
|
+
|
|
806
|
+
export const PreToolUseHookSpecificOutputSchema = lazySchema(() =>
|
|
807
|
+
z.object({
|
|
808
|
+
hookEventName: z.literal('PreToolUse'),
|
|
809
|
+
permissionDecision: PermissionBehaviorSchema().optional(),
|
|
810
|
+
permissionDecisionReason: z.string().optional(),
|
|
811
|
+
updatedInput: z.record(z.string(), z.unknown()).optional(),
|
|
812
|
+
additionalContext: z.string().optional(),
|
|
813
|
+
}),
|
|
814
|
+
)
|
|
815
|
+
|
|
816
|
+
export const UserPromptSubmitHookSpecificOutputSchema = lazySchema(() =>
|
|
817
|
+
z.object({
|
|
818
|
+
hookEventName: z.literal('UserPromptSubmit'),
|
|
819
|
+
additionalContext: z.string().optional(),
|
|
820
|
+
}),
|
|
821
|
+
)
|
|
822
|
+
|
|
823
|
+
export const SessionStartHookSpecificOutputSchema = lazySchema(() =>
|
|
824
|
+
z.object({
|
|
825
|
+
hookEventName: z.literal('SessionStart'),
|
|
826
|
+
additionalContext: z.string().optional(),
|
|
827
|
+
initialUserMessage: z.string().optional(),
|
|
828
|
+
watchPaths: z.array(z.string()).optional(),
|
|
829
|
+
}),
|
|
830
|
+
)
|
|
831
|
+
|
|
832
|
+
export const SetupHookSpecificOutputSchema = lazySchema(() =>
|
|
833
|
+
z.object({
|
|
834
|
+
hookEventName: z.literal('Setup'),
|
|
835
|
+
additionalContext: z.string().optional(),
|
|
836
|
+
}),
|
|
837
|
+
)
|
|
838
|
+
|
|
839
|
+
export const SubagentStartHookSpecificOutputSchema = lazySchema(() =>
|
|
840
|
+
z.object({
|
|
841
|
+
hookEventName: z.literal('SubagentStart'),
|
|
842
|
+
additionalContext: z.string().optional(),
|
|
843
|
+
}),
|
|
844
|
+
)
|
|
845
|
+
|
|
846
|
+
export const PostToolUseHookSpecificOutputSchema = lazySchema(() =>
|
|
847
|
+
z.object({
|
|
848
|
+
hookEventName: z.literal('PostToolUse'),
|
|
849
|
+
additionalContext: z.string().optional(),
|
|
850
|
+
updatedMCPToolOutput: z.unknown().optional(),
|
|
851
|
+
}),
|
|
852
|
+
)
|
|
853
|
+
|
|
854
|
+
export const PostToolUseFailureHookSpecificOutputSchema = lazySchema(() =>
|
|
855
|
+
z.object({
|
|
856
|
+
hookEventName: z.literal('PostToolUseFailure'),
|
|
857
|
+
additionalContext: z.string().optional(),
|
|
858
|
+
}),
|
|
859
|
+
)
|
|
860
|
+
|
|
861
|
+
export const PermissionDeniedHookSpecificOutputSchema = lazySchema(() =>
|
|
862
|
+
z.object({
|
|
863
|
+
hookEventName: z.literal('PermissionDenied'),
|
|
864
|
+
retry: z.boolean().optional(),
|
|
865
|
+
}),
|
|
866
|
+
)
|
|
867
|
+
|
|
868
|
+
export const NotificationHookSpecificOutputSchema = lazySchema(() =>
|
|
869
|
+
z.object({
|
|
870
|
+
hookEventName: z.literal('Notification'),
|
|
871
|
+
additionalContext: z.string().optional(),
|
|
872
|
+
}),
|
|
873
|
+
)
|
|
874
|
+
|
|
875
|
+
export const PermissionRequestHookSpecificOutputSchema = lazySchema(() =>
|
|
876
|
+
z.object({
|
|
877
|
+
hookEventName: z.literal('PermissionRequest'),
|
|
878
|
+
decision: z.union([
|
|
879
|
+
z.object({
|
|
880
|
+
behavior: z.literal('allow'),
|
|
881
|
+
updatedInput: z.record(z.string(), z.unknown()).optional(),
|
|
882
|
+
updatedPermissions: z.array(PermissionUpdateSchema()).optional(),
|
|
883
|
+
}),
|
|
884
|
+
z.object({
|
|
885
|
+
behavior: z.literal('deny'),
|
|
886
|
+
message: z.string().optional(),
|
|
887
|
+
interrupt: z.boolean().optional(),
|
|
888
|
+
}),
|
|
889
|
+
]),
|
|
890
|
+
}),
|
|
891
|
+
)
|
|
892
|
+
|
|
893
|
+
export const CwdChangedHookSpecificOutputSchema = lazySchema(() =>
|
|
894
|
+
z.object({
|
|
895
|
+
hookEventName: z.literal('CwdChanged'),
|
|
896
|
+
watchPaths: z.array(z.string()).optional(),
|
|
897
|
+
}),
|
|
898
|
+
)
|
|
899
|
+
|
|
900
|
+
export const FileChangedHookSpecificOutputSchema = lazySchema(() =>
|
|
901
|
+
z.object({
|
|
902
|
+
hookEventName: z.literal('FileChanged'),
|
|
903
|
+
watchPaths: z.array(z.string()).optional(),
|
|
904
|
+
}),
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
export const SyncHookJSONOutputSchema = lazySchema(() =>
|
|
908
|
+
z.object({
|
|
909
|
+
continue: z.boolean().optional(),
|
|
910
|
+
suppressOutput: z.boolean().optional(),
|
|
911
|
+
stopReason: z.string().optional(),
|
|
912
|
+
decision: z.enum(['approve', 'block']).optional(),
|
|
913
|
+
systemMessage: z.string().optional(),
|
|
914
|
+
reason: z.string().optional(),
|
|
915
|
+
hookSpecificOutput: z
|
|
916
|
+
.union([
|
|
917
|
+
PreToolUseHookSpecificOutputSchema(),
|
|
918
|
+
UserPromptSubmitHookSpecificOutputSchema(),
|
|
919
|
+
SessionStartHookSpecificOutputSchema(),
|
|
920
|
+
SetupHookSpecificOutputSchema(),
|
|
921
|
+
SubagentStartHookSpecificOutputSchema(),
|
|
922
|
+
PostToolUseHookSpecificOutputSchema(),
|
|
923
|
+
PostToolUseFailureHookSpecificOutputSchema(),
|
|
924
|
+
PermissionDeniedHookSpecificOutputSchema(),
|
|
925
|
+
NotificationHookSpecificOutputSchema(),
|
|
926
|
+
PermissionRequestHookSpecificOutputSchema(),
|
|
927
|
+
ElicitationHookSpecificOutputSchema(),
|
|
928
|
+
ElicitationResultHookSpecificOutputSchema(),
|
|
929
|
+
CwdChangedHookSpecificOutputSchema(),
|
|
930
|
+
FileChangedHookSpecificOutputSchema(),
|
|
931
|
+
WorktreeCreateHookSpecificOutputSchema(),
|
|
932
|
+
])
|
|
933
|
+
.optional(),
|
|
934
|
+
}),
|
|
935
|
+
)
|
|
936
|
+
|
|
937
|
+
export const ElicitationHookSpecificOutputSchema = lazySchema(() =>
|
|
938
|
+
z
|
|
939
|
+
.object({
|
|
940
|
+
hookEventName: z.literal('Elicitation'),
|
|
941
|
+
action: z.enum(['accept', 'decline', 'cancel']).optional(),
|
|
942
|
+
content: z.record(z.string(), z.unknown()).optional(),
|
|
943
|
+
})
|
|
944
|
+
.describe(
|
|
945
|
+
'Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request.',
|
|
946
|
+
),
|
|
947
|
+
)
|
|
948
|
+
|
|
949
|
+
export const ElicitationResultHookSpecificOutputSchema = lazySchema(() =>
|
|
950
|
+
z
|
|
951
|
+
.object({
|
|
952
|
+
hookEventName: z.literal('ElicitationResult'),
|
|
953
|
+
action: z.enum(['accept', 'decline', 'cancel']).optional(),
|
|
954
|
+
content: z.record(z.string(), z.unknown()).optional(),
|
|
955
|
+
})
|
|
956
|
+
.describe(
|
|
957
|
+
'Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server.',
|
|
958
|
+
),
|
|
959
|
+
)
|
|
960
|
+
|
|
961
|
+
export const WorktreeCreateHookSpecificOutputSchema = lazySchema(() =>
|
|
962
|
+
z
|
|
963
|
+
.object({
|
|
964
|
+
hookEventName: z.literal('WorktreeCreate'),
|
|
965
|
+
worktreePath: z.string(),
|
|
966
|
+
})
|
|
967
|
+
.describe(
|
|
968
|
+
'Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead.',
|
|
969
|
+
),
|
|
970
|
+
)
|
|
971
|
+
|
|
972
|
+
export const HookJSONOutputSchema = lazySchema(() =>
|
|
973
|
+
z.union([AsyncHookJSONOutputSchema(), SyncHookJSONOutputSchema()]),
|
|
974
|
+
)
|
|
975
|
+
|
|
976
|
+
export const PromptRequestOptionSchema = lazySchema(() =>
|
|
977
|
+
z.object({
|
|
978
|
+
key: z
|
|
979
|
+
.string()
|
|
980
|
+
.describe('Unique key for this option, returned in the response'),
|
|
981
|
+
label: z.string().describe('Display text for this option'),
|
|
982
|
+
description: z
|
|
983
|
+
.string()
|
|
984
|
+
.optional()
|
|
985
|
+
.describe('Optional description shown below the label'),
|
|
986
|
+
}),
|
|
987
|
+
)
|
|
988
|
+
|
|
989
|
+
export const PromptRequestSchema = lazySchema(() =>
|
|
990
|
+
z.object({
|
|
991
|
+
prompt: z
|
|
992
|
+
.string()
|
|
993
|
+
.describe(
|
|
994
|
+
'Request ID. Presence of this key marks the line as a prompt request.',
|
|
995
|
+
),
|
|
996
|
+
message: z.string().describe('The prompt message to display to the user'),
|
|
997
|
+
options: z
|
|
998
|
+
.array(PromptRequestOptionSchema())
|
|
999
|
+
.describe('Available options for the user to choose from'),
|
|
1000
|
+
}),
|
|
1001
|
+
)
|
|
1002
|
+
|
|
1003
|
+
export const PromptResponseSchema = lazySchema(() =>
|
|
1004
|
+
z.object({
|
|
1005
|
+
prompt_response: z
|
|
1006
|
+
.string()
|
|
1007
|
+
.describe('The request ID from the corresponding prompt request'),
|
|
1008
|
+
selected: z.string().describe('The key of the selected option'),
|
|
1009
|
+
}),
|
|
1010
|
+
)
|
|
1011
|
+
|
|
1012
|
+
// ============================================================================
|
|
1013
|
+
// Skill/Command Types
|
|
1014
|
+
// ============================================================================
|
|
1015
|
+
|
|
1016
|
+
export const SlashCommandSchema = lazySchema(() =>
|
|
1017
|
+
z
|
|
1018
|
+
.object({
|
|
1019
|
+
name: z.string().describe('Skill name (without the leading slash)'),
|
|
1020
|
+
description: z.string().describe('Description of what the skill does'),
|
|
1021
|
+
argumentHint: z
|
|
1022
|
+
.string()
|
|
1023
|
+
.describe('Hint for skill arguments (e.g., "<file>")'),
|
|
1024
|
+
})
|
|
1025
|
+
.describe(
|
|
1026
|
+
'Information about an available skill (invoked via /command syntax).',
|
|
1027
|
+
),
|
|
1028
|
+
)
|
|
1029
|
+
|
|
1030
|
+
export const AgentInfoSchema = lazySchema(() =>
|
|
1031
|
+
z
|
|
1032
|
+
.object({
|
|
1033
|
+
name: z.string().describe('Agent type identifier (e.g., "Explore")'),
|
|
1034
|
+
description: z.string().describe('Description of when to use this agent'),
|
|
1035
|
+
model: z
|
|
1036
|
+
.string()
|
|
1037
|
+
.optional()
|
|
1038
|
+
.describe(
|
|
1039
|
+
"Model alias this agent uses. If omitted, inherits the parent's model",
|
|
1040
|
+
),
|
|
1041
|
+
})
|
|
1042
|
+
.describe(
|
|
1043
|
+
'Information about an available subagent that can be invoked via the Task tool.',
|
|
1044
|
+
),
|
|
1045
|
+
)
|
|
1046
|
+
|
|
1047
|
+
export const ModelInfoSchema = lazySchema(() =>
|
|
1048
|
+
z
|
|
1049
|
+
.object({
|
|
1050
|
+
value: z.string().describe('Model identifier to use in API calls'),
|
|
1051
|
+
displayName: z.string().describe('Human-readable display name'),
|
|
1052
|
+
description: z
|
|
1053
|
+
.string()
|
|
1054
|
+
.describe("Description of the model's capabilities"),
|
|
1055
|
+
supportsEffort: z
|
|
1056
|
+
.boolean()
|
|
1057
|
+
.optional()
|
|
1058
|
+
.describe('Whether this model supports effort levels'),
|
|
1059
|
+
supportedEffortLevels: z
|
|
1060
|
+
.array(z.enum(['low', 'medium', 'high', 'max']))
|
|
1061
|
+
.optional()
|
|
1062
|
+
.describe('Available effort levels for this model'),
|
|
1063
|
+
supportsAdaptiveThinking: z
|
|
1064
|
+
.boolean()
|
|
1065
|
+
.optional()
|
|
1066
|
+
.describe(
|
|
1067
|
+
'Whether this model supports adaptive thinking (Claude decides when and how much to think)',
|
|
1068
|
+
),
|
|
1069
|
+
supportsFastMode: z
|
|
1070
|
+
.boolean()
|
|
1071
|
+
.optional()
|
|
1072
|
+
.describe('Whether this model supports fast mode'),
|
|
1073
|
+
supportsAutoMode: z
|
|
1074
|
+
.boolean()
|
|
1075
|
+
.optional()
|
|
1076
|
+
.describe('Whether this model supports auto mode'),
|
|
1077
|
+
})
|
|
1078
|
+
.describe('Information about an available model.'),
|
|
1079
|
+
)
|
|
1080
|
+
|
|
1081
|
+
export const AccountInfoSchema = lazySchema(() =>
|
|
1082
|
+
z
|
|
1083
|
+
.object({
|
|
1084
|
+
email: z.string().optional(),
|
|
1085
|
+
organization: z.string().optional(),
|
|
1086
|
+
subscriptionType: z.string().optional(),
|
|
1087
|
+
tokenSource: z.string().optional(),
|
|
1088
|
+
apiKeySource: z.string().optional(),
|
|
1089
|
+
apiProvider: z
|
|
1090
|
+
.enum(['firstParty', 'bedrock', 'vertex', 'foundry'])
|
|
1091
|
+
.optional()
|
|
1092
|
+
.describe(
|
|
1093
|
+
'Active API backend. Anthropic OAuth login only applies when "firstParty"; for 3P providers the other fields are absent and auth is external (AWS creds, gcloud ADC, etc.).',
|
|
1094
|
+
),
|
|
1095
|
+
})
|
|
1096
|
+
.describe("Information about the logged in user's account."),
|
|
1097
|
+
)
|
|
1098
|
+
|
|
1099
|
+
// ============================================================================
|
|
1100
|
+
// Agent Definition Types
|
|
1101
|
+
// ============================================================================
|
|
1102
|
+
|
|
1103
|
+
export const AgentMcpServerSpecSchema = lazySchema(() =>
|
|
1104
|
+
z.union([
|
|
1105
|
+
z.string(),
|
|
1106
|
+
z.record(z.string(), McpServerConfigForProcessTransportSchema()),
|
|
1107
|
+
]),
|
|
1108
|
+
)
|
|
1109
|
+
|
|
1110
|
+
export const AgentDefinitionSchema = lazySchema(() =>
|
|
1111
|
+
z
|
|
1112
|
+
.object({
|
|
1113
|
+
description: z
|
|
1114
|
+
.string()
|
|
1115
|
+
.describe('Natural language description of when to use this agent'),
|
|
1116
|
+
tools: z
|
|
1117
|
+
.array(z.string())
|
|
1118
|
+
.optional()
|
|
1119
|
+
.describe(
|
|
1120
|
+
'Array of allowed tool names. If omitted, inherits all tools from parent',
|
|
1121
|
+
),
|
|
1122
|
+
disallowedTools: z
|
|
1123
|
+
.array(z.string())
|
|
1124
|
+
.optional()
|
|
1125
|
+
.describe('Array of tool names to explicitly disallow for this agent'),
|
|
1126
|
+
prompt: z.string().describe("The agent's system prompt"),
|
|
1127
|
+
model: z
|
|
1128
|
+
.string()
|
|
1129
|
+
.optional()
|
|
1130
|
+
.describe(
|
|
1131
|
+
"Model alias (e.g. 'sonnet', 'opus', 'haiku') or full model ID (e.g. 'claude-opus-4-5'). If omitted or 'inherit', uses the main model",
|
|
1132
|
+
),
|
|
1133
|
+
mcpServers: z.array(AgentMcpServerSpecSchema()).optional(),
|
|
1134
|
+
criticalSystemReminder_EXPERIMENTAL: z
|
|
1135
|
+
.string()
|
|
1136
|
+
.optional()
|
|
1137
|
+
.describe('Experimental: Critical reminder added to system prompt'),
|
|
1138
|
+
skills: z
|
|
1139
|
+
.array(z.string())
|
|
1140
|
+
.optional()
|
|
1141
|
+
.describe('Array of skill names to preload into the agent context'),
|
|
1142
|
+
initialPrompt: z
|
|
1143
|
+
.string()
|
|
1144
|
+
.optional()
|
|
1145
|
+
.describe(
|
|
1146
|
+
'Auto-submitted as the first user turn when this agent is the main thread agent. Slash commands are processed. Prepended to any user-provided prompt.',
|
|
1147
|
+
),
|
|
1148
|
+
maxTurns: z
|
|
1149
|
+
.number()
|
|
1150
|
+
.int()
|
|
1151
|
+
.positive()
|
|
1152
|
+
.optional()
|
|
1153
|
+
.describe(
|
|
1154
|
+
'Maximum number of agentic turns (API round-trips) before stopping',
|
|
1155
|
+
),
|
|
1156
|
+
background: z
|
|
1157
|
+
.boolean()
|
|
1158
|
+
.optional()
|
|
1159
|
+
.describe(
|
|
1160
|
+
'Run this agent as a background task (non-blocking, fire-and-forget) when invoked',
|
|
1161
|
+
),
|
|
1162
|
+
memory: z
|
|
1163
|
+
.enum(['user', 'project', 'local'])
|
|
1164
|
+
.optional()
|
|
1165
|
+
.describe(
|
|
1166
|
+
"Scope for auto-loading agent memory files. 'user' - ~/.claude/agent-memory/<agentType>/, 'project' - .claude/agent-memory/<agentType>/, 'local' - .claude/agent-memory-local/<agentType>/",
|
|
1167
|
+
),
|
|
1168
|
+
effort: z
|
|
1169
|
+
.union([z.enum(['low', 'medium', 'high', 'max']), z.number().int()])
|
|
1170
|
+
.optional()
|
|
1171
|
+
.describe(
|
|
1172
|
+
'Reasoning effort level for this agent. Either a named level or an integer',
|
|
1173
|
+
),
|
|
1174
|
+
permissionMode: PermissionModeSchema()
|
|
1175
|
+
.optional()
|
|
1176
|
+
.describe(
|
|
1177
|
+
'Permission mode controlling how tool executions are handled',
|
|
1178
|
+
),
|
|
1179
|
+
})
|
|
1180
|
+
.describe(
|
|
1181
|
+
'Definition for a custom subagent that can be invoked via the Agent tool.',
|
|
1182
|
+
),
|
|
1183
|
+
)
|
|
1184
|
+
|
|
1185
|
+
// ============================================================================
|
|
1186
|
+
// Settings Types
|
|
1187
|
+
// ============================================================================
|
|
1188
|
+
|
|
1189
|
+
export const SettingSourceSchema = lazySchema(() =>
|
|
1190
|
+
z
|
|
1191
|
+
.enum(['user', 'project', 'local'])
|
|
1192
|
+
.describe(
|
|
1193
|
+
'Source for loading filesystem-based settings. ' +
|
|
1194
|
+
"'user' - Global user settings (~/.claude/settings.json). " +
|
|
1195
|
+
"'project' - Project settings (.claude/settings.json). " +
|
|
1196
|
+
"'local' - Local settings (.claude/settings.local.json).",
|
|
1197
|
+
),
|
|
1198
|
+
)
|
|
1199
|
+
|
|
1200
|
+
export const SdkPluginConfigSchema = lazySchema(() =>
|
|
1201
|
+
z
|
|
1202
|
+
.object({
|
|
1203
|
+
type: z
|
|
1204
|
+
.literal('local')
|
|
1205
|
+
.describe("Plugin type. Currently only 'local' is supported"),
|
|
1206
|
+
path: z
|
|
1207
|
+
.string()
|
|
1208
|
+
.describe('Absolute or relative path to the plugin directory'),
|
|
1209
|
+
})
|
|
1210
|
+
.describe('Configuration for loading a plugin.'),
|
|
1211
|
+
)
|
|
1212
|
+
|
|
1213
|
+
// ============================================================================
|
|
1214
|
+
// Rewind Types
|
|
1215
|
+
// ============================================================================
|
|
1216
|
+
|
|
1217
|
+
export const RewindFilesResultSchema = lazySchema(() =>
|
|
1218
|
+
z
|
|
1219
|
+
.object({
|
|
1220
|
+
canRewind: z.boolean(),
|
|
1221
|
+
error: z.string().optional(),
|
|
1222
|
+
filesChanged: z.array(z.string()).optional(),
|
|
1223
|
+
insertions: z.number().optional(),
|
|
1224
|
+
deletions: z.number().optional(),
|
|
1225
|
+
})
|
|
1226
|
+
.describe('Result of a rewindFiles operation.'),
|
|
1227
|
+
)
|
|
1228
|
+
|
|
1229
|
+
// ============================================================================
|
|
1230
|
+
// External Type Placeholders
|
|
1231
|
+
// ============================================================================
|
|
1232
|
+
//
|
|
1233
|
+
// These schemas use z.unknown() as placeholders for external types.
|
|
1234
|
+
// The generation script uses TypeOverrideMap to output the correct TS type references.
|
|
1235
|
+
// This allows us to define SDK message types in Zod while maintaining proper typing.
|
|
1236
|
+
|
|
1237
|
+
/** Placeholder for APIUserMessage from @anthropic-ai/sdk */
|
|
1238
|
+
export const APIUserMessagePlaceholder = lazySchema(() => z.unknown())
|
|
1239
|
+
|
|
1240
|
+
/** Placeholder for APIAssistantMessage from @anthropic-ai/sdk */
|
|
1241
|
+
export const APIAssistantMessagePlaceholder = lazySchema(() => z.unknown())
|
|
1242
|
+
|
|
1243
|
+
/** Placeholder for RawMessageStreamEvent from @anthropic-ai/sdk */
|
|
1244
|
+
export const RawMessageStreamEventPlaceholder = lazySchema(() => z.unknown())
|
|
1245
|
+
|
|
1246
|
+
/** Placeholder for UUID from crypto */
|
|
1247
|
+
export const UUIDPlaceholder = lazySchema(() => z.string())
|
|
1248
|
+
|
|
1249
|
+
/** Placeholder for NonNullableUsage (mapped type over Usage) */
|
|
1250
|
+
export const NonNullableUsagePlaceholder = lazySchema(() => z.unknown())
|
|
1251
|
+
|
|
1252
|
+
// ============================================================================
|
|
1253
|
+
// SDK Message Types
|
|
1254
|
+
// ============================================================================
|
|
1255
|
+
|
|
1256
|
+
export const SDKAssistantMessageErrorSchema = lazySchema(() =>
|
|
1257
|
+
z.enum([
|
|
1258
|
+
'authentication_failed',
|
|
1259
|
+
'billing_error',
|
|
1260
|
+
'rate_limit',
|
|
1261
|
+
'invalid_request',
|
|
1262
|
+
'server_error',
|
|
1263
|
+
'unknown',
|
|
1264
|
+
'max_output_tokens',
|
|
1265
|
+
]),
|
|
1266
|
+
)
|
|
1267
|
+
|
|
1268
|
+
export const SDKStatusSchema = lazySchema(() =>
|
|
1269
|
+
z.union([z.literal('compacting'), z.null()]),
|
|
1270
|
+
)
|
|
1271
|
+
|
|
1272
|
+
// SDKUserMessage content without uuid/session_id
|
|
1273
|
+
const SDKUserMessageContentSchema = lazySchema(() =>
|
|
1274
|
+
z.object({
|
|
1275
|
+
type: z.literal('user'),
|
|
1276
|
+
message: APIUserMessagePlaceholder(),
|
|
1277
|
+
parent_tool_use_id: z.string().nullable(),
|
|
1278
|
+
isSynthetic: z.boolean().optional(),
|
|
1279
|
+
tool_use_result: z.unknown().optional(),
|
|
1280
|
+
priority: z.enum(['now', 'next', 'later']).optional(),
|
|
1281
|
+
timestamp: z
|
|
1282
|
+
.string()
|
|
1283
|
+
.optional()
|
|
1284
|
+
.describe(
|
|
1285
|
+
'ISO timestamp when the message was created on the originating process. Older emitters omit it; consumers should fall back to receive time.',
|
|
1286
|
+
),
|
|
1287
|
+
}),
|
|
1288
|
+
)
|
|
1289
|
+
|
|
1290
|
+
export const SDKUserMessageSchema = lazySchema(() =>
|
|
1291
|
+
SDKUserMessageContentSchema().extend({
|
|
1292
|
+
uuid: UUIDPlaceholder().optional(),
|
|
1293
|
+
session_id: z.string().optional(),
|
|
1294
|
+
}),
|
|
1295
|
+
)
|
|
1296
|
+
|
|
1297
|
+
export const SDKUserMessageReplaySchema = lazySchema(() =>
|
|
1298
|
+
SDKUserMessageContentSchema().extend({
|
|
1299
|
+
uuid: UUIDPlaceholder(),
|
|
1300
|
+
session_id: z.string(),
|
|
1301
|
+
isReplay: z.literal(true),
|
|
1302
|
+
}),
|
|
1303
|
+
)
|
|
1304
|
+
|
|
1305
|
+
export const SDKRateLimitInfoSchema = lazySchema(() =>
|
|
1306
|
+
z
|
|
1307
|
+
.object({
|
|
1308
|
+
status: z.enum(['allowed', 'allowed_warning', 'rejected']),
|
|
1309
|
+
resetsAt: z.number().optional(),
|
|
1310
|
+
rateLimitType: z
|
|
1311
|
+
.enum([
|
|
1312
|
+
'five_hour',
|
|
1313
|
+
'seven_day',
|
|
1314
|
+
'seven_day_opus',
|
|
1315
|
+
'seven_day_sonnet',
|
|
1316
|
+
'overage',
|
|
1317
|
+
])
|
|
1318
|
+
.optional(),
|
|
1319
|
+
utilization: z.number().optional(),
|
|
1320
|
+
overageStatus: z
|
|
1321
|
+
.enum(['allowed', 'allowed_warning', 'rejected'])
|
|
1322
|
+
.optional(),
|
|
1323
|
+
overageResetsAt: z.number().optional(),
|
|
1324
|
+
overageDisabledReason: z
|
|
1325
|
+
.enum([
|
|
1326
|
+
'overage_not_provisioned',
|
|
1327
|
+
'org_level_disabled',
|
|
1328
|
+
'org_level_disabled_until',
|
|
1329
|
+
'out_of_credits',
|
|
1330
|
+
'seat_tier_level_disabled',
|
|
1331
|
+
'member_level_disabled',
|
|
1332
|
+
'seat_tier_zero_credit_limit',
|
|
1333
|
+
'group_zero_credit_limit',
|
|
1334
|
+
'member_zero_credit_limit',
|
|
1335
|
+
'org_service_level_disabled',
|
|
1336
|
+
'org_service_zero_credit_limit',
|
|
1337
|
+
'no_limits_configured',
|
|
1338
|
+
'unknown',
|
|
1339
|
+
])
|
|
1340
|
+
.optional(),
|
|
1341
|
+
isUsingOverage: z.boolean().optional(),
|
|
1342
|
+
surpassedThreshold: z.number().optional(),
|
|
1343
|
+
})
|
|
1344
|
+
.describe('Rate limit information for claude.ai subscription users.'),
|
|
1345
|
+
)
|
|
1346
|
+
|
|
1347
|
+
export const SDKAssistantMessageSchema = lazySchema(() =>
|
|
1348
|
+
z.object({
|
|
1349
|
+
type: z.literal('assistant'),
|
|
1350
|
+
message: APIAssistantMessagePlaceholder(),
|
|
1351
|
+
parent_tool_use_id: z.string().nullable(),
|
|
1352
|
+
error: SDKAssistantMessageErrorSchema().optional(),
|
|
1353
|
+
uuid: UUIDPlaceholder(),
|
|
1354
|
+
session_id: z.string(),
|
|
1355
|
+
}),
|
|
1356
|
+
)
|
|
1357
|
+
|
|
1358
|
+
export const SDKRateLimitEventSchema = lazySchema(() =>
|
|
1359
|
+
z
|
|
1360
|
+
.object({
|
|
1361
|
+
type: z.literal('rate_limit_event'),
|
|
1362
|
+
rate_limit_info: SDKRateLimitInfoSchema(),
|
|
1363
|
+
uuid: UUIDPlaceholder(),
|
|
1364
|
+
session_id: z.string(),
|
|
1365
|
+
})
|
|
1366
|
+
.describe('Rate limit event emitted when rate limit info changes.'),
|
|
1367
|
+
)
|
|
1368
|
+
|
|
1369
|
+
export const SDKStreamlinedTextMessageSchema = lazySchema(() =>
|
|
1370
|
+
z
|
|
1371
|
+
.object({
|
|
1372
|
+
type: z.literal('streamlined_text'),
|
|
1373
|
+
text: z
|
|
1374
|
+
.string()
|
|
1375
|
+
.describe('Text content preserved from the assistant message'),
|
|
1376
|
+
session_id: z.string(),
|
|
1377
|
+
uuid: UUIDPlaceholder(),
|
|
1378
|
+
})
|
|
1379
|
+
.describe(
|
|
1380
|
+
'@internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed.',
|
|
1381
|
+
),
|
|
1382
|
+
)
|
|
1383
|
+
|
|
1384
|
+
export const SDKStreamlinedToolUseSummaryMessageSchema = lazySchema(() =>
|
|
1385
|
+
z
|
|
1386
|
+
.object({
|
|
1387
|
+
type: z.literal('streamlined_tool_use_summary'),
|
|
1388
|
+
tool_summary: z
|
|
1389
|
+
.string()
|
|
1390
|
+
.describe('Summary of tool calls (e.g., "Read 2 files, wrote 1 file")'),
|
|
1391
|
+
session_id: z.string(),
|
|
1392
|
+
uuid: UUIDPlaceholder(),
|
|
1393
|
+
})
|
|
1394
|
+
.describe(
|
|
1395
|
+
'@internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string.',
|
|
1396
|
+
),
|
|
1397
|
+
)
|
|
1398
|
+
|
|
1399
|
+
export const SDKPermissionDenialSchema = lazySchema(() =>
|
|
1400
|
+
z.object({
|
|
1401
|
+
tool_name: z.string(),
|
|
1402
|
+
tool_use_id: z.string(),
|
|
1403
|
+
tool_input: z.record(z.string(), z.unknown()),
|
|
1404
|
+
}),
|
|
1405
|
+
)
|
|
1406
|
+
|
|
1407
|
+
export const SDKResultSuccessSchema = lazySchema(() =>
|
|
1408
|
+
z.object({
|
|
1409
|
+
type: z.literal('result'),
|
|
1410
|
+
subtype: z.literal('success'),
|
|
1411
|
+
duration_ms: z.number(),
|
|
1412
|
+
duration_api_ms: z.number(),
|
|
1413
|
+
is_error: z.boolean(),
|
|
1414
|
+
num_turns: z.number(),
|
|
1415
|
+
result: z.string(),
|
|
1416
|
+
stop_reason: z.string().nullable(),
|
|
1417
|
+
total_cost_usd: z.number(),
|
|
1418
|
+
usage: NonNullableUsagePlaceholder(),
|
|
1419
|
+
modelUsage: z.record(z.string(), ModelUsageSchema()),
|
|
1420
|
+
permission_denials: z.array(SDKPermissionDenialSchema()),
|
|
1421
|
+
structured_output: z.unknown().optional(),
|
|
1422
|
+
fast_mode_state: FastModeStateSchema().optional(),
|
|
1423
|
+
uuid: UUIDPlaceholder(),
|
|
1424
|
+
session_id: z.string(),
|
|
1425
|
+
}),
|
|
1426
|
+
)
|
|
1427
|
+
|
|
1428
|
+
export const SDKResultErrorSchema = lazySchema(() =>
|
|
1429
|
+
z.object({
|
|
1430
|
+
type: z.literal('result'),
|
|
1431
|
+
subtype: z.enum([
|
|
1432
|
+
'error_during_execution',
|
|
1433
|
+
'error_max_turns',
|
|
1434
|
+
'error_max_budget_usd',
|
|
1435
|
+
'error_max_structured_output_retries',
|
|
1436
|
+
]),
|
|
1437
|
+
duration_ms: z.number(),
|
|
1438
|
+
duration_api_ms: z.number(),
|
|
1439
|
+
is_error: z.boolean(),
|
|
1440
|
+
num_turns: z.number(),
|
|
1441
|
+
stop_reason: z.string().nullable(),
|
|
1442
|
+
total_cost_usd: z.number(),
|
|
1443
|
+
usage: NonNullableUsagePlaceholder(),
|
|
1444
|
+
modelUsage: z.record(z.string(), ModelUsageSchema()),
|
|
1445
|
+
permission_denials: z.array(SDKPermissionDenialSchema()),
|
|
1446
|
+
errors: z.array(z.string()),
|
|
1447
|
+
fast_mode_state: FastModeStateSchema().optional(),
|
|
1448
|
+
uuid: UUIDPlaceholder(),
|
|
1449
|
+
session_id: z.string(),
|
|
1450
|
+
}),
|
|
1451
|
+
)
|
|
1452
|
+
|
|
1453
|
+
export const SDKResultMessageSchema = lazySchema(() =>
|
|
1454
|
+
z.union([SDKResultSuccessSchema(), SDKResultErrorSchema()]),
|
|
1455
|
+
)
|
|
1456
|
+
|
|
1457
|
+
export const SDKSystemMessageSchema = lazySchema(() =>
|
|
1458
|
+
z.object({
|
|
1459
|
+
type: z.literal('system'),
|
|
1460
|
+
subtype: z.literal('init'),
|
|
1461
|
+
agents: z.array(z.string()).optional(),
|
|
1462
|
+
apiKeySource: ApiKeySourceSchema(),
|
|
1463
|
+
betas: z.array(z.string()).optional(),
|
|
1464
|
+
claude_code_version: z.string(),
|
|
1465
|
+
cwd: z.string(),
|
|
1466
|
+
tools: z.array(z.string()),
|
|
1467
|
+
mcp_servers: z.array(
|
|
1468
|
+
z.object({
|
|
1469
|
+
name: z.string(),
|
|
1470
|
+
status: z.string(),
|
|
1471
|
+
}),
|
|
1472
|
+
),
|
|
1473
|
+
model: z.string(),
|
|
1474
|
+
permissionMode: PermissionModeSchema(),
|
|
1475
|
+
slash_commands: z.array(z.string()),
|
|
1476
|
+
output_style: z.string(),
|
|
1477
|
+
skills: z.array(z.string()),
|
|
1478
|
+
plugins: z.array(
|
|
1479
|
+
z.object({
|
|
1480
|
+
name: z.string(),
|
|
1481
|
+
path: z.string(),
|
|
1482
|
+
source: z
|
|
1483
|
+
.string()
|
|
1484
|
+
.optional()
|
|
1485
|
+
.describe(
|
|
1486
|
+
'@internal Plugin source identifier in "name\\@marketplace" format. Sentinels: "name\\@inline" for --plugin-dir, "name\\@builtin" for built-in plugins.',
|
|
1487
|
+
),
|
|
1488
|
+
}),
|
|
1489
|
+
),
|
|
1490
|
+
fast_mode_state: FastModeStateSchema().optional(),
|
|
1491
|
+
uuid: UUIDPlaceholder(),
|
|
1492
|
+
session_id: z.string(),
|
|
1493
|
+
}),
|
|
1494
|
+
)
|
|
1495
|
+
|
|
1496
|
+
export const SDKPartialAssistantMessageSchema = lazySchema(() =>
|
|
1497
|
+
z.object({
|
|
1498
|
+
type: z.literal('stream_event'),
|
|
1499
|
+
event: RawMessageStreamEventPlaceholder(),
|
|
1500
|
+
parent_tool_use_id: z.string().nullable(),
|
|
1501
|
+
uuid: UUIDPlaceholder(),
|
|
1502
|
+
session_id: z.string(),
|
|
1503
|
+
}),
|
|
1504
|
+
)
|
|
1505
|
+
|
|
1506
|
+
export const SDKCompactBoundaryMessageSchema = lazySchema(() =>
|
|
1507
|
+
z.object({
|
|
1508
|
+
type: z.literal('system'),
|
|
1509
|
+
subtype: z.literal('compact_boundary'),
|
|
1510
|
+
compact_metadata: z.object({
|
|
1511
|
+
trigger: z.enum(['manual', 'auto']),
|
|
1512
|
+
pre_tokens: z.number(),
|
|
1513
|
+
preserved_segment: z
|
|
1514
|
+
.object({
|
|
1515
|
+
head_uuid: UUIDPlaceholder(),
|
|
1516
|
+
anchor_uuid: UUIDPlaceholder(),
|
|
1517
|
+
tail_uuid: UUIDPlaceholder(),
|
|
1518
|
+
})
|
|
1519
|
+
.optional()
|
|
1520
|
+
.describe(
|
|
1521
|
+
'Relink info for messagesToKeep. Loaders splice the preserved ' +
|
|
1522
|
+
'segment at anchor_uuid (summary for suffix-preserving, ' +
|
|
1523
|
+
'boundary for prefix-preserving partial compact) so resume ' +
|
|
1524
|
+
'includes preserved content. Unset when compaction summarizes ' +
|
|
1525
|
+
'everything (no messagesToKeep).',
|
|
1526
|
+
),
|
|
1527
|
+
}),
|
|
1528
|
+
uuid: UUIDPlaceholder(),
|
|
1529
|
+
session_id: z.string(),
|
|
1530
|
+
}),
|
|
1531
|
+
)
|
|
1532
|
+
|
|
1533
|
+
export const SDKStatusMessageSchema = lazySchema(() =>
|
|
1534
|
+
z.object({
|
|
1535
|
+
type: z.literal('system'),
|
|
1536
|
+
subtype: z.literal('status'),
|
|
1537
|
+
status: SDKStatusSchema(),
|
|
1538
|
+
permissionMode: PermissionModeSchema().optional(),
|
|
1539
|
+
uuid: UUIDPlaceholder(),
|
|
1540
|
+
session_id: z.string(),
|
|
1541
|
+
}),
|
|
1542
|
+
)
|
|
1543
|
+
|
|
1544
|
+
export const SDKPostTurnSummaryMessageSchema = lazySchema(() =>
|
|
1545
|
+
z
|
|
1546
|
+
.object({
|
|
1547
|
+
type: z.literal('system'),
|
|
1548
|
+
subtype: z.literal('post_turn_summary'),
|
|
1549
|
+
summarizes_uuid: z.string(),
|
|
1550
|
+
status_category: z.enum([
|
|
1551
|
+
'blocked',
|
|
1552
|
+
'waiting',
|
|
1553
|
+
'completed',
|
|
1554
|
+
'review_ready',
|
|
1555
|
+
'failed',
|
|
1556
|
+
]),
|
|
1557
|
+
status_detail: z.string(),
|
|
1558
|
+
is_noteworthy: z.boolean(),
|
|
1559
|
+
title: z.string(),
|
|
1560
|
+
description: z.string(),
|
|
1561
|
+
recent_action: z.string(),
|
|
1562
|
+
needs_action: z.string(),
|
|
1563
|
+
artifact_urls: z.array(z.string()),
|
|
1564
|
+
uuid: UUIDPlaceholder(),
|
|
1565
|
+
session_id: z.string(),
|
|
1566
|
+
})
|
|
1567
|
+
.describe(
|
|
1568
|
+
'@internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes.',
|
|
1569
|
+
),
|
|
1570
|
+
)
|
|
1571
|
+
|
|
1572
|
+
export const SDKAPIRetryMessageSchema = lazySchema(() =>
|
|
1573
|
+
z
|
|
1574
|
+
.object({
|
|
1575
|
+
type: z.literal('system'),
|
|
1576
|
+
subtype: z.literal('api_retry'),
|
|
1577
|
+
attempt: z.number(),
|
|
1578
|
+
max_retries: z.number(),
|
|
1579
|
+
retry_delay_ms: z.number(),
|
|
1580
|
+
error_status: z.number().nullable(),
|
|
1581
|
+
error: SDKAssistantMessageErrorSchema(),
|
|
1582
|
+
uuid: UUIDPlaceholder(),
|
|
1583
|
+
session_id: z.string(),
|
|
1584
|
+
})
|
|
1585
|
+
.describe(
|
|
1586
|
+
'Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response.',
|
|
1587
|
+
),
|
|
1588
|
+
)
|
|
1589
|
+
|
|
1590
|
+
export const SDKLocalCommandOutputMessageSchema = lazySchema(() =>
|
|
1591
|
+
z
|
|
1592
|
+
.object({
|
|
1593
|
+
type: z.literal('system'),
|
|
1594
|
+
subtype: z.literal('local_command_output'),
|
|
1595
|
+
content: z.string(),
|
|
1596
|
+
uuid: UUIDPlaceholder(),
|
|
1597
|
+
session_id: z.string(),
|
|
1598
|
+
})
|
|
1599
|
+
.describe(
|
|
1600
|
+
'Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript.',
|
|
1601
|
+
),
|
|
1602
|
+
)
|
|
1603
|
+
|
|
1604
|
+
export const SDKHookStartedMessageSchema = lazySchema(() =>
|
|
1605
|
+
z.object({
|
|
1606
|
+
type: z.literal('system'),
|
|
1607
|
+
subtype: z.literal('hook_started'),
|
|
1608
|
+
hook_id: z.string(),
|
|
1609
|
+
hook_name: z.string(),
|
|
1610
|
+
hook_event: z.string(),
|
|
1611
|
+
uuid: UUIDPlaceholder(),
|
|
1612
|
+
session_id: z.string(),
|
|
1613
|
+
}),
|
|
1614
|
+
)
|
|
1615
|
+
|
|
1616
|
+
export const SDKHookProgressMessageSchema = lazySchema(() =>
|
|
1617
|
+
z.object({
|
|
1618
|
+
type: z.literal('system'),
|
|
1619
|
+
subtype: z.literal('hook_progress'),
|
|
1620
|
+
hook_id: z.string(),
|
|
1621
|
+
hook_name: z.string(),
|
|
1622
|
+
hook_event: z.string(),
|
|
1623
|
+
stdout: z.string(),
|
|
1624
|
+
stderr: z.string(),
|
|
1625
|
+
output: z.string(),
|
|
1626
|
+
uuid: UUIDPlaceholder(),
|
|
1627
|
+
session_id: z.string(),
|
|
1628
|
+
}),
|
|
1629
|
+
)
|
|
1630
|
+
|
|
1631
|
+
export const SDKHookResponseMessageSchema = lazySchema(() =>
|
|
1632
|
+
z.object({
|
|
1633
|
+
type: z.literal('system'),
|
|
1634
|
+
subtype: z.literal('hook_response'),
|
|
1635
|
+
hook_id: z.string(),
|
|
1636
|
+
hook_name: z.string(),
|
|
1637
|
+
hook_event: z.string(),
|
|
1638
|
+
output: z.string(),
|
|
1639
|
+
stdout: z.string(),
|
|
1640
|
+
stderr: z.string(),
|
|
1641
|
+
exit_code: z.number().optional(),
|
|
1642
|
+
outcome: z.enum(['success', 'error', 'cancelled']),
|
|
1643
|
+
uuid: UUIDPlaceholder(),
|
|
1644
|
+
session_id: z.string(),
|
|
1645
|
+
}),
|
|
1646
|
+
)
|
|
1647
|
+
|
|
1648
|
+
export const SDKToolProgressMessageSchema = lazySchema(() =>
|
|
1649
|
+
z.object({
|
|
1650
|
+
type: z.literal('tool_progress'),
|
|
1651
|
+
tool_use_id: z.string(),
|
|
1652
|
+
tool_name: z.string(),
|
|
1653
|
+
parent_tool_use_id: z.string().nullable(),
|
|
1654
|
+
elapsed_time_seconds: z.number(),
|
|
1655
|
+
task_id: z.string().optional(),
|
|
1656
|
+
uuid: UUIDPlaceholder(),
|
|
1657
|
+
session_id: z.string(),
|
|
1658
|
+
}),
|
|
1659
|
+
)
|
|
1660
|
+
|
|
1661
|
+
export const SDKAuthStatusMessageSchema = lazySchema(() =>
|
|
1662
|
+
z.object({
|
|
1663
|
+
type: z.literal('auth_status'),
|
|
1664
|
+
isAuthenticating: z.boolean(),
|
|
1665
|
+
output: z.array(z.string()),
|
|
1666
|
+
error: z.string().optional(),
|
|
1667
|
+
uuid: UUIDPlaceholder(),
|
|
1668
|
+
session_id: z.string(),
|
|
1669
|
+
}),
|
|
1670
|
+
)
|
|
1671
|
+
|
|
1672
|
+
export const SDKFilesPersistedEventSchema = lazySchema(() =>
|
|
1673
|
+
z.object({
|
|
1674
|
+
type: z.literal('system'),
|
|
1675
|
+
subtype: z.literal('files_persisted'),
|
|
1676
|
+
files: z.array(
|
|
1677
|
+
z.object({
|
|
1678
|
+
filename: z.string(),
|
|
1679
|
+
file_id: z.string(),
|
|
1680
|
+
}),
|
|
1681
|
+
),
|
|
1682
|
+
failed: z.array(
|
|
1683
|
+
z.object({
|
|
1684
|
+
filename: z.string(),
|
|
1685
|
+
error: z.string(),
|
|
1686
|
+
}),
|
|
1687
|
+
),
|
|
1688
|
+
processed_at: z.string(),
|
|
1689
|
+
uuid: UUIDPlaceholder(),
|
|
1690
|
+
session_id: z.string(),
|
|
1691
|
+
}),
|
|
1692
|
+
)
|
|
1693
|
+
|
|
1694
|
+
export const SDKTaskNotificationMessageSchema = lazySchema(() =>
|
|
1695
|
+
z.object({
|
|
1696
|
+
type: z.literal('system'),
|
|
1697
|
+
subtype: z.literal('task_notification'),
|
|
1698
|
+
task_id: z.string(),
|
|
1699
|
+
tool_use_id: z.string().optional(),
|
|
1700
|
+
status: z.enum(['completed', 'failed', 'stopped']),
|
|
1701
|
+
output_file: z.string(),
|
|
1702
|
+
summary: z.string(),
|
|
1703
|
+
usage: z
|
|
1704
|
+
.object({
|
|
1705
|
+
total_tokens: z.number(),
|
|
1706
|
+
tool_uses: z.number(),
|
|
1707
|
+
duration_ms: z.number(),
|
|
1708
|
+
})
|
|
1709
|
+
.optional(),
|
|
1710
|
+
uuid: UUIDPlaceholder(),
|
|
1711
|
+
session_id: z.string(),
|
|
1712
|
+
}),
|
|
1713
|
+
)
|
|
1714
|
+
|
|
1715
|
+
export const SDKTaskStartedMessageSchema = lazySchema(() =>
|
|
1716
|
+
z.object({
|
|
1717
|
+
type: z.literal('system'),
|
|
1718
|
+
subtype: z.literal('task_started'),
|
|
1719
|
+
task_id: z.string(),
|
|
1720
|
+
tool_use_id: z.string().optional(),
|
|
1721
|
+
description: z.string(),
|
|
1722
|
+
task_type: z.string().optional(),
|
|
1723
|
+
workflow_name: z
|
|
1724
|
+
.string()
|
|
1725
|
+
.optional()
|
|
1726
|
+
.describe(
|
|
1727
|
+
"meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.",
|
|
1728
|
+
),
|
|
1729
|
+
prompt: z.string().optional(),
|
|
1730
|
+
uuid: UUIDPlaceholder(),
|
|
1731
|
+
session_id: z.string(),
|
|
1732
|
+
}),
|
|
1733
|
+
)
|
|
1734
|
+
|
|
1735
|
+
export const SDKSessionStateChangedMessageSchema = lazySchema(() =>
|
|
1736
|
+
z
|
|
1737
|
+
.object({
|
|
1738
|
+
type: z.literal('system'),
|
|
1739
|
+
subtype: z.literal('session_state_changed'),
|
|
1740
|
+
state: z.enum(['idle', 'running', 'requires_action']),
|
|
1741
|
+
uuid: UUIDPlaceholder(),
|
|
1742
|
+
session_id: z.string(),
|
|
1743
|
+
})
|
|
1744
|
+
.describe(
|
|
1745
|
+
"Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.",
|
|
1746
|
+
),
|
|
1747
|
+
)
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
export const SDKTaskProgressMessageSchema = lazySchema(() =>
|
|
1751
|
+
z.object({
|
|
1752
|
+
type: z.literal('system'),
|
|
1753
|
+
subtype: z.literal('task_progress'),
|
|
1754
|
+
task_id: z.string(),
|
|
1755
|
+
tool_use_id: z.string().optional(),
|
|
1756
|
+
description: z.string(),
|
|
1757
|
+
usage: z.object({
|
|
1758
|
+
total_tokens: z.number(),
|
|
1759
|
+
tool_uses: z.number(),
|
|
1760
|
+
duration_ms: z.number(),
|
|
1761
|
+
}),
|
|
1762
|
+
last_tool_name: z.string().optional(),
|
|
1763
|
+
summary: z.string().optional(),
|
|
1764
|
+
uuid: UUIDPlaceholder(),
|
|
1765
|
+
session_id: z.string(),
|
|
1766
|
+
}),
|
|
1767
|
+
)
|
|
1768
|
+
|
|
1769
|
+
export const SDKToolUseSummaryMessageSchema = lazySchema(() =>
|
|
1770
|
+
z.object({
|
|
1771
|
+
type: z.literal('tool_use_summary'),
|
|
1772
|
+
summary: z.string(),
|
|
1773
|
+
preceding_tool_use_ids: z.array(z.string()),
|
|
1774
|
+
uuid: UUIDPlaceholder(),
|
|
1775
|
+
session_id: z.string(),
|
|
1776
|
+
}),
|
|
1777
|
+
)
|
|
1778
|
+
|
|
1779
|
+
export const SDKElicitationCompleteMessageSchema = lazySchema(() =>
|
|
1780
|
+
z
|
|
1781
|
+
.object({
|
|
1782
|
+
type: z.literal('system'),
|
|
1783
|
+
subtype: z.literal('elicitation_complete'),
|
|
1784
|
+
mcp_server_name: z.string(),
|
|
1785
|
+
elicitation_id: z.string(),
|
|
1786
|
+
uuid: UUIDPlaceholder(),
|
|
1787
|
+
session_id: z.string(),
|
|
1788
|
+
})
|
|
1789
|
+
.describe(
|
|
1790
|
+
'Emitted when an MCP server confirms that a URL-mode elicitation is complete.',
|
|
1791
|
+
),
|
|
1792
|
+
)
|
|
1793
|
+
|
|
1794
|
+
/** @internal */
|
|
1795
|
+
export const SDKPromptSuggestionMessageSchema = lazySchema(() =>
|
|
1796
|
+
z
|
|
1797
|
+
.object({
|
|
1798
|
+
type: z.literal('prompt_suggestion'),
|
|
1799
|
+
suggestion: z.string(),
|
|
1800
|
+
uuid: UUIDPlaceholder(),
|
|
1801
|
+
session_id: z.string(),
|
|
1802
|
+
})
|
|
1803
|
+
.describe(
|
|
1804
|
+
'Predicted next user prompt, emitted after each turn when promptSuggestions is enabled.',
|
|
1805
|
+
),
|
|
1806
|
+
)
|
|
1807
|
+
|
|
1808
|
+
// ============================================================================
|
|
1809
|
+
// Session Listing Types
|
|
1810
|
+
// ============================================================================
|
|
1811
|
+
|
|
1812
|
+
export const SDKSessionInfoSchema = lazySchema(() =>
|
|
1813
|
+
z
|
|
1814
|
+
.object({
|
|
1815
|
+
sessionId: z.string().describe('Unique session identifier (UUID).'),
|
|
1816
|
+
summary: z
|
|
1817
|
+
.string()
|
|
1818
|
+
.describe(
|
|
1819
|
+
'Display title for the session: custom title, auto-generated summary, or first prompt.',
|
|
1820
|
+
),
|
|
1821
|
+
lastModified: z
|
|
1822
|
+
.number()
|
|
1823
|
+
.describe('Last modified time in milliseconds since epoch.'),
|
|
1824
|
+
fileSize: z
|
|
1825
|
+
.number()
|
|
1826
|
+
.optional()
|
|
1827
|
+
.describe(
|
|
1828
|
+
'File size in bytes. Only populated for local JSONL storage.',
|
|
1829
|
+
),
|
|
1830
|
+
customTitle: z
|
|
1831
|
+
.string()
|
|
1832
|
+
.optional()
|
|
1833
|
+
.describe('User-set session title via /rename.'),
|
|
1834
|
+
firstPrompt: z
|
|
1835
|
+
.string()
|
|
1836
|
+
.optional()
|
|
1837
|
+
.describe('First meaningful user prompt in the session.'),
|
|
1838
|
+
gitBranch: z
|
|
1839
|
+
.string()
|
|
1840
|
+
.optional()
|
|
1841
|
+
.describe('Git branch at the end of the session.'),
|
|
1842
|
+
cwd: z.string().optional().describe('Working directory for the session.'),
|
|
1843
|
+
tag: z.string().optional().describe('User-set session tag.'),
|
|
1844
|
+
createdAt: z
|
|
1845
|
+
.number()
|
|
1846
|
+
.optional()
|
|
1847
|
+
.describe(
|
|
1848
|
+
"Creation time in milliseconds since epoch, extracted from the first entry's timestamp.",
|
|
1849
|
+
),
|
|
1850
|
+
})
|
|
1851
|
+
.describe('Session metadata returned by listSessions and getSessionInfo.'),
|
|
1852
|
+
)
|
|
1853
|
+
|
|
1854
|
+
export const SDKMessageSchema = lazySchema(() =>
|
|
1855
|
+
z.union([
|
|
1856
|
+
SDKAssistantMessageSchema(),
|
|
1857
|
+
SDKUserMessageSchema(),
|
|
1858
|
+
SDKUserMessageReplaySchema(),
|
|
1859
|
+
SDKResultMessageSchema(),
|
|
1860
|
+
SDKSystemMessageSchema(),
|
|
1861
|
+
SDKPartialAssistantMessageSchema(),
|
|
1862
|
+
SDKCompactBoundaryMessageSchema(),
|
|
1863
|
+
SDKStatusMessageSchema(),
|
|
1864
|
+
SDKAPIRetryMessageSchema(),
|
|
1865
|
+
SDKLocalCommandOutputMessageSchema(),
|
|
1866
|
+
SDKHookStartedMessageSchema(),
|
|
1867
|
+
SDKHookProgressMessageSchema(),
|
|
1868
|
+
SDKHookResponseMessageSchema(),
|
|
1869
|
+
SDKToolProgressMessageSchema(),
|
|
1870
|
+
SDKAuthStatusMessageSchema(),
|
|
1871
|
+
SDKTaskNotificationMessageSchema(),
|
|
1872
|
+
SDKTaskStartedMessageSchema(),
|
|
1873
|
+
SDKTaskProgressMessageSchema(),
|
|
1874
|
+
SDKSessionStateChangedMessageSchema(),
|
|
1875
|
+
SDKFilesPersistedEventSchema(),
|
|
1876
|
+
SDKToolUseSummaryMessageSchema(),
|
|
1877
|
+
SDKRateLimitEventSchema(),
|
|
1878
|
+
SDKElicitationCompleteMessageSchema(),
|
|
1879
|
+
SDKPromptSuggestionMessageSchema(),
|
|
1880
|
+
]),
|
|
1881
|
+
)
|
|
1882
|
+
|
|
1883
|
+
export const FastModeStateSchema = lazySchema(() =>
|
|
1884
|
+
z
|
|
1885
|
+
.enum(['off', 'cooldown', 'on'])
|
|
1886
|
+
.describe(
|
|
1887
|
+
'Fast mode state: off, in cooldown after rate limit, or actively enabled.',
|
|
1888
|
+
),
|
|
1889
|
+
)
|