Documentation
¶
Index ¶
- func ForceKillSessionByPID(runtimeDir, sessionID string)
- func SessionPIDAlive(runtimeDir, sessionID string) bool
- func TerminateSessionByPID(runtimeDir, sessionID string)
- type CanonicalClaimsReader
- type ClaimsReader
- type CompositeObserver
- type EventTicketMaterializer
- type HealthStatus
- type HeartbeatObserver
- type Monitor
- type Observation
- type Observer
- type PidObserver
- type SessionClaims
- type SessionMeta
- type SessionStatus
- type TicketMaterializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForceKillSessionByPID ¶
func ForceKillSessionByPID(runtimeDir, sessionID string)
ForceKillSessionByPID reads the PID from a session's process.json and forcefully kills the process.
func SessionPIDAlive ¶
SessionPIDAlive returns true if the session's process.json PID is alive. Returns false if process.json is missing or the PID is dead.
func TerminateSessionByPID ¶
func TerminateSessionByPID(runtimeDir, sessionID string)
TerminateSessionByPID reads the PID from a session's process.json and requests graceful termination.
Types ¶
type CanonicalClaimsReader ¶
type CanonicalClaimsReader struct {
// contains filtered or unexported fields
}
func NewCanonicalClaimsReader ¶
func NewCanonicalClaimsReader(runtimeDir string) *CanonicalClaimsReader
func (*CanonicalClaimsReader) ReadSession ¶
func (r *CanonicalClaimsReader) ReadSession(sessionID string) (SessionClaims, error)
type ClaimsReader ¶
type ClaimsReader interface {
ReadSession(sessionID string) (SessionClaims, error)
}
type CompositeObserver ¶
type CompositeObserver struct {
// contains filtered or unexported fields
}
func NewCompositeObserver ¶
func NewCompositeObserver(runtimeDir string, local Observer, remote Observer) *CompositeObserver
func (*CompositeObserver) Observe ¶
func (o *CompositeObserver) Observe(sessionID string) (Observation, error)
type EventTicketMaterializer ¶
type EventTicketMaterializer struct {
// contains filtered or unexported fields
}
func NewEventTicketMaterializer ¶
func NewEventTicketMaterializer(runtimeDir string) *EventTicketMaterializer
func (*EventTicketMaterializer) Materialize ¶
func (m *EventTicketMaterializer) Materialize(ctx context.Context, sessionIDs []string) error
type HealthStatus ¶
type HealthStatus string
const ( HealthGreen HealthStatus = "green" HealthYellow HealthStatus = "yellow" HealthRed HealthStatus = "red" )
type HeartbeatObserver ¶
type HeartbeatObserver struct {
// contains filtered or unexported fields
}
func NewHeartbeatObserver ¶
func NewHeartbeatObserver(runtimeDir string) *HeartbeatObserver
func (*HeartbeatObserver) Observe ¶
func (o *HeartbeatObserver) Observe(sessionID string) (Observation, error)
type Observation ¶
type Observer ¶
type Observer interface {
Observe(sessionID string) (Observation, error)
}
type PidObserver ¶
type PidObserver struct {
// contains filtered or unexported fields
}
PidObserver checks session liveness by reading the PID from process.json and probing it with kill(pid, 0). EPERM is treated as alive per brain/codebase/unix-process-liveness-eperm.
func NewPidObserver ¶
func NewPidObserver(runtimeDir string) *PidObserver
func (*PidObserver) Observe ¶
func (o *PidObserver) Observe(sessionID string) (Observation, error)
type SessionClaims ¶
type SessionClaims struct {
SessionID string `json:"session_id"`
HasEvents bool `json:"has_events"`
Completed bool `json:"completed"`
Skill string `json:"skill,omitempty"`
Runtime string `json:"runtime,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
TotalCostUSD float64 `json:"total_cost_usd"`
FirstEventAt time.Time `json:"first_event_at"`
LastEventAt time.Time `json:"last_event_at"`
LastAction string `json:"last_action,omitempty"`
TokensIn int `json:"tokens_in"`
TokensOut int `json:"tokens_out"`
Failed bool `json:"failed"`
}
type SessionMeta ¶
type SessionMeta struct {
SessionID string `json:"session_id"`
Status SessionStatus `json:"status"`
Runtime string `json:"runtime,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
TotalCostUSD float64 `json:"total_cost_usd"`
DurationSeconds int64 `json:"duration_seconds"`
LastActivity time.Time `json:"last_activity"`
CurrentAction string `json:"current_action,omitempty"`
Health HealthStatus `json:"health"`
ContextWindowUsagePct float64 `json:"context_window_usage_pct"`
RetryCount int `json:"retry_count"`
Alive bool `json:"alive"`
Stuck bool `json:"stuck"`
LogSize int64 `json:"log_size"`
UpdatedAt time.Time `json:"updated_at"`
IdleSeconds int64 `json:"idle_seconds"`
LastObservedProviderRaw string `json:"last_observed_provider_raw,omitempty"`
}
func DeriveSessionMeta ¶
func DeriveSessionMeta( sessionID string, observation Observation, claims SessionClaims, previous SessionMeta, now time.Time, ) SessionMeta
type SessionStatus ¶
type SessionStatus string
const ( SessionStatusRunning SessionStatus = "running" SessionStatusExited SessionStatus = "exited" SessionStatusFailed SessionStatus = "failed" )