Skip to content

refactor: use message utils factory functions#31

Open
SimFG wants to merge 1 commit intoMagicCube:mainfrom
SimFG:main
Open

refactor: use message utils factory functions#31
SimFG wants to merge 1 commit intoMagicCube:mainfrom
SimFG:main

Conversation

@SimFG
Copy link
Copy Markdown
Contributor

@SimFG SimFG commented Apr 13, 2026

refactor: use message utils factory functions instead of inline object construction

Replace all manual message and content part construction with factory functions from @/foundation/messages/utils:

  • Content parts: createTextContent, createThinkingContent (with providerData), createToolUseContent, createToolResultContent
  • Messages: createSystemMessage, createUserMessage, createAssistantMessage, createAssistantMessageWithContent (now supports usage/streaming options), createToolMessage
  • Adapter helpers: anthropicTextBlock/ThinkingBlock/ToolUseBlock/etc. and openaiToolCall/ToolMessage/AssistantMessage for third-party SDK types

ThinkingContent now has an optional providerData field for provider-specific metadata (e.g. Anthropic _anthropicSignature), replacing the previous as-unknown-as-Record hack.

…t construction

Replace all manual message and content part construction with factory
functions from @/foundation/messages/utils:
- Content parts: createTextContent, createThinkingContent (with providerData),
  createToolUseContent, createToolResultContent
- Messages: createSystemMessage, createUserMessage, createAssistantMessage,
  createAssistantMessageWithContent (now supports usage/streaming options),
  createToolMessage
- Adapter helpers: anthropicTextBlock/ThinkingBlock/ToolUseBlock/etc. and
  openaiToolCall/ToolMessage/AssistantMessage for third-party SDK types

ThinkingContent now has an optional providerData field for provider-specific
metadata (e.g. Anthropic _anthropicSignature), replacing the previous
as-unknown-as-Record hack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant