import type { AgentSessionEvent } from '@earendil-works/pi-coding-agent'; import type { BrokerToClient, RpcExtensionUIRequest } from '../../../core/runtime/broker-protocol.js'; import { type PreviewableCommand } from '../slash/prompt-preview.js'; import type { AttachSession } from './context.js'; export interface FrameEffects { /** Fold the frame through the shared reducer and repaint whatever slice of * chrome changed. Runs FIRST for every frame, before any case below. */ foldState: (frame: BrokerToClient) => void; /** The transcript. Only the writes this switch performs are listed, so a * reader can see the whole render coupling from the type. */ chat: { applySnapshot: (snapshot: Extract['snapshot']) => Promise | void; handleEvent: (event: AgentSessionEvent) => void; bashStart: (command: string, excludeFromContext?: boolean) => void; bashOutput: (chunk: string) => void; bashEnd: (frame: Extract) => void; }; setNotice: (message: string) => void; /** Repaint the status line — for the frames whose footer effect is NOT * derivable from session state (the on-disk bash-job scan). */ renderFooter: () => void; /** Put the editor's text back (tree navigation restores it for re-editing). */ setEditorText: (text: string) => void; /** Show/dismiss a blocking extension dialog. */ attachDialog: (req: RpcExtensionUIRequest) => void; dismissDialog: (id: string) => void; /** Replace the command inventory (`undefined` clears it pending a fresh ack). */ setCommands: (next?: ReadonlyArray) => void; /** Clear + refetch the memory-ref inventory, superseding anything in flight. */ resetMemoryRefs: () => void; /** Re-read the node's persona/lifecycle from the canvas. */ refreshNodeIdentity: () => void; /** Re-resolve user keybindings after a `/reload` (and re-install the tmux side). */ reloadBindings: () => void; /** "sonnet medium" — the label a model or thinking change announces. */ modelThinkingLabel: () => string | undefined; } /** Build the single `frame` handler the socket is wired to. */ export declare function createFrameHandler(ctx: Pick, fx: FrameEffects): (frame: BrokerToClient) => void;