Expand description
Output compaction, byte caps and redaction.
Structsยง
Enumsยง
Constantsยง
- MARKER_
RESERVE ๐ - Bytes reserved inside the budget for the
truncated/original_byteskeys (and a wrapper for a non-object root). - MIN_
SHORTEN_ ๐LEN - A string at or below this length is never shortened (the marker would not save bytes).
- SHORTEN_
SLACK ๐ - Extra bytes removed past the excess when shortening a string, so the
...[+N bytes]tail always nets a saving.
Functionsยง
- cap_
json - Cap
valueatcap.max_bytes(exempt arrays aside) and keep it valid JSON. A reduced result carries"truncated": trueand"original_bytes": n. - children ๐
- Visit every child value that is not an exempt array.
- compact_
form_ field - Keep the form-field keys the agent needs (
packages/schema/src/form.ts:53-119). - compact_
message - compact_
permission - cut_
array_ ๐tail - cut_
object_ ๐tail - depth_
cap - Replace every container nested deeper than
max_depth(the root is depth 0) with"<depth>". - for_
first_ ๐mut - largest ๐
- pick ๐
- redact
- Redact secret-bearing keys and strip URL userinfo from every string.
- redact_
text - Remove
user[:pass]@from everyscheme://user:pass@hostins. - reduce_
exempt ๐ - Reduce every exempt array found under
v; returns whether anything changed. - scalar_
len ๐ - scalar_
or_ ๐full_ len - sensitive_
key ๐ - shorten_
string ๐ - shrink ๐
- Reduce
vuntilsize(v, skip) <= budget: arrays cut at element boundaries, then the longest strings shortened, then (last resort, so the bound always holds) object entries dropped. - size ๐
- Serialised length of
v, counting an array under an exempt key as[]. - str_of ๐
- unwrap_
envelope - Split a CLI envelope into
(data, cursor, meta); a_tagenvelope is aCLI_ERROR.