Skip to main content

Module wire

Module wire 

Source
Expand description

View-building helpers for the interception-port call sites (PLUGIN-SPEC §4’s nine rows, P2).

The bounds here are the §3.2 byte bounds and §7.6’s frame bound, enforced before serialization; the digests are the §3.2 *_sha256 fields. They live in kian-plugin because K10 allows exactly one new dependency this round (sha2, here) — every call site (kian-loop, kian-cli) digests through these functions instead of growing its own sha2 edge, and kian-dsh (which may not depend on this crate at all, §3.5) ships its own local implementation over the same constants.

Redaction is deliberately absent: tier-0 handlers receive the unredacted view (§3.2 — same process, same authority), and the secret redactor runs at the sidecar wire (P3), not at these call sites.

Constants§

FRAME_PAYLOAD_MAX_BYTES
§7.6’s frame bound: one line, either direction, is at most max_payload_kib (256 KiB) — the bound a §3.2.5 arguments value must fit to ride parsed.
PREVIEW_MAX_BYTES
§3.2’s content_preview bound: ≤4096 bytes of the head of the content, cut at a UTF-8 character boundary.

Functions§

bounded_value
§3.2.5’s exhaustive two-form rule for arguments: the parsed value when its serialization fits the frame bound, else the longest character-boundary prefix that fits, as a string — never a partially serialized object. Returns (arguments, truncated).
preview
§3.2’s preview rule: the head of content, at most PREVIEW_MAX_BYTES bytes, cut at a UTF-8 character boundary; the flag is true when the preview is shorter than the content.
serialized
The exact serialized form a digest or byte count describes (§3.2: content_bytes is the serialized length). Compact JSON — the same bytes serde_json::to_string produces everywhere else.
sha256_hex
The §3.2 *_sha256 digest fields: SHA-256 over the exact bytes, lowercase hex.