cievents

package
v0.20260526.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitOK      = 0
	ExitGeneric = 1
	ExitUsage   = 2
	ExitConfig  = 3
	ExitLLM     = 4
	ExitTool    = 5
	ExitTimeout = 6
)
View Source
const (
	TypeRunStart       = "run_start"
	TypeAssistantStart = "assistant_start"
	TypeAssistantDelta = "assistant_delta"
	TypeAssistantEnd   = "assistant_end"
	TypeToolStart      = "tool_start"
	TypeToolResult     = "tool_result"
	TypeError          = "error"
	TypeRunEnd         = "run_end"
)
View Source
const (
	ChannelContent   = "content"
	ChannelReasoning = "reasoning"
)
View Source
const SchemaVersion = 1

Variables

This section is empty.

Functions

func ClassifyExit

func ClassifyExit(err error) (code int, reason string)

func ConfigError

func ConfigError(err error) error

func TimeoutError

func TimeoutError(err error) error

func ToolPolicyError

func ToolPolicyError() error

func UsageError

func UsageError(msg string) error

Types

type Event

type Event map[string]any

func AssistantDelta

func AssistantDelta(turn int, channel, delta string) Event

func AssistantEnd

func AssistantEnd(turn int, content, reasoning string, toolCalls []map[string]any) Event

func AssistantStart

func AssistantStart(turn, checkpointSeq int) Event

func ErrorEvent

func ErrorEvent(code int, message string) Event

func RunEnd

func RunEnd(exitCode int, exitReason, finalContent string, usage any) Event

func RunStart

func RunStart(prompt, model, provider, projHex string, ephemeral bool) Event

func ToolResult

func ToolResult(turn int, id, name string, result json.RawMessage, errMsg string) Event

func ToolStart

func ToolStart(turn int, id, name string, arguments json.RawMessage) Event

type ExecCLIOpts added in v0.20260525.0

type ExecCLIOpts struct {
	JSON            bool
	JSONL           bool
	NoColor         bool
	FailOnToolError bool
	EnvFile         string
	Prompt          string
}

func ParseExecCLIArgs added in v0.20260525.0

func ParseExecCLIArgs(args []string) (ExecCLIOpts, error)

type JSONCollector

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

func NewJSONCollector

func NewJSONCollector(out io.Writer) *JSONCollector

func (*JSONCollector) Emit

func (c *JSONCollector) Emit(ev Event)

func (*JSONCollector) Events

func (c *JSONCollector) Events() []Event

func (*JSONCollector) FlushReport

func (c *JSONCollector) FlushReport(meta ReportMeta, exitCode int, exitReason, finalContent string, usage any) error

func (*JSONCollector) StreamMode

func (c *JSONCollector) StreamMode() bool

type JSONLEmitter

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

func NewJSONLEmitter

func NewJSONLEmitter(out io.Writer) *JSONLEmitter

func (*JSONLEmitter) Emit

func (e *JSONLEmitter) Emit(ev Event)

func (*JSONLEmitter) Events

func (e *JSONLEmitter) Events() []Event

func (*JSONLEmitter) FlushReport

func (e *JSONLEmitter) FlushReport(ReportMeta, int, string, string, any) error

func (*JSONLEmitter) StreamMode

func (e *JSONLEmitter) StreamMode() bool

type ReportMeta

type ReportMeta struct {
	Prompt    string
	Model     string
	Provider  string
	ProjHex   string
	Ephemeral bool
}

type RunError

type RunError struct {
	Code   int
	Reason string
	Err    error
}

func NewRunError

func NewRunError(code int, reason string, err error) *RunError

func (*RunError) Error

func (e *RunError) Error() string

func (*RunError) Unwrap

func (e *RunError) Unwrap() error

type RunReport

type RunReport struct {
	V            int     `json:"v"`
	Prompt       string  `json:"prompt"`
	Model        string  `json:"model"`
	Provider     string  `json:"provider"`
	ProjHex      string  `json:"proj_hex"`
	Ephemeral    bool    `json:"ephemeral"`
	Events       []Event `json:"events"`
	ExitCode     int     `json:"exit_code"`
	ExitReason   string  `json:"exit_reason"`
	FinalContent string  `json:"final_content,omitempty"`
	Usage        any     `json:"usage,omitempty"`
	Error        string  `json:"error,omitempty"`
}

type Sink

type Sink interface {
	Emit(ev Event)
	StreamMode() bool
	Events() []Event
	FlushReport(meta ReportMeta, exitCode int, exitReason, finalContent string, usage any) error
}

Jump to

Keyboard shortcuts

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