services/session/handler

Session handler — composition/adapter layer. Moved from core/session/ to services/session/ (Stage 2C). De-violated: reflection and tool wiring are now caller responsibilities. Wires session state and loop runner.

Values

pub fn handle_message(
  session: session.Session,
  client: client.Client,
  user_message: String,
  tool_defs: List(tool_def.ToolDefinition),
  max_rounds: Int,
  all_tools: List(tool.Tool),
  conn: sqlight.Connection,
  user_key: String,
  approval_handler: fn(tool.ApprovalRequest) -> tool.ApprovalResponse,
  log: behaviours.Logger,
  db_connector: behaviours.DbConnector,
  db_path: String,
  maybe_reflect: fn(
    client.Client,
    String,
    List(message.Message),
    String,
    Int,
    behaviours.Logger,
    behaviours.DbConnector,
    String,
  ) -> Nil,
) -> #(String, session.Session)

Process a user message through the conversation loop. maybe_reflect is a caller-provided function that fires background memory consolidation after successful turns. The caller wires it to plugins/hooks/reflection/ (no core→plugin violation in this module).

pub fn handle_message_with(
  session: session.Session,
  client: client.Client,
  user_message: String,
  tool_defs: List(tool_def.ToolDefinition),
  max_rounds: Int,
  all_tools: List(tool.Tool),
  conn: sqlight.Connection,
  user_key: String,
  approval_handler: fn(tool.ApprovalRequest) -> tool.ApprovalResponse,
  log: behaviours.Logger,
  db_connector: behaviours.DbConnector,
  db_path: String,
  maybe_reflect: fn(
    client.Client,
    String,
    List(message.Message),
    String,
    Int,
    behaviours.Logger,
    behaviours.DbConnector,
    String,
  ) -> Nil,
) -> #(String, session.Session)

Backward-compatible alias for handle_message.

Search Document