imbytecat 600f574b5c refactor: replace hand-rolled SSE with Hono + fetch-event-source
Server (index.ts):
- migrate to Hono streamSSE, mounted under Bun.serve fetch handler
- idleTimeout: 255 fixes the silent Bun 10s timeout that killed SSE
  responses before the first keepalive could fire (root cause of the
  empty EventStream tab)
- stream.onAbort wires an AbortController into upstream fetch signal
- 15s : keepalive raw SSE comments for Cloudflare 120s headroom
- decodeDataUrl returns Uint8Array<ArrayBuffer> for DOM Blob types
- chromeDevToolsAutomaticWorkspaceFolders: false silences the
  'Unable to add filesystem' warning in sandboxed browsers

Client (client.ts new):
- extracted from inline <script> — Bun only bundles external script src,
  not inline module imports, so node_modules bare specifiers must live
  in their own file
- @microsoft/fetch-event-source replaces hand-rolled fetch +
  ReadableStream parsing; supports POST + body + signal natively
- client aborts the loop on event:done so fetchEventSource doesn't retry

Build:
- drop unused react/react-dom/@types/react* deps (KISS)
- add 'DOM', 'DOM.Iterable' to tsconfig lib for client.ts
2026-05-18 23:13:06 +08:00
2026-05-18 21:50:41 +08:00
2026-05-18 21:50:41 +08:00
2026-05-18 21:50:41 +08:00

ai-playground

To install dependencies:

bun install

To run:

bun run index.ts

This project was created using bun init in bun v1.3.13. Bun is a fast all-in-one JavaScript runtime.

S
Description
No description provided
Readme 92 KiB
Languages
TypeScript 66.2%
HTML 33.8%