Skip to content

feat(websockets): add stream summary extraction for SSE/WebSocket responses - #10455

Open
ZxBing0066 wants to merge 2 commits into
developfrom
feat/ai-sse-response-summary
Open

feat(websockets): add stream summary extraction for SSE/WebSocket responses#10455
ZxBing0066 wants to merge 2 commits into
developfrom
feat/ai-sse-response-summary

Conversation

@ZxBing0066

Copy link
Copy Markdown
Member

Summary

  • Extracts a JSONPath from each streaming SSE/WebSocket message and concatenates it into one readable transcript, shown in a new "Summary" tab next to Events — useful for debugging LLM streaming APIs (OpenAI, Anthropic, Gemini) without scrolling through raw chunks.
  • Auto-infers the JSONPath from the request URL for known provider endpoints (OpenAI Chat Completions/legacy Completions/Responses, Anthropic Messages, Google Gemini streamGenerateContent), matched by pathname only so Azure/self-hosted proxies work too. Falls back to a manually-editable path otherwise.
  • Handles curl's SSE event log being chunk-granular rather than frame-granular (a JSON payload can span multiple raw network reads, or multiple SSE frames can land in one chunk) by reconstructing the raw wire text and re-parsing data: frames properly.
  • Summary tab defaults to selected when the URL matches a known provider, otherwise Events stays default. Plain text/Markdown render toggle for the summary output.
  • Scoped to curl (SSE) and webSocket protocols only — socketIO/mcp are untouched.

Test plan

  • npm run type-check (all workspaces) — 0 errors
  • npm run lint (all workspaces) — 0 errors
  • packages/insomnia vitest: src/common, src/ui/hooks — 550/550 passing
  • packages/insomnia-data vitest — 471/471 passing
  • Manual: verified in-app with real OpenAI/Anthropic streaming responses (correct chunk reconstruction order, resize handles behave correctly with the new tab)

…ponses

Extracts a user-editable or auto-inferred JSONPath from each streaming
message and concatenates it into a single readable transcript, shown in
a new "Summary" tab next to Events — useful for debugging LLM streaming
APIs (OpenAI, Anthropic, Gemini) without scrolling through raw chunks.

- packages/insomnia-data: add RequestMeta.streamSummaryPath/streamSummaryRenderMarkdown
- packages/insomnia/src/common/stream-summary.ts: JSONPath extraction,
  SSE wire-text reframing (curl's event log is chunk-granular, not
  frame-granular), and pathname-based provider inference
- packages/insomnia/src/ui/hooks/use-stream-summary.ts: wires RequestMeta
  to the extraction logic
- realtime-response-pane.tsx: new Summary tab (curl/webSocket only,
  positioned second, default-selected when the URL matches a known
  provider), Plain text/Markdown render toggle
- event-view.tsx: fix double top/bottom padding on the existing
  CodeEditor filter box
/>
</div>
<div className="grow p-4">
<div className="grow p-4 pb-0">

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

To fix a ui issue.

Image

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.

1 participant