Documentation
¶
Overview ¶
Package jsonspan extracts the exact byte span of a value inside a single-line JSON object, walking JSON syntax (strings, escapes, nesting) without ever parse-and-reserializing. It exists because the span rule (docs/export-format-v1.md §1.2) makes raw byte spans load-bearing: the bytes that were signed are the bytes that must come back out, verbatim.
The Week-1 export tests carry an intentionally independent copy of this scanner (internal/exportv1/span_test.go); this package is the production version used by the Week-2 log envelope and export bridge.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTopLevelValue ¶
ExtractTopLevelValue returns the exact byte span of the value for key in the top-level JSON object encoded by line. The returned slice aliases line; callers must not modify it.
func TopLevelSpan ¶
TopLevelSpan returns the half-open byte offsets [start, end) of the value for key in the top-level JSON object encoded by line. Offsets, rather than the aliased slice ExtractTopLevelValue returns, are what a splicer needs: the MCP proxy rebuilds a tools/call line around the params._meta span and must copy every other byte through untouched.
Types ¶
type Field ¶
Field is one member of a JSON object: its decoded name and the byte span of its raw value.
func TopLevelKeys ¶
TopLevelKeys returns the keys of the top-level JSON object encoded by line, in the order they appear, each paired with its value's byte span. The proxy uses it to build a payload's field-digest manifest without re-serializing any value (Q37).