ag-ui-validate 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +229 -0
- package/dist/catalog-BglXBNbL.js +472 -0
- package/dist/catalog-BglXBNbL.js.map +1 -0
- package/dist/catalog-Ci9dqc1a.cjs +495 -0
- package/dist/catalog-Ci9dqc1a.cjs.map +1 -0
- package/dist/cli.js +2783 -0
- package/dist/cli.js.map +1 -0
- package/dist/index-Hmqj3r_r.d.cts +52 -0
- package/dist/index-oNG1kOp9.d.ts +52 -0
- package/dist/index.cjs +14 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/report.cjs +139 -0
- package/dist/report.cjs.map +1 -0
- package/dist/report.d.cts +85 -0
- package/dist/report.d.ts +85 -0
- package/dist/report.js +134 -0
- package/dist/report.js.map +1 -0
- package/dist/src-HmI-kxef.cjs +1596 -0
- package/dist/src-HmI-kxef.cjs.map +1 -0
- package/dist/src-rGZ2G4qA.js +1555 -0
- package/dist/src-rGZ2G4qA.js.map +1 -0
- package/dist/transport.cjs +329 -0
- package/dist/transport.cjs.map +1 -0
- package/dist/transport.d.cts +89 -0
- package/dist/transport.d.ts +89 -0
- package/dist/transport.js +323 -0
- package/dist/transport.js.map +1 -0
- package/dist/types-oH_QTnn2.d.cts +148 -0
- package/dist/types-oH_QTnn2.d.ts +148 -0
- package/dist/vitest.d.ts +28 -0
- package/dist/vitest.js +2089 -0
- package/dist/vitest.js.map +1 -0
- package/package.json +127 -0
- package/src/cli-args.ts +202 -0
- package/src/cli.ts +147 -0
- package/src/index.ts +465 -0
- package/src/protocol/event-table.ts +316 -0
- package/src/protocol/jsonpatch.ts +220 -0
- package/src/report/index.ts +10 -0
- package/src/report/json.ts +20 -0
- package/src/report/junit.ts +56 -0
- package/src/report/pretty.ts +59 -0
- package/src/report/sarif.ts +109 -0
- package/src/rules/catalog.json +431 -0
- package/src/rules/catalog.ts +84 -0
- package/src/rules/checks/context.ts +117 -0
- package/src/rules/checks/lifecycle.ts +59 -0
- package/src/rules/checks/reasoning.ts +97 -0
- package/src/rules/checks/state.ts +72 -0
- package/src/rules/checks/text.ts +109 -0
- package/src/rules/checks/toolcalls.ts +167 -0
- package/src/rules/checks/transport.ts +17 -0
- package/src/transport/index.ts +331 -0
- package/src/transport/ndjson.ts +25 -0
- package/src/transport/sse.ts +126 -0
- package/src/types.ts +136 -0
- package/src/vitest/index.ts +19 -0
- package/src/vitest/matcher.ts +77 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-HmI-kxef.cjs","names":["CATALOG","RULES","formatMessage"],"sources":["../src/protocol/event-table.ts","../src/rules/checks/context.ts","../src/rules/checks/lifecycle.ts","../src/rules/checks/reasoning.ts","../src/protocol/jsonpatch.ts","../src/rules/checks/state.ts","../src/rules/checks/text.ts","../src/rules/checks/toolcalls.ts","../src/rules/checks/transport.ts","../src/types.ts","../src/index.ts"],"sourcesContent":["// AUTO-GENERATED from @ag-ui/core v0.0.58 — do not edit by hand.\n// Regenerate with: node scripts/generate-event-table.mjs\n// test/protocol-drift.test.ts fails if this file drifts from the installed SDK.\n\nexport type FieldKind = \"string\" | \"number\" | \"boolean\" | \"object\" | \"array\" | \"any\"\n\nexport type EventCategory =\n | \"lifecycle\"\n | \"text\"\n | \"toolcall\"\n | \"state\"\n | \"activity\"\n | \"reasoning\"\n | \"thinking\"\n | \"special\"\n\nexport interface FieldSpec {\n kind: FieldKind\n required: boolean\n enum?: readonly string[]\n}\n\nexport interface EventSpec {\n category: EventCategory\n /** Present when the SDK marks the event @deprecated; names the replacement. */\n deprecated?: string\n /** Docs section governing this event. */\n specUrl: string\n /** Wire fields beyond the base-event fields (type, timestamp, rawEvent). */\n fields: Readonly<Record<string, FieldSpec>>\n}\n\n/** Version of @ag-ui/core this table was derived from. */\nexport const SDK_VERSION = \"0.0.58\"\n\n/** Canonical wire event types and their schemas, derived from @ag-ui/core. */\nexport const EVENT_TABLE: Readonly<Record<string, EventSpec>> = {\n \"TEXT_MESSAGE_START\": {\n category: \"text\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#textmessagestart\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n \"role\": { kind: \"string\", required: false, enum: [\"developer\",\"system\",\"assistant\",\"user\"] },\n \"name\": { kind: \"string\", required: false },\n },\n },\n \"TEXT_MESSAGE_CONTENT\": {\n category: \"text\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#textmessagecontent\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n \"delta\": { kind: \"string\", required: true },\n },\n },\n \"TEXT_MESSAGE_END\": {\n category: \"text\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#textmessageend\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n },\n },\n \"TEXT_MESSAGE_CHUNK\": {\n category: \"text\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#textmessagechunk\",\n fields: {\n \"messageId\": { kind: \"string\", required: false },\n \"role\": { kind: \"string\", required: false, enum: [\"developer\",\"system\",\"assistant\",\"user\"] },\n \"delta\": { kind: \"string\", required: false },\n \"name\": { kind: \"string\", required: false },\n },\n },\n \"TOOL_CALL_START\": {\n category: \"toolcall\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#toolcallstart\",\n fields: {\n \"toolCallId\": { kind: \"string\", required: true },\n \"toolCallName\": { kind: \"string\", required: true },\n \"parentMessageId\": { kind: \"string\", required: false },\n },\n },\n \"TOOL_CALL_ARGS\": {\n category: \"toolcall\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#toolcallargs\",\n fields: {\n \"toolCallId\": { kind: \"string\", required: true },\n \"delta\": { kind: \"string\", required: true },\n },\n },\n \"TOOL_CALL_END\": {\n category: \"toolcall\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#toolcallend\",\n fields: {\n \"toolCallId\": { kind: \"string\", required: true },\n },\n },\n \"TOOL_CALL_CHUNK\": {\n category: \"toolcall\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#toolcallchunk\",\n fields: {\n \"toolCallId\": { kind: \"string\", required: false },\n \"toolCallName\": { kind: \"string\", required: false },\n \"parentMessageId\": { kind: \"string\", required: false },\n \"delta\": { kind: \"string\", required: false },\n },\n },\n \"TOOL_CALL_RESULT\": {\n category: \"toolcall\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#toolcallresult\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n \"toolCallId\": { kind: \"string\", required: true },\n \"content\": { kind: \"string\", required: true },\n \"role\": { kind: \"string\", required: false, enum: [\"tool\"] },\n },\n },\n \"THINKING_START\": {\n category: \"thinking\",\n deprecated: \"REASONING_START\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#thinking-events-deprecated\",\n fields: {\n \"title\": { kind: \"string\", required: false },\n },\n },\n \"THINKING_END\": {\n category: \"thinking\",\n deprecated: \"REASONING_END\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#thinking-events-deprecated\",\n fields: {\n },\n },\n \"THINKING_TEXT_MESSAGE_START\": {\n category: \"thinking\",\n deprecated: \"REASONING_MESSAGE_START\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#thinking-events-deprecated\",\n fields: {\n },\n },\n \"THINKING_TEXT_MESSAGE_CONTENT\": {\n category: \"thinking\",\n deprecated: \"REASONING_MESSAGE_CONTENT\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#thinking-events-deprecated\",\n fields: {\n \"delta\": { kind: \"string\", required: true },\n },\n },\n \"THINKING_TEXT_MESSAGE_END\": {\n category: \"thinking\",\n deprecated: \"REASONING_MESSAGE_END\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#thinking-events-deprecated\",\n fields: {\n },\n },\n \"STATE_SNAPSHOT\": {\n category: \"state\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#statesnapshot\",\n fields: {\n \"snapshot\": { kind: \"any\", required: true },\n },\n },\n \"STATE_DELTA\": {\n category: \"state\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#statedelta\",\n fields: {\n \"delta\": { kind: \"array\", required: true },\n },\n },\n \"MESSAGES_SNAPSHOT\": {\n category: \"state\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#messagessnapshot\",\n fields: {\n \"messages\": { kind: \"array\", required: true },\n },\n },\n \"ACTIVITY_SNAPSHOT\": {\n category: \"activity\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#activitysnapshot\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n \"activityType\": { kind: \"string\", required: true },\n \"content\": { kind: \"object\", required: true },\n \"replace\": { kind: \"boolean\", required: false },\n },\n },\n \"ACTIVITY_DELTA\": {\n category: \"activity\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#activitydelta\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n \"activityType\": { kind: \"string\", required: true },\n \"patch\": { kind: \"array\", required: true },\n },\n },\n \"RAW\": {\n category: \"special\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#raw\",\n fields: {\n \"event\": { kind: \"any\", required: true },\n \"source\": { kind: \"string\", required: false },\n },\n },\n \"CUSTOM\": {\n category: \"special\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#custom\",\n fields: {\n \"name\": { kind: \"string\", required: true },\n \"value\": { kind: \"any\", required: true },\n },\n },\n \"RUN_STARTED\": {\n category: \"lifecycle\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#runstarted\",\n fields: {\n \"threadId\": { kind: \"string\", required: true },\n \"runId\": { kind: \"string\", required: true },\n \"parentRunId\": { kind: \"string\", required: false },\n \"input\": { kind: \"object\", required: false },\n },\n },\n \"RUN_FINISHED\": {\n category: \"lifecycle\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#runfinished\",\n fields: {\n \"threadId\": { kind: \"string\", required: true },\n \"runId\": { kind: \"string\", required: true },\n \"result\": { kind: \"any\", required: false },\n \"outcome\": { kind: \"object\", required: false },\n \"usage\": { kind: \"array\", required: false },\n },\n },\n \"RUN_ERROR\": {\n category: \"lifecycle\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#runerror\",\n fields: {\n \"message\": { kind: \"string\", required: true },\n \"code\": { kind: \"string\", required: false },\n \"usage\": { kind: \"array\", required: false },\n },\n },\n \"STEP_STARTED\": {\n category: \"lifecycle\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#stepstarted\",\n fields: {\n \"stepName\": { kind: \"string\", required: true },\n },\n },\n \"STEP_FINISHED\": {\n category: \"lifecycle\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#stepfinished\",\n fields: {\n \"stepName\": { kind: \"string\", required: true },\n },\n },\n \"REASONING_START\": {\n category: \"reasoning\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#reasoningstart\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n },\n },\n \"REASONING_MESSAGE_START\": {\n category: \"reasoning\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#reasoningmessagestart\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n \"role\": { kind: \"string\", required: true, enum: [\"reasoning\"] },\n },\n },\n \"REASONING_MESSAGE_CONTENT\": {\n category: \"reasoning\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#reasoningmessagecontent\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n \"delta\": { kind: \"string\", required: true },\n },\n },\n \"REASONING_MESSAGE_END\": {\n category: \"reasoning\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#reasoningmessageend\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n },\n },\n \"REASONING_MESSAGE_CHUNK\": {\n category: \"reasoning\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#reasoningmessagechunk\",\n fields: {\n \"messageId\": { kind: \"string\", required: false },\n \"delta\": { kind: \"string\", required: false },\n },\n },\n \"REASONING_END\": {\n category: \"reasoning\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#reasoningend\",\n fields: {\n \"messageId\": { kind: \"string\", required: true },\n },\n },\n \"REASONING_ENCRYPTED_VALUE\": {\n category: \"reasoning\",\n specUrl: \"https://docs.ag-ui.com/concepts/events#reasoningencryptedvalue\",\n fields: {\n \"subtype\": { kind: \"string\", required: true, enum: [\"tool-call\",\"message\"] },\n \"entityId\": { kind: \"string\", required: true },\n \"encryptedValue\": { kind: \"string\", required: true },\n },\n },\n}\n\n/** All canonical wire `type` values, in @ag-ui/core enum order. */\nexport const EVENT_TYPES: readonly string[] = Object.keys(EVENT_TABLE)\n\n/**\n * Wire types documented as drafts (https://docs.ag-ui.com/drafts/overview) but\n * not yet in @ag-ui/core. Not errors: reported at info severity.\n */\nexport const DRAFT_EVENT_TYPES: readonly string[] = [\"META\"]\n","// Internal validator state and the API each check module sees.\n// Everything here is engine-internal; the public surface lives in src/types.ts.\n\nimport type { CanonicalFeature } from \"../../types.js\"\n\n/** Emit a diagnostic for rule `id`; params fill the catalog messageTemplate. */\nexport type EmitFn = (\n ruleId: string,\n params: Record<string, unknown>,\n extra?: {\n eventIndex?: number\n pointer?: string\n relatedEventIndex?: number\n /** Instance-level severity floor (e.g. draft META downgrades AGUI503). */\n severity?: \"error\" | \"warning\" | \"info\"\n /** Instance-level spec link override (e.g. draft docs page). */\n specUrl?: string\n /** Appended to the formatted message (e.g. casing hints). */\n messageSuffix?: string\n },\n) => void\n\nexport interface OpenToolCall {\n startIndex: number\n args: string\n sawArgs: boolean\n}\n\nexport interface RunState {\n /** null while the run is implicit (stream opened without RUN_STARTED). */\n runId: string | null\n threadId: string | null\n startIndex: number\n implicit: boolean\n terminal: { type: string; index: number } | null\n\n openMessages: Map<string, { startIndex: number }>\n /** messageId -> index of the event that closed it. */\n closedMessages: Map<string, number>\n /** Every message id observed (starts, chunks, snapshots, tool results). */\n knownMessageIds: Set<string>\n\n openToolCalls: Map<string, OpenToolCall>\n closedToolCalls: Map<string, number>\n /** Ids also known from MESSAGES_SNAPSHOT history. */\n knownToolCallIds: Set<string>\n\n /** stepName -> re-entrant open count (SQ-10) and first-open index. */\n openSteps: Map<string, { count: number; firstIndex: number }>\n\n openReasoningBlocks: Map<string, number>\n openReasoningMessages: Map<string, number>\n\n state: {\n /** True once a STATE_SNAPSHOT established an observable base (SQ-1). */\n known: boolean\n value: unknown\n deltasSinceSnapshot: number\n snapshotSeen: boolean\n agui301Fired: boolean\n }\n\n /** Implicit streams opened by *_CHUNK events; closed by any other event. */\n textChunk: { messageId: string; startIndex: number } | null\n toolChunk: { toolCallId: string; startIndex: number; args: string; sawArgs: boolean } | null\n reasoningChunk: { messageId: string; startIndex: number } | null\n}\n\nexport function newRunState(init: {\n runId: string | null\n threadId: string | null\n startIndex: number\n implicit: boolean\n}): RunState {\n return {\n ...init,\n terminal: null,\n openMessages: new Map(),\n closedMessages: new Map(),\n knownMessageIds: new Set(),\n openToolCalls: new Map(),\n closedToolCalls: new Map(),\n knownToolCallIds: new Set(),\n openSteps: new Map(),\n openReasoningBlocks: new Map(),\n openReasoningMessages: new Map(),\n state: { known: false, value: undefined, deltasSinceSnapshot: 0, snapshotSeen: false, agui301Fired: false },\n textChunk: null,\n toolChunk: null,\n reasoningChunk: null,\n }\n}\n\nexport interface StreamState {\n eventCount: number\n sawTimestamp: boolean\n anySnapshot: boolean\n agui001Fired: boolean\n features: Set<CanonicalFeature>\n}\n\n/** What a per-event check handler receives. */\nexport interface CheckApi {\n index: number\n type: string\n event: Record<string, unknown>\n run: RunState\n stream: StreamState\n emit: EmitFn\n feature: (f: CanonicalFeature) => void\n}\n\n/** Reads a field only if it is a string (schema problems already reported). */\nexport function str(event: Record<string, unknown>, field: string): string | undefined {\n const v = event[field]\n return typeof v === \"string\" ? v : undefined\n}\n","// Lifecycle rules: AGUI001–AGUI008. Run open/terminate logic lives in the\n// engine (src/index.ts) because it owns run-scope resets; this module holds\n// the step pairing and the RUN_FINISHED id-stability check.\n\nimport type { CheckApi, RunState, EmitFn } from \"./context.js\"\nimport { str } from \"./context.js\"\n\nexport function handleStepEvent(api: CheckApi): void {\n const { type, event, run, emit, index } = api\n const stepName = str(event, \"stepName\")\n if (stepName === undefined) return\n\n if (type === \"STEP_STARTED\") {\n const open = run.openSteps.get(stepName)\n if (open !== undefined) {\n open.count += 1 // re-entrant same-name steps are tolerated (SQ-10)\n } else {\n run.openSteps.set(stepName, { count: 1, firstIndex: index })\n }\n return\n }\n\n if (type === \"STEP_FINISHED\") {\n const open = run.openSteps.get(stepName)\n if (open === undefined) {\n emit(\"AGUI006\", { stepName }, { pointer: \"/stepName\" })\n return\n }\n open.count -= 1\n if (open.count === 0) run.openSteps.delete(stepName)\n }\n}\n\n/** AGUI008 — RUN_FINISHED must carry the ids RUN_STARTED established. */\nexport function checkRunIdStability(api: CheckApi): void {\n const { event, run, emit } = api\n if (run.implicit) return // no RUN_STARTED to compare against\n for (const field of [\"threadId\", \"runId\"] as const) {\n const actual = str(api.event, field)\n const expected = field === \"threadId\" ? run.threadId : run.runId\n if (actual !== undefined && expected !== null && actual !== expected) {\n emit(\"AGUI008\", { field, actual, expected }, {\n pointer: `/${field}`,\n relatedEventIndex: run.startIndex,\n })\n }\n }\n void event\n}\n\n/** AGUI007 — open steps when the run reaches a clean end. */\nexport function endOfRunSteps(run: RunState, emit: EmitFn, atIndex: number): void {\n for (const [stepName, open] of run.openSteps) {\n emit(\"AGUI007\", { stepName }, {\n eventIndex: atIndex,\n relatedEventIndex: open.firstIndex,\n })\n }\n}\n","// Reasoning rules: AGUI401–AGUI402, plus REASONING_MESSAGE_CHUNK handling.\n//\n// Per SQ-4: block-level nesting (REASONING_MESSAGE_* inside\n// REASONING_START/END) is only described as \"a typical flow\" by the docs, so\n// it is NOT enforced. AGUI401 enforces the message-level pairing, mirroring\n// the text message rules; AGUI402 reports unterminated starts at warning.\n\nimport type { CheckApi, RunState, EmitFn } from \"./context.js\"\nimport { str } from \"./context.js\"\n\nexport function handleReasoningEvent(api: CheckApi): void {\n const { type, event, run, emit, index } = api\n\n switch (type) {\n case \"REASONING_START\": {\n const id = str(event, \"messageId\")\n if (id !== undefined) run.openReasoningBlocks.set(id, index)\n return\n }\n\n case \"REASONING_END\": {\n const id = str(event, \"messageId\")\n if (id !== undefined) run.openReasoningBlocks.delete(id)\n return\n }\n\n case \"REASONING_MESSAGE_START\": {\n const id = str(event, \"messageId\")\n if (id !== undefined) run.openReasoningMessages.set(id, index)\n return\n }\n\n case \"REASONING_MESSAGE_CONTENT\": {\n const id = str(event, \"messageId\")\n if (id === undefined) return\n const openChunk = run.reasoningChunk !== null && run.reasoningChunk.messageId === id\n if (!run.openReasoningMessages.has(id) && !openChunk) {\n emit(\"AGUI401\", { messageId: id }, { pointer: \"/messageId\" })\n }\n return\n }\n\n case \"REASONING_MESSAGE_END\": {\n const id = str(event, \"messageId\")\n if (id !== undefined) run.openReasoningMessages.delete(id)\n return\n }\n\n case \"REASONING_MESSAGE_CHUNK\": {\n const id = str(event, \"messageId\")\n if (id === undefined) {\n if (run.reasoningChunk === null) {\n emit(\"AGUI504\", { type, detail: \"first REASONING_MESSAGE_CHUNK must include messageId\" }, {\n pointer: \"/messageId\",\n })\n return\n }\n if (event.delta === \"\") run.reasoningChunk = null // documented implicit close\n return\n }\n if (run.reasoningChunk !== null && run.reasoningChunk.messageId !== id) {\n run.reasoningChunk = null\n }\n if (event.delta === \"\") {\n run.reasoningChunk = null // empty delta implicitly closes the message\n return\n }\n if (run.reasoningChunk === null) {\n run.reasoningChunk = { messageId: id, startIndex: index }\n }\n return\n }\n\n // REASONING_ENCRYPTED_VALUE: schema-checked only; no ordering rules cited.\n }\n}\n\n/** Chunked reasoning also closes on any non-reasoning event (documented). */\nexport function closeReasoningChunk(run: RunState): void {\n run.reasoningChunk = null\n}\n\n/** AGUI402 — unterminated reasoning at a clean run end. */\nexport function endOfRunReasoning(run: RunState, emit: EmitFn, atIndex: number): void {\n for (const [id, startIndex] of run.openReasoningBlocks) {\n emit(\"AGUI402\", { startType: \"REASONING_START\", messageId: id }, {\n eventIndex: atIndex,\n relatedEventIndex: startIndex,\n })\n }\n for (const [id, startIndex] of run.openReasoningMessages) {\n emit(\"AGUI402\", { startType: \"REASONING_MESSAGE_START\", messageId: id }, {\n eventIndex: atIndex,\n relatedEventIndex: startIndex,\n })\n }\n}\n","// Minimal RFC 6902 (JSON Patch) + RFC 6901 (JSON Pointer) implementation.\n// Hand-rolled so the core keeps zero runtime dependencies. Immutable: the\n// input document is never mutated; ops apply atomically (all or none).\n\nexport type PatchResult =\n | { ok: true; result: unknown }\n | { ok: false; error: string; opIndex: number }\n\nexport interface PatchShapeProblem {\n /** Human-readable problem. */\n error: string\n /** Index of the offending op, or -1 when the document itself is not an array. */\n opIndex: number\n /** RFC 6901 pointer into the patch document, e.g. \"/0/op\". */\n pointer: string\n}\n\nconst OPS = [\"add\", \"remove\", \"replace\", \"move\", \"copy\", \"test\"] as const\ntype OpName = (typeof OPS)[number]\n\n/** RFC 6901: \"\" → whole document; \"/a/b\" → [\"a\", \"b\"]. Returns null when invalid. */\nexport function parsePointer(pointer: unknown): string[] | null {\n if (typeof pointer !== \"string\") return null\n if (pointer === \"\") return []\n if (!pointer.startsWith(\"/\")) return null\n return pointer\n .slice(1)\n .split(\"/\")\n .map((t) => t.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))\n}\n\n/** Structural validation of a patch document, without applying it. */\nexport function validatePatchShape(patch: unknown): PatchShapeProblem | null {\n if (!Array.isArray(patch)) {\n return { error: \"patch document must be an array of operations\", opIndex: -1, pointer: \"\" }\n }\n for (let i = 0; i < patch.length; i++) {\n const op = patch[i]\n if (typeof op !== \"object\" || op === null || Array.isArray(op)) {\n return { error: `operation ${i} is not an object`, opIndex: i, pointer: `/${i}` }\n }\n const o = op as Record<string, unknown>\n if (!OPS.includes(o.op as OpName)) {\n return { error: `operation ${i} has invalid op '${String(o.op)}'`, opIndex: i, pointer: `/${i}/op` }\n }\n if (parsePointer(o.path) === null) {\n return { error: `operation ${i} (${String(o.op)}) has invalid path`, opIndex: i, pointer: `/${i}/path` }\n }\n if ((o.op === \"add\" || o.op === \"replace\" || o.op === \"test\") && !(\"value\" in o)) {\n return { error: `operation ${i} (${String(o.op)}) is missing value`, opIndex: i, pointer: `/${i}` }\n }\n if ((o.op === \"move\" || o.op === \"copy\") && parsePointer(o.from) === null) {\n return { error: `operation ${i} (${String(o.op)}) is missing or has invalid from`, opIndex: i, pointer: `/${i}` }\n }\n }\n return null\n}\n\nfunction clone(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(clone)\n if (typeof value === \"object\" && value !== null) {\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(value)) out[k] = clone(v)\n return out\n }\n return value\n}\n\nfunction deepEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((v, i) => deepEqual(v, b[i]))\n }\n if (typeof a === \"object\" && a !== null && typeof b === \"object\" && b !== null && !Array.isArray(a) && !Array.isArray(b)) {\n const ka = Object.keys(a)\n const kb = Object.keys(b as object)\n return ka.length === kb.length && ka.every((k) => deepEqual((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k]))\n }\n return false\n}\n\nfunction arrayIndex(token: string, length: number, allowAppend: boolean): number | null {\n if (allowAppend && token === \"-\") return length\n if (!/^(0|[1-9]\\d*)$/.test(token)) return null\n const i = Number(token)\n return i > length ? null : i\n}\n\ninterface Located {\n parent: Record<string, unknown> | unknown[] | null // null → the document root itself\n key: string | number\n exists: boolean\n value: unknown\n}\n\nfunction locate(doc: unknown, tokens: string[], forAdd: boolean): Located | string {\n if (tokens.length === 0) return { parent: null, key: \"\", exists: true, value: doc }\n let current = doc\n for (let i = 0; i < tokens.length - 1; i++) {\n const token = tokens[i]!\n if (Array.isArray(current)) {\n const idx = arrayIndex(token, current.length, false)\n if (idx === null || idx >= current.length) return `path segment '/${token}' does not exist`\n current = current[idx]\n } else if (typeof current === \"object\" && current !== null) {\n const obj = current as Record<string, unknown>\n if (!(token in obj)) return `path segment '/${token}' does not exist`\n current = obj[token]\n } else {\n return `path segment '/${token}' is not an object or array`\n }\n }\n const last = tokens[tokens.length - 1]!\n if (Array.isArray(current)) {\n const idx = arrayIndex(last, current.length, forAdd)\n if (idx === null) return `'${last}' is not a valid index for an array of length ${current.length}`\n return { parent: current, key: idx, exists: idx < current.length, value: current[idx] }\n }\n if (typeof current === \"object\" && current !== null) {\n const obj = current as Record<string, unknown>\n return { parent: obj, key: last, exists: last in obj, value: obj[last] }\n }\n return `target of '/${last}' is not an object or array`\n}\n\n/** Applies an RFC 6902 patch. Validates shape first; never throws. */\nexport function applyPatch(doc: unknown, patch: unknown): PatchResult {\n const shape = validatePatchShape(patch)\n if (shape !== null) return { ok: false, error: shape.error, opIndex: shape.opIndex }\n\n let result = clone(doc)\n const ops = patch as Record<string, unknown>[]\n\n const getAt = (pointer: string): { ok: true; value: unknown } | { ok: false; error: string } => {\n const loc = locate(result, parsePointer(pointer)!, false)\n if (typeof loc === \"string\") return { ok: false, error: `${pointer}: ${loc}` }\n if (!loc.exists) return { ok: false, error: `${pointer} does not exist` }\n return { ok: true, value: loc.value }\n }\n\n const setAt = (pointer: string, value: unknown, mustExist: boolean): string | null => {\n const tokens = parsePointer(pointer)!\n if (tokens.length === 0) {\n result = value\n return null\n }\n const loc = locate(result, tokens, !mustExist)\n if (typeof loc === \"string\") return `${pointer}: ${loc}`\n if (mustExist && !loc.exists) return `${pointer} does not exist`\n if (Array.isArray(loc.parent)) {\n if (mustExist) loc.parent[loc.key as number] = value\n else loc.parent.splice(loc.key as number, 0, value)\n } else {\n loc.parent![loc.key as string] = value\n }\n return null\n }\n\n const removeAt = (pointer: string): { ok: true; removed: unknown } | { ok: false; error: string } => {\n const tokens = parsePointer(pointer)!\n if (tokens.length === 0) return { ok: false, error: \"cannot remove the whole document\" }\n const loc = locate(result, tokens, false)\n if (typeof loc === \"string\") return { ok: false, error: `${pointer}: ${loc}` }\n if (!loc.exists) return { ok: false, error: `${pointer} does not exist` }\n if (Array.isArray(loc.parent)) loc.parent.splice(loc.key as number, 1)\n else delete loc.parent![loc.key as string]\n return { ok: true, removed: loc.value }\n }\n\n for (let i = 0; i < ops.length; i++) {\n const op = ops[i]!\n const path = op.path as string\n let error: string | null = null\n\n switch (op.op as OpName) {\n case \"add\":\n error = setAt(path, clone(op.value), false)\n break\n case \"replace\":\n error = setAt(path, clone(op.value), true)\n break\n case \"remove\": {\n const r = removeAt(path)\n if (!r.ok) error = r.error\n break\n }\n case \"move\": {\n const from = op.from as string\n if (path.startsWith(`${from}/`)) {\n error = `cannot move ${from} into its own child ${path}`\n break\n }\n const r = removeAt(from)\n if (!r.ok) { error = r.error; break }\n error = setAt(path, r.removed, false)\n break\n }\n case \"copy\": {\n const r = getAt(op.from as string)\n if (!r.ok) { error = r.error; break }\n error = setAt(path, clone(r.value), false)\n break\n }\n case \"test\": {\n const r = getAt(path)\n if (!r.ok) error = r.error\n else if (!deepEqual(r.value, op.value)) error = `test failed at ${path}`\n break\n }\n }\n\n if (error !== null) return { ok: false, error, opIndex: i }\n }\n return { ok: true, result }\n}\n\n/** RFC 6901 token escaping, for building diagnostic pointers. */\nexport function escapePointerToken(token: string): string {\n return token.replace(/~/g, \"~0\").replace(/\\//g, \"~1\")\n}\n","// State rules: AGUI301–AGUI305, plus MESSAGES_SNAPSHOT history harvesting.\n\nimport { applyPatch, validatePatchShape } from \"../../protocol/jsonpatch.js\"\nimport type { CheckApi } from \"./context.js\"\n\nexport function handleStateEvent(api: CheckApi): void {\n const { type, event, run, stream, emit } = api\n\n switch (type) {\n case \"STATE_SNAPSHOT\": {\n api.feature(\"shared-state\")\n if (run.state.deltasSinceSnapshot > 0) {\n emit(\"AGUI304\", { deltaCount: run.state.deltasSinceSnapshot }, {})\n }\n run.state.known = true\n run.state.value = event.snapshot\n run.state.snapshotSeen = true\n run.state.deltasSinceSnapshot = 0\n stream.anySnapshot = true\n return\n }\n\n case \"STATE_DELTA\": {\n api.feature(\"shared-state\")\n const delta = event.delta\n if (!Array.isArray(delta)) return // AGUI504 already reported the kind mismatch\n const shape = validatePatchShape(delta)\n if (shape !== null) {\n emit(\"AGUI303\", { error: shape.error }, { pointer: `/delta${shape.pointer}` })\n return\n }\n if (!run.state.snapshotSeen && !run.state.agui301Fired) {\n // The base may be seeded out-of-band via RunAgentInput.state (SQ-1),\n // so this is informational, and patch application is not judged until\n // a snapshot establishes an observable base.\n emit(\"AGUI301\", {}, {})\n run.state.agui301Fired = true\n }\n if (run.state.known) {\n const applied = applyPatch(run.state.value, delta)\n if (applied.ok) {\n run.state.value = applied.result\n } else {\n emit(\"AGUI302\", { error: applied.error }, { pointer: `/delta/${applied.opIndex}` })\n }\n }\n run.state.deltasSinceSnapshot += 1\n return\n }\n\n case \"MESSAGES_SNAPSHOT\": {\n // Snapshots can carry history from before this capture: harvest ids so\n // reference checks (AGUI207/AGUI208) don't false-positive on them.\n const messages = event.messages\n if (!Array.isArray(messages)) return\n for (const message of messages) {\n if (typeof message !== \"object\" || message === null) continue\n const m = message as Record<string, unknown>\n if (typeof m.id === \"string\") run.knownMessageIds.add(m.id)\n if (Array.isArray(m.toolCalls)) {\n for (const call of m.toolCalls) {\n if (typeof call === \"object\" && call !== null) {\n const id = (call as Record<string, unknown>).id\n if (typeof id === \"string\") run.knownToolCallIds.add(id)\n }\n }\n }\n }\n return\n }\n }\n}\n","// Text message rules: AGUI101–AGUI106, plus TEXT_MESSAGE_CHUNK stream handling.\n\nimport type { CheckApi, RunState, EmitFn } from \"./context.js\"\nimport { str } from \"./context.js\"\n\nexport function handleTextEvent(api: CheckApi): void {\n const { type, event, run, emit, index } = api\n api.feature(\"agentic-chat\")\n\n switch (type) {\n case \"TEXT_MESSAGE_START\": {\n const id = str(event, \"messageId\")\n if (id === undefined) return\n if (run.openMessages.has(id)) {\n emit(\"AGUI106\", { messageId: id }, {\n pointer: \"/messageId\",\n relatedEventIndex: run.openMessages.get(id)!.startIndex,\n })\n return\n }\n if (run.closedMessages.has(id)) {\n emit(\"AGUI104\", { messageId: id }, {\n pointer: \"/messageId\",\n relatedEventIndex: run.closedMessages.get(id)!,\n })\n return\n }\n run.openMessages.set(id, { startIndex: index })\n run.knownMessageIds.add(id)\n return\n }\n\n case \"TEXT_MESSAGE_CONTENT\": {\n const id = str(event, \"messageId\")\n if (id === undefined) return\n const open = run.openMessages.get(id)\n if (open === undefined) {\n const closedAt = run.closedMessages.get(id)\n emit(\"AGUI101\", { messageId: id }, {\n pointer: \"/messageId\",\n ...(closedAt !== undefined ? { relatedEventIndex: closedAt } : {}),\n })\n return\n }\n if (event.delta === \"\") {\n emit(\"AGUI105\", { messageId: id }, { pointer: \"/delta\", relatedEventIndex: open.startIndex })\n }\n return\n }\n\n case \"TEXT_MESSAGE_END\": {\n const id = str(event, \"messageId\")\n if (id === undefined) return\n if (!run.openMessages.has(id)) {\n emit(\"AGUI102\", { messageId: id }, { pointer: \"/messageId\" })\n return\n }\n run.openMessages.delete(id)\n run.closedMessages.set(id, index)\n return\n }\n\n case \"TEXT_MESSAGE_CHUNK\": {\n const id = str(event, \"messageId\")\n if (id === undefined) {\n // Continuation chunks may omit messageId; the first chunk must not\n // (docs: \"First chunk for a message must include messageId\").\n if (run.textChunk === null) {\n emit(\"AGUI504\", { type, detail: \"first TEXT_MESSAGE_CHUNK for a message must include messageId\" }, {\n pointer: \"/messageId\",\n })\n }\n return\n }\n // Mixing chunk and explicit forms on one id is undefined behaviour\n // (SQ-9): tolerated, treated as content for the open message.\n if (run.openMessages.has(id)) return\n if (run.textChunk !== null && run.textChunk.messageId === id) return\n closeTextChunk(run, index)\n if (run.closedMessages.has(id)) {\n emit(\"AGUI104\", { messageId: id }, {\n pointer: \"/messageId\",\n relatedEventIndex: run.closedMessages.get(id)!,\n })\n return\n }\n run.textChunk = { messageId: id, startIndex: index }\n run.knownMessageIds.add(id)\n return\n }\n }\n}\n\n/** Chunk streams close implicitly on the next non-chunk event. */\nexport function closeTextChunk(run: RunState, atIndex: number): void {\n if (run.textChunk === null) return\n run.closedMessages.set(run.textChunk.messageId, atIndex)\n run.textChunk = null\n}\n\n/** AGUI103 — open messages when the run reaches a clean end. */\nexport function endOfRunText(run: RunState, emit: EmitFn, atIndex: number): void {\n for (const [id, open] of run.openMessages) {\n emit(\"AGUI103\", { messageId: id }, {\n eventIndex: atIndex,\n relatedEventIndex: open.startIndex,\n })\n }\n}\n","// Tool call rules: AGUI201–AGUI208, plus TOOL_CALL_CHUNK stream handling.\n\nimport type { CheckApi, RunState, EmitFn } from \"./context.js\"\nimport { str } from \"./context.js\"\n\nexport function handleToolCallEvent(api: CheckApi): void {\n const { type, event, run, emit, index } = api\n api.feature(\"backend-tool-rendering\")\n\n switch (type) {\n case \"TOOL_CALL_START\": {\n const id = str(event, \"toolCallId\")\n if (id === undefined) return\n if (run.openToolCalls.has(id) || run.closedToolCalls.has(id)) {\n const related = run.openToolCalls.get(id)?.startIndex ?? run.closedToolCalls.get(id)!\n emit(\"AGUI205\", { toolCallId: id }, { pointer: \"/toolCallId\", relatedEventIndex: related })\n return\n }\n run.openToolCalls.set(id, { startIndex: index, args: \"\", sawArgs: false })\n const parent = str(event, \"parentMessageId\")\n if (parent !== undefined && !run.knownMessageIds.has(parent)) {\n emit(\"AGUI208\", { parentMessageId: parent }, { pointer: \"/parentMessageId\" })\n }\n return\n }\n\n case \"TOOL_CALL_ARGS\": {\n const id = str(event, \"toolCallId\")\n if (id === undefined) return\n const open = run.openToolCalls.get(id)\n if (open === undefined) {\n emit(\"AGUI201\", { toolCallId: id }, { pointer: \"/toolCallId\" })\n return\n }\n const delta = str(event, \"delta\")\n if (delta !== undefined) {\n open.args += delta\n open.sawArgs = true\n }\n return\n }\n\n case \"TOOL_CALL_END\": {\n const id = str(event, \"toolCallId\")\n if (id === undefined) return\n const open = run.openToolCalls.get(id)\n if (open === undefined) {\n emit(\"AGUI202\", { toolCallId: id }, { pointer: \"/toolCallId\" })\n return\n }\n run.openToolCalls.delete(id)\n run.closedToolCalls.set(id, index)\n checkArgsJson(id, open, emit, index)\n return\n }\n\n case \"TOOL_CALL_RESULT\": {\n const id = str(event, \"toolCallId\")\n if (id !== undefined) {\n const open = run.openToolCalls.get(id)\n if (open !== undefined) {\n emit(\"AGUI206\", { toolCallId: id }, {\n pointer: \"/toolCallId\",\n relatedEventIndex: open.startIndex,\n })\n } else if (!run.closedToolCalls.has(id) && !run.knownToolCallIds.has(id)) {\n emit(\"AGUI207\", { toolCallId: id }, { pointer: \"/toolCallId\" })\n }\n }\n // The result is itself a tool message in the conversation.\n const messageId = str(event, \"messageId\")\n if (messageId !== undefined) run.knownMessageIds.add(messageId)\n return\n }\n\n case \"TOOL_CALL_CHUNK\": {\n const id = str(event, \"toolCallId\")\n const delta = str(event, \"delta\")\n if (id === undefined) {\n if (run.toolChunk === null) {\n emit(\"AGUI504\", { type, detail: \"first TOOL_CALL_CHUNK for a tool call must include toolCallId and toolCallName\" }, {\n pointer: \"/toolCallId\",\n })\n return\n }\n if (delta !== undefined) {\n run.toolChunk.args += delta\n run.toolChunk.sawArgs = true\n }\n return\n }\n // SQ-9: chunk continuing an explicitly-opened call — treat as args.\n const openExplicit = run.openToolCalls.get(id)\n if (openExplicit !== undefined) {\n if (delta !== undefined) {\n openExplicit.args += delta\n openExplicit.sawArgs = true\n }\n return\n }\n if (run.toolChunk !== null && run.toolChunk.toolCallId === id) {\n if (delta !== undefined) {\n run.toolChunk.args += delta\n run.toolChunk.sawArgs = true\n }\n return\n }\n closeToolChunk(run, emit, index)\n if (run.closedToolCalls.has(id)) {\n emit(\"AGUI205\", { toolCallId: id }, {\n pointer: \"/toolCallId\",\n relatedEventIndex: run.closedToolCalls.get(id)!,\n })\n return\n }\n if (str(event, \"toolCallName\") === undefined) {\n emit(\"AGUI504\", { type, detail: \"first TOOL_CALL_CHUNK for a tool call must include toolCallName\" }, {\n pointer: \"/toolCallName\",\n })\n }\n run.toolChunk = {\n toolCallId: id,\n startIndex: index,\n args: delta ?? \"\",\n sawArgs: delta !== undefined && delta.length > 0,\n }\n return\n }\n }\n}\n\nfunction checkArgsJson(\n id: string,\n call: { startIndex: number; args: string; sawArgs: boolean },\n emit: EmitFn,\n atIndex: number,\n): void {\n // A call that streamed no args at all is fine (a no-argument tool).\n if (!call.sawArgs || call.args.length === 0) return\n try {\n JSON.parse(call.args)\n } catch (e) {\n emit(\"AGUI204\", { toolCallId: id, error: e instanceof Error ? e.message : String(e) }, {\n eventIndex: atIndex,\n relatedEventIndex: call.startIndex,\n })\n }\n}\n\n/** Chunk streams close implicitly on the next non-chunk event. */\nexport function closeToolChunk(run: RunState, emit: EmitFn, atIndex: number): void {\n if (run.toolChunk === null) return\n const { toolCallId, startIndex, args, sawArgs } = run.toolChunk\n run.toolChunk = null\n run.closedToolCalls.set(toolCallId, atIndex)\n checkArgsJson(toolCallId, { startIndex, args, sawArgs }, emit, atIndex)\n}\n\n/** AGUI203 — open tool calls when the run reaches a clean end. */\nexport function endOfRunToolCalls(run: RunState, emit: EmitFn, atIndex: number): void {\n for (const [id, open] of run.openToolCalls) {\n emit(\"AGUI203\", { toolCallId: id }, {\n eventIndex: atIndex,\n relatedEventIndex: open.startIndex,\n })\n }\n}\n","// Transport rules (AGUI501, AGUI505–AGUI508) are only checkable against a\n// live connection: SSE framing, Content-Type, keepalive timing, flush\n// behaviour, abnormal EOF. The core cannot observe any of that from a parsed\n// event sequence, so it reports these rules as skipped — never silently —\n// and the transport layer (ag-ui-validate/transport, M5) evaluates them.\n//\n// AGUI502/503/504 are transport-adjacent but *are* checkable here (the core\n// accepts raw JSON strings), so they live in the engine, not this list.\n\nimport { CATALOG } from \"../catalog.js\"\n\nexport const TRANSPORT_SKIP_REASON =\n \"transport-layer rule; only checkable against a live connection (validated by ag-ui-validate/transport)\"\n\nexport const TRANSPORT_RULE_IDS: readonly string[] = CATALOG.rules\n .filter((r) => r.checkedIn === \"transport\")\n .map((r) => r.id)\n","import type { Severity, SeverityOrOff } from \"./rules/catalog.js\"\n\nexport type { Severity, SeverityOrOff }\n\n/** A single conformance finding. */\nexport interface Diagnostic {\n /** Rule ID, e.g. \"AGUI203\". */\n rule: string\n severity: Severity\n /** Human-readable, includes the offending id/value. */\n message: string\n /**\n * 0-based position in the stream of the event this diagnostic is about.\n * Stream-level diagnostics (e.g. AGUI902) use -1.\n */\n eventIndex: number\n /** The event's declared type, if parseable. */\n eventType?: string\n /** RFC 6901 JSON pointer into the event, e.g. \"/toolCallId\". */\n pointer?: string\n /** e.g. the unterminated TOOL_CALL_START this refers back to. */\n relatedEventIndex?: number\n /** Link to the governing spec section. Always populated. */\n specUrl: string\n}\n\n/** The seven canonical AG-UI features (from the AG-UI Dojo). */\nexport type CanonicalFeature =\n | \"agentic-chat\"\n | \"backend-tool-rendering\"\n | \"human-in-the-loop\"\n | \"agentic-generative-ui\"\n | \"tool-based-generative-ui\"\n | \"shared-state\"\n | \"predictive-state-updates\"\n\nexport const CANONICAL_FEATURES: readonly CanonicalFeature[] = [\n \"agentic-chat\",\n \"backend-tool-rendering\",\n \"human-in-the-loop\",\n \"agentic-generative-ui\",\n \"tool-based-generative-ui\",\n \"shared-state\",\n \"predictive-state-updates\",\n]\n\n/**\n * Feature-matrix status. Capability discovery (getCapabilities()) is\n * out-of-band and invisible to a passive stream observer, so this matrix is\n * inferred from observed events; features whose exercise cannot be\n * distinguished passively are \"not-inferable\". See docs/spec-questions.md SQ-13.\n */\nexport type FeatureStatus = \"exercised\" | \"not-exercised\" | \"not-inferable\"\n\nexport type FeatureMatrix = Record<CanonicalFeature, FeatureStatus>\n\nexport interface Summary {\n errors: number\n warnings: number\n info: number\n}\n\nexport interface SkippedRule {\n rule: string\n reason: string\n}\n\nexport interface Report {\n diagnostics: Diagnostic[]\n summary: Summary\n features: FeatureMatrix\n /**\n * Rules that were not evaluated in this mode and why — e.g. transport rules\n * when validating recorded input. Skips are reported, never silent.\n */\n skipped: SkippedRule[]\n eventCount: number\n /**\n * Unexpected internal validator errors. The validator never throws on any\n * input; if a check itself crashes, the message lands here instead.\n */\n internalErrors: string[]\n}\n\nexport type ValidationLayer = \"core\" | \"transport\"\n\nexport interface ValidatorOptions {\n /** Pins the rule set to a spec version. Only \"0.x\" exists today. */\n spec?: \"0.x\"\n /**\n * Declared features. Enables feature-conditional rules (e.g. AGUI305 fires\n * only when \"shared-state\" is declared).\n */\n features?: string[]\n /** Per-rule severity overrides; \"off\" disables a rule. */\n severityOverrides?: Record<string, SeverityOrOff>\n /**\n * Which rule layers are being evaluated. \"core\" is always on. Wrapping\n * layers that check transport rules (via emitExternal) declare \"transport\"\n * so those rules stop being reported as skipped. Default: [\"core\"].\n */\n layers?: ValidationLayer[]\n}\n\nexport interface Validator {\n /**\n * Feed one event — a parsed object, or a raw JSON string (malformed JSON is\n * a diagnostic, not an exception). Returns diagnostics detectable at this\n * event, in stream order. Never throws.\n */\n feed(event: unknown): Diagnostic[]\n /**\n * End-of-stream checks (unterminated tool calls, missing RUN_FINISHED, …).\n * Idempotent: second and later calls return []. Never throws.\n */\n finalize(): Diagnostic[]\n /** Cumulative report over everything fed so far. Never throws. */\n report(): Report\n /**\n * For wrapping layers (transport, CLI): report a layer-checked rule through\n * the same catalog formatting, severity overrides, and summary as core\n * diagnostics. Returns the diagnostic, or null when the rule is unknown\n * (recorded in internalErrors) or overridden off. Never throws.\n */\n emitExternal(\n rule: string,\n params?: Record<string, unknown>,\n extra?: { eventIndex?: number; pointer?: string; relatedEventIndex?: number },\n ): Diagnostic | null\n /**\n * For wrapping layers: declare that a rule was NOT evaluated and why (e.g.\n * timing rules on recorded input). The entry appears in report().skipped,\n * replacing any layer-computed entry for the same rule. Never throws.\n */\n markSkipped(rule: string, reason: string): void\n}\n","// ag-ui-validate core: a pure function over an AG-UI event sequence.\n// Zero I/O, zero runtime dependencies, isomorphic. Transports, the CLI, and\n// the Vitest matcher are thin wrappers over this module.\n//\n// Two invariants hold everywhere here:\n// - the validator NEVER throws on input: broken input is its input;\n// - every diagnostic cites the spec section that governs it (specUrl).\n\nimport { DRAFT_EVENT_TYPES, EVENT_TABLE, EVENT_TYPES, SDK_VERSION } from \"./protocol/event-table.js\"\nimport type { EventSpec } from \"./protocol/event-table.js\"\nimport { RULES, formatMessage } from \"./rules/catalog.js\"\nimport type { CheckApi, EmitFn, RunState, StreamState } from \"./rules/checks/context.js\"\nimport { newRunState, str } from \"./rules/checks/context.js\"\nimport { checkRunIdStability, endOfRunSteps, handleStepEvent } from \"./rules/checks/lifecycle.js\"\nimport { closeReasoningChunk, endOfRunReasoning, handleReasoningEvent } from \"./rules/checks/reasoning.js\"\nimport { handleStateEvent } from \"./rules/checks/state.js\"\nimport { closeTextChunk, endOfRunText, handleTextEvent } from \"./rules/checks/text.js\"\nimport { closeToolChunk, endOfRunToolCalls, handleToolCallEvent } from \"./rules/checks/toolcalls.js\"\nimport { TRANSPORT_RULE_IDS, TRANSPORT_SKIP_REASON } from \"./rules/checks/transport.js\"\nimport type {\n CanonicalFeature,\n Diagnostic,\n FeatureMatrix,\n Report,\n Severity,\n Validator,\n ValidatorOptions,\n} from \"./types.js\"\nimport { CANONICAL_FEATURES } from \"./types.js\"\n\nexport * from \"./types.js\"\nexport { CATALOG, RULES, formatMessage, validateCatalog } from \"./rules/catalog.js\"\nexport type { Catalog, RuleDefinition, Severity as RuleSeverity, SeverityOrOff } from \"./rules/catalog.js\"\nexport { EVENT_TABLE, EVENT_TYPES, SDK_VERSION } from \"./protocol/event-table.js\"\nexport type { EventCategory, EventSpec, FieldKind, FieldSpec } from \"./protocol/event-table.js\"\nexport { applyPatch, validatePatchShape } from \"./protocol/jsonpatch.js\"\n\nconst DRAFTS_META_URL = \"https://docs.ag-ui.com/drafts/meta-events\"\n\n// Features whose exercise cannot be distinguished on a passive stream: both\n// generative-UI features need knowledge of the frontend's tool/component\n// registry, which is out-of-band (see SQ-13).\nconst NOT_INFERABLE: readonly CanonicalFeature[] = [\n \"agentic-generative-ui\",\n \"tool-based-generative-ui\",\n]\n\n/** \"runStarted\" → \"RUN_STARTED\": case-insensitive match against wire types. */\nconst CANONICAL_BY_SQUASHED: ReadonlyMap<string, string> = new Map(\n EVENT_TYPES.map((t) => [t.replace(/_/g, \"\").toLowerCase(), t]),\n)\n\nfunction describeValue(v: unknown): string {\n if (v === null) return \"null\"\n if (Array.isArray(v)) return \"array\"\n return typeof v\n}\n\nexport function createValidator(opts: ValidatorOptions = {}): Validator {\n const overrides = opts.severityOverrides ?? {}\n const declaredFeatures = new Set(opts.features ?? [])\n const layers = new Set([\"core\", ...(opts.layers ?? [])])\n\n const diagnostics: Diagnostic[] = []\n const internalErrors: string[] = []\n const explicitSkips = new Map<string, string>()\n const stream: StreamState = {\n eventCount: 0,\n sawTimestamp: false,\n anySnapshot: false,\n agui001Fired: false,\n features: new Set(),\n }\n let run: RunState | null = null\n let finalized = false\n\n function mkEmit(batch: Diagnostic[], current: { index: number; type: string } | null): EmitFn {\n return (ruleId, params, extra = {}) => {\n const rule = RULES.get(ruleId)\n if (rule === undefined) {\n internalErrors.push(`emit() for unknown rule ${ruleId}`)\n return\n }\n const override = overrides[ruleId]\n if (override === \"off\") return\n const severity: Severity = override ?? extra.severity ?? rule.severity\n const aboutCurrentEvent = extra.eventIndex === undefined && current !== null\n const diag: Diagnostic = {\n rule: ruleId,\n severity,\n message: formatMessage(rule, params) + (extra.messageSuffix ?? \"\"),\n eventIndex: extra.eventIndex ?? current?.index ?? -1,\n specUrl: extra.specUrl ?? rule.specUrl,\n }\n if (aboutCurrentEvent) diag.eventType = current.type\n if (extra.pointer !== undefined) diag.pointer = extra.pointer\n if (extra.relatedEventIndex !== undefined) diag.relatedEventIndex = extra.relatedEventIndex\n diagnostics.push(diag)\n batch.push(diag)\n }\n }\n\n function validateSchema(type: string, spec: EventSpec, ev: Record<string, unknown>, emit: EmitFn): void {\n for (const [field, fs] of Object.entries(spec.fields)) {\n const v = ev[field]\n if (v === undefined) {\n if (fs.required) {\n emit(\"AGUI504\", { type, detail: `missing required field '${field}' (${fs.kind})` }, {\n pointer: `/${field}`,\n })\n }\n continue\n }\n let kindOk = true\n switch (fs.kind) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n kindOk = typeof v === fs.kind\n break\n case \"array\":\n kindOk = Array.isArray(v)\n break\n case \"object\":\n kindOk = typeof v === \"object\" && v !== null && !Array.isArray(v)\n break\n case \"any\":\n break\n }\n if (!kindOk) {\n emit(\"AGUI504\", { type, detail: `field '${field}' must be ${fs.kind === \"array\" ? \"an\" : \"a\"} ${fs.kind}, got ${describeValue(v)}` }, {\n pointer: `/${field}`,\n })\n continue\n }\n if (fs.enum !== undefined && typeof v === \"string\" && !fs.enum.includes(v)) {\n emit(\"AGUI504\", { type, detail: `field '${field}' must be one of ${fs.enum.join(\"|\")}, got '${v}'` }, {\n pointer: `/${field}`,\n })\n }\n }\n }\n\n /** Chunk streams close implicitly on any event of a different type. */\n function closeChunks(r: RunState, emit: EmitFn, atIndex: number, except?: string): void {\n if (except !== \"TEXT_MESSAGE_CHUNK\") closeTextChunk(r, atIndex)\n if (except !== \"TOOL_CALL_CHUNK\") closeToolChunk(r, emit, atIndex)\n if (except !== \"REASONING_MESSAGE_CHUNK\") closeReasoningChunk(r)\n }\n\n /** Unterminated-at-run-end rules. Only on a *clean* end (RUN_FINISHED or a\n * stream that just stops): after RUN_ERROR, open streams are expected\n * debris of the failure, and flagging them would manufacture noise. */\n function endOfRunChecks(r: RunState, emit: EmitFn, atIndex: number): void {\n endOfRunText(r, emit, atIndex)\n endOfRunToolCalls(r, emit, atIndex)\n endOfRunSteps(r, emit, atIndex)\n endOfRunReasoning(r, emit, atIndex)\n }\n\n /** Opens the implicit run scope for streams that never announced one. */\n function ensureRun(index: number, type: string, emit: EmitFn): RunState {\n if (run === null) {\n if (!stream.agui001Fired) {\n emit(\"AGUI001\", { type }, {})\n stream.agui001Fired = true\n }\n run = newRunState({ runId: null, threadId: null, startIndex: index, implicit: true })\n }\n return run\n }\n\n function processEvent(input: unknown, batch: Diagnostic[]): void {\n const index = stream.eventCount\n stream.eventCount += 1\n\n // 1. Parse. Malformed input is a diagnostic, never an exception.\n let parsed: unknown = input\n if (typeof input === \"string\") {\n try {\n parsed = JSON.parse(input)\n } catch (e) {\n mkEmit(batch, { index, type: \"\" })(\"AGUI502\", {\n error: e instanceof Error ? e.message : String(e),\n })\n return\n }\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n mkEmit(batch, { index, type: \"\" })(\"AGUI502\", {\n error: `payload is ${describeValue(parsed)}, expected a JSON object`,\n })\n return\n }\n const ev = parsed as Record<string, unknown>\n\n // 2. The declared type is the key to everything else.\n if (typeof ev.type !== \"string\") {\n mkEmit(batch, { index, type: \"\" })(\"AGUI504\", {\n type: \"(untyped)\",\n detail: \"event has no string 'type' property\",\n }, { pointer: \"/type\" })\n return\n }\n const type = ev.type\n const emit = mkEmit(batch, { index, type })\n\n // 3. Base-event fields.\n if (\"timestamp\" in ev && ev.timestamp !== undefined) {\n if (typeof ev.timestamp === \"number\") stream.sawTimestamp = true\n else emit(\"AGUI504\", { type, detail: `field 'timestamp' must be a number, got ${describeValue(ev.timestamp)}` }, { pointer: \"/timestamp\" })\n }\n\n // 4. Unknown types: AGUI503 (documented drafts at info; casing hints for\n // near-misses — SQ-7).\n const spec = EVENT_TABLE[type]\n if (spec === undefined) {\n if (DRAFT_EVENT_TYPES.includes(type)) {\n emit(\"AGUI503\", { type, sdkVersion: SDK_VERSION }, {\n severity: \"info\",\n specUrl: DRAFTS_META_URL,\n messageSuffix: \" — documented draft event type, not yet in @ag-ui/core\",\n })\n } else {\n const canonical = CANONICAL_BY_SQUASHED.get(type.replace(/[_\\-\\s]/g, \"\").toLowerCase())\n emit(\"AGUI503\", { type, sdkVersion: SDK_VERSION }, {\n ...(canonical !== undefined\n ? { messageSuffix: ` — did you mean '${canonical}'? AG-UI wire types use SCREAMING_SNAKE_CASE` }\n : {}),\n })\n }\n return\n }\n\n // 5. Schema validation for the declared type (AGUI504).\n validateSchema(type, spec, ev, emit)\n\n // 6. Lifecycle position.\n if (type === \"RUN_STARTED\") {\n if (run === null) {\n run = newRunState({\n runId: str(ev, \"runId\") ?? null,\n threadId: str(ev, \"threadId\") ?? null,\n startIndex: index,\n implicit: false,\n })\n } else if (run.terminal !== null) {\n // A new run after a clean terminal: multi-run streams are legal\n // (serialized logs branch via parentRunId — SQ-6). Fresh scope.\n run = newRunState({\n runId: str(ev, \"runId\") ?? null,\n threadId: str(ev, \"threadId\") ?? null,\n startIndex: index,\n implicit: false,\n })\n } else if (run.implicit) {\n // The stream opened without RUN_STARTED (AGUI001 already fired); the\n // late start legitimizes the implicit scope rather than double-firing.\n closeChunks(run, emit, index)\n run.implicit = false\n run.runId = str(ev, \"runId\") ?? null\n run.threadId = str(ev, \"threadId\") ?? null\n } else {\n closeChunks(run, emit, index)\n emit(\"AGUI002\", { runId: str(ev, \"runId\") ?? \"(missing)\" }, {\n relatedEventIndex: run.startIndex,\n })\n }\n return\n }\n\n const r = ensureRun(index, type, emit)\n\n // 7. Nothing may follow a terminal event (AGUI004/AGUI005).\n if (r.terminal !== null) {\n const terminalType = r.terminal.type\n if ((type === \"RUN_FINISHED\" || type === \"RUN_ERROR\") && type !== terminalType) {\n emit(\"AGUI005\", { type, terminalType }, { relatedEventIndex: r.terminal.index })\n } else {\n emit(\"AGUI004\", { type, terminalType }, { relatedEventIndex: r.terminal.index })\n }\n return\n }\n\n closeChunks(r, emit, index, type)\n\n // 8. Terminal events.\n if (type === \"RUN_FINISHED\" || type === \"RUN_ERROR\") {\n if (type === \"RUN_FINISHED\") {\n checkRunIdStability(api(index, type, ev, r, emit))\n endOfRunChecks(r, emit, index)\n const outcome = ev.outcome\n if (typeof outcome === \"object\" && outcome !== null &&\n (outcome as Record<string, unknown>).type === \"interrupt\") {\n stream.features.add(\"human-in-the-loop\")\n }\n }\n r.terminal = { type, index }\n return\n }\n\n // 9. Per-category checks.\n const a = api(index, type, ev, r, emit)\n switch (spec.category) {\n case \"lifecycle\":\n handleStepEvent(a) // STEP_STARTED / STEP_FINISHED\n break\n case \"text\":\n handleTextEvent(a)\n break\n case \"toolcall\":\n handleToolCallEvent(a)\n break\n case \"state\":\n handleStateEvent(a)\n break\n case \"reasoning\":\n handleReasoningEvent(a)\n break\n case \"thinking\":\n // Deprecated but valid (SQ-8): schema-checked above, no ordering rules\n // in the catalog yet — a \"deprecated event used\" rule is proposed\n // upstream rather than invented here.\n break\n case \"activity\":\n // No activity rules in the catalog yet.\n break\n case \"special\":\n if (type === \"RAW\") {\n const wrapped = ev.event\n if (typeof wrapped === \"object\" && wrapped !== null) {\n const wrappedType = (wrapped as Record<string, unknown>).type\n if (typeof wrappedType === \"string\" && EVENT_TABLE[wrappedType] !== undefined) {\n emit(\"AGUI901\", { wrappedType }, { pointer: \"/event/type\" })\n }\n }\n } else if (type === \"CUSTOM\") {\n const name = str(ev, \"name\")\n if (name !== undefined) {\n if (name === \"PredictState\") stream.features.add(\"predictive-state-updates\")\n if (!/[.:/]/.test(name)) emit(\"AGUI903\", { name }, { pointer: \"/name\" })\n }\n }\n break\n }\n }\n\n function api(\n index: number,\n type: string,\n event: Record<string, unknown>,\n r: RunState,\n emit: EmitFn,\n ): CheckApi {\n return {\n index,\n type,\n event,\n run: r,\n stream,\n emit,\n feature: (f) => stream.features.add(f),\n }\n }\n\n return {\n feed(event: unknown): Diagnostic[] {\n const batch: Diagnostic[] = []\n try {\n processEvent(event, batch)\n } catch (e) {\n internalErrors.push(`feed(event ${stream.eventCount - 1}): ${e instanceof Error ? (e.stack ?? e.message) : String(e)}`)\n }\n return batch\n },\n\n finalize(): Diagnostic[] {\n if (finalized) return []\n finalized = true\n const batch: Diagnostic[] = []\n const emit = mkEmit(batch, null)\n try {\n if (run !== null && run.terminal === null) {\n closeChunks(run, emit, -1)\n emit(\"AGUI003\", { runId: run.runId ?? \"(unknown)\" }, {\n eventIndex: -1,\n relatedEventIndex: run.startIndex,\n })\n endOfRunChecks(run, emit, -1)\n }\n if (stream.eventCount > 0 && !stream.sawTimestamp) {\n emit(\"AGUI902\", { eventCount: stream.eventCount }, { eventIndex: -1 })\n }\n if (declaredFeatures.has(\"shared-state\") && !stream.anySnapshot) {\n emit(\"AGUI305\", {}, { eventIndex: -1 })\n }\n } catch (e) {\n internalErrors.push(`finalize(): ${e instanceof Error ? (e.stack ?? e.message) : String(e)}`)\n }\n return batch\n },\n\n emitExternal(rule, params = {}, extra = {}): Diagnostic | null {\n const batch: Diagnostic[] = []\n try {\n mkEmit(batch, null)(rule, params, extra)\n } catch (e) {\n internalErrors.push(`emitExternal(${rule}): ${e instanceof Error ? e.message : String(e)}`)\n }\n return batch[0] ?? null\n },\n\n markSkipped(rule, reason): void {\n explicitSkips.set(String(rule), String(reason))\n },\n\n report(): Report {\n const summary = { errors: 0, warnings: 0, info: 0 }\n for (const d of diagnostics) {\n if (d.severity === \"error\") summary.errors += 1\n else if (d.severity === \"warning\") summary.warnings += 1\n else summary.info += 1\n }\n\n const features = {} as FeatureMatrix\n for (const f of CANONICAL_FEATURES) {\n features[f] = NOT_INFERABLE.includes(f)\n ? \"not-inferable\"\n : stream.features.has(f)\n ? \"exercised\"\n : \"not-exercised\"\n }\n\n let skipped = layers.has(\"transport\")\n ? []\n : TRANSPORT_RULE_IDS\n .filter((id) => overrides[id] !== \"off\")\n .map((rule) => ({ rule, reason: TRANSPORT_SKIP_REASON }))\n if (!declaredFeatures.has(\"shared-state\") && overrides.AGUI305 !== \"off\") {\n skipped.push({\n rule: \"AGUI305\",\n reason: \"only evaluated when the 'shared-state' feature is declared via options.features\",\n })\n }\n for (const [rule, severity] of Object.entries(overrides)) {\n if (severity === \"off\" && RULES.has(rule)) {\n skipped.push({ rule, reason: \"disabled by severityOverrides\" })\n }\n }\n if (explicitSkips.size > 0) {\n skipped = skipped.filter((s) => !explicitSkips.has(s.rule))\n for (const [rule, reason] of explicitSkips) skipped.push({ rule, reason })\n }\n\n return {\n diagnostics: [...diagnostics],\n summary,\n features,\n skipped,\n eventCount: stream.eventCount,\n internalErrors: [...internalErrors],\n }\n },\n }\n}\n"],"mappings":";;;AAiCA,MAAa,cAAc;;AAG3B,MAAa,cAAmD;CAC9D,sBAAsB;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