Turn protocol v1 parts into the old stream format, for widgets before 0.6
メンテナーはふだん 1 日以内に返信
評価
この issue はまだ評価されていません。
説明
The 0.6 server streams typed parts (WirePart, in packages/core/src/protocol/v1.ts), but widgets on 0.5 and older read chunks like {"content":"Hi"} and {"done":true}. Those widgets will stay on sites and CDNs for months, so the server needs to translate. This issue is that translation, as one pure function.
What to do
Create packages/core/src/protocol/legacy.ts:
export interface LegacyChunk {
content?: string;
done?: boolean;
error?: string;
retryAfter?: number; // seconds
leadCaptured?: boolean;
leadData?: Record<string, unknown>;
suggestedActions?: string[];
}
/** The chunk an old widget expects for this part, or null for parts it has no use for. */
export function toLegacyChunk(part: WirePart): LegacyChunk | null;
| v1 part | Legacy chunk |
|---|---|
text-delta |
{ content: delta } |
lead-captured |
{ leadCaptured: true, leadData: lead } |
suggestions |
{ suggestedActions: items } |
error with rate_limited |
{ error: 'rate_limit', retryAfter }, with retryAfter = retryAfterMs rounded up to seconds, left out when there's none |
error with timeout |
{ error: 'timeout' } |
error with internal_error |
{ error: 'internal_error' } |
error with invalid_request |
{ error: 'Invalid request' } (what 0.5 servers send) |
error with any other code |
{ error: 'provider_error' } |
finish with reason error or aborted |
null (the error part already went out, or nobody is listening) |
finish with any other reason |
{ done: true } |
everything else (start, text-start, text-end, source, tool-call, tool-result, handoff, agent-message) |
null |
Those error strings are the ones the 0.5 widget understands (packages/widget/src/widget.ts, resolveErrorType, line 643).
Where to look
packages/core/src/protocol/v1.ts(the part types)packages/server/src/handler.ts, which writes the old chunks today (lines 51, 61, 71, 181, 209, 223, 250)
Acceptance criteria
- New
packages/core/src/protocol/legacy.ts, exported frompackages/core/src/protocol/index.tsand from@chatcops/core - One test per row of the table, plus
retryAfterMs: 1500becomingretryAfter: 2 - A test that runs a whole v1 stream through it and gets the exact chunks a 0.5 server sends for the same reply
- 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分
- マージ済み PR(30日)
- 122
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 1週間以上 初心者へのやさしさ 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対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンenhancement hacktoberfest help wanted server
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
codercops/chatcops の issue をすべて見る
似ている issue
-
ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
xavxyz/bei-shan-lin-shui#57 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] rag: sentence content can cross the reported sentence boundaries対応中かも @LJK-ikun が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIオープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
platformatic/mcp#361 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
siyuan-note/siyuan#20799 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信