Skip to content

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.

ts
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: Name

    The event's name: its xstate event type, and the name of its tool on the Agent's Menu.

  • description (optional): string

    What the event means. An Agent's model reads it as the tool's description.

  • input: Input

    The schema of the event's payload: a flat z.object, never a union.

  • semantics: EventSemantics

    How the sender gets its answer: always "ack" on an event that createMachine accepts.

  • audience (optional): EventAudience

    Who may send the event. Absent: the state of each on key decides (see EventAudience).

See also

The docs of Kit version 0.5.1. Each page is also at its .md URL.