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