# TypeScript workspace builder API

Source: https://libtmux.org/en/ts/latest/workspace/reference/

> Internal reference for the TypeScript workspace builder and configuration APIs.

Import planning and application from `@libtmux/workspace`, and parsers from
`@libtmux/workspace/config`. Application operates
on a core libtmux `Server` supplied by the caller; creating that server does
not choose a workspace or apply one automatically.

## Parse and validate

[`parseWorkspace`](./config-parseworkspace/) validates data already
read by your application.
[`parseWorkspaceYaml`](./config-parseworkspaceyaml/)
adds Bun's YAML parsing. Both produce the workspace configuration consumed by
the builder.

## Plan and apply

[`planWorkspace`](./builder-planworkspace/) returns a description
of membership changes. [`WorkspacePlan`](./planning-workspaceplan/)
records creations, removals, renames, and retained surplus.

[`applyWorkspace`](./builder-applyworkspace/) performs the work and
resolves to the resulting `Session`. Its options control pruning and whether
commands run in existing panes. Planning accepts pruning policy; command
policy belongs to application.

## Handle failure

[`WorkspaceApplyError`](./builder-workspaceapplyerror/) preserves
the cause and completed milestones. Reinspect tmux before retrying; the error
is not a transaction log of every effect or a receipt for shell commands.

The language API builds workspaces directly. Availability through an MCP
server is a separate protocol capability; consult this port's
[MCP section](../../mcp/) for its advertised tools.

[Public exports](https://github.com/libtmux/libtmux-ts/blob/f85b8de551353f746d50eaf36bf0112f4fe5a528/packages/workspace/package.json)

## API declarations

- [builder.applyWorkspace](https://libtmux.org/en/ts/latest/workspace/reference/builder-applyworkspace/)
- [operation_options.ApplyWorkspaceOptions](https://libtmux.org/en/ts/latest/workspace/reference/operation_options-applyworkspaceoptions/)
- [ownership.claimSession](https://libtmux.org/en/ts/latest/workspace/reference/ownership-claimsession/)
- [operation_options.CommandPolicy](https://libtmux.org/en/ts/latest/workspace/reference/operation_options-commandpolicy/)
- [config.initialPaneStartDirectory](https://libtmux.org/en/ts/latest/workspace/reference/config-initialpanestartdirectory/)
- [ownership.mayPrune](https://libtmux.org/en/ts/latest/workspace/reference/ownership-mayprune/)
- [config.optionValue](https://libtmux.org/en/ts/latest/workspace/reference/config-optionvalue/)
- [ownership.ownedByWorkspace](https://libtmux.org/en/ts/latest/workspace/reference/ownership-ownedbyworkspace/)
- [config.paneCommands](https://libtmux.org/en/ts/latest/workspace/reference/config-panecommands/)
- [config.paneStartDirectory](https://libtmux.org/en/ts/latest/workspace/reference/config-panestartdirectory/)
- [config.paneWantsFocus](https://libtmux.org/en/ts/latest/workspace/reference/config-panewantsfocus/)
- [config.parseWorkspace](https://libtmux.org/en/ts/latest/workspace/reference/config-parseworkspace/)
- [config.parseWorkspaceYaml](https://libtmux.org/en/ts/latest/workspace/reference/config-parseworkspaceyaml/)
- [builder.planWorkspace](https://libtmux.org/en/ts/latest/workspace/reference/builder-planworkspace/)
- [operation_options.PlanWorkspaceOptions](https://libtmux.org/en/ts/latest/workspace/reference/operation_options-planworkspaceoptions/)
- [ownership.PrunePolicy](https://libtmux.org/en/ts/latest/workspace/reference/ownership-prunepolicy/)
- [config.windowStartDirectory](https://libtmux.org/en/ts/latest/workspace/reference/config-windowstartdirectory/)
- [config.Workspace](https://libtmux.org/en/ts/latest/workspace/reference/config-workspace/)
- [builder.WorkspaceApplyError](https://libtmux.org/en/ts/latest/workspace/reference/builder-workspaceapplyerror/)
- [builder.WorkspaceApplyMilestone](https://libtmux.org/en/ts/latest/workspace/reference/builder-workspaceapplymilestone/)
- [builder.WorkspaceApplyStage](https://libtmux.org/en/ts/latest/workspace/reference/builder-workspaceapplystage/)
- [config.WorkspaceInput](https://libtmux.org/en/ts/latest/workspace/reference/config-workspaceinput/)
- [config.WorkspaceOptionValue](https://libtmux.org/en/ts/latest/workspace/reference/config-workspaceoptionvalue/)
- [config.WorkspacePane](https://libtmux.org/en/ts/latest/workspace/reference/config-workspacepane/)
- [planning.WorkspacePaneCreation](https://libtmux.org/en/ts/latest/workspace/reference/planning-workspacepanecreation/)
- [planning.WorkspacePaneRemoval](https://libtmux.org/en/ts/latest/workspace/reference/planning-workspacepaneremoval/)
- [planning.WorkspacePlan](https://libtmux.org/en/ts/latest/workspace/reference/planning-workspaceplan/)
- [planning.WorkspaceRetention](https://libtmux.org/en/ts/latest/workspace/reference/planning-workspaceretention/)
- [config.WorkspaceWindow](https://libtmux.org/en/ts/latest/workspace/reference/config-workspacewindow/)
- [planning.WorkspaceWindowCreation](https://libtmux.org/en/ts/latest/workspace/reference/planning-workspacewindowcreation/)
- [config.WorkspaceWindowInput](https://libtmux.org/en/ts/latest/workspace/reference/config-workspacewindowinput/)
- [planning.WorkspaceWindowPlacement](https://libtmux.org/en/ts/latest/workspace/reference/planning-workspacewindowplacement/)
- [planning.WorkspaceWindowRemoval](https://libtmux.org/en/ts/latest/workspace/reference/planning-workspacewindowremoval/)
- [planning.WorkspaceWindowRename](https://libtmux.org/en/ts/latest/workspace/reference/planning-workspacewindowrename/)
