generative-a11y
Core

RuntimeEvent

Report confirmed lifecycle changes with serializable runtime events.

Dispatch an event

Use the same response ID for its start, appended text, and terminal event.

Start a response
import type { RuntimeEvent } from "@generative-a11y/core";

const event: RuntimeEvent = {
  type: "response.started",
  responseId: "report",
};
runtime.dispatch(event);

See the complete response lifecycle for text deltas and completion.

Event families

Events describe actions and changes your app can confirm. They contain serializable data, not rendered components or private framework state.

FamilyEventsRequired identity
Runstarted, completed, interrupted, failed, retryingrunId
Stepstarted, progress, completed, interrupted, failed, retryingrunId; stepId when stable identity exists
Responsestarted, text.delta, completed, interrupted, failed, retryingresponseId
Toolstarted, progress, completed, failedtoolId
Interactionrequested, resolvedinteractionId
Approvalrequested, resolvedapprovalId
Connectionlost, restorednone
CitationavailableresponseId

Response replacement example

Use responseInstanceId when one logical response can be replaced. Late events from the old instance are suppressed as stale.

Replace a response attempt
runtime.dispatch({
  type: "response.retrying",
  responseId: "report",
  responseInstanceId: "attempt-1",
  nextResponseInstanceId: "attempt-2",
  attempt: 2,
});

Keep responseId stable across regeneration and use the replacement nextResponseInstanceId on later deltas and terminal events. A later response.started with the same responseId also replaces the active attempt and makes events from older instance IDs stale.

Common fields

ID fields connect related events. Labels and messages contain translated text for users.

Prop

Type

Localized announcements

See catalogs and adapter copy for the typed messages and copy options, language ownership, validation, construction lifetime, and replay requirements. Existing lifecycle evidence and timing remain unchanged.