transcript

package
v0.0.0-...-457a063 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package transcript provides JSONL parsing and Markdown rendering for Claude session transcripts.

Index

Constants

View Source
const (
	// MaxToolInputRunes is the maximum number of runes for tool input truncation.
	MaxToolInputRunes = 2000
	// MaxToolResultRunes is the maximum number of runes for tool result truncation.
	MaxToolResultRunes = 3000
	// CollapseThresholdRunes is the threshold for collapsing non-Task/Skill tools.
	CollapseThresholdRunes = 500
)
View Source
const (

	// PollInterval is the interval between file change checks.
	// Exported for testing configurability.
	PollInterval = 500 * time.Millisecond
)

Variables

View Source
var ErrKiroIDENotFound = errors.New("kiro ide storage not found")

ErrKiroIDENotFound indicates the Kiro IDE storage directory does not exist.

Functions

func BuildSkillDescriptionMap

func BuildSkillDescriptionMap(entries []Entry) map[string]string

BuildSkillDescriptionMap scans entries for meta entries containing skill/command descriptions and returns a map from sourceToolUseID (for Skill tools) or parentUUID (for slash commands) to the description text. Exported for use by Follower in follow mode.

func BuildToolMeta

func BuildToolMeta(entries []Entry) map[string]ToolMeta

BuildToolMeta accumulates tool metadata from entries. This processes all entries and extracts tool_use information needed for correctly rendering tool_result entries that reference them. Exported for use by Follower in follow mode.

func FormatLastAction

func FormatLastAction(entry *Entry) string

FormatLastAction formats an entry as a last action summary. Per requirement 3.5: prioritizes tool_use over text when both present.

func FormatToolUse

func FormatToolUse(name string, input any) string

FormatToolUse formats a tool_use content item for display. Returns format: "{ToolName}: {key_input}" with truncation to 60 chars.

func IsDisplayableEntry

func IsDisplayableEntry(e *Entry) bool

IsDisplayableEntry checks if an entry should be considered for "last action" display. Returns true for assistant messages with tool_use or text content. Excludes meta entries and thinking content.

func KiroIDEBasePath

func KiroIDEBasePath() (string, error)

KiroIDEBasePath returns the platform-specific base directory for Kiro IDE session storage. Uses os.UserConfigDir() and appends the Kiro IDE-specific subdirectory. Returns ("", ErrKiroIDENotFound) if the directory does not exist.

func KiroIDEExecutionDetailPath

func KiroIDEExecutionDetailPath(workspaceDir, executionID string) string

KiroIDEExecutionDetailPath returns the deterministic path to an execution detail file. Path: {workspaceDir}/414d1636299d2b9e4ce7e17fb11f63e9/{sha256_32(executionId)}

func KiroIDEWorkspaceDir

func KiroIDEWorkspaceDir(projectPath string) (string, error)

KiroIDEWorkspaceDir returns the workspace directory for a given project path. Normalizes the path (filepath.Abs + filepath.Clean), computes SHA-256[:32], and joins it with the base path. Returns ("", ErrKiroIDENotFound) if the directory does not exist.

func ParseFirstTimestamp

func ParseFirstTimestamp(r io.Reader) (time.Time, error)

ParseFirstTimestamp reads only the first entry's timestamp from JSONL. Used for efficient session listing without parsing the entire file. If the timestamp cannot be parsed, returns the zero time and an error.

func ParseKiroUsageInfo

func ParseKiroUsageInfo(r io.Reader) (float64, error)

ParseKiroUsageInfo extracts usage info from Kiro session JSON. Returns total credits used across all usage_info entries.

func RenderEntries

func RenderEntries(entries []Entry, toolMeta map[string]ToolMeta, skillDescriptions map[string]string, opts RenderOptions) string

RenderEntries renders entries without header, using pre-built state. This is the incremental rendering function for follow mode.

func RenderHTML

