fix(sdk): preserve V2Event name for SSE streams by thdxr · Pull Request #34171 · anomalyco/opencode · GitHub
Skip to content

fix(sdk): preserve V2Event name for SSE streams#34171

Merged
kitlangton merged 1 commit into
devfrom
event-name-fix
Jun 28, 2026
Merged

fix(sdk): preserve V2Event name for SSE streams#34171
kitlangton merged 1 commit into
devfrom
event-name-fix

Conversation

@thdxr

@thdxr thdxr commented Jun 27, 2026

Copy link
Copy Markdown
Member

Summary

  • patch effect@4.0.0-beta.83 so StreamSse({ data }) gives its JSON-string transport wrapper a distinct ${Identifier}Stream OpenAPI identifier
  • regenerate the JS SDK and published OpenAPI spec so the event union is V2Event and the wrapper is V2EventStream
  • switch TUI usage back to the clean V2Event type and add a regression test for the OpenAPI schema shape

Why

StreamSse({ data: EventSchema }) wraps the SSE data: field with Schema.fromJsonString(EventSchema). The wrapper was resolving to the same identifier as the decoded schema, so the string wrapper claimed V2Event and the real union was emitted as V2Event1.

This fixes the collision at the Effect schema source instead of post-processing opencode's SDK output.

Validation

  • cd packages/opencode && bun test test/server/httpapi-public-openapi.test.ts
  • cd packages/opencode && bun typecheck
  • cd packages/client && bun test test/effect.test.ts
  • cd packages/client && bun run generate && bun run check:generated
  • ./packages/sdk/js/script/build.ts
  • cd packages/sdk/js && bun tsc
  • cd packages/tui && bun typecheck
  • grep -rn '\bV2Event1\b' packages/sdk/js/src returns no matches

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@kitlangton kitlangton merged commit 6446b8a into dev Jun 28, 2026
11 checks passed
@kitlangton kitlangton deleted the event-name-fix branch June 28, 2026 01:05
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