Help us shape the future of Go! Take the 2026 Go Developer Survey

livetext

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package livetext reads and joins bounded transient text and reasoning bodies.

Index

Constants

View Source
const MaxBytes = 2048

MaxBytes caps one preview frame before transport encoding.

Variables

This section is empty.

Functions

func BoundaryLoop

func BoundaryLoop(body json.RawMessage) (string, bool)

BoundaryLoop names the loop whose gapped previews a committed boundary clears. A boundary without a loop identifier clears all preview gaps.

func Join

func Join(first json.RawMessage, text string) (json.RawMessage, error)

Join replaces the first body's text with the concatenation the caller checked against MaxBytes. All other public fields stay present.

func Merge

func Merge(first, next json.RawMessage) (json.RawMessage, bool)

Merge joins only adjacent chunks of the same kind, loop and turn within the raw cap.

Types

type Delta

type Delta struct {
	Version   int    `json:"v"`
	Type      string `json:"type"`
	SessionID string `json:"session_id"`
	LoopID    string `json:"loop_id"`
	TurnID    string `json:"turn_id"`
	Chunk     struct {
		Type     string `json:"chunk_type"`
		Text     string `json:"text"`
		Thinking string `json:"thinking"`
	} `json:"chunk"`
}

Delta is the correlation and visible content of one public TokenDelta body.

func Parse

func Parse(body json.RawMessage) (Delta, bool)

Parse accepts only bounded text or reasoning deltas with loop and turn identities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL