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

transcript

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventKindUser       = "user"
	EventKindAssistant  = "assistant"
	EventKindThinking   = "thinking"
	EventKindToolCall   = "tool_call"
	EventKindToolResult = "tool_result"
	EventKindError      = "error"
)

Variables

View Source
var (
	ErrInvalidCursor  = errors.New("invalid transcript cursor")
	ErrCursorMismatch = errors.New("transcript cursor does not match this transcript")
	ErrCursorPastEnd  = errors.New("transcript cursor is past the end of the transcript")
)

Functions

func ExtractAssistantContent

func ExtractAssistantContent(line []byte) string

func ExtractLastAssistantMessage

func ExtractLastAssistantMessage(path string, maxChars int) (string, error)

func ExtractLastAssistantMessageAfterLastUser added in v0.2.7

func ExtractLastAssistantMessageAfterLastUser(path string, maxChars int) (string, error)

func ExtractLastAssistantMessageAfterLastUserSince added in v0.2.7

func ExtractLastAssistantMessageAfterLastUserSince(path string, maxChars int, minAssistantTimestamp time.Time) (string, error)

func FindArchivedCodexTranscript added in v0.13.0

func FindArchivedCodexTranscript(resumeID string) string

func FindClaudeTranscript

func FindClaudeTranscript(sessionID string) string

func FindCodexTranscript

func FindCodexTranscript(cwd string, startedAt time.Time) string

func FindCodexTranscriptForResume added in v0.12.0

func FindCodexTranscriptForResume(resumeID string) string

func FindCopilotLaunchTranscript added in v0.12.0

func FindCopilotLaunchTranscript(cwd string, launchedAt time.Time, claimed func(conversationID string) bool) string

func FindCopilotTranscript

func FindCopilotTranscript(cwd string, startedAt time.Time) string

func FindCopilotTranscriptForResume added in v0.3.0

func FindCopilotTranscriptForResume(resumeID string) string

func HeadCursor added in v0.12.0

func HeadCursor(path string) (string, error)

func RedactText added in v0.12.0

func RedactText(text string) string

func ResolveCodexRolloutPath added in v0.13.0

func ResolveCodexRolloutPath(path string) string

func SupportsUsage added in v0.12.0

func SupportsUsage(agent string) bool

Types

type AssistantMessage added in v0.12.0

type AssistantMessage struct {
	Key     string
	Content string
}

type AssistantTurn added in v0.2.7

type AssistantTurn struct {
	Content   string
	Timestamp time.Time
	UUID      string
}

func ExtractLastAssistantTurnAfterLastUserSince added in v0.2.7

func ExtractLastAssistantTurnAfterLastUserSince(path string, maxChars int, minAssistantTimestamp time.Time) (AssistantTurn, error)

ExtractLastAssistantTurnAfterLastUserSince reads back from the end to the last user or assistant entry: a user entry there means the latest turn has no reply yet.

type AssistantWindow added in v0.12.0

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

func NewAssistantWindow added in v0.12.0

func NewAssistantWindow(limits AssistantWindowLimits) *AssistantWindow

func (*AssistantWindow) Apply added in v0.12.0

func (w *AssistantWindow) Apply(events []Event) bool

func (*AssistantWindow) MarkPrefixOmitted added in v0.12.0

func (w *AssistantWindow) MarkPrefixOmitted()

func (*AssistantWindow) Snapshot added in v0.12.0

type AssistantWindowLimits added in v0.12.0

type AssistantWindowLimits struct {
	MaxMessages     int
	MaxMessageChars int
	MaxTotalChars   int
}

type AssistantWindowReport added in v0.12.0

type AssistantWindowReport struct {
	DroppedOversize int
	LargestDropped  int
	DroppedOld      int
	OmittedPrefix   bool
}

func (AssistantWindowReport) Truncated added in v0.12.0

func (r AssistantWindowReport) Truncated() bool

type ConversationSlice added in v0.12.0

type ConversationSlice struct {
	Brief      string
	Rescoping  []string
	Summary    string
	AgentTurns []string
	HumanCount int
	AgentCount int
}

func ExtractConversationSlice added in v0.12.0

func ExtractConversationSlice(path string, opts SliceOptions) (ConversationSlice, error)

func (ConversationSlice) Empty added in v0.12.0

