import type { LiveSandboxedPluginManifestV2, PluginSettingsContribution, Sha256Digest } from "./manifest-types.js";
export declare const LIVE_PLUGIN_FORMAT_VERSION: 1;
export declare const LIVE_PLUGIN_AUTHOR_KINDS: readonly ["user", "assistant", "system"];
export declare const LIVE_PLUGIN_AUTHORING_OPERATIONS: readonly ["create", "update", "restore", "reconcile"];
export declare const LIVE_PLUGIN_BRANCH_KINDS: readonly ["local", "remote", "conflict"];
export type LivePluginAuthorKind = typeof LIVE_PLUGIN_AUTHOR_KINDS[number];
export type LivePluginAuthoringOperation = typeof LIVE_PLUGIN_AUTHORING_OPERATIONS[number];
export type LivePluginBranchKind = typeof LIVE_PLUGIN_BRANCH_KINDS[number];
export interface BoundedPluginProvenanceV1 {
    readonly schemaVersion: 1;
    readonly authorKind: LivePluginAuthorKind;
    /** Authenticated, device-safe author identifier. It is NFC-normalized. */
    readonly actorId: string;
    readonly authoredAt: string;
    readonly operation: LivePluginAuthoringOperation;
    /** Optional NFC-normalized host tool identifier; never a prompt or transcript. */
    readonly toolId?: string;
}
export type BoundedPluginProvenance = BoundedPluginProvenanceV1;
export interface LivePluginContentV1 {
    readonly manifest: LiveSandboxedPluginManifestV2;
    readonly javascript: string;
    readonly css: string;
    /**
     * Optional duplicate projection for authoring tools. When present it must
     * exactly agree with manifest.contributes.settings after canonicalization.
     */
    readonly settingsSchema?: PluginSettingsContribution;
}
export interface LivePluginBundleV1 extends LivePluginContentV1 {
    readonly formatVersion: typeof LIVE_PLUGIN_FORMAT_VERSION;
    readonly pluginId: string;
    readonly apiVersion: string;
    readonly revision: Sha256Digest;
    readonly parentRevision: Sha256Digest | null;
    readonly provenance: BoundedPluginProvenanceV1;
}
export interface LivePluginPatchV1 {
    readonly manifest?: LiveSandboxedPluginManifestV2;
    readonly javascript?: string;
    readonly css?: string;
    readonly settingsSchema?: PluginSettingsContribution | null;
}
export interface LivePluginPreviewCandidateV1 {
    readonly formatVersion: typeof LIVE_PLUGIN_FORMAT_VERSION;
    readonly pluginId: string;
    readonly baseRevision: Sha256Digest | null;
    readonly content: LivePluginContentV1;
}
export interface LivePluginRevisionSummaryV1 {
    readonly pluginId: string;
    readonly revision: Sha256Digest;
    readonly parentRevision: Sha256Digest | null;
    readonly authoredAt: string;
    readonly authorKind: LivePluginAuthorKind;
    readonly operation: LivePluginAuthoringOperation;
    readonly sizeBytes: number;
}
export interface LivePluginBranchV1 {
    readonly pluginId: string;
    readonly headRevision: Sha256Digest;
    readonly parentRevision: Sha256Digest | null;
    readonly kind: LivePluginBranchKind;
    readonly observedAt: string;
}
export type LivePluginCasResultV1 = {
    readonly status: "created" | "updated" | "restored";
    readonly bundle: LivePluginBundleV1;
    readonly previousRevision: Sha256Digest | null;
} | {
    readonly status: "stale";
    readonly expectedRevision: Sha256Digest | null;
    readonly actualRevision: Sha256Digest | null;
} | {
    readonly status: "not-found";
} | {
    readonly status: "already-exists";
    readonly actualRevision: Sha256Digest;
};
export declare const LIVE_PLUGIN_VALIDATION_CODES: readonly ["live.not-object", "live.unknown-field", "live.missing-field", "live.invalid-format", "live.invalid-plugin-id", "live.invalid-api-version", "live.invalid-manifest", "live.identity-mismatch", "live.settings-mismatch", "live.invalid-source", "live.invalid-provenance", "live.invalid-revision", "live.invalid-parent", "live.size-limit", "live.empty-patch"];
export type LivePluginValidationCode = typeof LIVE_PLUGIN_VALIDATION_CODES[number];
export interface LivePluginValidationIssue {
    readonly code: LivePluginValidationCode;
    readonly path: string;
    readonly message: string;
}
export type LivePluginValidationResult = {
    readonly ok: true;
    readonly bundle: LivePluginBundleV1;
} | {
    readonly ok: false;
    readonly issues: readonly LivePluginValidationIssue[];
};
export declare class LivePluginContractError extends Error {
    readonly issues: readonly LivePluginValidationIssue[];
    readonly name = "LivePluginContractError";
    readonly code = "live-plugin-invalid";
    constructor(issues: readonly LivePluginValidationIssue[]);
}
export declare function parseBoundedPluginProvenanceV1(value: unknown): BoundedPluginProvenanceV1;
export declare function parseLivePluginContentV1(pluginId: unknown, value: unknown): LivePluginContentV1;
export declare function parseLivePluginPatchV1(value: unknown): LivePluginPatchV1;
export declare function canonicalLivePluginRevisionInput(bundle: Omit<LivePluginBundleV1, "revision"> | LivePluginBundleV1): Uint8Array;
export declare function computeLivePluginRevision(bundle: Omit<LivePluginBundleV1, "revision"> | LivePluginBundleV1): Promise<Sha256Digest>;
export declare function createLivePluginBundleV1(args: {
    pluginId: unknown;
    content: unknown;
    parentRevision: Sha256Digest | null;
    provenance: unknown;
}): Promise<LivePluginBundleV1>;
export declare function applyLivePluginPatchV1(args: {
    current: LivePluginBundleV1;
    patch: unknown;
    provenance: unknown;
}): Promise<LivePluginBundleV1>;
export declare function encodeLivePluginBundleV1(bundle: LivePluginBundleV1): Uint8Array;
export declare function validateLivePluginBundleV1(value: unknown): Promise<LivePluginValidationResult>;
export declare function parseLivePluginBundleV1(value: unknown): Promise<LivePluginBundleV1>;
export declare function decodeLivePluginBundleV1(bytes: Uint8Array): Promise<LivePluginBundleV1>;
export declare function livePluginRevisionSummary(bundle: LivePluginBundleV1, sizeBytes?: number): LivePluginRevisionSummaryV1;
export declare function parseLivePluginPreviewCandidateV1(value: unknown): LivePluginPreviewCandidateV1;
export declare function parseLivePluginBranchV1(value: unknown): LivePluginBranchV1;
export declare function isLivePluginCasResultV1(value: unknown): value is LivePluginCasResultV1;
