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