{"_id":"@cool-ai/beach-channel-sse","_rev":"2-2b2525c7a04120d3a591eda2d93d6a85","name":"@cool-ai/beach-channel-sse","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"name":"@cool-ai/beach-channel-sse","version":"0.1.1","license":"Apache-2.0","_id":"@cool-ai/beach-channel-sse@0.1.1","maintainers":[{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"}],"homepage":"https://cool-ai.org","bugs":{"url":"https://gitlab.com/johncandrew/beach/-/issues"},"dist":{"shasum":"3b8a80aa8d7cfc2be8e6cdca04be61b5f2121143","tarball":"https://registry.npmjs.org/@cool-ai/beach-channel-sse/-/beach-channel-sse-0.1.1.tgz","fileCount":27,"integrity":"sha512-JDuNZWiuAiPDK+7VATeCL8PGfoujLN+7S4nXQnrG+aWwqeZgdp8NHO9NEnhY0Pt68lZMQ0mbG/QNjul7aRICqg==","signatures":[{"sig":"MEUCIGAWl+sEx2RNtHbgU/kTdYppMQY3T138RzctY1Gchai+AiEAj8X1ri6lQT8Ky+z5SHl6q+tp/5so8lnY8p+L0QDX5+M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":324751},"type":"module","_from":"file:cool-ai-beach-channel-sse-0.1.1.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --project tsconfig.json --watch","test":"vitest run","build":"tsc --project tsconfig.json","coverage":"vitest run --coverage","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"},"_resolved":"/tmp/405d466e922d082ab189a8ef2c4e848c/cool-ai-beach-channel-sse-0.1.1.tgz","_integrity":"sha512-JDuNZWiuAiPDK+7VATeCL8PGfoujLN+7S4nXQnrG+aWwqeZgdp8NHO9NEnhY0Pt68lZMQ0mbG/QNjul7aRICqg==","repository":{"url":"git+https://gitlab.com/johncandrew/beach.git","type":"git","directory":"packages/beach-channel-sse"},"_npmVersion":"10.9.8","description":"Beach SSE channel — browser HTTP inbound, Server-Sent-Events streaming outbound. Implements core's ChannelAdaptor.","directories":{},"_nodeVersion":"22.22.3","dependencies":{"@cool-ai/beach-core":"^0.13.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","typescript":"^5.5.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/beach-channel-sse_0.1.1_1780677382231_0.17025273534250784","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@cool-ai/beach-channel-sse","version":"0.1.2","description":"Beach SSE channel — browser HTTP inbound, Server-Sent-Events streaming outbound. Implements core's ChannelAdaptor.","license":"Apache-2.0","repository":{"type":"git","url":"git+https://gitlab.com/johncandrew/beach.git","directory":"packages/beach-channel-sse"},"homepage":"https://cool-ai.org","bugs":{"url":"https://gitlab.com/johncandrew/beach/-/issues"},"type":"module","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"publishConfig":{"access":"public"},"dependencies":{"@cool-ai/beach-core":"^0.13.3"},"devDependencies":{"@types/node":"^22.0.0","typescript":"^5.5.0","vitest":"^2.0.0"},"scripts":{"build":"tsc --project tsconfig.json","dev":"tsc --project tsconfig.json --watch","test":"vitest run","coverage":"vitest run --coverage","test:watch":"vitest","typecheck":"tsc --noEmit"},"_id":"@cool-ai/beach-channel-sse@0.1.2","_integrity":"sha512-aNfGfzhWMNCAk+yUte+Wix+JWtWZJ5bChW9nTcv4BY8oRty5sGydi65OlUWfi0FPOMj1Z79UVtfJ0HplS5dvgQ==","_resolved":"/tmp/fdb4d2e9979e431374175419f7126980/cool-ai-beach-channel-sse-0.1.2.tgz","_from":"file:cool-ai-beach-channel-sse-0.1.2.tgz","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-aNfGfzhWMNCAk+yUte+Wix+JWtWZJ5bChW9nTcv4BY8oRty5sGydi65OlUWfi0FPOMj1Z79UVtfJ0HplS5dvgQ==","shasum":"c4a16ac14510337e9a74531f307c2060e6adb72c","tarball":"https://registry.npmjs.org/@cool-ai/beach-channel-sse/-/beach-channel-sse-0.1.2.tgz","fileCount":27,"unpackedSize":316983,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICcPyofLCB2fFdIHvqnbVnzsvT0bDWKlhNy+pIiQa2GjAiAn0XRnvJnclvyfOhJAkM6B5nQ9BqMyqLtp+QoHGK/J0w=="}]},"_npmUser":{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"},"directories":{},"maintainers":[{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/beach-channel-sse_0.1.2_1781772154385_0.10355321675012186"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-05T16:36:22.070Z","modified":"2026-06-18T08:42:34.648Z","0.1.1":"2026-06-05T16:36:22.382Z","0.1.2":"2026-06-18T08:42:34.542Z"},"bugs":{"url":"https://gitlab.com/johncandrew/beach/-/issues"},"license":"Apache-2.0","homepage":"https://cool-ai.org","repository":{"type":"git","url":"git+https://gitlab.com/johncandrew/beach.git","directory":"packages/beach-channel-sse"},"description":"Beach SSE channel — browser HTTP inbound, Server-Sent-Events streaming outbound. Implements core's ChannelAdaptor.","maintainers":[{"name":"johncandrew","email":"johncandrew@yahoo.co.uk"}],"readme":"# @cool-ai/beach-channel-sse\n\nThe SSE channel adaptor: a browser sends messages in over HTTP, and the agent's reply streams back over Server-Sent Events. It implements core's `ChannelAdaptor`, so the channel-router routes its inbound messages and delivers its replies like any other channel.\n\nSSE is a streaming channel, so it follows the per-chunk model: the router calls `send` once for each routed reply event, and the adaptor writes that chunk to the open stream. The adaptor keeps the one piece of state a streaming channel needs — a map from each browser's stable `clientId` to its open connection — keyed on the client id (which the reply destination carries), not the session id, so the stream can open before a session is bound.\n\nInbound parts are handed through channel-blind; the browser renders the streamed parts itself (for instance with `@cool-ai/beach-a2ui-renderer-lit`), so the adaptor wires no server-side renderer.\n\n## Use\n\n```ts\nimport { SSEChannelAdaptor } from '@cool-ai/beach-channel-sse';\n\nconst sse = new SSEChannelAdaptor({\n  inbound: (req) => channelRouter.inbound(req),\n});\n\n// Mount on your HTTP layer:\napp.get('/stream', (req, res) => sse.openStream(req.query.clientId, res));\napp.post('/message', sse.inboundHandler());\n\n// Register `sse` as a channel-router adaptor so replies stream back out.\n```\n\nThe browser opens `GET /stream?clientId=…` to receive the stream, then `POST`s `{ clientId, parts }` for each message it sends. Replies addressed to that client are written as `data:` events; a reply for a disconnected client is dropped silently.\n","readmeFilename":"README.md"}