import type { SessionLogConformanceOptions } from '../store/session-log/conformance.js'; import type { LLMProvider } from '../types/provider/interface.js'; import type { ProviderRetryConfig } from './retry.js'; /** Shape of the `describe` a runner supplies; the same one every SDK conformance suite takes. */ type ConformanceDescribe = SessionLogConformanceOptions['describe']; /** Shape of the `it` a runner supplies. */ type ConformanceIt = SessionLogConformanceOptions['it']; /** Shape of the `expect` a runner supplies. */ type ConformanceExpect = SessionLogConformanceOptions['expect']; /** * The driver contract, as a suite every driver package runs. * * Seven packages implement `LLMProvider` and there was nowhere to write a * rule binding all of them. Each carried a hand-written error-taxonomy * test covering the same ground differently, and every provider finding in * the audit was a behaviour present in exactly ONE driver and absent from * the other six — which is what you get when a contract lives in seven * copies of a test rather than in one place. Nothing failed when an eighth * package appeared implementing none of it. * * The mechanism already existed for a different interface: the checkpoint * store publishes its contract at `@namzu/sdk/testing` and takes its * runner as an argument. This copies that shape exactly, for the same two * reasons — the SDK gains no test dependency from publishing a suite, and * a caller can pass a RECORDING `describe`/`it` and run the whole contract * as ordinary code, which is how a deliberately wrong driver is shown to * fail it. * * ## What is in it, and what is deliberately not * * Seeded only with rules that pass for every driver today. A suite that * ships red is a suite somebody switches off in its first week, and the * point of it is to hold the line while the four known gaps are closed one * at a time — each of which adds a rule here in the commit that fixes it. * * ## Consuming it * * ```typescript * import { describe, expect, it } from 'vitest' * import { defineProviderDriverConformance } from '@namzu/sdk/testing' * * defineProviderDriverConformance({ * describe, it, expect, * label: 'anthropic', * registryType: 'anthropic', * makeProvider: () => new AnthropicProvider({ apiKey: 'test' }), * }) * ``` */ /** The contract revision a driver declares itself written against. */ export declare const PROVIDER_DRIVER_CONTRACT_VERSION = 1; export interface ProviderDriverConformanceOptions { readonly describe: ConformanceDescribe; readonly it: ConformanceIt; readonly expect: ConformanceExpect; /** * The string this driver is registered under. Asserted to equal `id`, * because the two are used interchangeably at call sites — a chain * member names one and a `ProviderRegistry` lookup uses the other — and * a driver where they differ resolves for some callers and not others. */ readonly registryType: string; /** * Built once per case. No case may depend on another's state, and a * driver that holds a connection gets a fresh one rather than a shared * instance the suite would then have to clean. */ readonly makeProvider: () => LLMProvider | Promise; /** * What this driver declares as its retry defaults, restated here. * * REQUIRED, and required as a value rather than inferred from the * driver, so a new package cannot skip the decision by not thinking * about it. `undefined` is a legitimate answer — it means the generic * default suits this vendor — but it has to be written down, which is * the difference between a decision and an omission. */ readonly retryDefaults: Partial | undefined; /** * Whether this driver identifies the kernel to its vendor, and if not * why not. * * REQUIRED for the same reason `retryDefaults` is: a package that never * decided should not typecheck. `'unsupported'` is a legitimate answer * — one vendor's client speaks a websocket protocol with no header seam * — but it has to carry a reason, so the next reader learns whether it * is impossible or merely undone. */ readonly attribution: { kind: 'header'; } | { kind: 'unsupported'; reason: string; }; /** Names the driver in test output. Defaults to `provider driver`. */ readonly label?: string; } export declare function defineProviderDriverConformance(options: ProviderDriverConformanceOptions): void; export {}; //# sourceMappingURL=conformance.d.ts.map