1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// =============================================================================
// #######
// ### ### F: plugin.rs
// ## ## ## ## P: AppCore-Runtime
// ## ##
// C: 2026/05/29 20:47:35 by dnettoRaw
// ## ## ## ## U: 2026/06/04 11:51:30 by dnettoRaw
// ########### S: 0.6.0
// =============================================================================
//! Application plugin contract using concrete core registries.
use crate::bus::CommandBus;
use crate::command::CommandRegistry;
use crate::decision::{DecisionEngine, DecisionRegistry};
use crate::error::RuntimeResult;
use crate::event::EventRegistry;
use crate::identity::RuntimeIdentity;
use crate::ids::NodeId;
use crate::state::StateRegistry;
use appcore_contracts::ApplicationManifestV1;
/// Runtime-facing application plugin contract.
pub trait AppPlugin: Send + Sync {
/// Returns the application-owned V1 contract.
fn application_manifest(&self) -> ApplicationManifestV1;
/// Returns the Runtime identity bound to the supplied node.
fn identity(&self, node_id: NodeId) -> RuntimeIdentity;
/// Declares command names implemented by the plugin.
fn register_commands(&self, registry: &mut CommandRegistry) -> RuntimeResult<()>;
/// Declares event names emitted by the plugin.
fn register_events(&self, registry: &mut EventRegistry) -> RuntimeResult<()>;
/// Declares state names used by the plugin.
fn register_states(&self, registry: &mut StateRegistry) -> RuntimeResult<()>;
/// Registers decision names for catalog/manifest/introspection.
fn register_decisions(&self, registry: &mut DecisionRegistry) -> RuntimeResult<()>;
/// Registers executable decision nodes used at dispatch time.
/// `RuntimeBuilder` keeps registry aligned with engine names after this step.
fn register_decision_nodes(&self, _engine: &mut DecisionEngine) -> RuntimeResult<()> {
Ok(())
}
/// Registers executable command handlers.
fn register_handlers(&self, _bus: &mut CommandBus) -> RuntimeResult<()> {
Ok(())
}
}
#[cfg(test)]
#[path = "plugin_tests.rs"]
mod tests;