EventDef
Type, in src/define-event.ts of @jr2/agent-protocol, a dependency of @jr2/orchestrator. The signature of an export, or a type that it names, names this type. The Authoring surface page lists each export. This type is not an export of @jr2/orchestrator, so a workflow module does not import it by name.
type EventDef<Name extends string = string, Input extends z.ZodObject = z.ZodObject> = {
readonly name: Name;
readonly description?: string;
readonly input: Input;
readonly semantics: EventSemantics;
readonly audience?: EventAudience;
};A workflow event, as defineEvent gives it back: plain, frozen data and a zod schema, safe to import anywhere. Give it to jr2Setup({ events }). A Machine accepts only the events in that list.
Fields
name:NameThe event's name: its xstate event
type, and the name of its tool on the Agent's Menu.description(optional):stringWhat the event means. An Agent's model reads it as the tool's description.
input:InputThe schema of the event's payload: a flat
z.object, never a union.semantics:EventSemanticsHow the sender gets its answer: always
"ack"on an event thatcreateMachineaccepts.audience(optional):EventAudienceWho may send the event. Absent: the state of each
onkey decides (seeEventAudience).
See also