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;
36#[cfg(test)]
37mod projection_pairs;
38pub mod runtime;
39pub mod scheduler;
40pub mod signals;
41pub mod syscall;
42pub mod types;
43
44// Re-export key types at crate root for convenience
45pub use governance::quota::ResourceQuota;
46pub use mm::{
47    EvictionOp, EvictionPlan, Handle, HandleId, HandleKind, HandleTable, MemoryTierHint,
48    PageInEntry, Residency, plan_eviction,
49};
50pub use proc::{AgentProcess, ProcessState};
51pub use runtime::kernel::wire::{
52    KernelEffect, KernelInput, KernelTerminal, KernelTransaction, PlannedStep, SyscallRequest,
53    WireEnvelope,
54};
55pub use runtime::session::SessionEvent;
56pub use runtime::{
57    KernelEventCategory, KernelObservation, KernelPressureAction, OsSnapshot, Primitive,
58    category_for_kind, primitive_for_kind, rebuild_os_snapshot_from_events,
59    reconstruct_messages_with_fallback,
60};
61pub use scheduler::cross_operation::{
62    CrossOperationMessage, CrossOperationRouter, CrossOperationRouterSnapshot, DeliveryFailure,
63    DeliverySettlement, DeliveryState, OperationAddress, OperationRegistration,
64    PayloadAvailability, PayloadLocator, RouteOutcome,
65};
66pub use scheduler::entropy::{EntropySample, EntropyTracker, EntropyWatchConfig};
67pub use scheduler::tcb::{BudgetLedger, TaskId, TaskLifecycle, TaskTable, Tcb};
68pub use syscall::{Disposition, Syscall};
69pub use types::agent::{
70    AgentCapabilityFilter, AgentIdentity, AgentIsolation, AgentRole, AgentRunSpec,
71    ContextInheritance, IsolationManifest, LoopRoundSpec,
72};
73pub use types::capability::{
74    CapabilityCommand, CapabilityDescriptor, CapabilityKind, CapabilityLease, CapabilityManifest,
75};
76pub use types::contract::{AcceptanceCriterion, VerificationContract};
77pub use types::error::{DeepStrikeError, Result};
78pub use types::message::{Message, ToolCall, ToolResult};
79pub use types::milestone::{
80    MilestoneCheckResult, MilestoneContract, MilestonePhase, MilestoneRollbackPolicy,
81    MilestoneUnlockPolicy, MilestoneVerifier, RetryPolicy,
82};
83pub use types::signal::RuntimeSignal;
84pub use types::task::{RuntimeTask, TaskLane};