func RenderHTML(entries []Entry, opts RenderOptions) string

RenderHTML converts parsed entries to a styled HTML document.

func RenderHTMLFragment

func RenderHTMLFragment(entries []Entry, opts RenderOptions) string

RenderHTMLFragment renders just the content without document wrapper. Returns HTML that can be embedded in an existing page template. Includes navigation at top/bottom when Navigation is set. Does NOT include <!DOCTYPE>, <html>, <head>, or <body> tags.

func RenderMarkdown

func RenderMarkdown(entries []Entry, opts RenderOptions) string

RenderMarkdown converts parsed entries to Markdown format.

func TranscriptCSS

func TranscriptCSS() string

TranscriptCSS returns the CSS for transcript rendering. This can be used by external packages (like the web server) to include the same styles without duplication.

Types

type CodexContent

type CodexContent struct {
	Type string `json:"type"` // input_text, output_text
	Text string `json:"text"`
}

CodexContent represents content items in Codex messages.

type CodexEntry

type CodexEntry struct {
	Timestamp string          `json:"timestamp"`
	Type      string          `json:"type"` // session_meta, response_item, event_msg, turn_context
	Payload   json.RawMessage `json:"payload"`
}

CodexEntry represents a single line in Codex JSONL.

type CodexEventMsg

type CodexEventMsg struct {
	Type    string `json:"type"`              // agent_reasoning, agent_message, user_message, token_count
	Text    string `json:"text,omitempty"`    // for agent_reasoning
	Message string `json:"message,omitempty"` // for agent_message
}

CodexEventMsg is the payload for event_msg entries.

type CodexResponseItem

type CodexResponseItem struct {
	Type      string         `json:"type"`                // message, function_call, function_call_output, reasoning, ghost_snapshot
	Role      string         `json:"role,omitempty"`      // user, assistant (for message type)
	Name      string         `json:"name,omitempty"`      // function name (for function_call)
	Arguments string         `json:"arguments,omitempty"` // JSON string of arguments (for function_call)
	CallID    string         `json:"call_id,omitempty"`   // links function_call and function_call_output
	Output    string         `json:"output,omitempty"`    // function output (for function_call_output)
	Content   []CodexContent `json:"content,omitempty"`   // message content items
	Summary   []CodexSummary `json:"summary,omitempty"`   // reasoning summary items
}

CodexResponseItem is the payload for response_item entries.

type CodexSessionMeta

type CodexSessionMeta struct {
	ID        string `json:"id"`
	Timestamp string `json:"timestamp"`
	Cwd       string `json:"cwd"`
}

CodexSessionMeta is the payload for session_meta entries.

type CodexSummary

type CodexSummary struct {
	Type string `json:"type"` // summary_text
	Text string `json:"text"`
}

CodexSummary represents reasoning summary items.

type ContentItem

type ContentItem struct {
	Type      string `json:"type"`
	Text      string `json:"text,omitempty"`
	Thinking  string `json:"thinking,omitempty"`
	Name      string `json:"name,omitempty"`
	Input     any    `json:"input,omitempty"`
	Content   string `json:"content,omitempty"`
	IsError   bool   `json:"is_error,omitempty"`
	ID        string `json:"id,omitempty"`          // tool_use ID for linking to tool_result
	ToolUseID string `json:"tool_use_id,omitempty"` // links tool_result to tool_use
}

ContentItem represents a content block in a message.

func (*ContentItem) UnmarshalJSON

func (c *ContentItem) UnmarshalJSON(data []byte) error

UnmarshalJSON handles polymorphic content field (string or array). Tool results can have content as either a string or an array of content blocks.

type CopilotAttachment

type CopilotAttachment struct {
	Path string `json:"path,omitempty"`
	Type string `json:"type,omitempty"`
}

CopilotAttachment represents a file attachment in a user message.

type CopilotData

