Skip to main content

oxios_kernel/
lib.rs

1//! Oxios kernel: supervisor, event bus, state store.
2//!
3//! The kernel is the core of the Oxios Agent OS. Everything passes
4//! through here: agent lifecycle, inter-agent communication, and
5//! persistent state management.
6
7#![allow(missing_docs)]
8
9// ─── Lifecycle ──────────────────────────────────────────────────────
10// Agent 생성, 실행, 종료. OS의 init + process management.
11pub mod agent_group;
12pub mod agent_lifecycle;
13pub mod agent_runtime;
14pub mod daemon;
15pub mod readiness;
16pub mod streaming_sink;
17pub mod subagent_runner;
18pub mod supervisor;
19
20// ─── Agent History Log ──────────────────────────────────────────────
21// 에이전트 실행 기록 — SQLite + JSON dual storage.
22pub mod agent_log_db;
23
24// ─── Orchestration ──────────────────────────────────────────────────
25// 작업 조율, 스케줄링, 예산 관리.
26pub mod budget;
27pub mod cron;
28pub mod orchestrator;
29// ─── Resilience (RFC-029) ──────────────────────────────────────────────
30// Failure classification + (P2) recovery coordination.
31pub mod resilience;
32
33// ─── Security ───────────────────────────────────────────────────────
34// 접근 제어, 인증, 권한, 감사.
35pub mod access_manager;
36pub mod auth;
37pub mod capability;
38pub mod credential;
39
40// ─── Audit Persistence ───────────────────────────────────────────────
41//
42// `audit_persistence` wires `oxi_sdk::observability::AuditPersistence`
43// to the kernel's filesystem-based `StateStore`. The trail itself
44// lives in `oxi_sdk::observability::AuditTrail` and is re-exported
45// below — RFC-014 Phase F.
46mod audit_persistence;
47
48// ─── Autonomous Persistence ─────────────────────────────────────────
49// RFC-016: Post-execution hook for auto-saving knowledge and memory.
50pub mod knowledge_dream;
51pub mod persistence_hook;
52
53// ─── Communication ──────────────────────────────────────────────────
54// 이벤트, 메시징, 외부 프로토콜, 멀티 에이전트 조정.
55pub mod a2a;
56pub mod coordination;
57pub mod email;
58pub mod event_bus;
59pub mod mcp;
60
61// ─── Intelligence ───────────────────────────────────────────────────
62// 메모리, 임베딩, 페르소나, 온보딩.
63pub mod embedding;
64pub mod memory;
65pub mod onboarding;
66pub mod persona;
67
68// ─── Tools & Skills ───────────────────────────────────────────────
69pub mod host_tools;
70pub mod skill;
71pub mod token_maxing;
72pub mod tools;
73#[cfg(feature = "wasm-sandbox")]
74pub mod wasm_sandbox;
75pub mod workers;
76
77// ─── State & Config ─────────────────────────────────────────────────
78// 영속 상태, 설정, 백업, 리소스 모니터링.
79pub mod backup;
80pub mod config;
81pub mod git_layer;
82pub mod mount;
83pub mod project;
84pub mod resource_monitor;
85pub mod session_context;
86pub mod state_store;
87
88// ─── Infrastructure ─────────────────────────────────────────────────
89// 엔진, 에러, 타입, 메트릭, 텔레메트리, 옵저버빌리티.
90pub mod engine;
91pub mod error;
92pub mod metrics;
93pub mod observability;
94pub mod types;
95
96// ─── API Surface ────────────────────────────────────────────────────
97// 외부에 노출하는 typed facade.
98pub mod kernel_handle;
99
100// ─────────────────────────────────────────────────────────────────────
101// Re-exports (같은 섹션 순서)
102// ─────────────────────────────────────────────────────────────────────
103
104// ─── Lifecycle ──────────────────────────────────────────────────────
105pub use agent_group::{OxiosAgentGroup, OxiosAgentGroupStatus, OxiosGroupAgent};
106pub use agent_lifecycle::AgentLifecycleManager;
107pub use agent_runtime::AgentRuntime;
108pub use daemon::{DaemonManager, DaemonStatus};
109pub use persistence_hook::PersistenceHook;
110pub use readiness::{ReadinessGate, SubsystemState};
111pub use supervisor::{BasicSupervisor, Supervisor};
112
113// ─── Orchestration ──────────────────────────────────────────────────
114pub use budget::{
115    BudgetExceeded, BudgetInfo, BudgetKind, BudgetLimit, BudgetManager, FullBudgetInfo,
116};
117// Circuit breaker — delegates to oxi-sdk
118pub use cron::{CronJob, CronJobResult, CronJobUpdate, CronScheduler, JobSource};
119pub use orchestrator::{AgentRole, OrchestrationResult, Orchestrator, SubTask};
120// CircuitBreaker removed — use oxi_sdk::ProviderCircuitBreaker directly (#11).
121pub use types::Priority;
122
123// ─── Security ───────────────────────────────────────────────────────
124pub use access_manager::{
125    AccessManager, Action, AgentPermissions, ApprovalStatus, PendingApproval, RbacAuditEntry,
126    RbacManager, RbacPolicy, Role, Subject,
127};
128// AuditTrail types are re-exported from oxi-sdk (Phase F: removed
129// 1134-line duplicate). `AgentId as AuditAgentId` preserves the
130// historical kernel-level type alias.
131pub use auth::{AuthManager, KeyMeta};
132pub use capability::template::CapabilityTemplate;
133pub use capability::{CSpace, Capability, CapabilityId, Issuer, ResourceRef, Rights};
134pub use credential::CredentialStore;
135pub use oxi_sdk::observability::audit_trail::AgentId as AuditAgentId;
136pub use oxi_sdk::observability::{
137    AuditAction, AuditError, AuditPersistence, AuditTrail, HashDigest, TrailEntry,
138};
139
140// ─── Communication ──────────────────────────────────────────────────
141pub use a2a::{
142    A2ACircuitBreaker, A2AMessage, A2AProtocol, A2ARequest, A2AResponse, AgentCard,
143    AgentCardRegistry, CircuitState, DelegationHandler, TaskPriority, TaskSpec,
144};
145pub use email::{SendReceipt, SmtpClient};
146pub use event_bus::{EventBus, KernelEvent};
147pub use mcp::{
148    McpBridge, McpCapabilities, McpServer, McpTool, McpToolCallResult as CallToolResult,
149};
150
151// ─── Intelligence ───────────────────────────────────────────────────
152pub use embedding::{EmbeddingProvider, EmbeddingVector, TfIdfEmbeddingProvider};
153
154// ─── GGUF Embedding (RFC-012) ──────────────────────────────────────
155#[cfg(feature = "embedding-gguf")]
156pub use embedding::gguf::{EmbeddingDimension, GgufEmbeddingProvider, GgufModelLoader};
157
158pub use memory::auto_memory_bridge::{
159    AutoMemoryBridge, ExportResult, GuidancePattern, ImportResult, InsightCategory, MemoryInsight,
160    SyncDirection, SyncResult,
161};
162pub use memory::{
163    DreamCheckpoint, DreamConfig, DreamProcess, DreamReport, HnswIndex, HnswMemoryIndex,
164    MemoryManager, ProactiveRecall, RecallTiming, SemanticHit,
165};
166pub use memory::{MemoryEntry, MemoryTier, MemoryType, ProtectionLevel, TextVector, content_hash};
167pub use oxios_memory::memory::flash_attention::{
168    BenchmarkResult as AttentionBenchmarkResult, FlashAttention, FlashAttentionConfig,
169    MemoryEstimate,
170};
171pub use oxios_memory::memory::{
172    HyperbolicConfig, HyperbolicEmbedding, batch_euclidean_to_poincare, euclidean_to_poincare,
173    hyperbolic_distance, mobius_add, mobius_scalar_mul,
174};
175pub use oxios_memory::{
176    AutoClassifier, AutoProtector, CompactionTree, CurationCandidate, CurationReport, DecayEngine,
177    EmbeddingCache, HistoricalPeriod, MemoryBudget, MemoryGraph, MemoryMapEntry, MemoryNeighbor,
178    RootEntry, RootIndex, SonaEngine, TopicEntry,
179};
180
181// ─── Memory core types (extracted to oxios-memory, RFC-018 b.1) ───
182// Re-exported here for back-compat — existing `use oxios_kernel::chunk_fixed;`
183// and friends continue to work without code changes.
184pub use oxios_memory::{
185    ChunkConfig, TextChunk, chunk_fixed, chunk_paragraphs, cosine_similarity_f32, l2_normalize_f32,
186    l2_normalize_f64,
187};
188
189// ─── SQLite Memory (RFC-012) ────────────────────────────────────────
190#[cfg(feature = "sqlite-memory")]
191pub use oxios_memory::memory::sqlite::SqliteMemoryStore;
192#[cfg(feature = "sqlite-memory")]
193pub use oxios_memory::memory::sqlite::cache::{self as sqlite_cache};
194#[cfg(feature = "sqlite-memory")]
195pub use oxios_memory::memory::sqlite::migration::{self as sqlite_migration, MigrationReport};
196#[cfg(feature = "sqlite-memory")]
197pub use oxios_memory::memory::sqlite::search::{
198    Bm25Hit, RankedMemory, VectorHit, reciprocal_rank_fusion,
199};
200#[cfg(feature = "sqlite-memory")]
201pub use oxios_memory::memory::sqlite::{MemoryDatabase, bytes_to_f32_slice, f32_slice_to_bytes};
202pub use persona::{Persona, PersonaManager, PersonaStore, default_personas};
203
204// ─── Tools & Skills ────────────────────────────────────────────────
205pub use skill::clawhub::{
206    ClawHubClient, ClawHubInstaller, ClawHubLockEntry, ClawHubLockfile, ClawHubOrigin,
207    ClawHubSearchResult, ClawHubSkillDetail, ClawHubSkillMeta, ClawHubVersion, DownloadedArchive,
208    InstallResult, UpdateAvailable, UpdateResult,
209};
210pub use skill::skills_sh::{
211    SkillsShAuditEntry, SkillsShAuditResponse, SkillsShClient, SkillsShFile, SkillsShInstallResult,
212    SkillsShInstaller, SkillsShOrigin, SkillsShSearchResponse, SkillsShSkill, SkillsShSkillDetail,
213};
214pub use skill::{
215    InstallKind, Requirements, RequirementsCheck, Skill, SkillConfig, SkillEntry, SkillFormat,
216    SkillInstallSpec, SkillInvocationPolicy, SkillManager, SkillMeta, SkillMetadata, SkillRef,
217    SkillSnapshot, SkillSource, SkillState, SkillStatus,
218};
219pub use tools::ToolMeta;
220pub use tools::tool_types::{ArgumentDef, ToolDef};
221pub use tools::{ExecTool, KnowledgeTool};
222#[cfg(feature = "wasm-sandbox")]
223pub use wasm_sandbox::{ResourceKind, WasmConfig, WasmError, WasmSandbox};
224// Token-maxing (RFC-031): self-tracker + QuotaTracker + maxer/planner/session.
225pub use kernel_handle::TokenMaxingApi;
226pub use token_maxing::{
227    Availability, CooldownRecord, ProviderBudget, ProviderSnapshot, ProviderState, QuotaTracker,
228    QuotaTrackerSnapshot, RecalibrationOutcome, RecalibrationRecord, ReserveError,
229    SUBSCRIPTION_BILLING_MODEL, TokenMaxingConfig, TokenMaxingProviderConfig,
230};
231pub use token_maxing::{
232    MaxerStatus, MaxingStart, MaxingWindow, PlannedTask, TokenMaxer, TokenMaxingSession,
233    WorkPlanner,
234};
235
236// ─── State & Config ─────────────────────────────────────────────────
237pub use backup::{BackupManifest, BackupSection};
238pub use config::{
239    BrowserConfig, ChannelsConfig, CronConfig, DaemonConfig, EmailConfig, EmbeddingConfig,
240    EngineConfig, ExecConfig, ExecMode, GitConfig, InlineCronJob, LoggingConfig, MarketplaceConfig,
241    McpConfig, McpServerDef, MemoryConfig, MountsConfig, OrchestratorConfig, OxiosConfig,
242    PersonaConfig, SkillsShConfig, SqliteMemoryConfig,
243};
244pub use git_layer::{
245    CommitContext, CommitDiff, CommitInfo, DiffKind, DiffStats, FileDiff, GitLayer, LogEntry,
246};
247pub use mount::{
248    DetectionResult as MountDetectionResult, Mount, MountId, MountMeta, MountSource,
249    PromotionConfig, detect_mounts,
250};
251#[cfg(feature = "sqlite-memory")]
252pub use mount::{MountManager, MountManagerError};
253pub use project::{
254    ConversationBuffer, ConversationTurn, DetectionResult, Project, ProjectId, ProjectSource,
255    detect_project, extract_path, find_by_id, find_by_name,
256};
257#[cfg(feature = "sqlite-memory")]
258pub use project::{ProjectManager, ProjectManagerError};
259pub use resource_monitor::{OverloadThreshold, ResourceMonitor, ResourceSnapshot};
260pub use state_store::{
261    AgentResponse, PruneConfig, PruneThrottle, Session, SessionId, SessionSummary, StateStore,
262};
263
264// ─── Infrastructure ─────────────────────────────────────────────────
265pub use engine::{EngineHandle, EngineProvider, OxiosEngine};
266pub use error::{HttpStatus, KernelError, KernelResult};
267pub use metrics::{get_metrics, register_builtin_metrics, registry};
268pub use observability::{
269    AuditEntry as SdkAuditEntry, AuditFilter, CostSnapshot, CostTracker, Span, SpanGuard, SpanKind,
270    TokenUsage, Tracer as SdkTracer, audit_log, cost_tracker, tracer,
271};
272pub use types::{AgentId, AgentInfo, AgentStatus, ToolCallRecord};
273
274// ─── API Surface ────────────────────────────────────────────────────
275pub use host_tools::{CredentialStatus, DetectedTool, ToolSource};
276pub use kernel_handle::KernelHandle;
277pub use kernel_handle::MarketplaceApi;
278pub use kernel_handle::{
279    A2aApi, AgentApi, CalendarApi, CopilotResponse, EmailApi, EngineApi, EngineConfigResponse,
280    ExecApi, ExtensionApi, FallbackEvent, HostToolsApi, InfraApi,
281    InputModality as EngineInputModality, KnowledgeContext, KnowledgeLens, KnowledgeNote, McpApi,
282    MemoryNote, ModelInfo, MountApi, MountInfo, PersonaApi, ProjectApi, ProjectInfo,
283    ProviderCategory, ProviderInfo, RoutingConfigSnapshot, RoutingStats, RoutingStatsSnapshot,
284    RoutingUpdate, SecurityApi, SharedExecConfig, StateApi, ValidateKeyResult,
285};
286pub use session_context::SessionContext;
287
288// ─── oxi-sdk re-exports ─────────────────────────────────────────────
289//
290// Removed: dead re-exports (#11). Consumers should depend on oxi-sdk
291// directly and use `oxi_sdk::` instead of going through oxios-kernel.