mumucc 0.4.2 → 0.4.3

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.
Files changed (645) hide show
  1. package/AGENTS.md +297 -0
  2. package/bin/mumucc +3 -8
  3. package/bun.lock +44 -141
  4. package/defaults/mcp-servers.json +0 -6
  5. package/package.json +3 -3
  6. package/shims/bun-bundle.ts +0 -3
  7. package/shims/globals.d.ts +15 -0
  8. package/shims/globals.ts +1 -1
  9. package/src/QueryEngine.ts +1 -0
  10. package/src/assistant/gate.ts +4 -1
  11. package/src/assistant/index.ts +29 -1
  12. package/src/assistant/sessionDiscovery.ts +10 -1
  13. package/src/bootstrap/state.ts +6 -1
  14. package/src/buddy/CompanionSprite.tsx +1 -0
  15. package/src/buddy/observer.ts +6 -0
  16. package/src/buddy/useBuddyNotification.tsx +1 -0
  17. package/src/cli/handlers/util.tsx +1 -0
  18. package/src/cli/print.ts +4 -1
  19. package/src/cli/structuredIO.ts +6 -1
  20. package/src/commands/add-dir/add-dir.tsx +1 -0
  21. package/src/commands/branch/branch.ts +1 -0
  22. package/src/commands/bridge/bridge.tsx +2 -1
  23. package/src/commands/btw/btw.tsx +1 -0
  24. package/src/commands/buddy/index.ts +2 -1
  25. package/src/commands/chrome/chrome.tsx +1 -0
  26. package/src/commands/clear/caches.ts +1 -0
  27. package/src/commands/compact/compact.ts +1 -0
  28. package/src/commands/context/context-noninteractive.ts +1 -0
  29. package/src/commands/context/context.tsx +1 -0
  30. package/src/commands/copy/copy.tsx +2 -1
  31. package/src/commands/effort/effort.tsx +1 -0
  32. package/src/commands/extra-usage/extra-usage.tsx +1 -0
  33. package/src/commands/fast/fast.tsx +1 -0
  34. package/src/commands/fork/index.ts +2 -1
  35. package/src/commands/ide/ide.tsx +2 -1
  36. package/src/commands/insights.ts +1 -0
  37. package/src/commands/install-github-app/ApiKeyStep.tsx +1 -0
  38. package/src/commands/install-github-app/CheckExistingSecretStep.tsx +1 -0
  39. package/src/commands/install-github-app/ChooseRepoStep.tsx +1 -0
  40. package/src/commands/install-github-app/CreatingStep.tsx +1 -0
  41. package/src/commands/install-github-app/ErrorStep.tsx +1 -0
  42. package/src/commands/install-github-app/ExistingWorkflowStep.tsx +1 -0
  43. package/src/commands/install-github-app/InstallAppStep.tsx +1 -0
  44. package/src/commands/install-github-app/OAuthFlowStep.tsx +1 -0
  45. package/src/commands/install-github-app/SuccessStep.tsx +1 -0
  46. package/src/commands/install-github-app/WarningsStep.tsx +1 -0
  47. package/src/commands/install-github-app/install-github-app.tsx +2 -1
  48. package/src/commands/install.tsx +1 -0
  49. package/src/commands/login/CodexLogin.tsx +39 -12
  50. package/src/commands/login/CustomProviderLogin.tsx +45 -9
  51. package/src/commands/login/ThirdPartyLogin.tsx +24 -6
  52. package/src/commands/login/login.tsx +37 -10
  53. package/src/commands/login/profileDefaults.ts +25 -0
  54. package/src/commands/mcp/mcp.tsx +1 -0
  55. package/src/commands/mobile/mobile.tsx +1 -0
  56. package/src/commands/model/model.tsx +14 -3
  57. package/src/commands/peers/index.ts +2 -1
  58. package/src/commands/permissions/permissions.tsx +1 -0
  59. package/src/commands/plan/plan.tsx +1 -0
  60. package/src/commands/plugin/DiscoverPlugins.tsx +1 -0
  61. package/src/commands/plugin/ManageMarketplaces.tsx +1 -0
  62. package/src/commands/plugin/ManagePlugins.tsx +1 -0
  63. package/src/commands/plugin/PluginOptionsDialog.tsx +1 -0
  64. package/src/commands/plugin/PluginSettings.tsx +2 -1
  65. package/src/commands/plugin/UnifiedInstalledCell.tsx +1 -0
  66. package/src/commands/plugin/ValidatePlugin.tsx +1 -0
  67. package/src/commands/plugin/pluginDetailsHelpers.tsx +1 -0
  68. package/src/commands/rate-limit-options/rate-limit-options.tsx +1 -0
  69. package/src/commands/remote-setup/remote-setup.tsx +1 -0
  70. package/src/commands/resume/resume.tsx +1 -0
  71. package/src/commands/review/UltrareviewOverageDialog.tsx +1 -0
  72. package/src/commands/review/ultrareviewCommand.tsx +1 -0
  73. package/src/commands/session/session.tsx +1 -0
  74. package/src/commands/tag/tag.tsx +1 -0
  75. package/src/commands/terminalSetup/terminalSetup.tsx +1 -0
  76. package/src/commands/theme/theme.tsx +1 -0
  77. package/src/commands/thinkback/thinkback.tsx +2 -1
  78. package/src/commands/ultraplan.tsx +11 -1
  79. package/src/commands/upgrade/upgrade.tsx +1 -0
  80. package/src/commands/workflows/index.ts +2 -1
  81. package/src/components/AgentProgressLine.tsx +1 -0
  82. package/src/components/App.tsx +1 -0
  83. package/src/components/ApproveApiKey.tsx +1 -0
  84. package/src/components/AutoModeOptInDialog.tsx +1 -0
  85. package/src/components/AutoUpdater.tsx +1 -0
  86. package/src/components/AutoUpdaterWrapper.tsx +1 -0
  87. package/src/components/AwsAuthStatusBox.tsx +1 -0
  88. package/src/components/BaseTextInput.tsx +1 -0
  89. package/src/components/BashModeProgress.tsx +1 -0
  90. package/src/components/BridgeDialog.tsx +2 -1
  91. package/src/components/BypassPermissionsModeDialog.tsx +1 -0
  92. package/src/components/ChannelDowngradeDialog.tsx +1 -0
  93. package/src/components/ClaudeInChromeOnboarding.tsx +1 -0
  94. package/src/components/ClaudeMdExternalIncludesDialog.tsx +1 -0
  95. package/src/components/ClickableImageRef.tsx +1 -0
  96. package/src/components/CompactSummary.tsx +1 -0
  97. package/src/components/ConfigurableShortcutHint.tsx +1 -0
  98. package/src/components/ConsoleOAuthFlow.tsx +1 -0
  99. package/src/components/ContextSuggestions.tsx +1 -0
  100. package/src/components/ContextVisualization.tsx +2 -1
  101. package/src/components/CoordinatorAgentStatus.tsx +3 -4
  102. package/src/components/CostThresholdDialog.tsx +1 -0
  103. package/src/components/CtrlOToExpand.tsx +1 -0
  104. package/src/components/CustomSelect/SelectMulti.tsx +1 -0
  105. package/src/components/CustomSelect/select-input-option.tsx +1 -0
  106. package/src/components/CustomSelect/select-option.tsx +1 -0
  107. package/src/components/CustomSelect/select.tsx +2 -1
  108. package/src/components/CustomSelect/use-multi-select-state.ts +1 -0
  109. package/src/components/DesktopHandoff.tsx +1 -0
  110. package/src/components/DesktopUpsell/DesktopUpsellStartup.tsx +1 -0
  111. package/src/components/DevBar.tsx +1 -0
  112. package/src/components/DevChannelsDialog.tsx +1 -0
  113. package/src/components/DiagnosticsDisplay.tsx +1 -0
  114. package/src/components/EffortCallout.tsx +1 -0
  115. package/src/components/ExitFlow.tsx +1 -0
  116. package/src/components/FallbackToolUseErrorMessage.tsx +1 -0
  117. package/src/components/FastIcon.tsx +1 -0
  118. package/src/components/Feedback.tsx +1 -0
  119. package/src/components/FeedbackSurvey/FeedbackSurvey.tsx +1 -0
  120. package/src/components/FeedbackSurvey/FeedbackSurveyView.tsx +1 -0
  121. package/src/components/FeedbackSurvey/TranscriptSharePrompt.tsx +1 -0
  122. package/src/components/FeedbackSurvey/useFrustrationDetection.ts +6 -1
  123. package/src/components/FeedbackSurvey/useMemorySurvey.tsx +1 -0
  124. package/src/components/FeedbackSurvey/usePostCompactSurvey.tsx +2 -1
  125. package/src/components/FileEditToolDiff.tsx +1 -0
  126. package/src/components/FileEditToolUpdatedMessage.tsx +1 -0
  127. package/src/components/FileEditToolUseRejectedMessage.tsx +1 -0
  128. package/src/components/FilePathLink.tsx +1 -0
  129. package/src/components/FullscreenLayout.tsx +1 -0
  130. package/src/components/GlobalSearchDialog.tsx +2 -1
  131. package/src/components/HelpV2/Commands.tsx +1 -0
  132. package/src/components/HelpV2/HelpV2.tsx +1 -0
  133. package/src/components/HighlightedCode/Fallback.tsx +1 -0
  134. package/src/components/HighlightedCode.tsx +1 -0
  135. package/src/components/HistorySearchDialog.tsx +1 -0
  136. package/src/components/IdeAutoConnectDialog.tsx +1 -0
  137. package/src/components/IdeOnboardingDialog.tsx +1 -0
  138. package/src/components/IdeStatusIndicator.tsx +1 -0
  139. package/src/components/IdleReturnDialog.tsx +1 -0
  140. package/src/components/InvalidConfigDialog.tsx +1 -0
  141. package/src/components/InvalidSettingsDialog.tsx +1 -0
  142. package/src/components/KeybindingWarnings.tsx +1 -0
  143. package/src/components/LanguagePicker.tsx +1 -0
  144. package/src/components/LogSelector.tsx +2 -1
  145. package/src/components/LogoV2/ChannelsNotice.tsx +6 -5
  146. package/src/components/LogoV2/Clawd.tsx +1 -0
  147. package/src/components/LogoV2/CondensedLogo.tsx +1 -0
  148. package/src/components/LogoV2/Feed.tsx +1 -0
  149. package/src/components/LogoV2/FeedColumn.tsx +1 -0
  150. package/src/components/LogoV2/LogoV2.tsx +2 -1
  151. package/src/components/LogoV2/OverageCreditUpsell.tsx +1 -0
  152. package/src/components/LogoV2/WelcomeV2.tsx +1 -0
  153. package/src/components/LogoV2/feedConfigs.tsx +1 -0
  154. package/src/components/MCPServerApprovalDialog.tsx +1 -0
  155. package/src/components/MCPServerDesktopImportDialog.tsx +1 -0
  156. package/src/components/MCPServerMultiselectDialog.tsx +1 -0
  157. package/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.tsx +1 -0
  158. package/src/components/Markdown.tsx +1 -0
  159. package/src/components/MemoryUsageIndicator.tsx +1 -0
  160. package/src/components/Message.tsx +2 -1
  161. package/src/components/MessageModel.tsx +1 -0
  162. package/src/components/MessageResponse.tsx +1 -0
  163. package/src/components/MessageRow.tsx +1 -0
  164. package/src/components/MessageSelector.tsx +2 -1
  165. package/src/components/MessageTimestamp.tsx +1 -0
  166. package/src/components/Messages.tsx +1 -0
  167. package/src/components/ModelPicker.tsx +4 -3
  168. package/src/components/NativeAutoUpdater.tsx +1 -0
  169. package/src/components/NotebookEditToolUseRejectedMessage.tsx +1 -0
  170. package/src/components/Onboarding.tsx +1 -0
  171. package/src/components/OutputStylePicker.tsx +1 -0
  172. package/src/components/PackageManagerAutoUpdater.tsx +1 -0
  173. package/src/components/PrBadge.tsx +1 -0
  174. package/src/components/PromptInput/HistorySearchInput.tsx +1 -0
  175. package/src/components/PromptInput/Notifications.tsx +1 -0
  176. package/src/components/PromptInput/PromptInput.tsx +10 -8
  177. package/src/components/PromptInput/PromptInputFooter.tsx +1 -0
  178. package/src/components/PromptInput/PromptInputFooterLeftSide.tsx +1 -0
  179. package/src/components/PromptInput/PromptInputFooterSuggestions.tsx +1 -0
  180. package/src/components/PromptInput/PromptInputHelpMenu.tsx +1 -0
  181. package/src/components/PromptInput/PromptInputModeIndicator.tsx +1 -0
  182. package/src/components/PromptInput/PromptInputStashNotice.tsx +1 -0
  183. package/src/components/PromptInput/SandboxPromptFooterHint.tsx +1 -0
  184. package/src/components/PromptInput/ShimmeredInput.tsx +1 -0
  185. package/src/components/PromptInput/VoiceIndicator.tsx +1 -0
  186. package/src/components/QuickOpenDialog.tsx +2 -1
  187. package/src/components/RemoteEnvironmentDialog.tsx +2 -1
  188. package/src/components/ResumeTask.tsx +1 -0
  189. package/src/components/SandboxViolationExpandedView.tsx +1 -0
  190. package/src/components/SearchBox.tsx +1 -0
  191. package/src/components/SessionBackgroundHint.tsx +1 -0
  192. package/src/components/SessionPreview.tsx +1 -0
  193. package/src/components/Settings/Config.tsx +1 -0
  194. package/src/components/Settings/Settings.tsx +1 -0
  195. package/src/components/Settings/Status.tsx +2 -1
  196. package/src/components/Settings/Usage.tsx +1 -0
  197. package/src/components/ShowInIDEPrompt.tsx +1 -0
  198. package/src/components/SkillImprovementSurvey.tsx +1 -0
  199. package/src/components/Spinner/FlashingChar.tsx +1 -0
  200. package/src/components/Spinner/GlimmerMessage.tsx +1 -0
  201. package/src/components/Spinner/ShimmerChar.tsx +1 -0
  202. package/src/components/Spinner/SpinnerAnimationRow.tsx +1 -0
  203. package/src/components/Spinner/SpinnerGlyph.tsx +1 -0
  204. package/src/components/Spinner/TeammateSpinnerTree.tsx +1 -0
  205. package/src/components/Spinner/utils.ts +1 -0
  206. package/src/components/Spinner.tsx +2 -1
  207. package/src/components/Stats.tsx +2 -1
  208. package/src/components/StatusNotices.tsx +1 -0
  209. package/src/components/StructuredDiff/Fallback.tsx +1 -0
  210. package/src/components/StructuredDiff.tsx +2 -1
  211. package/src/components/StructuredDiffList.tsx +1 -0
  212. package/src/components/TaskListV2.tsx +1 -0
  213. package/src/components/TeammateViewHeader.tsx +1 -0
  214. package/src/components/TeleportError.tsx +1 -0
  215. package/src/components/TeleportProgress.tsx +1 -0
  216. package/src/components/TeleportRepoMismatchDialog.tsx +1 -0
  217. package/src/components/TeleportResumeWrapper.tsx +1 -0
  218. package/src/components/TextInput.tsx +1 -0
  219. package/src/components/ThemePicker.tsx +1 -0
  220. package/src/components/ThinkingToggle.tsx +1 -0
  221. package/src/components/TokenWarning.tsx +1 -0
  222. package/src/components/ToolUseLoader.tsx +1 -0
  223. package/src/components/TrustDialog/TrustDialog.tsx +1 -0
  224. package/src/components/ValidationErrorsList.tsx +1 -0
  225. package/src/components/VimTextInput.tsx +1 -0
  226. package/src/components/VirtualMessageList.tsx +1 -0
  227. package/src/components/WorkflowMultiselectDialog.tsx +1 -0
  228. package/src/components/agents/AgentDetail.tsx +1 -0
  229. package/src/components/agents/AgentEditor.tsx +1 -0
  230. package/src/components/agents/AgentNavigationFooter.tsx +1 -0
  231. package/src/components/agents/AgentsList.tsx +2 -1
  232. package/src/components/agents/AgentsMenu.tsx +2 -1
  233. package/src/components/agents/ColorPicker.tsx +1 -0
  234. package/src/components/agents/ModelSelector.tsx +1 -0
  235. package/src/components/agents/ToolSelector.tsx +2 -1
  236. package/src/components/agents/generateAgent.ts +1 -0
  237. package/src/components/agents/new-agent-creation/CreateAgentWizard.tsx +1 -0
  238. package/src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx +1 -0
  239. package/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx +1 -0
  240. package/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx +1 -0
  241. package/src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx +1 -0
  242. package/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx +1 -0
  243. package/src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx +1 -0
  244. package/src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx +1 -0
  245. package/src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx +1 -0
  246. package/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx +1 -0
  247. package/src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx +1 -0
  248. package/src/components/design-system/Byline.tsx +1 -0
  249. package/src/components/design-system/Dialog.tsx +1 -0
  250. package/src/components/design-system/Divider.tsx +1 -0
  251. package/src/components/design-system/FuzzyPicker.tsx +1 -0
  252. package/src/components/design-system/KeyboardShortcutHint.tsx +1 -0
  253. package/src/components/design-system/ListItem.tsx +1 -0
  254. package/src/components/design-system/LoadingState.tsx +1 -0
  255. package/src/components/design-system/Pane.tsx +1 -0
  256. package/src/components/design-system/ProgressBar.tsx +1 -0
  257. package/src/components/design-system/Ratchet.tsx +1 -0
  258. package/src/components/design-system/StatusIcon.tsx +1 -0
  259. package/src/components/design-system/Tabs.tsx +2 -1
  260. package/src/components/design-system/ThemeProvider.tsx +1 -0
  261. package/src/components/design-system/ThemedBox.tsx +1 -0
  262. package/src/components/design-system/ThemedText.tsx +1 -0
  263. package/src/components/diff/DiffDetailView.tsx +1 -0
  264. package/src/components/diff/DiffDialog.tsx +1 -0
  265. package/src/components/diff/DiffFileList.tsx +1 -0
  266. package/src/components/grove/Grove.tsx +2 -1
  267. package/src/components/hooks/HooksConfigMenu.tsx +2 -1
  268. package/src/components/hooks/PromptDialog.tsx +1 -0
  269. package/src/components/hooks/SelectEventMode.tsx +1 -0
  270. package/src/components/hooks/SelectHookMode.tsx +1 -0
  271. package/src/components/hooks/SelectMatcherMode.tsx +1 -0
  272. package/src/components/hooks/ViewHookMode.tsx +1 -0
  273. package/src/components/mcp/CapabilitiesSection.tsx +1 -0
  274. package/src/components/mcp/ElicitationDialog.tsx +1 -0
  275. package/src/components/mcp/MCPAgentServerMenu.tsx +1 -0
  276. package/src/components/mcp/MCPListPanel.tsx +2 -1
  277. package/src/components/mcp/MCPReconnect.tsx +1 -0
  278. package/src/components/mcp/MCPRemoteServerMenu.tsx +1 -0
  279. package/src/components/mcp/MCPSettings.tsx +2 -1
  280. package/src/components/mcp/MCPStdioServerMenu.tsx +1 -0
  281. package/src/components/mcp/MCPToolDetailView.tsx +1 -0
  282. package/src/components/mcp/MCPToolListView.tsx +1 -0
  283. package/src/components/mcp/McpParsingWarnings.tsx +1 -0
  284. package/src/components/memory/MemoryFileSelector.tsx +2 -1
  285. package/src/components/memory/MemoryUpdateNotification.tsx +1 -0
  286. package/src/components/messageActions.tsx +1 -0
  287. package/src/components/messages/AdvisorMessage.tsx +1 -0
  288. package/src/components/messages/AssistantRedactedThinkingMessage.tsx +1 -0
  289. package/src/components/messages/AssistantTextMessage.tsx +1 -0
  290. package/src/components/messages/AssistantThinkingMessage.tsx +1 -0
  291. package/src/components/messages/AssistantToolUseMessage.tsx +1 -0
  292. package/src/components/messages/AttachmentMessage.tsx +2 -1
  293. package/src/components/messages/CollapsedReadSearchContent.tsx +2 -1
  294. package/src/components/messages/GroupedToolUseContent.tsx +1 -0
  295. package/src/components/messages/HighlightedThinkingText.tsx +1 -0
  296. package/src/components/messages/HookProgressMessage.tsx +1 -0
  297. package/src/components/messages/PlanApprovalMessage.tsx +1 -0
  298. package/src/components/messages/RateLimitMessage.tsx +1 -0
  299. package/src/components/messages/ShutdownMessage.tsx +1 -0
  300. package/src/components/messages/SystemAPIErrorMessage.tsx +1 -0
  301. package/src/components/messages/SystemTextMessage.tsx +2 -1
  302. package/src/components/messages/TaskAssignmentMessage.tsx +1 -0
  303. package/src/components/messages/UserAgentNotificationMessage.tsx +1 -0
  304. package/src/components/messages/UserBashInputMessage.tsx +1 -0
  305. package/src/components/messages/UserBashOutputMessage.tsx +1 -0
  306. package/src/components/messages/UserChannelMessage.tsx +1 -0
  307. package/src/components/messages/UserCommandMessage.tsx +1 -0
  308. package/src/components/messages/UserImageMessage.tsx +1 -0
  309. package/src/components/messages/UserLocalCommandOutputMessage.tsx +1 -0
  310. package/src/components/messages/UserMemoryInputMessage.tsx +1 -0
  311. package/src/components/messages/UserPlanMessage.tsx +1 -0
  312. package/src/components/messages/UserResourceUpdateMessage.tsx +1 -0
  313. package/src/components/messages/UserTeammateMessage.tsx +1 -0
  314. package/src/components/messages/UserTextMessage.tsx +1 -0
  315. package/src/components/messages/UserToolResultMessage/RejectedPlanMessage.tsx +1 -0
  316. package/src/components/messages/UserToolResultMessage/UserToolErrorMessage.tsx +1 -0
  317. package/src/components/messages/UserToolResultMessage/UserToolRejectMessage.tsx +1 -0
  318. package/src/components/messages/UserToolResultMessage/UserToolResultMessage.tsx +1 -0
  319. package/src/components/messages/UserToolResultMessage/utils.tsx +1 -0
  320. package/src/components/messages/nullRenderingAttachments.ts +1 -0
  321. package/src/components/messages/teamMemCollapsed.tsx +1 -0
  322. package/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.tsx +2 -1
  323. package/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.tsx +1 -0
  324. package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.tsx +2 -1
  325. package/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.tsx +2 -1
  326. package/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.tsx +1 -0
  327. package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.tsx +1 -0
  328. package/src/components/permissions/BashPermissionRequest/bashToolUseOptions.tsx +1 -0
  329. package/src/components/permissions/ComputerUseApproval/ComputerUseApproval.tsx +2 -1
  330. package/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.tsx +1 -0
  331. package/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.tsx +1 -0
  332. package/src/components/permissions/FallbackPermissionRequest.tsx +1 -0
  333. package/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.tsx +1 -0
  334. package/src/components/permissions/FilePermissionDialog/FilePermissionDialog.tsx +1 -0
  335. package/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.tsx +1 -0
  336. package/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.tsx +1 -0
  337. package/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.tsx +1 -0
  338. package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.tsx +1 -0
  339. package/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.tsx +2 -1
  340. package/src/components/permissions/PermissionDecisionDebugInfo.tsx +2 -1
  341. package/src/components/permissions/PermissionDialog.tsx +1 -0
  342. package/src/components/permissions/PermissionExplanation.tsx +2 -1
  343. package/src/components/permissions/PermissionPrompt.tsx +2 -1
  344. package/src/components/permissions/PermissionRequest.tsx +1 -0
  345. package/src/components/permissions/PermissionRequestTitle.tsx +1 -0
  346. package/src/components/permissions/PermissionRuleExplanation.tsx +1 -0
  347. package/src/components/permissions/SandboxPermissionRequest.tsx +1 -0
  348. package/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.tsx +1 -0
  349. package/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.tsx +1 -0
  350. package/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.tsx +1 -0
  351. package/src/components/permissions/WorkerBadge.tsx +1 -0
  352. package/src/components/permissions/WorkerPendingPermission.tsx +1 -0
  353. package/src/components/permissions/rules/AddPermissionRules.tsx +1 -0
  354. package/src/components/permissions/rules/AddWorkspaceDirectory.tsx +2 -1
  355. package/src/components/permissions/rules/PermissionRuleDescription.tsx +1 -0
  356. package/src/components/permissions/rules/PermissionRuleInput.tsx +1 -0
  357. package/src/components/permissions/rules/PermissionRuleList.tsx +2 -1
  358. package/src/components/permissions/rules/RecentDenialsTab.tsx +1 -0
  359. package/src/components/permissions/rules/RemoveWorkspaceDirectory.tsx +1 -0
  360. package/src/components/permissions/rules/WorkspaceTab.tsx +1 -0
  361. package/src/components/sandbox/SandboxConfigTab.tsx +1 -0
  362. package/src/components/sandbox/SandboxDependenciesTab.tsx +1 -0
  363. package/src/components/sandbox/SandboxDoctorSection.tsx +1 -0
  364. package/src/components/sandbox/SandboxOverridesTab.tsx +1 -0
  365. package/src/components/sandbox/SandboxSettings.tsx +1 -0
  366. package/src/components/shell/ExpandShellOutputContext.tsx +1 -0
  367. package/src/components/shell/OutputLine.tsx +1 -0
  368. package/src/components/shell/ShellProgressMessage.tsx +1 -0
  369. package/src/components/shell/ShellTimeDisplay.tsx +1 -0
  370. package/src/components/skills/SkillsMenu.tsx +1 -0
  371. package/src/components/tasks/AsyncAgentDetailDialog.tsx +1 -0
  372. package/src/components/tasks/BackgroundTask.tsx +1 -0
  373. package/src/components/tasks/BackgroundTaskStatus.tsx +2 -1
  374. package/src/components/tasks/BackgroundTasksDialog.tsx +2 -1
  375. package/src/components/tasks/DreamDetailDialog.tsx +1 -0
  376. package/src/components/tasks/InProcessTeammateDetailDialog.tsx +1 -0
  377. package/src/components/tasks/RemoteSessionDetailDialog.tsx +2 -1
  378. package/src/components/tasks/RemoteSessionProgress.tsx +1 -0
  379. package/src/components/tasks/ShellDetailDialog.tsx +2 -1
  380. package/src/components/tasks/ShellProgress.tsx +1 -0
  381. package/src/components/tasks/taskStatusUtils.tsx +1 -0
  382. package/src/components/teams/TeamStatus.tsx +1 -0
  383. package/src/components/teams/TeamsDialog.tsx +2 -1
  384. package/src/components/ui/OrderedList.tsx +1 -0
  385. package/src/components/ui/OrderedListItem.tsx +1 -0
  386. package/src/components/ui/TreeSelect.tsx +2 -1
  387. package/src/components/wizard/WizardDialogLayout.tsx +1 -0
  388. package/src/components/wizard/WizardProvider.tsx +2 -1
  389. package/src/components/wizard/useWizard.ts +1 -0
  390. package/src/constants/betas.ts +1 -0
  391. package/src/constants/prompts.ts +1 -0
  392. package/src/context/QueuedMessageContext.tsx +1 -0
  393. package/src/context/fpsMetrics.tsx +1 -0
  394. package/src/context/mailbox.tsx +1 -0
  395. package/src/context/modalContext.tsx +1 -0
  396. package/src/context/overlayContext.tsx +1 -0
  397. package/src/context/promptOverlayContext.tsx +1 -0
  398. package/src/context/stats.tsx +1 -0
  399. package/src/context/voice.tsx +1 -0
  400. package/src/cost-tracker.ts +1 -0
  401. package/src/dialogLaunchers.tsx +1 -0
  402. package/src/entrypoints/agentSdkTypes.ts +4 -17
  403. package/src/entrypoints/cli.tsx +1 -0
  404. package/src/entrypoints/sdk/controlTypes.ts +86 -10
  405. package/src/entrypoints/sdk/coreTypes.generated.ts +99 -2
  406. package/src/entrypoints/sdk/runtimeTypes.ts +53 -18
  407. package/src/entrypoints/sdk/settingsTypes.generated.ts +2 -1
  408. package/src/hooks/notifs/useAntOrgWarningNotification.ts +1 -1
  409. package/src/hooks/notifs/useCanSwitchToExistingSubscription.tsx +1 -0
  410. package/src/hooks/notifs/useDeprecationWarningNotification.tsx +1 -0
  411. package/src/hooks/notifs/useFastModeNotification.tsx +1 -0
  412. package/src/hooks/notifs/useIDEStatusIndicator.tsx +1 -0
  413. package/src/hooks/notifs/useInstallMessages.tsx +1 -0
  414. package/src/hooks/notifs/useLspInitializationNotification.tsx +1 -0
  415. package/src/hooks/notifs/useMcpConnectivityStatus.tsx +1 -0
  416. package/src/hooks/notifs/useNpmDeprecationNotification.tsx +1 -0
  417. package/src/hooks/notifs/usePluginAutoupdateNotification.tsx +1 -0
  418. package/src/hooks/notifs/usePluginInstallationStatus.tsx +1 -0
  419. package/src/hooks/notifs/useRateLimitWarningNotification.tsx +1 -0
  420. package/src/hooks/useCanUseTool.tsx +2 -1
  421. package/src/hooks/useChromeExtensionNotification.tsx +1 -0
  422. package/src/hooks/useClaudeCodeHintRecommendation.tsx +1 -0
  423. package/src/hooks/useCommandKeybindings.tsx +1 -0
  424. package/src/hooks/useDiffData.ts +1 -0
  425. package/src/hooks/useIDEIntegration.tsx +1 -0
  426. package/src/hooks/useLspPluginRecommendation.tsx +1 -0
  427. package/src/hooks/useOfficialMarketplaceNotification.tsx +1 -0
  428. package/src/hooks/usePluginRecommendationBase.tsx +1 -0
  429. package/src/hooks/usePromptsFromClaudeInChrome.tsx +1 -0
  430. package/src/hooks/useRemoteSession.ts +1 -0
  431. package/src/hooks/useReplBridge.tsx +1 -0
  432. package/src/hooks/useSSHSession.ts +1 -0
  433. package/src/hooks/useTeleportResume.tsx +1 -0
  434. package/src/hooks/useTurnDiffs.ts +1 -0
  435. package/src/hooks/useTypeahead.tsx +1 -0
  436. package/src/hooks/useVoiceIntegration.tsx +1 -0
  437. package/src/ink/Ansi.tsx +1 -0
  438. package/src/ink/bidi.ts +1 -0
  439. package/src/ink/components/AlternateScreen.tsx +1 -0
  440. package/src/ink/components/Box.tsx +1 -0
  441. package/src/ink/components/Button.tsx +1 -0
  442. package/src/ink/components/ClockContext.tsx +1 -0
  443. package/src/ink/components/Link.tsx +1 -0
  444. package/src/ink/components/Newline.tsx +1 -0
  445. package/src/ink/components/NoSelect.tsx +1 -0
  446. package/src/ink/components/RawAnsi.tsx +1 -0
  447. package/src/ink/components/ScrollBox.tsx +1 -0
  448. package/src/ink/components/TerminalFocusContext.tsx +1 -0
  449. package/src/ink/components/Text.tsx +1 -0
  450. package/src/ink/ink.tsx +1 -0
  451. package/src/ink/reconciler.ts +1 -0
  452. package/src/ink/render-to-screen.ts +1 -0
  453. package/src/interactiveHelpers.tsx +4 -4
  454. package/src/keybindings/KeybindingContext.tsx +2 -1
  455. package/src/keybindings/KeybindingProviderSetup.tsx +1 -0
  456. package/src/keybindings/parser.ts +1 -0
  457. package/src/keybindings/template.ts +1 -0
  458. package/src/keybindings/validate.ts +1 -0
  459. package/src/main.tsx +5 -7
  460. package/src/memdir/findRelevantMemories.ts +1 -0
  461. package/src/native-ts/color-diff/index.ts +1 -0
  462. package/src/proactive/index.ts +26 -1
  463. package/src/proactive/useProactive.ts +13 -1
  464. package/src/query/stopHooks.ts +1 -0
  465. package/src/query.ts +1 -0
  466. package/src/remote/SessionsWebSocket.ts +1 -0
  467. package/src/screens/Doctor.tsx +2 -1
  468. package/src/screens/REPL.tsx +13 -6
  469. package/src/screens/ResumeConversation.tsx +1 -0
  470. package/src/services/AgentSummary/agentSummary.ts +1 -0
  471. package/src/services/PromptSuggestion/promptSuggestion.ts +1 -0
  472. package/src/services/api/claude.ts +33 -31
  473. package/src/services/api/client.ts +34 -31
  474. package/src/services/api/errors.ts +1 -0
  475. package/src/services/api/logging.ts +1 -0
  476. package/src/services/api/openaiShim.ts +35 -8
  477. package/src/services/api/withRetry.ts +1 -0
  478. package/src/services/autoDream/autoDream.ts +1 -0
  479. package/src/services/claudeAiLimits.ts +1 -0
  480. package/src/services/compact/autoCompact.ts +1 -0
  481. package/src/services/compact/cachedMicrocompact.ts +56 -4
  482. package/src/services/compact/compact.ts +1 -0
  483. package/src/services/compact/microCompact.ts +1 -0
  484. package/src/services/compact/postCompactCleanup.ts +1 -0
  485. package/src/services/compact/reactiveCompact.ts +16 -1
  486. package/src/services/compact/sessionMemoryCompact.ts +1 -0
  487. package/src/services/compact/snipCompact.ts +18 -1
  488. package/src/services/compact/snipProjection.ts +6 -1
  489. package/src/services/contextCollapse/index.ts +33 -1
  490. package/src/services/extractMemories/extractMemories.ts +1 -0
  491. package/src/services/mcp/MCPConnectionManager.tsx +1 -0
  492. package/src/services/mcp/channelAllowlist.ts +1 -1
  493. package/src/services/mcp/channelNotification.ts +90 -4
  494. package/src/services/mcp/channelPermissions.ts +1 -1
  495. package/src/services/mcp/client.ts +1 -0
  496. package/src/services/mcp/useManageMCPConnections.ts +5 -3
  497. package/src/services/notifier.ts +1 -0
  498. package/src/services/rateLimitMocking.ts +1 -0
  499. package/src/services/skillSearch/localSearch.ts +1 -1
  500. package/src/services/skillSearch/prefetch.ts +10 -1
  501. package/src/services/tips/tipRegistry.ts +1 -0
  502. package/src/services/toolUseSummary/toolUseSummaryGenerator.ts +1 -0
  503. package/src/services/tools/StreamingToolExecutor.ts +1 -0
  504. package/src/services/tools/toolOrchestration.ts +1 -0
  505. package/src/services/vcr.ts +1 -0
  506. package/src/services/voice.ts +1 -0
  507. package/src/setup.ts +1 -0
  508. package/src/skills/bundled/claudeInChrome.ts +1 -0
  509. package/src/skills/bundled/keybindings.ts +1 -0
  510. package/src/skills/bundled/skillify.ts +1 -0
  511. package/src/state/AppState.tsx +10 -7
  512. package/src/tasks/LocalMainSessionTask.ts +1 -0
  513. package/src/tasks/LocalShellTask/LocalShellTask.tsx +1 -0
  514. package/src/tasks/LocalShellTask/killShellTasks.ts +1 -0
  515. package/src/tasks/RemoteAgentTask/RemoteAgentTask.tsx +1 -0
  516. package/src/tools/AgentTool/AgentTool.tsx +30 -3
  517. package/src/tools/AgentTool/UI.tsx +2 -1
  518. package/src/tools/AgentTool/agentToolUtils.ts +1 -0
  519. package/src/tools/AgentTool/builtInAgents.ts +1 -0
  520. package/src/tools/AgentTool/forkSubagent.ts +1 -0
  521. package/src/tools/AgentTool/loadAgentsDir.ts +9 -0
  522. package/src/tools/AgentTool/runAgent.ts +2 -0
  523. package/src/tools/AskUserQuestionTool/AskUserQuestionTool.tsx +1 -0
  524. package/src/tools/BashTool/BashTool.tsx +1 -0
  525. package/src/tools/BashTool/BashToolResultMessage.tsx +1 -0
  526. package/src/tools/BashTool/UI.tsx +1 -0
  527. package/src/tools/BriefTool/UI.tsx +1 -0
  528. package/src/tools/FileEditTool/UI.tsx +1 -0
  529. package/src/tools/FileEditTool/utils.ts +1 -0
  530. package/src/tools/FileReadTool/FileReadTool.ts +1 -0
  531. package/src/tools/FileReadTool/imageProcessor.ts +1 -0
  532. package/src/tools/FileWriteTool/UI.tsx +2 -1
  533. package/src/tools/GrepTool/UI.tsx +1 -0
  534. package/src/tools/LSPTool/UI.tsx +1 -0
  535. package/src/tools/MCPTool/UI.tsx +1 -0
  536. package/src/tools/NotebookEditTool/NotebookEditTool.ts +1 -0
  537. package/src/tools/NotebookEditTool/UI.tsx +1 -0
  538. package/src/tools/PowerShellTool/PowerShellTool.tsx +1 -0
  539. package/src/tools/SendMessageTool/SendMessageTool.ts +1 -0
  540. package/src/tools/SkillTool/SkillTool.ts +1 -0
  541. package/src/tools/TaskOutputTool/TaskOutputTool.tsx +1 -0
  542. package/src/tools/TaskStopTool/UI.tsx +1 -0
  543. package/src/tools/ToolSearchTool/prompt.ts +1 -0
  544. package/src/tools/TungstenTool/TungstenLiveMonitor.ts +3 -0
  545. package/src/tools/WebBrowserTool/WebBrowserPanel.ts +3 -1
  546. package/src/tools/WebFetchTool/utils.ts +1 -0
  547. package/src/tools/WebSearchTool/WebSearchTool.ts +1 -0
  548. package/src/tools/WorkflowTool/createWorkflowCommand.ts +3 -1
  549. package/src/tools/testing/TestingPermissionTool.tsx +1 -0
  550. package/src/tools/utils.ts +1 -0
  551. package/src/types/commands-js.d.ts +13 -0
  552. package/src/types/diff.d.ts +1 -0
  553. package/src/types/hooks.ts +1 -0
  554. package/src/types/macro.d.ts +15 -0
  555. package/src/types/markdown.d.ts +4 -0
  556. package/src/types/message.ts +56 -107
  557. package/src/types/react-compiler-runtime.d.ts +4 -0
  558. package/src/types/utils.ts +3 -3
  559. package/src/utils/advisor.ts +1 -0
  560. package/src/utils/asciicast.ts +1 -0
  561. package/src/utils/attachments.ts +1 -0
  562. package/src/utils/attribution.ts +1 -0
  563. package/src/utils/autoRunIssue.tsx +1 -0
  564. package/src/utils/claudeInChrome/mcpServer.ts +1 -0
  565. package/src/utils/claudeInChrome/setup.ts +1 -0
  566. package/src/utils/claudemd.ts +1 -0
  567. package/src/utils/cleanup.ts +1 -0
  568. package/src/utils/cliHighlight.ts +1 -0
  569. package/src/utils/collapseReadSearch.ts +1 -0
  570. package/src/utils/computerUse/executor.ts +1 -0
  571. package/src/utils/computerUse/gates.ts +1 -0
  572. package/src/utils/computerUse/hostAdapter.ts +1 -0
  573. package/src/utils/computerUse/inputLoader.ts +1 -0
  574. package/src/utils/computerUse/mcpServer.ts +1 -0
  575. package/src/utils/computerUse/setup.ts +1 -0
  576. package/src/utils/computerUse/swiftLoader.ts +1 -0
  577. package/src/utils/computerUse/wrapper.tsx +2 -1
  578. package/src/utils/context.ts +1 -0
  579. package/src/utils/contextAnalysis.ts +1 -0
  580. package/src/utils/conversationRecovery.ts +1 -0
  581. package/src/utils/deepLink/protocolHandler.ts +1 -0
  582. package/src/utils/diff.ts +1 -0
  583. package/src/utils/effort.ts +1 -0
  584. package/src/utils/envUtils.ts +1 -0
  585. package/src/utils/execFileNoThrowPortable.ts +1 -0
  586. package/src/utils/fileHistory.ts +1 -0
  587. package/src/utils/filePersistence/filePersistence.ts +1 -0
  588. package/src/utils/filePersistence/outputsScanner.ts +1 -0
  589. package/src/utils/gitDiff.ts +1 -0
  590. package/src/utils/groupToolUses.ts +1 -0
  591. package/src/utils/hooks/hooksConfigManager.ts +1 -0
  592. package/src/utils/hooks/skillImprovement.ts +1 -0
  593. package/src/utils/hooks.ts +1 -0
  594. package/src/utils/imagePaste.ts +1 -0
  595. package/src/utils/log.ts +1 -0
  596. package/src/utils/logoV2Utils.ts +6 -6
  597. package/src/utils/messageQueueManager.ts +1 -0
  598. package/src/utils/messages.ts +122 -100
  599. package/src/utils/model/agent.ts +43 -2
  600. package/src/utils/model/configs.ts +1 -1
  601. package/src/utils/model/deprecation.ts +1 -0
  602. package/src/utils/model/fetchModels.ts +11 -1
  603. package/src/utils/model/model.ts +31 -0
  604. package/src/utils/model/modelCapabilities.ts +1 -0
  605. package/src/utils/model/modelOptions.ts +68 -14
  606. package/src/utils/model/modelStrings.ts +1 -0
  607. package/src/utils/model/platformProfiles.ts +524 -0
  608. package/src/utils/model/thirdPartyProviders.ts +158 -15
  609. package/src/utils/modelCost.ts +1 -0
  610. package/src/utils/notebook.ts +1 -0
  611. package/src/utils/permissions/classifierDecision.ts +1 -0
  612. package/src/utils/permissions/pathValidation.ts +1 -0
  613. package/src/utils/permissions/permissionExplainer.ts +1 -0
  614. package/src/utils/plugins/loadPluginHooks.ts +1 -0
  615. package/src/utils/plugins/lspPluginIntegration.ts +1 -0
  616. package/src/utils/plugins/pluginLoader.ts +1 -0
  617. package/src/utils/preflightChecks.tsx +2 -1
  618. package/src/utils/processUserInput/processSlashCommand.tsx +13 -3
  619. package/src/utils/queryHelpers.ts +1 -0
  620. package/src/utils/readFileInRange.ts +1 -0
  621. package/src/utils/sandbox/sandbox-adapter.ts +24 -22
  622. package/src/utils/sessionFileAccessHooks.ts +1 -0
  623. package/src/utils/sessionRestore.ts +1 -0
  624. package/src/utils/sessionStorage.ts +84 -46
  625. package/src/utils/settings/types.ts +72 -0
  626. package/src/utils/shell/prefix.ts +1 -0
  627. package/src/utils/sideQuery.ts +1 -0
  628. package/src/utils/sliceAnsi.ts +1 -0
  629. package/src/utils/staticRender.tsx +1 -0
  630. package/src/utils/stats.ts +1 -0
  631. package/src/utils/status.tsx +1 -0
  632. package/src/utils/swarm/It2SetupPrompt.tsx +2 -1
  633. package/src/utils/swarm/teammateModel.ts +1 -0
  634. package/src/utils/taskSummary.ts +6 -1
  635. package/src/utils/textHighlighting.ts +1 -0
  636. package/src/utils/thinking.ts +1 -0
  637. package/src/utils/toolResultStorage.ts +1 -0
  638. package/src/utils/transcriptSearch.ts +1 -0
  639. package/src/utils/worktree.ts +1 -0
  640. package/stubs/@anthropic-ai/mcpb/index.d.ts +23 -1
  641. package/stubs/@anthropic-ai/sandbox-runtime/index.d.ts +39 -1
  642. package/.gitignore.bak +0 -11
  643. package/bin/mumuclaw +0 -154
  644. package/bin/opencc +0 -50
  645. package/src/channels/heartbeat-channel.mjs +0 -280
