Skip to content

fix(core): flip text content fields#2013

Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
compos-howdah-reckoned
Open

fix(core): flip text content fields#2013
rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
compos-howdah-reckoned

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports livekit/agents#6353 to agents-js: assistant textContent now strips only LiveKit <expr/> markup, while provider/runtime paths use raw text via rawTextContent so model-facing expressive markup is preserved.

Source diff coverage

Coverage classification
  • livekit-agents/livekit/agents/llm/_provider_format/anthropic.py - ported to plugins/anthropic/src/llm.ts; Anthropic context building now uses rawTextContent.
  • livekit-agents/livekit/agents/llm/_provider_format/aws.py - not applicable; agents-js has no AWS provider-format counterpart.
  • livekit-agents/livekit/agents/llm/_provider_format/google.py - ported to agents/src/llm/provider_format/google.ts; system messages now use rawTextContent.
  • livekit-agents/livekit/agents/llm/_provider_format/utils.py - ported to agents/src/llm/provider_format/utils.ts; mid-conversation instructions conversion now preserves raw instruction text.
  • livekit-agents/livekit/agents/llm/chat_context.py - adapted to agents/src/llm/chat_context.ts and agents/src/tts/provider_format.ts; added rawTextContent, made assistant textContent strip only <expr/>, added stripMarkup JSON handling, and added the minimal expr-only stripping helper because the target lacked the Python TTS provider-format markup infrastructure.
  • livekit-agents/livekit/agents/llm/utils.py - adapted to agents/src/llm/utils.ts; agents-js diff ops do not have Python's to_update, so changed same-id message raw text is represented as remove/create.
  • livekit-agents/livekit/agents/telemetry/traces.py - adapted/no code change; agents-js telemetry serialization already iterates message content directly rather than using textContent, so it already preserves raw text.
  • livekit-agents/livekit/agents/tts/_provider_format.py - adapted to agents/src/tts/provider_format.ts; ported the expr-only strip behavior needed by the source change, not the full Python provider-format parser.
  • livekit-agents/livekit/agents/voice/agent_activity.py - ported to agents/src/voice/agent_activity.ts; realtime reply input, preemptive transcript comparison, and user-input tracing now use rawTextContent.
  • livekit-agents/livekit/agents/voice/agent_session.py - not applicable; the exact debug logging path does not exist in agents-js.
  • livekit-agents/livekit/agents/voice/remote_session.py - adapted/no code change; agents-js remote session serialization already iterates raw message content directly.
  • livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realtime/realtime_model.py - not applicable; agents-js has no AWS realtime plugin counterpart.
  • livekit-plugins/livekit-plugins-langchain/livekit/plugins/langchain/langgraph.py - not applicable; agents-js has no LangChain plugin counterpart.
  • livekit-plugins/livekit-plugins-phonic/livekit/plugins/phonic/realtime/realtime_model.py - ported to plugins/phonic/src/realtime/realtime_model.ts; system/developer messages, tail user text, and turn history now use rawTextContent.
  • livekit-plugins/livekit-plugins-turn-detector/livekit/plugins/turn_detector/base.py - adapted/no code change; agents-js keyterm/STT context paths intentionally use sanitized textContent, matching the source's new assistant-stripped behavior.
  • livekit-plugins/livekit-plugins-ultravox/livekit/plugins/ultravox/realtime/realtime_model.py - not applicable; agents-js has no Ultravox plugin counterpart.
  • livekit-plugins/livekit-plugins-xai/livekit/plugins/xai/realtime/realtime_model.py - not applicable; agents-js xAI realtime extends the OpenAI realtime implementation and does not contain the Python override/comparison path touched in the source diff.
  • tests/test_expr_markup.py - ported to agents/src/llm/chat_context.test.ts; added the source tests for expr-only stripping, assistant/non-assistant text accessors, undefined text, and toJSON({ stripMarkup: true }).

Verification

  • pnpm test -- agents/src/llm/chat_context.test.ts agents/src/llm/utils.test.ts - passed.
  • pnpm test -- plugins/anthropic plugins/phonic - passed after build; Phonic has no matching tests in this suite.
  • pnpm test -- agents --exclude agents/src/voice/amd.test.ts - passed: 90 files, 1206 tests.
  • pnpm build - passed.
  • pnpm lint - passed with existing warnings.
  • cue-cli text-mode runtime smoke against built examples/dist/warm_transfer.js (warm-transfer) - passed; observed one assistant conversation_item_added framework event.

Known unrelated verification blockers:

  • pnpm test -- agents plugins/anthropic plugins/phonic fails only because agents/src/voice/amd.test.ts currently fails 11 AMD classification/timeout assertions; rerunning pnpm test -- agents/src/voice/amd.test.ts reproduces the same failures in isolation.
  • pnpm api:check is blocked by unrelated @livekit/agents-plugin-hedra missing API report warnings.
  • Touched-package API checks are also blocked by existing API Extractor/tooling issues: @livekit/agents and Phonic fail on unsupported export * as ___ declarations, while Anthropic exits nonzero on pre-existing missing API report/release-tag warnings.

Ported from livekit/agents#6353

Original PR description

Before:

  • text_content raw content, with expressive tags and bracket tags;
  • plain_text_content clean content, without any tags;

Now:

  • text_content clean content, without any expressive-only tags expr
  • raw_text_content raw content with expr tags

@rosetta-livekit-bot rosetta-livekit-bot Bot requested a review from a team as a code owner July 9, 2026 19:19
@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 73862ee

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@livekit/agents Major
@livekit/agents-plugin-anthropic Major
@livekit/agents-plugin-phonic Major
@livekit/agents-plugin-anam Major
@livekit/agents-plugin-assemblyai Major
@livekit/agents-plugin-baseten Major
@livekit/agents-plugin-bey Major
@livekit/agents-plugin-cartesia Major
@livekit/agents-plugin-cerebras Major
@livekit/agents-plugin-deepgram Major
@livekit/agents-plugin-did Major
@livekit/agents-plugin-elevenlabs Major
@livekit/agents-plugin-fishaudio Major
@livekit/agents-plugin-google Major
@livekit/agents-plugin-hedra Major
@livekit/agents-plugin-hume Major
@livekit/agents-plugin-inworld Major
@livekit/agents-plugin-lemonslice Major
@livekit/agents-plugin-liveavatar Major
@livekit/agents-plugin-livekit Major
@livekit/agents-plugin-minimax Major
@livekit/agents-plugin-mistral Major
@livekit/agents-plugin-mistralai Major
@livekit/agents-plugin-neuphonic Major
@livekit/agents-plugin-openai Major
@livekit/agents-plugin-perplexity Major
@livekit/agents-plugin-resemble Major
@livekit/agents-plugin-rime Major
@livekit/agents-plugin-runway Major
@livekit/agents-plugin-sarvam Major
@livekit/agents-plugin-silero Major
@livekit/agents-plugin-soniox Major
@livekit/agents-plugin-tavus Major
@livekit/agents-plugins-test Major
@livekit/agents-plugin-trugen Major
@livekit/agents-plugin-xai Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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.

0 participants