Documentation
¶
Overview ¶
Package normalizer ports the trajectory normalizer to Go.
Index ¶
- Constants
- Variables
- func NormalizeBytes(data []byte) (*obj, error)
- func NormalizeClaude(records []*obj) *obj
- func NormalizeCodex(records []*obj) *obj
- func NormalizeFile(path string) (*obj, error)
- func NormalizeOpenCode(doc *obj) *obj
- func ShardBytes(doc *obj) (map[string][]byte, error)
- func WriteSharded(doc *obj, dir string) error
- type Source
- type TreeResult
Constants ¶
View Source
const ChunkSize = 1000
Variables ¶
View Source
var ( ErrEmptyInput = errors.New("cannot detect format of an empty file") ErrNoKnownRecords = errors.New("file contains no recognizable records") )
Functions ¶
func NormalizeBytes ¶
NormalizeBytes detects and normalizes one transcript.
func NormalizeClaude ¶
func NormalizeClaude(records []*obj) *obj
NormalizeClaude is the Claude 2.1 adapter; it returns an insertion-ordered document. Two rules from SPEC.md §3.1 drive the shape of this code:
- A key declared absent still occupies its slot, even though it never serializes — so every field is Set here, with Undefined for "absent", in declaration order.
- Assigning to an already-declared key keeps its original slot — so later attachments (result, childSessionId, i) Set on the same object.
func NormalizeCodex ¶
func NormalizeCodex(records []*obj) *obj
func NormalizeFile ¶
func NormalizeOpenCode ¶
func NormalizeOpenCode(doc *obj) *obj
func ShardBytes ¶
ShardBytes returns the relative sharded files for one trajectory.
func WriteSharded ¶
Types ¶
type Source ¶
type Source string
func DetectFormat ¶
DetectFormat implements the reference detector: whole OpenCode documents first, then JSONL Codex sentinel records, with Claude as the JSONL fallback.
type TreeResult ¶
func NormalizeDirectory ¶
func NormalizeDirectory(input, out, linksPath string) (TreeResult, error)
NormalizeDirectory normalizes a set and writes the oracle-compatible tree.
Click to show internal directories.
Click to hide internal directories.