type CopilotData struct {
	// session.start fields
	SessionID      string `json:"sessionId,omitempty"`
	Version        int    `json:"version,omitempty"`
	Producer       string `json:"producer,omitempty"`
	CopilotVersion string `json:"copilotVersion,omitempty"`
	StartTime      string `json:"startTime,omitempty"`

	// session.info fields
	InfoType string `json:"infoType,omitempty"`
	Message  string `json:"message,omitempty"`

	// user.message fields
	Content            string              `json:"content,omitempty"`
	TransformedContent string              `json:"transformedContent,omitempty"`
	Attachments        []CopilotAttachment `json:"attachments,omitempty"`

	// assistant.turn_start / assistant.turn_end fields
	TurnID string `json:"turnId,omitempty"`

	// assistant.message fields
	MessageID       string               `json:"messageId,omitempty"`
	ToolRequests    []CopilotToolRequest `json:"toolRequests,omitempty"`
	ReasoningText   string               `json:"reasoningText,omitempty"`
	ReasoningOpaque string               `json:"reasoningOpaque,omitempty"` // Encrypted, not rendered

	// assistant.reasoning fields
	ReasoningID string `json:"reasoningId,omitempty"`

	// tool.execution_start fields
	ToolCallID string         `json:"toolCallId,omitempty"`
	ToolName   string         `json:"toolName,omitempty"`
	Arguments  map[string]any `json:"arguments,omitempty"`

	// tool.execution_complete fields
	Success       bool                  `json:"success,omitempty"`
	Result        *CopilotToolResult    `json:"result,omitempty"`
	ToolTelemetry *CopilotToolTelemetry `json:"toolTelemetry,omitempty"`
}

CopilotData holds the polymorphic data payload for different event types. Different event types use different fields.

type CopilotEvent

type CopilotEvent struct {
	Type      string      `json:"type"`
	Data      CopilotData `json:"data"`
	ID        string      `json:"id"`
	Timestamp string      `json:"timestamp"`
	ParentID  *string     `json:"parentId"`
}

CopilotEvent represents a single event line in the Copilot JSONL format.

type CopilotToolRequest

type CopilotToolRequest struct {
	ToolCallID string         `json:"toolCallId"`
	Name       string         `json:"name"`
	Arguments  map[string]any `json:"arguments,omitempty"`
}

CopilotToolRequest represents a tool call request in an assistant message.

type CopilotToolResult

type CopilotToolResult struct {
	Content string `json:"content,omitempty"`
}

CopilotToolResult contains the result of a tool execution.

type CopilotToolTelemetry

type CopilotToolTelemetry struct {
	Properties map[string]string  `json:"properties,omitempty"`
	Metrics    map[string]float64 `json:"metrics,omitempty"`
}

CopilotToolTelemetry contains telemetry data for tool executions.

type Entry

type Entry struct {
	Type            string         `json:"type"`
	Message         *Message       `json:"message,omitempty"`
	Timestamp       string         `json:"timestamp,omitempty"`
	SessionID       string         `json:"sessionId,omitempty"`
	Cwd             string         `json:"cwd,omitempty"`             // Working directory for this entry
	IsMeta          bool           `json:"isMeta,omitempty"`          // Meta entries are internal Claude markers
	UUID            string         `json:"uuid,omitempty"`            // Unique identifier for this entry
	ParentUUID      string         `json:"parentUuid,omitempty"`      // Links to parent entry's UUID
	SourceToolUseID string         `json:"sourceToolUseID,omitempty"` // Links meta entry to originating tool_use
	ToolUseResult   *ToolUseResult `json:"toolUseResult,omitempty"`   // Result metadata for tool calls
}

Entry represents a single line in the Claude session JSONL.

func GetLastDisplayableEntry

func GetLastDisplayableEntry(filePath string) (*Entry, error)

GetLastDisplayableEntry reads the transcript file from the end and returns the most recent displayable entry (assistant message with tool_use or text). Uses an expanding search window to handle large entries. Returns nil, nil if no displayable entry exists (file empty or only system messages). Returns nil, error for actual read/parse errors.

