@breadai/transport-http-sse
v0.1.2
Published
HTTP (SSE) BreadTransport for bread — a mount()-able server ingress plus a remoteAgent() client, browser-EventSource-friendly.
Maintainers
Readme
@breadai/transport-http-sse
HTTP (SSE) BreadTransport for bread —
a mount()-able server ingress plus a remoteAgent() client, using Server-Sent Events. The
browser-EventSource-friendly alternative to @breadai/transport-http-chunked; preserves today's
exact wire format (data: {type,payload}\n\n, id: <seq>, Last-Event-ID/?after= catch-up), so
existing curl/EventSource examples keep working unchanged.
Install
bun add @breadai/transport-http-sseUsage
// bread.config.ts
import { transport } from '@breadai/transport-http-sse'
export default defineConfig({
entrypoints: ['writer'],
store: store({ path: './bread.db' }),
transport: transport(),
})// Consuming a remote bread instance's mounted routes (config.remoteAgents)
import { remoteAgent } from '@breadai/transport-http-sse'
export default defineConfig({
entrypoints: ['local'],
store: store({ path: './bread.db' }),
remoteAgents: {
researcher: remoteAgent({ url: 'http://remote:3000' }),
},
})What mount() adds
Same four routes as @breadai/transport-http-chunked (POST /agents/:id/run,
POST /pipelines/:id/run, POST /resume/:checkpointId, GET /runs/:runId/stream), reimplemented
generically against the public BreadInstance surface — no private config access, so a failure
that would otherwise throw before the stream starts (e.g. an unknown pipeline id) surfaces as an
SSE {type:'error', payload:{code,message}} event instead of a 404 or a torn-down connection.
Semantics
transport()'s pub/sub + bounded replay is the embeddedstreamTransport()— single-process only. Cross-replica fan-out is@breadai/transport-redis's job (seedocs/transports.md's known gap on combining the two).remoteAgent()'srun()is a plain SSE line reader — no reconnect/replay logic of its own today.
