import type { BrandApiClientOptions } from "./api/client.js"; import { type BrandKitSectionSummary } from "./kits/sections.js"; import { type UploadDocumentSource, type UploadedDocument } from "./documents/upload.js"; import type { BrandKitSummary } from "./kits/list.js"; import type { BrandDocument } from "./recipe/schema.js"; /** * Stage labels emitted via `onProgress`. Useful for callers that * surface progress (CLI streaming output, MCP progress events). */ export type SeedStage = "createKit" | "uploadDocument" | "publishKit" | "runIngestion" | "runEnrichment" | "pollSections" | "done"; export interface SeedProgressEvent { stage: SeedStage; /** Wall-clock elapsed seconds since seed start. */ elapsedSec: number; message: string; /** Populated when sections exist. */ sectionCount?: number; } export interface SeedBrandKitOptions { client: BrandApiClientOptions; /** Display name + brand name for the new kit. */ name: string; /** * Single source PDF. Must be a publicly reachable URL — Sitecore * fetches it server-side. Optional when `documents` is provided; * exactly one of `source` / `documents` must be set. */ source?: UploadDocumentSource | { url: string; }; /** * Multiple source documents — uploaded before a single ingestion + * enrichment pass. Takes precedence over `source` when non-empty. * Accepts the recipe-shaped `BrandDocument` union (URL or * registry-file). The seed runner rejects `registry-file` entries * with `INPUT_INVALID` and a clear hint — see the * `LOCAL_UPLOAD_UNSUPPORTED_MESSAGE` rationale in * `documents/upload.ts` for why bytes uploads don't work end-to-end. * Callers (orchestrator's `brandkit_deploy` handler) must translate * registry-file paths to public URLs before invoking scai. */ documents?: BrandDocument[]; /** Optional kit metadata. */ description?: string; industry?: string; /** Document metadata for the single-`source` path. */ documentTitle?: string; documentSummary?: string; /** Poll interval for the sections endpoint, seconds. Default 15. */ pollIntervalSec?: number; /** Hard timeout for waiting on sections to appear, seconds. Default 900. */ timeoutSec?: number; /** Callback for stage transitions + polling ticks. */ onProgress?: (event: SeedProgressEvent) => void; signal?: AbortSignal; } export interface SeedBrandKitResult { kit: BrandKitSummary; document: UploadedDocument; sections: BrandKitSectionSummary[]; /** Total wall-clock seconds spent. */ elapsedSec: number; } export interface EnrichExistingKitOptions { client: BrandApiClientOptions; /** Brand kit id (the API uuid, not the display name). */ brandKitId: string; /** Display name — used only for default upload metadata and log lines. */ name: string; /** One or more documents to upload before the ingest+enrich cycle. */ documents: BrandDocument[]; pollIntervalSec?: number; timeoutSec?: number; onProgress?: (event: SeedProgressEvent) => void; signal?: AbortSignal; } export interface EnrichExistingKitResult { document: UploadedDocument; sections: BrandKitSectionSummary[]; elapsedSec: number; } /** * Run the upload → publish → ingest → enrich → poll pipeline against * an EXISTING brand kit. Mirrors steps 2-6 of `seedBrandKit` without * creating a new kit — the self-heal path for bare kits that were * previously created without documents (and therefore have zero * sections). * * Why this exists: this is the document-ingestion + AI enrichment path * for operators who ship *real* source documents and want sections * populated from their content. (Kits with no source document don't need * this — `createBrandKit` + `publishBrandKit` materializes the canonical * section + field set directly, and the recipe writes values via PATCH.) */ export declare const enrichBrandKitWithDocuments: (options: EnrichExistingKitOptions) => Promise; /** * The headline composite — drive a brand kit from "doesn't exist" to * "has populated sections and is ready for Brand Review" in one call. * * Sequence (see [[project-scai-brand-kit-seed-recipe]]): * * 1. createBrandKit → draft kit * 2. uploadDocument → doc attached (status: pending) * 3. publishBrandKit → kit status: published (required!) * 4. runBrandIngestionPipeline (chunks the doc) * 5. runEnrichSectionsPipeline (populates sections from chunks) * 6. poll listBrandKitSections until the count goes from 0 to >0 * 7. return kit + doc + section list * * The `doc.status` going to `failed` mid-flight is misleading and * NOT a real error — sections still populate via enrichment, so the * composite ignores that signal and only cares about section count. * * Cost note: this triggers two paid AI pipeline runs. Each run takes * ~5 min wall-clock. Don't loop this without consent. */ export declare const seedBrandKit: (options: SeedBrandKitOptions) => Promise;