func (*Entry) UnmarshalJSON

func (e *Entry) UnmarshalJSON(data []byte) error

UnmarshalJSON handles polymorphic toolUseResult field (string or object). Some tool results have toolUseResult as a string, others as an object.

type Follower

type Follower struct {
	// contains filtered or unexported fields
}

Follower monitors a JSONL file and renders new entries incrementally.

func NewFollower

func NewFollower(filePath string, output io.Writer, opts RenderOptions) (*Follower, error)

NewFollower creates a new Follower for the given file path. Validates file exists at creation time (fails fast per requirement 7.1).

func (*Follower) Run

func (f *Follower) Run(ctx context.Context) error

Run starts the follow loop. Blocks until ctx is cancelled. Returns nil on clean shutdown (context cancellation), error on file errors.

type Format

type Format int

Format represents the detected log format.

const (
	FormatUnknown Format = iota
	FormatClaude
	FormatCodex
	FormatKiro
	FormatCopilot
	FormatKiroIDE
)

func DetectFormat

func DetectFormat(r io.Reader) (Format, []byte, error)

DetectFormat examines file content to determine the log format. Returns the detected format, the initial bytes read (with BOM stripped), and any error.

Detection strategy: 1. Read a chunk of content (up to 64KB to handle long JSONL lines) 2. Try parsing as complete JSON with Kiro markers - if successful, it's Kiro format 3. Otherwise, treat as JSONL and detect based on first format-defining line

Note: Cannot use first-byte check alone because both JSON and JSONL start with '{'

type KiroAssistantMessage

type KiroAssistantMessage struct {
	ToolUse      *KiroToolUse      `json:"ToolUse,omitempty"`
	TextResponse *KiroTextResponse `json:"TextResponse,omitempty"`
	Response     *KiroTextResponse `json:"Response,omitempty"`
}

KiroAssistantMessage represents an assistant response in Kiro format. It can be ToolUse (with tool calls), TextResponse (text only), or Response (also text only).

type KiroDuration

type KiroDuration struct {
	Secs  int64 `json:"secs"`
	Nanos int64 `json:"nanos"`
}

KiroDuration represents a duration with seconds and nanoseconds.

type KiroEnvContext

type KiroEnvContext struct {
	EnvState *KiroEnvState `json:"env_state,omitempty"`
}

KiroEnvContext contains environment state information.

type KiroEnvState

type KiroEnvState struct {
	OperatingSystem         string   `json:"operating_system"`
	CurrentWorkingDirectory string   `json:"current_working_directory"`
	EnvironmentVariables    []string `json:"environment_variables"`
}

KiroEnvState contains OS and directory information.

type KiroHistoryEntry

type KiroHistoryEntry struct {
	User            *KiroUserMessage      `json:"user,omitempty"`
	Assistant       *KiroAssistantMessage `json:"assistant,omitempty"`
	RequestMetadata *KiroRequestMetadata  `json:"request_metadata,omitempty"`
}

KiroHistoryEntry represents a single exchange in the Kiro history.

type KiroIDEAction

type KiroIDEAction struct {
	ActionID     string         `json:"actionId"`
	ActionType   string         `json:"actionType"`
	ActionState  string         `json:"actionState"`
	Input        map[string]any `json:"input,omitempty"`
	Output       map[string]any `json:"output,omitempty"`
	ErrorMessage string         `json:"errorMessage,omitempty"`
	TaskID       string         `json:"taskId,omitempty"`
	TaskStatus   string         `json:"taskStatus,omitempty"`
	TaskListURI  string         `json:"taskListUri,omitempty"`
}

KiroIDEAction represents a single action in the execution detail's actions array. Actions encode tool calls (readFiles, replace, create, runCommand, search), assistant messages (say), task updates (taskStatus), user interactions (userInput), and internal operations (model, steering, intentClassification, specAgent).

