org.llm4s.assistant

Members list

Type members

Classlikes

class AssistantAgent(client: LLMClient, tools: ToolRegistry, sessionDir: String, consoleConfig: ConsoleConfig)

Interactive assistant agent that wraps the existing Agent functionality in a user-friendly conversational loop with session management using functional programming principles.

Interactive assistant agent that wraps the existing Agent functionality in a user-friendly conversational loop with session management using functional programming principles.

Attributes

Supertypes
class Object
trait Matchable
class Any
sealed trait Command

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Help
class Load
object New
object Quit
class Save
object Sessions
Show all
object Command

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Command.type
case class ConsoleConfig(promptSymbol: String, assistantSymbol: String, colorScheme: Map[MessageType, Attrs], styles: StyleConfig)

Immutable configuration for console interface

Immutable configuration for console interface

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ConsoleConfig

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
class ConsoleInterface(tools: ToolRegistry, sessionManager: SessionManager, config: ConsoleConfig)

Handles console-based user interface using functional programming principles

Handles console-based user interface using functional programming principles

Attributes

Supertypes
class Object
trait Matchable
class Any
sealed trait MessageType

Enumeration for different message types

Enumeration for different message types

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Error
object Info
object Success
object Warning
object MessageType

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
case class SessionInfo(id: SessionId, title: String, filePath: FilePath, created: LocalDateTime, messageCount: Int, fileSize: Long)

Information about a saved session file.

Information about a saved session file.

Contains metadata about a persisted session including file location and statistics about the conversation.

Value parameters

created

Timestamp when the session was created

filePath

Path to the session JSON file

fileSize

Size of the session file in bytes

id

Unique session identifier

messageCount

Number of messages in the conversation

title

Human-readable session title

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object SessionInfo

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
class SessionManager(sessionDir: DirectoryPath, agent: Agent)

Manages session persistence for the interactive assistant.

Manages session persistence for the interactive assistant.

SessionManager handles saving and loading conversation sessions to disk, enabling users to resume previous conversations and maintain context across multiple interactions.

== Key Features ==

  • '''Session Save''': Persists AgentState as JSON with markdown companion
  • '''Session Load''': Restores sessions with tool registry reconstruction
  • '''Session Listing''': Shows recent sessions sorted by modification time
  • '''Filename Sanitization''': Safely handles special characters in titles

== Storage Format == Sessions are stored as two files:

  • {title}.json - Machine-readable session state for loading
  • {title}.md - Human-readable markdown for viewing/sharing

== Usage Example ==

val manager = new SessionManager(DirectoryPath("/path/to/sessions"), agent)

// Save current session
val info = manager.saveSession(sessionState, Some("My Conversation"))

// List recent sessions
val sessions = manager.listRecentSessions(limit = 5)

// Load a previous session
val loaded = manager.loadSession("My Conversation", tools)

Value parameters

agent

Agent instance for markdown formatting

sessionDir

Directory path where sessions are stored

Attributes

See also

SessionState for the state being persisted

SessionInfo for session metadata returned after save

Supertypes
class Object
trait Matchable
class Any
case class SessionState(agentState: Option[AgentState], sessionId: SessionId, sessionDir: DirectoryPath, created: LocalDateTime)

Represents the state of an interactive assistant session.

Represents the state of an interactive assistant session.

Encapsulates the agent state, session identity, and metadata for persistence and session management.

Value parameters

agentState

Optional underlying agent state with conversation history

created

Timestamp when the session was created

sessionDir

Directory path for session file storage

sessionId

Unique identifier for this session

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object SessionState

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class SessionSummary(id: SessionId, title: String, filename: String, created: LocalDateTime)

Summary of a session for listing and display purposes.

Summary of a session for listing and display purposes.

Lightweight representation of a session containing only essential information for session selection UI.

Value parameters

created

Timestamp when the session was created

filename

Base filename of the session file

id

Unique session identifier

title

Human-readable session title

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
object ShowInstances

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type