-
-
Notifications
You must be signed in to change notification settings - Fork 883
feat(realtime): Realtime streams v2 #2632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+11,502
−1,375
Merged
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
10418d8
fix(realtime): gracefully recover from ECONNRESET errors when sending…
ericallam fb2d548
Add support for multiple writers to a single stream by removing the E…
ericallam 4bdda7a
Make the MetadataStream client more robust to failure and add tests
ericallam 278aad2
Make the stream client more resilient and robust, including implement…
ericallam de51c26
Add some more streaming examples and markdown streaming
ericallam 17ffdf3
s2 WIP
ericallam 500bf15
Added realtimeStreams column to TaskRun to replace using metadata for…
ericallam f56ad0c
Write to s2 from the client instead of the server
ericallam bbdbe71
WIP
ericallam d6ef9be
Add env var
ericallam dccd43f
Loads more stuff
ericallam c084c1a
The stream.read() span now works better when specifying a startIndex
ericallam d6af637
WIP
ericallam 33887cc
Configure the waitUntil timeout via an env var
ericallam a4ab169
Return stream parts from SSE class
ericallam fceefd9
Adds new streams icon
samejr 5f4de7f
Layout improvements to streams inspector
samejr 3ff8dc8
Improve layout of streams inspector
samejr 3516897
Remove tabs if only Overview is shown
samejr 16c17e0
Added compact view for streams and sticky copy button
ericallam 12ddd4b
Add AI SDK demo
ericallam 8c1e384
experiment_throttle is now just throttle
ericallam 908dd1c
Show textwrapping, copy and modal buttons on the Properties code blocks
samejr d299a38
Use simplr library for plurals and flex wrap the heading info nicely
samejr 1f00978
Moves toggle button functionality into the header with new icons
samejr 9f837b5
Make sure the scroll view knows if it’s at the top or bottom even if …
samejr 2303ec2
Improve loading states
samejr ad0954f
Add divide between heads and inspector content
samejr 77cb137
Remove 0 padding
samejr 6c30fda
Adds nice behaviour if a long stream key is used
samejr 4253f84
Disable the header buttons if the content is loading
samejr 8b3b8a5
Fixed failing test
ericallam 6bd2354
Improved X-Resume-From-Chunk header parsing
ericallam 92e85d8
Unify inactivity timeout threshold
ericallam c0f7612
If v2 streams is requested, throw an error if S2 env vars are not set
ericallam 0326f5f
Use implicit radix arg when calling parseInt
ericallam 83823e8
Consistent API client creation
ericallam 81ea750
Normalize the stream source to an async iterable before passing to th…
ericallam 3fc6e96
Refactor the metadata streams stuff to be better
ericallam a8110c4
properly abort streams when the waitUntil timeout occurs
ericallam 178b490
fix the new configurable waitUntil timeout
ericallam 234bd93
prevent memory leaks by cleaning up responses and requests
ericallam fd40ab7
Fix timer leak
ericallam 4c76837
use server provided options for the s2 writer
ericallam f0d5e42
s2 stream writer now handles abort signals
ericallam 581135c
Fixed core tests
ericallam 5dcf303
No need to use keys and a Map for stream management
ericallam 9286e9b
Fixed runStream tests
ericallam 9e5460d
Implement TRIGGER_V2_REALTIME_STREAMS env var
ericallam bd18134
New streams API (sync pipe with default)
ericallam 57db0a6
Fixed useRealtimeStream issue because of overloading
ericallam f80e4c0
Prevent initializing a realtime stream on a completed run
ericallam d4d7f01
Add streams.append
ericallam 3cc9ba6
Nicer API and update the s2 writer to use the new append session
ericallam 5a4deac
Use a readable stream directly
ericallam 396f325
Implement s2 chunk deduping
ericallam d4e1c98
Fix tests
ericallam 37eb03a
couple of fixes
ericallam e979f52
Improve stream dashboard perf with virtualization
ericallam a0c3963
Fix streams.append for s2, and a bunch of other little things, plus t…
ericallam b5db525
close the controller when signal aborts
ericallam 967f418
Fix waitForStreams async executor
ericallam 557b48a
change info logs to debug
ericallam 1626195
fix streams test
ericallam 211d804
Update changeset to be a minor update
ericallam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@trigger.dev/sdk": minor | ||
| "@trigger.dev/react-hooks": minor | ||
| --- | ||
|
|
||
| Realtime streams v2 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| export function ListBulletIcon({ className }: { className?: string }) { | ||
| return ( | ||
| <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path | ||
| d="M9 5H20" | ||
| stroke="currentColor" | ||
| strokeWidth="2" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| d="M9 12H20" | ||
| stroke="currentColor" | ||
| strokeWidth="2" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| d="M9 19H20" | ||
| stroke="currentColor" | ||
| strokeWidth="2" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <circle cx="4" cy="5" r="1" fill="currentColor" /> | ||
| <circle cx="4" cy="12" r="1" fill="currentColor" /> | ||
| <circle cx="4" cy="19" r="1" fill="currentColor" /> | ||
| </svg> | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| export function MoveToBottomIcon({ className }: { className?: string }) { | ||
| return ( | ||
| <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path | ||
| d="M12 15L12 3" | ||
| stroke="currentColor" | ||
| strokeWidth="2" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| d="M3 21L21 21" | ||
| stroke="currentColor" | ||
| strokeWidth="2" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| d="M7.5 12.5L12 17L16.5 12.5" | ||
| stroke="currentColor" | ||
| strokeWidth="2" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| </svg> | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| export function SnakedArrowIcon({ className }: { className?: string }) { | ||
| return ( | ||
| <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path | ||
| d="M5 5H16C17.6569 5 19 6.34315 19 8L19 8.5C19 10.1569 17.6569 11.5 16 11.5H8C6.34314 11.5 5 12.8431 5 14.5L5 15C4.99999 16.6569 6.34314 18 8 18H18.634" | ||
| stroke="currentColor" | ||
| strokeWidth="2" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| d="M16 21L19 18L16 15" | ||
| stroke="currentColor" | ||
| strokeWidth="2" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| </svg> | ||
| ); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export function StreamsIcon({ className }: { className?: string }) { | ||
| return ( | ||
| <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path d="M3 19C3 19 5.01155 17 8 17C10.9885 17 13 18.9973 16 18.9973C19 18.9973 21 17 21 17" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/> | ||
| <path d="M3 13.0001C3 13.0001 5.01155 11 8 11C10.9885 11 13 13 16 13C19 13 21 11.0001 21 11.0001" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/> | ||
| <path d="M3 7C3 7 5.01155 5 8 5C10.9885 5 13 6.9973 16 6.9973C19 6.9973 21 5 21 5" stroke="currentColor" strokeWidth="2" strokeLinecap="round"/> | ||
| </svg> | ||
| ); | ||
| } | ||
|
|
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make realtime-stream id parsing robust; normalize metadata null-to-undefined.
Split at the first colon to preserve streamKey with colons; ensure metadata is undefined (not null) on parse failure.
🤖 Prompt for AI Agents