Skip to main content

deepstrike_core/
lib.rs

1//! # DeepStrike Core
2//!
3//! Cross-language agent runtime kernel — pure computation, zero I/O.
4//!
5//! This crate provides the core state machines, data structures, and algorithms
6//! for the DeepStrike agent framework. It is designed to be embedded via FFI
7//! bindings (PyO3, napi-rs, wasm-bindgen) into any language runtime.
8//!
9//! ## Architecture
10//!
11//! ```text
12//! ┌─────────────┐  ┌─────────────┐  ┌─────────────┐
13//! │ Python SDK  │  │ Node.js SDK │  │  WASM SDK   │
14//! └──────┬──────┘  └──────┬──────┘  └──────┬──────┘
15//!        └────────┬───────┴────────┬───────┘
16//!                 │  deepstrike-core │
17//!                 └─────────────────┘
18//! ```
19//!
20//! ## Design Principles
21//!
22//! - **Pure computation**: No I/O, no async, no network calls
23//! - **State machine driven**: SDK feeds events, kernel returns actions
24//! - **Zero-copy where possible**: CompactString, borrowed slices
25//! - **Compile-time safety**: Ownership, Send+Sync, exhaustive matches
26
27pub mod context;
28pub mod governance;
29pub mod harness;
30pub mod memory;
31pub mod mm;
32pub mod orchestration;
33pub mod proc;
34pub mod runtime;
35pub mod scheduler;
36pub mod signals;
37pub mod syscall;
38pub mod types;
39
40// Re-export key types at crate root for convenience
41pub use governance::quota::ResourceQuota;
42pub use mm::{
43    plan_eviction, EvictionOp, EvictionPlan, Handle, HandleId, HandleKind, HandleTable,
44    MemoryTierHint, PageInEntry, Residency,
45};
46pub use proc::{AgentProcess, ProcessState};
47pub use scheduler::tcb::{BudgetLedger, TaskId, TaskLifecycle, TaskTable, Tcb, WaitReason};
48pub use syscall::{Disposition, Syscall};
49pub use runtime::session::SessionEvent;
50pub use runtime::{
51    category_for_kind, primitive_for_kind, reconstruct_messages_with_fallback,
52    rebuild_os_snapshot_from_events, KernelEventCategory,
53    Primitive, KERNEL_ABI_VERSION, KernelAction, KernelInput, OsSnapshot,
54    KernelInputEvent, KernelObservation, KernelPressureAction, KernelRuntime, KernelStep,
55};
56pub use types::agent::{
57    AgentCapabilityFilter, AgentIdentity, AgentIsolation, AgentRole, AgentRunSpec,
58    ContextInheritance, IsolationManifest, LoopRoundSpec,
59};
60pub use types::capability::{
61    CapabilityCommand, CapabilityDescriptor, CapabilityKind, CapabilityLease, CapabilityManifest,
62};
63pub use types::contract::{AcceptanceCriterion, VerificationContract};
64pub use types::error::{DeepStrikeError, Result};
65pub use types::message::{Message, ToolCall, ToolResult};
66pub use types::milestone::{
67    MilestoneCheckResult, MilestoneContract, MilestonePhase, MilestoneRollbackPolicy,
68    MilestoneUnlockPolicy, MilestoneVerifier, RetryPolicy,
69};
70pub use types::signal::RuntimeSignal;
71pub use types::task::{RuntimeTask, TaskLane};