services/loop/runner
Loop runner — composition root entry points for the conversation loop. Moved from core/loop/runner.gleam (Stage 3). Wires concrete service implementations into service bundles for the orchestrator.
Values
pub fn run(
client: client.Client,
persona: String,
history: List(message.Message),
user_message: String,
tool_defs: List(tool_def.ToolDefinition),
max_rounds: Int,
conn: sqlight.Connection,
user_key: String,
session_id: String,
) -> orchestrator.LoopResult
Run the conversation loop with the default tool registry (auto-deny approvals).
pub fn run_with(
client: client.Client,
persona: String,
history: List(message.Message),
user_message: String,
tool_defs: List(tool_def.ToolDefinition),
max_rounds: Int,
all_tools: List(tool.Tool),
conn: sqlight.Connection,
user_key: String,
session_id: String,
approval_handler: fn(tool.ApprovalRequest) -> tool.ApprovalResponse,
) -> orchestrator.LoopResult
Run the conversation loop with a custom tool list (e.g. approval-enabled bash).
pub fn run_with_chat_fn(
chat_fn: fn(
client.Client,
List(message.Message),
List(tool_def.ToolDefinition),
) -> Result(response.ChatResponse, client.ClientError),
client: client.Client,
persona: String,
history: List(message.Message),
user_message: String,
tool_defs: List(tool_def.ToolDefinition),
max_rounds: Int,
all_tools: List(tool.Tool),
conn: sqlight.Connection,
user_key: String,
session_id: String,
) -> orchestrator.LoopResult
Run the conversation loop with a custom chat function (for testing, auto-deny approvals).