@@ -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(message)) {
884
- const toolUseID = message.message.content[0]?.id
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 = message
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
- isHookAttachmentMessage(message) &&
902
- message.attachment.hookEvent === 'PreToolUse'
903
- ) {
904
- const toolUseID = message.attachment.toolUseID
905
- if (!toolUseGroups.has(toolUseID)) {
906
- toolUseGroups.set(toolUseID, {
907
- toolUse: null,
908
- preHooks: [],
909
- toolResult: null,
910
- postHooks: [],
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.type === 'user' &&
920
- message.message.content[0]?.type === 'tool_result'
921
- ) {
922
- const toolUseID = message.message.content[0].tool_use_id
923
- if (!toolUseGroups.has(toolUseID)) {
924
- toolUseGroups.set(toolUseID, {
925
- toolUse: null,
926
- preHooks: [],
927
- toolResult: null,
928
- postHooks: [],
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
- isHookAttachmentMessage(message) &&
938
- message.attachment.hookEvent === 'PostToolUse'
939
- ) {
940
- const toolUseID = message.attachment.toolUseID
941
- if (!toolUseGroups.has(toolUseID)) {
942
- toolUseGroups.set(toolUseID, {
943
- toolUse: null,
944
- preHooks: [],
945
- toolResult: null,
946
- postHooks: [],
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(message)) {
966
- const toolUseID = message.message.content[0]?.id
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
- isHookAttachmentMessage(message) &&
986
- (message.attachment.hookEvent === 'PreToolUse' ||
987
- message.attachment.hookEvent === 'PostToolUse')
988
- ) {
989
- // Skip - already handled in tool use groups
990
- continue
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 (message.type === 'system' && message.subtype === 'api_error') {
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] = message
1018
+ result[result.length - 1] = currentMessage
1006
1019
  } else {
1007
- result.push(message)
1020
+ result.push(currentMessage)
1008
1021
  }
1009
1022
  continue
1010
1023
  }
1011
1024
 
1012
1025
  // Add standalone messages
1013
- result.push(message)
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
- (_): _ is AssistantMessage =>
1126
- _.type === 'assistant' &&
1127
- _.message.content.some(_ => _.type === 'tool_use' && _.id === toolUseID),
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
- (_): _ is AssistantMessage =>
1136
- _.type === 'assistant' && _.message.id === messageID,
1150
+ (_: AssistantMessage): _ is AssistantMessage =>
1151
+ _.type === 'assistant' && _.message.id === messageID,
1137
1152
  )
1138
1153
 
1139
1154
  return new Set(
1140
- siblingMessages.flatMap(_ =>
1141
- _.message.content.filter(_ => _.type === 'tool_use').map(_ => _.id),
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(contentBlock => {
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 => block.type === 'thinking' || block.type === 'redacted_thinking',
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())),
@@ -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.
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Model deprecation utilities
3
4
  *
@@ -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.includes('localhost')) {
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