Skip to content

feat(core): add Stream Event Protocol v1 types (ADR 0001) - #41

Open
sjr666666 wants to merge 1 commit into
helsome:mainfrom
sjr666666:feat/27-stream-event-protocol
Open

feat(core): add Stream Event Protocol v1 types (ADR 0001)#41
sjr666666 wants to merge 1 commit into
helsome:mainfrom
sjr666666:feat/27-stream-event-protocol

Conversation

@sjr666666

Copy link
Copy Markdown
Collaborator

Summary

First step of #27 — the pure-type foundation for the Stream Event Protocol v1:

  • packages/core/src/stream-events.ts: versioned envelope (protocolVersion, runId, messageId, monotonic sequence, timestamp, typed payload) plus 12 event types with a per-type payload mapping. Adds text_delta, tool_progress, citation_added, status, cancelled, error on top of the current 8-event AgentEvent.
  • Re-exported from @finagent/core.
  • docs/adr/0001-stream-event-protocol.md: context, decision, migration path (types first, then runtime / transport / renderer), and 3 open questions for reviewers.
  • Unit tests asserting enum completeness and compile-time payload coverage.

No runtime/behavior changeAgentEvent and all existing consumers are untouched; the new protocol types coexist during migration.

Verification

  • bun test packages/core/src/stream-events.test.ts → 4 passed
  • tsc --noEmit for @finagent/core → exit 0
  • Full-workspace typecheck on my local env fails on i18next module resolution (pre-existing under local bun 1.4 layout, unrelated to this diff; no files outside core/docs are touched)

Open questions

See ADR §Open questions: resume data source for v1, status.phase enum sufficiency, and keeping messageId merged with runId. Happy to adjust per review.

@helsome helsome left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先暂缓单独合入。这个 PR 的 StreamEvent 判别联合问题已经由你在 #43 中确认并修复,而且 messageId === runId 与正在实现的 #34 conversation lineage 身份模型冲突。请以 #43 顶层 review 为准,先把 identity contract 定型,再合这组 stack。

@helsome helsome left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更新审核结论:上一轮提到的 identity/reconnect 问题已经在顶层 #43 修掉,不再要求你回头改 #41#41/#42 继续作为 stacked 中间层即可,不建议单独合;现在以已经 APPROVE 的 #43 为最终合入单元,剩余只需把顶层 stack rebase 到最新 main 并通过基础 CI。

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
sjr666666 force-pushed the feat/27-stream-event-protocol branch from 99650f4 to e8d4bb4 Compare September 11, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants