Expand description
Suture: ultra-low latency streaming JSON repair proxy.
Library surface re-exports the repair engine; the suture binary is the proxy.
Re-exports§
pub use config::Config;
Modules§
- config
- encoding
- HTTP content-encoding handling for the proxy: a small
Encodingmodel plus streaming decode (and, in a later task, encode) so repair operates on plaintext. - proxy
- Reverse proxy router and handler.
Structs§
- Anthropic
- Anthropic Messages SSE extractor.
- Append
Repair - Result of an append-only repair (for streaming passthrough, where already- emitted bytes cannot be retracted).
- OpenAi
- OpenAI Chat Completions SSE extractor.
- Repair
- Result of computing how to make a (possibly truncated) JSON byte stream valid.
- SseRepairer
- Drives SSE repair. Forwards COMPLETE, non-terminator events verbatim while
holding back (a) the current incomplete event and (b) the terminator event.
finishemits synthetic repairs THEN the held terminator, and discards the trailing incomplete event (a conformant client discards it too). Repairs are computed only from forwarded events, matching the client’s reassembly. - Stream
Repairer
Traits§
- Delta
Extractor - A provider-specific adapter that interprets SSE event payloads, routes JSON
delta fragments into
Targets, recognises the stream terminator, and synthesizes the closing SSE bytes from computed repairs.
Functions§
- repair_
str - Repair a complete (possibly truncated) JSON string.
- repair_
stream - Wrap an upstream byte stream, forwarding each chunk verbatim and appending a synthesized repair tail after the upstream ends cleanly. On an upstream error, the error is forwarded and the stream stops (no repair tail).