type KiroIDEChatFile

type KiroIDEChatFile struct {
	ExecutionID string           `json:"executionId"`
	Chat        []KiroIDEMessage `json:"chat"`
	Metadata    *KiroIDEMetadata `json:"metadata"`
}

KiroIDEChatFile represents the top-level structure of a Kiro IDE .chat file. Fields like actionId, context, and validations are present in the source but not used for transcript conversion — they are omitted from this struct.

type KiroIDEExecutionDetail

type KiroIDEExecutionDetail struct {
	ExecutionID  string                `json:"executionId"`
	UsageSummary []KiroIDEUsageSummary `json:"usageSummary"`
	Actions      []KiroIDEAction       `json:"actions"`
}

KiroIDEExecutionDetail represents the execution detail file (for cost and action extraction).

type KiroIDEMessage

type KiroIDEMessage struct {
	Role    string `json:"role"` // "human", "bot", or "tool"
	Content string `json:"content"`
}

KiroIDEMessage represents a single message in the chat array.

type KiroIDEMetadata

type KiroIDEMetadata struct {
	ModelID       string `json:"modelId"`
	ModelProvider string `json:"modelProvider"`
	Workflow      string `json:"workflow"`
	WorkflowID    string `json:"workflowId"`
	StartTime     int64  `json:"startTime"` // milliseconds since epoch
	EndTime       int64  `json:"endTime"`   // milliseconds since epoch
}

KiroIDEMetadata contains session metadata.

type KiroIDEUsageSummary

type KiroIDEUsageSummary struct {
	Unit       string  `json:"unit"`
	UnitPlural string  `json:"unitPlural"`
	Usage      float64 `json:"usage"` // Note: "usage" not "value" (differs from Kiro CLI)
}

KiroIDEUsageSummary represents a single usage entry in the execution detail file.

type KiroImage

type KiroImage struct {
	Source string `json:"source,omitempty"`
}

KiroImage represents an image attachment.

type KiroJsonOutput

type KiroJsonOutput struct {
	ExitStatus string `json:"exit_status"` // Always string in observed logs
	Stdout     string `json:"stdout"`
	Stderr     string `json:"stderr"`
}

KiroJsonOutput represents structured command output in Json variant.

type KiroPrompt

type KiroPrompt struct {
	Prompt string `json:"prompt"`
}

KiroPrompt contains the user's text prompt.

type KiroRequestMetadata

type KiroRequestMetadata struct {
	RequestID               string         `json:"request_id"`
	ContextUsagePercentage  *float64       `json:"context_usage_percentage"`
	MessageID               string         `json:"message_id"`
	RequestStartTimestampMs int64          `json:"request_start_timestamp_ms"`
	StreamEndTimestampMs    int64          `json:"stream_end_timestamp_ms"`
	TimeToFirstChunk        *KiroDuration  `json:"time_to_first_chunk,omitempty"`
	TimeBetweenChunks       []KiroDuration `json:"time_between_chunks,omitempty"`
	UserPromptLength        int            `json:"user_prompt_length"`
	ResponseSize            int            `json:"response_size"`
	ChatConversationType    string         `json:"chat_conversation_type"`
	ToolUseIDsAndNames      [][]string     `json:"tool_use_ids_and_names"`
	ModelID                 string         `json:"model_id"`
	MessageMetaTags         []string       `json:"message_meta_tags"`
}

KiroRequestMetadata contains telemetry and metadata about the request.

type KiroResultContent

type KiroResultContent struct {
	Text string          `json:"Text,omitempty"`
	Json *KiroJsonOutput `json:"Json,omitempty"`
}

KiroResultContent represents content in a tool result.

type KiroSession

type KiroSession struct {
	ConversationID   string                `json:"conversation_id"`
	NextMessage      *KiroHistoryEntry     `json:"next_message"`
	History          []KiroHistoryEntry    `json:"history"`
	UserTurnMetadata *KiroUserTurnMetadata `json:"user_turn_metadata,omitempty"`
}

