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