Skip to main content

locode_core/
lib.rs

1//! locode — the facade crate: the public surface for consumers (the future
2//! `locode-app`, and `locode-exec` as the reference consumer).
3//!
4//! Two curated surfaces (Task 14, SPEC Users #3/#4):
5//!
6//! - **The driving API** — assemble and run one session: [`Session`] +
7//!   [`EngineConfig`], harness selection ([`resolve`]/[`available`] +
8//!   [`PackContext`]), the providers ([`AnthropicProvider`]/[`MockProvider`]),
9//!   the host ([`Host`]/[`HostConfig`]/[`PathPolicy`]), and the report/event
10//!   types ([`Report`]/[`Status`]/[`Event`]/[`Usage`]).
11//! - **The tool surface** — use our typed tools in *your own* loop: [`Tool`],
12//!   [`Registry`] (+ the [`Registry::dispatch`] door), [`ToolCtx`],
13//!   [`ToolOutput`], [`ToolSpec`], and the packs' concrete tool sets via
14//!   [`Pack::build_registry`].
15//!
16//! Downstream code should depend on this crate, not the `locode-*` internals —
17//! the internals may churn; this surface is the stable contract.
18
19mod providers;
20
21// ---- custom providers: name → factory registry (ADR-0015) ----
22pub use providers::{
23    BuiltProvider, ProviderBuildError, ProviderFactory, ProviderInit, ProviderRegistry,
24};
25
26// ---- protocol: conversation, report envelope, stream events ----
27pub use locode_protocol::{
28    ContentBlock, Conversation, Event, GrammarSyntax, ImageSource, Message, ReasoningFormat,
29    Report, ResultChunk, Role, Status, ToolCallRecord, ToolInputFormat, ToolSpec, Usage,
30    reconstruct_conversation,
31};
32
33// ---- engine: the driving API ----
34pub use locode_engine::{
35    AllowAll, ApprovalRequest, Approver, CancellationToken, Decision, EngineConfig, EventSink,
36    FnSink, NullSink, Session,
37};
38
39// ---- providers: the wire schemas ----
40pub use locode_provider::anthropic::{
41    ApiBackend, AuthRefresh, AuthScheme, DeveloperRendering, ModelConfig, ReasoningEncoding,
42    RetryPolicy,
43};
44pub use locode_provider::{
45    AnthropicProvider, CacheHint, Completion, ConversationRequest, MockProvider, OpenAiBackend,
46    OpenAiModelConfig, OpenAiResponsesProvider, Provider, ProviderError, ReasoningEffort,
47    SamplingArgs, StopReason, SystemPlacement,
48};
49
50// ---- packs: harness selection ----
51pub use locode_packs::{GrokPack, Pack, PackContext, UnknownHarness, available, grok, resolve};
52
53// ---- host: the side-effect seam ----
54pub use locode_host::{ExecLimits, Host, HostConfig, PathPolicy};
55
56// ---- tools: the full tool surface (SPEC Users #4) ----
57pub use locode_tools::{
58    Dispatched, DynTool, MODEL_OUTPUT_BUDGET, Registry, Tool, ToolCtx, ToolError, ToolKind,
59    ToolOutput, truncate_for_model,
60};