Skip to main content

clawft_kernel/
lib.rs

1//! WeftOS kernel layer for clawft.
2//!
3//! This crate provides the kernel abstraction layer that sits between
4//! the CLI/API surface and `clawft-core`. It introduces:
5//!
6//! - **Boot sequence** ([`boot::Kernel`]) -- lifecycle management
7//!   wrapping `AppContext` with structured startup/shutdown.
8//! - **Process table** ([`process::ProcessTable`]) -- PID-based
9//!   agent tracking with state machine transitions.
10//! - **Service registry** ([`service::ServiceRegistry`]) -- named
11//!   service lifecycle with health checks.
12//! - **IPC** ([`ipc::KernelIpc`]) -- typed message envelopes over
13//!   the existing `MessageBus`.
14//! - **Capabilities** ([`capability::AgentCapabilities`]) -- permission
15//!   model for agent processes.
16//! - **Health monitoring** ([`health::HealthSystem`]) -- aggregated
17//!   health checks across all services.
18//! - **Console** ([`console`]) -- boot event types and output
19//!   formatting for the interactive kernel terminal.
20//! - **Configuration** ([`config::KernelConfig`]) -- kernel-specific
21//!   settings embedded in the root config.
22//! - **Containers** ([`container::ContainerManager`]) -- sidecar
23//!   container lifecycle and health integration.
24//! - **Applications** ([`app::AppManager`]) -- application manifest
25//!   parsing, validation, and lifecycle state machine.
26//! - **Cluster** ([`cluster::ClusterMembership`]) -- multi-node
27//!   cluster membership, peer tracking, and health.
28//! - **Environments** ([`environment::EnvironmentManager`]) --
29//!   governance-scoped dev/staging/prod environments.
30//! - **Governance** ([`governance::GovernanceEngine`]) -- three-branch
31//!   constitutional governance with effect algebra scoring.
32//! - **Agency** ([`agency::Agency`]) -- agent-first architecture
33//!   with roles, spawn permissions, and agent manifests.
34//!
35//! # Feature Flags
36//!
37//! - `native` (default) -- enables tokio runtime, native file I/O.
38//! - `mesh` (default) -- mesh transport, framing, IPC (JSON KernelMessage).
39//! - `mesh-rvf` -- experimental RVF IPC encoding API surface (ADR-031 /
40//!   WEFT-683); encode/decode currently return `UnsupportedEncoding`.
41//! - `wasm-sandbox` -- enables WASM tool runner (Phase K3).
42//! - `containers` -- enables container manager (Phase K4).
43//! - `ecc` -- enables ECC cognitive substrate (Phase K3c).
44//!
45//! ## Crate Ecosystem
46//!
47//! WeftOS is built from these crates:
48//!
49//! | Crate | Role |
50//! |-------|------|
51//! | [`weftos`](https://crates.io/crates/weftos) | Product facade -- re-exports kernel, core, types |
52//! | [`clawft-kernel`](https://crates.io/crates/clawft-kernel) | Kernel: processes, services, governance, mesh, ExoChain |
53//! | [`clawft-core`](https://crates.io/crates/clawft-core) | Agent framework: pipeline, context, tools, skills |
54//! | [`clawft-types`](https://crates.io/crates/clawft-types) | Shared type definitions |
55//! | [`clawft-platform`](https://crates.io/crates/clawft-platform) | Platform abstraction (native/WASM/browser) |
56//! | [`clawft-plugin`](https://crates.io/crates/clawft-plugin) | Plugin SDK for tools, channels, and extensions |
57//! | [`clawft-llm`](https://crates.io/crates/clawft-llm) | LLM provider abstraction (11 providers + local) |
58//! | [`exo-resource-tree`](https://crates.io/crates/exo-resource-tree) | Hierarchical resource namespace with Merkle integrity |
59//!
60//! Source: <https://github.com/weave-logic-ai/weftos>
61
62// `test-support` exposes a process-wide child-root override for integration
63// tests; it must never reach a release build.
64#[cfg(all(feature = "test-support", not(debug_assertions)))]
65compile_error!("clawft-kernel: the `test-support` feature is for debug test builds only");
66
67// WEFT-504: `ecc` pulls native-only deps (blake3, clawft-core/vector-memory,
68// clawft-bvh). Browser / pure wasm32-unknown-unknown consumers must build
69// with `--no-default-features` (mesh + ecc off). `scripts/build.sh browser`
70// never enables ecc; `scripts/build.sh check|gate` assert the rejection.
71#[cfg(all(
72    feature = "ecc",
73    target_arch = "wasm32",
74    target_os = "unknown"
75))]
76compile_error!(
77    "feature \"ecc\" is not supported on wasm32-unknown-unknown (WEFT-504); \
78     use --no-default-features for kernel WASM checks, or scripts/build.sh browser \
79     (clawft-wasm never enables ecc)"
80);
81
82// ── ECC cognitive substrate modules (K3c) ────────────────────────
83#[cfg(feature = "ecc")]
84pub mod artifact_store;
85// mesh-placement-07: signed workload package manifests (ADR-100 section 1).
86#[cfg(all(feature = "ecc", feature = "exochain"))]
87pub mod workload_pkg;
88// P2-B: workload-kind registry (cog-boundary audit M3).
89#[cfg(all(feature = "ecc", feature = "exochain"))]
90pub mod workload_kind;
91// mesh-placement-17: model manifest, adopt-in-place and weights locality (ADR-101 section 3).
92#[cfg(all(feature = "ecc", feature = "exochain", feature = "native"))]
93pub mod model_manifest;
94// mesh-placement-09: WorkloadRuntime adapters (native, container, Seed API).
95#[cfg(all(feature = "workload-runtime", unix))]
96pub mod workload_runtime;
97// mesh-placement-19: stable inference address, loopback proxy, mesh forwarding.
98#[cfg(all(feature = "workload-runtime", feature = "mesh", unix))]
99pub mod infer_proxy;
100// mesh-placement-10: cog ingest bridge and store forwarding.
101#[cfg(all(feature = "workload-runtime", feature = "mesh", unix))]
102pub mod cog_ingest;
103// mesh-placement-12: placement control plane and the workload-host service.
104#[cfg(all(feature = "workload-runtime", feature = "mesh", unix))]
105pub mod workload_ctl;
106#[cfg(feature = "ecc")]
107pub mod calibration;
108#[cfg(feature = "ecc")]
109pub mod causal;
110#[cfg(feature = "ecc")]
111pub mod causal_predict;
112#[cfg(feature = "ecc")]
113pub mod ecc_segment;
114#[cfg(feature = "ecc")]
115pub mod lewm_invariant;
116#[cfg(feature = "ecc")]
117pub mod cognitive_tick;
118#[cfg(feature = "ecc")]
119pub mod coherence;
120#[cfg(feature = "ecc")]
121pub mod context_graft;
122#[cfg(feature = "ecc")]
123pub mod context_promote;
124#[cfg(feature = "ecc")]
125pub mod crossref;
126#[cfg(feature = "ecc")]
127pub mod democritus;
128#[cfg(feature = "ecc")]
129pub mod duplex;
130#[cfg(feature = "ecc")]
131pub mod thin_edge;
132#[cfg(all(feature = "ecc", feature = "exochain"))]
133pub mod causal_state_fold;
134#[cfg(feature = "ecc")]
135pub mod embedding;
136#[cfg(feature = "ecc")]
137pub mod embedding_e5;
138#[cfg(feature = "ecc")]
139pub mod embedding_onnx;
140#[cfg(feature = "ecc")]
141pub mod embedding_qwen3;
142#[cfg(feature = "ecc")]
143pub mod eml_coherence;
144#[cfg(feature = "ecc")]
145pub mod eml_kernel;
146#[cfg(feature = "ecc")]
147pub mod eml_persistence;
148#[cfg(feature = "ecc")]
149pub mod floor;
150#[cfg(feature = "ecc")]
151pub mod hnsw_eml;
152#[cfg(feature = "ecc")]
153pub mod hnsw_service;
154#[cfg(feature = "ecc")]
155pub mod impulse;
156#[cfg(feature = "ecc")]
157pub mod persistence;
158#[cfg(feature = "ecc")]
159pub mod profile_store;
160#[cfg(feature = "ecc")]
161pub mod quantum_backend;
162#[cfg(all(feature = "ecc", feature = "quantum-braket"))]
163pub mod quantum_braket;
164#[cfg(all(feature = "ecc", feature = "quantum-pasqal"))]
165pub mod quantum_pasqal;
166#[cfg(feature = "ecc")]
167pub mod quantum_register;
168#[cfg(feature = "ecc")]
169pub mod quantum_state;
170#[cfg(feature = "ecc")]
171pub mod talk_loop;
172#[cfg(feature = "ecc")]
173pub mod vector_backend;
174#[cfg(feature = "ecc")]
175pub mod vector_diskann;
176#[cfg(feature = "ecc")]
177pub mod vector_hnsw;
178#[cfg(feature = "ecc")]
179pub mod vector_hybrid;
180#[cfg(feature = "ecc")]
181pub mod vector_quantization;
182#[cfg(feature = "ecc")]
183pub mod spatial_backend;
184#[cfg(feature = "ecc")]
185pub mod spatial_bvh;
186#[cfg(feature = "ecc")]
187pub mod spatial_service;
188#[cfg(feature = "ecc")]
189pub mod view_resolver;
190#[cfg(feature = "ecc")]
191pub mod weaver;
192
193#[cfg(feature = "sensor")]
194pub mod sensor_graph;
195
196#[cfg(feature = "native")]
197pub mod a2a;
198pub mod agency;
199#[cfg(feature = "native")]
200pub mod agent_loop;
201#[cfg(feature = "native")]
202pub mod agent_registry;
203pub mod app;
204pub mod assessment;
205pub mod boot;
206pub mod capability;
207/// Cross-node signed capability advertisements (WEFT-147).
208pub mod capability_claim;
209#[cfg(feature = "exochain")]
210pub mod chain;
211#[cfg(feature = "exochain")]
212pub mod chain_anchor;
213#[cfg(feature = "exochain")]
214pub mod chain_rule_hash;
215/// Project governance overlay, kernel side: load, merge, hash (ADR-103 D8).
216#[cfg(feature = "exochain")]
217pub mod governance_overlay;
218/// A project kernel's live governance: boot, reload, parent updates.
219#[cfg(feature = "exochain")]
220pub mod overlay_runtime;
221/// Trust root, rollback pin and revocation checks of a project kernel.
222#[cfg(feature = "exochain")]
223pub mod overlay_trust;
224/// The signed parent policy the user daemon exports (ADR-103 D8).
225#[cfg(feature = "exochain")]
226pub mod parent_policy;
227#[cfg(feature = "exochain")]
228pub mod chain_subscribe;
229#[cfg(all(test, feature = "exochain"))]
230mod chain_hash_tests;
231#[cfg(all(test, feature = "exochain"))]
232mod governance_overlay_tests;
233#[cfg(all(test, feature = "exochain"))]
234mod governance_overlay_prop_tests;
235#[cfg(all(test, feature = "exochain"))]
236mod overlay_runtime_tests;
237#[cfg(all(test, feature = "exochain"))]
238mod overlay_swap_tests;
239#[cfg(all(test, feature = "exochain"))]
240mod overlay_trust_tests;
241#[cfg(all(test, feature = "exochain"))]
242mod overlay_boot_tests;
243#[cfg(feature = "exochain")]
244pub mod chain_migrate;
245pub mod chain_storage;
246#[cfg(feature = "exochain")]
247pub mod token_authority;
248#[cfg(all(feature = "exochain", feature = "native"))]
249pub mod project_identity;
250#[cfg(all(feature = "exochain", feature = "native"))]
251pub mod user_key_rotation;
252// S10 key rotation needs Clock (mesh) + ChainManager (exochain). WEFT-107.
253#[cfg(all(feature = "exochain", feature = "mesh"))]
254pub mod key_rotation;
255pub mod cluster;
256pub mod config;
257pub mod console;
258pub mod container;
259pub mod cron;
260pub mod environment;
261pub mod error;
262#[cfg(feature = "exochain")]
263pub mod gate;
264pub mod governance;
265pub mod governance_project;
266pub mod rule_distribution;
267#[cfg(all(feature = "ecc", feature = "exochain"))]
268pub mod placement_vocabulary;
269pub mod health;
270pub mod heartbeat;
271pub mod ipc;
272/// The one node-id derivation (ADR-103 D11).
273pub mod node_id;
274/// File-backed node key shared by the daemon and one-shot foreground boots.
275#[cfg(any(feature = "mesh", feature = "exochain"))]
276pub mod node_key;
277#[cfg(feature = "native")]
278pub mod node_registry;
279/// Node facts probes and TTL cache (ADR-099 section 2, card mesh-placement-03).
280#[cfg(feature = "native")]
281pub mod node_facts;
282/// Signed node facts, beside `capability_claim` (card mesh-placement-03).
283#[cfg(all(feature = "native", any(feature = "mesh", feature = "exochain")))]
284pub mod node_facts_advert;
285/// Node facts and deltas over the mesh with receiver-assigned trust (card mesh-placement-03).
286#[cfg(all(feature = "native", feature = "mesh"))]
287pub mod node_facts_exchange;
288pub mod process;
289pub mod rate_limit;
290pub mod revocation;
291/// Governance actions, audit events and permits for placed workloads (ADR-099).
292#[cfg(feature = "exochain")]
293pub mod workload_governance;
294/// Bound on chain writes caused by unauthenticated requests.
295pub mod refusal_budget;
296pub mod service;
297#[cfg(all(feature = "native", feature = "exochain"))]
298pub mod stream_anchor;
299#[cfg(feature = "native")]
300pub mod substrate_service;
301pub mod supervisor;
302pub mod topic;
303#[cfg(feature = "exochain")]
304pub mod tree_manager;
305
306// ── Self-healing & process management modules (08a) ─────────────
307#[cfg(feature = "os-patterns")]
308pub mod monitor;
309#[cfg(feature = "os-patterns")]
310pub mod reconciler;
311#[allow(clippy::new_without_default)]
312pub mod wasm_runner;
313
314// ── Reliable IPC & observability modules (08b) ──────────────────
315#[cfg(feature = "os-patterns")]
316pub mod dead_letter;
317#[cfg(feature = "os-patterns")]
318pub mod log_service;
319#[cfg(feature = "os-patterns")]
320pub mod metrics;
321#[cfg(feature = "os-patterns")]
322pub mod named_pipe;
323#[cfg(feature = "os-patterns")]
324pub mod reliable_queue;
325#[cfg(feature = "os-patterns")]
326pub mod timer;
327
328// ── Content integrity & operational services (08c) ───────────────
329pub mod auth_service;
330pub mod config_service;
331#[cfg(feature = "http-api")]
332pub mod http_api;
333/// Transport-agnostic REST + SSE facade types (WEFT-122 / Cognitum gaps #6–#8).
334///
335/// Bound by `clawft-services` axum handlers; not a standalone server.
336#[cfg(feature = "http-api")]
337pub mod http_facade;
338pub mod tree_view;
339
340// ── Mesh networking modules (K6) ──────────────────────────────
341// WEFT-151: mesh_bootstrap / mesh_dedup / mesh_listener / mesh_log are
342// unit-tested library orphans (no boot/daemon/CLI callers). See each
343// module's "Status (WEFT-151 audit)" docs for wiring schedule. Do not
344// hard-delete; do not apply #[deprecated] under clippy -D warnings.
345#[cfg(feature = "mesh")]
346pub mod mesh;
347#[cfg(feature = "mesh")]
348pub mod mesh_clock;
349// mesh-placement-11: swarm-ready artifact piece protocol (ADR-099 section 6).
350#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
351pub mod mesh_artifact;
352#[cfg(all(test, feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
353mod mesh_artifact_large_tests;
354#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
355pub mod mesh_artifact_peers;
356#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
357pub mod mesh_artifact_pkg;
358#[cfg(all(test, feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
359mod mesh_artifact_tests;
360#[cfg(all(test, feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
361mod mesh_artifact_rogue_tests;
362#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
363pub mod mesh_artifact_transfer;
364#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
365pub mod mesh_artifact_types;
366#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
367pub mod mesh_artifact_wire;
368// mesh-placement-25: swarm distribution (multi-source fetch, seeding, cache, bans, revocation).
369#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
370pub mod mesh_swarm_cache;
371#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
372pub mod mesh_swarm_fetch;
373#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
374pub mod mesh_swarm_governance;
375#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
376pub mod mesh_swarm_lookup;
377#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
378pub mod mesh_swarm_pkg;
379#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
380pub mod mesh_swarm_picker;
381#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
382pub mod mesh_swarm_rate;
383#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
384pub mod mesh_swarm_revoke;
385#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
386pub mod mesh_swarm_state;
387// ADR-106 phase 1a: Seed licence proxy, member side (checkout grants, approvals, policy).
388#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
389pub mod licence;
390// ADR-106 phase 1c: artifact streams and the checkout relay over machine-mesh deliveries.
391#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
392pub mod mesh_artifact_tunnel;
393#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
394pub mod mesh_cog;
395#[cfg(all(test, feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
396mod mesh_swarm_tests;
397#[cfg(feature = "mesh")]
398pub mod mesh_admit;
399#[cfg(feature = "mesh")]
400pub mod mesh_admit_gate;
401#[cfg(feature = "mesh")]
402pub mod mesh_assess;
403#[cfg(feature = "mesh")]
404pub mod mesh_bootstrap;
405#[cfg(feature = "mesh")]
406pub mod mesh_chain;
407#[cfg(feature = "mesh")]
408pub mod mesh_dedup;
409#[cfg(feature = "mesh")]
410pub mod mesh_delivery;
411#[cfg(feature = "mesh")]
412pub mod mesh_discovery;
413#[cfg(feature = "mesh")]
414pub mod mesh_framing;
415#[cfg(feature = "mesh")]
416pub mod mesh_heartbeat;
417#[cfg(feature = "mesh")]
418pub mod mesh_liveness;
419#[cfg(feature = "mesh")]
420pub mod mesh_load;
421#[cfg(feature = "mesh")]
422pub mod mesh_ipc;
423#[cfg(feature = "mesh")]
424pub mod mesh_kad;
425#[cfg(feature = "mesh")]
426pub mod mesh_limits;
427#[cfg(feature = "mesh")]
428pub mod mesh_listener;
429#[cfg(feature = "mesh")]
430pub mod mesh_log;
431#[cfg(feature = "mesh")]
432pub mod mesh_mdns;
433#[cfg(feature = "mesh")]
434pub mod mesh_mode;
435#[cfg(feature = "mesh")]
436pub mod mesh_noise;
437#[cfg(feature = "mesh")]
438pub mod mesh_process;
439#[cfg(feature = "mesh")]
440pub mod mesh_runtime;
441#[cfg(feature = "mesh")]
442pub mod mesh_leaf;
443#[cfg(feature = "mesh")]
444pub mod mesh_sensor;
445#[cfg(feature = "mesh")]
446pub mod mesh_serve;
447#[cfg(feature = "mesh")]
448pub mod mesh_service;
449#[cfg(feature = "mesh")]
450pub mod mesh_service_adv;
451#[cfg(feature = "mesh")]
452pub mod mesh_system_service;
453#[cfg(feature = "mesh")]
454pub mod mesh_tcp;
455/// Multi-node mesh test fixtures (WEFT-112). Available outside `cfg(test)` so
456/// downstream crates and integration tests can construct in-memory meshes.
457#[cfg(feature = "mesh")]
458pub mod mesh_test_support;
459#[cfg(feature = "mesh")]
460pub mod mesh_tree;
461#[cfg(feature = "mesh")]
462pub mod mesh_ws;
463/// QUIC transport via quinn (WEFT-118 / ADR-026). Feature-gated `quic`.
464#[cfg(all(feature = "mesh", feature = "quic"))]
465pub mod mesh_quic;
466
467// Re-export key types at the crate level for convenience.
468#[cfg(feature = "native")]
469pub use a2a::A2ARouter;
470pub use agency::{
471    Agency, AgentHealth, AgentInterface, AgentManifest, AgentPriority, AgentResources,
472    AgentRestartPolicy, AgentRole, InterfaceProtocol, ResponseMode,
473};
474#[cfg(feature = "native")]
475pub use agent_registry::{
476    AgentRegistry, RegisteredAgent, publish_payload, register_payload, subscribe_payload,
477};
478pub use app::{
479    AgentSpec, AppCapabilities, AppError, AppHooks, AppManager, AppManifest, AppState, AppsFile,
480    InstalledApp, ServiceSpec, ToolSource, ToolSpec,
481};
482#[cfg(feature = "ecc")]
483pub use artifact_store::{ArtifactBackend, ArtifactStore, ArtifactType, StoredArtifact};
484pub use assessment::{
485    AnalysisContext, Analyzer, AnalyzerRegistry, AssessmentDiff, AssessmentReport,
486    AssessmentService, AssessmentSummary, ComparisonReport, Finding,
487    PeerInfo as AssessmentPeerInfo,
488};
489#[cfg(feature = "os-patterns")]
490pub use auth_service::{
491    AuditEntry, AuthService, AuthToken, CredentialGrant, CredentialRequest, CredentialType,
492    HashedCredential, IssuedToken, StoredCredential as AuthStoredCredential,
493};
494pub use boot::{Kernel, KernelState};
495#[cfg(feature = "ecc")]
496pub use calibration::{EccCalibration, EccCalibrationConfig};
497pub use capability::{
498    AgentCapabilities, CapabilityChecker, CapabilityElevationRequest, ElevationResult, IpcScope,
499    ResourceLimits, ResourceType, SandboxPolicy, ToolPermissions,
500};
501pub use capability_claim::{
502    CAPABILITY_ALLOWLIST, CapabilityClaim, CapabilityClaimError, SignedCapabilityAdvertisement,
503    validate_capabilities, validate_capability,
504};
505#[cfg(any(feature = "mesh", feature = "exochain"))]
506pub use capability_claim::{apply_verified_capabilities, sign_claim, verify_signed_advertisement};
507#[cfg(feature = "ecc")]
508pub use causal::{
509    CausalEdge, CausalEdgeType, CausalGraph, CausalNode, ChangeEvent, ChangePrediction,
510    CouplingPair, SPECTRAL_EML_MIN_NODES, SPECTRAL_RFF_MIN_NODES, SpectralMethod, SpectralResult,
511    select_spectral_method,
512};
513#[cfg(feature = "ecc")]
514pub use ecc_segment::{
515    CalibrationProfileSegment, EccSegment, EccSegmentCodec, EccSegmentError, EccSegmentType,
516    SpectralCheckpoint, decode_ecc_segment, encode_ecc_segment, segment_from_wire, segment_to_wire,
517};
518#[cfg(feature = "ecc")]
519pub use lewm_invariant::{
520    DecouplingRule, InvariantCheck, WmWriteKind, WorldModelFacade, check_wm_write,
521    local_ecc_sufficient_without_wm,
522};
523#[cfg(feature = "ecc")]
524pub use causal_predict::{
525    CausalCollapseModel, CausalRankRequest, CausalRankResponse, CoherenceTracker, CollapseFeatures,
526    ConversationState, EvidenceRanking, detect_conversation_cycle, predict_delta_lambda2,
527    rank_evidence_by_impact,
528};
529#[cfg(feature = "exochain")]
530pub use chain::{
531    AnchorReceipt, AppendSignedError, ChainAnchor, ChainCheckpoint, ChainEvent, ChainLoggable,
532    ChainManager, ChainStatus, ChainVerifyResult, CustodyAttestation, GovernanceDecisionEvent,
533    IpcDeadLetterEvent, MockAnchor, RestartEvent,
534};
535#[cfg(all(feature = "exochain", feature = "mesh"))]
536pub use key_rotation::{
537    DEFAULT_GRACE_PERIOD_SECS, KIND_KEY_ROTATION, SOURCE_IDENTITY, KeyRotationError,
538    KeyRotationPayload, KeyRotationVerifier, build_key_rotation_payload, format_rotation_summary,
539    rotate_chain_signing_key, rotate_chain_signing_key_now, verify_key_rotation_event,
540    verify_key_rotation_payload,
541};
542#[cfg(feature = "exochain")]
543pub use chain_anchor::{
544    AnchorFrequencyPolicy, AnchoringController, ExternalIntentEntry, ExternalLedgerAnchor,
545    FileLedgerAnchor, FileLedgerEntry,
546};
547pub use clawft_types::config::{
548    ClusterNetworkConfig, KernelConfig, PairingConfig, ProfilesConfig,
549    VectorBackendKind as VectorBackendKindConfig, VectorConfig, VectorDiskAnnConfig,
550    VectorEvictionPolicy, VectorHnswConfig, VectorHybridConfig,
551};
552#[cfg(feature = "cluster")]
553pub use cluster::ClusterService;
554#[cfg(feature = "ecc")]
555pub use cluster::NodeEccCapability;
556#[cfg(any(feature = "mesh", feature = "exochain"))]
557pub use cluster::NodeIdentity;
558pub use cluster::{
559    ClusterConfig, ClusterError, ClusterMembership, NodeId, NodePlatform, NodeState, PairedHost,
560    PairedHostsFile, PairingGate, PairingWindowResult, PeerNode,
561};
562#[cfg(feature = "ecc")]
563pub use cognitive_tick::{CognitiveTick, CognitiveTickConfig, CognitiveTickStats};
564#[cfg(feature = "ecc")]
565pub use coherence::{
566    CoherenceBand, CoherenceDampener, CoherenceSignals, DAMPEN_FACTOR, compute_coherence,
567};
568pub use config::KernelConfigExt;
569#[cfg(feature = "os-patterns")]
570pub use config_service::{ConfigChange, ConfigEntry, ConfigService, ConfigValue, SecretRef};
571pub use console::{BootEvent, BootLog, BootPhase, KernelEventLog, LogLevel};
572pub use container::{
573    ContainerConfig, ContainerError, ContainerManager, ContainerService, ContainerState,
574    ManagedContainer, PortMapping, RestartPolicy, VolumeMount,
575};
576pub use cron::{CronError, CronService};
577#[cfg(feature = "ecc")]
578pub use crossref::{CrossRef, CrossRefStore, CrossRefType, StructureTag, UniversalNodeId};
579#[cfg(feature = "ecc")]
580pub use democritus::{DemocritusConfig, DemocritusLoop, DemocritusTickResult};
581#[cfg(feature = "ecc")]
582pub use embedding::{
583    EmbeddingError, EmbeddingProvider, LlmEmbeddingConfig, LlmEmbeddingProvider,
584    MockEmbeddingProvider, select_embedding_provider,
585};
586#[cfg(feature = "ecc")]
587pub use embedding_e5::{
588    E5EmbeddingProvider, E5_DIMS, E5_MAX_TOKENS, E5_MODEL_NAME, PASSAGE_PREFIX, QUERY_PREFIX,
589};
590#[cfg(feature = "ecc")]
591pub use embedding_onnx::{
592    AstEmbeddingProvider, OnnxEmbeddingProvider, RustCodeFeatures, SentenceTransformerProvider,
593    extract_rust_features, preprocess_markdown, split_sentences,
594};
595pub use environment::{
596    AuditLevel, Environment, EnvironmentClass, EnvironmentError, EnvironmentManager,
597    GovernanceBranches, GovernanceScope, LearningMode,
598};
599#[cfg(feature = "ecc")]
600pub use duplex::{
601    DuplexChannel, DuplexImpulse, DuplexState, EdgeCommand, FloorVerdict, MediaPayload, PayloadKind,
602    StreamObservation,
603};
604#[cfg(feature = "ecc")]
605pub use thin_edge::{
606    ControlMessage, EdgeReflexShadow, EdgeState, LocalhostDuplexSession, MediaFrame, ObserveOutcome,
607    ThinEdge,
608};
609#[cfg(all(feature = "ecc", feature = "exochain"))]
610pub use causal_state_fold::{
611    NodeStateTransition, fold_node_states, fold_node_states_from_chain, fold_node_states_until,
612};
613pub use error::{KernelError, KernelResult};
614#[cfg(feature = "ecc")]
615pub use floor::{
616    ContentReadiness, ERL_BARGE_FLOOR, ERL_BARGE_HYSTERESIS, ErlBargeConfig, ErlBargeGate,
617    FloorCandidate, FloorDecision, FloorState, UrgencySignals, compute_urgency, contending_count,
618    crowd_density, erl_admits_barge, erl_admits_barge_opt, evaluate_floor, floor_verdict_from_erl,
619    floor_verdict_from_erl_config,
620};
621#[cfg(feature = "exochain")]
622pub use gate::{CapabilityGate, GateBackend, GateDecision, GovernanceGate};
623pub use governance::{
624    EffectVector, GateEffectKind, GatePrincipal, GovernanceBranch, GovernanceDecision,
625    GovernanceEngine, GovernanceRequest, GovernanceResult, GovernanceRule, GovernanceRuleType,
626    RuleSeverity, selector_matches, with_effect_context,
627};
628pub use rule_distribution::{
629    EscalationOutcome, EscalationRecord, RuleDistribution, RuleGossipEnvelope, VersionedRule,
630};
631pub use health::{HealthStatus, HealthSystem, OverallHealth};
632#[cfg(feature = "os-patterns")]
633pub use health::{ProbeConfig, ProbeResult, ProbeState};
634#[cfg(feature = "ecc")]
635pub use hnsw_eml::{
636    ArmMetrics, DistanceTrainingPoint, EfPrediction, EfStrategy, EfTrainingPoint,
637    HnswBenchmarkParams, HnswEmlBenchmark, HnswEmlConfig, HnswEmlManager, HnswEmlStatus,
638    HnswScalingPoint, PathPredictBenchmark, PathPrediction, PathTrainingPoint, ProbeReport,
639    RebuildPrediction, RebuildTrainingPoint, SearchStrategy, SpectrumForm, TriageRecord,
640    probe_corpus, run_hnsw_benchmark, run_hnsw_benchmark_with, run_path_predict_benchmark,
641    triage_strategy,
642};
643#[cfg(feature = "ecc")]
644pub use hnsw_service::{
645    HnswSearchResult, HnswService, HnswServiceConfig, MultiKey, MultiKeyConfig,
646    RELATIONSHIP_HNSW_PREFIX, entity_search_keys, relationship_hnsw_id, relationship_search_keys,
647};
648#[cfg(feature = "ecc")]
649pub use impulse::{ImpulseQueue, ImpulseType};
650pub use ipc::{
651    CompositePid, ExitReason as SignalExitReason, GlobalPid, KernelIpc, KernelMessage, KernelSignal,
652    MeshNodeId, MessagePayload, MessageTarget, ProcessDown as SignalProcessDown,
653};
654#[cfg(feature = "mesh")]
655pub use mesh::{
656    MAX_MESSAGE_SIZE, MeshError, MeshPeer, MeshStream, MeshTransport, TransportListener,
657    WeftHandshake,
658};
659#[cfg(feature = "mesh")]
660pub use mesh_clock::{Clock, MockClock, MonoTime, RealClock};
661#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
662pub use mesh_artifact::{ArtifactExchange, ExchangeConfig, ExchangeError};
663#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
664pub use mesh_artifact_pkg::{ExchangedPackage, PackageExchangeError};
665#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
666pub use mesh_artifact_transfer::{
667    FetchError, FetchOutcome, PeerLink, PeerSet, PieceScheduler, SequentialScheduler, ServeStats,
668};
669#[cfg(all(feature = "mesh", feature = "ecc", feature = "exochain", feature = "native"))]
670pub use mesh_artifact_wire::{
671    ArtifactDescriptor, ArtifactId, ArtifactKey, ArtifactMsg, Bitfield, WireError,
672};
673#[cfg(feature = "mesh")]
674pub use mesh_assess::{AssessmentEnvelope, AssessmentTransport};
675#[cfg(feature = "mesh")]
676pub use mesh_bootstrap::{BootstrapDiscovery, PeerExchangeDiscovery};
677#[cfg(feature = "mesh")]
678pub use mesh_chain::{
679    ChainBridgeEvent, ChainForkStatus, ChainSyncRequest, ChainSyncResponse, SyncStateDigest,
680};
681#[cfg(feature = "mesh")]
682pub use mesh_dedup::DedupFilter;
683#[cfg(feature = "mesh")]
684pub use mesh_discovery::{
685    DiscoveredPeer, DiscoveryBackend, DiscoveryCoordinator, DiscoveryError, DiscoverySource,
686    MeshPeerEvent, MeshPeerEventBus,
687};
688#[cfg(feature = "mesh")]
689pub use mesh_framing::{Frame, FrameType, MeshFrame, MsgType};
690#[cfg(feature = "mesh")]
691pub use mesh_heartbeat::{
692    HeartbeatConfig, HeartbeatState, HeartbeatTracker, PeerHeartbeat, PingRequest, PingResponse,
693};
694#[cfg(feature = "mesh")]
695pub use mesh_ipc::{MeshIpcEnvelope, MeshIpcError, Scope as MeshScope};
696#[cfg(feature = "mesh")]
697pub use mesh_delivery::LocalDelivery;
698#[cfg(feature = "mesh")]
699pub use mesh_mode::MeshMode;
700#[cfg(feature = "mesh")]
701pub use mesh_kad::{
702    ALPHA, DhtEntry, DhtKey, K_BUCKET_SIZE, KEY_BITS, KademliaDiscovery, KademliaTable,
703    NamespacedDhtKey, bucket_index, leading_zeros, xor_distance,
704};
705#[cfg(feature = "mesh")]
706pub use mesh_listener::{JoinRequest, JoinResponse, MeshConnectionPool, PeerInfo};
707#[cfg(feature = "mesh")]
708pub use mesh_log::{LogAggregator, LogQuery as MeshLogQuery, RemoteLogEntry};
709#[cfg(feature = "mesh")]
710pub use mesh_mdns::{MdnsAnnouncement, MdnsDiscovery, WEFTOS_SERVICE_NAME};
711#[cfg(feature = "mesh")]
712pub use mesh_noise::{EncryptedChannel, EncryptedPeer, NoiseConfig, NoisePattern};
713#[cfg(feature = "mesh")]
714pub use mesh_process::{
715    ConsensusEntry, ConsensusOp, ConsensusRole, ConsistentHashRing, CrdtGossipState,
716    DistributedProcessTable, MetadataConsensus, ProcessAdvertisement, ProcessStatus,
717    ResourceSummary,
718};
719#[cfg(feature = "mesh")]
720pub use mesh_runtime::{DiscoveryState, MeshRuntime, PeerConnection};
721#[cfg(feature = "mesh")]
722pub use mesh_service::{
723    // Note: `ServiceEndpoint` alias lives on `mesh_service` only — crate root
724    // already exports `service::ServiceEndpoint` (local kernel service API).
725    RemoteServiceEndpoint, ServiceResolutionCache, ServiceResolveRequest, ServiceResolveResponse,
726};
727#[cfg(feature = "mesh")]
728pub use mesh_system_service::MeshService;
729#[cfg(feature = "mesh")]
730pub use mesh_service_adv::{ClusterServiceRegistry, ServiceAdvertisement};
731#[cfg(feature = "mesh")]
732pub use mesh_tcp::TcpTransport;
733#[cfg(feature = "mesh")]
734pub use mesh_tree::{
735    MerkleProof, TreeDiffType, TreeNodeDiff, TreeSyncAction, TreeSyncRequest, TreeSyncResponse,
736};
737#[cfg(feature = "mesh")]
738pub use mesh_ws::WsTransport;
739#[cfg(all(feature = "mesh", feature = "quic"))]
740pub use mesh_quic::QuicTransport;
741#[cfg(feature = "os-patterns")]
742pub use monitor::{ExitReason, MonitorRegistry, ProcessDown, ProcessLink, ProcessMonitor};
743#[cfg(feature = "native")]
744pub use node_registry::{
745    DerivedGrantError, DerivedWriteGrant, GrantScope, MESH_CANONICAL_PREFIX, NodeRegistry,
746    RegisteredNode, node_publish_payload, path_belongs_to, required_path_prefix,
747};
748pub use node_id::{is_node_id, node_id_from_pubkey};
749#[cfg(any(feature = "mesh", feature = "exochain"))]
750pub use node_key::{NODE_KEY_FILE, NodeKeyError, load_or_generate_key_file, load_or_generate_node_key};
751#[cfg(feature = "ecc")]
752pub use persistence::PersistenceConfig;
753pub use process::{Pid, ProcessEntry, ProcessState, ProcessTable, ResourceUsage};
754#[cfg(feature = "ecc")]
755pub use profile_store::{ProfileEntry, ProfileError, ProfileMeta, ProfileStore};
756#[cfg(feature = "ecc")]
757pub use quantum_backend::{
758    BackendStatus, EvolutionParams, JobHandle, JobStatus, QuantumBackend, QuantumError,
759    QuantumResults,
760};
761#[cfg(all(feature = "ecc", feature = "quantum-braket"))]
762pub use quantum_braket::{BraketBackend, BraketConfig, BraketDevice};
763#[cfg(all(feature = "ecc", feature = "quantum-pasqal"))]
764pub use quantum_pasqal::{PasqalBackend, PasqalConfig, PasqalDevice};
765#[cfg(feature = "ecc")]
766pub use quantum_register::{
767    LayoutMethod, RegisterConstraints, build_register, build_register_with,
768};
769#[cfg(feature = "ecc")]
770pub use quantum_state::{
771    Complex, Hypothesis, HypothesisSuperposition, QuantumCognitiveState, QuantumEvidenceRanking,
772};
773#[cfg(feature = "os-patterns")]
774pub use reconciler::{DesiredAgentState, DriftEvent, ReconciliationController};
775pub use revocation::{
776    RevocationError, RevocationKind, RevocationList, RevokedHost, RevokedSubject,
777};
778pub use service::{
779    KernelServiceApi, McpAdapter, ServiceApi, ServiceAuditLevel, ServiceContract, ServiceEndpoint,
780    ServiceEntry, ServiceInfo, ServiceRegistry, ServiceType, ShellAdapter, SystemService,
781};
782#[cfg(all(feature = "native", feature = "exochain"))]
783pub use stream_anchor::{StreamWindowAnchor, TopicAnchor, topic_matches};
784#[cfg(feature = "native")]
785pub use substrate_service::{
786    AclDenialEvent, EgressDenied, GateDenied, Sensitivity as SubstrateSensitivity,
787    SubstrateListEntry, SubstrateListSnapshot, SubstrateReadSnapshot, SubstrateService,
788};
789pub use supervisor::{AgentSupervisor, EnclaveConfig, SpawnBackend, SpawnRequest, SpawnResult};
790#[cfg(feature = "os-patterns")]
791pub use supervisor::{
792    ResourceCheckResult, RestartBudget, RestartStrategy, RestartTracker, check_resource_usage,
793};
794#[cfg(feature = "ecc")]
795pub use talk_loop::{TalkModeConfig, TalkModeLoop, TalkTickResult};
796#[cfg(feature = "exochain")]
797pub use tree_manager::{TreeManager, TreeStats};
798pub use tree_view::{AgentTreeView, TreeScope};
799#[cfg(feature = "ecc")]
800pub use vector_backend::{
801    SearchResult as VectorSearchResult, VectorBackend, VectorBackendKind, VectorError, VectorResult,
802};
803#[cfg(feature = "ecc")]
804pub use vector_diskann::{DiskAnnBackend, DiskAnnConfig};
805#[cfg(feature = "ecc")]
806pub use vector_hnsw::HnswBackend;
807#[cfg(feature = "ecc")]
808pub use vector_hybrid::{EvictionPolicy, HybridBackend, HybridConfig};
809#[cfg(feature = "ecc")]
810pub use view_resolver::{SingleViewResolver, ViewResolver};
811#[cfg(feature = "ecc")]
812pub use weaver::{
813    ConfidenceGap, ConfidenceReport, DataSource, ExportedModel, IngestResult, MetaDecisionType,
814    MetaLoomEvent, ModelingSession, ModelingSuggestion, StrategyPattern, TickResult, WeaverCommand,
815    WeaverEngine, WeaverError, WeaverKnowledgeBase, WeaverResponse,
816};
817// ── 08b re-exports ──────────────────────────────────────────────
818#[cfg(feature = "os-patterns")]
819pub use dead_letter::{DeadLetter, DeadLetterQueue, DeadLetterReason};
820#[cfg(feature = "os-patterns")]
821pub use log_service::{LogEntry, LogQuery, LogService};
822#[cfg(feature = "os-patterns")]
823pub use metrics::{
824    Histogram, METRIC_ACTIVE_AGENTS, METRIC_ACTIVE_SERVICES, METRIC_AGENT_CRASHES,
825    METRIC_AGENT_SPAWNS, METRIC_CHAIN_LENGTH, METRIC_GOVERNANCE_EVAL_MS, METRIC_IPC_LATENCY_MS,
826    METRIC_MESSAGES_DELIVERED, METRIC_MESSAGES_DROPPED, METRIC_MESSAGES_SENT,
827    METRIC_TOOL_EXECUTION_MS, METRIC_TOOL_EXECUTIONS, MetricSnapshot, MetricsRegistry,
828};
829#[cfg(feature = "os-patterns")]
830pub use named_pipe::{NamedPipe, NamedPipeRegistry, PipeInfo};
831#[cfg(feature = "os-patterns")]
832pub use reliable_queue::{DeliveryResult, PendingDelivery, ReliableConfig, ReliableQueue};
833#[cfg(feature = "os-patterns")]
834pub use timer::{TimerEntry, TimerInfo, TimerService};
835pub use topic::{SubscriberId, SubscriberSink, Subscription, TopicRouter};
836#[cfg(feature = "native")]
837pub use wasm_runner::AgentSendTool;
838pub use wasm_runner::{
839    AgentInspectTool, AgentListTool, AgentResumeTool, AgentSpawnTool, AgentStopTool,
840    AgentSuspendTool, BackendSelection, BuiltinTool, BuiltinToolSpec, Certificate,
841    CompiledModuleCache, DeployedTool, FsCopyTool, FsCreateDirTool, FsExistsTool, FsGlobTool,
842    FsMoveTool, FsReadDirTool, FsReadFileTool, FsRemoveTool, FsStatTool, FsWriteFileTool,
843    IpcSendTool, IpcSubscribeTool, SandboxConfig, ShellPipeline, SysCronAddTool, SysCronListTool,
844    SysCronRemoveTool, SysEnvGetTool, SysServiceHealthTool, SysServiceListTool, ToolCategory,
845    ToolError, ToolRegistry, ToolSigningAuthority, ToolVersion, WasiFsScope, WasmError,
846    WasmSandboxConfig, WasmTool, WasmToolResult, WasmToolRunner, WasmValidation,
847    builtin_tool_catalog, compute_module_hash, verify_tool_signature,
848};
849#[cfg(feature = "exochain")]
850pub use wasm_runner::{SysChainQueryTool, SysChainStatusTool, SysTreeInspectTool, SysTreeReadTool};