docs(api): audit streaming/SSE support for chat-interface response streaming - #6311
Closed
nghetienhiep wants to merge 1 commit into
Closed
docs(api): audit streaming/SSE support for chat-interface response streaming#6311nghetienhiep wants to merge 1 commit into
nghetienhiep wants to merge 1 commit into
Conversation
…reaming Written inventory of the API layer's streaming/SSE infrastructure, groundwork for the chat-interface spec (JSONbored#6230). Audits src/api/routes.ts and sweeps the tree for response-streaming primitives (SSE, ReadableStream response bodies, WebSockets, Durable Objects, Hono streaming helpers), plus the Workers deploy config and the self-host Node runtime, each with file:line references. Finds no reusable outgoing-streaming/SSE infra: handlers return whole responses, the sole Durable Object is rate-limit-only, and the AI provider layer buffers. Documents the Workers-vs-self-host dual-runtime constraint on a DO-based design. Audit and documentation only; no code changed. Closes JSONbored#6303
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Owner
|
No longer want |
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.
Closes #6303.
What
A research/audit deliverable — a written inventory of the API layer's streaming/SSE infrastructure, groundwork for the chat-interface spec (#6230, alongside the UI-primitives inventory #6244). New file:
src/api/streaming-sse-audit.md. Audit and documentation only — no code changed (per the issue boundary).Placed beside the audited source, following the merged precedent of
src/selfhost/docs-drift-audit-sweep-rfc.md(#5794) — a design/research doc living undersrc/**next to the code it concerns.Method
Audited
src/api/routes.tsand sweptsrc/**,packages/*/src/**, andapps/*/src/**for every response-streaming primitive (ReadableStream/TransformStreamresponse bodies,text/event-stream/SSE,EventSource,WebSocketPair, Durable Objects, Hono'sstreamSSE/streamText), plus the Workers deploy config (wrangler.jsonc) and the self-host Node runtime (src/server.ts,src/selfhost/**). Every finding carries afile:linereference.Findings in brief
c.json(...); no route returns a streamed body, setstext/event-stream, or opens a WebSocket. Hono's streaming helpers are available (hono^4.12.27) but imported nowhere.readRequestBodyWithLimit(src/api/routes.ts:399-421) buffers a request body; not reusable for server-sent output.RateLimiter(src/auth/rate-limit.ts:27), bound asRATE_LIMITERinwrangler.jsonc:272-285. Proves the DO capability the sibling repo'sresources/subscribeSSE pattern needs is deployable here, but it does no streaming;wrangler.jsonc:268-271documents the add-a-DO procedure (SubmissionLockTODO).src/selfhost/ai.tscalls providers withawait res.json()(:333,346,387,394), nostream: true, so even the token source is non-streaming today.text/event-streamappears only as a validator of other repos' claims (src/review/content-lane/registry-logic.ts:643-645), andReadableStreamelsewhere is R2/S3 storage I/O (src/selfhost/blob-store.ts:32), not HTTP.@hono/node-server(src/server.ts:13,866) wherecloudflare:workersis stubbed and the DO is never instantiated (src/selfhost/cf-workers-shim.ts:1-6) — so a DO-coordinated streaming design would not run self-hosted. The doc recommends a plain streamedResponse(identical on Workers and Node) with any DO-based multiplexing as a Workers-only enhancement plus a self-host fallback.Notes
Docs-only, non-binding. No API/schema, wrangler-binding, env-read, or DB change, so no generated artifacts (
ui:openapi,cf-typegen,selfhost:env-reference, migrations) are affected. The new markdown adds no coverable source lines.