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