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