Skip to main content

Module session

Module session 

Source
Expand description

Session persistence and storage.

This module provides session management with the following design principles:

  • Abstraction: SessionStore trait for pluggable storage backends
  • Local First: Works fully offline with LocalFileStore
  • Cloud Ready: Sync can be added via trait implementation

§Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Application Layer                        │
│  SessionAsset, ConversationHistory, ProjectContext          │
└─────────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────────┐
│                    Storage Abstraction                      │
│  SessionStore trait                                         │
└─────────────────────────────────────────────────────────────┘
                           │
          ┌────────────────┴────────────────┐
          ▼                                 ▼
    ┌──────────┐                     ┌──────────┐
    │  Local   │                     │  Remote  │
    │  Store   │                     │  Store   │
    └──────────┘                     └──────────┘

§Example

use orcs_runtime::session::{SessionStore, LocalFileStore, SessionAsset};
use std::path::PathBuf;

// Create a local store
let store = LocalFileStore::new(PathBuf::from("~/.orcs/sessions"))?;

// Create and save a session
let mut asset = SessionAsset::new();
store.save(&asset).await?;

// List all sessions
let sessions = store.list().await?;

// Load a specific session
let loaded = store.load(&asset.id).await?;

Structs§

AutoTriggerConfig
Auto-trigger configuration for skills.
CodingStylePrefs
Coding style preferences.
CommunicationPrefs
Communication preferences.
CompactedTurn
Compacted (summarized) turns.
ConversationHistory
Conversation history.
ConversationTurn
A single conversation turn.
LearnedFact
A fact learned about the project.
LocalFileStore
Local file-based session store.
ProjectContext
Project-specific context.
SessionAsset
SessionAsset - The accumulating value.
SessionMeta
Session metadata for listing.
SkillConfig
Skill configuration.
SyncStatus
Overall sync status for the store.
ToolCallRecord
Record of a tool call.
UserPreferences
User preferences learned over time.

Enums§

StorageError
Errors that can occur during session storage operations.
SyncMode
Sync mode.
SyncState
Sync state for a session.
TriggerCondition
Trigger condition for auto-firing skills.

Traits§

SessionStore
Session storage abstraction.

Functions§

default_session_path
Returns the default session storage path.