import type { RevealTarget } from "../useRevealLine.js";
import type { SelectedWorkspaceFile } from "./workspace-file-selection-store.js";
/**
 * Options for opening a file in the surface (via `openPreview` / the surface's
 * `onOpenFile` seam). `line` requests a jump-to-line reveal: the file opens in
 * a line-faithful view scrolled to and highlighting that 1-based line. Absent,
 * the file opens normally (top of file / diff-default). Deliberately an options
 * object so future open-intents (e.g. a column) extend it without churning the
 * callback signature.
 */
export interface OpenFileOptions {
    /** 1-based line to reveal after opening. */
    readonly line?: number;
}
/**
 * A pending reveal request scoped to a specific editor. Extends the viewer-side
 * {@link RevealTarget} with the `key` of the editor it targets, so a consumer
 * applies the reveal only while that editor is the active one. Transient
 * navigation, never editor identity (the line does not key the tab).
 */
export interface EditorReveal extends RevealTarget {
    /** {@link editorKey} of the editor this reveal targets. */
    readonly key: string;
}
/**
 * One open editor tab.
 *
 * `preview` marks the single reusable "preview" tab (shown in italics): a
 * single click opens or replaces it in place, so casual browsing never
 * accumulates tabs. Pinning it (double-click, or opening the file explicitly)
 * clears the flag and the tab becomes persistent. At most one editor is a
 * preview at any time.
 */
export interface OpenEditor {
    /** Stable-within-page id of the owning workspace entry. */
    readonly entryId: string;
    /** Repo-relative (git) or root-relative (local) file path. */
    readonly path: string;
    /** Whether this is the reusable preview tab (italic, single per group). */
    readonly preview: boolean;
}
/** Immutable snapshot for the `useSyncExternalStore` contract. */
export interface WorkspaceEditorsSnapshot {
    /** Open editors in tab order. */
    readonly editors: readonly OpenEditor[];
    /** Key of the active editor, or `null` when the group is empty. */
    readonly activeKey: string | null;
    /**
     * The active editor as a {@link SelectedWorkspaceFile} (stable ref between
     * mutations), or `null`. This is what the viewer, diff correlation, and tree
     * highlight consume — the editors store's projection into the selection shape.
     */
    readonly activeFile: SelectedWorkspaceFile | null;
    /**
     * A pending jump-to-line reveal, or `null`. Set only by an open-with-line
     * (`openPreview` with a `line`); cleared by any other active-editor change so
     * returning to a tab never re-scrolls to a stale line. Consumers honor it only
     * while `reveal.key` matches {@link activeKey}. Transient — not part of any
     * editor's identity.
     */
    readonly reveal: EditorReveal | null;
}
type Listener = () => void;
/**
 * Stable key for an editor. Uses NUL as the separator — legal in neither an
 * entry id nor a file path — so `entryId`/`path` can never collide.
 */
export declare function editorKey(entryId: string, path: string): string;
/**
 * Entry id for a virtual document — an editor tab whose content is not a
 * workspace file (e.g. the session's `plan.md`, an execution artifact).
 * Virtual documents share the editor group with file tabs (same open / pin /
 * close / activate semantics); only their *content rendering* differs, via the
 * surface's `virtualDocuments` seam. `kind` names the document family
 * (`"plan"` today) so future virtual documents get distinct identities.
 */
export declare function virtualEntryId(kind: string): string;
/**
 * True when an entry id names a virtual document rather than a workspace
 * entry. Used by file-only consumers (diff correlation, tree highlight,
 * reveal) to skip work that can only apply to real files.
 */
export declare function isVirtualEntryId(entryId: string): boolean;
/**
 * Framework-agnostic store for the surface's open-editor group.
 *
 * Implements the `useSyncExternalStore` contract like the sibling selection and
 * conversation stores: the context/ref carries the instance, and `getSnapshot`
 * returns a snapshot object that is replaced only inside a mutation — so it is a
 * stable reference between mutations and never triggers a render loop.
 *
 * VS Code preview-tab semantics:
 * - {@link openPreview} — single click: reuse the one preview slot (or focus an
 *   already-open editor); casual browsing stays at one tab.
 * - {@link openPinned} / {@link pin} — double-click or explicit open: the tab
 *   becomes persistent.
 * - {@link close} — remove a tab, activating a neighbor.
 * - {@link activate} — focus an already-open tab.
 */
export declare class WorkspaceEditorsStore {
    private _snapshot;
    private _listeners;
    /** Monotonic reveal token — bumped on every open-with-line (see `openPreview`). */
    private _revealSeq;
    /**
     * Single-click open: reuse the preview slot, or focus if already open.
     *
     * When `options.line` is set, this also records a jump-to-line reveal for the
     * opened editor. The reveal nonce is bumped **every** time — even when the
     * file is already open and active — so a second search hit in the same file
     * re-scrolls the already-mounted viewer. An open without a `line` clears any
     * pending reveal.
     */
    openPreview(entryId: string, path: string, options?: OpenFileOptions): void;
    /** Explicit open (double-click / open-to-keep): a persistent tab. */
    openPinned(entryId: string, path: string): void;
    /** Pin an open editor (clear its preview flag), keeping it active. */
    pin(entryId: string, path: string): void;
    /** Focus an already-open editor. No-op if it is not open. */
    activate(entryId: string, path: string): void;
    /**
     * Close an editor. When the closed tab was active, the neighbor to its right
     * (or, failing that, its left) becomes active — matching editor conventions.
     */
    close(entryId: string, path: string): void;
    /** Close every editor. */
    closeAll(): void;
    subscribe: (listener: Listener) => (() => void);
    /** Returns the current snapshot (stable ref between mutations). */
    getSnapshot: () => WorkspaceEditorsSnapshot;
    private _setActive;
    /** Build a reveal for `key` from open options, or `null` when no line given. */
    private _makeReveal;
    /**
     * Replace the snapshot. `reveal` defaults to `null`, so any mutation that does
     * not explicitly carry one clears a pending reveal (invariant: returning to a
     * tab must not re-scroll to a stale line). The `activeFile` object reference
     * is preserved when the active editor is unchanged, so a reveal-only update
     * doesn't churn downstream memoization (diff correlation, tree highlight).
     */
    private _commit;
    private _notify;
}
export {};
//# sourceMappingURL=workspace-editors-store.d.ts.map