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 evolution;
30pub mod governance;
31pub mod harness;
32pub mod lexical;
33pub mod memory;
34pub mod mm;
35pub mod orchestration;
36pub mod proc;
37#[cfg(test)]
38mod projection_pairs;
39pub mod runtime;
40pub mod scheduler;
41pub mod signals;
42pub mod syscall;
43pub mod types;
44
45// Re-export key types at crate root for convenience
46pub use context::execution::{
47    CachePrefixBoundary, ContextCandidate, ContextContractError, ContextDispatchPreparation,
48    ContextDispatchRequest, ContextEntryRef, ContextEntrySource, ContextExecutionInput,
49    ContextPlan, ContextPlanAction, ContextPreparation, ContextPreparationRequest,
50    ContextPromptMeasurement, ContextSelection, ContextState, prepare_context_dispatch,
51    verify_context_dispatch,
52};
53pub use evolution::{
54    ActivationBinding, ArtifactKind, ArtifactManifest, ArtifactRef, ArtifactSet, ArtifactVersion,
55    ContentDigest, EvaluationContextBinding, EvaluationFact, EvaluationGate, EvaluationMetric,
56    EvaluationRun, EvolutionBundle, EvolutionProposal, EvolutionReport, EvolutionVerdict,
57    PromotionDecision, PromotionOutcome, validate_evolution, validate_evolution_json,
58};
59pub use governance::quota::ResourceQuota;
60pub use mm::{
61    EvictionOp, EvictionPlan, Handle, HandleId, HandleKind, HandleTable, MemoryTierHint,
62    PageInEntry, Residency, plan_eviction,
63};
64pub use proc::{AgentProcess, ProcessState};
65pub use runtime::kernel::wire::{
66    KernelEffect, KernelInput, KernelTerminal, KernelTransaction, PlannedStep, SyscallRequest,
67    WireEnvelope,
68};
69pub use runtime::session::SessionEvent;
70pub use runtime::{
71    KernelEventCategory, KernelObservation, KernelPressureAction, OsSnapshot, Primitive,
72    category_for_kind, primitive_for_kind, rebuild_os_snapshot_from_events,
73    reconstruct_messages_with_fallback,
74};
75pub use scheduler::cross_operation::{
76    CrossOperationMessage, CrossOperationRouter, CrossOperationRouterSnapshot, DeliveryFailure,
77    DeliverySettlement, DeliveryState, OperationAddress, OperationRegistration,
78    PayloadAvailability, PayloadLocator, RouteOutcome,
79};
80pub use scheduler::entropy::{EntropySample, EntropyTracker, EntropyWatchConfig};
81pub use scheduler::tcb::{BudgetLedger, TaskId, TaskLifecycle, TaskTable, Tcb};
82pub use syscall::{Disposition, Syscall};
83pub use types::agent::{
84    AgentCapabilityFilter, AgentIdentity, AgentIsolation, AgentRole, AgentRunSpec,
85    ContextInheritance, IsolationManifest, LoopRoundSpec,
86};
87pub use types::capability::{
88    CapabilityCommand, CapabilityDescriptor, CapabilityKind, CapabilityLease, CapabilityManifest,
89};
90pub use types::contract::{AcceptanceCriterion, VerificationContract};
91pub use types::error::{DeepStrikeError, Result};
92pub use types::message::{CoreMessage, ToolCall, ToolResult};
93pub use types::milestone::{
94    MilestoneCheckResult, MilestoneContract, MilestonePhase, MilestoneRollbackPolicy,
95    MilestoneUnlockPolicy, MilestoneVerifier, RetryPolicy,
96};
97pub use types::signal::RuntimeSignal;
98pub use types::task::{RuntimeTask, TaskLane};