progress

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IconWorkflowLoad     = "📋" // Loading workflow file
	IconWorkflowCompiled = "✅" // Workflow successfully compiled
	IconWorkflowError    = "❌" // Workflow error

	IconDocumentStart    = "📄"  // Document processing started
	IconDocumentComplete = "✅"  // Document processed successfully
	IconDocumentError    = "❌"  // Document processing error
	IconDocumentSkipped  = "⏭️" // Document skipped

	IconStepProcessing = "⚙️ " // Step is processing (mutable line)
	IconStepComplete   = "✅"   // Step completed successfully
	IconStepError      = "❌"   // Step failed with error

	IconRouterEvaluating = "🧭" // Router evaluating conditions
	IconRouterMatched    = "↳" // Router matched a route (text, not emoji)

	IconForeachStart = "🔁" // Foreach loop started
	IconForeachItem  = "✅" // Foreach item completed

	IconRetryAttempt   = "🔄" // Retry attempt
	IconRetrySuccess   = "✅" // Retry succeeded
	IconRetryExhausted = "❌" // All retries exhausted

	IconBatchProcessing = "📂"  // Batch processing
	IconChunking        = "✂️" // Document chunking

	IconThinking = "💭" // LLM thinking/reasoning content

	IconSummary = "📊"  // Pipeline summary
	IconWarning = "⚠️" // Warning message
)

Icons used for progress reporting - centralized for easy customization

Variables

This section is empty.

Functions

func IsInForeachMode

func IsInForeachMode(ctx context.Context) bool

IsInForeachMode checks if we're currently inside a foreach loop

func WithForeachMode

func WithForeachMode(ctx context.Context) context.Context

WithForeachMode marks the context as being inside a foreach loop

func WithReporter

func WithReporter(ctx context.Context, reporter *Reporter) context.Context

WithReporter embeds a progress reporter in the context

func WithStepInfo

func WithStepInfo(ctx context.Context, info StepInfo) context.Context

WithStepInfo embeds step information in the context

Types

type ProfileTokenUsage

type ProfileTokenUsage struct {
	Name  string
	Usage TokenUsage
}

ProfileTokenUsage represents token usage for a specific profile

type Reporter

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

Reporter handles all progress output to stderr with educational messages

func FromContext

func FromContext(ctx context.Context) *Reporter

FromContext extracts the progress reporter from context

func New

func New(quiet bool) *Reporter

New creates a new progress reporter

func NewWithWriter

func NewWithWriter(w io.Writer, quiet bool) *Reporter

NewWithWriter creates a reporter with a custom writer (for testing)

func (*Reporter) BatchComplete

func (r *Reporter) BatchComplete()

BatchComplete finalizes batch progress

func (*Reporter) BatchProgress

func (r *Reporter) BatchProgress(processed, total int)

BatchProgress reports batch processing progress

func (*Reporter) BatchStart

func (r *Reporter) BatchStart(inputPath, outputPath string, mutable bool)

BatchStart indicates batch processing is starting

func (*Reporter) ChunkingStart

func (r *Reporter) ChunkingStart(strategy string, chunkCount int)

ChunkingStart indicates document is being split

func (*Reporter) DocumentComplete

func (r *Reporter) DocumentComplete(path string, duration time.Duration)

DocumentComplete indicates successful document completion

func (*Reporter) DocumentError

func (r *Reporter) DocumentError(path string, err error)

DocumentError reports a document processing error

func (*Reporter) DocumentSkipped

func (r *Reporter) DocumentSkipped(path string, reason string)

DocumentSkipped indicates a document was skipped

func (*Reporter) DocumentStart

func (r *Reporter) DocumentStart(path string, sizeKB float64)

DocumentStart indicates a document is starting to process

func (*Reporter) ForeachComplete

func (r *Reporter) ForeachComplete(successCount, totalCount int, duration time.Duration)

ForeachComplete indicates foreach loop completed

func (*Reporter) ForeachItem

func (r *Reporter) ForeachItem(index, total int, status string)

ForeachItem reports progress on a foreach item

func (*Reporter) ForeachStart

