/**
 * `docs.read` core-SDK contract — the envelope-typed surface an external
 * consumer (the Obsidian plugin, `cleo docs view`) calls to render a single
 * CLEO doc directly from `cleo.db`, the SOLE doc authority (saga T11778).
 *
 * The response carries the doc **body** plus its full provenance **frontmatter**
 * (slug, version anchors, supersession pointers, related tasks, topics). Binary
 * or non-UTF-8 bodies are surfaced as base64 (T11825 AC2) so a consumer can
 * render images/PDFs/files stored as blobs without a second round-trip.
 *
 * Part of the T10400 core-SDK API standard — this is a typed contract, not an
 * ad-hoc shape (T11825 AC3).
 *
 * @task T11825 (Epic T11781 / Saga T11778)
 * @adr ADR-078 — Docs SSoT as provenance graph
 */
import { z } from 'zod';
/** Zod schema for {@link DocFrontmatter}. */
export const docFrontmatterSchema = z.object({
    slug: z.string(),
    kind: z.string().nullable(),
    title: z.string().nullable(),
    summary: z.string().nullable(),
    lifecycleStatus: z.string(),
    docVersion: z.number().int(),
    ownerVersion: z.string().nullable(),
    supersedes: z.string().nullable(),
    supersededBy: z.string().nullable(),
    topics: z.array(z.string()).readonly(),
    relatedTasks: z.array(z.string()).readonly(),
    sha256: z.string(),
    createdAt: z.string(),
});
/** Zod schema for {@link DocBody}. */
export const docBodySchema = z.object({
    encoding: z.enum(['utf-8', 'base64']),
    text: z.string().optional(),
    base64: z.string().optional(),
    sizeBytes: z.number().int().nonnegative(),
    mimeType: z.string().nullable(),
});
/** Zod schema for {@link DocReadResponse}. */
export const docReadResponseSchema = z.object({
    frontmatter: docFrontmatterSchema,
    body: docBodySchema,
});
/**
 * Type guard for {@link DocReadResponse}.
 *
 * @param value - Unknown value to validate.
 * @returns True when `value` conforms to the `docs.read` response schema.
 * @task T11825
 */
export function isDocReadResponse(value) {
    return docReadResponseSchema.safeParse(value).success;
}
//# sourceMappingURL=read.js.map