mumucc 0.4.2 → 0.4.4
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/AGENTS.md +297 -0
- package/bin/mumucc +3 -8
- package/bun.lock +44 -141
- package/defaults/mcp-servers.json +0 -6
- package/mumucc-0.4.3.tgz +0 -0
- package/package.json +3 -3
- package/shims/bun-bundle.ts +0 -3
- package/shims/globals.d.ts +15 -0
- package/shims/globals.ts +1 -1
- package/src/QueryEngine.ts +1 -0
- package/src/assistant/gate.ts +4 -1
- package/src/assistant/index.ts +29 -1
- package/src/assistant/sessionDiscovery.ts +10 -1
- package/src/bootstrap/state.ts +6 -1
- package/src/buddy/CompanionSprite.tsx +1 -0
- package/src/buddy/observer.ts +6 -0
- package/src/buddy/useBuddyNotification.tsx +1 -0
- package/src/cli/handlers/util.tsx +1 -0
- package/src/cli/print.ts +4 -1
- package/src/cli/structuredIO.ts +6 -1
- package/src/commands/add-dir/add-dir.tsx +1 -0
- package/src/commands/branch/branch.ts +1 -0
- package/src/commands/bridge/bridge.tsx +2 -1
- package/src/commands/btw/btw.tsx +1 -0
- package/src/commands/buddy/index.ts +2 -1
- package/src/commands/chrome/chrome.tsx +1 -0
- package/src/commands/clear/caches.ts +1 -0
- package/src/commands/compact/compact.ts +1 -0
- package/src/commands/context/context-noninteractive.ts +1 -0
- package/src/commands/context/context.tsx +1 -0
- package/src/commands/copy/copy.tsx +2 -1
- package/src/commands/effort/effort.tsx +1 -0
- package/src/commands/extra-usage/extra-usage.tsx +1 -0
- package/src/commands/fast/fast.tsx +1 -0
- package/src/commands/fork/index.ts +2 -1
- package/src/commands/ide/ide.tsx +2 -1
- package/src/commands/insights.ts +1 -0
- package/src/commands/install-github-app/ApiKeyStep.tsx +1 -0
- package/src/commands/install-github-app/CheckExistingSecretStep.tsx +1 -0
- package/src/commands/install-github-app/ChooseRepoStep.tsx +1 -0
- package/src/commands/install-github-app/CreatingStep.tsx +1 -0
- package/src/commands/install-github-app/ErrorStep.tsx +1 -0
- package/src/commands/install-github-app/ExistingWorkflowStep.tsx +1 -0
- package/src/commands/install-github-app/InstallAppStep.tsx +1 -0
- package/src/commands/install-github-app/OAuthFlowStep.tsx +1 -0
- package/src/commands/install-github-app/SuccessStep.tsx +1 -0
- package/src/commands/install-github-app/WarningsStep.tsx +1 -0
- package/src/commands/install-github-app/install-github-app.tsx +2 -1
- package/src/commands/install.tsx +1 -0
- package/src/commands/login/CodexLogin.tsx +39 -12
- package/src/commands/login/CustomProviderLogin.tsx +45 -9
- package/src/commands/login/ThirdPartyLogin.tsx +24 -6
- package/src/commands/login/login.tsx +37 -10
- package/src/commands/login/profileDefaults.ts +25 -0
- package/src/commands/mcp/mcp.tsx +1 -0
- package/src/commands/mobile/mobile.tsx +1 -0
- package/src/commands/model/model.tsx +14 -3
- package/src/commands/peers/index.ts +2 -1
- package/src/commands/permissions/permissions.tsx +1 -0
- package/src/commands/plan/plan.tsx +1 -0
- package/src/commands/plugin/DiscoverPlugins.tsx +1 -0
- package/src/commands/plugin/ManageMarketplaces.tsx +1 -0
- package/src/commands/plugin/ManagePlugins.tsx +1 -0
- package/src/commands/plugin/PluginOptionsDialog.tsx +1 -0
- package/src/commands/plugin/PluginSettings.tsx +2 -1
- package/src/commands/plugin/UnifiedInstalledCell.tsx +1 -0
- package/src/commands/plugin/ValidatePlugin.tsx +1 -0
- package/src/commands/plugin/pluginDetailsHelpers.tsx +1 -0
- package/src/commands/rate-limit-options/rate-limit-options.tsx +1 -0
- package/src/commands/remote-setup/remote-setup.tsx +1 -0
- package/src/commands/resume/resume.tsx +1 -0
- package/src/commands/review/UltrareviewOverageDialog.tsx +1 -0
- package/src/commands/review/ultrareviewCommand.tsx +1 -0
- package/src/commands/session/session.tsx +1 -0
- package/src/commands/tag/tag.tsx +1 -0
- package/src/commands/terminalSetup/terminalSetup.tsx +1 -0
- package/src/commands/theme/theme.tsx +1 -0
- package/src/commands/thinkback/thinkback.tsx +2 -1
- package/src/commands/ultraplan.tsx +11 -1
- package/src/commands/upgrade/upgrade.tsx +1 -0
- package/src/commands/workflows/index.ts +2 -1
- package/src/components/AgentProgressLine.tsx +1 -0
- package/src/components/App.tsx +1 -0
- package/src/components/ApproveApiKey.tsx +1 -0
- package/src/components/AutoModeOptInDialog.tsx +1 -0
- package/src/components/AutoUpdater.tsx +1 -0
- package/src/components/AutoUpdaterWrapper.tsx +1 -0
- package/src/components/AwsAuthStatusBox.tsx +1 -0
- package/src/components/BaseTextInput.tsx +1 -0
- package/src/components/BashModeProgress.tsx +1 -0
- package/src/components/BridgeDialog.tsx +2 -1
- package/src/components/BypassPermissionsModeDialog.tsx +1 -0
- package/src/components/ChannelDowngradeDialog.tsx +1 -0
- package/src/components/ClaudeInChromeOnboarding.tsx +1 -0
- package/src/components/ClaudeMdExternalIncludesDialog.tsx +1 -0
- package/src/components/ClickableImageRef.tsx +1 -0
- package/src/components/CompactSummary.tsx +1 -0
- package/src/components/ConfigurableShortcutHint.tsx +1 -0
- package/src/components/ConsoleOAuthFlow.tsx +1 -0
- package/src/components/ContextSuggestions.tsx +1 -0
- package/src/components/ContextVisualization.tsx +2 -1
- package/src/components/CoordinatorAgentStatus.tsx +3 -4
- package/src/components/CostThresholdDialog.tsx +1 -0
- package/src/components/CtrlOToExpand.tsx +1 -0
- package/src/components/CustomSelect/SelectMulti.tsx +1 -0
- package/src/components/CustomSelect/select-input-option.tsx +1 -0
- package/src/components/CustomSelect/select-option.tsx +1 -0
- package/src/components/CustomSelect/select.tsx +2 -1
- package/src/components/CustomSelect/use-multi-select-state.ts +1 -0
- package/src/components/DesktopHandoff.tsx +1 -0
- package/src/components/DesktopUpsell/DesktopUpsellStartup.tsx +1 -0
- package/src/components/DevBar.tsx +1 -0
- package/src/components/DevChannelsDialog.tsx +1 -0
- package/src/components/DiagnosticsDisplay.tsx +1 -0
- package/src/components/EffortCallout.tsx +1 -0
- package/src/components/ExitFlow.tsx +1 -0
- package/src/components/FallbackToolUseErrorMessage.tsx +1 -0
- package/src/components/FastIcon.tsx +1 -0
- package/src/components/Feedback.tsx +1 -0
- package/src/components/FeedbackSurvey/FeedbackSurvey.tsx +1 -0
- package/src/components/FeedbackSurvey/FeedbackSurveyView.tsx +1 -0
- package/src/components/FeedbackSurvey/TranscriptSharePrompt.tsx +1 -0
- package/src/components/FeedbackSurvey/useFrustrationDetection.ts +6 -1
- package/src/components/FeedbackSurvey/useMemorySurvey.tsx +1 -0
- package/src/components/FeedbackSurvey/usePostCompactSurvey.tsx +2 -1
- package/src/components/FileEditToolDiff.tsx +1 -0
- package/src/components/FileEditToolUpdatedMessage.tsx +1 -0
- package/src/components/FileEditToolUseRejectedMessage.tsx +1 -0
- package/src/components/FilePathLink.tsx +1 -0
- package/src/components/FullscreenLayout.tsx +1 -0
- package/src/components/GlobalSearchDialog.tsx +2 -1
- package/src/components/HelpV2/Commands.tsx +1 -0
- package/src/components/HelpV2/HelpV2.tsx +1 -0
- package/src/components/HighlightedCode/Fallback.tsx +1 -0
- package/src/components/HighlightedCode.tsx +1 -0
- package/src/components/HistorySearchDialog.tsx +1 -0
- package/src/components/IdeAutoConnectDialog.tsx +1 -0
- package/src/components/IdeOnboardingDialog.tsx +1 -0
- package/src/components/IdeStatusIndicator.tsx +1 -0
- package/src/components/IdleReturnDialog.tsx +1 -0
- package/src/components/InvalidConfigDialog.tsx +1 -0
- package/src/components/InvalidSettingsDialog.tsx +1 -0
- package/src/components/KeybindingWarnings.tsx +1 -0
- package/src/components/LanguagePicker.tsx +1 -0
- package/src/components/LogSelector.tsx +2 -1
- package/src/components/LogoV2/ChannelsNotice.tsx +6 -5
- package/src/components/LogoV2/Clawd.tsx +1 -0
- package/src/components/LogoV2/CondensedLogo.tsx +1 -0
- package/src/components/LogoV2/Feed.tsx +1 -0
- package/src/components/LogoV2/FeedColumn.tsx +1 -0
- package/src/components/LogoV2/LogoV2.tsx +2 -1
- package/src/components/LogoV2/OverageCreditUpsell.tsx +1 -0
- package/src/components/LogoV2/WelcomeV2.tsx +1 -0
- package/src/components/LogoV2/feedConfigs.tsx +1 -0
- package/src/components/MCPServerApprovalDialog.tsx +1 -0
- package/src/components/MCPServerDesktopImportDialog.tsx +1 -0
- package/src/components/MCPServerMultiselectDialog.tsx +1 -0
- package/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.tsx +1 -0
- package/src/components/Markdown.tsx +1 -0
- package/src/components/MemoryUsageIndicator.tsx +1 -0
- package/src/components/Message.tsx +2 -1
- package/src/components/MessageModel.tsx +1 -0
- package/src/components/MessageResponse.tsx +1 -0
- package/src/components/MessageRow.tsx +1 -0
- package/src/components/MessageSelector.tsx +2 -1
- package/src/components/MessageTimestamp.tsx +1 -0
- package/src/components/Messages.tsx +1 -0
- package/src/components/ModelPicker.tsx +4 -3
- package/src/components/NativeAutoUpdater.tsx +1 -0
- package/src/components/NotebookEditToolUseRejectedMessage.tsx +1 -0
- package/src/components/Onboarding.tsx +1 -0
- package/src/components/OutputStylePicker.tsx +1 -0
- package/src/components/PackageManagerAutoUpdater.tsx +1 -0
- package/src/components/PrBadge.tsx +1 -0
- package/src/components/PromptInput/HistorySearchInput.tsx +1 -0
- package/src/components/PromptInput/Notifications.tsx +1 -0
- package/src/components/PromptInput/PromptInput.tsx +10 -8
- package/src/components/PromptInput/PromptInputFooter.tsx +1 -0
- package/src/components/PromptInput/PromptInputFooterLeftSide.tsx +1 -0
- package/src/components/PromptInput/PromptInputFooterSuggestions.tsx +1 -0
- package/src/components/PromptInput/PromptInputHelpMenu.tsx +1 -0
- package/src/components/PromptInput/PromptInputModeIndicator.tsx +1 -0
- package/src/components/PromptInput/PromptInputStashNotice.tsx +1 -0
- package/src/components/PromptInput/SandboxPromptFooterHint.tsx +1 -0
- package/src/components/PromptInput/ShimmeredInput.tsx +1 -0
- package/src/components/PromptInput/VoiceIndicator.tsx +1 -0
- package/src/components/QuickOpenDialog.tsx +2 -1
- package/src/components/RemoteEnvironmentDialog.tsx +2 -1
- package/src/components/ResumeTask.tsx +1 -0
- package/src/components/SandboxViolationExpandedView.tsx +1 -0
- package/src/components/SearchBox.tsx +1 -0
- package/src/components/SessionBackgroundHint.tsx +1 -0
- package/src/components/SessionPreview.tsx +1 -0
- package/src/components/Settings/Config.tsx +1 -0
- package/src/components/Settings/Settings.tsx +1 -0
- package/src/components/Settings/Status.tsx +2 -1
- package/src/components/Settings/Usage.tsx +1 -0
- package/src/components/ShowInIDEPrompt.tsx +1 -0
- package/src/components/SkillImprovementSurvey.tsx +1 -0
- package/src/components/Spinner/FlashingChar.tsx +1 -0
- package/src/components/Spinner/GlimmerMessage.tsx +1 -0
- package/src/components/Spinner/ShimmerChar.tsx +1 -0
- package/src/components/Spinner/SpinnerAnimationRow.tsx +1 -0
- package/src/components/Spinner/SpinnerGlyph.tsx +1 -0
- package/src/components/Spinner/TeammateSpinnerTree.tsx +1 -0
- package/src/components/Spinner/utils.ts +1 -0
- package/src/components/Spinner.tsx +2 -1
- package/src/components/Stats.tsx +2 -1
- package/src/components/StatusNotices.tsx +1 -0
- package/src/components/StructuredDiff/Fallback.tsx +1 -0
- package/src/components/StructuredDiff.tsx +2 -1
- package/src/components/StructuredDiffList.tsx +1 -0
- package/src/components/TaskListV2.tsx +1 -0
- package/src/components/TeammateViewHeader.tsx +1 -0
- package/src/components/TeleportError.tsx +1 -0
- package/src/components/TeleportProgress.tsx +1 -0
- package/src/components/TeleportRepoMismatchDialog.tsx +1 -0
- package/src/components/TeleportResumeWrapper.tsx +1 -0
- package/src/components/TextInput.tsx +1 -0
- package/src/components/ThemePicker.tsx +1 -0
- package/src/components/ThinkingToggle.tsx +1 -0
- package/src/components/TokenWarning.tsx +1 -0
- package/src/components/ToolUseLoader.tsx +1 -0
- package/src/components/TrustDialog/TrustDialog.tsx +1 -0
- package/src/components/ValidationErrorsList.tsx +1 -0
- package/src/components/VimTextInput.tsx +1 -0
- package/src/components/VirtualMessageList.tsx +1 -0
- package/src/components/WorkflowMultiselectDialog.tsx +1 -0
- package/src/components/agents/AgentDetail.tsx +1 -0
- package/src/components/agents/AgentEditor.tsx +1 -0
- package/src/components/agents/AgentNavigationFooter.tsx +1 -0
- package/src/components/agents/AgentsList.tsx +2 -1
- package/src/components/agents/AgentsMenu.tsx +2 -1
- package/src/components/agents/ColorPicker.tsx +1 -0
- package/src/components/agents/ModelSelector.tsx +1 -0
- package/src/components/agents/ToolSelector.tsx +2 -1
- package/src/components/agents/generateAgent.ts +1 -0
- package/src/components/agents/new-agent-creation/CreateAgentWizard.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx +1 -0
- package/src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx +1 -0
- package/src/components/design-system/Byline.tsx +1 -0
- package/src/components/design-system/Dialog.tsx +1 -0
- package/src/components/design-system/Divider.tsx +1 -0
- package/src/components/design-system/FuzzyPicker.tsx +1 -0
- package/src/components/design-system/KeyboardShortcutHint.tsx +1 -0
- package/src/components/design-system/ListItem.tsx +1 -0
- package/src/components/design-system/LoadingState.tsx +1 -0
- package/src/components/design-system/Pane.tsx +1 -0
- package/src/components/design-system/ProgressBar.tsx +1 -0
- package/src/components/design-system/Ratchet.tsx +1 -0
- package/src/components/design-system/StatusIcon.tsx +1 -0
- package/src/components/design-system/Tabs.tsx +2 -1
- package/src/components/design-system/ThemeProvider.tsx +1 -0
- package/src/components/design-system/ThemedBox.tsx +1 -0
- package/src/components/design-system/ThemedText.tsx +1 -0
- package/src/components/diff/DiffDetailView.tsx +1 -0
- package/src/components/diff/DiffDialog.tsx +1 -0
- package/src/components/diff/DiffFileList.tsx +1 -0
- package/src/components/grove/Grove.tsx +2 -1
- package/src/components/hooks/HooksConfigMenu.tsx +2 -1
- package/src/components/hooks/PromptDialog.tsx +1 -0
- package/src/components/hooks/SelectEventMode.tsx +1 -0
- package/src/components/hooks/SelectHookMode.tsx +1 -0
- package/src/components/hooks/SelectMatcherMode.tsx +1 -0
- package/src/components/hooks/ViewHookMode.tsx +1 -0
- package/src/components/mcp/CapabilitiesSection.tsx +1 -0
- package/src/components/mcp/ElicitationDialog.tsx +1 -0
- package/src/components/mcp/MCPAgentServerMenu.tsx +1 -0
- package/src/components/mcp/MCPListPanel.tsx +2 -1
- package/src/components/mcp/MCPReconnect.tsx +1 -0
- package/src/components/mcp/MCPRemoteServerMenu.tsx +1 -0
- package/src/components/mcp/MCPSettings.tsx +2 -1
- package/src/components/mcp/MCPStdioServerMenu.tsx +1 -0
- package/src/components/mcp/MCPToolDetailView.tsx +1 -0
- package/src/components/mcp/MCPToolListView.tsx +1 -0
- package/src/components/mcp/McpParsingWarnings.tsx +1 -0
- package/src/components/memory/MemoryFileSelector.tsx +2 -1
- package/src/components/memory/MemoryUpdateNotification.tsx +1 -0
- package/src/components/messageActions.tsx +1 -0
- package/src/components/messages/AdvisorMessage.tsx +1 -0
- package/src/components/messages/AssistantRedactedThinkingMessage.tsx +1 -0
- package/src/components/messages/AssistantTextMessage.tsx +1 -0
- package/src/components/messages/AssistantThinkingMessage.tsx +1 -0
- package/src/components/messages/AssistantToolUseMessage.tsx +1 -0
- package/src/components/messages/AttachmentMessage.tsx +2 -1
- package/src/components/messages/CollapsedReadSearchContent.tsx +2 -1
- package/src/components/messages/GroupedToolUseContent.tsx +1 -0
- package/src/components/messages/HighlightedThinkingText.tsx +1 -0
- package/src/components/messages/HookProgressMessage.tsx +1 -0
- package/src/components/messages/PlanApprovalMessage.tsx +1 -0
- package/src/components/messages/RateLimitMessage.tsx +1 -0
- package/src/components/messages/ShutdownMessage.tsx +1 -0
- package/src/components/messages/SystemAPIErrorMessage.tsx +1 -0
- package/src/components/messages/SystemTextMessage.tsx +2 -1
- package/src/components/messages/TaskAssignmentMessage.tsx +1 -0
- package/src/components/messages/UserAgentNotificationMessage.tsx +1 -0
- package/src/components/messages/UserBashInputMessage.tsx +1 -0
- package/src/components/messages/UserBashOutputMessage.tsx +1 -0
- package/src/components/messages/UserChannelMessage.tsx +1 -0
- package/src/components/messages/UserCommandMessage.tsx +1 -0
- package/src/components/messages/UserImageMessage.tsx +1 -0
- package/src/components/messages/UserLocalCommandOutputMessage.tsx +1 -0
- package/src/components/messages/UserMemoryInputMessage.tsx +1 -0
- package/src/components/messages/UserPlanMessage.tsx +1 -0
- package/src/components/messages/UserResourceUpdateMessage.tsx +1 -0
- package/src/components/messages/UserTeammateMessage.tsx +1 -0
- package/src/components/messages/UserTextMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/RejectedPlanMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/UserToolErrorMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/UserToolRejectMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/UserToolResultMessage.tsx +1 -0
- package/src/components/messages/UserToolResultMessage/utils.tsx +1 -0
- package/src/components/messages/nullRenderingAttachments.ts +1 -0
- package/src/components/messages/teamMemCollapsed.tsx +1 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.tsx +2 -1
- package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.tsx +1 -0
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.tsx +2 -1
- package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.tsx +2 -1
- package/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.tsx +1 -0
- package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.tsx +1 -0
- package/src/components/permissions/BashPermissionRequest/bashToolUseOptions.tsx +1 -0
- package/src/components/permissions/ComputerUseApproval/ComputerUseApproval.tsx +2 -1
- package/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.tsx +1 -0
- package/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.tsx +1 -0
- package/src/components/permissions/FallbackPermissionRequest.tsx +1 -0
- package/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx +1 -0
- package/src/components/permissions/FilePermissionDialog/FilePermissionDialog.tsx +1 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx +1 -0
- package/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.tsx +1 -0
- package/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.tsx +1 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.tsx +1 -0
- package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.tsx +2 -1
- package/src/components/permissions/PermissionDecisionDebugInfo.tsx +2 -1
- package/src/components/permissions/PermissionDialog.tsx +1 -0
- package/src/components/permissions/PermissionExplanation.tsx +2 -1
- package/src/components/permissions/PermissionPrompt.tsx +2 -1
- package/src/components/permissions/PermissionRequest.tsx +1 -0
- package/src/components/permissions/PermissionRequestTitle.tsx +1 -0
- package/src/components/permissions/PermissionRuleExplanation.tsx +1 -0
- package/src/components/permissions/SandboxPermissionRequest.tsx +1 -0
- package/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.tsx +1 -0
- package/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.tsx +1 -0
- package/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.tsx +1 -0
- package/src/components/permissions/WorkerBadge.tsx +1 -0
- package/src/components/permissions/WorkerPendingPermission.tsx +1 -0
- package/src/components/permissions/rules/AddPermissionRules.tsx +1 -0
- package/src/components/permissions/rules/AddWorkspaceDirectory.tsx +2 -1
- package/src/components/permissions/rules/PermissionRuleDescription.tsx +1 -0
- package/src/components/permissions/rules/PermissionRuleInput.tsx +1 -0
- package/src/components/permissions/rules/PermissionRuleList.tsx +2 -1
- package/src/components/permissions/rules/RecentDenialsTab.tsx +1 -0
- package/src/components/permissions/rules/RemoveWorkspaceDirectory.tsx +1 -0
- package/src/components/permissions/rules/WorkspaceTab.tsx +1 -0
- package/src/components/sandbox/SandboxConfigTab.tsx +1 -0
- package/src/components/sandbox/SandboxDependenciesTab.tsx +1 -0
- package/src/components/sandbox/SandboxDoctorSection.tsx +1 -0
- package/src/components/sandbox/SandboxOverridesTab.tsx +1 -0
- package/src/components/sandbox/SandboxSettings.tsx +1 -0
- package/src/components/shell/ExpandShellOutputContext.tsx +1 -0
- package/src/components/shell/OutputLine.tsx +1 -0
- package/src/components/shell/ShellProgressMessage.tsx +1 -0
- package/src/components/shell/ShellTimeDisplay.tsx +1 -0
- package/src/components/skills/SkillsMenu.tsx +1 -0
- package/src/components/tasks/AsyncAgentDetailDialog.tsx +1 -0
- package/src/components/tasks/BackgroundTask.tsx +1 -0
- package/src/components/tasks/BackgroundTaskStatus.tsx +2 -1
- package/src/components/tasks/BackgroundTasksDialog.tsx +2 -1
- package/src/components/tasks/DreamDetailDialog.tsx +1 -0
- package/src/components/tasks/InProcessTeammateDetailDialog.tsx +1 -0
- package/src/components/tasks/RemoteSessionDetailDialog.tsx +2 -1
- package/src/components/tasks/RemoteSessionProgress.tsx +1 -0
- package/src/components/tasks/ShellDetailDialog.tsx +2 -1
- package/src/components/tasks/ShellProgress.tsx +1 -0
- package/src/components/tasks/taskStatusUtils.tsx +1 -0
- package/src/components/teams/TeamStatus.tsx +1 -0
- package/src/components/teams/TeamsDialog.tsx +2 -1
- package/src/components/ui/OrderedList.tsx +1 -0
- package/src/components/ui/OrderedListItem.tsx +1 -0
- package/src/components/ui/TreeSelect.tsx +2 -1
- package/src/components/wizard/WizardDialogLayout.tsx +1 -0
- package/src/components/wizard/WizardProvider.tsx +2 -1
- package/src/components/wizard/useWizard.ts +1 -0
- package/src/constants/betas.ts +1 -0
- package/src/constants/prompts.ts +1 -0
- package/src/context/QueuedMessageContext.tsx +1 -0
- package/src/context/fpsMetrics.tsx +1 -0
- package/src/context/mailbox.tsx +1 -0
- package/src/context/modalContext.tsx +1 -0
- package/src/context/overlayContext.tsx +1 -0
- package/src/context/promptOverlayContext.tsx +1 -0
- package/src/context/stats.tsx +1 -0
- package/src/context/voice.tsx +1 -0
- package/src/cost-tracker.ts +1 -0
- package/src/dialogLaunchers.tsx +1 -0
- package/src/entrypoints/agentSdkTypes.ts +4 -17
- package/src/entrypoints/cli.tsx +1 -0
- package/src/entrypoints/sdk/controlTypes.ts +86 -10
- package/src/entrypoints/sdk/coreTypes.generated.ts +99 -2
- package/src/entrypoints/sdk/runtimeTypes.ts +53 -18
- package/src/entrypoints/sdk/settingsTypes.generated.ts +2 -1
- package/src/hooks/notifs/useAntOrgWarningNotification.ts +1 -1
- package/src/hooks/notifs/useCanSwitchToExistingSubscription.tsx +1 -0
- package/src/hooks/notifs/useDeprecationWarningNotification.tsx +1 -0
- package/src/hooks/notifs/useFastModeNotification.tsx +1 -0
- package/src/hooks/notifs/useIDEStatusIndicator.tsx +1 -0
- package/src/hooks/notifs/useInstallMessages.tsx +1 -0
- package/src/hooks/notifs/useLspInitializationNotification.tsx +1 -0
- package/src/hooks/notifs/useMcpConnectivityStatus.tsx +1 -0
- package/src/hooks/notifs/useNpmDeprecationNotification.tsx +1 -0
- package/src/hooks/notifs/usePluginAutoupdateNotification.tsx +1 -0
- package/src/hooks/notifs/usePluginInstallationStatus.tsx +1 -0
- package/src/hooks/notifs/useRateLimitWarningNotification.tsx +1 -0
- package/src/hooks/useCanUseTool.tsx +2 -1
- package/src/hooks/useChromeExtensionNotification.tsx +1 -0
- package/src/hooks/useClaudeCodeHintRecommendation.tsx +1 -0
- package/src/hooks/useCommandKeybindings.tsx +1 -0
- package/src/hooks/useDiffData.ts +1 -0
- package/src/hooks/useIDEIntegration.tsx +1 -0
- package/src/hooks/useLspPluginRecommendation.tsx +1 -0
- package/src/hooks/useOfficialMarketplaceNotification.tsx +1 -0
- package/src/hooks/usePluginRecommendationBase.tsx +1 -0
- package/src/hooks/usePromptsFromClaudeInChrome.tsx +1 -0
- package/src/hooks/useRemoteSession.ts +1 -0
- package/src/hooks/useReplBridge.tsx +1 -0
- package/src/hooks/useSSHSession.ts +1 -0
- package/src/hooks/useTeleportResume.tsx +1 -0
- package/src/hooks/useTurnDiffs.ts +1 -0
- package/src/hooks/useTypeahead.tsx +1 -0
- package/src/hooks/useVoiceIntegration.tsx +1 -0
- package/src/ink/Ansi.tsx +1 -0
- package/src/ink/bidi.ts +1 -0
- package/src/ink/components/AlternateScreen.tsx +1 -0
- package/src/ink/components/Box.tsx +1 -0
- package/src/ink/components/Button.tsx +1 -0
- package/src/ink/components/ClockContext.tsx +1 -0
- package/src/ink/components/Link.tsx +1 -0
- package/src/ink/components/Newline.tsx +1 -0
- package/src/ink/components/NoSelect.tsx +1 -0
- package/src/ink/components/RawAnsi.tsx +1 -0
- package/src/ink/components/ScrollBox.tsx +1 -0
- package/src/ink/components/TerminalFocusContext.tsx +1 -0
- package/src/ink/components/Text.tsx +1 -0
- package/src/ink/ink.tsx +1 -0
- package/src/ink/reconciler.ts +1 -0
- package/src/ink/render-to-screen.ts +1 -0
- package/src/interactiveHelpers.tsx +4 -4
- package/src/keybindings/KeybindingContext.tsx +2 -1
- package/src/keybindings/KeybindingProviderSetup.tsx +1 -0
- package/src/keybindings/parser.ts +1 -0
- package/src/keybindings/template.ts +1 -0
- package/src/keybindings/validate.ts +1 -0
- package/src/main.tsx +5 -7
- package/src/memdir/findRelevantMemories.ts +1 -0
- package/src/native-ts/color-diff/index.ts +1 -0
- package/src/proactive/index.ts +26 -1
- package/src/proactive/useProactive.ts +13 -1
- package/src/query/stopHooks.ts +1 -0
- package/src/query.ts +1 -0
- package/src/remote/SessionsWebSocket.ts +1 -0
- package/src/screens/Doctor.tsx +2 -1
- package/src/screens/REPL.tsx +13 -6
- package/src/screens/ResumeConversation.tsx +1 -0
- package/src/services/AgentSummary/agentSummary.ts +1 -0
- package/src/services/PromptSuggestion/promptSuggestion.ts +1 -0
- package/src/services/api/claude.ts +33 -31
- package/src/services/api/client.ts +34 -31
- package/src/services/api/errors.ts +1 -0
- package/src/services/api/logging.ts +1 -0
- package/src/services/api/openaiShim.ts +35 -8
- package/src/services/api/withRetry.ts +1 -0
- package/src/services/autoDream/autoDream.ts +1 -0
- package/src/services/claudeAiLimits.ts +1 -0
- package/src/services/compact/autoCompact.ts +1 -0
- package/src/services/compact/cachedMicrocompact.ts +56 -4
- package/src/services/compact/compact.ts +1 -0
- package/src/services/compact/microCompact.ts +1 -0
- package/src/services/compact/postCompactCleanup.ts +1 -0
- package/src/services/compact/reactiveCompact.ts +16 -1
- package/src/services/compact/sessionMemoryCompact.ts +1 -0
- package/src/services/compact/snipCompact.ts +18 -1
- package/src/services/compact/snipProjection.ts +6 -1
- package/src/services/contextCollapse/index.ts +33 -1
- package/src/services/extractMemories/extractMemories.ts +1 -0
- package/src/services/mcp/MCPConnectionManager.tsx +1 -0
- package/src/services/mcp/channelAllowlist.ts +1 -1
- package/src/services/mcp/channelNotification.ts +90 -4
- package/src/services/mcp/channelPermissions.ts +1 -1
- package/src/services/mcp/client.ts +1 -0
- package/src/services/mcp/useManageMCPConnections.ts +5 -3
- package/src/services/notifier.ts +1 -0
- package/src/services/rateLimitMocking.ts +1 -0
- package/src/services/skillSearch/localSearch.ts +1 -1
- package/src/services/skillSearch/prefetch.ts +10 -1
- package/src/services/tips/tipRegistry.ts +1 -0
- package/src/services/toolUseSummary/toolUseSummaryGenerator.ts +1 -0
- package/src/services/tools/StreamingToolExecutor.ts +1 -0
- package/src/services/tools/toolOrchestration.ts +1 -0
- package/src/services/vcr.ts +1 -0
- package/src/services/voice.ts +1 -0
- package/src/setup.ts +1 -0
- package/src/skills/bundled/claudeInChrome.ts +1 -0
- package/src/skills/bundled/keybindings.ts +1 -0
- package/src/skills/bundled/skillify.ts +1 -0
- package/src/state/AppState.tsx +10 -7
- package/src/tasks/LocalMainSessionTask.ts +1 -0
- package/src/tasks/LocalShellTask/LocalShellTask.tsx +1 -0
- package/src/tasks/LocalShellTask/killShellTasks.ts +1 -0
- package/src/tasks/RemoteAgentTask/RemoteAgentTask.tsx +1 -0
- package/src/tools/AgentTool/AgentTool.tsx +30 -3
- package/src/tools/AgentTool/UI.tsx +2 -1
- package/src/tools/AgentTool/agentToolUtils.ts +1 -0
- package/src/tools/AgentTool/builtInAgents.ts +1 -0
- package/src/tools/AgentTool/forkSubagent.ts +1 -0
- package/src/tools/AgentTool/loadAgentsDir.ts +9 -0
- package/src/tools/AgentTool/runAgent.ts +2 -0
- package/src/tools/AskUserQuestionTool/AskUserQuestionTool.tsx +1 -0
- package/src/tools/BashTool/BashTool.tsx +1 -0
- package/src/tools/BashTool/BashToolResultMessage.tsx +1 -0
- package/src/tools/BashTool/UI.tsx +1 -0
- package/src/tools/BriefTool/UI.tsx +1 -0
- package/src/tools/FileEditTool/UI.tsx +1 -0
- package/src/tools/FileEditTool/utils.ts +1 -0
- package/src/tools/FileReadTool/FileReadTool.ts +1 -0
- package/src/tools/FileReadTool/imageProcessor.ts +1 -0
- package/src/tools/FileWriteTool/UI.tsx +2 -1
- package/src/tools/GrepTool/UI.tsx +1 -0
- package/src/tools/LSPTool/UI.tsx +1 -0
- package/src/tools/MCPTool/UI.tsx +1 -0
- package/src/tools/NotebookEditTool/NotebookEditTool.ts +1 -0
- package/src/tools/NotebookEditTool/UI.tsx +1 -0
- package/src/tools/PowerShellTool/PowerShellTool.tsx +1 -0
- package/src/tools/SendMessageTool/SendMessageTool.ts +1 -0
- package/src/tools/SkillTool/SkillTool.ts +1 -0
- package/src/tools/TaskOutputTool/TaskOutputTool.tsx +1 -0
- package/src/tools/TaskStopTool/UI.tsx +1 -0
- package/src/tools/ToolSearchTool/prompt.ts +1 -0
- package/src/tools/TungstenTool/TungstenLiveMonitor.ts +3 -0
- package/src/tools/WebBrowserTool/WebBrowserPanel.ts +3 -1
- package/src/tools/WebFetchTool/utils.ts +1 -0
- package/src/tools/WebSearchTool/WebSearchTool.ts +1 -0
- package/src/tools/WorkflowTool/createWorkflowCommand.ts +3 -1
- package/src/tools/testing/TestingPermissionTool.tsx +1 -0
- package/src/tools/utils.ts +1 -0
- package/src/types/commands-js.d.ts +13 -0
- package/src/types/diff.d.ts +1 -0
- package/src/types/hooks.ts +1 -0
- package/src/types/macro.d.ts +15 -0
- package/src/types/markdown.d.ts +4 -0
- package/src/types/message.ts +56 -107
- package/src/types/react-compiler-runtime.d.ts +4 -0
- package/src/types/utils.ts +3 -3
- package/src/utils/advisor.ts +1 -0
- package/src/utils/asciicast.ts +1 -0
- package/src/utils/attachments.ts +1 -0
- package/src/utils/attribution.ts +1 -0
- package/src/utils/autoRunIssue.tsx +1 -0
- package/src/utils/claudeInChrome/mcpServer.ts +1 -0
- package/src/utils/claudeInChrome/setup.ts +1 -0
- package/src/utils/claudemd.ts +1 -0
- package/src/utils/cleanup.ts +1 -0
- package/src/utils/cliHighlight.ts +1 -0
- package/src/utils/collapseReadSearch.ts +1 -0
- package/src/utils/computerUse/executor.ts +1 -0
- package/src/utils/computerUse/gates.ts +1 -0
- package/src/utils/computerUse/hostAdapter.ts +1 -0
- package/src/utils/computerUse/inputLoader.ts +1 -0
- package/src/utils/computerUse/mcpServer.ts +1 -0
- package/src/utils/computerUse/setup.ts +1 -0
- package/src/utils/computerUse/swiftLoader.ts +1 -0
- package/src/utils/computerUse/wrapper.tsx +2 -1
- package/src/utils/context.ts +1 -0
- package/src/utils/contextAnalysis.ts +1 -0
- package/src/utils/conversationRecovery.ts +1 -0
- package/src/utils/deepLink/protocolHandler.ts +1 -0
- package/src/utils/diff.ts +1 -0
- package/src/utils/effort.ts +1 -0
- package/src/utils/envUtils.ts +1 -0
- package/src/utils/execFileNoThrowPortable.ts +1 -0
- package/src/utils/fileHistory.ts +1 -0
- package/src/utils/filePersistence/filePersistence.ts +1 -0
- package/src/utils/filePersistence/outputsScanner.ts +1 -0
- package/src/utils/gitDiff.ts +1 -0
- package/src/utils/groupToolUses.ts +1 -0
- package/src/utils/hooks/hooksConfigManager.ts +1 -0
- package/src/utils/hooks/skillImprovement.ts +1 -0
- package/src/utils/hooks.ts +1 -0
- package/src/utils/imagePaste.ts +1 -0
- package/src/utils/log.ts +1 -0
- package/src/utils/logoV2Utils.ts +6 -6
- package/src/utils/messageQueueManager.ts +1 -0
- package/src/utils/messages.ts +122 -100
- package/src/utils/model/agent.ts +43 -2
- package/src/utils/model/configs.ts +1 -1
- package/src/utils/model/deprecation.ts +1 -0
- package/src/utils/model/fetchModels.ts +11 -1
- package/src/utils/model/model.ts +31 -0
- package/src/utils/model/modelCapabilities.ts +1 -0
- package/src/utils/model/modelOptions.ts +68 -14
- package/src/utils/model/modelStrings.ts +1 -0
- package/src/utils/model/platformProfiles.ts +524 -0
- package/src/utils/model/thirdPartyProviders.ts +158 -15
- package/src/utils/modelCost.ts +1 -0
- package/src/utils/notebook.ts +1 -0
- package/src/utils/permissions/classifierDecision.ts +1 -0
- package/src/utils/permissions/pathValidation.ts +1 -0
- package/src/utils/permissions/permissionExplainer.ts +1 -0
- package/src/utils/plugins/loadPluginHooks.ts +1 -0
- package/src/utils/plugins/lspPluginIntegration.ts +1 -0
- package/src/utils/plugins/pluginLoader.ts +1 -0
- package/src/utils/preflightChecks.tsx +2 -1
- package/src/utils/processUserInput/processSlashCommand.tsx +13 -3
- package/src/utils/queryHelpers.ts +1 -0
- package/src/utils/readFileInRange.ts +1 -0
- package/src/utils/sandbox/sandbox-adapter.ts +24 -22
- package/src/utils/sessionFileAccessHooks.ts +1 -0
- package/src/utils/sessionRestore.ts +1 -0
- package/src/utils/sessionStorage.ts +84 -46
- package/src/utils/settings/types.ts +72 -0
- package/src/utils/shell/prefix.ts +1 -0
- package/src/utils/sideQuery.ts +1 -0
- package/src/utils/sliceAnsi.ts +1 -0
- package/src/utils/staticRender.tsx +1 -0
- package/src/utils/stats.ts +1 -0
- package/src/utils/status.tsx +1 -0
- package/src/utils/swarm/It2SetupPrompt.tsx +2 -1
- package/src/utils/swarm/teammateModel.ts +1 -0
- package/src/utils/taskSummary.ts +6 -1
- package/src/utils/textHighlighting.ts +1 -0
- package/src/utils/thinking.ts +1 -0
- package/src/utils/toolResultStorage.ts +1 -0
- package/src/utils/transcriptSearch.ts +1 -0
- package/src/utils/worktree.ts +1 -0
- package/stubs/@anthropic-ai/mcpb/index.d.ts +23 -1
- package/stubs/@anthropic-ai/sandbox-runtime/index.d.ts +39 -1
- package/.gitignore.bak +0 -11
- package/bin/mumuclaw +0 -154
- package/bin/opencc +0 -50
- package/src/channels/heartbeat-channel.mjs +0 -280
package/src/utils/messages.ts
CHANGED
|
@@ -90,6 +90,10 @@ type HookAttachmentWithName = Exclude<
|
|
|
90
90
|
HookAttachment,
|
|
91
91
|
HookPermissionDecisionAttachment
|
|
92
92
|
>
|
|
93
|
+
type LooseContentBlock = {
|
|
94
|
+
type: string
|
|
95
|
+
[key: string]: any
|
|
96
|
+
}
|
|
93
97
|
|
|
94
98
|
import type { APIError } from '@anthropic-ai/sdk'
|
|
95
99
|
import type {
|
|
@@ -373,7 +377,7 @@ function baseCreateAssistantMessage({
|
|
|
373
377
|
inference_geo: null,
|
|
374
378
|
iterations: null,
|
|
375
379
|
speed: null,
|
|
376
|
-
},
|
|
380
|
+
} as Usage,
|
|
377
381
|
}: {
|
|
378
382
|
content: BetaContentBlock[]
|
|
379
383
|
isApiErrorMessage?: boolean
|
|
@@ -750,7 +754,7 @@ export function normalizeMessages(messages: Message[]): NormalizedMessage[] {
|
|
|
750
754
|
switch (message.type) {
|
|
751
755
|
case 'assistant': {
|
|
752
756
|
isNewChain = isNewChain || message.message.content.length > 1
|
|
753
|
-
return message.message.content.map((_, index) => {
|
|
757
|
+
return message.message.content.map((_: any, index: number) => {
|
|
754
758
|
const uuid = isNewChain
|
|
755
759
|
? deriveUUID(message.uuid, index)
|
|
756
760
|
: message.uuid
|
|
@@ -794,7 +798,7 @@ export function normalizeMessages(messages: Message[]): NormalizedMessage[] {
|
|
|
794
798
|
}
|
|
795
799
|
isNewChain = isNewChain || message.message.content.length > 1
|
|
796
800
|
let imageIndex = 0
|
|
797
|
-
return message.message.content.map((_, index) => {
|
|
801
|
+
return message.message.content.map((_: any, index: number) => {
|
|
798
802
|
const isImage = _.type === 'image'
|
|
799
803
|
// For image content blocks, extract just the ID for this image
|
|
800
804
|
const imageId =
|
|
@@ -832,7 +836,7 @@ export function isToolUseRequestMessage(
|
|
|
832
836
|
return (
|
|
833
837
|
message.type === 'assistant' &&
|
|
834
838
|
// Note: stop_reason === 'tool_use' is unreliable -- it's not always set correctly
|
|
835
|
-
message.message.content.some(_ => _.type === 'tool_use')
|
|
839
|
+
message.message.content.some((_: any) => _.type === 'tool_use')
|
|
836
840
|
)
|
|
837
841
|
}
|
|
838
842
|
|
|
@@ -879,9 +883,10 @@ export function reorderMessagesInUI(
|
|
|
879
883
|
|
|
880
884
|
// First pass: group messages by tool use ID
|
|
881
885
|
for (const message of messages) {
|
|
886
|
+
const currentMessage = message as any
|
|
882
887
|
// Handle tool use messages
|
|
883
|
-
if (isToolUseRequestMessage(
|
|
884
|
-
const toolUseID =
|
|
888
|
+
if (isToolUseRequestMessage(currentMessage)) {
|
|
889
|
+
const toolUseID = currentMessage.message.content[0]?.id
|
|
885
890
|
if (toolUseID) {
|
|
886
891
|
if (!toolUseGroups.has(toolUseID)) {
|
|
887
892
|
toolUseGroups.set(toolUseID, {
|
|
@@ -891,63 +896,65 @@ export function reorderMessagesInUI(
|
|
|
891
896
|
postHooks: [],
|
|
892
897
|
})
|
|
893
898
|
}
|
|
894
|
-
toolUseGroups.get(toolUseID)!.toolUse =
|
|
899
|
+
toolUseGroups.get(toolUseID)!.toolUse = currentMessage
|
|
895
900
|
}
|
|
896
901
|
continue
|
|
897
902
|
}
|
|
898
903
|
|
|
899
904
|
// Handle pre-tool-use hooks
|
|
900
|
-
if (
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
905
|
+
if (isHookAttachmentMessage(currentMessage)) {
|
|
906
|
+
const attachmentMessage =
|
|
907
|
+
currentMessage as AttachmentMessage<HookAttachment>
|
|
908
|
+
if (attachmentMessage.attachment.hookEvent === 'PreToolUse') {
|
|
909
|
+
const toolUseID = attachmentMessage.attachment.toolUseID
|
|
910
|
+
if (!toolUseGroups.has(toolUseID)) {
|
|
911
|
+
toolUseGroups.set(toolUseID, {
|
|
912
|
+
toolUse: null,
|
|
913
|
+
preHooks: [],
|
|
914
|
+
toolResult: null,
|
|
915
|
+
postHooks: [],
|
|
916
|
+
})
|
|
917
|
+
}
|
|
918
|
+
toolUseGroups.get(toolUseID)!.preHooks.push(attachmentMessage)
|
|
919
|
+
continue
|
|
912
920
|
}
|
|
913
|
-
toolUseGroups.get(toolUseID)!.preHooks.push(message)
|
|
914
|
-
continue
|
|
915
921
|
}
|
|
916
922
|
|
|
917
923
|
// Handle tool results
|
|
918
|
-
if (
|
|
919
|
-
message
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
}
|
|
924
|
+
if ((message as any).type === 'user') {
|
|
925
|
+
const userMessage = message as UserMessage
|
|
926
|
+
if (userMessage.message.content[0]?.type === 'tool_result') {
|
|
927
|
+
const toolUseID = userMessage.message.content[0].tool_use_id
|
|
928
|
+
if (!toolUseGroups.has(toolUseID)) {
|
|
929
|
+
toolUseGroups.set(toolUseID, {
|
|
930
|
+
toolUse: null,
|
|
931
|
+
preHooks: [],
|
|
932
|
+
toolResult: null,
|
|
933
|
+
postHooks: [],
|
|
934
|
+
})
|
|
935
|
+
}
|
|
936
|
+
toolUseGroups.get(toolUseID)!.toolResult = userMessage
|
|
937
|
+
continue
|
|
930
938
|
}
|
|
931
|
-
toolUseGroups.get(toolUseID)!.toolResult = message
|
|
932
|
-
continue
|
|
933
939
|
}
|
|
934
940
|
|
|
935
941
|
// Handle post-tool-use hooks
|
|
936
|
-
if (
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
942
|
+
if (isHookAttachmentMessage(currentMessage)) {
|
|
943
|
+
const attachmentMessage =
|
|
944
|
+
currentMessage as AttachmentMessage<HookAttachment>
|
|
945
|
+
if (attachmentMessage.attachment.hookEvent === 'PostToolUse') {
|
|
946
|
+
const toolUseID = attachmentMessage.attachment.toolUseID
|
|
947
|
+
if (!toolUseGroups.has(toolUseID)) {
|
|
948
|
+
toolUseGroups.set(toolUseID, {
|
|
949
|
+
toolUse: null,
|
|
950
|
+
preHooks: [],
|
|
951
|
+
toolResult: null,
|
|
952
|
+
postHooks: [],
|
|
953
|
+
})
|
|
954
|
+
}
|
|
955
|
+
toolUseGroups.get(toolUseID)!.postHooks.push(attachmentMessage)
|
|
956
|
+
continue
|
|
948
957
|
}
|
|
949
|
-
toolUseGroups.get(toolUseID)!.postHooks.push(message)
|
|
950
|
-
continue
|
|
951
958
|
}
|
|
952
959
|
}
|
|
953
960
|
|
|
@@ -961,9 +968,10 @@ export function reorderMessagesInUI(
|
|
|
961
968
|
const processedToolUses = new Set<string>()
|
|
962
969
|
|
|
963
970
|
for (const message of messages) {
|
|
971
|
+
const currentMessage = message as any
|
|
964
972
|
// Check if this is a tool use
|
|
965
|
-
if (isToolUseRequestMessage(
|
|
966
|
-
const toolUseID =
|
|
973
|
+
if (isToolUseRequestMessage(currentMessage)) {
|
|
974
|
+
const toolUseID = currentMessage.message.content[0]?.id
|
|
967
975
|
if (toolUseID && !processedToolUses.has(toolUseID)) {
|
|
968
976
|
processedToolUses.add(toolUseID)
|
|
969
977
|
const group = toolUseGroups.get(toolUseID)
|
|
@@ -981,36 +989,41 @@ export function reorderMessagesInUI(
|
|
|
981
989
|
}
|
|
982
990
|
|
|
983
991
|
// Check if this message is part of a tool use group
|
|
984
|
-
if (
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
992
|
+
if (isHookAttachmentMessage(currentMessage)) {
|
|
993
|
+
const attachmentMessage =
|
|
994
|
+
currentMessage as AttachmentMessage<HookAttachment>
|
|
995
|
+
if (
|
|
996
|
+
attachmentMessage.attachment.hookEvent === 'PreToolUse' ||
|
|
997
|
+
attachmentMessage.attachment.hookEvent === 'PostToolUse'
|
|
998
|
+
) {
|
|
999
|
+
continue
|
|
1000
|
+
}
|
|
991
1001
|
}
|
|
992
1002
|
|
|
993
1003
|
if (
|
|
994
|
-
message.type === 'user' &&
|
|
995
|
-
message.message.content[0]?.type === 'tool_result'
|
|
1004
|
+
(message as any).type === 'user' &&
|
|
1005
|
+
(message as UserMessage).message.content[0]?.type === 'tool_result'
|
|
996
1006
|
) {
|
|
997
1007
|
// Skip - already handled in tool use groups
|
|
998
1008
|
continue
|
|
999
1009
|
}
|
|
1000
1010
|
|
|
1001
1011
|
// Handle api error messages (only keep the last one)
|
|
1002
|
-
if (
|
|
1012
|
+
if (
|
|
1013
|
+
(message as any).type === 'system' &&
|
|
1014
|
+
(message as any).subtype === 'api_error'
|
|
1015
|
+
) {
|
|
1003
1016
|
const last = result.at(-1)
|
|
1004
1017
|
if (last?.type === 'system' && last.subtype === 'api_error') {
|
|
1005
|
-
result[result.length - 1] =
|
|
1018
|
+
result[result.length - 1] = currentMessage
|
|
1006
1019
|
} else {
|
|
1007
|
-
result.push(
|
|
1020
|
+
result.push(currentMessage)
|
|
1008
1021
|
}
|
|
1009
1022
|
continue
|
|
1010
1023
|
}
|
|
1011
1024
|
|
|
1012
1025
|
// Add standalone messages
|
|
1013
|
-
result.push(
|
|
1026
|
+
result.push(currentMessage)
|
|
1014
1027
|
}
|
|
1015
1028
|
|
|
1016
1029
|
// Add synthetic streaming tool use messages
|
|
@@ -1122,9 +1135,11 @@ export function getSiblingToolUseIDs(
|
|
|
1122
1135
|
}
|
|
1123
1136
|
|
|
1124
1137
|
const unnormalizedMessage = messages.find(
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1138
|
+
(_: AssistantMessage): _ is AssistantMessage =>
|
|
1139
|
+
_.type === 'assistant' &&
|
|
1140
|
+
_.message.content.some(
|
|
1141
|
+
(block: any) => block.type === 'tool_use' && block.id === toolUseID,
|
|
1142
|
+
),
|
|
1128
1143
|
)
|
|
1129
1144
|
if (!unnormalizedMessage) {
|
|
1130
1145
|
return new Set()
|
|
@@ -1132,14 +1147,16 @@ export function getSiblingToolUseIDs(
|
|
|
1132
1147
|
|
|
1133
1148
|
const messageID = unnormalizedMessage.message.id
|
|
1134
1149
|
const siblingMessages = messages.filter(
|
|
1135
|
-
|
|
1136
|
-
|
|
1150
|
+
(_: AssistantMessage): _ is AssistantMessage =>
|
|
1151
|
+
_.type === 'assistant' && _.message.id === messageID,
|
|
1137
1152
|
)
|
|
1138
1153
|
|
|
1139
1154
|
return new Set(
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1155
|
+
siblingMessages.flatMap((message: AssistantMessage) =>
|
|
1156
|
+
message.message.content
|
|
1157
|
+
.filter((block: any) => block.type === 'tool_use')
|
|
1158
|
+
.map((block: any) => block.id),
|
|
1159
|
+
),
|
|
1143
1160
|
)
|
|
1144
1161
|
}
|
|
1145
1162
|
|
|
@@ -1552,7 +1569,7 @@ function stripUnavailableToolReferencesFromUserMessage(
|
|
|
1552
1569
|
block =>
|
|
1553
1570
|
block.type === 'tool_result' &&
|
|
1554
1571
|
Array.isArray(block.content) &&
|
|
1555
|
-
block.content.some(c => {
|
|
1572
|
+
block.content.some((c: any) => {
|
|
1556
1573
|
if (!isToolReferenceBlock(c)) return false
|
|
1557
1574
|
const toolName = (c as { tool_name?: string }).tool_name
|
|
1558
1575
|
return (
|
|
@@ -1575,7 +1592,7 @@ function stripUnavailableToolReferencesFromUserMessage(
|
|
|
1575
1592
|
}
|
|
1576
1593
|
|
|
1577
1594
|
// Filter out tool_reference blocks for unavailable tools
|
|
1578
|
-
const filteredContent = block.content.filter(c => {
|
|
1595
|
+
const filteredContent = block.content.filter((c: any) => {
|
|
1579
1596
|
if (!isToolReferenceBlock(c)) return true
|
|
1580
1597
|
const rawToolName = (c as { tool_name?: string }).tool_name
|
|
1581
1598
|
if (!rawToolName) return true
|
|
@@ -1704,7 +1721,7 @@ export function stripToolReferenceBlocksFromUserMessage(
|
|
|
1704
1721
|
|
|
1705
1722
|
// Filter out tool_reference blocks from tool_result content
|
|
1706
1723
|
const filteredContent = block.content.filter(
|
|
1707
|
-
c => !isToolReferenceBlock(c),
|
|
1724
|
+
(c: any) => !isToolReferenceBlock(c),
|
|
1708
1725
|
)
|
|
1709
1726
|
|
|
1710
1727
|
// If all content was tool_reference blocks, replace with a placeholder
|
|
@@ -1743,7 +1760,7 @@ export function stripCallerFieldFromAssistantMessage(
|
|
|
1743
1760
|
message: AssistantMessage,
|
|
1744
1761
|
): AssistantMessage {
|
|
1745
1762
|
const hasCallerField = message.message.content.some(
|
|
1746
|
-
block =>
|
|
1763
|
+
(block: any) =>
|
|
1747
1764
|
block.type === 'tool_use' && 'caller' in block && block.caller !== null,
|
|
1748
1765
|
)
|
|
1749
1766
|
|
|
@@ -1755,7 +1772,7 @@ export function stripCallerFieldFromAssistantMessage(
|
|
|
1755
1772
|
...message,
|
|
1756
1773
|
message: {
|
|
1757
1774
|
...message.message,
|
|
1758
|
-
content: message.message.content.map(block => {
|
|
1775
|
+
content: message.message.content.map((block: any) => {
|
|
1759
1776
|
if (block.type !== 'tool_use') {
|
|
1760
1777
|
return block
|
|
1761
1778
|
}
|
|
@@ -1804,7 +1821,7 @@ function ensureSystemReminderWrap(msg: UserMessage): UserMessage {
|
|
|
1804
1821
|
}
|
|
1805
1822
|
}
|
|
1806
1823
|
let changed = false
|
|
1807
|
-
const newContent = content.map(b => {
|
|
1824
|
+
const newContent = content.map((b: any) => {
|
|
1808
1825
|
if (b.type === 'text' && !b.text.startsWith('<system-reminder>')) {
|
|
1809
1826
|
changed = true
|
|
1810
1827
|
return { ...b, text: wrapInSystemReminder(b.text) }
|
|
@@ -2208,7 +2225,7 @@ export function normalizeMessagesForAPI(
|
|
|
2208
2225
|
...message,
|
|
2209
2226
|
message: {
|
|
2210
2227
|
...message.message,
|
|
2211
|
-
content: message.message.content.map(block => {
|
|
2228
|
+
content: message.message.content.map((block: any) => {
|
|
2212
2229
|
if (block.type === 'tool_use') {
|
|
2213
2230
|
const tool = tools.find(t => toolMatchesName(t, block.name))
|
|
2214
2231
|
const normalizedInput = tool
|
|
@@ -2405,7 +2422,7 @@ function isToolResultMessage(msg: Message): boolean {
|
|
|
2405
2422
|
}
|
|
2406
2423
|
const content = msg.message.content
|
|
2407
2424
|
if (typeof content === 'string') return false
|
|
2408
|
-
return content.some(block => block.type === 'tool_result')
|
|
2425
|
+
return content.some((block: any) => block.type === 'tool_result')
|
|
2409
2426
|
}
|
|
2410
2427
|
|
|
2411
2428
|
export function mergeUserMessages(a: UserMessage, b: UserMessage): UserMessage {
|
|
@@ -2656,7 +2673,8 @@ export function normalizeContentFromAPI(
|
|
|
2656
2673
|
if (!contentBlocks) {
|
|
2657
2674
|
return []
|
|
2658
2675
|
}
|
|
2659
|
-
return contentBlocks.map(
|
|
2676
|
+
return (contentBlocks as LooseContentBlock[]).map(
|
|
2677
|
+
(contentBlock: LooseContentBlock) => {
|
|
2660
2678
|
switch (contentBlock.type) {
|
|
2661
2679
|
case 'tool_use': {
|
|
2662
2680
|
if (
|
|
@@ -2747,7 +2765,8 @@ export function normalizeContentFromAPI(
|
|
|
2747
2765
|
default:
|
|
2748
2766
|
return contentBlock
|
|
2749
2767
|
}
|
|
2750
|
-
|
|
2768
|
+
},
|
|
2769
|
+
) as BetaMessage['content']
|
|
2751
2770
|
}
|
|
2752
2771
|
|
|
2753
2772
|
export function isEmptyMessageText(text: string): boolean {
|
|
@@ -2789,6 +2808,8 @@ export function getToolUseID(message: NormalizedMessage): string | null {
|
|
|
2789
2808
|
return message.subtype === 'informational'
|
|
2790
2809
|
? (message.toolUseID ?? null)
|
|
2791
2810
|
: null
|
|
2811
|
+
default:
|
|
2812
|
+
return null
|
|
2792
2813
|
}
|
|
2793
2814
|
}
|
|
2794
2815
|
|
|
@@ -2849,8 +2870,8 @@ export function getAssistantMessageText(message: Message): string | null {
|
|
|
2849
2870
|
if (Array.isArray(message.message.content)) {
|
|
2850
2871
|
return (
|
|
2851
2872
|
message.message.content
|
|
2852
|
-
.filter(block => block.type === 'text')
|
|
2853
|
-
.map(block => (block.type === 'text' ? block.text : ''))
|
|
2873
|
+
.filter((block: any) => block.type === 'text')
|
|
2874
|
+
.map((block: any) => (block.type === 'text' ? block.text : ''))
|
|
2854
2875
|
.join('\n')
|
|
2855
2876
|
.trim() || null
|
|
2856
2877
|
)
|
|
@@ -2963,7 +2984,7 @@ export function handleMessageFromStream(
|
|
|
2963
2984
|
// Capture complete thinking blocks for real-time display in transcript mode
|
|
2964
2985
|
if (message.type === 'assistant') {
|
|
2965
2986
|
const thinkingBlock = message.message.content.find(
|
|
2966
|
-
block => block.type === 'thinking',
|
|
2987
|
+
(block: any) => block.type === 'thinking',
|
|
2967
2988
|
)
|
|
2968
2989
|
if (thinkingBlock && thinkingBlock.type === 'thinking') {
|
|
2969
2990
|
onStreamingThinking?.(() => ({
|
|
@@ -3112,7 +3133,7 @@ export function wrapMessagesInSystemReminder(
|
|
|
3112
3133
|
}
|
|
3113
3134
|
} else if (Array.isArray(msg.message.content)) {
|
|
3114
3135
|
// For array content, wrap text blocks in system-reminder
|
|
3115
|
-
const wrappedContent = msg.message.content.map(block => {
|
|
3136
|
+
const wrappedContent = msg.message.content.map((block: any) => {
|
|
3116
3137
|
if (block.type === 'text') {
|
|
3117
3138
|
return {
|
|
3118
3139
|
...block,
|
|
@@ -4680,7 +4701,8 @@ export function isThinkingMessage(message: Message): boolean {
|
|
|
4680
4701
|
if (message.type !== 'assistant') return false
|
|
4681
4702
|
if (!Array.isArray(message.message.content)) return false
|
|
4682
4703
|
return message.message.content.every(
|
|
4683
|
-
block =>
|
|
4704
|
+
(block: any) =>
|
|
4705
|
+
block.type === 'thinking' || block.type === 'redacted_thinking',
|
|
4684
4706
|
)
|
|
4685
4707
|
}
|
|
4686
4708
|
|
|
@@ -4698,7 +4720,7 @@ export function countToolCalls(
|
|
|
4698
4720
|
if (!msg) continue
|
|
4699
4721
|
if (msg.type === 'assistant' && Array.isArray(msg.message.content)) {
|
|
4700
4722
|
const hasToolUse = msg.message.content.some(
|
|
4701
|
-
(block): block is ToolUseBlock =>
|
|
4723
|
+
(block: any): block is ToolUseBlock =>
|
|
4702
4724
|
block.type === 'tool_use' && block.name === toolName,
|
|
4703
4725
|
)
|
|
4704
4726
|
if (hasToolUse) {
|
|
@@ -4727,7 +4749,7 @@ export function hasSuccessfulToolCall(
|
|
|
4727
4749
|
if (!msg) continue
|
|
4728
4750
|
if (msg.type === 'assistant' && Array.isArray(msg.message.content)) {
|
|
4729
4751
|
const toolUse = msg.message.content.find(
|
|
4730
|
-
(block): block is ToolUseBlock =>
|
|
4752
|
+
(block: any): block is ToolUseBlock =>
|
|
4731
4753
|
block.type === 'tool_use' && block.name === toolName,
|
|
4732
4754
|
)
|
|
4733
4755
|
if (toolUse) {
|
|
@@ -4745,7 +4767,7 @@ export function hasSuccessfulToolCall(
|
|
|
4745
4767
|
if (!msg) continue
|
|
4746
4768
|
if (msg.type === 'user' && Array.isArray(msg.message.content)) {
|
|
4747
4769
|
const toolResult = msg.message.content.find(
|
|
4748
|
-
(block): block is ToolResultBlockParam =>
|
|
4770
|
+
(block: any): block is ToolResultBlockParam =>
|
|
4749
4771
|
block.type === 'tool_result' &&
|
|
4750
4772
|
block.tool_use_id === mostRecentToolUseId,
|
|
4751
4773
|
)
|
|
@@ -5164,7 +5186,7 @@ export function ensureToolResultPairing(
|
|
|
5164
5186
|
result.at(-1)?.type !== 'assistant'
|
|
5165
5187
|
) {
|
|
5166
5188
|
const stripped = msg.message.content.filter(
|
|
5167
|
-
block =>
|
|
5189
|
+
(block: any) =>
|
|
5168
5190
|
!(
|
|
5169
5191
|
typeof block === 'object' &&
|
|
5170
5192
|
'type' in block &&
|
|
@@ -5223,7 +5245,7 @@ export function ensureToolResultPairing(
|
|
|
5223
5245
|
// has no matching *_tool_result and the API rejects with e.g. "advisor
|
|
5224
5246
|
// tool use without corresponding advisor_tool_result".
|
|
5225
5247
|
const seenToolUseIds = new Set<string>()
|
|
5226
|
-
const finalContent = msg.message.content.filter(block => {
|
|
5248
|
+
const finalContent = msg.message.content.filter((block: any) => {
|
|
5227
5249
|
if (block.type === 'tool_use') {
|
|
5228
5250
|
if (allSeenToolUseIds.has(block.id)) {
|
|
5229
5251
|
repaired = true
|
|
@@ -5404,13 +5426,13 @@ export function ensureToolResultPairing(
|
|
|
5404
5426
|
const messageTypes = messages.map((m, idx) => {
|
|
5405
5427
|
if (m.type === 'assistant') {
|
|
5406
5428
|
const toolUses = m.message.content
|
|
5407
|
-
.filter(b => b.type === 'tool_use')
|
|
5408
|
-
.map(b => (b as ToolUseBlock | ToolUseBlockParam).id)
|
|
5429
|
+
.filter((b: any) => b.type === 'tool_use')
|
|
5430
|
+
.map((b: any) => (b as ToolUseBlock | ToolUseBlockParam).id)
|
|
5409
5431
|
const serverToolUses = m.message.content
|
|
5410
5432
|
.filter(
|
|
5411
|
-
b => b.type === 'server_tool_use' || b.type === 'mcp_tool_use',
|
|
5433
|
+
(b: any) => b.type === 'server_tool_use' || b.type === 'mcp_tool_use',
|
|
5412
5434
|
)
|
|
5413
|
-
.map(b => (b as { id: string }).id)
|
|
5435
|
+
.map((b: any) => (b as { id: string }).id)
|
|
5414
5436
|
const parts = [
|
|
5415
5437
|
`id=${m.message.id}`,
|
|
5416
5438
|
`tool_uses=[${toolUses.join(',')}]`,
|
|
@@ -5423,10 +5445,10 @@ export function ensureToolResultPairing(
|
|
|
5423
5445
|
if (m.type === 'user' && Array.isArray(m.message.content)) {
|
|
5424
5446
|
const toolResults = m.message.content
|
|
5425
5447
|
.filter(
|
|
5426
|
-
b =>
|
|
5448
|
+
(b: any) =>
|
|
5427
5449
|
typeof b === 'object' && 'type' in b && b.type === 'tool_result',
|
|
5428
5450
|
)
|
|
5429
|
-
.map(b => (b as ToolResultBlockParam).tool_use_id)
|
|
5451
|
+
.map((b: any) => (b as ToolResultBlockParam).tool_use_id)
|
|
5430
5452
|
if (toolResults.length > 0) {
|
|
5431
5453
|
return `[${idx}] user(tool_results=[${toolResults.join(',')}])`
|
|
5432
5454
|
}
|
|
@@ -5470,13 +5492,13 @@ export function stripAdvisorBlocks(
|
|
|
5470
5492
|
const result = messages.map(msg => {
|
|
5471
5493
|
if (msg.type !== 'assistant') return msg
|
|
5472
5494
|
const content = msg.message.content
|
|
5473
|
-
const filtered = content.filter(b => !isAdvisorBlock(b))
|
|
5495
|
+
const filtered = content.filter((b: any) => !isAdvisorBlock(b))
|
|
5474
5496
|
if (filtered.length === content.length) return msg
|
|
5475
5497
|
changed = true
|
|
5476
5498
|
if (
|
|
5477
5499
|
filtered.length === 0 ||
|
|
5478
5500
|
filtered.every(
|
|
5479
|
-
b =>
|
|
5501
|
+
(b: any) =>
|
|
5480
5502
|
b.type === 'thinking' ||
|
|
5481
5503
|
b.type === 'redacted_thinking' ||
|
|
5482
5504
|
(b.type === 'text' && (!b.text || !b.text.trim())),
|
package/src/utils/model/agent.ts
CHANGED
|
@@ -13,6 +13,12 @@ import {
|
|
|
13
13
|
getThirdPartyModelDisplayName,
|
|
14
14
|
getAllThirdPartyModels,
|
|
15
15
|
} from './thirdPartyProviders.js'
|
|
16
|
+
import {
|
|
17
|
+
getDefaultSubagentProfileId,
|
|
18
|
+
getPlatformDefaultModelForProfile,
|
|
19
|
+
getPlatformProfile,
|
|
20
|
+
isProfileQualifiedModel,
|
|
21
|
+
} from './platformProfiles.js'
|
|
16
22
|
|
|
17
23
|
export const AGENT_MODEL_OPTIONS = [...MODEL_ALIASES, 'inherit'] as const
|
|
18
24
|
export type AgentModelAlias = (typeof AGENT_MODEL_OPTIONS)[number]
|
|
@@ -28,6 +34,13 @@ export type AgentModelOption = {
|
|
|
28
34
|
* the model from the parent thread.
|
|
29
35
|
*/
|
|
30
36
|
export function getDefaultSubagentModel(): string {
|
|
37
|
+
const defaultProfile = getDefaultSubagentProfileId()
|
|
38
|
+
const defaultModel = defaultProfile
|
|
39
|
+
? getPlatformDefaultModelForProfile(defaultProfile)
|
|
40
|
+
: undefined
|
|
41
|
+
if (defaultProfile && defaultModel) {
|
|
42
|
+
return `${defaultProfile}:${defaultModel}`
|
|
43
|
+
}
|
|
31
44
|
return 'inherit'
|
|
32
45
|
}
|
|
33
46
|
|
|
@@ -44,20 +57,41 @@ export function getAgentModel(
|
|
|
44
57
|
parentModel: string,
|
|
45
58
|
toolSpecifiedModel?: ModelAlias | string,
|
|
46
59
|
permissionMode?: PermissionMode,
|
|
60
|
+
agentProfile?: string,
|
|
61
|
+
toolSpecifiedProfile?: string,
|
|
47
62
|
): string {
|
|
48
63
|
if (process.env.CLAUDE_CODE_SUBAGENT_MODEL) {
|
|
49
64
|
return parseUserSpecifiedModel(process.env.CLAUDE_CODE_SUBAGENT_MODEL)
|
|
50
65
|
}
|
|
51
66
|
|
|
67
|
+
const explicitProfile = toolSpecifiedProfile ?? agentProfile
|
|
68
|
+
|
|
52
69
|
// Third-party models (providerId:modelId) pass through directly.
|
|
53
70
|
// They don't need Bedrock region prefix or Anthropic alias resolution.
|
|
54
|
-
if (toolSpecifiedModel && isThirdPartyModel(toolSpecifiedModel)) {
|
|
71
|
+
if (toolSpecifiedModel && (isThirdPartyModel(toolSpecifiedModel) || isProfileQualifiedModel(toolSpecifiedModel))) {
|
|
55
72
|
return toolSpecifiedModel
|
|
56
73
|
}
|
|
57
|
-
if (agentModel && isThirdPartyModel(agentModel)) {
|
|
74
|
+
if (agentModel && (isThirdPartyModel(agentModel) || isProfileQualifiedModel(agentModel))) {
|
|
58
75
|
return agentModel
|
|
59
76
|
}
|
|
60
77
|
|
|
78
|
+
const resolvedProfile = explicitProfile
|
|
79
|
+
? getPlatformProfile(explicitProfile)
|
|
80
|
+
: undefined
|
|
81
|
+
const qualifyWithProfile = (profileId: string, modelValue: string): string => {
|
|
82
|
+
if (resolvedProfile?.provider.id === 'anthropic') {
|
|
83
|
+
return `${profileId}:${parseUserSpecifiedModel(modelValue)}`
|
|
84
|
+
}
|
|
85
|
+
return `${profileId}:${modelValue}`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (explicitProfile && !toolSpecifiedModel && !agentModel) {
|
|
89
|
+
const profileDefaultModel = getPlatformDefaultModelForProfile(explicitProfile)
|
|
90
|
+
if (profileDefaultModel) {
|
|
91
|
+
return qualifyWithProfile(explicitProfile, profileDefaultModel)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
61
95
|
// Extract Bedrock region prefix from parent model to inherit for subagents.
|
|
62
96
|
// This ensures subagents use the same cross-region inference profile (e.g., "eu.", "us.")
|
|
63
97
|
// as the parent, which is required when IAM permissions only allow specific regions.
|
|
@@ -82,6 +116,9 @@ export function getAgentModel(
|
|
|
82
116
|
|
|
83
117
|
// Prioritize tool-specified model if provided
|
|
84
118
|
if (toolSpecifiedModel) {
|
|
119
|
+
if (explicitProfile) {
|
|
120
|
+
return qualifyWithProfile(explicitProfile, toolSpecifiedModel)
|
|
121
|
+
}
|
|
85
122
|
if (aliasMatchesParentTier(toolSpecifiedModel, parentModel)) {
|
|
86
123
|
return parentModel
|
|
87
124
|
}
|
|
@@ -101,6 +138,10 @@ export function getAgentModel(
|
|
|
101
138
|
})
|
|
102
139
|
}
|
|
103
140
|
|
|
141
|
+
if (explicitProfile) {
|
|
142
|
+
return qualifyWithProfile(explicitProfile, agentModelWithExp)
|
|
143
|
+
}
|
|
144
|
+
|
|
104
145
|
if (aliasMatchesParentTier(agentModelWithExp, parentModel)) {
|
|
105
146
|
return parentModel
|
|
106
147
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModelName } from './model.js'
|
|
2
2
|
import type { APIProvider } from './providers.js'
|
|
3
3
|
|
|
4
|
-
export type ModelConfig = Record<APIProvider, ModelName
|
|
4
|
+
export type ModelConfig = Partial<Record<APIProvider, ModelName>>
|
|
5
5
|
|
|
6
6
|
// @[MODEL LAUNCH]: Add a new CLAUDE_*_CONFIG constant here. Double check the correct model strings
|
|
7
7
|
// here since the pattern may change.
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
import { logForDebugging } from '../debug.js'
|
|
12
12
|
import type { ApiFormat } from './thirdPartyProviders.js'
|
|
13
13
|
|
|
14
|
+
const LOCAL_PROVIDER_HOSTNAMES = new Set(['localhost', '127.0.0.1', '::1'])
|
|
15
|
+
|
|
14
16
|
// ─── Types ───────────────────────────────────────────────────────────────────
|
|
15
17
|
|
|
16
18
|
export interface FetchedModel {
|
|
@@ -110,6 +112,14 @@ function isChatModel(modelId: string): boolean {
|
|
|
110
112
|
return true
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
function isLocalProviderUrl(baseUrl: string): boolean {
|
|
116
|
+
try {
|
|
117
|
+
return LOCAL_PROVIDER_HOSTNAMES.has(new URL(baseUrl).hostname)
|
|
118
|
+
} catch {
|
|
119
|
+
return false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
113
123
|
// ─── Fetch implementations ──────────────────────────────────────────────────
|
|
114
124
|
|
|
115
125
|
/**
|
|
@@ -284,7 +294,7 @@ export async function fetchProviderModels(
|
|
|
284
294
|
const result = await fetchOpenAIModels(baseUrl, apiKey, timeoutMs)
|
|
285
295
|
|
|
286
296
|
// If standard /models failed and URL looks like Ollama, try /api/tags
|
|
287
|
-
if (result.models.length === 0 && baseUrl
|
|
297
|
+
if (result.models.length === 0 && isLocalProviderUrl(baseUrl)) {
|
|
288
298
|
const ollamaResult = await fetchOllamaModels(baseUrl, timeoutMs)
|
|
289
299
|
if (ollamaResult.models.length > 0) {
|
|
290
300
|
return ollamaResult
|