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 benchmark;
28pub mod context;
29pub mod governance;
30pub mod harness;
31pub mod lexical;
32pub mod memory;
33pub mod mm;
34pub mod orchestration;
35pub mod proc;
36pub mod runtime;
37pub mod scheduler;
38pub mod signals;
39pub mod syscall;
40pub mod types;
41
42// Re-export key types at crate root for convenience
43pub use governance::quota::ResourceQuota;
44pub use mm::{
45    EvictionOp, EvictionPlan, Handle, HandleId, HandleKind, HandleTable, MemoryTierHint,
46    PageInEntry, Residency, plan_eviction,
47};
48pub use proc::{AgentProcess, ProcessState};
49pub use runtime::session::SessionEvent;
50pub use runtime::{
51    CancellationReason, KERNEL_ABI_VERSION, KERNEL_SNAPSHOT_VERSION, KernelAction,
52    KernelEventCategory, KernelInput, KernelInputEvent, KernelObservation, KernelPreparationStatus,
53    KernelPreparedStep, KernelPressureAction, KernelRuntime, KernelSnapshotPolicy,
54    KernelSnapshot, KernelStep, OsSnapshot, Primitive, category_for_kind, primitive_for_kind,
55    rebuild_os_snapshot_from_events, reconstruct_messages_with_fallback,
56};
57pub use scheduler::entropy::{EntropySample, EntropyTracker, EntropyWatchConfig};
58pub use scheduler::tcb::{BudgetLedger, TaskId, TaskLifecycle, TaskTable, Tcb, WaitReason};
59pub use syscall::{Disposition, Syscall};
60pub use types::agent::{
61    AgentCapabilityFilter, AgentIdentity, AgentIsolation, AgentRole, AgentRunSpec,
62    ContextInheritance, IsolationManifest, LoopRoundSpec,
63};
64pub use types::capability::{
65    CapabilityCommand, CapabilityDescriptor, CapabilityKind, CapabilityLease, CapabilityManifest,
66};
67pub use types::contract::{AcceptanceCriterion, VerificationContract};
68pub use types::error::{DeepStrikeError, Result};
69pub use types::message::{Message, ToolCall, ToolResult};
70pub use types::milestone::{
71    MilestoneCheckResult, MilestoneContract, MilestonePhase, MilestoneRollbackPolicy,
72    MilestoneUnlockPolicy, MilestoneVerifier, RetryPolicy,
73};
74pub use types::signal::RuntimeSignal;
75pub use types::task::{RuntimeTask, TaskLane};