{"_id":"@conversation-flow-sdk/transport-web-chat","name":"@conversation-flow-sdk/transport-web-chat","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@conversation-flow-sdk/transport-web-chat","version":"0.1.0","description":"SSE web-chat transport for @conversation-flow-sdk/core.","license":"MIT","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"dependencies":{"@conversation-flow-sdk/core":"0.1.0"},"devDependencies":{"tsup":"^8.3.0","typescript":"^5.6.3","vitest":"^2.1.4"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup src/index.ts --format esm --dts --clean --sourcemap","typecheck":"tsc --noEmit"},"_id":"@conversation-flow-sdk/transport-web-chat@0.1.0","_integrity":"sha512-5HcyZrF9OwRTk48Xxbc/sOEX8f7+wUcSZ/b19D1noyfyjz2oTASuFCAUqkowuELidnaaRrjeXOt7mu1AqVUqUA==","_resolved":"/private/var/folders/j5/7dkmn95d0_9b5fdnfsmpjs580000gn/T/c96c9b1da3373c1335bd43cf50556d38/conversation-flow-sdk-transport-web-chat-0.1.0.tgz","_from":"file:conversation-flow-sdk-transport-web-chat-0.1.0.tgz","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-5HcyZrF9OwRTk48Xxbc/sOEX8f7+wUcSZ/b19D1noyfyjz2oTASuFCAUqkowuELidnaaRrjeXOt7mu1AqVUqUA==","shasum":"81a2af175674789e2207e4ecc829a8114bfa4382","tarball":"https://registry.npmjs.org/@conversation-flow-sdk/transport-web-chat/-/transport-web-chat-0.1.0.tgz","fileCount":5,"unpackedSize":13962,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDCpdx3t6gbtbsGpZu7duAV0Hyq6NUS6mzOmFtJH3ULZQIhAM+BPk7rw1bdKkG8oWm7UNmgrIXx7IpbylN9/xM0Xjq4"}]},"_npmUser":{"name":"octalpixel","email":"mithushancj@gmail.com"},"directories":{},"maintainers":[{"name":"octalpixel","email":"mithushancj@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/transport-web-chat_0.1.0_1777583325868_0.8419022527600593"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-30T21:08:45.755Z","0.1.0":"2026-04-30T21:08:46.022Z","modified":"2026-04-30T21:08:46.279Z"},"maintainers":[{"name":"octalpixel","email":"mithushancj@gmail.com"}],"description":"SSE web-chat transport for @conversation-flow-sdk/core.","license":"MIT","readme":"# @conversation-flow-sdk/transport-web-chat\n\nSSE-friendly web-chat transport for [`conversation-flow-sdk`](../../README.md). HTTP-framework-agnostic — pair with Hono, Express, fastify, Next.js Route Handlers, etc.\n\n```bash\npnpm add @conversation-flow-sdk/core @conversation-flow-sdk/transport-web-chat\n```\n\n## Usage\n\n```ts\nimport {\n  createInboundQueue,\n  createWebChatTransport,\n} from '@conversation-flow-sdk/transport-web-chat';\n\nconst inbound = createInboundQueue();\n\nconst transport = createWebChatTransport({\n  onSend: async (text) => {\n    // write an SSE frame to the response stream:\n    res.write(`data: ${JSON.stringify({ text })}\\n\\n`);\n  },\n  inboundQueue: inbound.inboundQueue,\n  onClose: () => res.end(),\n});\n\n// later, when a user message arrives via POST /chat:\ninbound.push({ text: 'hello', timestamp: Date.now() });\n\n// shutdown:\ninbound.close();\nawait transport.end();\n```\n\n## API\n\n```ts\ncreateWebChatTransport(options: {\n  onSend: (text: string, options?: { messageId?: string }) => Promise<void>;\n  inboundQueue: AsyncIterable<UserMessage>;\n  onClose?: (reason?: unknown) => void;\n}): FlowTransport\n```\n\n```ts\ncreateInboundQueue(): {\n  inboundQueue: AsyncIterable<UserMessage>;\n  push(msg: UserMessage): void;\n  close(): void;\n}\n```\n\nThe transport iterates `inboundQueue` and dispatches each `UserMessage` to subscribed handlers. Iteration ends when the queue closes or `transport.end()` is called.\n","readmeFilename":"README.md","_rev":"1-b035f3ed0381c398bc9e5a507375d574"}