/**
 * Unified payload for sending visual changes from Rivet UI to Claude Code via MCP.
 * Replaces DesignIntent — covers style diffs, text diffs, and free-text comments
 * in a single discriminated array.
 */
export interface ChangeRequest {
    changes: ChangeItem[];
    /**
     * When set, this batch targets a specific agent-variants variant rather than
     * the base project — every change item in the batch belongs to that variant.
     * Set by the UI; the server validates it resolves to a settled, editable
     * worktree and populates {@link ChangeRequest.worktreePath}. Absent ⇒ the
     * change applies to the base project (today's behavior). v1 forbids mixing
     * targets in one batch.
     */
    target?: ChangeRequestTarget;
    /**
     * Absolute path to the target variant's git worktree, resolved server-side
     * from {@link ChangeRequest.target}. The agent applies the changes here
     * instead of the base project. Server-set only — the UI leaves it undefined.
     */
    worktreePath?: string;
    /**
     * Server-resolved target for HTML-only variant previews. These batches are
     * handled by the variants MCP refinement flow and must not edit base files.
     */
    staticPreviewTarget?: StaticPreviewChangeTarget;
    /**
     * Deduplicated source file paths across all change items.
     * Empty for a given element means Claude should search by className/xpath.
     */
    sourceFiles: string[];
    /**
     * Optional analytics correlation fields captured in the browser and forwarded
     * to MCP backend telemetry so backend lifecycle events can link to replay sessions.
     */
    telemetryContext?: TelemetryContext;
    /**
     * Stable correlation ID for a single apply request across UI, bridge, and telemetry.
     */
    traceId?: string;
    /**
     * Unique run identifier for the apply lifecycle.
     */
    agentRunId?: string;
}
/**
 * Session correlation context captured in the browser at send time.
 * Field names stay product-agnostic; TelemetryService maps these to analytics properties.
 */
export interface TelemetryContext {
    browserSessionId?: string;
    browserDistinctId?: string;
}
/** Identifies the agent-variants variant a change batch applies to. */
export interface ChangeRequestTarget {
    kind: 'variant';
    /** sessionId of the agent-variants flow that owns the variant. */
    sessionId: string;
    /** workItemId of the variant within that session. */
    variantId: string;
}
/** Identifies a static HTML variant preview targeted by a change batch. */
export interface StaticPreviewChangeTarget {
    kind: 'static_preview';
    /** sessionId of the agent-variants flow that owns the variant. */
    sessionId: string;
    /** workItemId of the static_preview variant within that session. */
    variantId: string;
}
export type ChangeItem = StyleChangeItem | TextChangeItem | CommentChangeItem | ChatChangeItem | VariantChangeItem;
/** A CSS property change with an exact before/after diff */
export interface StyleChangeItem {
    kind: 'style';
    element: ElementRef;
    property: string;
    from: string;
    to: string;
}
/** A text content change with an exact before/after diff */
export interface TextChangeItem {
    kind: 'text';
    element: ElementRef;
    from: string;
    to: string;
}
/**
 * A free-text instruction pinned to an element.
 * Claude interprets and applies it using element + sourceFiles as context.
 * If sourceFiles is empty, className and xpath are sufficient to search the codebase.
 */
export interface CommentChangeItem {
    kind: 'comment';
    element: ElementRef;
    /** Optional multi-target context for shared comments. */
    elements?: ElementRef[];
    /** Per-comment variant target used when one static-preview batch spans variants. */
    target?: ChangeRequestTarget;
    /** Server-resolved static-preview target for this comment. */
    staticPreviewTarget?: StaticPreviewChangeTarget;
    instruction: string;
    /** Base64 data-URL images attached as visual reference for the instruction */
    images?: string[];
    /**
     * Variants the user attached as @-mention context for this comment. Carries
     * the wire shape only — the MCP intake resolves each `(sessionId, variantId)`
     * to a worktree/files path before the agent prompt is built. Unresolvable
     * references are dropped with a warning instead of failing intake.
     */
    references?: CommentReferenceItem[];
    /**
     * Resolved-on-the-server counterpart of {@link references}: each wire
     * reference promoted to a readable directory + label/brief. The MCP tool
     * surface includes these in the response to the agent so it can read the
     * referenced variant's source with its existing file tools.
     */
    resolvedReferences?: ResolvedCommentReference[];
    /**
     * Marks this comment as a request to run the MCP variants flow on the
     * targeted element instead of performing a direct apply. Undefined → standard
     * comment apply. When present, the MCP server skips beginApplyingRun and
     * routes the batch through propose_variants → approval → continue → commit.
     */
    variantRequest?: {
        count: number;
    };
}
/**
 * Wire shape of an attached variant reference. `origin` lets the server pick
 * the right resolution path: `live` → orchestrator-resolved worktree of an
 * active session, `history` → on-disk snapshot under `.rivet/variants/`.
 */
