Repository navigation
fix(openai): accept SDK response event interfaces - #98
Merged
Merged
Conversation
Kinfe123
commented
Oct 30, 2026
Kinfe123
left a comment
Collaborator
Author
There was a problem hiding this comment.
lgtm, real openai sdk streams now typecheck without casts.
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.
Problem
With streamfold 0.1.14 and openai 7.45.1, passing the result of
client.responses.create({ model, input, stream: true })directly toreadStructured(events, { integration: openAI })fails TypeScript compilation. Feeding SDK events intopushorpushAllfails too, even though the adapter can ignore non-tool events at runtime.Root cause
The fallback event type requires a string index signature. The SDK declares its events as interfaces without that signature, so events such as audio deltas cannot satisfy the adapter's union.
Change
Add a minimal discriminator-only fallback to the existing union. Keep the existing branches so raw event literals with extra provider fields remain accepted. There is no runtime or parser change and no SDK runtime dependency.
Verification
pnpm typecheckfails before the declaration change with TS2322/TS2345 at the real SDK boundaries and passes afterward.pnpm release:checkpasses: 197 JavaScript tests, 11 Rust tests, type/syntax checks, WASM build, formatting, Clippy, and package checks.Public surface
Widens
OpenAiResponsesToolEventwithout removing any existing shape. Updates API documentation and the unreleased changelog. OpenAI is a development-only dependency for the consumer type check.