/**
 * Durable-plan application-shell contract.
 *
 * The sandbox SDK owns the authoritative plan lifecycle and decision APIs.
 * This module only projects that substrate state into chat events and
 * persisted message parts that products can render and restore.
 */
declare const PLAN_SUBMITTED_EVENT: "plan.submitted";
/** Sandbox plan lifecycle. `preparing` is the transient submission state and
 * is retained in the projection even though the chat card normally starts at
 * `pending`. */
type ChatPlanStatus = 'preparing' | 'pending' | 'approved' | 'rejected' | 'superseded' | 'withdrawn';
type ChatPlanBase = {
    /** The sandbox SDK calls this field `id`; the transcript projection names
     * it explicitly so it cannot collide with a message-part id. */
    planId: string;
    revision: number;
    title?: string;
    body: string;
    submittedAt: string;
    /** Provider/Sandbox metadata is deliberately opaque to this package. */
    metadata?: Record<string, unknown>;
    decidedBy?: string;
};
/** Browser/persisted projection of the sandbox SDK's durable-plan union. */
type ChatPlan = ChatPlanBase & ({
    status: 'preparing';
} | {
    status: 'pending';
} | {
    status: 'approved';
    decidedAt: string;
} | {
    status: 'rejected';
    decidedAt: string;
    feedback: string;
} | {
    status: 'superseded';
    supersededAt: string;
    supersededByPlanId: string;
} | {
    status: 'withdrawn';
    withdrawnAt: string;
    withdrawnReason: string;
});
/** Canonical transcript part for one durable plan. */
type ChatPlanPersistedPart = ChatPlan & {
    type: 'plan';
};
/** Resolve the result of parsing a plan submission into success with value or failure with error */
type ParsePlanSubmittedResult = {
    succeeded: true;
    value: ChatPlan;
} | {
    succeeded: false;
    error: string;
};
/** Generate a unique key string for a given plan identifier */
declare function planPartKey(planId: string): string;
/** Generate a unique key string for a plan based on its ID and revision number */
declare function planRevisionKey(planId: string, revision: number): string;
/** Generate a unique follow-up turn ID based on the plan ID and its outcome */
declare function planFollowUpTurnId(planId: string, outcome: 'approved' | 'rejected'): string;
/** Plan status is monotonic: only a pending plan can settle. */
declare function canTransitionPlanStatus(from: ChatPlanStatus, to: ChatPlanStatus): boolean;
/** Resolve a ChatPlan into its persisted part representation for storage or transmission */
declare function planToPersistedPart(plan: ChatPlan): ChatPlanPersistedPart;
/** Resolve a persisted part object into a ChatPlan or return null if the type is not 'plan */
declare function persistedPartToPlan(part: Record<string, unknown>): ChatPlan | null;
/** Parses both direct sandbox events (`data.plan`) and session envelopes
 * (`properties.plan`). Session identity is carried by the surrounding stream
 * and is deliberately not required in the payload. */
declare function parsePlanSubmittedEvent(event: unknown): ParsePlanSubmittedResult;

export { type ChatPlan, type ChatPlanPersistedPart, type ChatPlanStatus, PLAN_SUBMITTED_EVENT, type ParsePlanSubmittedResult, canTransitionPlanStatus, parsePlanSubmittedEvent, persistedPartToPlan, planFollowUpTurnId, planPartKey, planRevisionKey, planToPersistedPart };