export interface CommentReferenceItem {
    sessionId: string;
    variantId: string;
    label: string;
    origin: 'live' | 'history';
}
/**
 * Server-stamped resolution of a {@link CommentReferenceItem}. The MCP intake
 * resolves each wire reference to a directory the agent can read with its
 * existing file tools; the agent uses these alongside the comment instruction
 * to decide what context to pull in. References that fail to resolve are
 * dropped before the agent ever sees the batch.
 */
export interface ResolvedCommentReference {
    sessionId: string;
    variantId: string;
    label: string;
    /** Short descriptor (the brief used to generate the variant), when known. */
    brief?: string;
    /** Absolute path to the variant's source root. For `live` references this
     *  is the worktree path; for `history` references it's
     *  `<workspaceRoot>/.rivet/variants/<sid>/<vid>/files/`. */
    path: string;
    origin: 'live' | 'history';
}
/**
 * A free-text chat instruction not tied to any specific element.
 * Claude interprets and applies it using the full codebase as context.
 */
export interface ChatChangeItem {
    kind: 'chat';
    instruction: string;
    /** Base64 data-URL images attached as visual reference */
    images?: string[];
}
/**
 * A user-picked variant from the agent-driven variants flow.
 * Carries either a unified diff (existing-project refinement / zero-to-one)
 * or a new-project handoff payload pointing at a worktree on disk.
 *
 * Agents apply it the same way they apply any other ChangeItem: read the
 * payload, apply via their own file-write tools.
 */
export interface VariantChangeItem {
    kind: 'variant';
    /** sessionId of the agent-variants flow that produced this pick */
    sourceSessionId: string;
    /** workItemId of the chosen variant within that session */
    variantId: string;
    /** Human label (e.g. "Spring blur") for telemetry/UX */
    variantLabel: string;
    /** Where the user wants the result to land on disk */
    destinationPath: string;
    /** Number of files in the variant's diff or scaffold output */
    changedFilesCount: number;
    payload: {
        kind: 'diff';
        /** Unified diff vs the worktree baseline; apply with `git apply` */
        diff: string;
        /** Refinement target (element/file/route), when applicable */
        target?: {
            type: 'element' | 'file' | 'route';
            ref: string;
        };
    } | {
        kind: 'diff-applied';
        /** Unified diff that has already been applied to the user's working
         *  tree (uncommitted). Included for telemetry / audit only — agents
         *  MUST NOT re-apply via `git apply`. Just inform the user and
         *  proceed. */
        diff: string;
        /** Refinement target (element/file/route), when applicable */
        target?: {
            type: 'element' | 'file' | 'route';
            ref: string;
        };
        /** Human-readable summary of what the server did. */
        note: string;
    } | {
        kind: 'project-created';
        /** Project files have already been copied to `destinationPath` and an
         *  initial commit landed. The agent only needs to optionally run
         *  `npm install` and continue from there — no further file
         *  operations are required. */
        note: string;
    };
}
/**
 * Minimal element identity for locating the right component in source files.
 * No computedStyles — Claude reads sourceFiles directly for better fidelity
 * (preserves Tailwind class names, CSS variables, etc. over resolved browser values).
 */
export interface ElementRef {
    xpath: string;
    tagName: string;
    className: string;
    id: string;
    filePaths: string[];
    rivetId?: string;
    textContent?: string;
    attributes?: Record<string, string>;
    componentTree?: Array<{
        name: string;
        type?: string;
        depth?: number;
    }>;
    parentElementSummary?: {
        tagName: string;
        className: string;
        textSnippet: string;
    };
}
//# sourceMappingURL=change-request-types.d.ts.map