KiroSession represents the top-level Kiro session JSON structure.

type KiroTextResponse

type KiroTextResponse struct {
	MessageID string `json:"message_id"`
	Content   string `json:"content"`
}

KiroTextResponse represents a text-only assistant response.

type KiroToolCall

type KiroToolCall struct {
	ID       string         `json:"id"`
	Name     string         `json:"name"`
	OrigName string         `json:"orig_name"`
	Args     map[string]any `json:"args"`
	OrigArgs map[string]any `json:"orig_args"`
}

KiroToolCall represents a single tool invocation.

type KiroToolUse

type KiroToolUse struct {
	MessageID string         `json:"message_id"`
	Content   string         `json:"content"`
	ToolUses  []KiroToolCall `json:"tool_uses"`
}

KiroToolUse represents an assistant response that includes tool calls.

type KiroToolUseResult

type KiroToolUseResult struct {
	ToolUseID string              `json:"tool_use_id"`
	Content   []KiroResultContent `json:"content"`
	Status    string              `json:"status"` // "Success", "Error", etc.
}

KiroToolUseResult represents a single tool result.

type KiroToolUseResults

type KiroToolUseResults struct {
	ToolUseResults []KiroToolUseResult `json:"tool_use_results"`
}

KiroToolUseResults contains results from tool executions.

type KiroUsageInfo

type KiroUsageInfo struct {
	Unit       string  `json:"unit"`        // e.g., "credit"
	UnitPlural string  `json:"unit_plural"` // e.g., "credits"
	Value      float64 `json:"value"`       // e.g., 0.09024116169154228
}

KiroUsageInfo represents usage/cost information for a session.

type KiroUserContent

type KiroUserContent struct {
	Prompt         *KiroPrompt         `json:"Prompt,omitempty"`
	ToolUseResults *KiroToolUseResults `json:"ToolUseResults,omitempty"`
}

KiroUserContent represents user content which can be either a Prompt or ToolUseResults. Uses Go's interface to handle the discriminated union.

type KiroUserMessage

type KiroUserMessage struct {
	AdditionalContext string          `json:"additional_context"`
	EnvContext        *KiroEnvContext `json:"env_context,omitempty"`
	Content           KiroUserContent `json:"content"`
	Timestamp         *string         `json:"timestamp"`
	Images            []KiroImage     `json:"images"`
}

KiroUserMessage represents a user message in Kiro format.

type KiroUserTurnMetadata

type KiroUserTurnMetadata struct {
	ContinuationID string          `json:"continuation_id"`
	Requests       []any           `json:"requests"`
	UsageInfo      []KiroUsageInfo `json:"usage_info"`
}

KiroUserTurnMetadata contains session-level metadata including usage info.

type Message

type Message struct {
	Role    string        `json:"role"`
	Content []ContentItem `json:"content"`
}

Message represents the message content within an entry.

func (*Message) UnmarshalJSON

func (m *Message) UnmarshalJSON(data []byte) error

UnmarshalJSON handles polymorphic content field (string or array). User messages have content as a plain string, assistant messages have an array.

type NavigationContext struct {
	PrevURL  string // URL for previous phase (empty if no previous)
	PrevText string // Display text for previous link (e.g., "Phase 1")
	NextURL  string // URL for next phase (empty if no next)
	NextText string // Display text for next link (e.g., "Phase 3")
	BackURL  string // URL to return to run detail page
	BackText string // Display text for back link (e.g., "Back to Run")
}

NavigationContext provides previous/next phase links for transcript navigation.

type ParseOptions

type ParseOptions struct {
	KiroIDECostPath string // execution detail file path for cost extraction
}

ParseOptions provides optional configuration for format-specific parsers.

type ParseResult

