import { type AdapterCheck } from './contracts.js'; import type { AdapterBenchmarkEntry, AdapterKind, AdapterReport } from './index.js'; /** The format every record declares, so a reader knows what it holds. */ export declare const COMPATIBILITY_RECORD_FORMAT = "nexus-compatibility/1"; /** The adapter a record is of, as its definition declares it. */ export interface CompatibilityRecordAdapter { /** Its name, usually its package name. */ name: string; /** Its version. */ version: string; /** Its kind. */ kind: AdapterKind; /** The releases of `nexus-ai-pro` it declares support for, as a range. */ nexus: string; /** What it declares it can do. */ capabilities: unknown; /** The p95 budgets it declares, in milliseconds. */ budgets?: Readonly>; /** Where it is published, such as `@acme/nexus-milvus@0.3.0`. */ package?: string; /** Its source repository. */ repository?: string; /** * The module that verifies it, as `nexus adapters verify` loads one, so `nexus adapters recheck` can * verify it again: a path, or a package specifier such as `@acme/nexus-milvus/verify`. */ verify?: string; } /** What an adapter's `verify()` proved, sealed. */ export interface CompatibilityRecord { /** `nexus-compatibility/1`. */ format: typeof COMPATIBILITY_RECORD_FORMAT; /** The adapter. */ adapter: CompatibilityRecordAdapter; /** The contract it was verified against: its kind and version. */ contract: { kind: AdapterKind; version: number; }; /** The release of `nexus-ai-pro` it was verified against. */ nexusVersion: string; /** ISO-8601 time it was verified. */ verifiedAt: string; /** The runtime it was verified on, such as `node 24.21.0 linux x64`. */ runtime: string; /** Whether that release is inside the adapter's declared range. */ compatible: boolean; /** Whether it is compatible and every check that ran held. */ passed: boolean; /** Every check, in order, skipped ones marked. */ checks: AdapterCheck[]; /** Latency per operation over the contract's calls. */ benchmark: Record; /** The SHA-256 of everything above, so an edited record is known for one. */ digest: string; } /** What `compatibilityRecord()` adds to a report. */ export interface CompatibilityRecordOptions { /** Where the adapter is published. */ package?: string; /** Its source repository. */ repository?: string; /** The module that verifies it, for `nexus adapters recheck`. */ verify?: string; /** The runtime, when not the one this runs on. */ runtime?: string; /** Replaces the clock, for tests. */ now?: () => Date; } /** Raised when a record cannot be read: not a record, of an unknown format, or edited after it was sealed. */ export declare class CompatibilityRecordError extends Error { /** Every problem found. */ readonly issues: readonly string[]; constructor(message: string, /** Every problem found. */ issues?: readonly string[]); } /** A record of what `verify()` reported, sealed with its digest. */ export declare function compatibilityRecord(report: AdapterReport, options?: CompatibilityRecordOptions): CompatibilityRecord; /** The digest a record is sealed with: the SHA-256 of its content, its keys in order, without the digest. */ export declare function recordDigest(record: Omit | CompatibilityRecord): string; /** * Reads a record, as JSON text or as an object, and checks it: its format, the fields every record * has, and its digest. Throws a `CompatibilityRecordError` listing every problem. */ export declare function readCompatibilityRecord(input: string | unknown): CompatibilityRecord; /** Where a record stands against a release: what a page shows, and what a check gates on. */ export type CompatibilityState = 'passing' | 'failing' | 'incompatible' | 'stale'; /** A record's state against a release, and why. */ export interface CompatibilityStatus { /** * `failing` when a check did not hold; `incompatible` when the release is outside the adapter's * declared range; `stale` when it was verified against an older version of its contract; * `passing` otherwise. */ state: CompatibilityState; /** Why, a sentence each. */ reasons: string[]; /** The checks its contract added since the version it was verified against. */ unverified: string[]; } /** Where a record stands against a release, the installed one by default. */ export declare function recordStatus(record: CompatibilityRecord, options?: { nexusVersion?: string; }): CompatibilityStatus; /** One check whose outcome moved between two records of an adapter. */ export interface CheckChange { /** The check. */ name: string; /** Why it fails now, when it does. */ detail?: string; } /** What changed between an adapter's listed record and a record of it verified again. */ export interface CompatibilityComparison { /** The adapter. */ adapter: string; /** Checks that held before and fail now. */ broken: CheckChange[]; /** Checks the listed record did not have, with whether each holds. */ added: AdapterCheck[]; /** Checks that failed before and hold now. */ fixed: string[]; /** Operations whose p95 more than doubled, with both. */ slower: Array<{ operation: string; beforeMs: number; afterMs: number; }>; /** True when the listed record passed and the new one does not: this release turns it red. */ regressed: boolean; } /** Compares an adapter's listed record with one verified again, such as against a release candidate. */ export declare function compareRecords(listed: CompatibilityRecord, current: CompatibilityRecord): CompatibilityComparison; /** Options for `compatibilityPage()`. */ export interface CompatibilityPageOptions { /** The page's title. Defaults to `Adapter compatibility`. */ title?: string; /** A paragraph under the title. */ intro?: string; /** The release each record's state is judged against. Defaults to the installed one. */ nexusVersion?: string; /** `markdown`, the default, or `html`. */ format?: 'markdown' | 'html'; } /** * One page listing every record: each adapter, its kind and version, the release and contract it was * verified against, its state there, its checks, and its p95 per operation, by kind and name. The * same records make the same page, so it can be checked for drift. A record is written as text, never * as markup: an adapter links to its repository only at an `http` or `https` address, and the HTML * page colours each row by its state, a failing one red. */ export declare function compatibilityPage(records: readonly CompatibilityRecord[], options?: CompatibilityPageOptions): string;