Problem
categorizeMessage in packages/web/src/lib/utils/message.ts assumes Content is always an array, but Content can also be a string, a single content item, or messages may use a top-level msg field. This causes incorrect categorization for non-array content shapes.
Origin
CodeRabbit review on PR #97 (commit 6d447a6) — identified as out of PR scope.
Proposed Solution
- Add a
normalizeContent(content: Content): ContentItem[] helper:
string → [{ type: 'text', text: content }]
- Single
ContentItem → [content]
ContentItem[] → pass through
msg field fallback
- Apply normalization before categorization in
categorizeMessage
Acceptance Criteria
Problem
categorizeMessageinpackages/web/src/lib/utils/message.tsassumesContentis always an array, butContentcan also be a string, a single content item, or messages may use a top-levelmsgfield. This causes incorrect categorization for non-array content shapes.Origin
CodeRabbit review on PR #97 (commit 6d447a6) — identified as out of PR scope.
Proposed Solution
normalizeContent(content: Content): ContentItem[]helper:string→[{ type: 'text', text: content }]ContentItem→[content]ContentItem[]→ pass throughmsgfield fallbackcategorizeMessageAcceptance Criteria