[skip-tag:sdk] feat(sdk/engine): StreamRouter for multi-sink delta fan-out (2/4)#75
Merged
Conversation
- StreamSink interface + StreamSinkFunc adapter for stream-delta consumers (SSE, WebSocket, log forwarders, etc.). - StreamRouter fans out an event.Bus subscription on SubjectStreamDelta to any number of attached sinks with per-sink error isolation. - Auto-teardown on SubjectRunEnd; explicit Close() drains and detaches sinks. - Attach-after-Close is rejected; sink errors are logged via the configured logger but do not propagate to peer sinks. Additive only. Co-authored-by: Cursor <cursoragent@cursor.com>
4 tasks
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.
Summary
Part 2 of 4 in the v0.2.x additive SDK batch. Tagging suppressed via
[skip-tag:sdk]; cumulativesdk/v0.2.9tag will be cut on PR 4/4.Introduces a centralized stream-delta fan-out mechanism so multiple consumers
(SSE, WebSocket, log forwarders, custom telemetry) can share one subscription
to
SubjectStreamDeltaevents without each rolling their own subscriber.Surface
StreamSinkinterface — singleOnDelta(ctx, env, delta)method.StreamSinkFunc— function adapter for stateless sinks.StreamRouter— bus-agnostic fan-out:NewStreamRouter(bus, opts...) *StreamRouterAttach(name, sink) error/Detach(name)Close()— drains and detaches all sinks.SubjectRunEnd(configurable via option).not affect peers.
Test plan
go vet ./engine/...go test ./engine/... -count=1sdk/engine/stream_sink_test.gocovers:SubjectRunEndtriggers auto-teardown.AttachafterClosereturns an error.Release notes
Additive; no breaking changes. Tag deferred to PR 4/4.
Made with Cursor