- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 870
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
          
     Open
      
      
            ericallam
  wants to merge
  49
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
feat/realtime-streams-2
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
      
        
          +9,850
        
        
          −1,145
        
        
          
        
      
    
  
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            49 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      1cc511b
              
                fix(realtime): gracefully recover from ECONNRESET errors when sending…
              
              
                ericallam b732879
              
                Add support for multiple writers to a single stream by removing the E…
              
              
                ericallam 771906e
              
                Make the MetadataStream client more robust to failure and add tests
              
              
                ericallam b9d743d
              
                Make the stream client more resilient and robust, including implement…
              
              
                ericallam 32858fe
              
                Add some more streaming examples and markdown streaming
              
              
                ericallam 8628af0
              
                s2 WIP
              
              
                ericallam d8b48c0
              
                Added realtimeStreams column to TaskRun to replace using metadata for…
              
              
                ericallam 192773b
              
                Write to s2 from the client instead of the server
              
              
                ericallam aa309e4
              
                WIP
              
              
                ericallam 0e4b525
              
                Add env var
              
              
                ericallam 4556c11
              
                Loads more stuff
              
              
                ericallam 506cfbc
              
                The stream.read() span now works better when specifying a startIndex
              
              
                ericallam 3721856
              
                WIP
              
              
                ericallam 7f23597
              
                Configure the waitUntil timeout via an env var
              
              
                ericallam 3edc3c3
              
                Return stream parts from SSE class
              
              
                ericallam bd25575
              
                Adds new streams icon
              
              
                samejr 11e069b
              
                Layout improvements to streams inspector
              
              
                samejr b2610a8
              
                Improve layout of streams inspector
              
              
                samejr 718ab6c
              
                Remove tabs if only Overview is shown
              
              
                samejr 8cd881a
              
                Added compact view for streams and sticky copy button
              
              
                ericallam 23b511e
              
                Add AI SDK demo
              
              
                ericallam 5292594
              
                experiment_throttle is now just throttle
              
              
                ericallam 5486c97
              
                Show textwrapping, copy and modal buttons on the Properties code blocks
              
              
                samejr 8fe968f
              
                Use simplr library for plurals and flex wrap the heading info nicely
              
              
                samejr 0d06351
              
                Moves toggle button functionality into the header with new icons
              
              
                samejr e0b2d7b
              
                Make sure the scroll view knows if it’s at the top or bottom even if …
              
              
                samejr b26608b
              
                Improve loading states
              
              
                samejr 90895fb
              
                Add divide between heads and inspector content
              
              
                samejr 0119d93
              
                Remove 0 padding
              
              
                samejr a87f7c7
              
                Adds nice behaviour if a long stream key is used
              
              
                samejr fd8c00e
              
                Disable the header buttons if the content is loading
              
              
                samejr 3b912cd
              
                Fixed failing test
              
              
                ericallam c59b1a7
              
                Improved X-Resume-From-Chunk header parsing
              
              
                ericallam 7f45372
              
                Unify inactivity timeout threshold
              
              
                ericallam 1249e61
              
                If v2 streams is requested, throw an error if S2 env vars are not set
              
              
                ericallam 367af7d
              
                Use implicit radix arg when calling parseInt
              
              
                ericallam 6b90ddc
              
                Consistent API client creation
              
              
                ericallam bdf4612
              
                Normalize the stream source to an async iterable before passing to th…
              
              
                ericallam a9893f0
              
                Refactor the metadata streams stuff to be better
              
              
                ericallam b10dff9
              
                properly abort streams when the waitUntil timeout occurs
              
              
                ericallam 7de813e
              
                fix the new configurable waitUntil timeout
              
              
                ericallam 747f825
              
                prevent memory leaks by cleaning up responses and requests
              
              
                ericallam 6bd09f6
              
                Fix timer leak
              
              
                ericallam bb8df95
              
                use server provided options for the s2 writer
              
              
                ericallam 717b9cc
              
                s2 stream writer now handles abort signals
              
              
                ericallam b5b969e
              
                Fixed core tests
              
              
                ericallam 998c8db
              
                No need to use keys and a Map for stream management
              
              
                ericallam 7872c71
              
                Fixed runStream tests
              
              
                ericallam 0a80d52
              
                Implement TRIGGER_V2_REALTIME_STREAMS env var
              
              
                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,5 @@ | ||
| --- | ||
| "@trigger.dev/sdk": patch | ||
| --- | ||
|  | ||
| gracefully recover from ECONNRESET errors when sending stream data from tasks to the server | 
  
    
      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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.