Documentation
¶
Index ¶
- Variables
- func AsTrimmedString(v any) string
- func CloneObject(src map[string]any) map[string]any
- func DecodeJSON(r io.Reader, dst any) error
- func NormalizeNativeTerminalJSON(raw []byte, protocol NativeTerminalProtocol) []byte
- func ParseJSONLike(raw string) any
- func RawString(raw json.RawMessage) string
- func UnsupportedField(obj map[string]any, allowed ...string) (string, bool)
- type NativeTerminalProtocol
- type NativeTerminalStream
Constants ¶
This section is empty.
Variables ¶
var ErrTrailingJSON = errors.New("trailing JSON")
Functions ¶
func AsTrimmedString ¶
AsTrimmedString returns the trimmed string form of v, or "" for non-strings.
func CloneObject ¶ added in v0.29.1
CloneObject returns a writable shallow copy, including for a nil source.
func DecodeJSON ¶ added in v0.29.1
DecodeJSON reads one complete value and preserves numbers in interface values.
func NormalizeNativeTerminalJSON ¶ added in v0.20.0
func NormalizeNativeTerminalJSON(raw []byte, protocol NativeTerminalProtocol) []byte
Keep protocol repair narrow: never invent a terminal event, repair truncated arguments, or change length/refusal/error outcomes. RawMessage preserves usage, large integer metadata, reasoning, signatures, and provider extensions.
func ParseJSONLike ¶
ParseJSONLike parses raw as JSON, returning an empty map for empty input and wrapping unparseable input as {"value": raw}.
func RawString ¶ added in v0.29.1
func RawString(raw json.RawMessage) string
RawString returns the string value of a JSON field, or "" if absent or invalid.
Types ¶
type NativeTerminalProtocol ¶ added in v0.20.0
type NativeTerminalProtocol uint8
NativeTerminalProtocol identifies native wire formats with narrowly bounded terminal compatibility repairs.
const ( NativeChatCompletions NativeTerminalProtocol = iota + 1 NativeMessages NativeResponses )
type NativeTerminalStream ¶ added in v0.20.0
type NativeTerminalStream struct {
Protocol NativeTerminalProtocol
// contains filtered or unexported fields
}
NativeTerminalStream owns only bounded evidence for actual tool calls. It accepts complete SSE data payloads; framing, timeouts, and byte limits remain with the relay. Zero values are valid when Protocol is set before use.
func (*NativeTerminalStream) AddData ¶ added in v0.20.0
func (s *NativeTerminalStream) AddData(raw []byte) []byte