/** * PaneGridPlanner — converts a logical pane tree into a sequence of * tmux `split-window` commands with debounce coalescing. * * DFS preorder walk emits one SplitCommand per non-root node. The * preorder traversal matches the spec test: for tree * root → [a → [a1, a2], b] * the emitted order is split-a, split-a1, split-a2, split-b. The * executor can chain splits by parent reference (the resulting paneId * is only known after tmux returns it). * * Direction rule: * - depth-1 (direct child of root) → "h" (horizontal) * - depth-2+ → "v" (vertical) * * Per D-43-04: NO cache layer. The 500ms trailing-edge debounce is the * sole coalescing mechanism. The planner is stateless beyond the * in-flight timer + stored root/callback. * * ORIGIN: opencode-tmux/src/grid-planner.ts:1-21 (file header) * ORIGIN: opencode-tmux/src/grid-planner.ts:23-113 (class body — 1:1 port) * * Reference: 43-01-PLAN.md Task 2 (REQ-03) */ import type { PaneGridPlannerInternal, PaneTreeNode, SplitCommand, SplitDirection } from "./types.js"; export type { PaneGridPlannerInternal, PaneTreeNode, SplitCommand, SplitDirection }; /** * Compute-only view of the planner (the public contract the * `tmux-copilot` tool sees). Internally this class is the wider * `PaneGridPlannerInternal`; a narrow `PaneGridPlanner` view is * returned from the adapter via `createPaneGridPlanner()`. * * ORIGIN: opencode-tmux/src/grid-planner.ts:35-113 */ export declare class PaneGridPlanner implements PaneGridPlannerInternal { private readonly debounceMs; private timer; private pendingRoot; private pendingCallback; constructor(debounceMs?: number); /** * Walk the tree in DFS preorder. For each non-root node, emit a * SplitCommand targeting its parent with the depth-based direction. * Empty tree → []. No cycle detection (v1 assumes well-formed input). * * The preorder traversal is intentional: a parent split must be * performed BEFORE any of its children's splits (we need the * resulting paneId as the parent reference). BFS would interleave * sibling branches whose parents haven't been created yet. * * ORIGIN: opencode-tmux/src/grid-planner.ts:55-74 */ computeSplitSequence(root: PaneTreeNode): SplitCommand[]; /** * Debounced coalescing. Each call REPLACES the pending root and * resets the timer (trailing-edge). On fire: invoke * onComputed(computeSplitSequence(storedRoot)). * * ORIGIN: opencode-tmux/src/grid-planner.ts:81-99 */ requestLayout(root: PaneTreeNode, onComputed: (commands: SplitCommand[]) => void): void; /** * Clear any pending timer. Pending root/callback are dropped. * Useful for tests and shutdown. * * ORIGIN: opencode-tmux/src/grid-planner.ts:105-112 */ cancel(): void; } /** * Factory helper — thin wrapper for consistency with P42's factory naming. * Returns the narrow public view (`PaneGridPlanner`) so consumers cannot * reach `requestLayout` / `cancel` through the adapter boundary. * * ORIGIN: opencode-tmux/src/grid-planner.ts:118-120 */ export declare function createDebouncedPaneGridPlanner(debounceMs?: number): PaneGridPlanner; //# sourceMappingURL=grid-planner.d.ts.map