"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ERROR_CODES = exports.getVariantInput = exports.listPastVariantsInput = exports.variantHistoryStatusSchema = exports.startVariantsInput = exports.startVariantsBriefContent = exports.startVariantsMode = exports.cancelVariantInput = exports.cancelVariantsInput = exports.extractInspirationContextInput = exports.reportVariantCompleteInput = exports.reportVariantCompleteStatus = exports.continueVariantsInput = exports.continueVariantsAction = exports.commitVariantInput = exports.approveVariantBriefsInput = exports.reportSourcePlanInput = exports.sourcePlanArtifactSchema = exports.reportVariantBriefsInput = exports.proposeVariantsInput = exports.runLabelSchema = exports.VARIANT_COUNT_MAX = exports.VARIANT_COUNT_MIN = exports.briefSchema = exports.targetSchema = exports.VARIANT_ARTIFACT_KINDS = exports.projectContextSchema = exports.projectContextFresh = exports.executionCapabilityPlanSchema = exports.assetPlanEntrySchema = exports.executionConfidenceSchema = exports.executionModeSchema = exports.sourceContextInputSchema = exports.sourceContextArtifactSchema = exports.sourceRoleEntrySchema = exports.sourceRoleSchema = exports.sourceArtifactInputSchema = exports.sourceArtifactKindSchema = exports.designContextEntrySchema = exports.sourceIntentArtifactSchema = exports.sourceIntentEntrySchema = exports.sourceIntentConfidenceSchema = exports.sourceIntentRoleSchema = exports.projectContextExisting = exports.WORK_ITEM_STATUSES = exports.WORK_ITEM_KINDS = exports.TERMINAL_STAGES = exports.STAGES = void 0;
const v3_1 = require("zod/v3");
const errors_1 = require("./errors");
Object.defineProperty(exports, "ERROR_CODES", { enumerable: true, get: function () { return errors_1.ERROR_CODES; } });
const inspirationDesignContext_1 = require("./inspirationDesignContext");
// --- Stages ---------------------------------------------------------------
exports.STAGES = [
    'awaiting_source_plan',
    'awaiting_briefs',
    'awaiting_approval',
    'work_items_ready',
    'waiting_for_results',
    'ready',
    'degraded',
    'failed',
    'cancelled',
];
exports.TERMINAL_STAGES = new Set([
    'ready',
    'degraded',
    'failed',
    'cancelled',
]);
// --- Work items -----------------------------------------------------------
exports.WORK_ITEM_KINDS = [
    'source_plan',
    'brief',
    'scaffold_base',
    'static_preview',
    'refine_variant',
    'code_gen',
    'cleanup_runtime',
];
exports.WORK_ITEM_STATUSES = [
    'pending',
    'running',
    'succeeded',
    'failed',
    'cancelled',
];
// --- Project context ------------------------------------------------------
exports.projectContextExisting = v3_1.z.object({
    kind: v3_1.z.literal('existing'),
});
const DESIGN_CONTEXT_MARKDOWN_MAX_LENGTH = 50_000;
const DESIGN_CONTEXT_SLUG_MAX_LENGTH = 120;
const SOURCE_URL_MAX_LENGTH = 2_048;
const SOURCE_ARTIFACT_LABEL_MAX_LENGTH = 80;
const SOURCE_ARTIFACT_CONTENT_MAX_LENGTH = 8_000;
const SOURCE_FINDING_MAX_LENGTH = 400;
const SOURCE_LIST_MAX_ITEMS = 24;
const SOURCE_SCREENSHOT_MAX_ITEMS = 16;
// --- Source intent ---------------------------------------------------------
exports.sourceIntentRoleSchema = v3_1.z.enum([
    'design_source',
    'interaction_reference',
    'asset_source',
    'content_reference',
    'other',
]);
exports.sourceIntentConfidenceSchema = v3_1.z.enum(['low', 'medium', 'high']);
/**
 * One classified source in the agent's `sourceIntent`. Identified by exactly
 * one of:
 *  - `url`: an inspiration URL the user provided
 *  - `imageRef`: a stable per-session reference of the form `image:<index>`
 *    pointing at an image-kind entry in `sourceArtifacts` (visualBrief or
 *    screenshotNotes). Indexed over image-kind artifacts only, so the ref
 *    survives reordering of text-only artifacts.
 */
