Skip to main content

theway_daemon/trigger_engine/
mod.rs

1//! Trigger engine — the host-side (CLI) implementation of external-event-driven agent
2//! invocation, moved out of theway-core.
3//!
4//! The core runtime maintains state and exposes the agent loop (`AgentHarness`); the
5//! trigger engine is a host concern: it owns the trigger envelope types, the dedup/cycle
6//! runtime, the permission hook chain, the audit persistence (via core `Session` public
7//! APIs), the sub-agent execution and result promotion (via core `Agent` public APIs),
8//! and its own event stream for CLI listeners.
9//!
10//! Modules:
11//! - [`types`] — trigger envelope, state machine, audit record, action/promotion types
12//! - [`runtime`] — dedup window + cycle suppression engine (pure logic)
13//! - [`notification_hook`] — transport-agnostic source adapter trait + status surface
14//! - [`event`] — trigger lifecycle events for CLI listeners
15//! - [`execution`] — [`TriggerExecutor`](execution::TriggerExecutor): the pipeline that
16//!   replaces the old `AgentHarness::handle_trigger` (evaluate → permission → audit →
17//!   sub-agent → promote)
18//!
19//! Transport adapters live in `crates/server/src/triggers` (MCP push, cron, dynamic) and
20//! register with the executor via [`execution::TriggerExecutor::register_notification_hook`].
21
22pub mod event;
23pub mod execution;
24pub mod notification_hook;
25pub mod runtime;
26pub mod types;