Skip to main content

Module inspect

Module inspect 

Source
Expand description

Inspection surface for outbound wire bodies.

The gateway forwards some requests as the caller’s own bytes rather than rebuilding them from CanonicalRequest. Governance still reasons about the canonical form, and that form is lossy by construction: the inbound parser drops any content block whose type it does not model, images carry no text, and structuredContent / _meta have no canonical home. Anything in one of those places would reach the provider without a scanner ever seeing it.

string_leaves closes that gap by reading the bytes that are actually going upstream and collecting every string in them, whatever shape the JSON takes. Attaching the result to the canonical request makes the scan surface a superset of the forwarded surface, so “inspected” and “sent” cannot diverge.

The response direction has the same gap and the same remedy, against the bytes the client receives rather than the bytes the provider sent: string_leaves for a buffered reply, sse_string_leaves for a streamed one, whose bytes are concatenated SSE frames and not a JSON document.

Copyright (c) systemprompt.io — Business Source License 1.1. See https://systemprompt.io for licensing details.

Structs§

ForwardedSurface
truncated means a budget stopped the walk, so the surface is a subset of the body and a scanner reading it may miss content that was still sent. Callers record that; it is never a silent success.
SurfaceBudget
A forwarded body is caller-controlled, so every dimension an attacker could grow without bound has a ceiling here.
SurfaceLeaf

Functions§

sse_string_leaves
string_leaves