exports.sourceIntentEntrySchema = v3_1.z
    .object({
    url: v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH).optional(),
    imageRef: v3_1.z.string().min(1).max(64).optional(),
    role: exports.sourceIntentRoleSchema,
    confidence: exports.sourceIntentConfidenceSchema,
    reason: v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH),
})
    .refine((entry) => Boolean(entry.url) !== Boolean(entry.imageRef), {
    message: 'sourceIntent entry must specify exactly one of `url` or `imageRef`.',
});
exports.sourceIntentArtifactSchema = v3_1.z.object({
    sources: v3_1.z.array(exports.sourceIntentEntrySchema).min(1).max(SOURCE_LIST_MAX_ITEMS),
});
exports.designContextEntrySchema = v3_1.z.discriminatedUnion('kind', [
    v3_1.z.object({
        kind: v3_1.z.literal('slug'),
        slug: v3_1.z.string().min(1).max(DESIGN_CONTEXT_SLUG_MAX_LENGTH),
    }),
    v3_1.z.object({
        kind: v3_1.z.literal('markdown'),
        content: v3_1.z.string().min(1).max(DESIGN_CONTEXT_MARKDOWN_MAX_LENGTH),
        label: v3_1.z.string().min(1).max(60),
    }),
]);
exports.sourceArtifactKindSchema = v3_1.z.enum([
    'urlText',
    'siteBrief',
    'visualBrief',
    'screenshotNotes',
    'motionBrief',
]);
exports.sourceArtifactInputSchema = v3_1.z.object({
    kind: exports.sourceArtifactKindSchema,
    label: v3_1.z.string().min(1).max(SOURCE_ARTIFACT_LABEL_MAX_LENGTH),
    content: v3_1.z.string().min(1).max(SOURCE_ARTIFACT_CONTENT_MAX_LENGTH),
});
exports.sourceRoleSchema = v3_1.z.enum([
    'primary',
    'inspiration',
    'competitor',
]);
exports.sourceRoleEntrySchema = v3_1.z.object({
    url: v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH),
    role: exports.sourceRoleSchema,
    rationale: v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH).optional(),
});
exports.sourceContextArtifactSchema = v3_1.z.object({
    sourceFindings: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH))
        .min(1)
        .max(SOURCE_LIST_MAX_ITEMS),
    sectionInventory: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH))
        .min(1)
        .max(SOURCE_LIST_MAX_ITEMS),
    visualObservations: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH))
        .min(1)
        .max(SOURCE_LIST_MAX_ITEMS),
    sourceRoles: v3_1.z.array(exports.sourceRoleEntrySchema).min(1).max(SOURCE_LIST_MAX_ITEMS),
    qualityBar: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH))
        .min(1)
        .max(SOURCE_LIST_MAX_ITEMS),
    screenshotReferences: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH))
        .max(SOURCE_SCREENSHOT_MAX_ITEMS)
        .optional(),
    risks: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH))
        .max(SOURCE_LIST_MAX_ITEMS)
        .optional(),
});
exports.sourceContextInputSchema = v3_1.z.object({
    sourceUrls: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH))
        .max(SOURCE_LIST_MAX_ITEMS)
        .optional(),
    preserveBrand: v3_1.z.boolean().optional(),
    sourceArtifacts: v3_1.z
        .array(exports.sourceArtifactInputSchema)
        .max(SOURCE_LIST_MAX_ITEMS)
        .optional(),
    artifact: exports.sourceContextArtifactSchema.optional(),
    sourceIntent: exports.sourceIntentArtifactSchema.optional(),
    designDecision: v3_1.z.enum(['let_rivet_choose', 'go_custom']).optional(),
});
// --- Execution capability planning ---------------------------------------
exports.executionModeSchema = v3_1.z.enum(['static_preview', 'vite_app']);
exports.executionConfidenceSchema = v3_1.z.enum(['low', 'medium', 'high']);
/**
 * One file to copy from an absolute disk path into the generated project.
 * `destination` is project-relative (e.g. `public/assets/avatar.glb`);
 * `referenceAs` is the served path the generated code should use (e.g.
 * `/assets/avatar.glb`). The agent decides asset routing at planning time
 * so MCP can materialize the same layout for every variant.
 */
