storage

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextRef

type ContextRef struct {
	Type string `json:"type"`
	ID   string `json:"id"`
	Name string `json:"name,omitempty"`
}

ContextRef references a Kai entity shared with the agent.

type Event

type Event struct {
	Sequence  int64          `json:"sequence"`
	Timestamp time.Time      `json:"timestamp"`
	Kind      EventKind      `json:"kind"`
	Role      string         `json:"role,omitempty"`
	Content   string         `json:"content,omitempty"`
	Duration  time.Duration  `json:"duration,omitempty"`
	Task      *TaskEvent     `json:"task,omitempty"`
	Context   []ContextRef   `json:"context,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
	Error     string         `json:"error,omitempty"`
}

Event represents a single line within the transcript.

type EventKind

type EventKind string

EventKind enumerates the supported transcript event types.

const (
	EventKindLifecycle EventKind = "lifecycle"
	EventKindMessage   EventKind = "message"
	EventKindTask      EventKind = "task"
	EventKindTaskState EventKind = "task_state"
	EventKindError     EventKind = "error"
)

type Metadata

type Metadata struct {
	SessionID        string     `json:"session_id"`
	SessionName      string     `json:"session_name,omitempty"`
	SessionCreatedAt *time.Time `json:"session_created_at,omitempty"`
	RecorderCreated  time.Time  `json:"recorder_created_at"`
	UpdatedAt        time.Time  `json:"updated_at"`
	EventCount       int64      `json:"event_count"`
	CLIVersion       string     `json:"cli_version,omitempty"`
}

Metadata captures high-level information about a stored session.

type Options

type Options struct {
	SessionName    string
	SessionCreated time.Time
	CLIVersion     string
}

Options describe the properties known at the time a recorder is created.

type SessionRecorder

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

SessionRecorder manages on-disk persistence for a Kai session.

func NewSessionRecorder

func NewSessionRecorder(sessionID string, opts Options) (*SessionRecorder, error)

NewSessionRecorder constructs or loads a recorder for the provided session.

func (*SessionRecorder) AppendEvent

func (r *SessionRecorder) AppendEvent(evt Event) error

AppendEvent appends a new transcript line and updates metadata atomically.

func (*SessionRecorder) Directory

func (r *SessionRecorder) Directory() string

Directory exposes the path used for session persistence.

func (*SessionRecorder) RecordError

func (r *SessionRecorder) RecordError(message string, attrs map[string]any) error

RecordError logs an error event in the transcript.

func (*SessionRecorder) SessionID

func (r *SessionRecorder) SessionID() string

SessionID returns the identifier associated with the recorder.

func (*SessionRecorder) SetSessionInfo

func (r *SessionRecorder) SetSessionInfo(name string, createdAt time.Time) error

SetSessionInfo updates the stored metadata with the latest view of the session details.

type TaskEvent

type TaskEvent struct {
	ID            string         `json:"id,omitempty"`
	Type          string         `json:"type,omitempty"`
	Status        string         `json:"status,omitempty"`
	Action        string         `json:"action,omitempty"`
	Message       string         `json:"message,omitempty"`
	Confirmation  string         `json:"confirmation,omitempty"`
	Error         string         `json:"error,omitempty"`
	Context       []ContextRef   `json:"context,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
	AnalysisReady bool           `json:"analysis_ready,omitempty"`
}

TaskEvent captures details related to Kai task proposals and updates.

Jump to

Keyboard shortcuts

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