func (r *Reporter) ForeachStart(itemCount int)

ForeachStart indicates foreach loop is starting

func (*Reporter) GetStats

func (r *Reporter) GetStats() Stats

GetStats returns a copy of current statistics

func (*Reporter) RetryAttempt

func (r *Reporter) RetryAttempt(attempt, maxAttempts int, delay time.Duration)

RetryAttempt indicates a retry is being attempted

func (*Reporter) RetryExhausted

func (r *Reporter) RetryExhausted(maxAttempts int)

RetryExhausted indicates all retry attempts failed

func (*Reporter) RetrySuccess

func (r *Reporter) RetrySuccess(attempt int)

RetrySuccess indicates retry succeeded

func (*Reporter) RouterDefault

func (r *Reporter) RouterDefault(targetJob string)

RouterDefault indicates router is using default route

func (*Reporter) RouterEvaluating

func (r *Reporter) RouterEvaluating()

RouterEvaluating indicates router is evaluating conditions

func (*Reporter) RouterMatched

func (r *Reporter) RouterMatched(routeName string, targetJob string)

RouterMatched indicates router matched a route

func (*Reporter) RouterNoMatch

func (r *Reporter) RouterNoMatch()

RouterNoMatch indicates no route was matched

func (*Reporter) SetForeachMode

func (r *Reporter) SetForeachMode(inForeach bool)

SetForeachMode sets whether we're inside a foreach loop

func (*Reporter) SetTokenSource

func (r *Reporter) SetTokenSource(source TokenSource)

SetTokenSource sets the token source for final usage reporting

func (*Reporter) StepComplete

func (r *Reporter) StepComplete(jobName, stepName string, stepNum, totalSteps int, duration time.Duration, tokens int)

StepComplete indicates step completion

func (*Reporter) StepError

func (r *Reporter) StepError(jobName, stepName string, stepNum, totalSteps int, err error)

StepError reports a step error

func (*Reporter) StepProgress

func (r *Reporter) StepProgress(message string)

StepProgress updates the current step status (mutable)

func (*Reporter) StepStart

func (r *Reporter) StepStart(jobName, stepName string, stepNum, totalSteps int)

StepStart indicates a workflow step is starting

func (*Reporter) Summary

func (r *Reporter) Summary()

Summary prints final execution summary

func (*Reporter) SummaryQuick

func (r *Reporter) SummaryQuick(docCount int, duration time.Duration)

SummaryQuick prints a compact one-line summary

func (*Reporter) ThinkingContent

func (r *Reporter) ThinkingContent(text string)

ThinkingContent displays LLM thinking/reasoning content This is used when --llm-think is enabled to show intermediate reasoning

func (*Reporter) UpdateTokens

func (r *Reporter) UpdateTokens(inputTokens, outputTokens int)

UpdateTokens updates token statistics

func (*Reporter) WorkflowCompiled

func (r *Reporter) WorkflowCompiled(name string, jobCount, stepCount int)

WorkflowCompiled indicates successful workflow compilation

func (*Reporter) WorkflowError

func (r *Reporter) WorkflowError(err error)

WorkflowError reports a workflow-level error

func (*Reporter) WorkflowLoading

func (r *Reporter) WorkflowLoading(path string)

WorkflowLoading indicates workflow file is being loaded

type Stats

type Stats struct {
	DocsProcessed int
	DocsSkipped   int
	DocsErrors    int
	TokensInput   int
	TokensOutput  int
	Errors        []error
}

Stats tracks processing metrics

type StepInfo

type StepInfo struct {
	JobName    string
	StepName   string
	StepNum    int
	TotalSteps int
}

StepInfo carries information about the current step execution

func GetStepInfo

func GetStepInfo(ctx context.Context) *StepInfo

GetStepInfo extracts step information from context

type TokenSource

type TokenSource interface {
	Usage() TokenUsage
	ProfileUsage() []ProfileTokenUsage
}

TokenSource interface for accessing token usage from LLM routers

type TokenUsage

type TokenUsage struct {
	InputTokens int
	ReplyTokens int
}

TokenUsage represents token usage statistics

Jump to

Keyboard shortcuts

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