effect-uai-mid-stream-abort
Installation
SKILL.md
effect-uai mid-stream-abort
Cancel an in-flight streamTurn cleanly via
Stream.interruptWhen(Deferred.await(abort)). When the deferred
completes, the stream interrupts, its scope closes, Effect's
structured concurrency tears down the HTTP response, and the underlying
fetch is aborted — the TCP connection drops.
Reach for this when the user says any of:
- "Stop button for the model"
- "Abort the current turn when a new prompt arrives"
- "Hard deadline on a single response"
The pattern
import { Deferred, Effect, Stream, pipe } from "effect"
import { loop, stop, onTurnComplete } from "@effect-uai/core/Loop"