session

package
v0.4.7 Latest Latest
Warning

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

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

Documentation

Overview

Package session tracks launch-scoped Claude sessions, routes, agents, and tasks.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidHook = errors.New("invalid lifecycle hook")

Functions

func ValidateHookEvent

func ValidateHookEvent(event HookEvent) error

Types

type Config

type Config struct {
	Store             *store.Store
	Recorder          *observability.Recorder
	LaunchID          int64
	Enabled           bool
	DefaultModelAlias string
}

type HookEvent

type HookEvent struct {
	SessionID     string `json:"session_id"`
	HookEventName string `json:"hook_event_name"`
	Source        string `json:"source"`
	Reason        string `json:"reason"`
	AgentID       string `json:"agent_id"`
	AgentType     string `json:"agent_type"`
	TaskID        string `json:"task_id"`
	TeammateName  string `json:"teammate_name"`
	TeamName      string `json:"team_name"`
}

HookEvent deliberately excludes transcript paths, messages, task text, tool arguments, and raw errors. JSON decoding discards those fields immediately.

type Route

type Route struct {
	Kind          string `json:"kind"`
	ModelAlias    string `json:"model_alias"`
	ProviderName  string `json:"provider_name"`
	ProviderModel string `json:"provider_model"`
	Protocol      string `json:"protocol"`
}

type SessionSnapshot

type SessionSnapshot struct {
	ID              int64  `json:"id,omitempty"`
	ClaudeSessionID string `json:"claude_session_id,omitempty"`
	State           string `json:"state,omitempty"`
	Source          string `json:"source,omitempty"`
}

type Snapshot

type Snapshot struct {
	SchemaVersion    int                    `json:"schema_version"`
	LaunchID         int64                  `json:"launch_id"`
	LifecycleEnabled bool                   `json:"lifecycle_enabled"`
	LifecycleState   string                 `json:"lifecycle_state"`
	CurrentSession   SessionSnapshot        `json:"current_session"`
	Route            Route                  `json:"route"`
	ActiveAgents     int                    `json:"active_agents"`
	ActiveTasks      int                    `json:"active_tasks"`
	LastEvent        string                 `json:"last_event,omitempty"`
	LastError        string                 `json:"last_error,omitempty"`
	UpdatedAt        string                 `json:"updated_at,omitempty"`
	Observability    observability.Snapshot `json:"observability"`
}

type Tracker

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

func NewTracker

func NewTracker(config Config) (*Tracker, error)

func (*Tracker) CurrentSessionID

func (t *Tracker) CurrentSessionID() int64

func (*Tracker) Finalize

func (t *Tracker) Finalize(ctx context.Context) error

func (*Tracker) HandleHook

func (t *Tracker) HandleHook(ctx context.Context, event HookEvent) error

func (*Tracker) ObserveRoute

func (t *Tracker) ObserveRoute(ctx context.Context, route Route)

func (*Tracker) Snapshot

func (t *Tracker) Snapshot() Snapshot

Jump to

Keyboard shortcuts

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