The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as Stream from "effect/Stream"; |
| 3 | |
| 4 | export function rpcInitialItems<A>(items: ReadonlyArray<A>): Stream.Stream<A> { |
| 5 | let pending: ReadonlyArray<A> | undefined = items; |
| 6 | return Stream.unwrap( |
| 7 | Effect.sync(() => { |
| 8 | const initial = pending; |
| 9 | // concat retains the initial stream during live tailing; release delivered snapshots and rows. |
| 10 | pending = undefined; |
| 11 | return initial === undefined ? Stream.empty : Stream.fromIterable(initial); |
| 12 | }), |
| 13 | ); |
| 14 | } |