feat(ai): stream AI suggestions over HTTP - #664
Open
Reversean wants to merge 1 commit into
Open
Conversation
This was referenced Jul 29, 2026
Reversean
force-pushed
the
feat/ai-streaming
branch
from
July 29, 2026 13:26
2265cba to
6bf913f
Compare
Reversean
changed the base branch from
chore/bump-types-node
to
fix/ai-prompt-injection
July 29, 2026 14:31
Reversean
force-pushed
the
feat/ai-streaming
branch
from
July 29, 2026 16:04
2ee7bd0 to
497be8b
Compare
Reversean
force-pushed
the
feat/ai-streaming
branch
from
July 29, 2026 16:07
497be8b to
9ff73a0
Compare
Reversean
force-pushed
the
feat/ai-streaming
branch
from
July 29, 2026 17:21
9ff73a0 to
8f8ee4a
Compare
An Ask AI suggestion takes tens of seconds to generate, and the GraphQL resolver can only return it once the model has finished. Suggestions are now also available as a stream over a plain Express route, guarded by the same workspace membership check as the resolver and rejecting requests missing the project, event or repetition id before reaching the model.
Reversean
force-pushed
the
feat/ai-streaming
branch
from
July 29, 2026 17:49
8f8ee4a to
bd3667c
Compare
e11sy
reviewed
Jul 31, 2026
| }); | ||
| } | ||
|
|
||
| const res: any = new Writable({ |
Member
There was a problem hiding this comment.
probably could be typed, since you assign it right away
Comment on lines
+93
to
+108
| const response = result.toUIMessageStreamResponse(); | ||
|
|
||
| res.status(response.status); | ||
| response.headers.forEach((value, key) => res.setHeader(key, value)); | ||
|
|
||
| if (!response.body) { | ||
| res.end(); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| Readable.fromWeb(response.body as NodeReadableStream<Uint8Array>).pipe(res); | ||
| } catch (error) { | ||
| next(error); | ||
| } | ||
| }); |
Member
There was a problem hiding this comment.
we can just use
result.pipeUIMessageStreamToResponse(res);with extra options or just
result.pipeTextStreamToResponse(res);since we don't need any metadata toolcalls etc
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.
GET /integration/ai/streamExpress route.Responsereturned by the AI SDK'stoUIMessageStreamResponse()is adapted onto the Express response.ReadableStream/Responseas ESLint globals (.eslintrc.js) - valid Node 18+ runtime globals that predate ESLint's bundlednodeenv.