Skip to content

Interface: DockPanelApi

Defined in: packages/sdk/src/types.ts:76

The panel API handed to a DockPanelKind component. Use these methods to drive the panel's own tab (title, close, focus) and update its stored parameters. The host provides the implementation; extensions never construct this object directly.

Properties

isActive

ts
readonly isActive: boolean;

Defined in: packages/sdk/src/types.ts:84

true while this panel is the active one in its dock group.


isVisible

ts
readonly isVisible: boolean;

Defined in: packages/sdk/src/types.ts:99

true while this panel is visible — its tab is the selected one in its group. Distinct from isActive: with split groups, every group's selected tab is visible but only one panel in the whole dock is active.

Methods

setTitle()

ts
setTitle(title): void;

Defined in: packages/sdk/src/types.ts:78

Update the title shown in the panel's tab.

Parameters

title

string

Returns

void


close()

ts
close(): void;

Defined in: packages/sdk/src/types.ts:80

Programmatically close this panel.

Returns

void


setActive()

ts
setActive(): void;

Defined in: packages/sdk/src/types.ts:82

Bring this panel to focus (make it the active panel in its group).

Returns

void


onDidActiveChange()

ts
onDidActiveChange(listener): Disposable;

Defined in: packages/sdk/src/types.ts:90

Subscribe to active-state transitions. The listener is called whenever the panel gains or loses active status, with an event carrying the new state. Returns a Disposable that cancels the subscription.

Parameters

listener

(event) => void

Returns

Disposable


onDidVisibilityChange()

ts
onDidVisibilityChange(listener): Disposable;

Defined in: packages/sdk/src/types.ts:106

Subscribe to visibility transitions (the panel's tab being selected or deselected in its group). Use to pause expensive work while hidden, or to re-measure on reveal (e.g. the terminal refits xterm when its tab becomes visible again). Returns a Disposable that cancels the subscription.

Parameters

listener

(event) => void

Returns

Disposable


updateParameters()

ts
updateParameters(params): void;

Defined in: packages/sdk/src/types.ts:114

Shallow-merge params into this panel's stored parameters. Keys absent from params are left unchanged. Useful for keeping tabs-serializable state (e.g. the open URL in a web-viewer panel) consistent with the UI.

Parameters

params

object

Returns

void


setAgentSession()

ts
setAgentSession(agentSessionId): void;

Defined in: packages/sdk/src/types.ts:134

Declare — or, with null, withdraw — the Agent Session this panel is showing (an AgentInfo.id — the id on the handle ctx.agents.sessions.connect() returned).

This is the only thing the host lacks about a Chat panel, and declaring it is what makes the panel an ordinary subject of agent chrome rather than an author of it. Once declared, the host routes this panel's tab through the same path a terminal tab takes: an AgentsService.bindActivity / AgentsService.bindIcon binder's provide(agentSessionId) reaches this tab, AgentsService.getActive reports the session while the tab is the active one (so a finish the user watched raises no badge), and AgentsService.close closes this panel. None of that requires the panel to know a badge exists.

Call it once the session is connected, and again with null on a teardown that outlives the panel (switching to a different agent). The host withdraws it automatically when the panel unmounts.

Parameters

agentSessionId

string | null

Returns

void


setBreadcrumb()

ts
setBreadcrumb(crumb): void;

Defined in: packages/sdk/src/types.ts:151

Publish the path this panel is showing, for the host-drawn breadcrumb strip — or, with null, show no path crumbs.

Only meaningful for a DockPanelKind that declares toolbar: { breadcrumb: true }; the host draws the strip and this fills in its crumbs. null leaves a strip that carries only contributed registerToolbarItem({ surface: "panel" }) items — which is also how a panel honours a "hide breadcrumbs" setting of its own.

This is the shape of DockPanelApi.setAgentSession: the panel states a fact about itself and the host routes on it. The path is not part of the panel's persisted identity, so it goes here rather than through DockPanelApi.updateParameters. The host withdraws it automatically when the panel unmounts.

Parameters

crumb

| { filePath: string; workspaceFolder?: string; leafIcon?: "file" | "folder"; } | null

Type Literal

{ filePath: string; workspaceFolder?: string; leafIcon?: "file" | "folder"; }

filePath

string

Absolute path shown as workspace-relative crumbs.

workspaceFolder?

string

Workspace folder the path is relativised against, when it is inside one.

leafIcon?

"file" | "folder"

Glyph on the trailing crumb. Defaults to "file".


null

Returns

void