Documentation
¶
Overview ¶
Package testjsonl provides shared JSONL fixture builders for Claude and Codex session test data. Used by both parser and sync test packages.
Index ¶
- func ClaudeAssistantJSON(content any, timestamp string) string
- func ClaudeEntryJSON(entryType, content, timestamp, uuid, parentUuid string, cwd ...string) string
- func ClaudeMetaUserJSON(content, timestamp string, meta, compact bool) string
- func ClaudeSnapshotJSON(timestamp string) string
- func ClaudeToolResultUserJSON(toolUseID, resultContent, timestamp string) string
- func ClaudeUserJSON(content, timestamp string, cwd ...string) string
- func ClaudeUserWithSessionIDJSON(content, timestamp, sessionID string, cwd ...string) string
- func CodexFunctionCallArgsJSON(name string, arguments any, timestamp string) string
- func CodexFunctionCallFieldsJSON(name string, arguments, input any, timestamp string) string
- func CodexFunctionCallJSON(name, summary, timestamp string) string
- func CodexFunctionCallOutputJSON(callID string, output any, timestamp string) string
- func CodexFunctionCallWithCallIDJSON(name, callID string, arguments any, timestamp string) string
- func CodexMsgJSON(role, text, timestamp string) string
- func CodexSessionMetaJSON(id, cwd, originator, timestamp string) string
- func CodexTokenCountJSON(timestamp string, inputTokens, outputTokens, cachedInputTokens int) string
- func CodexTurnContextJSON(model, timestamp string) string
- func GeminiAssistantMsg(id, timestamp, content string, opts *GeminiMsgOpts) map[string]any
- func GeminiInfoMsg(id, timestamp, content, msgType string) map[string]any
- func GeminiSessionJSON(sessionID, projectHash string, startTime, lastUpdated string, ...) string
- func GeminiUserMsg(id, timestamp, content string) map[string]any
- func JoinJSONL(lines ...string) string
- type GeminiMsgOpts
- type GeminiThought
- type GeminiToolCall
- type SessionBuilder
- func (b *SessionBuilder) AddClaudeAssistant(timestamp, text string) *SessionBuilder
- func (b *SessionBuilder) AddClaudeAssistantWithUUID(timestamp, text, uuid, parentUuid string) *SessionBuilder
- func (b *SessionBuilder) AddClaudeMetaUser(timestamp, content string, meta, compact bool) *SessionBuilder
- func (b *SessionBuilder) AddClaudeUser(timestamp, content string, cwd ...string) *SessionBuilder
- func (b *SessionBuilder) AddClaudeUserWithSessionID(timestamp, content, sessionID string, cwd ...string) *SessionBuilder
- func (b *SessionBuilder) AddClaudeUserWithUUID(timestamp, content, uuid, parentUuid string, cwd ...string) *SessionBuilder
- func (b *SessionBuilder) AddCodexFunctionCall(timestamp, name, summary string) *SessionBuilder
- func (b *SessionBuilder) AddCodexMessage(timestamp, role, text string) *SessionBuilder
- func (b *SessionBuilder) AddCodexMeta(timestamp, id, cwd, originator string) *SessionBuilder
- func (b *SessionBuilder) AddRaw(line string) *SessionBuilder
- func (b *SessionBuilder) String() string
- func (b *SessionBuilder) StringNoTrailingNewline() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaudeAssistantJSON ¶
ClaudeAssistantJSON returns a Claude assistant message as a JSON string.
func ClaudeEntryJSON ¶ added in v0.7.0
func ClaudeEntryJSON( entryType, content, timestamp, uuid, parentUuid string, cwd ...string, ) string
ClaudeEntryJSON returns a Claude JSONL entry with uuid and parentUuid fields.
func ClaudeMetaUserJSON ¶
ClaudeMetaUserJSON returns a Claude user message with optional isMeta and isCompactSummary flags as a JSON string.
func ClaudeSnapshotJSON ¶
ClaudeSnapshotJSON returns a Claude snapshot message as a JSON string.
func ClaudeToolResultUserJSON ¶ added in v0.7.0
ClaudeToolResultUserJSON returns a Claude user message containing only a tool_result block (no text content). These messages are filtered out by pairAndFilter.
func ClaudeUserJSON ¶
ClaudeUserJSON returns a Claude user message as a JSON string.
func ClaudeUserWithSessionIDJSON ¶ added in v0.3.2
ClaudeUserWithSessionIDJSON returns a Claude user message with a sessionId field as a JSON string.
func CodexFunctionCallArgsJSON ¶ added in v0.2.0
CodexFunctionCallArgsJSON returns a Codex function_call response_item with arguments payload.
func CodexFunctionCallFieldsJSON ¶ added in v0.2.1
CodexFunctionCallFieldsJSON returns a Codex function_call response_item with explicit arguments and input fields.
func CodexFunctionCallJSON ¶
CodexFunctionCallJSON returns a Codex function_call response_item as a JSON string.
func CodexFunctionCallOutputJSON ¶ added in v0.17.0
CodexFunctionCallOutputJSON returns a Codex function_call_output response_item.
func CodexFunctionCallWithCallIDJSON ¶ added in v0.17.0
func CodexFunctionCallWithCallIDJSON( name, callID string, arguments any, timestamp string, ) string
CodexFunctionCallWithCallIDJSON returns a Codex function_call response_item with an explicit call_id.
func CodexMsgJSON ¶
CodexMsgJSON returns a Codex response_item message as a JSON string.
func CodexSessionMetaJSON ¶
CodexSessionMetaJSON returns a Codex session_meta message as a JSON string.
func CodexTokenCountJSON ¶ added in v0.20.0
func CodexTokenCountJSON( timestamp string, inputTokens, outputTokens, cachedInputTokens int, ) string
CodexTokenCountJSON returns a Codex event_msg with payload.type=token_count and last_token_usage fields.
func CodexTurnContextJSON ¶ added in v0.16.0
CodexTurnContextJSON returns a Codex turn_context entry as a JSON string with the given model.
func GeminiAssistantMsg ¶
func GeminiAssistantMsg( id, timestamp, content string, opts *GeminiMsgOpts, ) map[string]any
GeminiAssistantMsg builds a Gemini assistant message object.
func GeminiInfoMsg ¶
GeminiInfoMsg builds a Gemini info/system message object.
func GeminiSessionJSON ¶
func GeminiSessionJSON( sessionID, projectHash string, startTime, lastUpdated string, messages []map[string]any, ) string
GeminiSessionJSON builds a complete Gemini session JSON string from the given parameters.
func GeminiUserMsg ¶
GeminiUserMsg builds a Gemini user message object.
Types ¶
type GeminiMsgOpts ¶
type GeminiMsgOpts struct {
Thoughts []GeminiThought
ToolCalls []GeminiToolCall
Model string
}
GeminiMsgOpts holds optional fields for a Gemini assistant message.
type GeminiThought ¶
GeminiThought defines a thought for Gemini test fixtures.
type GeminiToolCall ¶
type GeminiToolCall struct {
ID string
Name string
DisplayName string
Args map[string]string
ResultOutput string // if set, generates inline functionResponse result
}
GeminiToolCall defines a tool call for Gemini test fixtures.
type SessionBuilder ¶
type SessionBuilder struct {
// contains filtered or unexported fields
}
SessionBuilder constructs JSONL session content using a fluent API.
func NewSessionBuilder ¶
func NewSessionBuilder() *SessionBuilder
NewSessionBuilder returns a new empty SessionBuilder.
func (*SessionBuilder) AddClaudeAssistant ¶
func (b *SessionBuilder) AddClaudeAssistant( timestamp, text string, ) *SessionBuilder
AddClaudeAssistant appends a Claude assistant message line.
func (*SessionBuilder) AddClaudeAssistantWithUUID ¶ added in v0.7.0
func (b *SessionBuilder) AddClaudeAssistantWithUUID( timestamp, text, uuid, parentUuid string, ) *SessionBuilder
AddClaudeAssistantWithUUID appends a Claude assistant message with uuid and parentUuid fields.
func (*SessionBuilder) AddClaudeMetaUser ¶
func (b *SessionBuilder) AddClaudeMetaUser( timestamp, content string, meta, compact bool, ) *SessionBuilder
AddClaudeMetaUser appends a Claude user message line with isMeta and/or isCompactSummary flags.
func (*SessionBuilder) AddClaudeUser ¶
func (b *SessionBuilder) AddClaudeUser( timestamp, content string, cwd ...string, ) *SessionBuilder
AddClaudeUser appends a Claude user message line.
func (*SessionBuilder) AddClaudeUserWithSessionID ¶ added in v0.3.2
func (b *SessionBuilder) AddClaudeUserWithSessionID( timestamp, content, sessionID string, cwd ...string, ) *SessionBuilder
AddClaudeUserWithSessionID appends a Claude user message line with a sessionId field.
func (*SessionBuilder) AddClaudeUserWithUUID ¶ added in v0.7.0
func (b *SessionBuilder) AddClaudeUserWithUUID( timestamp, content, uuid, parentUuid string, cwd ...string, ) *SessionBuilder
AddClaudeUserWithUUID appends a Claude user message with uuid and parentUuid fields.
func (*SessionBuilder) AddCodexFunctionCall ¶
func (b *SessionBuilder) AddCodexFunctionCall( timestamp, name, summary string, ) *SessionBuilder
AddCodexFunctionCall appends a Codex function_call line.
func (*SessionBuilder) AddCodexMessage ¶
func (b *SessionBuilder) AddCodexMessage( timestamp, role, text string, ) *SessionBuilder
AddCodexMessage appends a Codex response_item line.
func (*SessionBuilder) AddCodexMeta ¶
func (b *SessionBuilder) AddCodexMeta( timestamp, id, cwd, originator string, ) *SessionBuilder
AddCodexMeta appends a Codex session_meta line.
func (*SessionBuilder) AddRaw ¶
func (b *SessionBuilder) AddRaw(line string) *SessionBuilder
AddRaw appends an arbitrary raw line.
func (*SessionBuilder) String ¶
func (b *SessionBuilder) String() string
String returns the JSONL content with a trailing newline.
func (*SessionBuilder) StringNoTrailingNewline ¶
func (b *SessionBuilder) StringNoTrailingNewline() string
StringNoTrailingNewline returns the JSONL content without a trailing newline.