Adds a transcript surface for a Structured-view session alongside the existing xterm attach view: a WS /api/structured/:id connection (structured.ts) mounted by ConnectionPool whenever a session's `view` is `"Structured"`, and pure per-row/rail renderers (structuredRender.ts, structuredDiff.ts) covering all eight transcript row kinds. Hierarchy follows the design reference (artifact 88ecd690): the approval is the only lifted, card-like element; a user turn is a tinted block with an accent rail; agent prose is plain text; tool calls are compact bordered rows expanding to output or a coloured, horizontally-scrolling diff computed from ACP's full old/new text. The client renders `reduced_state` and rows exactly as received, with no raw-event folding or turn tracking of its own. Extracted attach.ts's pane-header title building into paneTitle.ts and its connection interface into pane.ts (PaneConnection) so both connection kinds share one contract and one header.
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
// Shared shape a mounted pane connection satisfies, whatever session view is
|
|
// behind it — what ConnectionPool needs to mount/park/dispose a pane without
|
|
// caring whether it holds an xterm attach (attach.ts) or a structured
|
|
// transcript (structured.ts).
|
|
|
|
import type { Uuid } from "./types.js";
|
|
|
|
export interface PaneConnection {
|
|
readonly sessionId: Uuid;
|
|
/** The element to mount into a pane. */
|
|
readonly el: HTMLElement;
|
|
/** Becomes the visible view: fit/focus/sync as the connection needs.
|
|
* `focus: false` mounts without taking the keyboard (a sidebar preview). */
|
|
onMount(opts?: { focus?: boolean }): void;
|
|
/** Parked into the hidden cache: keep streaming, stop driving focus/sizing. */
|
|
onUnmount(): void;
|
|
/** Put the keyboard into this pane's primary input — the terminal for an
|
|
* attach connection, the composer for a structured one. */
|
|
focusTerminal(): void;
|
|
/** Raw bytes into a PTY, bypassing normal key handling (the leader's
|
|
* literal-byte escape hatch, docs/COMMAND-BAR.md). A structured connection
|
|
* has no PTY, so this is a no-op there. */
|
|
sendInput(data: string): void;
|
|
/** Fully disconnect and remove the element. */
|
|
dispose(): void;
|
|
}
|