func (s ConversationSlice) Empty() bool

func (ConversationSlice) Render added in v0.12.0

func (s ConversationSlice) Render() string

type CopilotToolLifecycle added in v0.2.7

type CopilotToolLifecycle struct {
	Kind       string
	ToolCallID string
	ToolName   string
}

func ExtractCopilotToolLifecycle added in v0.2.7

func ExtractCopilotToolLifecycle(line []byte) (CopilotToolLifecycle, bool)

type Event added in v0.12.0

type Event struct {
	Cursor     string `json:"cursor"`
	Timestamp  string `json:"timestamp,omitempty"`
	Kind       string `json:"kind"`
	Role       string `json:"role,omitempty"`
	Text       string `json:"text,omitempty"`
	ToolName   string `json:"tool_name,omitempty"`
	ToolCallID string `json:"tool_call_id,omitempty"`
	IsError    bool   `json:"is_error,omitempty"`
}

type EventPage added in v0.12.0

type EventPage struct {
	Events     []Event
	NextCursor string
	AtEnd      bool
}

func ReadEventPage added in v0.12.0

func ReadEventPage(path, agent, cursor string, maxEvents int) (EventPage, error)

type FollowBatch added in v0.12.0

type FollowBatch struct {
	Records []FollowRecord
	Events  []Event
	Usage   []TokenUsage
}

type FollowRecord added in v0.12.0

type FollowRecord struct {
	Raw    []byte
	Events []Event
	Usage  *TokenUsage
}

type Follower added in v0.12.0

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

func NewFollower added in v0.12.0

func NewFollower(path, agent string, startOffset int64) (*Follower, error)

func NewFollowerAfterCursor added in v0.12.0

func NewFollowerAfterCursor(path, agent, cursor string) (*Follower, error)

func (*Follower) Cursor added in v0.12.0

func (f *Follower) Cursor() string

func (*Follower) Read added in v0.12.0

func (f *Follower) Read() (FollowBatch, error)

type SliceOptions added in v0.12.0

type SliceOptions struct {
	MaxRescopingTurns int
	MaxAgentTurns     int
	TurnCharCap       int
	SummaryCharCap    int
}

func DefaultSliceOptions added in v0.12.0

func DefaultSliceOptions() SliceOptions

type TokenUsage added in v0.12.0

type TokenUsage struct {
	Key                          string
	Model                        string
	Purpose                      string
	FastMode                     bool
	InputTokens                  int64
	OutputTokens                 int64
	CacheWrite5mTokens           int64
	CacheWrite1hTokens           int64
	CacheWriteUnclassifiedTokens int64
	CacheReadTokens              int64
	ReportedCostUSD              float64
}

func (TokenUsage) HasTokens added in v0.12.0

func (u TokenUsage) HasTokens() bool

type TurnAbort added in v0.12.0

type TurnAbort struct {
	Reason string

	UserHalt bool

	At time.Time
}

func ClaudeTurnAborted added in v0.12.0

func ClaudeTurnAborted(line []byte) (TurnAbort, bool)

func CodexTurnAborted added in v0.12.0

func CodexTurnAborted(line []byte) (TurnAbort, bool)

func CopilotTurnAborted added in v0.12.0

func CopilotTurnAborted(line []byte) (TurnAbort, bool)

type UsageExtractor added in v0.12.0

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

func NewUsageExtractor added in v0.12.0

func NewUsageExtractor(agent string) *UsageExtractor

func (*UsageExtractor) Observe added in v0.12.0

func (e *UsageExtractor) Observe(line []byte, sourceKey string) (TokenUsage, bool)

type UsageSource added in v0.12.0

type UsageSource struct {
	ID      string
	Path    string
	Root    bool
	Purpose string
}

type UsageSourceResolver added in v0.12.0

type UsageSourceResolver interface {
	Discover() ([]UsageSource, error)
}

func NewClaudeUsageSourceResolver added in v0.12.0

func NewClaudeUsageSourceResolver(rootPath string) UsageSourceResolver

func NewCodexUsageSourceResolver added in v0.12.0

func NewCodexUsageSourceResolver(rootPath string) UsageSourceResolver

func NewReportedUsageSourceResolver added in v0.12.0

func NewReportedUsageSourceResolver(rootPath string) UsageSourceResolver

Jump to

Keyboard shortcuts

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