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, InputQueue, MID_RUN_PREAMBLE, NullSink, Session,
37};
38
39// ---- providers: the wire schemas ----
40pub use locode_provider::anthropic::{
41    ApiBackend, AuthRefresh, AuthScheme, DeveloperRendering, ModelConfig, RetryPolicy,
42};
43pub use locode_provider::{
44    AnthropicProvider, CacheHint, Completion, ConversationRequest, Effort, MockProvider,
45    OpenAiBackend, OpenAiModelConfig, OpenAiResponsesProvider, Provider, ProviderError,
46    ReasoningEffort, SamplingArgs, StopReason, SystemPlacement,
47};
48
49// ---- packs: harness selection ----
50pub use locode_packs::{GrokPack, Pack, PackContext, UnknownHarness, available, grok, resolve};
51
52// ---- host: the side-effect seam ----
53pub use locode_host::{
54    ExecLimits, GitMeta, Host, HostConfig, PathPolicy, RolloutContents, Settings, SettingsLoad,
55    SkillsExtraEntry, TraceExtras, TraceWriter, decode_cwd_dirname, encode_cwd_dirname,
56    find_latest_rollout, find_rollout_by_id, load_settings, locode_home, read_rollout,
57    update_user_setting,
58};
59
60// ---- instructions: `AGENTS.md` discovery + its injected message ----
61pub use locode_instructions::{
62    InstructionEntry, InstructionsConfig, ProjectInstructions, load_project_instructions,
63};
64
65// ---- skills: `SKILL.md` discovery + the model-facing listing ----
66pub use locode_skills::{
67    DiscoveredSkills, Skill, SkillScope, SkillsConfig, discover as discover_skills,
68};
69
70// ---- tools: the full tool surface (SPEC Users #4) ----
71pub use locode_tools::{
72    Dispatched, DynTool, MODEL_OUTPUT_BUDGET, Registry, Tool, ToolCtx, ToolError, ToolKind,
73    ToolOutput, truncate_for_model,
74};