import { type ContinuityReason } from "./session-observability.ts";
export type ContinuityEntrySnapshot = {
    sdkSessionId: string;
    accountName: string;
    modelId: string;
    systemPromptHash: string;
    toolsetHash: string;
    sentCount: number;
    sentHashes: readonly string[];
    lastAssistantUuid: string | null;
    assistantUuidByIndex: ReadonlyMap<number, string>;
    pendingForkReason: string | null;
    taintedReason?: string | null;
    /** Digest of the access token the resident subprocess was spawned with. */
    credentialDigest?: string;
};
export type ContinuityBindingSnapshot = {
    sdkSessionId: string;
    sentCount: number;
    sentHashes: readonly string[];
    sentPrefixHash?: string;
    lastAssistantUuid: string | null;
    /** Assistant boundaries as [index, uuid] entries, mirroring the runtime `ContinuityBinding`; a legacy fork anchors inside the hash-proven shared prefix (senpi#1974). */
    assistantUuidByIndex?: readonly (readonly [number, string])[];
    accountName: string;
    modelId: string;
    systemPromptHash: string;
    toolsetHash: string;
    /** Sent-stream digest of a turn that was pushed but never answered (retry checkpoint). */
    unansweredTurnDigest?: string;
    /** False until the SDK acknowledged the id; a resume/fork of an unconfirmed id is never attempted. */
    sdkSessionIdConfirmed?: boolean;
};
export type ContinuityDecisionInput = {
    entry: ContinuityEntrySnapshot | undefined;
    binding: ContinuityBindingSnapshot | undefined;
    currentHashes: readonly string[];
    accountName: string;
    modelId: string;
    fingerprint: {
        systemPromptHash: string;
        toolsetHash: string;
    };
    transcriptAvailable: boolean;
    /** false only on the config-dir lane, whose per-account credential roots cannot share a transcript root, so cross-account resume is impossible there. */
    crossAccountResumeSupported: boolean;
    idleExpired?: boolean;
    /** Reason the newest ledger record invalidated this session's binding, when one is pending. */
    invalidationReason?: string;
    /** Digest of the access token this turn's attempt authenticates with. */
    credentialDigest?: string;
};
export type ContinuityDecision = {
    kind: "bootstrap";
    reason?: ContinuityReason;
} | {
    kind: "delta";
    from: number;
} | {
    kind: "reattach";
    sdkSessionId: string;
    from: number;
    reason: ContinuityReason;
} | {
    kind: "fork";
    sdkSessionId: string;
    atUuid: string;
    from: number;
    reason: ContinuityReason;
} | {
    kind: "flatten";
    reason: ContinuityReason;
};
/**
 * Resume-first except after senpi compaction, which replaces the SDK transcript
 * with the compacted context. Only compaction, a missing transcript, an
 * unrecoverable boundary, a model identity drift, or account
 * drift on the config-dir lane on a persisted binding reaches `flatten`; every other
 * divergence resolves to `fork` (same lineage, new branch) or `reattach` (same
 * session, new query).
 */
export declare function decideNativeContinuity(input: ContinuityDecisionInput): ContinuityDecision;
//# sourceMappingURL=session-continuity.d.ts.map