Skip to main content

Module trigger_engine

Module trigger_engine 

Source
Expand description

Trigger engine — the host-side (CLI) implementation of external-event-driven agent invocation, moved out of theway-core.

The core runtime maintains state and exposes the agent loop (AgentHarness); the trigger engine is a host concern: it owns the trigger envelope types, the dedup/cycle runtime, the permission hook chain, the audit persistence (via core Session public APIs), the sub-agent execution and result promotion (via core Agent public APIs), and its own event stream for CLI listeners.

Modules:

  • types — trigger envelope, state machine, audit record, action/promotion types
  • runtime — dedup window + cycle suppression engine (pure logic)
  • notification_hook — transport-agnostic source adapter trait + status surface
  • event — trigger lifecycle events for CLI listeners
  • executionTriggerExecutor: the pipeline that replaces the old AgentHarness::handle_trigger (evaluate → permission → audit → sub-agent → promote)

Transport adapters live in crates/server/src/triggers (MCP push, cron, dynamic) and register with the executor via execution::TriggerExecutor::register_notification_hook.

Modules§

event
Trigger lifecycle events emitted by the TriggerExecutor (moved out of theway_core::SessionEvent). The CLI subscribes to these alongside the core harness event stream: the executor is host-owned, so its event surface is a host-level contract — the TUI banner, /triggers command and JSONL listeners all consume this stream.
execution
Trigger execution engine (moved out of theway-core into the CLI host).
notification_hook
RFC 1 (issue #20) NotificationHook trait + status surface (moved out of theway-core with the rest of the trigger engine).
runtime
RFC 1 (issue #20) dedup window + cycle suppression engine.
types
RFC 1 (issue #20) trigger envelope, source taxonomy, authority, state machine, and the TriggerRecord persisted as SessionTreeEntry::Custom { custom_type: "trigger" }.