ollie/cmd/olliesrv/internal/session/doc.go

36 lines
1.2 KiB
Go

// Package session owns session lifecycle, persistence, and agent management.
//
// A Session groups agents, manages the tool server connection, and provides
// the context for cancellation propagation. Sessions can be paused (releasing
// resources) and resumed.
//
// # Lifecycle
//
// Sessions are created via the registry (NewSession or restored from disk).
// Each session owns:
//
// - A unique ID and optional friendly name
// - A list of agents
// - A tool server process and connection (local or remote)
// - A goal (session-level objective) that can trigger workflows
// - Autosave state for persistence
//
// # Persistence
//
// Sessions are saved to JSON files under the sessions directory. Save
// happens automatically on state changes (debounced). Restore rebuilds
// agents from saved history and reconnects to tool servers.
//
// # Tool Server
//
// Each session owns a toolsrv process. The session manages spawning,
// connection, and the bypass approval loop. On pause, the tool server
// is stopped; on resume, a new one is spawned.
//
// # Events
//
// The package publishes session events (pause, resume, agent changes)
// through an internal event bus. Use SubscribeWait/UnsubscribeWait for
// blocking waits on specific events.
package session