Repository navigation
feat(agui): convert URL media blocks to AG-UI input contents - #4003
Merged
jujn merged 2 commits intoNov 5, 2026
Merged
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Contributor
Author
|
@jujn 辛苦有空的时候审核一下 |
jujn
approved these changes
Nov 5, 2026
This was referenced Nov 6, 2026
Merged
5 tasks done
jujn
pushed a commit
that referenced
this pull request
Nov 6, 2026
## Description Fixes #4008. An assistant message with a `ThinkingBlock` and supported URL media, but no text/tool call, currently converts to just a reasoning message. `toSingleAguiMessage` collects the media, then its old reasoning-only fast path returns before emitting it. This also loses media when `toAguiMessageList` converts a conversation. Build reasoning and standard content together in `buildAguiMessages`, as suggested in review. Collect thinking, text, tool calls/results and media in one content traversal, then emit the reasoning message and any remaining content. The reasoning-only return requires the collected media list to be empty, so mixed messages retain their assistant `MessageContent.Blocks`. This removes `toSingleAguiMessage`, `splitReasoningMessage` and the separate thinking scan while retaining public entry points, message order and multiple-tool-result expansion. The change builds on outbound media support in #4003 and is separate from inbound document handling in #3392. The regression covers all supported URL media categories (image, audio, video, document, and image/document `DataBlock` routing), checking the serialized type, URL and MIME type plus distinct generated message IDs. A conversation-list case verifies media serialization and preservation of the following user message; a reasoning-only control still yields one reasoning message. EN/ZH protocol docs describe the mixed case.
jujn
added a commit
that referenced
this pull request
Nov 6, 2026
…nversation lifecycle (#3979) ## Description ### What changed 1. **`fix(core): preserve document references in text sinks`** — new `DocumentReferenceRenderer` renders a document as a one-line reference (name, MIME type, URL/provider file id, or an inline-size description that never leaks base64 or a local temp path). Memory flushing, compaction, subagent/task results, session exports, public events, telemetry redaction, control-plane and admin projections now keep that reference instead of losing the attachment. 2. **`fix(model): preserve documents across provider formatting`** — Ollama, OpenAI (and the GLM/DeepSeek/Kimi/MiniMax compat formatters), OpenAI Official Responses, and Gemini keep documents through formatting and merging; the text extractor contract is "text without document references", and each converter renders references where documents can appear, so an assistant-carried document yields exactly one reference line. Gemini maps accepted MIME types (aligned with the GenerateContent reference) to its native file data and degrades the rest. 3. **`feat(protocol): preserve documents through AG-UI and A2A`** — AG-UI gains a document content type with URL / inline-data / provider-file sources. Documents serialize on every role alongside the URL media support from #4003 and compose with the reasoning-plus-media split from #4009; only a source the protocol cannot express falls back to a text reference. A2A file parts parse back into `DocumentBlock`s with framework metadata markers taking precedence over user keys. 4. **`feat(dashscope): support document inputs and PPT skills`** — closes #3943: URL documents map to the native `doc_url` content part (count and streaming validation), file-id documents keep the `fileid://` channel, `file_parsing_strategy` is honored, and the PPT `skill` parameter (template and creative mode) streams outline/pages through thinking blocks with the download URL in the final text content and a typed `dashscope.skill` metadata marker. Multimodal example and zh/en docs included. 5. **`fix(core,protocol,model): degrade unsupported documents instead of failing`** — a document block stays in the conversation history, so a formatter that throws on a source it cannot deliver breaks every later turn of that session. DashScope now emits a text reference for Base64 payloads and file ids issued by another provider (AG-UI accepts both on input), references say `unnamed` instead of leaking the block's internal UUID, A2A leaves `FilePart.name` unset instead of shipping a UUID as the attachment name, and the A2A file parser validates the MIME type before a document marker can route around it. Co-authored-by: jujn <[email protected]>
jujn
added a commit
that referenced
this pull request
Nov 21, 2026
## Description The AG-UI protocol defines three source types for media parts — `url`, `data` (inline Base64), and `file` (provider-issued handle) — and the inbound direction accepts all three. The outbound path from #4003, however, serialized URL sources only: media blocks carrying a `Base64Source` or `FileIdSource` were dropped silently, with no log or fallback. Media sent as inline data or a file handle therefore disappears from `MESSAGES_SNAPSHOT` history on reconnects, refreshes, and session switches. This change maps all three AgentScope source types on the outbound path, mirroring the document handling #3979 established in `toDocumentInputContent`. Co-authored-by: jujn <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
2.1.0-SNAPSHOTDescription
Related to #551
Related to #3392
Complement the inbound multimodal path from #2518 by converting AgentScope URL media content blocks to AG-UI
MessageContent.Blockson the outbound path.Changes
ImageBlock/AudioBlock/VideoBlock/DataBlock/DocumentBlockwithURLSourceto the matching AG-UIInputContenttypes (Image/Audio/Video/Document), preserving MIME type in metadata when present.MessageContent.Textso existing wire format andgetTextContent()remain unchanged.Notes
Verification
mvn -T1C -pl agentscope-extensions/agentscope-extensions-protocol/agentscope-extensions-agui -am spotless:check test -Dtest=AguiMessageConverterTestChecklist
mvn spotless:applymvn test)