/** Bounded, composer-safe panels for preset, session, and plugin kernel views. */ import { type ReactElement } from 'react'; import type { ModelDirectory, ModelRow } from '../models.ts'; import type { SubagentRow } from '../session/subagents.ts'; import type { SearchRow } from '../runner/search-rows.ts'; export type { SearchRow } from '../runner/search-rows.ts'; import type { ScheduleRow } from '../render/projection.ts'; import type { PermissionRow } from '../permissions.ts'; import type { PresetRow } from '../presets.ts'; import type { PluginRow } from '../plugin-inventory.ts'; import type { SessionDirectoryOptions, SessionRow } from '../session/session-directory.ts'; import type { ReviewBranch, ReviewCommit, ReviewSelection } from '../git-workflow.ts'; import { type UsageView } from '../render/usage.ts'; import { type StatusItemId } from '../render/status.ts'; export { editQuery } from '../ui/query-editor.ts'; export declare function ModePanel({ current, load, select, close }: { current: string; load: () => Promise; select: (id: string) => void; close: () => void; }): ReactElement; export declare function PermissionPanel({ current, load, select, close }: { current: string; load: () => Promise; select: (id: string) => void; close: () => void; }): ReactElement; export declare function PluginPanel({ load, close, initialQuery }: { load: () => readonly PluginRow[]; close: () => void; initialQuery?: string; }): ReactElement; /** One background job snapshot for the /jobs panel (the registry's read-only view). */ export interface JobRow { /** The registry-issued id (`-N`). */ readonly id: string; /** Producer kind (bash, subagent, …). */ readonly kind: string; /** One-line model-facing label (the command; the delegation description). */ readonly label: string; /** Lifecycle state. */ readonly status: 'running' | 'stopping' | 'completed' | 'killed' | 'failed'; /** Kind-specific status detail once the producer supplied one. */ readonly detail?: string; /** Epoch ms when the job was registered. */ readonly startedAt: number; /** Epoch ms when the job settled; absent while running/stopping. */ readonly finishedAt?: number; } /** Web TurnStatus elapsed format: `45s` under a minute, `2m03s` beyond. */ export declare function runClock(ms: number): string; /** * The read-only background-job panel: caller-owned and unowned jobs from the * host `jobs` registry in registration order, with a local second-hand while * the panel is open (elapsed clocks advance and the snapshot re-reads; the * interval dies with the panel). Cancel stays upstream-only; an absent * registry renders as the plain empty state (a harmless missing service). */ export declare function JobsPanel({ load, close }: { load: () => readonly JobRow[]; close: () => void; }): ReactElement; export declare function ResumePanel({ currentCwd, load, readTranscript, select, requestDelete, deleteConfirmId, reloadToken, deleteMode, presetId, close }: { currentCwd: string; load: (options: SessionDirectoryOptions, signal?: AbortSignal) => Promise; readTranscript: (id: string, signal?: AbortSignal) => Promise; select: (row: SessionRow) => void; /** Arm the composer-based delete confirm for one row (App owns the keys). */ requestDelete?: (row: SessionRow) => void; /** The row id awaiting y/n in the composer, when any (App-owned). */ deleteConfirmId?: string; /** Bump to reload the listing (e.g. after a deletion). */ reloadToken?: number; /** Opened via /delete: hint-first delete mode. */ deleteMode?: boolean; /** `/delete ` argument to resolve after the listing loads. */ presetId?: string; close: () => void; }): ReactElement; /** * The /history recall panel (Codex composer-history search, bounded): one * query line over the newest-first recall space, filtered by substring, with * arrow selection and enter to fill the composer. Editing the query restarts * from the newest match; Esc closes without touching the draft. */ export declare function HistoryPanel({ entries, fill, close }: { /** Newest-first recall entries (persistent + in-session, deduped). */ entries: readonly string[]; /** Accept one entry: its text plus its recall-space index (browsing resumes there). */ fill: (text: string, index: number) => void; close: () => void; }): ReactElement; /** * The /review candidate picker (Codex's preset popup): bare /review opens a * four-way preset — review uncommitted changes, pick a base branch, pick a * recent commit, or type a custom focus. Branch and commit phases are * type-to-filter lists; every selection resolves to the same /review * argument string the direct command accepts. */ export declare function ReviewPickerPanel({ loadBranches, loadCommits, choose, close }: { loadBranches: (signal?: AbortSignal) => Promise; loadCommits: (signal?: AbortSignal) => Promise; /** Run the review for one picker selection. */ choose: (selection: ReviewSelection) => void; close: () => void; }): ReactElement; /** * The /search panel: full-text search over every persisted session through * the in-process session-query engine (the same corpus the model's * session_search tool reads). Type a query, Enter searches, Enter again * resumes the hit; the query line edits like every kernel panel. */ export declare function SearchPanel({ load, select, initialQuery, close }: { load: (query: string, signal?: AbortSignal) => Promise; select: (row: SearchRow) => void; initialQuery?: string; close: () => void; }): ReactElement; /** * The /statusline picker (the Codex setup-view contract): one bounded list * of every status item with its enabled mark, arrow reordering, and a * live preview — the real status line under the composer updates as you * edit, so the panel itself carries no duplicate preview row. */ export declare function StatuslinePanel({ enabled, change, close }: { enabled: readonly StatusItemId[]; change: (items: readonly StatusItemId[]) => void; close: () => void; }): ReactElement; /** * The `/model` reasoning-effort stage (the Codex model → reasoning popup * contract): one bounded list over the selected model's adapter-advertised * effort levels — in the adapter's own display order, ids verbatim (the * kernel treats them as opaque and rejects anything else) — with the * effective effort and the model default marked. A model WITHOUT an * adapter-declared default leads with a "Default" (provider-default) row — * the web effort pane's first entry — so the user can clear a picked level * back to provider behavior. A model advertising no levels opens the same * stage with an explicit empty state (the web pane's "no levels" copy) * instead of a bare failure notice. Enter applies one level; Esc returns to * the model list without applying. */ export declare function EffortPanel({ row, current, select, back, onExit }: { /** The model row whose advertised levels this stage lists. */ row: ModelRow; /** Effective effort currently in force ('' when none), for the ● mark. */ current: string | undefined; /** Accept one advertised effort id, or '' for the provider default. */ select: (effortId: string) => void; /** Return to the model list without applying. */ back: () => void; /** Leave the whole /model flow (Ctrl+C). */ onExit: () => void; }): ReactElement; /** * The /agents panel (the Codex agent-picker contract, read-only): this * conversation's subagent conversations — live rows from the activity feed * first, persisted children the feed has not seen this process after — with * Enter/t opening the child's full transcript in the shared read-only * document view (the same projection the exporter uses). */ export declare function AgentsPanel({ live, load, readTranscript, attach, close }: { /** Live feed rows (child sessions observed this process). */ live: readonly SubagentRow[]; /** Load this session's persisted child sessions by lineage. */ load: () => Promise; /** Read one child session's full transcript as markdown. */ readTranscript: (id: string, signal?: AbortSignal) => Promise; /** Attach to one child as the whole view (the runner's live buses). */ attach: ((id: string, label: string) => void) | undefined; close: () => void; }): ReactElement; /** * The /subagent model panel: which model configuration delegated subagents * run on. The kernel seeds child agents from the parent's CREATE-TIME * AgentOptions, so a mid-session /model switch would otherwise leave them on * the launch-time route; the TUI mirrors the selection onto subagent-origin * requests (or an explicit override picked here) via an agent/request * listener. The leading "inherit" row restores follow-the-current-model * behavior; picking a model with several advertised efforts opens the same * effort stage /model uses. Effort overrides are not offered separately — * the kernel's AgentOptions has no effort channel for children, so the level * rides the selected model exactly as /model applies it. */ export declare function SubagentPanel({ current, load, pick, inherit, close }: { /** Display label of the override in force, '' when following the current model. */ current: string; load: () => Promise; /** Apply one model (with an advertised effort, when picked) as the override. */ pick: (row: ModelRow, effortId?: string) => void; /** Drop the override: subagents follow the current model again. */ inherit: () => void; close: () => void; }): ReactElement; /** * The /schedule panel: the read-only catalog of active reminders folded from * durable schedule/change events (the web ui-schedule contract: overdue * first, then ascending target; the model creates and cancels through its * schedule_* tools, the panel only shows state). A local second-hand keeps * the relative labels live while the panel is open. */ export interface ScheduleDisplayRow { readonly key: string; readonly text: string; readonly tone?: 'error'; } /** Human frequency label: one-shot kinds read as Once, every rows carry the interval. */ export declare function scheduleFrequency(row: ScheduleRow): string; /** Relative label for the next target: in N unit, or N unit overdue. */ export declare function scheduleRelative(targetAt: number, now: number): string; /** Ordered display rows: overdue first (error tone), then ascending target. */ export declare function scheduleDisplayRows(rows: readonly ScheduleRow[], now: number): readonly ScheduleDisplayRow[]; export declare function SchedulePanel({ rows, close }: { rows: () => readonly ScheduleRow[]; close: () => void; }): ReactElement; /** * The /usage panel: the session's provider-reported token totals, its context * pressure and estimated composition, and the exact per-turn accounting, in * one bounded scrollable surface. Read-only — Esc or q closes it. */ export declare function UsagePanel({ load, close }: { /** Read the current session's usage blocks from the mounted projections. */ load: () => Promise; close: () => void; }): ReactElement;