exports.assetPlanEntrySchema = v3_1.z.object({
    source: v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH),
    destination: v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH),
    referenceAs: v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH),
});
exports.executionCapabilityPlanSchema = v3_1.z.object({
    mode: exports.executionModeSchema,
    confidence: exports.executionConfidenceSchema,
    reason: v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH),
    assetPlan: v3_1.z
        .array(exports.assetPlanEntrySchema)
        .max(SOURCE_LIST_MAX_ITEMS)
        .optional(),
    runtimeRequirements: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH))
        .max(SOURCE_LIST_MAX_ITEMS)
        .optional(),
    userQuestion: v3_1.z.string().min(1).max(SOURCE_FINDING_MAX_LENGTH).optional(),
});
exports.projectContextFresh = v3_1.z.object({
    kind: v3_1.z.literal('fresh'),
    /** Where the generated subproject's files live (e.g.
     *  `fable-eng-demo/.rivet/marketing-clone/`). This is the materialize
     *  target — the agent reads/writes index.html, src/, etc. here. */
    workspacePath: v3_1.z.string().min(1),
    /** The user's working directory that owns *all* Rivet artifacts for the
     *  session (e.g. `fable-eng-demo`). `<workspaceRoot>/.rivet/` holds
     *  generated subprojects, variant history, and create-project manifests.
     *  Distinct from `path.dirname(workspacePath)` because subprojects nest
     *  inside `.rivet/` — the dirname would resolve to the `.rivet` dir,
     *  not the workspace itself. */
    workspaceRoot: v3_1.z.string().min(1),
    framework: v3_1.z.enum(['vite', 'next', 'astro', 'remix']).optional(),
    assetSourceRoot: v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH).optional(),
    /** Per-variant-slot design context. Slug entries resolve bundled catalog
     *  markdown; markdown entries are written directly as `DESIGN.md`. The
     *  order matches code-gen variant slot order. */
    designContext: v3_1.z.array(exports.designContextEntrySchema).optional(),
    sourceContext: exports.sourceContextInputSchema.optional(),
    /** Agent-supplied execution plan from `report_source_plan`. Drives the
     *  generation routing decision at approve() time: `static_preview` keeps
     *  the lightweight HTML-only path; `vite_app` provisions a real Vite
     *  worktree per variant and copies any large assets from `assetPlan`. */
    executionPlan: exports.executionCapabilityPlanSchema.optional(),
});
exports.projectContextSchema = v3_1.z.discriminatedUnion('kind', [
    exports.projectContextExisting,
    exports.projectContextFresh,
]);
// --- Variant session artifacts -------------------------------------------
/**
 * Kinds of supporting artifact a variants session can surface to the UI.
 * `design_context` is the only kind populated today (the DESIGN.md used or
 * generated for a 0→1 run); the other kinds reserve shape for source
 * research bundles, QA reports, and persisted asset manifests so the
 * snapshot contract stays stable as those land.
 */
exports.VARIANT_ARTIFACT_KINDS = [
    'design_context',
    'source_context',
    'qa_report',
    'asset',
];
// --- Target ---------------------------------------------------------------
exports.targetSchema = v3_1.z.object({
    type: v3_1.z.enum(['element', 'file', 'route']),
    ref: v3_1.z.string().min(1),
});
// --- Briefs ---------------------------------------------------------------
exports.briefSchema = v3_1.z.object({
    briefId: v3_1.z.string().min(1),
    label: v3_1.z
        .string()
        .min(1)
        .max(48)
        .describe('A 1–5 word, plain-English title that names what THIS direction actually changes, so the user instantly understands its intent. Describe the change, not the vibe — no marketing language, no evocative adjectives. Good: "Sticky header", "Collapsible sidebar", "Two-column layout", "Larger hero image", "Dark mode". Bad: "Spring blur", "Linear sharp", "Bold & immersive". Rendered as the variant card title in the UI.'),
    body: v3_1.z
        .string()
        .min(1)
        .max(200)
        .describe('One plain-English sentence describing the single MOST IMPORTANT change this variant makes relative to the baseline — pick the one diff that matters most (usually a motion, color, animation, or layout change) and don\'t try to list every change. Write a normal, readable, complete sentence: no arrows, no abbreviations, no value codes, no clause lists joined by ";". Say "from blue to green", not "blue → green"; "fades in", not "200ms ease-in". Keep it functional and plain — not flowery or marketing (avoid "gentle", "elegant", "modern", "smooth", "clean") — but a real sentence a person would say. Good: "The pages cross-dissolve into each other instead of cutting."; "The accent color shifts from blue to green."; "Cards fade in one after another instead of all at once."; "The layout becomes two columns on wider screens." No bullets, no line breaks.'),
    /**
     * Optional per-brief visual reference URL. Uses the same synchronous
     * network-target guard as inspiration URLs before downstream agents fetch it.
     */
    visualReferenceUrl: v3_1.z
        .string()
        .url()
        .refine((url) => (0, inspirationDesignContext_1.validateInspirationUrl)(url).ok, {
        message: 'visualReferenceUrl must be an HTTP(S) URL that does not target local or private networks',
    })
        .optional()
        .describe('Optional HTTP(S) inspiration URL. Subject to SSRF guard — must not resolve to local or private network targets.'),
});
// --- Tool I/O — propose_variants ------------------------------------------
/**
 * Inclusive bounds for the number of variants a single propose_variants run
 * may produce. Exported as named constants so the UI (parseVariantCount),
 * the /api/mcp/queue-changes intake Zod schema, and the propose_variants tool
 * schema all consume the same source of truth.
 */
