Skip to content

src/engine/bare/config.rs

This file is your builder surface: every set_* and with_* method on BareLoop, the temp-dir management, and the TextStreamer type.

Your setters all call debug_assert_idle, so run them before the first run. They cover set_reflector, set_recovery_strategy, and set_context_manager, which re-syncs window and threshold from session config.

They also cover set_token_counter, which is the driver fallback only since the manager’s counter rules, plus set_stream_handler under streaming, set_hook_executor under hooks, and set_health_registry under tool_health.

The rest are set_memory, set_pipeline which injects your loop’s registry as core, register_observer, set_text_streamer, add_contributor, set_request_options, and set_turn_mode.

Each setter has a fluent with_* twin you can chain instead.

Since 0.4.1 you also configure your tool surface here: set_tool_selector / with_tool_selector and set_async_tool_selector / with_async_tool_selector. The engine takes a sync selector or an async one, never both, and configuring either clears the other.

Attachments joined in 0.4.1: set_attachment / with_attachment, where an equal id replaces in place, plus detach_attachment(id) and attachment_ids().

with_temp_dir(base) and with_managed_temp_disabled() give you managed temp control, and TextStreamer = Arc<dyn Fn(&str) + Send + Sync> is your simple per-chunk text callback.

debug_assert_idle() panics in debug builds if the machine already advanced past Start.

set_pipeline never takes a builder with a core, because it injects your loop’s own registry. Building a pipeline manually elsewhere needs with_core.

Your two token counters, driver fallback and manager, are deliberately not synced. Configure the manager’s and the driver follows it.

set_context_manager syncs window and threshold from your session config, because session config owns window policy.

Deep dive: The driver.