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
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs'
|
|
2
|
+
import { join } from 'path'
|
|
3
|
+
import { DEFAULT_CODEX_BASE_URL, DEFAULT_OPENAI_BASE_URL, resolveCodexAuthPath } from 'src/services/api/openaiProviderConfig.js'
|
|
4
|
+
import { getClaudeConfigHomeDir } from '../envUtils.js'
|
|
5
|
+
import { logForDebugging } from '../debug.js'
|
|
6
|
+
import {
|
|
7
|
+
getSettings_DEPRECATED,
|
|
8
|
+
updateSettingsForSource,
|
|
9
|
+
} from '../settings/settings.js'
|
|
10
|
+
|
|
11
|
+
export type ProviderTransport =
|
|
12
|
+
| 'anthropic_messages'
|
|
13
|
+
| 'openai_chat_completions'
|
|
14
|
+
| 'codex_responses'
|
|
15
|
+
|
|
16
|
+
export type AuthAccountType =
|
|
17
|
+
| 'anthropic_oauth'
|
|
18
|
+
| 'openai_api_key'
|
|
19
|
+
| 'codex_oauth'
|
|
20
|
+
| 'env'
|
|
21
|
+
|
|
22
|
+
export type PlatformModelConfig = {
|
|
23
|
+
id: string
|
|
24
|
+
displayName?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type PlatformProviderConfig = {
|
|
28
|
+
id: string
|
|
29
|
+
name: string
|
|
30
|
+
transport: ProviderTransport
|
|
31
|
+
baseUrl?: string
|
|
32
|
+
headers?: Record<string, string>
|
|
33
|
+
models?: PlatformModelConfig[]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type PlatformAuthAccountConfig = {
|
|
37
|
+
id: string
|
|
38
|
+
name: string
|
|
39
|
+
type: AuthAccountType
|
|
40
|
+
providerId?: string
|
|
41
|
+
apiKey?: string
|
|
42
|
+
apiKeyEnv?: string
|
|
43
|
+
accountId?: string
|
|
44
|
+
authJsonPath?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type PlatformProfileConfig = {
|
|
48
|
+
id: string
|
|
49
|
+
name: string
|
|
50
|
+
providerId: string
|
|
51
|
+
authAccountId?: string
|
|
52
|
+
defaultModel?: string
|
|
53
|
+
baseUrl?: string
|
|
54
|
+
headers?: Record<string, string>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type ResolvedPlatformAuthAccount = PlatformAuthAccountConfig & {
|
|
58
|
+
resolvedApiKey?: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type ResolvedPlatformProfile = {
|
|
62
|
+
profile: PlatformProfileConfig
|
|
63
|
+
provider: PlatformProviderConfig
|
|
64
|
+
authAccount?: ResolvedPlatformAuthAccount
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
type LegacyProviderRecord = {
|
|
68
|
+
id: string
|
|
69
|
+
name: string
|
|
70
|
+
baseUrl: string
|
|
71
|
+
apiFormat?: 'anthropic' | 'openai'
|
|
72
|
+
apiKey?: string
|
|
73
|
+
apiKeyEnv?: string
|
|
74
|
+
accountId?: string
|
|
75
|
+
models?: PlatformModelConfig[]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const PROVIDERS_FILENAME = 'providers.json'
|
|
79
|
+
export const PROFILE_MODEL_SEPARATOR = ':'
|
|
80
|
+
const LOCAL_HOSTNAMES = new Set(['localhost', '127.0.0.1', '::1'])
|
|
81
|
+
|
|
82
|
+
const BUILTIN_PLATFORM_PROVIDERS: PlatformProviderConfig[] = [
|
|
83
|
+
{
|
|
84
|
+
id: 'anthropic',
|
|
85
|
+
name: 'Anthropic',
|
|
86
|
+
transport: 'anthropic_messages',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'openai',
|
|
90
|
+
name: 'OpenAI',
|
|
91
|
+
transport: 'openai_chat_completions',
|
|
92
|
+
baseUrl: DEFAULT_OPENAI_BASE_URL,
|
|
93
|
+
models: [
|
|
94
|
+
{ id: 'gpt-4o', displayName: 'GPT-4o' },
|
|
95
|
+
{ id: 'gpt-4o-mini', displayName: 'GPT-4o Mini' },
|
|
96
|
+
{ id: 'o3', displayName: 'o3' },
|
|
97
|
+
{ id: 'o4-mini', displayName: 'o4-mini' },
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'codex',
|
|
102
|
+
name: 'Codex',
|
|
103
|
+
transport: 'codex_responses',
|
|
104
|
+
baseUrl: DEFAULT_CODEX_BASE_URL,
|
|
105
|
+
models: [
|
|
106
|
+
{ id: 'codexplan', displayName: 'Codex Plan (GPT-5.4)' },
|
|
107
|
+
{ id: 'codexspark', displayName: 'Codex Spark' },
|
|
108
|
+
{ id: 'gpt-5.4', displayName: 'GPT-5.4' },
|
|
109
|
+
{ id: 'gpt-5.3-codex', displayName: 'GPT-5.3 Codex' },
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
const BUILTIN_PLATFORM_AUTH_ACCOUNTS: PlatformAuthAccountConfig[] = [
|
|
115
|
+
{
|
|
116
|
+
id: 'anthropic-oauth',
|
|
117
|
+
name: 'Anthropic OAuth',
|
|
118
|
+
type: 'anthropic_oauth',
|
|
119
|
+
providerId: 'anthropic',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'openai-env',
|
|
123
|
+
name: 'OpenAI API Key',
|
|
124
|
+
type: 'openai_api_key',
|
|
125
|
+
providerId: 'openai',
|
|
126
|
+
apiKeyEnv: 'OPENAI_API_KEY',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 'codex-auth',
|
|
130
|
+
name: 'Codex OAuth',
|
|
131
|
+
type: 'codex_oauth',
|
|
132
|
+
providerId: 'codex',
|
|
133
|
+
authJsonPath: resolveCodexAuthPath(),
|
|
134
|
+
},
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
const BUILTIN_PLATFORM_PROFILES: PlatformProfileConfig[] = [
|
|
138
|
+
{
|
|
139
|
+
id: 'anthropic',
|
|
140
|
+
name: 'Anthropic',
|
|
141
|
+
providerId: 'anthropic',
|
|
142
|
+
authAccountId: 'anthropic-oauth',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'openai',
|
|
146
|
+
name: 'OpenAI',
|
|
147
|
+
providerId: 'openai',
|
|
148
|
+
authAccountId: 'openai-env',
|
|
149
|
+
defaultModel: 'gpt-4o',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: 'codex',
|
|
153
|
+
name: 'Codex',
|
|
154
|
+
providerId: 'codex',
|
|
155
|
+
authAccountId: 'codex-auth',
|
|
156
|
+
defaultModel: 'codexplan',
|
|
157
|
+
},
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
function getLegacyProvidersFilePath(): string {
|
|
161
|
+
return join(getClaudeConfigHomeDir(), PROVIDERS_FILENAME)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function readLegacyProvidersFile(): LegacyProviderRecord[] {
|
|
165
|
+
const filePath = getLegacyProvidersFilePath()
|
|
166
|
+
try {
|
|
167
|
+
if (!existsSync(filePath)) return []
|
|
168
|
+
const content = readFileSync(filePath, 'utf-8')
|
|
169
|
+
const parsed = JSON.parse(content)
|
|
170
|
+
if (Array.isArray(parsed)) return parsed as LegacyProviderRecord[]
|
|
171
|
+
if (parsed && Array.isArray(parsed.providers)) {
|
|
172
|
+
return parsed.providers as LegacyProviderRecord[]
|
|
173
|
+
}
|
|
174
|
+
} catch (error) {
|
|
175
|
+
logForDebugging(`[PlatformProfiles] Failed to read legacy providers: ${error}`)
|
|
176
|
+
}
|
|
177
|
+
return []
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function resolveAuthApiKey(
|
|
181
|
+
account: PlatformAuthAccountConfig | undefined,
|
|
182
|
+
): string | undefined {
|
|
183
|
+
if (!account) return undefined
|
|
184
|
+
|
|
185
|
+
if (account.apiKeyEnv && process.env[account.apiKeyEnv]) {
|
|
186
|
+
return process.env[account.apiKeyEnv]
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (account.apiKey?.startsWith('env:')) {
|
|
190
|
+
const envName = account.apiKey.slice(4)
|
|
191
|
+
return process.env[envName] || undefined
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (account.apiKey) return account.apiKey
|
|
195
|
+
return undefined
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function mergeById<T extends { id: string }>(items: T[]): T[] {
|
|
199
|
+
const merged = new Map<string, T>()
|
|
200
|
+
for (const item of items) merged.set(item.id, item)
|
|
201
|
+
return [...merged.values()]
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function transportFromLegacyProvider(
|
|
205
|
+
provider: LegacyProviderRecord,
|
|
206
|
+
): ProviderTransport {
|
|
207
|
+
if (provider.baseUrl.replace(/\/+$/, '') === DEFAULT_CODEX_BASE_URL) {
|
|
208
|
+
return 'codex_responses'
|
|
209
|
+
}
|
|
210
|
+
if (provider.apiFormat === 'openai') return 'openai_chat_completions'
|
|
211
|
+
return 'anthropic_messages'
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function profileNameFromProvider(provider: LegacyProviderRecord): string {
|
|
215
|
+
return provider.name || provider.id
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export function getPlatformProviders(): PlatformProviderConfig[] {
|
|
219
|
+
const settings = getSettings_DEPRECATED() || {}
|
|
220
|
+
const configured = settings.providers ?? []
|
|
221
|
+
const legacyProviders = readLegacyProvidersFile().map(provider => ({
|
|
222
|
+
id: provider.id,
|
|
223
|
+
name: provider.name,
|
|
224
|
+
transport: transportFromLegacyProvider(provider),
|
|
225
|
+
baseUrl: provider.baseUrl,
|
|
226
|
+
models: provider.models,
|
|
227
|
+
}))
|
|
228
|
+
|
|
229
|
+
return mergeById([
|
|
230
|
+
...BUILTIN_PLATFORM_PROVIDERS,
|
|
231
|
+
...legacyProviders,
|
|
232
|
+
...configured,
|
|
233
|
+
])
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function getPlatformAuthAccounts(): PlatformAuthAccountConfig[] {
|
|
237
|
+
const settings = getSettings_DEPRECATED() || {}
|
|
238
|
+
const configured = settings.authAccounts ?? []
|
|
239
|
+
const legacyAccounts = readLegacyProvidersFile().map(provider => ({
|
|
240
|
+
id: `${provider.id}-legacy-auth`,
|
|
241
|
+
name: `${profileNameFromProvider(provider)} Auth`,
|
|
242
|
+
type:
|
|
243
|
+
transportFromLegacyProvider(provider) === 'codex_responses'
|
|
244
|
+
? ('codex_oauth' as const)
|
|
245
|
+
: provider.apiFormat === 'openai'
|
|
246
|
+
? ('openai_api_key' as const)
|
|
247
|
+
: ('env' as const),
|
|
248
|
+
providerId: provider.id,
|
|
249
|
+
apiKey: provider.apiKey,
|
|
250
|
+
apiKeyEnv: provider.apiKeyEnv,
|
|
251
|
+
accountId: provider.accountId,
|
|
252
|
+
authJsonPath:
|
|
253
|
+
transportFromLegacyProvider(provider) === 'codex_responses'
|
|
254
|
+
? resolveCodexAuthPath()
|
|
255
|
+
: undefined,
|
|
256
|
+
}))
|
|
257
|
+
|
|
258
|
+
return mergeById([
|
|
259
|
+
...BUILTIN_PLATFORM_AUTH_ACCOUNTS,
|
|
260
|
+
...legacyAccounts,
|
|
261
|
+
...configured,
|
|
262
|
+
])
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export function getPlatformProfiles(): PlatformProfileConfig[] {
|
|
266
|
+
const settings = getSettings_DEPRECATED() || {}
|
|
267
|
+
const configured = settings.profiles ?? []
|
|
268
|
+
const legacyProfiles = readLegacyProvidersFile().map(provider => ({
|
|
269
|
+
id: provider.id,
|
|
270
|
+
name: profileNameFromProvider(provider),
|
|
271
|
+
providerId: provider.id,
|
|
272
|
+
authAccountId: `${provider.id}-legacy-auth`,
|
|
273
|
+
defaultModel: provider.models?.[0]?.id,
|
|
274
|
+
baseUrl: provider.baseUrl,
|
|
275
|
+
}))
|
|
276
|
+
|
|
277
|
+
return mergeById([
|
|
278
|
+
...BUILTIN_PLATFORM_PROFILES,
|
|
279
|
+
...legacyProfiles,
|
|
280
|
+
...configured,
|
|
281
|
+
])
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export function getPlatformProfile(profileId: string): ResolvedPlatformProfile | null {
|
|
285
|
+
const profile = getPlatformProfiles().find(item => item.id === profileId)
|
|
286
|
+
if (!profile) return null
|
|
287
|
+
const provider = getPlatformProviders().find(item => item.id === profile.providerId)
|
|
288
|
+
if (!provider) return null
|
|
289
|
+
const authAccount = profile.authAccountId
|
|
290
|
+
? getPlatformAuthAccounts().find(item => item.id === profile.authAccountId)
|
|
291
|
+
: undefined
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
profile,
|
|
295
|
+
provider,
|
|
296
|
+
authAccount: authAccount
|
|
297
|
+
? {
|
|
298
|
+
...authAccount,
|
|
299
|
+
resolvedApiKey: resolveAuthApiKey(authAccount),
|
|
300
|
+
}
|
|
301
|
+
: undefined,
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function getDefaultProfileId(): string | undefined {
|
|
306
|
+
const settings = getSettings_DEPRECATED() || {}
|
|
307
|
+
return settings.defaultProfile
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export function getDefaultSubagentProfileId(): string | undefined {
|
|
311
|
+
const settings = getSettings_DEPRECATED() || {}
|
|
312
|
+
return settings.defaultSubagentProfile ?? settings.defaultProfile
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export function parseProfileQualifiedModel(
|
|
316
|
+
model: string,
|
|
317
|
+
): { profileId: string; modelId: string } | null {
|
|
318
|
+
const separator = model.indexOf(PROFILE_MODEL_SEPARATOR)
|
|
319
|
+
if (separator === -1) return null
|
|
320
|
+
|
|
321
|
+
const profileId = model.slice(0, separator).trim()
|
|
322
|
+
const modelId = model.slice(separator + 1).trim()
|
|
323
|
+
if (!profileId || !modelId) return null
|
|
324
|
+
|
|
325
|
+
if (!getPlatformProfiles().some(profile => profile.id === profileId)) {
|
|
326
|
+
return null
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return { profileId, modelId }
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export function isProfileQualifiedModel(model: string): boolean {
|
|
333
|
+
return parseProfileQualifiedModel(model) !== null
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export function getPlatformDefaultModelForProfile(profileId: string): string | undefined {
|
|
337
|
+
const resolved = getPlatformProfile(profileId)
|
|
338
|
+
if (!resolved) return undefined
|
|
339
|
+
return (
|
|
340
|
+
resolved.profile.defaultModel ??
|
|
341
|
+
resolved.provider.models?.[0]?.id
|
|
342
|
+
)
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export function getAllPlatformModels(): Array<{
|
|
346
|
+
qualifiedId: string
|
|
347
|
+
displayName: string
|
|
348
|
+
profileId: string
|
|
349
|
+
profileName: string
|
|
350
|
+
providerId: string
|
|
351
|
+
providerName: string
|
|
352
|
+
modelId: string
|
|
353
|
+
}> {
|
|
354
|
+
const profiles = getPlatformProfiles()
|
|
355
|
+
const results: Array<{
|
|
356
|
+
qualifiedId: string
|
|
357
|
+
displayName: string
|
|
358
|
+
profileId: string
|
|
359
|
+
profileName: string
|
|
360
|
+
providerId: string
|
|
361
|
+
providerName: string
|
|
362
|
+
modelId: string
|
|
363
|
+
}> = []
|
|
364
|
+
|
|
365
|
+
for (const profile of profiles) {
|
|
366
|
+
const resolved = getPlatformProfile(profile.id)
|
|
367
|
+
if (!resolved) continue
|
|
368
|
+
|
|
369
|
+
const apiKey = resolved.authAccount?.resolvedApiKey
|
|
370
|
+
const allowsAnonymous =
|
|
371
|
+
resolved.provider.transport !== 'anthropic_messages' &&
|
|
372
|
+
(() => {
|
|
373
|
+
try {
|
|
374
|
+
return LOCAL_HOSTNAMES.has(
|
|
375
|
+
new URL(resolved.profile.baseUrl ?? resolved.provider.baseUrl ?? '')
|
|
376
|
+
.hostname,
|
|
377
|
+
)
|
|
378
|
+
} catch {
|
|
379
|
+
return false
|
|
380
|
+
}
|
|
381
|
+
})()
|
|
382
|
+
|
|
383
|
+
if (
|
|
384
|
+
resolved.provider.id !== 'anthropic' &&
|
|
385
|
+
!apiKey &&
|
|
386
|
+
!allowsAnonymous &&
|
|
387
|
+
resolved.authAccount?.type !== 'anthropic_oauth'
|
|
388
|
+
) {
|
|
389
|
+
continue
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
for (const model of resolved.provider.models ?? []) {
|
|
393
|
+
results.push({
|
|
394
|
+
qualifiedId: `${profile.id}:${model.id}`,
|
|
395
|
+
displayName:
|
|
396
|
+
model.displayName ??
|
|
397
|
+
`${model.id} (${profile.name})`,
|
|
398
|
+
profileId: profile.id,
|
|
399
|
+
profileName: profile.name,
|
|
400
|
+
providerId: resolved.provider.id,
|
|
401
|
+
providerName: resolved.provider.name,
|
|
402
|
+
modelId: model.id,
|
|
403
|
+
})
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return results
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export function getPlatformModelDisplayName(model: string): string | null {
|
|
411
|
+
const parsed = parseProfileQualifiedModel(model)
|
|
412
|
+
if (!parsed) return null
|
|
413
|
+
const resolved = getPlatformProfile(parsed.profileId)
|
|
414
|
+
if (!resolved) return null
|
|
415
|
+
const modelConfig = resolved.provider.models?.find(
|
|
416
|
+
item => item.id === parsed.modelId,
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
return (
|
|
420
|
+
modelConfig?.displayName ??
|
|
421
|
+
`${parsed.modelId} (${resolved.profile.name})`
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export function resolvePlatformModelTarget(params: {
|
|
426
|
+
model?: string
|
|
427
|
+
profileId?: string
|
|
428
|
+
useDefaultProfile?: boolean
|
|
429
|
+
defaultProfileId?: string
|
|
430
|
+
}): {
|
|
431
|
+
profileId: string
|
|
432
|
+
modelId: string
|
|
433
|
+
profile: PlatformProfileConfig
|
|
434
|
+
provider: PlatformProviderConfig
|
|
435
|
+
authAccount?: ResolvedPlatformAuthAccount
|
|
436
|
+
} | null {
|
|
437
|
+
const parsed = params.model ? parseProfileQualifiedModel(params.model) : null
|
|
438
|
+
const profileId =
|
|
439
|
+
params.profileId ??
|
|
440
|
+
parsed?.profileId ??
|
|
441
|
+
params.defaultProfileId ??
|
|
442
|
+
(params.useDefaultProfile ? getDefaultProfileId() : undefined)
|
|
443
|
+
|
|
444
|
+
if (!profileId) return null
|
|
445
|
+
|
|
446
|
+
const resolved = getPlatformProfile(profileId)
|
|
447
|
+
if (!resolved) return null
|
|
448
|
+
const modelId =
|
|
449
|
+
parsed?.modelId ??
|
|
450
|
+
params.model ??
|
|
451
|
+
getPlatformDefaultModelForProfile(profileId)
|
|
452
|
+
|
|
453
|
+
if (!modelId) return null
|
|
454
|
+
|
|
455
|
+
return {
|
|
456
|
+
profileId,
|
|
457
|
+
modelId,
|
|
458
|
+
profile: resolved.profile,
|
|
459
|
+
provider: resolved.provider,
|
|
460
|
+
authAccount: resolved.authAccount,
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function upsertById<T extends { id: string }>(items: T[], item: T): T[] {
|
|
465
|
+
const next = items.filter(existing => existing.id !== item.id)
|
|
466
|
+
next.push(item)
|
|
467
|
+
return next
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export function syncLegacyProviderToPlatformSettings(provider: {
|
|
471
|
+
id: string
|
|
472
|
+
name: string
|
|
473
|
+
baseUrl: string
|
|
474
|
+
apiFormat?: 'anthropic' | 'openai'
|
|
475
|
+
apiKey?: string
|
|
476
|
+
apiKeyEnv?: string
|
|
477
|
+
accountId?: string
|
|
478
|
+
models: PlatformModelConfig[]
|
|
479
|
+
}): { error: Error | null } {
|
|
480
|
+
const settings = getSettings_DEPRECATED() || {}
|
|
481
|
+
const providerConfig: PlatformProviderConfig = {
|
|
482
|
+
id: provider.id,
|
|
483
|
+
name: provider.name,
|
|
484
|
+
transport: transportFromLegacyProvider(provider),
|
|
485
|
+
baseUrl: provider.baseUrl,
|
|
486
|
+
models: provider.models,
|
|
487
|
+
}
|
|
488
|
+
const authAccountId = `${provider.id}-legacy-auth`
|
|
489
|
+
const authAccountConfig: PlatformAuthAccountConfig = {
|
|
490
|
+
id: authAccountId,
|
|
491
|
+
name: `${provider.name} Auth`,
|
|
492
|
+
type:
|
|
493
|
+
providerConfig.transport === 'codex_responses'
|
|
494
|
+
? 'codex_oauth'
|
|
495
|
+
: provider.apiFormat === 'openai'
|
|
496
|
+
? 'openai_api_key'
|
|
497
|
+
: 'env',
|
|
498
|
+
providerId: provider.id,
|
|
499
|
+
apiKey: provider.apiKey,
|
|
500
|
+
apiKeyEnv: provider.apiKeyEnv,
|
|
501
|
+
accountId: provider.accountId,
|
|
502
|
+
authJsonPath:
|
|
503
|
+
providerConfig.transport === 'codex_responses'
|
|
504
|
+
? resolveCodexAuthPath()
|
|
505
|
+
: undefined,
|
|
506
|
+
}
|
|
507
|
+
const profileConfig: PlatformProfileConfig = {
|
|
508
|
+
id: provider.id,
|
|
509
|
+
name: provider.name,
|
|
510
|
+
providerId: provider.id,
|
|
511
|
+
authAccountId,
|
|
512
|
+
defaultModel: provider.models[0]?.id,
|
|
513
|
+
baseUrl: provider.baseUrl,
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
return updateSettingsForSource('userSettings', {
|
|
517
|
+
providers: upsertById(settings.providers ?? [], providerConfig),
|
|
518
|
+
authAccounts: upsertById(settings.authAccounts ?? [], authAccountConfig),
|
|
519
|
+
profiles: upsertById(settings.profiles ?? [], profileConfig),
|
|
520
|
+
defaultProfile: settings.defaultProfile ?? profileConfig.id,
|
|
521
|
+
defaultSubagentProfile:
|
|
522
|
+
settings.defaultSubagentProfile ?? settings.defaultProfile ?? profileConfig.id,
|
|
523
|
+
})
|
|
524
|
+
}
|