exports.VARIANT_COUNT_MIN = 2;
exports.VARIANT_COUNT_MAX = 8;
/** Optional agent-supplied label for the *run's* intent, shared by every
 *  variant. Keep it to the prompt's core change, not an evocative name. */
exports.runLabelSchema = v3_1.z
    .string()
    .min(1)
    .max(40)
    .optional()
    .describe('A 1–2 word, plain-English label for the INTENT of THIS run — the change the prompt asks for, shared by every variant (NOT a per-variant name). Name the change, not the vibe; no marketing or evocative adjectives. e.g. prompt "make it brighter and more vibrant" → "Brighter"; "add a sticky header" → "Sticky Header". Shown on every variant row. Omit it only if you truly can\'t summarize the intent — Rivet then derives one heuristically.');
exports.proposeVariantsInput = {
    sessionId: v3_1.z.string().optional(),
    clientRequestId: v3_1.z.string().optional(),
    prompt: v3_1.z.string().min(1),
    count: v3_1.z
        .number()
        .int()
        .min(exports.VARIANT_COUNT_MIN)
        .max(exports.VARIANT_COUNT_MAX)
        .optional(),
    target: exports.targetSchema.optional(),
    projectContext: exports.projectContextSchema.optional(),
    runLabel: exports.runLabelSchema,
};
// --- Tool I/O — report_variant_briefs -------------------------------------
exports.reportVariantBriefsInput = {
    sessionId: v3_1.z.string().min(1),
    workItemId: v3_1.z.string().min(1),
    attempt: v3_1.z.number().int().nonnegative(),
    leaseId: v3_1.z.string().optional(),
    briefs: v3_1.z.array(exports.briefSchema).min(1).max(8),
};
// --- Tool I/O — report_source_plan ----------------------------------------
/**
 * One agent-extracted DESIGN.md, keyed by exactly one of:
 *  - `url`: the inspiration URL the agent fetched via browser extraction
 *  - `imageRef`: a stable `image:<index>` reference matching an image-kind
 *    entry in the session's `sourceArtifacts` (see `buildImageRefs` in
 *    SessionStore for index semantics)
 */
const browserDesignContextSchema = v3_1.z
    .object({
    url: v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH).optional(),
    imageRef: v3_1.z.string().min(1).max(64).optional(),
    label: v3_1.z.string().min(1).max(60),
    markdown: v3_1.z.string().min(1).max(DESIGN_CONTEXT_MARKDOWN_MAX_LENGTH),
})
    .refine((entry) => Boolean(entry.url) !== Boolean(entry.imageRef), {
    message: 'designContexts entry must specify exactly one of `url` or `imageRef`.',
});
/**
 * Consolidated planning artifact reported by the agent in a single tool call.
 * Combines URL/role classification, research findings, browser-extracted
 * DESIGN.md per design_source URL, and the static_preview vs vite_app
 * execution decision. Replaces the prior `report_source_intent` +
 * `report_source_context` round-trips so source-grounded sessions only need
 * one planning hop before briefs.
 */
