KnowledgeGrant untagged enum (Fact + Entity variants), ContentEntityRegistry resource, KnowledgeGranted event processing, ContradictionClaim struct with 600-tick window detection in observe_entity. Wires knowledge_grant field in dialogue line selection. Implements D-079, D-083. Closes Q-026. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1.6 KiB
Rust
48 lines
1.6 KiB
Rust
//! Knowledge graph module (D-041).
|
|
//!
|
|
//! Implements information boundaries (D-010 principle 2): every piece of
|
|
//! state is tagged with who knows it. Per-entity KnowledgeGraph component
|
|
//! tracks what each entity knows about others and the world.
|
|
|
|
use bevy_app::prelude::*;
|
|
use bevy_ecs::prelude::*;
|
|
|
|
pub mod content_registry;
|
|
pub mod events;
|
|
pub mod graph;
|
|
pub mod registry;
|
|
pub mod types;
|
|
|
|
pub use content_registry::ContentEntityRegistry;
|
|
pub use events::{
|
|
ContradictionDetectedEvent, ContradictionDetectedQueue, InteractionType, KnowledgeEvent,
|
|
KnowledgeEventQueue, KnowledgeEventType, ProcessedEntityGrant, ProcessedFactGrant,
|
|
ProcessedKnowledgeGrant,
|
|
};
|
|
pub use graph::KnowledgeGraph;
|
|
pub use registry::{EntityRegistry, StableEntityId};
|
|
pub use types::*;
|
|
|
|
/// Knowledge system plugin.
|
|
/// Registers resources and systems for knowledge graph processing.
|
|
pub struct KnowledgePlugin;
|
|
|
|
impl Plugin for KnowledgePlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.init_resource::<KnowledgeEventQueue>()
|
|
.init_resource::<ContradictionDetectedQueue>()
|
|
.init_resource::<EntityRegistry>()
|
|
.init_resource::<ContentEntityRegistry>()
|
|
.init_resource::<DecayThresholds>()
|
|
.add_systems(
|
|
Update,
|
|
(
|
|
events::process_knowledge_events
|
|
.after(crate::perception::observer::compute_observer_snapshot),
|
|
events::decay_knowledge.after(events::process_knowledge_events),
|
|
),
|
|
);
|
|
tracing::debug!("KnowledgePlugin initialized");
|
|
}
|
|
}
|