feat(core): add Stream Event Protocol v1 types (ADR 0001) - #41
Open
sjr666666 wants to merge 1 commit into
Open
Conversation
This was referenced Sep 11, 2026
sjr666666
force-pushed
the
feat/27-stream-event-protocol
branch
from
September 11, 2026 08:53
721898f to
99650f4
Compare
This was referenced Sep 11, 2026
sjr666666
force-pushed
the
feat/27-stream-event-protocol
branch
2 times, most recently
from
September 13, 2026 13:01
e8d4bb4 to
70016c3
Compare
Introduce the pure-type foundation for the structured streaming event protocol (issue helsome#27): versioned envelope, 12 typed events, and the idempotency/cancel/reconnect contracts as types. Zero runtime change. Adds ADR 0001 documenting context, decision, migration path and open questions for maintainer review.
sjr666666
force-pushed
the
feat/27-stream-event-protocol
branch
from
September 13, 2026 13:05
70016c3 to
63027e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景与动机
copilot 的回答流目前走隐式
AgentEvent(8 事件),缺版本号、单调sequence契约、显式取消与重连能力(issue #27)。本 PR 是 #27 的第一步,也是整条迁移链的地基:只落协议类型,零运行时行为变更,便于单独评审。完成了什么
packages/core/src/stream-events.ts:版本化信封(protocolVersion/runId/messageId?/ 单调sequence/timestamp/ typedpayload)+ 12 种事件类型及逐类型 payload 映射;在现有 8 事件之上补text_delta、tool_progress、citation_added、status、cancelled、error。@finagent/corere-export。docs/adr/0001-stream-event-protocol.md:context / decision / migration path / open questions。packages/core/src/stream-events.test.ts:枚举完整性与编译期 payload 覆盖断言。向后兼容
AgentEvent与全部现有消费方未改动;新协议类型在迁移期与旧事件族并存。关联 Issue
Refs #27(第一步,不关闭)、#34(message/run 双身份模型)。
验证
环境:Bun 1.4.2 / Windows 11 (NT 10.0.26200)
CI(本 PR 的 checks,全部 pass):Typecheck / Focused tests / Full unit tests (advisory) / Secret scan。
本地
Open questions
见 ADR §Open questions(resume 数据源、
status.phase是否够用)。第 3 条messageId与runId的取舍已在 #43 落地为"message 级事件携带messageId,run 级只带runId"。Rebase 说明
已 rebase 到最新
main(046b5d3)。栈 #41 → #42 → #43;合并时以 #43 栈顶一次性带入完整协议增量,不再分别 squash #41/#42。