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