exports.sourcePlanArtifactSchema = v3_1.z.object({
    sourceIntent: exports.sourceIntentArtifactSchema,
    sourceContext: exports.sourceContextArtifactSchema,
    designContexts: v3_1.z
        .array(browserDesignContextSchema)
        .max(SOURCE_LIST_MAX_ITEMS)
        .optional(),
    executionPlan: exports.executionCapabilityPlanSchema,
});
exports.reportSourcePlanInput = {
    sessionId: v3_1.z.string().min(1),
    workItemId: v3_1.z.string().min(1),
    attempt: v3_1.z.number().int().nonnegative(),
    leaseId: v3_1.z.string().min(1),
    sourcePlan: exports.sourcePlanArtifactSchema,
};
// --- Tool I/O — approve_variant_briefs ------------------------------------
exports.approveVariantBriefsInput = {
    sessionId: v3_1.z.string().min(1),
    briefIds: v3_1.z.array(v3_1.z.string().min(1)).min(1).max(8).optional(),
    confirmedByUser: v3_1.z.boolean().optional(),
    bypassRequestedByUser: v3_1.z.boolean().optional(),
    bypassReason: v3_1.z.string().min(1).optional(),
    selections: v3_1.z
        .array(v3_1.z.object({
        briefId: v3_1.z.string().min(1),
        bodyOverride: v3_1.z.string().optional(),
    }))
        .min(1)
        .max(8)
        .optional(),
};
// --- Tool I/O — commit_variant --------------------------------------------
exports.commitVariantInput = {
    sessionId: v3_1.z.string().min(1),
    variantId: v3_1.z.string().min(1),
    confirmedByUser: v3_1.z.boolean().optional(),
    bypassRequestedByUser: v3_1.z.boolean().optional(),
    bypassReason: v3_1.z.string().min(1).optional(),
};
// --- Tool I/O — continue_variants -----------------------------------------
exports.continueVariantsAction = v3_1.z
    .enum(['check', 'wait', 'request_work', 'refine_variant'])
    .optional();
exports.continueVariantsInput = {
    sessionId: v3_1.z.string().min(1),
    clientRequestId: v3_1.z.string().optional(),
    action: exports.continueVariantsAction,
    requestedLeaseCount: v3_1.z.number().int().min(1).max(8).optional(),
    variantId: v3_1.z.string().min(1).optional(),
    instruction: v3_1.z.string().min(1).optional(),
};
// --- Tool I/O — report_variant_complete -----------------------------------
exports.reportVariantCompleteStatus = v3_1.z.enum([
    'running',
    'succeeded',
    'failed',
    'cancelled',
]);
exports.reportVariantCompleteInput = {
    sessionId: v3_1.z.string().min(1),
    workItemId: v3_1.z.string().min(1),
    leaseId: v3_1.z.string().min(1),
    attempt: v3_1.z.number().int().nonnegative(),
    status: exports.reportVariantCompleteStatus,
    output: v3_1.z.unknown().optional(),
    error: v3_1.z
        .object({
        code: v3_1.z.string(),
        message: v3_1.z.string(),
    })
        .optional(),
    terminalChunk: v3_1.z.string().optional(),
    // Optional benchmark instrumentation: tokens consumed by the agent
    // generating this variant. Forwarded to PostHog for HTML vs full-stack
    // cost comparison. Agents that don't have this info can omit the fields.
    tokensIn: v3_1.z.number().int().nonnegative().optional(),
    tokensOut: v3_1.z.number().int().nonnegative().optional(),
    model: v3_1.z.string().optional(),
};
// --- Tool I/O — extract_inspiration_context ------------------------------
/**
 * Stateless inspiration-extraction kickoff. Agents call this before
 * `start_variants(mode='zero_to_one')` when the user provides inspiration
 * URLs or other source artifacts, then pass the returned `designContext`
 * (and optional `sourceContext` echo) into `start_variants`.
 */
exports.extractInspirationContextInput = {
    prompt: v3_1.z.string().min(1),
    count: v3_1.z.number().int().min(exports.VARIANT_COUNT_MIN).max(exports.VARIANT_COUNT_MAX),
    urls: v3_1.z
        .array(v3_1.z.string().min(1).max(SOURCE_URL_MAX_LENGTH))
        .max(SOURCE_LIST_MAX_ITEMS)
        .optional(),
    preserveBrand: v3_1.z.boolean().optional(),
    sourceArtifacts: v3_1.z
        .array(exports.sourceArtifactInputSchema)
        .max(SOURCE_LIST_MAX_ITEMS)
        .optional(),
    /** When true, bypass any cache entry and force a fresh fetch + extract. */
    forceRefresh: v3_1.z.boolean().optional(),
    /** Caller-supplied correlation id, echoed into telemetry so this stateless
     *  extraction can be tied to the subsequent `start_variants` call (which
     *  accepts the same field) even though no session exists yet. */
    clientRequestId: v3_1.z.string().optional(),
};
// --- Tool I/O — cancel_variants -------------------------------------------
exports.cancelVariantsInput = {
    sessionId: v3_1.z.string().min(1),
    reason: v3_1.z.string().optional(),
};
// --- Tool I/O — cancel_variant (per-variant) -----------------------------
exports.cancelVariantInput = {
    sessionId: v3_1.z.string().min(1),
    variantId: v3_1.z.string().min(1),
    reason: v3_1.z.string().optional(),
};
// --- Tool I/O — start_variants (unified kickoff) -------------------------
exports.startVariantsMode = v3_1.z
    .enum(['existing', 'zero_to_one'])
    .describe('"existing": vary an existing project at projectPath/cwd (spawns code_gen items). "zero_to_one": prompt-only fresh project; server derives destinationPath (spawns static_preview items).');
