Expand description
Protocol drift detection between the AG-UI TypeScript source of truth and this repo’s Rust event types.
Why this exists: the Rust event types are a hand-written port of the upstream Zod schemas. Nothing in the compiler links the two, so upstream can add an event type and this SDK will keep building, keep passing its tests, and silently not speak the protocol any more. That is exactly how the previous community SDK fell ten event types behind without anyone noticing.
The link is this check:
drift-check— offline, deterministic, the CI gate. Compares the vendored baseline inxtask/baseline/against the Rust source, read as text.drift-check --upstream— additionally asks GitHub whether the baseline itself has gone stale. Needs the network, so it is a scheduled job, never the required check.drift-check --refresh— re-captures the baseline. How a human accepts an upstream protocol change.
Modules§
- baseline
- The vendored snapshot of the upstream event surface.
- fetch
- Fetching the upstream source of truth.
- rust_
src - Extracts the event surface from
crates/ag-ui/src/event/**/*.rs. - text
- Small text utilities shared by the TypeScript and Rust scanners.
- upstream
- Extracts the AG-UI event surface from the upstream TypeScript source of
truth (
sdks/typescript/packages/core/src/events.ts).
Structs§
- Args
- Base
Event 🔒Diff - The
BaseEventcomparison, which is one struct rather than one per event. - Field
Delta 🔒 - The three ways one payload’s fields can disagree with the baseline’s.
- Field
Diff 🔒 - Freshness 🔒
- What a fetch of upstream had to say about the vendored baseline.
- Report 🔒
- Everything the offline comparison found.
Constants§
- BASELINE 🔒
- Where the vendored baseline lives, relative to the repo root.
- EVENT_
DIR 🔒 - Where the Rust event types live, relative to the repo root.
- EXIT_
DRIFT - EXIT_OK
- Exit codes: 0 clean, 1 drift found, 2 the check itself could not run.
Functions§
- check_
upstream 🔒 - Fetches upstream and returns the ways the baseline no longer matches it.
- compare 🔒
- diff_
baselines 🔒 - Human-readable differences between two snapshots of the upstream surface.
- indent 🔒
- optionality 🔒
- refresh 🔒
- Re-captures the vendored baseline from upstream.
- render 🔒
- render_
delta 🔒 - The field-by-field lines under a heading, shared by the per-event and the
BaseEventsections so the two read identically. - render_
notes 🔒 - Prints how the extractor read what upstream did not spell out.
- render_
upstream 🔒 - repo_
root 🔒 - The repo root, from the compile-time location of this crate.
- run
- Runs the check.
Errmeans the check could not be performed at all, which is a different thing from finding drift. - short 🔒