type ParseResult struct {
	Entries  []Entry
	Warnings []ParseWarning
	Metadata *ParseResultMetadata // nil for formats without metadata
}

ParseResult contains the parsed entries and any warnings encountered.

func Parse

func Parse(r io.Reader) (*ParseResult, error)

Parse reads a transcript file and automatically detects its format. It handles all supported formats: Claude JSONL, Codex JSONL, Kiro CLI JSON, Kiro IDE JSON, and Copilot JSONL. When format detection fails (e.g., file contains only unknown entry types), falls back to Claude format parsing which gracefully skips unrecognized entries. Use this function when the format is unknown; use ParseJSONLWithFormat when the format is known.

func ParseCodexJSONL

func ParseCodexJSONL(r io.Reader) (*ParseResult, error)

ParseCodexJSONL parses Codex format JSONL and normalizes to []Entry.

func ParseCopilot

func ParseCopilot(r io.Reader) (*ParseResult, error)

ParseCopilot parses a Copilot session JSONL file and returns the result.

func ParseJSONL

func ParseJSONL(r io.Reader) (*ParseResult, error)

ParseJSONL reads JSONL from the provided reader and returns parsed entries. Automatically detects format (Claude or Codex) and delegates to appropriate parser. Preserves streaming architecture to avoid memory issues with large files.

func ParseJSONLWithFormat

func ParseJSONLWithFormat(r io.Reader, format Format, opts ...ParseOptions) (*ParseResult, error)

ParseJSONLWithFormat reads JSONL from the provided reader using the specified format. This skips format detection and directly uses the given parser. Use Parse for auto-detection of all formats, or ParseJSONL for JSONL-only auto-detection.

func ParseKiro

func ParseKiro(r io.Reader) (*ParseResult, error)

ParseKiro parses a Kiro session JSON file and returns the result.

func ParseKiroIDE

func ParseKiroIDE(r io.Reader) (*ParseResult, error)

ParseKiroIDE parses a Kiro IDE .chat JSON file and returns the result without cost data.

func ParseKiroIDEWithCostPath

func ParseKiroIDEWithCostPath(r io.Reader, executionDetailPath string) (*ParseResult, error)

ParseKiroIDEWithCostPath parses a .chat file and extracts cost from the given execution detail file path.

type ParseResultMetadata

type ParseResultMetadata struct {
	TotalCost *float64 // nil = not available, pointer to value = available
	CostUnit  string   // e.g., "credits"
}

ParseResultMetadata contains optional format-specific metadata.

type ParseWarning

type ParseWarning struct {
	Line    int
	Message string
}

ParseWarning represents a non-fatal parsing issue.

type PatchHunk

type PatchHunk struct {
	OldStart int      `json:"oldStart"`
	OldLines int      `json:"oldLines"`
	NewStart int      `json:"newStart"`
	NewLines int      `json:"newLines"`
	Lines    []string `json:"lines"`
}

PatchHunk represents a single hunk in a unified diff.

type RenderOptions

type RenderOptions struct {
	Title      string             // Document title (e.g., "Session Transcript" or "Phase 1 Session Transcript")
	SessionID  string             // Session ID to display in header
	ProjectDir string             // Project directory to strip from file paths (e.g., "/Users/foo/project")
	Navigation *NavigationContext // Optional navigation context for prev/next/back links
	TotalCost  *float64           // nil = don't display, pointer = display if > 0.005
	CostUnit   string             // e.g., "credits" (default if empty)
}

RenderOptions configures Markdown rendering.

type ToolMeta

type ToolMeta = toolMetadata

ToolMeta stores information about a tool_use for result matching. Exported for use by Follower in follow mode.

type ToolUseResult

type ToolUseResult struct {
	FilePath        string      `json:"filePath,omitempty"`
	StructuredPatch []PatchHunk `json:"structuredPatch,omitempty"`
}

ToolUseResult contains metadata about a tool execution result.

Jump to

Keyboard shortcuts

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