-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: RooMessage type system and storage layer for ModelMessage migration #11380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: RooMessage type system and storage layer for ModelMessage migration #11380
Conversation
…igration Add foundation infrastructure for migrating message storage from Anthropic format to AI SDK ModelMessage format (EXT-646). - RooMessage type = AI SDK ModelMessage + Roo metadata (ts, condense, truncation) - Anthropic-to-RooMessage converter for migrating old conversations on read - Versioned storage (readRooMessages/saveRooMessages) with auto-detection - flattenModelMessagesToStringContent utility for providers needing string content No behavior change - purely additive. Existing code paths untouched. EXT-647 will wire Task.ts to use these new functions.
Reviewed 1 changed file in the latest commit (mocked Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
…s/index.ts and unnecessary re-exports
- Narrow summary from any[] to Array<{ type: string; text: string }> matching EncryptedReasoningItem
- Delete unused converters/index.ts barrel (knip: unused file)
- Remove UserContent, AssistantContent, ToolContent re-exports (importable from 'ai' directly)
- Remove FlattenMessagesOptions re-export from index.ts
|
The
Root causeThe test expects However, FixThe test needs a path that will reliably fail on all platforms. Two options:
import * as storage from "../../utils/storage"
vi.spyOn(storage, "getTaskDirectoryPath").mockRejectedValueOnce(new Error("simulated write failure"))Option 2 is probably the better path since the test is checking the error-handling logic in |
|
@roomote Fix the test based on my comment |
Fixed the cross-platform test failure by mocking |
…ss-platform reliability
Summary
Adds foundation infrastructure for migrating message storage from Anthropic format to AI SDK
ModelMessageformat (EXT-646).No behavior change — purely additive. Existing code paths are untouched.
What's Added
Type System (
rooMessage.ts)RooMessage= AI SDKModelMessage+ Roo metadata (ts,condenseId,truncationId, etc.)UserModelMessage,AssistantModelMessage,ToolModelMessagefrom"ai")RooMessageMetadataandRooReasoningMessage(encrypted reasoning)isRooUserMessage(),isRooAssistantMessage(),isRooToolMessage(),isRooReasoningMessage()Legacy Converter (
converters/anthropicToRoo.ts)convertAnthropicToRooMessages()— Converts old Anthropic-format conversations toRooMessageon first openVersioned Storage (
apiMessages.ts)readRooMessages()— Reads JSON, auto-detects format (v2 envelope vs legacy Anthropic array), converts on readsaveRooMessages()— Writes in v2 format:{ version: 2, messages: [...] }detectFormat()— Format detection utilityreadApiMessages()/saveApiMessages()untouchedUtility (
messageUtils.ts)flattenModelMessagesToStringContent()— For providers needing string content (e.g., DeepSeek on SambaNova)Design Principles
streamText()with zero conversionTextPart,ImagePart,ToolCallPart, etc.) come from the"ai"packageTest Coverage
Next Steps
Task.tsto usereadRooMessages()/saveRooMessages()and constructRooMessagedirectlyconvertToAiSdkMessages,convertToOpenAiMessages, etc.)Resolves EXT-646
Important
Introduces
RooMessagetype system and storage layer for migrating from Anthropic to AI SDKModelMessageformat, with conversion functions and comprehensive tests.RooMessagetypes inrooMessage.ts, extending AI SDKModelMessagewith metadata.isRooUserMessage(),isRooAssistantMessage(),isRooToolMessage(),isRooReasoningMessage().convertAnthropicToRooMessages()inconverters/anthropicToRoo.tsto convert Anthropic-format messages toRooMessage.readRooMessages()andsaveRooMessages()inapiMessages.tsfor versioned message storage.flattenModelMessagesToStringContent()inmessageUtils.tsfor flattening message content.This description was created by
for e8ea492. You can customize this summary. It will automatically update as commits are pushed.