# tmux

> tmux as an iii worker — list, create, rename and kill sessions and windows, see which pane runs Claude Code or Codex (working, waiting for you, idle), which runs `iii compose` and every listening port by process and pane, plus a Console page whose terminal is a live tmux client.

| field | value |
|-------|-------|
| version | 0.1.1 |
| type | binary |
| license | Apache-2.0 |
| repo | https://github.com/iii-hq/workers |
| supported_targets | x86_64-apple-darwin, aarch64-apple-darwin, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-unknown-linux-musl, armv7-unknown-linux-gnueabihf |
| author | iii |

## installation

```sh
iii trigger compose::add worker=tmux@0.1.1
```

## configuration

```yaml
- max_terminals: 8
  poll_interval_ms: 1000
  ports_interval_ms: 3000
  terminal_idle_timeout_ms: 30000
  tmux_binary: tmux
```

## dependencies

- `ade` @ `latest`
- `configuration` @ `latest`

## readme

# tmux

tmux as an iii worker. It lists every tmux session, window and pane on the
host, creates, renames and kills sessions and windows, and tells you what is
running where: which pane holds Claude Code or Codex and whether that agent is
working, waiting for you or idle, which pane runs `iii compose` and on which
port its engine listens, and every TCP port your processes listen on, traced
back to the pane that started them. Its Console page embeds a terminal that
is a real tmux client: what you type goes straight into the session, and the
screen updates as tmux draws it, the same way a second terminal attached with
`tmux attach` would.

## Install

```bash
iii trigger compose::add worker=tmux
```

The worker drives the `tmux` binary installed on the host (Linux or macOS) and
talks to the same tmux server you use from your terminal. Without tmux it still
starts and reports `available: false`.

## Quickstart

Open the **tmux** page in the Console to browse sessions, open one in the
terminal, and see the **Ports** tab. From code or an agent:

```bash
# Every session → window → pane, with agent / compose / port status
iii trigger tmux::sessions::list

# A new session running a dev server, then a second window in it
iii trigger tmux::sessions::create name=api cwd=~/code/api command="pnpm dev"
iii trigger tmux::windows::create session=api name=logs

# Who listens on which port, and which compose stacks are up
iii trigger tmux::ports::list
```

A pane running an agent and a pane running `iii compose` look like this in
`tmux::sessions::list`:

```json
{ "id": "%3", "command": "claude",
  "agent": { "id": "claude", "label": "Claude Code", "state": "waiting", "since_ms": 1791936000000,
             "title": "Fix the login redirect" } }
{ "id": "%7", "command": "iii:c:default",
  "compose": { "namespace": "default", "pid": 2759592 },
  "ports": [ { "port": 49135, "role": "engine", "process": "iii:e:default" },
             { "port": 3111, "role": "worker", "worker": "http" },
             { "port": 3114, "role": "worker", "worker": "ade" } ] }
```

Agent state comes from the pane's last lines: a permission or choice prompt is
`waiting`, Claude Code's `esc to interrupt` line is `working`. The agent's
`title` is the session title it put on its pane (Claude Code's conversation
topic) without the ✳ or spinner in front; it is null while the pane shows
tmux's default title, the host name. Selecting a window
(`tmux::windows::select`) works like tmux itself: every client attached to
that session, your own terminal included, switches to it.

Panes work the same way. `tmux::panes::select` makes a pane active and, with
`zoom: true`, zooms the window on it the way prefix `z` does, for every client
looking at that window; `zoom: false` unzooms. `tmux::panes::capture` returns a
pane's visible screen with its colour escapes, its size and cursor:

```bash
iii trigger tmux::panes::select pane=%3 zoom=true
iii trigger tmux::panes::capture pane=%3
```

## Configuration

```yaml
tmux_binary: tmux            # name on PATH or absolute path (never this worker's own binary)
socket_name: null            # tmux -L <name>; null = your default tmux server
socket_path: null            # tmux -S <path>; wins over socket_name
poll_interval_ms: 1000       # live feed cadence for sessions and agent state
ports_interval_ms: 3000      # process and listening-port re-scan cadence
busy_window_ms: 2000         # agents without working patterns: "working" while the pane changed this recently
command_timeout_ms: 5000     # one tmux command
max_terminals: 8             # concurrent Console terminals (each one is a tmux client)
terminal_idle_timeout_ms: 30000  # detach a Console terminal its page stopped heart-beating
agents:                      # first match wins; patterns are case-insensitive regexes over the pane's last lines
  - id: claude
    label: Claude Code
    process: [claude]
    working_patterns: ["esc to interrupt"]
    waiting_patterns: ["❯\\s*1\\.\\s*Yes", "Do you want to proceed\\?", "Enter to select"]
```

The built-in list also recognises `codex`, `opencode` and `gemini`; see
[`src/config.rs`](src/config.rs). Edit the configuration from the page's
settings action or with `configuration::set`.

## Custom trigger types

| Trigger type | Fires when | Payload to subscribers |
|---|---|---|
| `tmux::changed` | Once when bound, then whenever sessions, windows, panes, agent states, compose stacks or listening ports change | `{ sessions, ports }` — the same shapes `tmux::sessions::list` and `tmux::ports::list` return |

Bind it with `config: {}`. The worker only polls tmux while at least one
binding exists.

## skills

This version ships 1 skill file for agents, also browsable on the worker page:

