import type { VisualQuestionDelegatePayload } from '../adapters/visual/protocol-contract.js'; import type { ProjectionQuery } from '../projection.js'; import type { NestingKind } from '../nesting.js'; import type { VisualLayoutSavePayload, VisualViewOperation } from '../adapters/visual/protocol-contract.js'; import type { YarramateOperation } from '../operations.js'; import type { EditorHost } from './editor-host.js'; import { type FilterSource, type VisualAppState } from './state.js'; /** * The session as the page holds it: one reducer, one host, and nothing that * decides anything on its own. * * The transport moved out (#252). What stays is everything that is true of the * editor whatever is answering it: the reducer, the sequence every input is * stamped with, which surface asked for the standing filter, and the re-ask * that keeps a matched set from outliving the model it was resolved against. * A host that owned those would have to reimplement them to be a host at all. */ export interface VisualSession { readonly state: VisualAppState; readonly connected: boolean; readonly ask: (text: string) => void; readonly choose: (optionId: string) => void; /** Hands one open question to the agent on the socket (#515, ADR 0151). */ readonly delegate: (payload: VisualQuestionDelegatePayload) => void; readonly navigate: (viewId: string) => void; readonly filter: (query: ProjectionQuery, origin?: FilterSource, /** * The nesting the canvas is drawing with. Only `query.instances` reads it, * and it must: the closure IS the containment tree (#473 phase 2). */ nesting?: readonly NestingKind[], /** * Whether the view shows responsibility edges. The `connected` walk * reads it (#563, ADR 0161): a hidden responsibility edge must not bring * a person into the picture. */ showResponsibility?: boolean) => void; readonly clearFilter: () => void; readonly setQuickFilterText: (text: string) => void; readonly stageViewChange: (operation: VisualViewOperation) => void; /** One subject into or out of a view's own membership list, composed on top * of whatever is already staged for that view. */ readonly stageViewMembership: (viewId: string, subjectId: string, membership: 'add' | 'remove') => void; readonly stageChange: (operation: YarramateOperation) => void; readonly discardChange: (index: number) => void; readonly clearChangeset: () => void; readonly undoChangeset: () => void; readonly redoChangeset: () => void; readonly commitChangeset: () => void; readonly saveLayout: (payload: VisualLayoutSavePayload) => void; readonly end: () => void; } export declare const useVisualSession: (host: EditorHost) => VisualSession;