Add one shared encoder for the server's event stream lines
維護者通常 1 天內回覆
@kachamsiddarth 已經在處理了。
開始於 2026年10月20日。
評估
這個 Issue 還沒有評估資料。
描述
Each server adapter builds its own SSE lines and writes its own data: [DONE] (packages/server/src/adapters/express.ts, lines 59 and 61, vercel.ts, lines 55 and 57, cloudflare.ts, lines 72 and 74), and their headers differ slightly. For protocol v1, one module will own the format so the adapters only move bytes. This issue is that module.
What to do
Create packages/core/src/protocol/sse.ts:
/** One event: `data: <json>` and a blank line. */
export function encodeSSE(part: WirePart | Record<string, unknown>): string;
/** A comment line that keeps the connection busy while nothing else is sent. */
export const SSE_PING: string; // ': ping\n\n'
/** Ends the stream. */
export const SSE_DONE: string; // 'data: [DONE]\n\n'
export const SSE_HEADERS: Readonly<Record<string, string>>;
SSE_HEADERS:Content-Type: text/event-stream; charset=utf-8,Cache-Control: no-cache, no-transform(stops proxies from compressing and buffering),X-Accel-Buffering: no(nginx). Leave outConnection. HTTP/2 doesn't allow it, and the runtimes handle it themselves.encodeSSEmust never produce a raw line break inside the data line.JSON.stringifyalready escapes\nand\r, so test that a part with line breaks in its text stays on one line. Also test that U+2028 and U+2029 survive.
Where to look
packages/core/src/protocol/v1.ts- The SSE format on MDN
Acceptance criteria
- New
packages/core/src/protocol/sse.ts, exported frompackages/core/src/protocol/index.tsand from@chatcops/core - Tests for the line format, line breaks in text, U+2028/U+2029, and the exact header values
- The adapters aren't changed in this PR (I switch them over in the protocol PR)
- Changeset for
@chatcops/core(minor) -
pnpm test:coverageandpnpm lintpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.
- 主要語言
- TypeScript
- 星號
- 13
- 分支
- 7
- 平均合併
- 4 小時 11 分鐘
- 30 天內合併 PR
- 122
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
codercops/chatcops 的其他 Issue
-
enhancement hacktoberfest help wanted server
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
Document the pre-chat form可能已有人在做 @masyarakatai 於 5 天前認領。 未關閉documentation good first issue hacktoberfest widget
難度 2/5 1-3 小時 新手友好度 88/100
codercops/chatcops#70 · 3 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
enhancement hacktoberfest help wanted server
難度 5/5 一週以上 新手友好度 25/100
維護者通常 1 天內回覆
-
Create @chatcops/store-redis for Upstash and other Redis clients可能已有人在做 @bhushan4work 於 1 天前認領。 未關閉enhancement hacktoberfest help wanted server
codercops/chatcops#248 · 2 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Create @chatcops/store-sqlite, a store for single-server setups可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉enhancement hacktoberfest help wanted server
難度 5/5 一週以上 新手友好度 35/100
維護者通常 1 天內回覆
查看 codercops/chatcops 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
endora-commerce/endora-commerce#397 ·
維護者通常 1 天內回覆
-
level/task
難度 2/5 1-3 小時 新手友好度 68/100
wazuh/wazuh-dashboard-plugins#9472 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 63/100
維護者通常 1 天內回覆
-
ready-for-agent
難度 2/5 1-3 小時 新手友好度 68/100
xavxyz/bei-shan-lin-shui#57 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
opennextjs/opennextjs-cloudflare#1461 ·
維護者通常 1 天內回覆