import { ResourceListResponseBody } from './sveltekit.js'; /** Immutable selector for this discovery artifact family. */ export declare const SMRT_DISCOVERY_CONFORMANCE_SCHEMA = "https://smrt.dev/schemas/discovery-conformance/v1"; /** Version of the discovery artifact payload. */ export declare const SMRT_DISCOVERY_CONFORMANCE_VERSION: 1; /** Versioned selector for structured application results and errors. */ export declare const SMRT_APP_RESULT_SCHEMA = "https://smrt.dev/schemas/app-result/v1"; /** Version of the structured application result contract. */ export declare const SMRT_APP_RESULT_VERSION: 1; /** MCP result `_meta` member carrying the app-result metadata. */ export declare const SMRT_MCP_RESULT_METADATA_KEY = "io.happyvertical/smrt"; /** JSON-safe value used by structured details and parameter schemas. */ export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue; }; /** A declared input field which controls retry or optimistic-concurrency use. */ export interface DeclaredActionField { /** JSON Schema property name supplied by the action. */ field: string; /** Whether the action marks the field required. */ required: boolean; } /** Retry and concurrency declarations projected from a command schema. */ export interface CommandRequirements { idempotencyKey?: DeclaredActionField; expectedVersion?: DeclaredActionField; } /** Machine-readable metadata shared by HTTP CLI and MCP bridge results. */ export interface AppResultMetadata { code: string; message?: string; details?: JsonValue; retryable?: boolean; correlationId?: string; idempotencyKey?: DeclaredActionField; expectedVersion?: DeclaredActionField; } export interface AppResultContract { schema: typeof SMRT_APP_RESULT_SCHEMA; version: typeof SMRT_APP_RESULT_VERSION; mcpMetadataKey: typeof SMRT_MCP_RESULT_METADATA_KEY; metadataFields: readonly [ 'code', 'message', 'details', 'retryable', 'correlationId', 'idempotencyKey', 'expectedVersion' ]; } /** Stable description of the result metadata contract contained in an artifact. */ export declare const SMRT_APP_RESULT_CONTRACT: AppResultContract; /** The pre-artifact wire payload, kept for the existing `/_resources` fields. */ export type DiscoveryPayload = Omit; export interface DiscoveryArtifactIntegrity { algorithm: 'sha256'; /** `sha256:` over canonical unsigned artifact JSON. */ digest: string; } /** Versioned payload a consumer can validate and pin. */ export interface DiscoveryConformanceArtifact { schema: typeof SMRT_DISCOVERY_CONFORMANCE_SCHEMA; version: typeof SMRT_DISCOVERY_CONFORMANCE_VERSION; discovery: DiscoveryPayload; resultContract: AppResultContract; integrity: DiscoveryArtifactIntegrity; } /** A JSON Schema export for consumers that validate artifacts outside Node. */ export declare const SMRT_DISCOVERY_CONFORMANCE_ARTIFACT_SCHEMA: { readonly $id: "https://smrt.dev/schemas/discovery-conformance/v1"; readonly type: "object"; readonly required: readonly ["schema", "version", "discovery", "resultContract", "integrity"]; readonly properties: { readonly schema: { readonly const: "https://smrt.dev/schemas/discovery-conformance/v1"; }; readonly version: { readonly const: 1; }; readonly discovery: { readonly type: "object"; readonly required: readonly ["user", "warnings", "resources"]; readonly properties: { readonly user: { readonly type: "object"; readonly required: readonly ["authenticated"]; }; readonly warnings: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly resources: { readonly type: "array"; }; }; }; readonly resultContract: { readonly type: "object"; readonly required: readonly ["schema", "version", "mcpMetadataKey", "metadataFields"]; }; readonly integrity: { readonly type: "object"; readonly required: readonly ["algorithm", "digest"]; readonly properties: { readonly algorithm: { readonly const: "sha256"; }; readonly digest: { readonly type: "string"; readonly pattern: "^sha256:[a-f0-9]{64}$"; }; }; }; }; }; /** Thrown when an artifact is malformed, non-canonical, or fails its digest. */ export declare class DiscoveryArtifactValidationError extends Error { constructor(message: string); } /** * Project conventionally named request fields from a JSON Schema into the * discovery contract. This is declarative only: the action remains the owner * of enforcement and may use a body field or adapt it to an HTTP header. */ export declare function deriveCommandRequirements(parameters: Record | undefined): CommandRequirements | undefined; /** Produce a deterministically ordered artifact with a SHA-256 integrity pin. */ export declare function createDiscoveryConformanceArtifact(discovery: DiscoveryPayload): DiscoveryConformanceArtifact; /** * Validate structure, canonical ordering, and the integrity digest. Returns * the typed artifact so consumers can use one operation for validation and * consumption. */ export declare function validateDiscoveryConformanceArtifact(value: unknown): DiscoveryConformanceArtifact; /** Canonical JSON bytes whose digest is carried by the artifact. */ export declare function canonicalizeDiscoveryArtifact(artifact: Omit): string; //# sourceMappingURL=app-contract.d.ts.map