Project releases
MidStream inspects a model's output while it is still streaming
MidStream analyses LLM output in flight rather than after the fact. A September change adds the aidefence-core Rust crate over shared pattern packs, with pack driven prompt injection detection for tool invocation and exfiltration URLs.
GitHub activity: · Published:
What MidStream is
Waiting for a model to finish before checking its output wastes the only moment when intervention is cheap. MidStream does inflight analysis on the stream itself, in Rust, with a WASM build for the browser and a QUIC transport.
What changed
Pull request #102 adds the aidefence-core crate built over shared AIDefence pattern packs. It follows pack driven prompt injection detection covering tool invocation attempts, exfiltration URLs and encoded input.
Get started
For the browser or Node build:
npm install @midstream/wasm
Expected result: the WASM bundle available to analyse a stream as it arrives.
For Rust, add the published crates from crates.io to your Cargo.toml.
Detection packs catch patterns. They are a layer, not a guarantee, and should sit alongside permission limits rather than replace them.
Use it today
Practical case: an agent that can call tools, reading untrusted web content. Input is the model stream; the workflow is scan for injection patterns mid flight; the output is an early stop instead of an executed instruction.
Acceptance test: feed it a page containing an obvious injection string and confirm the safety gate fires before the tool call.
Push it further
Experimental commentary. Inflight analysis makes real time intervention possible — rerouting, halting, or asking for confirmation while generation continues. The limitation is false positives: a gate that fires constantly gets switched off.
Falsifiable test: run a week of normal traffic through the packs and count false positives. If the rate is not near zero, tune before enforcing.
feat(aimds): add aidefence-core Rust crate over the shared AIDefence pattern packs (#102)