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 context::renewal::{ContractCheckResult, HandoffArtifact};
42pub use context::snapshot::ContextSnapshotHint;
43pub use governance::tool_decision::{
44    ToolDecision, ToolDecisionContext, ToolDecisionPipeline, ToolDecisionStage,
45};
46pub use governance::sandbox::SandboxProfile;
47pub use governance::pipeline::SecurityPolicySnapshot;
48pub use governance::quota::ResourceQuota;
49pub use mm::{
50    plan_eviction, EvictionOp, EvictionPlan, Handle, HandleId, HandleKind, HandleTable,
51    MemoryTierHint, PageInEntry, PageInRequest, Residency,
52};
53pub use proc::{AgentProcess, ProcessState};
54pub use scheduler::tcb::{
55    BudgetLedger, BudgetSlice, ScheduleDecision, TaskId, TaskState, TaskTable, Tcb, WaitReason,
56};
57pub use syscall::{Disposition, Syscall};
58pub use runtime::session::SessionEvent;
59pub use runtime::{
60    category_for_kind, primitive_for_kind, reconstruct_messages_with_fallback,
61    rebuild_os_snapshot_from_events, session_log_has_required_categories, KernelEventCategory,
62    Primitive, KERNEL_ABI_VERSION, KERNEL_OBSERVATION_KINDS, KernelAction, KernelInput, OsSnapshot,
63    KernelInputEvent, KernelObservation, KernelPressureAction, KernelRuntime, KernelStep,
64};
65pub use types::agent::{
66    AgentCapabilityFilter, AgentIdentity, AgentIsolation, AgentRole, AgentRunSpec,
67    ContextInheritance, IsolationManifest,
68};
69pub use types::capability::{
70    CapabilityCommand, CapabilityDescriptor, CapabilityKind, CapabilityLease, CapabilityManifest,
71};
72pub use types::contract::{AcceptanceCriterion, VerificationContract};
73pub use types::error::{DeepStrikeError, Result};
74pub use types::message::{Message, ToolCall, ToolResult};
75pub use types::milestone::{
76    MilestoneCheckResult, MilestoneContract, MilestonePhase, MilestoneRollbackPolicy,
77    MilestoneUnlockPolicy, MilestoneVerifier, RetryPolicy,
78};
79pub use types::signal::RuntimeSignal;
80pub use types::task::{RuntimeTask, TaskLane};