import type { RuntimeSdkPeers } from "./sdk.js"; /** * THE MATRIX. The plan pins this object verbatim. * * `winterAgentSdk` is a RANGE because the Winter SDK is this repository's sibling and moves with it. * WS-23: the `claudeAgentSdk` exact pin is gone with the official runtime it described. */ export declare const SUPPORTED: { readonly winterAgentSdk: ">=0.0.21 <0.1.0"; }; /** * The Winter wire protocol versions this router is tested against (`PROTOCOL_VERSION` in the SDK's * own `protocol/frames.ts`). Separate from `SUPPORTED` because the plan pins that object's shape and * because these are two independent identities: a wrapper can be re-released without moving its wire. */ export declare const SUPPORTED_PROTOCOL_VERSIONS: readonly ["1.0"]; /** Where a peer's package version came from. See this module's header. */ export type PeerVersionSource = "host-declared" | "peer-export" | "resolved-manifest"; export interface PeerVersionIdentity { /** The package name the identity was read for. */ packageName: string; /** The version string that was matched against the matrix. */ packageVersion: string; source: PeerVersionSource; /** The matrix entry this peer satisfied. */ supported: string; } export interface VersionMatrixReport { winterAgentSdk: PeerVersionIdentity & { protocolVersion: string; }; /** The matrix the report was produced against, so a diagnostic never has to guess. */ supported: typeof SUPPORTED; supportedProtocolVersions: readonly string[]; /** ISO-8601, so a persisted report says when it was taken. */ checkedAt: string; } interface ParsedVersion { major: number; minor: number; patch: number; /** The `-alpha.1` tail, or "" for a release. */ prerelease: string; } /** Parses `X.Y.Z`, `vX.Y.Z`, `X.Y.Z-tag`, `X.Y.Z+build`. Returns undefined for anything else. */ export declare function parseVersion(raw: string): ParsedVersion | undefined; /** * Whether `version` satisfies `range`. * * Supported forms, and deliberately only these: a space-separated conjunction of `>=`/`>`/`<=`/`<` * comparators, a caret (`^X.Y.Z`), and a bare or `=`-prefixed exact version. An UNRECOGNISED range * throws rather than returning false — a matrix entry nobody can parse is a bug in the matrix, and * silently refusing every peer would look like a peer problem. */ export declare function satisfiesRange(version: string, range: string): boolean; /** The export names a peer may use to publish its own package version, in probe order. */ export declare const VERSION_EXPORT_NAMES: readonly ["SDK_VERSION", "VERSION", "PACKAGE_VERSION", "version"]; /** Step 1: a version identity exported by the injected module namespace itself. */ export declare function readExportedVersion(namespace: unknown): string | undefined; /** * Step 2: the `version` of the copy of `packageName` THIS module can resolve. * * Walks up from the resolved entry file rather than resolving `/package.json` directly, * because a package whose `exports` map is closed to `"."` (the Winter SDK's is) does not expose its * own manifest as a subpath. Every failure mode — no such package, a manifest that will not parse, a * manifest with no `version` — returns `undefined`, which the caller turns into the loud refusal. * Never throws: a missing OPTIONAL peer must not crash the matrix on its way to reporting itself. * * `resolveEntry` is an injectable seam (R2), defaulting to the real * `createRequire(import.meta.url).resolve` — NOT deleted, still the only resolver this package ever * uses on its own. It exists so a test can simulate the one condition this package cannot otherwise * reproduce on demand: a compiled binary, where that resolve call cannot see outside the bundle * (`file:///$bunfs/...`) and always throws. Production code never passes a second argument. */ export declare function readResolvedManifestVersion(packageName: string, resolveEntry?: (name: string) => string): string | undefined; /** * The seams `resolveVersionMatrix` accepts. `resolveEntry`, when given, REPLACES probe 2's resolver * end to end (through `identityFor` into `readResolvedManifestVersion`) — the only way a test can make * that probe genuinely fail rather than merely be irrelevant because `declared` or peer-export already * answered. Production code (`assertVersionMatrix`) never supplies one. */ export interface VersionMatrixSeams { resolveEntry?: (name: string) => string; } /** * Reads the injected peer's version identity and refuses loudly on a miss. * * `declared` is `RuntimeSdkOptions.peerVersions` (R2), optional — the one-arg call * (`assertVersionMatrix(peers)`) stays legal and behaves exactly as before: with nothing declared, * every peer's identity comes from probe 1 or probe 2, unchanged. * * `seams` is test-only (R2 review r1): NOT exposed here — `resolveVersionMatrix` below is where a test * reaches it. A public seam parameter on this function is a production call site that could pass a * broken resolver by accident, for a capability real hosts never need. */ export declare function assertVersionMatrix(peers: RuntimeSdkPeers, declared?: { winterAgentSdk?: string; }): VersionMatrixReport; /** * `assertVersionMatrix`'s full implementation, with an injectable `seams` (R2 review r1, `test/spine/ * version-matrix.test.ts`'s test (d)). NOT on the package barrel (`src/index.ts`) — deliberately: a * real host has no reason to override how this package resolves ITS OWN peers' manifests, so this * function exists only so a test can force probe 2 (`resolved-manifest`) to GENUINELY fail — the one * condition a test cannot otherwise reproduce on demand (in an ordinary dev checkout the real peers * really are resolvable, so a test that never overrides the resolver cannot tell "declared won" from * "resolved-manifest would have answered the same value anyway"). `assertVersionMatrix` is the public, * one-line delegation with the real (default) seams. */ export declare function resolveVersionMatrix(peers: RuntimeSdkPeers, declared?: { winterAgentSdk?: string; }, seams?: VersionMatrixSeams): VersionMatrixReport; export {};