Skip to main content

quorum_rs/
lib.rs

1//! # quorum-rs
2//!
3//! Trait definitions, data types, and runtime for building deliberation agents.
4//!
5//! This crate provides the agent SDK plus a reference runtime: traits to code
6//! against, batteries-included implementations to compose with, and the NATS
7//! JetStream worker that ties them together.
8//!
9//! - **Agent traits**: [`NsedAgent`], [`PersistenceStore`], [`TokenEstimator`]
10//! - **LLM traits**: [`AiModel`], [`ChatStrategy`]
11//! - **Tool trait**: [`Tool`]
12//! - **Prompt trait**: [`PromptSet`]
13//! - **Data types**: [`AgentContext`], [`Proposal`], [`Evaluation`], [`AgentConfig`], etc.
14//! - **NATS utilities**: [`nats_utils::sanitize_subject_component`], [`nats_utils::ensure_kv_bucket`]
15//! - **Agent implementations**: [`ExecAgent`], [`McpAgent`], [`ClaudeAgent`], and the
16//!   reference `ProposerEvaluatorAgent` (native LLM via `OpenAICompatibleModel`).
17//!
18//! Dual-licensed Apache-2.0 OR MIT.
19
20pub mod agent_manager;
21pub mod agents;
22pub mod api_error_middleware;
23/// Brand strings — banner ASCII, copy snippets used by `quorum
24/// init` and `quorum validate`. Kept in one module so a future
25/// rebrand changes one file, not 12 string-literal sites.
26pub mod brand;
27#[cfg(feature = "cli")]
28pub mod cli;
29pub mod config;
30pub mod control_plane;
31pub mod conversation;
32#[cfg(feature = "audit")]
33pub mod crypto;
34pub mod dump_prompts;
35pub mod events;
36/// Workspace + agent-fleet config primitives that `quorum init`
37/// composes: provider catalog, persona presets, yaml renderer,
38/// env-file merger, generic wizard helpers. No CLI surface —
39/// the binary-facing wizard lives at `cli::commands::init_wizard`.
40pub mod init;
41pub mod llms;
42pub mod middleware;
43pub mod multi_agent;
44pub mod nats_utils;
45pub mod orchestrator_registry;
46pub mod project_registry;
47pub mod project_sync;
48pub mod prompts;
49pub mod providers;
50pub mod scheduling;
51pub mod serve;
52pub mod status;
53pub mod telemetry;
54pub mod tools;
55pub mod version_check;
56pub mod workers;
57
58// Re-export commonly used items at crate root for convenience
59pub use agents::DeliberationPhase;
60pub use agents::ProposalRecord;
61pub use agents::config::{AgentConfig, TaskPrecision};
62pub use agents::exec_agent::ExecAgent;
63pub use agents::mcp_agent::{ClaudeAgent, McpAgent};
64pub use agents::{
65    AgentContext, AgentHeartbeat, AgentLiveStatus, AgentPricingInfo, AnnotationType,
66    CandidateProposal, ChatCapable, Evaluation, EvaluationRecord, HeuristicTokenEstimator,
67    InjectionPriority, NsedAgent, OperatorAnnotation, OrchestratorPing, PendingToolCall,
68    PersistenceStore, Proposal, TokenEstimator, TokenUsage, ToolCallStatus, ToolChanges,
69    UserInjection, UserToolDefinition,
70};
71pub use control_plane::{AgentControlPlane, ConfigPatch};
72#[cfg(feature = "audit")]
73pub use crypto::{AgentKeyPair, SigningHook};
74pub use events::{
75    CategoryScoreBreakdown, JobCompleteEvent, ProposalControversyEntry, ProposalScoreEntry,
76    RoundSummaryEvent,
77};
78pub use llms::{
79    AiModel, ChatCompletionResult, LlmRequestSpan, RequestConfig, SimpleOpenAIModel, TimingMetadata,
80};
81pub use nats_utils::{NatsAuth, OrchestratorEntry, connect_nats, sha256_hex};
82pub use prompts::PromptSet;
83pub use scheduling::PolicySla;
84pub use status::{AgentStatusSnapshot, EventLogEntry, ScoreEntry, SharedAgentStatus, TaskLogEntry};
85pub use telemetry::{
86    AgentEventCommon, FinishReason, LlmError, LlmErrorClass, NatsConnectionState,
87    PromptExposureDetected, RetryReason, TaskFailureClass, TelemetryConfig, TelemetryContext,
88    TelemetryEmitter, TelemetryEvent, TelemetrySource, derive_trace_id, trace_id_for,
89};
90pub use tools::Tool;
91pub use workers::buffer::{AckHandle, BufferEntryDetail, BufferEntrySummary, ResponseBuffer};
92pub use workers::{
93    JobManifest, NatsNsedWorker, NatsScratchpadStore, UserToolHandlerFactory, WorkerConfig,
94    WorkerHook,
95};
96// Re-export crypto-core for downstream consumers
97#[cfg(feature = "audit")]
98pub use quorum_crypto_core;