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::kernel::wire::{
50    KernelEffect, KernelInput, KernelTerminal, KernelTransaction, PlannedStep, SyscallRequest,
51    WireEnvelope,
52};
53pub use runtime::session::SessionEvent;
54pub use runtime::{
55    KERNEL_ABI_VERSION, KernelEventCategory, KernelObservation, KernelPressureAction, OsSnapshot,
56    Primitive, category_for_kind, primitive_for_kind, rebuild_os_snapshot_from_events,
57    reconstruct_messages_with_fallback,
58};
59pub use scheduler::entropy::{EntropySample, EntropyTracker, EntropyWatchConfig};
60pub use scheduler::tcb::{BudgetLedger, TaskId, TaskLifecycle, TaskTable, Tcb, WaitReason};
61pub use syscall::{Disposition, Syscall};
62pub use types::agent::{
63    AgentCapabilityFilter, AgentIdentity, AgentIsolation, AgentRole, AgentRunSpec,
64    ContextInheritance, IsolationManifest, LoopRoundSpec,
65};
66pub use types::capability::{
67    CapabilityCommand, CapabilityDescriptor, CapabilityKind, CapabilityLease, CapabilityManifest,
68};
69pub use types::contract::{AcceptanceCriterion, VerificationContract};
70pub use types::error::{DeepStrikeError, Result};
71pub use types::message::{Message, ToolCall, ToolResult};
72pub use types::milestone::{
73    MilestoneCheckResult, MilestoneContract, MilestonePhase, MilestoneRollbackPolicy,
74    MilestoneUnlockPolicy, MilestoneVerifier, RetryPolicy,
75};
76pub use types::signal::RuntimeSignal;
77pub use types::task::{RuntimeTask, TaskLane};