feat: ship chats.streamChat() with SSE support#7
Conversation
The registry spec declares the stream endpoint as application/x-ndjson (the
grpc-gateway generator shape), which Speakeasy silently skips during codegen -
the method was documented but never generated. The server actually emits
Server-Sent Events (data: {...} frames, Content-Type: text/event-stream).
Add overlay actions rewriting the operation to the served contract (200 ->
text/event-stream with the discriminated stream-event payload; errors ->
application/json) and regenerate. streamChat() now returns
EventStream<StreamChatEvent>.
Once TextQLLabs/demo2#13014 ships through a prod deploy the registry spec is
SSE at the source and these overlay actions become redundant no-ops.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
* bear bones
* feat: ship chats.streamChat() with SSE support
The registry spec declares the stream endpoint as application/x-ndjson (the
grpc-gateway generator shape), which Speakeasy silently skips during codegen -
the method was documented but never generated. The server actually emits
Server-Sent Events (data: {...} frames, Content-Type: text/event-stream).
Add overlay actions rewriting the operation to the served contract (200 ->
text/event-stream with the discriminated stream-event payload; errors ->
application/json) and regenerate. streamChat() now returns
EventStream<StreamChatEvent>.
Once TextQLLabs/demo2#13014 ships through a prod deploy the registry spec is
SSE at the source and these overlay actions become redundant no-ops.
---------
Co-authored-by: textql-sdk-dispatch-bot[bot] <307206229+textql-sdk-dispatch-bot[bot]@users.noreply.github.com>
Summary
streamChatwas documented on docs.textql.com but missing from the generated SDK. Root cause: the registry spec labels the stream responseapplication/x-ndjson, and Speakeasy gates JSONL/NDJSON stream generation (jsonlResponses) behind its enterprise tier — so codegen silently skipped the operation. SSE generation works on the current tier.The endpoint is served by demo2's platform v2 SSE handler (TextQLLabs/demo2#13014), which streams
{result: Cell}/{error: Status}envelopes asdata:frames.Changes
.speakeasy/speakeasy-modifications-overlay.yaml): normalizes the stream operation to the SSE envelope contract —200istext/event-streamwith typeddata.result: Cell/data.error: Status, errors areapplication/json. Written to be robust against any registry snapshot state; becomes a harmless no-op once demo2 publishes the SSE spec at the source.textql.chats.streamChat()returningEventStream<StreamChatEvent>. Version 1.1.1.Usage
Cross-repo context & merge order
This PR can merge independently, but the generated method only works once demo2#13014 deploys (the endpoint doesn't exist in production until then). On merge, the Publish workflow releases to npm and auto-opens the docs-sync PR in demo2.
Follow-ups
examples/chat-demostill uses a raw-fetch NDJSON parser; switch it tochats.streamChat()once this is on npm.