testutil

package
v0.74.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package testutil provides fixture generators for adapter testing and benchmarking, producing realistic JSONL session files in Claude Code and Codex formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApproximateMessageCount

func ApproximateMessageCount(targetSize int64, avgMessageSize int) int

ApproximateMessageCount returns the message count to generate a file of approximately the given size. size is in bytes, avgMessageSize is the target size per message pair.

func GenerateClaudeCodeSessionFile

func GenerateClaudeCodeSessionFile(path string, messageCount int, avgMessageSize int) error

GenerateClaudeCodeSessionFile creates a JSONL file with realistic message content. messageCount determines the number of message pairs (user + assistant). avgMessageSize is the approximate size of message content in bytes.

func GenerateCodexSessionFile

func GenerateCodexSessionFile(path string, messageCount int, avgMessageSize int) error

GenerateCodexSessionFile creates a JSONL file in Codex format.

Types

type ClaudeCodeMessage

type ClaudeCodeMessage struct {
	Type      string                `json:"type"`
	UUID      string                `json:"uuid"`
	SessionID string                `json:"sessionId"`
	Timestamp time.Time             `json:"timestamp"`
	Message   *ClaudeCodeMsgContent `json:"message,omitempty"`
	CWD       string                `json:"cwd,omitempty"`
	Version   string                `json:"version,omitempty"`
}

ClaudeCodeMessage represents a JSONL message in Claude Code format.

type ClaudeCodeMsgContent

type ClaudeCodeMsgContent struct {
	Role    string           `json:"role"`
	Content json.RawMessage  `json:"content"`
	Model   string           `json:"model,omitempty"`
	Usage   *ClaudeCodeUsage `json:"usage,omitempty"`
}

ClaudeCodeMsgContent holds the actual message content.

type ClaudeCodeUsage

type ClaudeCodeUsage struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
}

ClaudeCodeUsage tracks token usage.

type CodexMessage

type CodexMessage struct {
	Type      string    `json:"type"`
	SessionID string    `json:"session_id,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty"`
	Role      string    `json:"role,omitempty"`
	Content   string    `json:"content,omitempty"`
	Model     string    `json:"model,omitempty"`
	CallID    string    `json:"call_id,omitempty"`
	Name      string    `json:"name,omitempty"`
	Arguments string    `json:"arguments,omitempty"`
	Output    string    `json:"output,omitempty"`
	Input     int       `json:"input,omitempty"`
	Output_   int       `json:"output_,omitempty"` // for usage
}

CodexMessage represents a JSONL message in Codex format.

Jump to

Keyboard shortcuts

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