Commit d624cbd
committed
refactor(runtime): drop unused receiver from handleStream
handleStream is the chunked-stream aggregator that turns an LLM
provider's chat.MessageStream into a streamResult plus a sequence
of events. It was declared as a method on *LocalRuntime, but its
body never touches `r` — the receiver is purely an artefact of
where the file sits. Drop it.
This is a pure isolation win, not a behaviour change:
- handleStream is now a free function, callable (and unit-testable)
without spinning up a LocalRuntime, a team, hooks, or anything
else; a mock chat.MessageStream is the only dependency.
- The events parameter tightens from `chan Event` to `chan<- Event`,
matching the rest of the package's send-only conventions and
documenting that the function never reads from the channel.
- Doc comment now states the dependency direction explicitly: the
loop calls into the chunker, never the reverse.
- Only caller (tryModelWithFallback in fallback.go) updated to drop
the `r.` qualifier.
streamResult and stripImageContent are unchanged. A future
follow-up could lift this into pkg/runtime/internal/streamproc to
enforce the boundary at compile time, but that requires inverting
the events-channel dependency (Event is currently a runtime type)
and is out of scope here.
Assisted-By: docker-agent1 parent b27e9d2 commit d624cbd
2 files changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
| |||
0 commit comments