Skip to main content

Module triggers

Module triggers 

Source
Expand description

Trigger family implementations: AgentDispatch, Notification, YubabaAction.

Each family implements TriggerHandler (from dispatch.rs). Wire them together via CompoundTriggerHandler for production use; test each individually with the provided stub implementations.

Prompt-template injection safety: event payloads are wrapped in explicit delimiters before insertion into the rendered prompt so that hostile log lines cannot masquerade as instructions to the agent.

Architecture: .yah/docs/architecture/A052-yah-tower.md

@yah:ticket(R380-T5, “Migrate tower triggers + rule validate to the new tower-rules TaskPlacement”) @yah:assignee(agent:claude) @yah:at(2026-06-01T21:06:17Z) @yah:status(review) @yah:parent(R380) @yah:next(“ForgeSpec in tower/src/triggers.rs becomes AgentDispatchSpec carrying the new TaskPlacement.”) @yah:next(“Trigger::AgentDispatch.forge_where field renames to placement.”) @yah:next(“Update validate.rs round-trip tests + tower-rules tests/round_trip.rs to use TaskPlacement.”) @yah:next(“Update tower/tests/{dispatch,simulate,triggers}.rs ForgeWhere references.”) @yah:handoff(“Migrated Trigger::AgentDispatch.forge_where: ForgeWhere → placement: TaskPlacement and renamed tower::triggers::ForgeSpec → AgentDispatchSpec. Updated all callsites in tower (triggers.rs, simulate.rs, rules/validate.rs, rules/parse.rs YAML), tower-rules (round_trip tests + library/yubaba-restart-on-error.yaml), tower tests (dispatch/simulate/triggers), and the cli display in app/yah/cli/src/tower.rs. Added a From for TaskPlacement bridge in tower-rules (Local→{Local,Native}, Remote→{RemoteAny{empty tier},Container}, Integration panics) for gradual external-callsite migration. UI: replaced the flat ForgeWhere dropdown in components/tower/RuleEditor.tsx with a TaskPlacementEditor (location + tier-when-remote_any + runtime selectors).”) @yah:handoff(“Boundary converter (tower-rules::TaskPlacement → task::TaskPlacement) intentionally NOT added: no production ForgeClient consumes AgentDispatchSpec today (it’s still the R094-F1 stub), so the conversion has no callsite. When the real forge driver lands, it’ll add task as a dep and implement the conversion at its own seam — mapping is mechanical (TaskLocation::Local → task::TaskLocation::Local; TaskLocation::RemoteAny{tier:tower_rules::TierTag} → task::TaskLocation::RemoteAny{tier:workload_spec::TierTag}; runtime variants pass through). Kept ForgeWhere alive in tower-rules with deprecation rustdoc; T8 drops it.”) @yah:handoff(“All 134 tower tests + 50 tower-rules tests pass. yah cli builds clean. UI typecheck clean for tower (pre-existing errors in ChatSurface/test files unrelated).”) @yah:next(“R380-T6 picks up: wire the local + container quadrant in task::local. New TaskRuntime::Container path on TaskLocation::Local shells to docker run (or configured container runtime). Today task::local always builds a subprocess regardless of runtime; this needs a fork in spawn() that routes to a docker-run shim when runtime=Container. See W148 for the yah_qed::build-image consumer that motivates this path.”) @yah:next(“R380-T7 (independent of T6): decide remote+native policy at the YubabaClient seam — refuse with a clear error in v1 OR implement yubaba-agent-exec without containerd. The relay’s open question.”) @yah:next(“Eventually (T8) drop ForgeWhere from tower-rules + task crate entirely, delete the From impls, drop ForgeWhere.ts. After T6 + T7 settle, the on-wire form is TaskPlacement everywhere.”) @yah:verify(“cargo test -p tower -p tower-rules”) @yah:verify(“cargo build -p yah –bin yah”) @yah:verify(“cd packages/yah/ui && bun run typecheck”)

Structs§

AgentDispatchHandler
Renders an AgentDispatchSpec from an AgentDispatch trigger and hands it to forge.run.
AgentDispatchSpec
Minimal description of an agent run to be handed to forge.run.
CompoundTriggerHandler
Routes dispatch calls to the correct family handler by trigger kind.
NotificationHandler
Fans a Notification trigger out to all configured channels.
NotificationPayload
Payload delivered to each notification channel when a rule fires.
YubabaActionHandler
Translates a YubabaAction trigger into a yubaba RPC call.

Enums§

ForgeRunError
Error returned when the forge client rejects or fails a run.
NotifyError
Error returned when a notification channel fails.
YubabaCommand
Command issued to the yubaba RPC surface.
YubabaRpcError
Error returned when a yubaba RPC call fails.

Traits§

ForgeClient
Submits an AgentDispatchSpec to the forge runtime (R094-F3).
NotificationSink
Delivers a notification to a single channel.
YubabaClient
Issues bounded cluster commands to the yubaba RPC (R091).

Functions§

render_prompt
Render a PromptTemplate with the event payload from ctx.