- [`SKILL.md`](https://workers.iii.dev/workers/tmux?tab=skills&skill=SKILL.md&version=0.1.1)

### SKILL.md

# tmux

The tmux worker drives the `tmux` binary on the host and reads the same tmux
server the person uses in their terminal. It reports every session, window
and pane with the foreground command, working directory and title, and adds
what tmux itself does not know: the agent CLI running in a pane (matched in
the pane's process tree) with a working / waiting / idle state read from the
pane's last lines, the `iii compose` daemon running in a pane with its
engine's WebSocket port and its workers' ports, and every TCP port this
user's processes listen on, each traced back to the pane that started it.

Changes are tmux's own semantics. Selecting a window switches every client
attached to that session, the person's terminal included. Creating a window
makes it current unless `select: false` is passed. Killing a session or
window kills the programs in it. The Console page's terminal is a real tmux
client that only the Console drives.

## When to Use

- A person asks which Claude Code or Codex sessions are running, which of
  them is busy, or which one is waiting for an answer or an approval.
- A person asks whether `iii compose` is up, on which port the engine
  listens, or which ports the http, ade or other workers use.
- A person asks what is listening on a port, or which tmux window started a
  server.
- A person wants a new tmux session or window, optionally running a command
  in a given directory, or wants one renamed or closed.

## Boundaries

- Read functions (`status`, `sessions::list`, `ports::list`) are allowed by
  default. Creating, renaming, selecting and killing change the person's
  tmux and are approval-gated; killing ends whatever runs there, so name
  what will stop before asking. `panes::select` is approval-gated too: a
  zoom shows on every client looking at that window.
- `panes::capture` returns whatever is on a pane's screen, which can include
  anything the person typed or a program printed; it needs approval and its
  text should not be repeated beyond what the question needs.
- The worker never types into panes. `tmux::terminal::*` is the Console
  page's own terminal and is denied to agents.
- Agent state is a reading of the screen: `waiting` means a prompt that needs
  the person is visible, not that the agent's process is blocked. Patterns
  live in the worker configuration and can be tuned per agent.
- Ports are TCP listeners of this user's processes only, and tmux locations
  only exist for processes started inside tmux.
- tmux is Unix-only; on a host without tmux, `status` reports
  `available: false` and the lists come back empty.

## Functions

- `tmux::status` — whether tmux is installed, its version and path, and whether a server is running.
- `tmux::sessions::list` — every session → window → pane with command, cwd, title, size, agent state and session title, compose daemon and ports.
- `tmux::sessions::create` — start a detached session with an optional name, directory, first window name and command.
- `tmux::sessions::rename` / `tmux::sessions::kill` — rename or kill a session by id (`$5`) or exact name.
- `tmux::windows::create` — add a window to a session with an optional name, directory, command and `select`.
- `tmux::windows::select` — make a window current in its session (every attached client follows).
- `tmux::windows::rename` / `tmux::windows::kill` — rename or kill a window by id (`@3`) or index.
- `tmux::panes::select` — make a pane (`%5`) active; `zoom: true` zooms the window on it, `zoom: false` unzooms (every client of that window follows).
- `tmux::panes::capture` — a pane's visible screen with colour escapes, its size, cursor and alternate-screen flag.
- `tmux::ports::list` — listening TCP ports with process, iii role, worker, compose namespace and pane, plus each `iii compose` stack.

## Reactive triggers

Bind `tmux::changed` instead of polling `sessions::list` when something must
react to tmux: an agent that finishes a turn (`working` → `idle`), one that
starts waiting for the person, a compose stack that comes up, a session that
appears or goes away. It fires the full overview (`sessions` and `ports`,
the same shapes the two list functions return) once when bound and then only
when something changed; the worker polls tmux only while a binding exists.

Register a handler, then bind it with an empty config:

```ts
iii.registerFunction('my-worker::on-tmux', async ({ sessions, ports }) => {
  // compare agent states with the previous overview
})
iii.registerTrigger({ type: 'tmux::changed', function_id: 'my-worker::on-tmux', config: {} })
```

## api reference

```json
{
  "functions": [
    {
      "description": "Returns this worker instance's effective configuration entry ID, without its value.",
      "metadata": {
        "internal": true
      },
      "name": "tmux::configuration-id",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Empty user request. Ignore transport metadata such as `_caller_worker_id`, which the engine adds to routed calls; no payload field selects the entry.",
        "title": "ConfigurationIdentityRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Only the entry ID is exposed; configuration values and secrets stay in the service.",
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "title": "ConfigurationIdentityResponse",
        "type": "object"
      }
    },
    {
      "description": "Internal: re-read the tmux configuration after an operator change.",
      "metadata": {
        "internal": true
      },
      "name": "tmux::on-config-change",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Trigger payload for `<worker>::on-config-change`. Advisory only: handlers re-fetch the authoritative value and ignore it, so a direct call can never inject config.",
        "properties": {
          "id": {
            "default": null,
            "description": "Configuration id that changed.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "OnConfigChangeEvent",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Ack returned by the internal `<worker>::on-config-change` handler.",
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "title": "OnConfigChangeResponse",
        "type": "object"
      }
    },
    {
      "description": "The visible screen of one pane as text with its colour and style escapes (capture-pane -e), plus the pane's size, cursor position and whether a full-screen program has the alternate screen. Read-only.",
      "metadata": {},
      "name": "tmux::panes::capture",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "pane": {
            "description": "Pane id, e.g. `%5`.",
            "type": "string"
          }
        },
        "required": [
          "pane"
        ],
        "title": "PaneInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "alternate": {
            "description": "The pane shows its alternate screen (a full-screen program).",
            "type": "boolean"
          },
          "cursor_x": {
            "description": "Cursor column, from 0.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "cursor_y": {
            "description": "Cursor row, from 0.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "height": {
            "description": "Height in rows.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          },
          "pane_id": {
            "description": "Pane id.",
            "type": "string"
          },
          "text": {
            "description": "The visible screen, one line per row separated by `\\n`, with SGR escapes.",
            "type": "string"
          },
          "width": {
            "description": "Width in columns.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "alternate",
          "cursor_x",
          "cursor_y",
          "height",
          "pane_id",
          "text",
          "width"
        ],
        "title": "PaneCapture",
        "type": "object"
      }
    },
    {
      "description": "Make a pane the active pane of its window, optionally zooming the window on it (zoom: true, like tmux's prefix z) or unzooming it (zoom: false); without zoom the window keeps its zoom state. Like tmux itself, every client looking at that window follows, your terminal included. It does not change the session's current window (tmux::windows::select does).",
      "metadata": {},
      "name": "tmux::panes::select",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "pane": {
            "description": "Pane id, e.g. `%5`.",
            "type": "string"
          },
          "zoom": {
            "default": null,
            "description": "true zooms the window on this pane, false unzooms it, absent keeps the window's zoom.",
            "type": [
              "boolean",
              "null"
            ]
          }
        },
        "required": [
          "pane"
        ],
        "title": "SelectPaneInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "pane_id": {
            "description": "Pane id now active in its window.",
            "type": "string"
          },
          "session_id": {
            "description": "Session id the pane was resolved in.",
            "type": "string"
          },
          "window_id": {
            "description": "Window id holding the pane.",
            "type": "string"
          },
          "zoomed": {
            "description": "The window is zoomed on the active pane.",
            "type": "boolean"
          }
        },
        "required": [
          "pane_id",
          "session_id",
          "window_id",
          "zoomed"
        ],
        "title": "SelectedPane",
        "type": "object"
      }
    },
    {
      "description": "Every TCP port this user's processes listen on, with process, iii role (engine / worker / compose), worker name, compose namespace and the tmux pane the process runs in; plus each running `iii compose` stack with its engine WebSocket port and workers' ports.",
      "metadata": {},
      "name": "tmux::ports::list",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "No parameters.",
        "title": "EmptyInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "AddressFamily": {
            "enum": [
              "ipv4",
              "ipv6"
            ],
            "type": "string"
          },
          "ComposeEngine": {
            "properties": {
              "pid": {
                "description": "Engine pid.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "ports": {
                "description": "Ports the engine listens on.",
                "items": {
                  "format": "uint16",
                  "minimum": 0,
                  "type": "integer"
                },
                "type": "array"
              },
              "ws_port": {
                "description": "The engine WebSocket port workers connect to.",
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "pid",
              "ports"
            ],
            "type": "object"
          },
          "ComposeStack": {
            "properties": {
              "compose_file": {
                "description": "Compose file the daemon serves, when known.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "engine": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ComposeEngine"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The engine the daemon started, if it manages one."
              },
              "location": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/PaneRef"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "tmux pane the daemon runs in."
              },
              "namespace": {
                "description": "Daemon namespace (`iii:c:<namespace>`).",
                "type": "string"
              },
              "pid": {
                "description": "Daemon pid.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "project_dir": {
                "description": "Daemon working directory.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "workers": {
                "description": "Workers the daemon started.",
                "items": {
                  "$ref": "#/definitions/ComposeWorker"
                },
                "type": "array"
              }
            },
            "required": [
              "namespace",
              "pid",
              "workers"
            ],
            "type": "object"
          },
          "ComposeWorker": {
            "properties": {
              "name": {
                "description": "Worker name.",
                "type": "string"
              },
              "pid": {
                "description": "Top-most pid of the worker's process tree.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "ports": {
                "description": "Ports the worker's processes listen on.",
                "items": {
                  "format": "uint16",
                  "minimum": 0,
                  "type": "integer"
                },
                "type": "array"
              }
            },
            "required": [
              "name",
              "pid",
              "ports"
            ],
            "type": "object"
          },
          "Listener": {
            "description": "One TCP socket in LISTEN state.",
            "properties": {
              "address": {
                "description": "Bound address, e.g. `0.0.0.0` or `::1`.",
                "type": "string"
              },
              "compose": {
                "description": "Compose namespace the process belongs to.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "family": {
                "allOf": [
                  {
                    "$ref": "#/definitions/AddressFamily"
                  }
                ],
                "description": "IPv4 or IPv6."
              },
              "location": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/PaneRef"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "tmux pane the process descends from."
              },
              "pid": {
                "description": "Owning process.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "port": {
                "description": "Port number.",
                "format": "uint16",
                "minimum": 0,
                "type": "integer"
              },
              "process": {
                "description": "Owning process name.",
                "type": "string"
              },
              "role": {
                "allOf": [
                  {
                    "$ref": "#/definitions/ListenerRole"
                  }
                ],
                "description": "What kind of process owns the socket."
              },
              "worker": {
                "description": "iii worker name, when known.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "address",
              "family",
              "pid",
              "port",
              "process",
              "role"
            ],
            "type": "object"
          },
          "ListenerRole": {
            "oneOf": [
              {
                "description": "An iii engine (its WebSocket and built-in listeners).",
                "enum": [
                  "engine"
                ],
                "type": "string"
              },
              {
                "description": "An iii worker.",
                "enum": [
                  "worker"
                ],
                "type": "string"
              },
              {
                "description": "An `iii compose` daemon.",
                "enum": [
                  "compose"
                ],
                "type": "string"
              },
              {
                "description": "Anything else.",
                "enum": [
                  "other"
                ],
                "type": "string"
              }
            ]
          },
          "PaneRef": {
            "description": "Where a process runs in tmux.",
            "properties": {
              "pane_id": {
                "description": "Pane id.",
                "type": "string"
              },
              "session": {
                "description": "Session name.",
                "type": "string"
              },
              "session_id": {
                "description": "Session id.",
                "type": "string"
              },
              "window_id": {
                "description": "Window id.",
                "type": "string"
              },
              "window_index": {
                "description": "Window index.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "pane_id",
              "session",
              "session_id",
              "window_id",
              "window_index"
            ],
            "type": "object"
          }
        },
        "description": "Listening ports and the `iii compose` stacks that own them.",
        "properties": {
          "composes": {
            "description": "Running `iii compose` daemons.",
            "items": {
              "$ref": "#/definitions/ComposeStack"
            },
            "type": "array"
          },
          "error": {
            "description": "Why the scan failed, if it did.",
            "type": [
              "string",
              "null"
            ]
          },
          "generated_at_ms": {
            "description": "When the snapshot was taken.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "listeners": {
            "description": "Every TCP listening socket of this user's processes, sorted by port.",
            "items": {
              "$ref": "#/definitions/Listener"
            },
            "type": "array"
          },
          "supported": {
            "description": "This platform has a port scanner.",
            "type": "boolean"
          }
        },
        "required": [
          "composes",
          "generated_at_ms",
          "listeners",
          "supported"
        ],
        "title": "PortsSnapshot",
        "type": "object"
      }
    },
    {
      "description": "Create a detached tmux session (starting the tmux server if needed). Optional name, working directory (default $HOME), first window name and a shell command to run instead of the default shell.",
      "metadata": {},
      "name": "tmux::sessions::create",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "command": {
            "default": null,
            "description": "Shell command to run in the first window instead of the default shell.",
            "type": [
              "string",
              "null"
            ]
          },
          "cwd": {
            "default": null,
            "description": "Working directory, absolute or `~/…`. Defaults to $HOME.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "default": null,
            "description": "Session name; tmux picks a number when omitted. No `:` or `.`.",
            "type": [
              "string",
              "null"
            ]
          },
          "window_name": {
            "default": null,
            "description": "Name of the first window.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "title": "CreateSessionInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "pane_id": {
            "description": "First pane id.",
            "type": "string"
          },
          "session": {
            "description": "Session name.",
            "type": "string"
          },
          "session_id": {
            "description": "New session id, e.g. `$7`.",
            "type": "string"
          },
          "window_id": {
            "description": "First window id.",
            "type": "string"
          },
          "window_index": {
            "description": "First window index.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "pane_id",
          "session",
          "session_id",
          "window_id",
          "window_index"
        ],
        "title": "CreatedSession",
        "type": "object"
      }
    },
    {
      "description": "Kill a tmux session and every program running in its windows.",
      "metadata": {},
      "name": "tmux::sessions::kill",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "session": {
            "description": "Session id (`$5`) or exact name.",
            "type": "string"
          }
        },
        "required": [
          "session"
        ],
        "title": "SessionInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "killed": {
            "description": "Always true.",
            "type": "boolean"
          }
        },
        "required": [
          "killed"
        ],
        "title": "KilledOutput",
        "type": "object"
      }
    },
    {
      "description": "Every tmux session with its windows and panes: foreground command, cwd, title, size, the agent CLI running in the pane (claude, codex, … with state working / waiting / idle), the `iii compose` daemon it runs and the ports its processes listen on.",
      "metadata": {},
      "name": "tmux::sessions::list",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "No parameters.",
        "title": "EmptyInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "AddressFamily": {
            "enum": [
              "ipv4",
              "ipv6"
            ],
            "type": "string"
          },
          "AgentState": {
            "oneOf": [
              {
                "description": "The agent is running a turn.",
                "enum": [
                  "working"
                ],
                "type": "string"
              },
              {
                "description": "The agent shows a prompt that needs you.",
                "enum": [
                  "waiting"
                ],
                "type": "string"
              },
              {
                "description": "The agent waits for a new message.",
                "enum": [
                  "idle"
                ],
                "type": "string"
              }
            ]
          },
          "AgentStatus": {
            "properties": {
              "id": {
                "description": "Matcher id from the configuration, e.g. `claude`.",
                "type": "string"
              },
              "label": {
                "description": "Display name, e.g. `Claude Code`.",
                "type": "string"
              },
              "pid": {
                "description": "Pid of the agent process.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "since_ms": {
                "description": "When the agent entered `state`.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "state": {
                "allOf": [
                  {
                    "$ref": "#/definitions/AgentState"
                  }
                ],
                "description": "What the agent is doing."
              },
              "title": {
                "default": null,
                "description": "The agent's session title: the pane title without the agent's status glyph (Claude Code's ✳ or spinner). Null when the pane only shows tmux's default title (the host name) or nothing.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "label",
              "pid",
              "since_ms",
              "state"
            ],
            "type": "object"
          },
          "ComposeRef": {
            "properties": {
              "namespace": {
                "description": "Compose daemon namespace.",
                "type": "string"
              },
              "pid": {
                "description": "Compose daemon pid.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "namespace",
              "pid"
            ],
            "type": "object"
          },
          "Listener": {
            "description": "One TCP socket in LISTEN state.",
            "properties": {
              "address": {
                "description": "Bound address, e.g. `0.0.0.0` or `::1`.",
                "type": "string"
              },
              "compose": {
                "description": "Compose namespace the process belongs to.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "family": {
                "allOf": [
                  {
                    "$ref": "#/definitions/AddressFamily"
                  }
                ],
                "description": "IPv4 or IPv6."
              },
              "location": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/PaneRef"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "tmux pane the process descends from."
              },
              "pid": {
                "description": "Owning process.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "port": {
                "description": "Port number.",
                "format": "uint16",
                "minimum": 0,
                "type": "integer"
              },
              "process": {
                "description": "Owning process name.",
                "type": "string"
              },
              "role": {
                "allOf": [
                  {
                    "$ref": "#/definitions/ListenerRole"
                  }
                ],
                "description": "What kind of process owns the socket."
              },
              "worker": {
                "description": "iii worker name, when known.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "address",
              "family",
              "pid",
              "port",
              "process",
              "role"
            ],
            "type": "object"
          },
          "ListenerRole": {
            "oneOf": [
              {
                "description": "An iii engine (its WebSocket and built-in listeners).",
                "enum": [
                  "engine"
                ],
                "type": "string"
              },
              {
                "description": "An iii worker.",
                "enum": [
                  "worker"
                ],
                "type": "string"
              },
              {
                "description": "An `iii compose` daemon.",
                "enum": [
                  "compose"
                ],
                "type": "string"
              },
              {
                "description": "Anything else.",
                "enum": [
                  "other"
                ],
                "type": "string"
              }
            ]
          },
          "Pane": {
            "properties": {
              "active": {
                "description": "The window's active pane.",
                "type": "boolean"
              },
              "agent": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/AgentStatus"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The agent CLI running in this pane, if any."
              },
              "command": {
                "description": "Foreground process name.",
                "type": "string"
              },
              "compose": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ComposeRef"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The `iii compose` daemon running in this pane, if any."
              },
              "cwd": {
                "description": "Current directory.",
                "type": "string"
              },
              "dead": {
                "description": "The pane's process exited and the pane is kept.",
                "type": "boolean"
              },
              "height": {
                "description": "Height in rows.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "id": {
                "description": "Pane id, e.g. `%5`.",
                "type": "string"
              },
              "index": {
                "description": "Pane index inside the window.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "pid": {
                "description": "Pid of the process tmux started in the pane.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "ports": {
                "description": "Listening sockets owned by processes started from this pane.",
                "items": {
                  "$ref": "#/definitions/Listener"
                },
                "type": "array"
              },
              "title": {
                "description": "Pane title set by the program.",
                "type": "string"
              },
              "width": {
                "description": "Width in columns.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "active",
              "command",
              "cwd",
              "dead",
              "height",
              "id",
              "index",
              "pid",
              "ports",
              "title",
              "width"
            ],
            "type": "object"
          },
          "PaneRef": {
            "description": "Where a process runs in tmux.",
            "properties": {
              "pane_id": {
                "description": "Pane id.",
                "type": "string"
              },
              "session": {
                "description": "Session name.",
                "type": "string"
              },
              "session_id": {
                "description": "Session id.",
                "type": "string"
              },
              "window_id": {
                "description": "Window id.",
                "type": "string"
              },
              "window_index": {
                "description": "Window index.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "pane_id",
              "session",
              "session_id",
              "window_id",
              "window_index"
            ],
            "type": "object"
          },
          "Session": {
            "properties": {
              "activity_at_ms": {
                "description": "Last activity in any of its windows.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "attached": {
                "description": "tmux clients attached, console terminals included.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "console_attached": {
                "description": "How many attached clients are console terminals.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "created_at_ms": {
                "description": "When the session was created.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "id": {
                "description": "Session id, e.g. `$5`.",
                "type": "string"
              },
              "name": {
                "description": "Session name.",
                "type": "string"
              },
              "windows": {
                "description": "Windows sorted by index.",
                "items": {
                  "$ref": "#/definitions/Window"
                },
                "type": "array"
              }
            },
            "required": [
              "activity_at_ms",
              "attached",
              "console_attached",
              "created_at_ms",
              "id",
              "name",
              "windows"
            ],
            "type": "object"
          },
          "TmuxInfo": {
            "description": "Whether a usable tmux exists and which server this worker talks to.",
            "properties": {
              "available": {
                "description": "A usable tmux binary was found.",
                "type": "boolean"
              },
              "error": {
                "description": "Why tmux is unavailable, or the last listing error.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "description": "Resolved tmux binary.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "server_running": {
                "description": "A tmux server is running on that socket.",
                "type": "boolean"
              },
              "socket_path": {
                "description": "Server socket, known while the server runs.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "version": {
                "description": "tmux version, e.g. `3.6`.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "available",
              "server_running"
            ],
            "type": "object"
          },
          "Window": {
            "properties": {
              "active": {
                "description": "This is the session's current window.",
                "type": "boolean"
              },
              "activity_at_ms": {
                "description": "Last output in the window.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "bell": {
                "description": "A bell rang in the window.",
                "type": "boolean"
              },
              "id": {
                "description": "Window id, e.g. `@3` (unique on the server).",
                "type": "string"
              },
              "index": {
                "description": "Window index inside the session.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "name": {
                "description": "Window name.",
                "type": "string"
              },
              "panes": {
                "description": "Panes sorted by index.",
                "items": {
                  "$ref": "#/definitions/Pane"
                },
                "type": "array"
              },
              "zoomed": {
                "description": "A pane is zoomed.",
                "type": "boolean"
              }
            },
            "required": [
              "active",
              "activity_at_ms",
              "bell",
              "id",
              "index",
              "name",
              "panes",
              "zoomed"
            ],
            "type": "object"
          }
        },
        "description": "Every session with its windows and panes.",
        "properties": {
          "generated_at_ms": {
            "description": "When the snapshot was taken.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "sessions": {
            "description": "Sessions sorted by name.",
            "items": {
              "$ref": "#/definitions/Session"
            },
            "type": "array"
          },
          "tmux": {
            "allOf": [
              {
                "$ref": "#/definitions/TmuxInfo"
              }
            ],
            "description": "tmux availability and server."
          }
        },
        "required": [
          "generated_at_ms",
          "sessions",
          "tmux"
        ],
        "title": "SessionsSnapshot",
        "type": "object"
      }
    },
    {
      "description": "Rename a tmux session.",
      "metadata": {},
      "name": "tmux::sessions::rename",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "name": {
            "description": "New name. No `:` or `.`.",
            "type": "string"
          },
          "session": {
            "description": "Session id (`$5`) or exact name.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "session"
        ],
        "title": "RenameSessionInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "name": {
            "description": "New name.",
            "type": "string"
          },
          "session_id": {
            "description": "Session id.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "session_id"
        ],
        "title": "RenamedSession",
        "type": "object"
      }
    },
    {
      "description": "Whether tmux is installed, its version and path, and whether a tmux server is running on the configured socket.",
      "metadata": {},
      "name": "tmux::status",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "No parameters.",
        "title": "EmptyInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Whether a usable tmux exists and which server this worker talks to.",
        "properties": {
          "available": {
            "description": "A usable tmux binary was found.",
            "type": "boolean"
          },
          "error": {
            "description": "Why tmux is unavailable, or the last listing error.",
            "type": [
              "string",
              "null"
            ]
          },
          "path": {
            "description": "Resolved tmux binary.",
            "type": [
              "string",
              "null"
            ]
          },
          "server_running": {
            "description": "A tmux server is running on that socket.",
            "type": "boolean"
          },
          "socket_path": {
            "description": "Server socket, known while the server runs.",
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "description": "tmux version, e.g. `3.6`.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "available",
          "server_running"
        ],
        "title": "TmuxInfo",
        "type": "object"
      }
    },
    {
      "description": "Detach a console terminal's tmux client. The session keeps running.",
      "metadata": {
        "internal": true,
        "trace_hidden": true
      },
      "name": "tmux::terminal::close",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Identifies one terminal and proves the caller opened it.",
        "properties": {
          "access_key": {
            "description": "Credential from `open`.",
            "type": "string"
          },
          "terminal_id": {
            "description": "Terminal handle from `open`.",
            "type": "string"
          }
        },
        "required": [
          "access_key",
          "terminal_id"
        ],
        "title": "TerminalRef",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "closed": {
            "description": "False when the terminal was already gone.",
            "type": "boolean"
          }
        },
        "required": [
          "closed"
        ],
        "title": "CloseResponse",
        "type": "object"
      }
    },
    {
      "description": "Attach a console terminal to a tmux session as a real tmux client running in a PTY. Output is pushed to the page's handler.",
      "metadata": {
        "internal": true,
        "trace_hidden": true
      },
      "name": "tmux::terminal::open",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "WindowArg": {
            "anyOf": [
              {
                "description": "Window index inside the session.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              {
                "description": "Window id like `@3`, or an index as text.",
                "type": "string"
              }
            ],
            "description": "A window as callers name it: an id (`\"@3\"`) or an index (`2` or `\"2\"`)."
          }
        },
        "properties": {
          "cols": {
            "description": "Terminal width in columns (2..=500).",
            "format": "uint16",
            "minimum": 0,
            "type": "integer"
          },
          "output_function_id": {
            "description": "Browser handler receiving output: `iii::tmux-ui::pty-output::console-<browser id>`.",
            "type": "string"
          },
          "rows": {
            "description": "Terminal height in rows (2..=500).",
            "format": "uint16",
            "minimum": 0,
            "type": "integer"
          },
          "session": {
            "description": "Session id (`$5`) or exact name to attach to.",
            "type": "string"
          },
          "window": {
            "anyOf": [
              {
                "$ref": "#/definitions/WindowArg"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Window id (`@3`) or index to select before attaching."
          }
        },
        "required": [
          "cols",
          "output_function_id",
          "rows",
          "session"
        ],
        "title": "OpenRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "access_key": {
            "description": "Short-lived credential required by every other call. Never persist it.",
            "type": "string"
          },
          "client_tty": {
            "description": "The tmux client's tty, as `list-clients` shows it.",
            "type": [
              "string",
              "null"
            ]
          },
          "session_id": {
            "description": "Session the client attached to.",
            "type": "string"
          },
          "terminal_id": {
            "description": "Terminal handle for the other calls.",
            "type": "string"
          }
        },
        "required": [
          "access_key",
          "session_id",
          "terminal_id"
        ],
        "title": "OpenResponse",
        "type": "object"
      }
    },
    {
      "description": "Ask tmux to repaint the console terminal's whole screen (refresh-client).",
      "metadata": {
        "internal": true,
        "trace_hidden": true
      },
      "name": "tmux::terminal::redraw",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Identifies one terminal and proves the caller opened it.",
        "properties": {
          "access_key": {
            "description": "Credential from `open`.",
            "type": "string"
          },
          "terminal_id": {
            "description": "Terminal handle from `open`.",
            "type": "string"
          }
        },
        "required": [
          "access_key",
          "terminal_id"
        ],
        "title": "TerminalRef",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "ok": {
            "description": "Always true.",
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "title": "OkResponse",
        "type": "object"
      }
    },
    {
      "description": "Re-send buffered output frames after a sequence, for gap repair.",
      "metadata": {
        "internal": true,
        "trace_hidden": true
      },
      "name": "tmux::terminal::replay",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Identifies one terminal and proves the caller opened it.",
        "properties": {
          "access_key": {
            "description": "Credential from `open`.",
            "type": "string"
          },
          "after_sequence": {
            "description": "Last sequence the page applied; frames after it are returned.",
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "terminal_id": {
            "description": "Terminal handle from `open`.",
            "type": "string"
          }
        },
        "required": [
          "access_key",
          "after_sequence",
          "terminal_id"
        ],
        "title": "ReplayRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "OutputFrame": {
            "properties": {
              "data": {
                "type": "string"
              },
              "sequence": {
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "data",
              "sequence"
            ],
            "type": "object"
          }
        },
        "properties": {
          "frames": {
            "items": {
              "$ref": "#/definitions/OutputFrame"
            },
            "type": "array"
          },
          "next_sequence": {
            "format": "uint64",
            "minimum": 0,
            "type": "integer"
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "required": [
          "frames",
          "next_sequence",
          "truncated"
        ],
        "title": "Replay",
        "type": "object"
      }
    },
    {
      "description": "Resize a console terminal; also its heartbeat.",
      "metadata": {
        "internal": true,
        "trace_hidden": true
      },
      "name": "tmux::terminal::resize",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Identifies one terminal and proves the caller opened it.",
        "properties": {
          "access_key": {
            "description": "Credential from `open`.",
            "type": "string"
          },
          "cols": {
            "description": "Width in columns (2..=500).",
            "format": "uint16",
            "minimum": 0,
            "type": "integer"
          },
          "rows": {
            "description": "Height in rows (2..=500).",
            "format": "uint16",
            "minimum": 0,
            "type": "integer"
          },
          "terminal_id": {
            "description": "Terminal handle from `open`.",
            "type": "string"
          }
        },
        "required": [
          "access_key",
          "cols",
          "rows",
          "terminal_id"
        ],
        "title": "ResizeRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "cols": {
            "description": "Width applied.",
            "format": "uint16",
            "minimum": 0,
            "type": "integer"
          },
          "rows": {
            "description": "Height applied.",
            "format": "uint16",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "cols",
          "rows"
        ],
        "title": "ResizeResponse",
        "type": "object"
      }
    },
    {
      "description": "Move only this console terminal's tmux client to another session (switch-client), optionally selecting a window there.",
      "metadata": {
        "internal": true,
        "trace_hidden": true
      },
      "name": "tmux::terminal::switch",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "WindowArg": {
            "anyOf": [
              {
                "description": "Window index inside the session.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              {
                "description": "Window id like `@3`, or an index as text.",
                "type": "string"
              }
            ],
            "description": "A window as callers name it: an id (`\"@3\"`) or an index (`2` or `\"2\"`)."
          }
        },
        "description": "Identifies one terminal and proves the caller opened it.",
        "properties": {
          "access_key": {
            "description": "Credential from `open`.",
            "type": "string"
          },
          "session": {
            "description": "Session id (`$5`) or exact name to move this client to.",
            "type": "string"
          },
          "terminal_id": {
            "description": "Terminal handle from `open`.",
            "type": "string"
          },
          "window": {
            "anyOf": [
              {
                "$ref": "#/definitions/WindowArg"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Window id (`@3`) or index to select there."
          }
        },
        "required": [
          "access_key",
          "session",
          "terminal_id"
        ],
        "title": "SwitchRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "session_id": {
            "description": "Session the client now shows.",
            "type": "string"
          }
        },
        "required": [
          "session_id"
        ],
        "title": "SwitchResponse",
        "type": "object"
      }
    },
    {
      "description": "Write base64 keyboard input to a console terminal's tmux client.",
      "metadata": {
        "internal": true,
        "trace_hidden": true
      },
      "name": "tmux::terminal::write",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Identifies one terminal and proves the caller opened it.",
        "properties": {
          "access_key": {
            "description": "Credential from `open`.",
            "type": "string"
          },
          "data": {
            "description": "Base64 keyboard input, at most 64 KiB decoded.",
            "type": "string"
          },
          "terminal_id": {
            "description": "Terminal handle from `open`.",
            "type": "string"
          }
        },
        "required": [
          "access_key",
          "data",
          "terminal_id"
        ],
        "title": "WriteRequest",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "written": {
            "description": "Bytes written to the tmux client.",
            "format": "uint",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "written"
        ],
        "title": "WriteResponse",
        "type": "object"
      }
    },
    {
      "description": "Serve the tmux worker's injected console UI assets (content function for its console:script / console:style / console:module triggers).",
      "metadata": {
        "internal": true
      },
      "name": "tmux::ui-content",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Input of the content function: the console asks for one asset by path.",
        "properties": {
          "path": {
            "description": "The asset path from the trigger config (e.g. `state/page.js`).",
            "type": "string"
          }
        },
        "required": [
          "path"
        ],
        "title": "UiContentInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "Output of the content function.",
        "properties": {
          "content": {
            "description": "The asset source, verbatim.",
            "type": "string"
          },
          "content_type": {
            "description": "MIME type the console should serve the asset with.",
            "type": "string"
          }
        },
        "required": [
          "content",
          "content_type"
        ],
        "title": "UiContentResult",
        "type": "object"
      }
    },
    {
      "description": "Create a window in a tmux session. Optional name, working directory (default: the directory the session was created in), a shell command to run instead of the default shell, and whether to make it the current window (default true).",
      "metadata": {},
      "name": "tmux::windows::create",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "command": {
            "default": null,
            "description": "Shell command to run instead of the default shell.",
            "type": [
              "string",
              "null"
            ]
          },
          "cwd": {
            "default": null,
            "description": "Working directory, absolute or `~/…`. Defaults to the directory the session was created in.",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "default": null,
            "description": "Window name. No `:` or `.`.",
            "type": [
              "string",
              "null"
            ]
          },
          "select": {
            "default": null,
            "description": "Make it the session's current window (default true).",
            "type": [
              "boolean",
              "null"
            ]
          },
          "session": {
            "description": "Session id (`$5`) or exact name.",
            "type": "string"
          }
        },
        "required": [
          "session"
        ],
        "title": "CreateWindowInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "pane_id": {
            "description": "Its first pane id.",
            "type": "string"
          },
          "session_id": {
            "description": "Session id.",
            "type": "string"
          },
          "window_id": {
            "description": "New window id, e.g. `@9`.",
            "type": "string"
          },
          "window_index": {
            "description": "New window index.",
            "format": "uint32",
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "pane_id",
          "session_id",
          "window_id",
          "window_index"
        ],
        "title": "CreatedWindow",
        "type": "object"
      }
    },
    {
      "description": "Kill a tmux window and every program running in its panes.",
      "metadata": {},
      "name": "tmux::windows::kill",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "WindowArg": {
            "anyOf": [
              {
                "description": "Window index inside the session.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              {
                "description": "Window id like `@3`, or an index as text.",
                "type": "string"
              }
            ],
            "description": "A window as callers name it: an id (`\"@3\"`) or an index (`2` or `\"2\"`)."
          }
        },
        "properties": {
          "session": {
            "description": "Session id (`$5`) or exact name.",
            "type": "string"
          },
          "window": {
            "allOf": [
              {
                "$ref": "#/definitions/WindowArg"
              }
            ],
            "description": "Window id (`@3`) or index."
          }
        },
        "required": [
          "session",
          "window"
        ],
        "title": "WindowInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "killed": {
            "description": "Always true.",
            "type": "boolean"
          }
        },
        "required": [
          "killed"
        ],
        "title": "KilledOutput",
        "type": "object"
      }
    },
    {
      "description": "Rename a tmux window.",
      "metadata": {},
      "name": "tmux::windows::rename",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "WindowArg": {
            "anyOf": [
              {
                "description": "Window index inside the session.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              {
                "description": "Window id like `@3`, or an index as text.",
                "type": "string"
              }
            ],
            "description": "A window as callers name it: an id (`\"@3\"`) or an index (`2` or `\"2\"`)."
          }
        },
        "properties": {
          "name": {
            "description": "New name. No `:` or `.`.",
            "type": "string"
          },
          "session": {
            "description": "Session id (`$5`) or exact name.",
            "type": "string"
          },
          "window": {
            "allOf": [
              {
                "$ref": "#/definitions/WindowArg"
              }
            ],
            "description": "Window id (`@3`) or index."
          }
        },
        "required": [
          "name",
          "session",
          "window"
        ],
        "title": "RenameWindowInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "name": {
            "description": "New name.",
            "type": "string"
          },
          "window_id": {
            "description": "Window id.",
            "type": "string"
          }
        },
        "required": [
          "name",
          "window_id"
        ],
        "title": "RenamedWindow",
        "type": "object"
      }
    },
    {
      "description": "Make a window the current window of its session. Like tmux itself, every client attached to that session (your terminal included) switches to it.",
      "metadata": {},
      "name": "tmux::windows::select",
      "request_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "WindowArg": {
            "anyOf": [
              {
                "description": "Window index inside the session.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              {
                "description": "Window id like `@3`, or an index as text.",
                "type": "string"
              }
            ],
            "description": "A window as callers name it: an id (`\"@3\"`) or an index (`2` or `\"2\"`)."
          }
        },
        "properties": {
          "session": {
            "description": "Session id (`$5`) or exact name.",
            "type": "string"
          },
          "window": {
            "allOf": [
              {
                "$ref": "#/definitions/WindowArg"
              }
            ],
            "description": "Window id (`@3`) or index."
          }
        },
        "required": [
          "session",
          "window"
        ],
        "title": "WindowInput",
        "type": "object"
      },
      "response_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "properties": {
          "session_id": {
            "description": "Session id.",
            "type": "string"
          },
          "window_id": {
            "description": "Window id now current.",
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "window_id"
        ],
        "title": "SelectedWindow",
        "type": "object"
      }
    }
  ],
  "triggers": [
    {
      "description": "Live tmux overview: fires the full state (sessions, windows, panes with agent/compose/port status, compose stacks and listening ports) when bound and again whenever it changes. Config takes no options.",
      "invocation_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "`tmux::changed` takes no options.",
        "title": "ChangedConfig",
        "type": "object"
      },
      "metadata": {},
      "name": "tmux::changed",
      "return_schema": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "definitions": {
          "AddressFamily": {
            "enum": [
              "ipv4",
              "ipv6"
            ],
            "type": "string"
          },
          "AgentState": {
            "oneOf": [
              {
                "description": "The agent is running a turn.",
                "enum": [
                  "working"
                ],
                "type": "string"
              },
              {
                "description": "The agent shows a prompt that needs you.",
                "enum": [
                  "waiting"
                ],
                "type": "string"
              },
              {
                "description": "The agent waits for a new message.",
                "enum": [
                  "idle"
                ],
                "type": "string"
              }
            ]
          },
          "AgentStatus": {
            "properties": {
              "id": {
                "description": "Matcher id from the configuration, e.g. `claude`.",
                "type": "string"
              },
              "label": {
                "description": "Display name, e.g. `Claude Code`.",
                "type": "string"
              },
              "pid": {
                "description": "Pid of the agent process.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "since_ms": {
                "description": "When the agent entered `state`.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "state": {
                "allOf": [
                  {
                    "$ref": "#/definitions/AgentState"
                  }
                ],
                "description": "What the agent is doing."
              },
              "title": {
                "default": null,
                "description": "The agent's session title: the pane title without the agent's status glyph (Claude Code's ✳ or spinner). Null when the pane only shows tmux's default title (the host name) or nothing.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "label",
              "pid",
              "since_ms",
              "state"
            ],
            "type": "object"
          },
          "ComposeEngine": {
            "properties": {
              "pid": {
                "description": "Engine pid.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "ports": {
                "description": "Ports the engine listens on.",
                "items": {
                  "format": "uint16",
                  "minimum": 0,
                  "type": "integer"
                },
                "type": "array"
              },
              "ws_port": {
                "description": "The engine WebSocket port workers connect to.",
                "format": "uint16",
                "minimum": 0,
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "pid",
              "ports"
            ],
            "type": "object"
          },
          "ComposeRef": {
            "properties": {
              "namespace": {
                "description": "Compose daemon namespace.",
                "type": "string"
              },
              "pid": {
                "description": "Compose daemon pid.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "namespace",
              "pid"
            ],
            "type": "object"
          },
          "ComposeStack": {
            "properties": {
              "compose_file": {
                "description": "Compose file the daemon serves, when known.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "engine": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ComposeEngine"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The engine the daemon started, if it manages one."
              },
              "location": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/PaneRef"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "tmux pane the daemon runs in."
              },
              "namespace": {
                "description": "Daemon namespace (`iii:c:<namespace>`).",
                "type": "string"
              },
              "pid": {
                "description": "Daemon pid.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "project_dir": {
                "description": "Daemon working directory.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "workers": {
                "description": "Workers the daemon started.",
                "items": {
                  "$ref": "#/definitions/ComposeWorker"
                },
                "type": "array"
              }
            },
            "required": [
              "namespace",
              "pid",
              "workers"
            ],
            "type": "object"
          },
          "ComposeWorker": {
            "properties": {
              "name": {
                "description": "Worker name.",
                "type": "string"
              },
              "pid": {
                "description": "Top-most pid of the worker's process tree.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "ports": {
                "description": "Ports the worker's processes listen on.",
                "items": {
                  "format": "uint16",
                  "minimum": 0,
                  "type": "integer"
                },
                "type": "array"
              }
            },
            "required": [
              "name",
              "pid",
              "ports"
            ],
            "type": "object"
          },
          "Listener": {
            "description": "One TCP socket in LISTEN state.",
            "properties": {
              "address": {
                "description": "Bound address, e.g. `0.0.0.0` or `::1`.",
                "type": "string"
              },
              "compose": {
                "description": "Compose namespace the process belongs to.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "family": {
                "allOf": [
                  {
                    "$ref": "#/definitions/AddressFamily"
                  }
                ],
                "description": "IPv4 or IPv6."
              },
              "location": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/PaneRef"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "tmux pane the process descends from."
              },
              "pid": {
                "description": "Owning process.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "port": {
                "description": "Port number.",
                "format": "uint16",
                "minimum": 0,
                "type": "integer"
              },
              "process": {
                "description": "Owning process name.",
                "type": "string"
              },
              "role": {
                "allOf": [
                  {
                    "$ref": "#/definitions/ListenerRole"
                  }
                ],
                "description": "What kind of process owns the socket."
              },
              "worker": {
                "description": "iii worker name, when known.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "address",
              "family",
              "pid",
              "port",
              "process",
              "role"
            ],
            "type": "object"
          },
          "ListenerRole": {
            "oneOf": [
              {
                "description": "An iii engine (its WebSocket and built-in listeners).",
                "enum": [
                  "engine"
                ],
                "type": "string"
              },
              {
                "description": "An iii worker.",
                "enum": [
                  "worker"
                ],
                "type": "string"
              },
              {
                "description": "An `iii compose` daemon.",
                "enum": [
                  "compose"
                ],
                "type": "string"
              },
              {
                "description": "Anything else.",
                "enum": [
                  "other"
                ],
                "type": "string"
              }
            ]
          },
          "Pane": {
            "properties": {
              "active": {
                "description": "The window's active pane.",
                "type": "boolean"
              },
              "agent": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/AgentStatus"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The agent CLI running in this pane, if any."
              },
              "command": {
                "description": "Foreground process name.",
                "type": "string"
              },
              "compose": {
                "anyOf": [
                  {
                    "$ref": "#/definitions/ComposeRef"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "The `iii compose` daemon running in this pane, if any."
              },
              "cwd": {
                "description": "Current directory.",
                "type": "string"
              },
              "dead": {
                "description": "The pane's process exited and the pane is kept.",
                "type": "boolean"
              },
              "height": {
                "description": "Height in rows.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "id": {
                "description": "Pane id, e.g. `%5`.",
                "type": "string"
              },
              "index": {
                "description": "Pane index inside the window.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "pid": {
                "description": "Pid of the process tmux started in the pane.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "ports": {
                "description": "Listening sockets owned by processes started from this pane.",
                "items": {
                  "$ref": "#/definitions/Listener"
                },
                "type": "array"
              },
              "title": {
                "description": "Pane title set by the program.",
                "type": "string"
              },
              "width": {
                "description": "Width in columns.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "active",
              "command",
              "cwd",
              "dead",
              "height",
              "id",
              "index",
              "pid",
              "ports",
              "title",
              "width"
            ],
            "type": "object"
          },
          "PaneRef": {
            "description": "Where a process runs in tmux.",
            "properties": {
              "pane_id": {
                "description": "Pane id.",
                "type": "string"
              },
              "session": {
                "description": "Session name.",
                "type": "string"
              },
              "session_id": {
                "description": "Session id.",
                "type": "string"
              },
              "window_id": {
                "description": "Window id.",
                "type": "string"
              },
              "window_index": {
                "description": "Window index.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              }
            },
            "required": [
              "pane_id",
              "session",
              "session_id",
              "window_id",
              "window_index"
            ],
            "type": "object"
          },
          "PortsSnapshot": {
            "description": "Listening ports and the `iii compose` stacks that own them.",
            "properties": {
              "composes": {
                "description": "Running `iii compose` daemons.",
                "items": {
                  "$ref": "#/definitions/ComposeStack"
                },
                "type": "array"
              },
              "error": {
                "description": "Why the scan failed, if it did.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "generated_at_ms": {
                "description": "When the snapshot was taken.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "listeners": {
                "description": "Every TCP listening socket of this user's processes, sorted by port.",
                "items": {
                  "$ref": "#/definitions/Listener"
                },
                "type": "array"
              },
              "supported": {
                "description": "This platform has a port scanner.",
                "type": "boolean"
              }
            },
            "required": [
              "composes",
              "generated_at_ms",
              "listeners",
              "supported"
            ],
            "type": "object"
          },
          "Session": {
            "properties": {
              "activity_at_ms": {
                "description": "Last activity in any of its windows.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "attached": {
                "description": "tmux clients attached, console terminals included.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "console_attached": {
                "description": "How many attached clients are console terminals.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "created_at_ms": {
                "description": "When the session was created.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "id": {
                "description": "Session id, e.g. `$5`.",
                "type": "string"
              },
              "name": {
                "description": "Session name.",
                "type": "string"
              },
              "windows": {
                "description": "Windows sorted by index.",
                "items": {
                  "$ref": "#/definitions/Window"
                },
                "type": "array"
              }
            },
            "required": [
              "activity_at_ms",
              "attached",
              "console_attached",
              "created_at_ms",
              "id",
              "name",
              "windows"
            ],
            "type": "object"
          },
          "SessionsSnapshot": {
            "description": "Every session with its windows and panes.",
            "properties": {
              "generated_at_ms": {
                "description": "When the snapshot was taken.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "sessions": {
                "description": "Sessions sorted by name.",
                "items": {
                  "$ref": "#/definitions/Session"
                },
                "type": "array"
              },
              "tmux": {
                "allOf": [
                  {
                    "$ref": "#/definitions/TmuxInfo"
                  }
                ],
                "description": "tmux availability and server."
              }
            },
            "required": [
              "generated_at_ms",
              "sessions",
              "tmux"
            ],
            "type": "object"
          },
          "TmuxInfo": {
            "description": "Whether a usable tmux exists and which server this worker talks to.",
            "properties": {
              "available": {
                "description": "A usable tmux binary was found.",
                "type": "boolean"
              },
              "error": {
                "description": "Why tmux is unavailable, or the last listing error.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "description": "Resolved tmux binary.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "server_running": {
                "description": "A tmux server is running on that socket.",
                "type": "boolean"
              },
              "socket_path": {
                "description": "Server socket, known while the server runs.",
                "type": [
                  "string",
                  "null"
                ]
              },
              "version": {
                "description": "tmux version, e.g. `3.6`.",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "available",
              "server_running"
            ],
            "type": "object"
          },
          "Window": {
            "properties": {
              "active": {
                "description": "This is the session's current window.",
                "type": "boolean"
              },
              "activity_at_ms": {
                "description": "Last output in the window.",
                "format": "uint64",
                "minimum": 0,
                "type": "integer"
              },
              "bell": {
                "description": "A bell rang in the window.",
                "type": "boolean"
              },
              "id": {
                "description": "Window id, e.g. `@3` (unique on the server).",
                "type": "string"
              },
              "index": {
                "description": "Window index inside the session.",
                "format": "uint32",
                "minimum": 0,
                "type": "integer"
              },
              "name": {
                "description": "Window name.",
                "type": "string"
              },
              "panes": {
                "description": "Panes sorted by index.",
                "items": {
                  "$ref": "#/definitions/Pane"
                },
                "type": "array"
              },
              "zoomed": {
                "description": "A pane is zoomed.",
                "type": "boolean"
              }
            },
            "required": [
              "active",
              "activity_at_ms",
              "bell",
              "id",
              "index",
              "name",
              "panes",
              "zoomed"
            ],
            "type": "object"
          }
        },
        "description": "Payload of the `tmux::changed` live feed.",
        "properties": {
          "ports": {
            "allOf": [
              {
                "$ref": "#/definitions/PortsSnapshot"
              }
            ],
            "description": "Listening ports and compose stacks."
          },
          "sessions": {
            "allOf": [
              {
                "$ref": "#/definitions/SessionsSnapshot"
              }
            ],
            "description": "Sessions, windows, panes and their status."
          }
        },
        "required": [
          "ports",
          "sessions"
        ],
        "title": "Overview",
        "type": "object"
      }
    }
  ]
}
```
