Intents and diagnostics
Inspect prepared announcements and the runtime decisions that produced them.
AnnouncementIntent
An AnnouncementIntent describes an update prepared by core. It does not confirm that the browser delivered it or that a screen reader spoke it.
import { createRuntime } from "@generative-a11y/core";
const runtime = createRuntime({
onAnnouncement: (intent) => console.log(intent.sourceType, intent.channel),
onDiagnostic: (diagnostic) => console.log(diagnostic.reason),
});
// Call runtime.dispose() when inspection ends.Intent fields
Prop
Type
AnnouncementDiagnostic
Diagnostics record runtime decisions for tests and telemetry. Listener failures do not change runtime behavior. Repeated queue-limit decisions can share one diagnostic with a count.
| Disposition | Typical reasons | Meaning |
|---|---|---|
| queued | scheduled | Candidate entered the scheduler |
| merged | coalesced | Pending equivalent work was replaced |
| suppressed | duplicate, policy-silent, stale-response, stale-run, stale-step, partial-identity | Policy or identity prevented output |
| cancelled | scope-cancelled, runtime-disposed | Pending work became invalid |
| announced | delivered, delivery-error | Listeners accepted output or every attempt failed |
Prop
Type
Versioned runtime observability
subscribeDiagnosticEvents emits each normalized source event before the decisions caused by that dispatch. getDiagnosticSnapshot returns current lifecycle and queue timing without response text, labels, errors, scopes, deduplication keys, or timer handles.
Prop
Type
Evidence and testing note
Runtime diagnostics explain library behavior. They do not prove DOM delivery or screen-reader speech.