/**
 * Brief content supplied by the agent through `start_variants`. The server
 * generates briefIds, so the agent only provides label + body (and an
 * optional visualReferenceUrl). Shape matches `briefSchema` minus briefId.
 */
exports.startVariantsBriefContent = exports.briefSchema.omit({ briefId: true });
exports.startVariantsInput = {
    prompt: v3_1.z.string().min(1),
    count: v3_1.z
        .number()
        .int()
        .min(exports.VARIANT_COUNT_MIN)
        .max(exports.VARIANT_COUNT_MAX)
        .optional(),
    mode: exports.startVariantsMode,
    target: exports.targetSchema.optional(),
    runLabel: exports.runLabelSchema,
    /**
     * Per-variant briefs supplied by the agent. When omitted, the server
     * falls back to a generic "Variant N" label + the prompt verbatim for
     * each body — UI shows that as the variant name/description, so the
     * agent should always supply briefs for human-readable variants. When
     * `briefs` is provided, its length determines the variant count
     * (overriding any explicit `count`).
     */
    briefs: v3_1.z
        .array(exports.startVariantsBriefContent)
        .min(exports.VARIANT_COUNT_MIN)
        .max(exports.VARIANT_COUNT_MAX)
        .optional()
        .describe('One brief per variant. `briefs.length` sets the variant count (3-5); do NOT also pass `count`. Each brief MUST describe a distinct direction — never copy the user prompt verbatim into a body. Each `label` is a 1–5 word, plain-English title naming what that direction changes (the intent the user will read), not an evocative name.'),
    /** Zero-to-one only: framework for the scaffolded project. Defaults to 'vite'. */
    framework: v3_1.z.enum(['vite']).optional(),
    /** Zero-to-one only: absolute parent directory under which Rivet derives
     *  a slugified project folder. Defaults to the user's home dir. */
    destinationParent: v3_1.z.string().optional(),
    /** Existing only: absolute path to the project. Defaults to the MCP
     *  server's current working directory. Used to detect framework and
     *  auto-open the visual editor without a separate detect_project call. */
    projectPath: v3_1.z.string().optional(),
    /** Zero-to-one only: per-variant-slot design context produced upstream by
     *  `extract_inspiration_context`. Threaded into the fresh worktree as
     *  DESIGN.md per slot. Slot order matches variant order. */
    designContext: v3_1.z.array(exports.designContextEntrySchema).optional(),
    /** Zero-to-one only: optional source-context metadata (inspiration URLs,
     *  preserveBrand flag, sourceArtifacts). Forwarded to the worktree
     *  scaffold so SOURCE_CONTEXT.md is written. */
    sourceContext: exports.sourceContextInputSchema.optional(),
    clientRequestId: v3_1.z.string().optional(),
};
// --- Tool I/O — list_past_variants / get_variant ------------------------
exports.variantHistoryStatusSchema = v3_1.z.enum([
    'completed',
    'committed',
    'rejected',
    'cancelled',
    // User dismissed the variant from the UI; retained on disk, never rendered.
    'removed',
]);
exports.listPastVariantsInput = {
    projectPath: v3_1.z.string().optional(),
    limit: v3_1.z.number().int().min(1).max(500).optional(),
    status: exports.variantHistoryStatusSchema.optional(),
};
exports.getVariantInput = {
    projectPath: v3_1.z.string().optional(),
    sessionId: v3_1.z.string().min(1),
    variantId: v3_1.z.string().min(1),
    /** When false, diff body / file list are omitted to keep responses small. */
    includeBody: v3_1.z.boolean().optional(),
};
//# sourceMappingURL=contracts.js.map