import type { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
import type { SelectedThreadItem } from "../internal/store/selection-store.js";
import { type OpenFileOptions, type WorkspaceEditorsStore } from "../internal/store/index.js";
/** Options for {@link useSessionPanel}. */
export interface UseSessionPanelOptions {
    /**
     * The display execution's phase, or `null` before any execution exists.
     * A transition between running and terminal resets the user's sticky view
     * pick (mirroring the retired inspector-tab FSM).
     */
    readonly phase: ExecutionPhase | null;
    /**
     * Whether the session has git write-backs. The first arrival auto-surfaces
     * the Changes view — but only while the panel is open; a collapsed panel
     * signals through badges instead of pulling the user out of the chat.
     */
    readonly hasChanges: boolean;
    /**
     * Identity of the session's current plan, or `null` when none exists. Two
     * identity families, supplied by the viewer: `<executionId>:streaming`
     * while the active turn is WRITING a plan (see `findStreamingPlan`), then
     * the published identity (`planDraftKey`) once the artifact exists. A NEW
     * identity — a plan starting to stream, the first published plan, or a
     * refined plan superseding it — auto-opens the plan document tab (see
     * {@link SessionPanelController.openPlanDocument}), expanding a collapsed
     * panel. This deliberately breaks the Changes/Inspect "never open a
     * collapsed panel" convention: a plan is not ambient state, it is the
     * deliverable of the turn the user just requested, and with the thread
     * showing only a compact card there is no other review surface — live or
     * settled. The streaming→published transition is itself a new identity,
     * harmlessly re-firing the (idempotent) open as the tab's content settles.
     * Keyed on plan IDENTITY, not presence, so a refined plan re-surfaces too;
     * the identity present at mount is swallowed (loading a session with an
     * old plan — or mid-stream — never hijacks the layout).
     */
    readonly planKey?: string | null;
    /**
     * The panel's home view — the view it opens on and the one every automatic
     * reset returns to (running⇄terminal transition, selection cleared). Defaults
     * to `"files"` (the Explorer), which suits the session viewer. The launcher
     * passes `"configure"`: pre-session there is no workspace, so the Config
     * facet — carrying the run defaults (harness/model) — is the useful landing
     * view. Auto-switches (Changes/Inspect) and explicit rail picks still
     * take over from here exactly as before.
     *
     * @default "files"
     */
    readonly defaultView?: string;
}
/**
 * State + actions for the unified session panel, shared by every viewer that
 * hosts it (session + launcher) so they behave identically (DD-016).
 *
 * The panel is the one right-side surface: a workspace surface whose activity
 * rail hosts the session facets (see `useSessionRailViews`). It replaces the
 * former two-view model (narrow inspector ⇄ workspace-mode flip): the panel is
 * **collapsed by default** to a top-right chip, and `isOpen` + `view` describe
 * it fully.
 *
 * Owns the {@link WorkspaceEditorsStore} (the open-editor group) and the view
 * FSM ported from the retired inspector tabs: explicit picks are sticky until
 * a meaningful state change (selection cleared, running⇄terminal transition)
 * resets them back to the `defaultView`. Both are decoupled from any store
 * subscription at the owner level: callbacks mutate imperatively so a file
 * open/switch re-renders only the subscribing panel subtree, never the
 * streaming conversation column (DD-009/DD-010, invariant 2).
 */
export interface SessionPanelController {
    /** The open-editor group store; subscribe with `useWorkspaceEditors`. */
    readonly editorsStore: WorkspaceEditorsStore;
    /** Whether the panel is expanded (chat narrow) or collapsed to the chip. */
    readonly isOpen: boolean;
    /** The active rail view id (`"files"`, `"search"`, or an injected facet). */
    readonly view: string;
    /** Expand the panel, restoring the previous view (or Inspect if a thread item is selected). */
    readonly openPanel: () => void;
    /** Collapse the panel to the chip, preserving editors and view. */
    readonly closePanel: () => void;
    /** Explicit view pick from the rail — sticky against auto-switching. */
    readonly setView: (viewId: string) => void;
    /**
     * Open a file as a preview tab and expand the panel. Pass `options.line` to
     * jump to and highlight a specific 1-based line (e.g. a content-search hit) —
     * the file opens in its line-faithful File view scrolled to that line.
     */
    readonly openFile: (entryId: string, path: string, options?: OpenFileOptions) => void;
    /** Focus an already-open editor tab. */
    readonly activateEditor: (entryId: string, path: string) => void;
    /** Pin an editor tab (clear its preview state). */
    readonly pinEditor: (entryId: string, path: string) => void;
    /**
     * Close an editor tab. The panel stays open even when the group empties —
     * unlike the retired workspace-mode flip, the panel is more than files.
     */
    readonly closeEditor: (entryId: string, path: string) => void;
    /**
     * Open (or focus) the plan document tab and expand the panel. The tab is
     * **pinned**, never the recyclable preview slot — file browsing must not
     * evict the plan — and it activates, replacing the focused tab: the plan is
     * the deliverable being reviewed. Fired by the thread cards' "Open plan"
     * (the live `PlanStreamingCard` and the settled `PlanArtifactCard`), the
     * Artifacts facet's `plan.md`, and the new-plan auto-open — which triggers
     * both when a plan STARTS STREAMING and when it publishes (see `planKey`).
     */
    readonly openPlanDocument: () => void;
    /**
     * Report the current thread-item selection. Called from an effect inside the
     * panel subtree (the level that subscribes to the selection store), keeping
     * the owner subscription-free. While the panel is open, a new selection
     * auto-switches to the Inspect view (unless the user picked one explicitly);
     * a collapsed panel deliberately ignores selections — Inspect has no
     * auto-open (it must never pull the user out of the chat).
     */
    readonly notifySelection: (item: SelectedThreadItem | null) => void;
}
/**
 * Create a {@link SessionPanelController} for a viewer instance.
 */
export declare function useSessionPanel({ phase, hasChanges, planKey, defaultView, }: UseSessionPanelOptions): SessionPanelController;
//# sourceMappingURL=useSessionPanel.d.ts.map