services/loop/types
Loop service types — slim environment and service bundles for the orchestrator. Replaces the monolithic LoopContext record with focused parameter bundles.
Types
pub type CompressionService {
CompressionService(
should_compress: fn(Int, Int, Int) -> Bool,
split_history: fn(List(message.Message), Int, Int) -> hooks.CompressionPlan,
build_summary_prompt: fn(List(message.Message)) -> String,
apply_compression: fn(List(message.Message), Int, Int, String) -> List(
message.Message,
),
is_cooling_down: fn(hooks.CooldownState, Int) -> Bool,
record_success: fn(hooks.CooldownState) -> hooks.CooldownState,
record_failure: fn(hooks.CooldownState, Int) -> hooks.CooldownState,
)
}
Constructors
-
CompressionService( should_compress: fn(Int, Int, Int) -> Bool, split_history: fn(List(message.Message), Int, Int) -> hooks.CompressionPlan, build_summary_prompt: fn(List(message.Message)) -> String, apply_compression: fn(List(message.Message), Int, Int, String) -> List( message.Message, ), is_cooling_down: fn(hooks.CooldownState, Int) -> Bool, record_success: fn(hooks.CooldownState) -> hooks.CooldownState, record_failure: fn(hooks.CooldownState, Int) -> hooks.CooldownState, )
pub type ContextService {
ContextService(
build_system_prompt: fn(String, sqlight.Connection, String) -> String,
)
}
Constructors
-
ContextService( build_system_prompt: fn(String, sqlight.Connection, String) -> String, )
pub type GuardrailService {
GuardrailService(
fresh: fn() -> hooks.LoopState,
record_success: fn(hooks.LoopState, String, String, String) -> hooks.LoopState,
record_failure: fn(hooks.LoopState, String, String) -> hooks.LoopState,
escalation: fn(hooks.LoopState, Int, Int, Int, Int, Int, Int) -> hooks.Escalation,
block_tool: fn(hooks.LoopState, String) -> hooks.LoopState,
halt: fn(hooks.LoopState) -> hooks.LoopState,
)
}
Constructors
-
GuardrailService( fresh: fn() -> hooks.LoopState, record_success: fn(hooks.LoopState, String, String, String) -> hooks.LoopState, record_failure: fn(hooks.LoopState, String, String) -> hooks.LoopState, escalation: fn(hooks.LoopState, Int, Int, Int, Int, Int, Int) -> hooks.Escalation, block_tool: fn(hooks.LoopState, String) -> hooks.LoopState, halt: fn(hooks.LoopState) -> hooks.LoopState, )
pub type LLMService {
LLMService(
is_retryable: fn(client.ClientError) -> Bool,
should_compress: fn(client.ClientError) -> Bool,
)
}
Constructors
-
LLMService( is_retryable: fn(client.ClientError) -> Bool, should_compress: fn(client.ClientError) -> Bool, )
pub type LoggerBundle {
LoggerBundle(
debug: fn(logging.LogCategory, String, String) -> Nil,
info: fn(logging.LogCategory, String, String) -> Nil,
warn: fn(logging.LogCategory, String, String) -> Nil,
error: fn(logging.LogCategory, String, String) -> Nil,
)
}
Constructors
-
LoggerBundle( debug: fn(logging.LogCategory, String, String) -> Nil, info: fn(logging.LogCategory, String, String) -> Nil, warn: fn(logging.LogCategory, String, String) -> Nil, error: fn(logging.LogCategory, String, String) -> Nil, )
pub type LoopEnv {
LoopEnv(
chat_fn: fn(
client.Client,
List(message.Message),
List(tool_def.ToolDefinition),
) -> Result(response.ChatResponse, client.ClientError),
client: client.Client,
persona: String,
tool_defs: List(tool_def.ToolDefinition),
max_rounds: Int,
config: config.LoopConfig,
)
}
Constructors
-
LoopEnv( chat_fn: fn( client.Client, List(message.Message), List(tool_def.ToolDefinition), ) -> Result(response.ChatResponse, client.ClientError), client: client.Client, persona: String, tool_defs: List(tool_def.ToolDefinition), max_rounds: Int, config: config.LoopConfig, )
pub type TokenService {
TokenService(
estimate: fn(
String,
List(message.Message),
List(tool_def.ToolDefinition),
) -> Int,
)
}
Constructors
-
TokenService( estimate: fn( String, List(message.Message), List(tool_def.ToolDefinition), ) -> Int, )