Conversation
Bumps [basic-ftp](https://github.com/patrickjuchli/basic-ftp) from 5.0.5 to 5.2.0. - [Release notes](https://github.com/patrickjuchli/basic-ftp/releases) - [Changelog](https://github.com/patrickjuchli/basic-ftp/blob/master/CHANGELOG.md) - [Commits](patrickjuchli/basic-ftp@v5.0.5...v5.2.0) --- updated-dependencies: - dependency-name: basic-ftp dependency-version: 5.2.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
…em-tests/browser-direct-import/basic-ftp-5.2.0 chore(deps): bump basic-ftp from 5.0.5 to 5.2.0 in /ecosystem-tests/browser-direct-import
* chore(internal): refactor imports * refactor(tests): switch from prism to steady * chore(tests): bump steady to v0.19.4 * feat(client): add async iterator and stream() to WebSocket classes * chore(tests): bump steady to v0.19.5 * release: 6.33.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
* Release please branches master changes next components OpenAI (#22) (#23) * chore(internal): refactor imports * refactor(tests): switch from prism to steady * chore(tests): bump steady to v0.19.4 * feat(client): add async iterator and stream() to WebSocket classes * chore(tests): bump steady to v0.19.5 * release: 6.33.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> * chore(deps): bump seroval and solid-js in /ecosystem-tests/vercel-edge (#25) Bumps [seroval](https://github.com/lxsmnsyc/seroval) and [solid-js](https://github.com/solidjs/solid). These dependencies needed to be updated together. Updates `seroval` from 0.5.1 to 1.4.2 - [Release notes](https://github.com/lxsmnsyc/seroval/releases) - [Commits](https://github.com/lxsmnsyc/seroval/commits) Updates `solid-js` from 1.7.11 to 1.9.6 - [Release notes](https://github.com/solidjs/solid/releases) - [Changelog](https://github.com/solidjs/solid/blob/main/CHANGELOG.md) - [Commits](solidjs/solid@v1.7.11...v1.9.6) --- updated-dependencies: - dependency-name: seroval dependency-version: 1.4.2 dependency-type: indirect - dependency-name: solid-js dependency-version: 1.9.6 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Release please branches master changes next components OpenAI (#22) (#23) * chore(internal): refactor imports * refactor(tests): switch from prism to steady * chore(tests): bump steady to v0.19.4 * feat(client): add async iterator and stream() to WebSocket classes * chore(tests): bump steady to v0.19.5 * release: 6.33.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> * chore(deps): bump seroval and solid-js in /ecosystem-tests/vercel-edge (#25) Bumps [seroval](https://github.com/lxsmnsyc/seroval) and [solid-js](https://github.com/solidjs/solid). These dependencies needed to be updated together. Updates `seroval` from 0.5.1 to 1.4.2 - [Release notes](https://github.com/lxsmnsyc/seroval/releases) - [Commits](https://github.com/lxsmnsyc/seroval/commits) Updates `solid-js` from 1.7.11 to 1.9.6 - [Release notes](https://github.com/solidjs/solid/releases) - [Changelog](https://github.com/solidjs/solid/blob/main/CHANGELOG.md) - [Commits](solidjs/solid@v1.7.11...v1.9.6) --- updated-dependencies: - dependency-name: seroval dependency-version: 1.4.2 dependency-type: indirect - dependency-name: solid-js dependency-version: 1.9.6 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Main (#26) (#27) * Release please branches master changes next components OpenAI (#22) (#23) * chore(internal): refactor imports * refactor(tests): switch from prism to steady * chore(tests): bump steady to v0.19.4 * feat(client): add async iterator and stream() to WebSocket classes * chore(tests): bump steady to v0.19.5 * release: 6.33.0 --------- * chore(deps): bump seroval and solid-js in /ecosystem-tests/vercel-edge (#25) Bumps [seroval](https://github.com/lxsmnsyc/seroval) and [solid-js](https://github.com/solidjs/solid). These dependencies needed to be updated together. Updates `seroval` from 0.5.1 to 1.4.2 - [Release notes](https://github.com/lxsmnsyc/seroval/releases) - [Commits](https://github.com/lxsmnsyc/seroval/commits) Updates `solid-js` from 1.7.11 to 1.9.6 - [Release notes](https://github.com/solidjs/solid/releases) - [Changelog](https://github.com/solidjs/solid/blob/main/CHANGELOG.md) - [Commits](solidjs/solid@v1.7.11...v1.9.6) --- updated-dependencies: - dependency-name: seroval dependency-version: 1.4.2 dependency-type: indirect - dependency-name: solid-js dependency-version: 1.9.6 dependency-type: indirect ... --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Release please branches master changes next components OpenAI (#22) (#23) * chore(internal): refactor imports * refactor(tests): switch from prism to steady * chore(tests): bump steady to v0.19.4 * feat(client): add async iterator and stream() to WebSocket classes * chore(tests): bump steady to v0.19.5 * release: 6.33.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> * chore(deps): bump seroval and solid-js in /ecosystem-tests/vercel-edge (#25) Bumps [seroval](https://github.com/lxsmnsyc/seroval) and [solid-js](https://github.com/solidjs/solid). These dependencies needed to be updated together. Updates `seroval` from 0.5.1 to 1.4.2 - [Release notes](https://github.com/lxsmnsyc/seroval/releases) - [Commits](https://github.com/lxsmnsyc/seroval/commits) Updates `solid-js` from 1.7.11 to 1.9.6 - [Release notes](https://github.com/solidjs/solid/releases) - [Changelog](https://github.com/solidjs/solid/blob/main/CHANGELOG.md) - [Commits](solidjs/solid@v1.7.11...v1.9.6) --- updated-dependencies: - dependency-name: seroval dependency-version: 1.4.2 dependency-type: indirect - dependency-name: solid-js dependency-version: 1.9.6 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Main (#26) (#27) * Release please branches master changes next components OpenAI (#22) (#23) * chore(internal): refactor imports * refactor(tests): switch from prism to steady * chore(tests): bump steady to v0.19.4 * feat(client): add async iterator and stream() to WebSocket classes * chore(tests): bump steady to v0.19.5 * release: 6.33.0 --------- * chore(deps): bump seroval and solid-js in /ecosystem-tests/vercel-edge (#25) Bumps [seroval](https://github.com/lxsmnsyc/seroval) and [solid-js](https://github.com/solidjs/solid). These dependencies needed to be updated together. Updates `seroval` from 0.5.1 to 1.4.2 - [Release notes](https://github.com/lxsmnsyc/seroval/releases) - [Commits](https://github.com/lxsmnsyc/seroval/commits) Updates `solid-js` from 1.7.11 to 1.9.6 - [Release notes](https://github.com/solidjs/solid/releases) - [Changelog](https://github.com/solidjs/solid/blob/main/CHANGELOG.md) - [Commits](solidjs/solid@v1.7.11...v1.9.6) --- updated-dependencies: - dependency-name: seroval dependency-version: 1.4.2 dependency-type: indirect - dependency-name: solid-js dependency-version: 1.9.6 dependency-type: indirect ... --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb31c761f7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| stream(): AsyncIterableIterator<ResponsesStreamMessage> { | ||
| return this[Symbol.asyncIterator](); |
There was a problem hiding this comment.
Add iterator support to the realtime WebSocket clients too
If a consumer applies the new for await/.stream() pattern to the other public websocket entry points (src/realtime/ws.ts, src/realtime/websocket.ts, and the src/beta/... variants), those classes still throw because they do not implement stream() or Symbol.asyncIterator. That leaves the SDK with two incompatible websocket APIs under one feature, so shared helpers over responses and realtime sockets will fail at runtime unless the sibling classes are updated as well.
Useful? React with 👍 / 👎.
| const push = (msg: ResponsesStreamMessage) => { | ||
| queue.push(msg); | ||
| resolvers.shift()?.(); | ||
| }; |
There was a problem hiding this comment.
Should we add a hard cap to the queue and define an overflow behavior? Right now this is an unbounded in-memory buffer. a slow or abandoned consumer might cause unbounded growth.
| this.on('error', onEmitterError); | ||
| this.socket.on('open', onOpen); | ||
| this.socket.on('close', onClose); |
There was a problem hiding this comment.
Curious, does each iterator attach its own listeners? if so, this might increase memory usage. Probably not a concern but we should either enforce its ownership or document that multi-consumer duplication is intentional.
| switch (this.socket.readyState) { | ||
| case WS.WebSocket.CONNECTING: | ||
| push({ type: 'connecting' }); | ||
| break; | ||
| case WS.WebSocket.OPEN: | ||
| push({ type: 'open' }); | ||
| break; | ||
| case WS.WebSocket.CLOSING: | ||
| push({ type: 'closing' }); | ||
| break; | ||
| case WS.WebSocket.CLOSED: | ||
| push({ type: 'close' }); | ||
| done = true; | ||
| cleanup(); | ||
| break; | ||
| } |
There was a problem hiding this comment.
This looks like it could be a race condition. The socket can transition after listeners are attached BUT before the readyState switch runs. That might end up enqueueing dupes of open or close events. I wonder if we should route these through a guarded call like emitOpen / emitClose
Changes being requested
Additional context & links