Documentation
¶
Index ¶
- type ContextRef
- type Event
- type EventKind
- type Metadata
- type Options
- type SessionRecorder
- func (r *SessionRecorder) AppendEvent(evt Event) error
- func (r *SessionRecorder) Directory() string
- func (r *SessionRecorder) RecordError(message string, attrs map[string]any) error
- func (r *SessionRecorder) SessionID() string
- func (r *SessionRecorder) SetSessionInfo(name string, createdAt time.Time) error
- type TaskEvent
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 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 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.