Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add remend for streaming markdown healing#163

Merged
cramforce merged 3 commits intomainfrom
remend
Mar 3, 2026
Merged

Add remend for streaming markdown healing#163
cramforce merged 3 commits intomainfrom
remend

Conversation

@haydenbleasel
Copy link
Member

@haydenbleasel haydenbleasel commented Mar 3, 2026

Summary

  • Adds remend to fix broken markdown rendering during fallback streaming (Teams, GChat, Discord)
  • Remend is the markdown healing library that powers Streamdown — it intelligently closes dangling markdown syntax (**bold, ```code, [links](, etc.) in real-time as tokens stream in
  • Applied to intermediate edits only — the final message uses raw accumulated text since it's already complete
  • Wraps streamed message content in { markdown: string } objects instead of plain strings, giving adapters explicit format context for both postMessage, editMessage, and stream calls
  • Slack is unaffected (uses native streaming API)

What was happening

During fallback streaming, intermediate edits are sent every 500ms with whatever text has accumulated so far. If the AI is mid-stream through a markdown construct like **bold, the user sees broken formatting until the closing syntax arrives.

Additionally, adapters had no way to distinguish between plain text and markdown content — wrapping in { markdown: string } makes the format explicit.

Test plan

  • Added test verifying intermediate edits have balanced markdown markers
  • Updated all streaming tests to expect { markdown: string } content format
  • All existing streaming tests pass
  • Full validation passes (pnpm validate)

@vercel
Copy link
Contributor

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 0:52am
chat-sdk-nextjs-chat Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 0:52am

@socket-security
Copy link

socket-security bot commented Mar 3, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedremend@​1.2.110010010092100

View full report

Update 'fallbackStream' and 'handleStream' to send '{ markdown: string }'. Adjust tests for '{ markdown: string }'.

Slack-Thread: https://vercel.slack.com/archives/C08077A6JDB/p1772491650055389?thread_ts=1772491650.055389&cid=C08077A6JDB

Co-authored-by: v0 <v0[bot]@users.noreply.github.com>
@cramforce cramforce merged commit 73de82d into main Mar 3, 2026
10 checks passed
@cramforce cramforce deleted the remend branch March 3, 2026 16:00
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.

2 participants