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