/** * ARD (Agentic Resource Discovery) 1.0 catalog export. * * Maps selected Agent Harness assets to the current public ARD schemas and * writes `.well-known/ard.json` (the ArdManifest consumers are REQUIRED to * fetch, spec v0.91 §5.1) plus `.well-known/ai-catalog.json` (the AI-catalog * predecessor manifest, kept as a legacy courtesy) — both atomically. */ import { ARD_SPEC_VERSION, getArdPublisherFqdn } from "./ard/types.js"; import type { AssetCatalogEntry } from "./types.js"; /** ARD 1.0 trust manifest subset emitted by Agent Harness. */ export interface ArdTrustManifest { identity: string; identityType?: "spiffe" | "did" | "https" | "other"; } interface ArdCatalogEntryBase { identifier: string; displayName: string; type: string; description?: string; capabilities?: string[]; representativeQueries?: string[]; version?: string; updatedAt?: string; tags?: string[]; metadata?: Record; trustManifest?: ArdTrustManifest; } /** ARD requires exactly one of `url` and `data`. */ export type ArdCatalogEntry = ArdCatalogEntryBase & ({ url: string; data?: never; } | { data: Record; url?: never; }); /** Current public ARD ai-catalog root object. */ export interface ArdCatalog { specVersion: typeof ARD_SPEC_VERSION; host?: { displayName: string; identifier?: string; documentationUrl?: string; trustManifest?: ArdTrustManifest; }; entries: ArdCatalogEntry[]; } /** * ARD v0.91 ArdManifest root object for `/.well-known/ard.json`. * * The schema requires only `entries[]` of ArdEntry (each of which requires * identifier, displayName, type, and exactly one of url/data). Any other * top-level members are transport-defined and ignored by ARD, so the minimal * faithful shape omits the ai-catalog envelope fields entirely. */ export interface ArdManifest { entries: ArdCatalogEntry[]; } /** Re-export publisher FQDN helper for external callers. */ export { getArdPublisherFqdn }; /** * Builds a current ARD identifier. * Format: `urn:air:::`. */ export declare function buildArdUrn(entry: AssetCatalogEntry, publisherFqdn: string): string; declare function sanitizePublisherFqdn(value: string): string; declare function sanitizeUrnSegment(value: string, fallback: string): string; /** * Emits a minimal ARD 1.0 trust identity only when Agent Harness has a reason * to claim publisher identity. Local trust flags are not converted into ARD * attestations because the public schema requires verifiable URI/mediaType * evidence for every attestation. */ export declare function deriveArdTrustManifest(entry: AssetCatalogEntry): ArdTrustManifest | undefined; /** Omits missing, invalid, or epoch-sentinel update timestamps. */ export declare function resolveArdUpdatedAt(entry: AssetCatalogEntry): string | undefined; /** Maps one Agent Harness asset to a schema-valid ARD 1.0 entry. */ export declare function mapEntryToArd(entry: AssetCatalogEntry, publisherFqdn: string, version: string): ArdCatalogEntry; declare function resolveHttpUrl(value: string | undefined): string | undefined; declare function buildRepresentativeQueries(entry: AssetCatalogEntry): string[]; /** Formatter signature injected by tests or backed by Prettier at runtime. */ export type PrettierFormatter = (source: string, options: { parser: string; endOfLine: "lf" | "crlf" | "cr" | "auto"; trailingComma: "all" | "es5" | "none"; }) => Promise; /** Writes the selected catalog as ARD 1.0 JSON (both manifest files). */ export declare function writeArdCatalog(projectRoot: string, version?: string, formatWithPrettier?: PrettierFormatter): Promise<{ filePath: string; ardFilePath: string; entryCount: number; }>; /** Extracts a readable message from an unknown thrown value. */ export declare function extractErrorMessage(error: unknown): string; /** Exposes ARD conversion helpers for focused tests without widening runtime APIs. */ export declare const ardCatalogInternals: { resolveHttpUrl: typeof resolveHttpUrl; sanitizePublisherFqdn: typeof sanitizePublisherFqdn; sanitizeUrnSegment: typeof sanitizeUrnSegment; buildRepresentativeQueries: typeof buildRepresentativeQueries; };