feat(agent): capture full Reference content and ChatStartedPayload fields - #566
Open
hogan-yuan wants to merge 2 commits into
Open
feat(agent): capture full Reference content and ChatStartedPayload fields#566hogan-yuan wants to merge 2 commits into
hogan-yuan wants to merge 2 commits into
Conversation
…elds
Audited the agent SSE wire against the SDK types and closed the gaps
where the SDK dropped data the server actually sends:
- Reference: the real payload nests the human-readable fields under a
`content` object (source, description, published_at, source_url,
source_logo, kind, …) and carries `type`/`id`/`original_index` at the
top level. The SDK modeled only a flat {index,title,url}, so title/url
came back empty for real references and everything else was lost. Add
original_index, ref_type (wire "type"), id, and content (raw JSON,
since the field set varies by ref_type). This fixes references
everywhere they appear: ConversationResponse.references, and the
message / node_tool_use_finished / workflow_finished outputs.
- ChatStartedPayload: add chat_id / error / error_message (present on
the wire, mirroring ChatFinishedPayload).
Mirrored across every binding (Python, Node.js, Java, C); the C header
is regenerated by cbindgen. content is surfaced as raw JSON — a
serde_json::Value in Rust/Python/Node, a JSON string in C
(content_json) and Java (getContent), following the existing
NodeToolUseOutputs.data precedent.
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.
What
Audited the agent SSE wire against the SDK types (using a recorded real stream) and closed the two places the SDK dropped data the server actually sends.
Reference— was lossyThe real reference nests the human-readable fields under a
contentobject and carriestype/id/original_indexat the top level:{"type":"NewsArticle","id":"295354885","index":1,"original_index":10, "content":{"source":"…","description":"…","published_at":"…","source_url":"…","source_logo":"…","kind":"…","title":""}}The SDK modeled only a flat
{index,title,url}— sotitle/urlcame back empty for real references andsource/description/published_at/… were lost entirely. Addoriginal_index,ref_type(wire"type"),id, andcontent(raw JSON — the shape varies byref_type). Fixes references wherever they appear:ConversationResponse.referencesand themessage/node_tool_use_finished/workflow_finishedoutputs.ChatStartedPayloadAdd
chat_id/error/error_message(present on the wire, mirroringChatFinishedPayload).Bindings
Mirrored across Python, Node.js, Java, C (+ rust core); the C header is regenerated by cbindgen.
contentis surfaced as raw JSON —serde_json::Valuein Rust/Python/Node, a JSON string in C (content_json) and Java (getContent()), following the existingNodeToolUseOutputs.dataprecedent. Each binding crate builds clean; rust core tests cover the nested-content and flat-shape references.Why
Downstream (
longbridge-terminal) renders a References footer and emits references in--format json; going through the SDK's lossyReferencesilently blanked both. This restores fidelity. Companion PR: longbridge/openapi-go#113.