Files
pebrel/docs/runtime-api-v1.schema.json
T
kuddev 66d1b1946e feat(runtime): resource CLI, pane exec, quick jump, terminal fixes
Snapshot commit of the in-progress runtime-control and terminal-fidelity
work on this branch. Every item below is code-complete and covered by
targeted checks; none of it has had human UX acceptance yet.

Runtime control surface
- Resource-style CLI (`nebula <resource> <verb>`) replacing the flat verb
  list, with shell completions regenerated for zsh/bash/fish.
- `pane.exec` end to end: protocol params, both UI routes, and a process
  executor that reaps the whole descendant tree through a Windows Job
  Object so a timed-out or early-exiting child cannot leave the stdout
  reader waiting on an EOF that never comes.
- `shortcuts` module exposing the keybinding surface to the API.
- Agent environment contract (`agent_env`): TERM_PROGRAM and friends, so
  third-party tooling identifies Nebula without special-casing.
- Provider command matrix filled in for OpenCode, Cursor, Kimi, Pi and
  omp (cold start / resume / fork), each from verified CLI syntax.

Workspace
- Quick Jump over tabs, panes, frecency directories, SSH hosts and AI
  sessions; Recipes and Files scopes stay hidden until their backends
  exist end to end.
- Send-selection-to-chat with explicit pane routing.
- Taskbar integration.
- Configurable terminal-card geometry (radius, gutter, shadow, divider)
  carried by the theme, with a single radius constant shared by both
  shells instead of one literal per shell.

Terminal
- PTY lost-wakeup fix completed. The 1.2.0 repost keyed on "the pipe
  still holds bytes", but `drain_inner` takes the read waker *before*
  copying, so that check was a TOCTOU: a read that got data already
  means no waker is registered. The repost now keys only on "this read
  got data", which self-converges, plus a regression test.
- `conpty_realign` now corrects both directions. Only the collapse case
  (conhost above our cursor) was handled; a rewrap that leaves conhost
  *below* us left every absolute CUP from PSReadLine landing on the
  wrong row after a split.
- DECSET 2031 colour-scheme change notifications, with the light/dark
  predicate sharing one source with the OSC 11 answer.
- `TerminalColorResolver` reachable from the GPUI shell (`pub(crate)`),
  and its line endings restored to LF after an editor round-trip had
  rewritten all 329 lines as CRLF.

Repro tooling
- `pty_stall_repro.ps1` reproduces the lost wakeup by separating the
  64 KB burst from the tail, which is the half the earlier drain probe
  was missing.
- `tui_redraw_dup_probe.ps1` checks in-place UI-block redraws for
  duplicated and dropped lines via monotonic line numbering.

Ignore rules: the `.run-*`, `.isolated-*`, `.chk*.js`, `*-probe.png`,
`NebulaTerminal-*/` and `*-preview-package/` families were reaching
`git status` as untracked. They are per-round debug evidence and local
build output.

Verification
- `cargo check -p nebula --features gpui-shell` passes.
- `cargo test -p nebula --features gpui-shell`: 1001 passed, 1 failed.
- `git diff --check` passes.
- The single failure, `math_overlay::tests::alt_screen_renders_agent_math`,
  reproduces identically on e41b3c8 in a clean worktree. It predates this
  work and is not addressed here: the test swaps to the alternate screen,
  which resets its region, then expects the primary screen's formula to
  still be planned.
2026-08-27 19:23:02 +08:00

1198 lines
36 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/Kuddev/nebula/docs/runtime-api-v1.schema.json",
"title": "Nebula Runtime API v1 frames",
"description": "JSON Lines request, response, and event frames for the authenticated local runtime control plane.",
"type": "object",
"properties": {
"protocol": {
"const": "nebula.runtime"
},
"version": {
"const": 1
}
},
"required": [
"protocol",
"version"
],
"oneOf": [
{
"$ref": "#/$defs/request"
},
{
"$ref": "#/$defs/response"
},
{
"$ref": "#/$defs/event"
}
],
"$defs": {
"request": {
"type": "object",
"required": [
"protocol",
"version",
"id",
"token",
"method",
"params"
],
"properties": {
"protocol": {
"const": "nebula.runtime"
},
"version": {
"const": 1
},
"id": {
"type": "string",
"minLength": 1
},
"token": {
"type": "string",
"minLength": 1
},
"method": {
"enum": [
"runtime.describe",
"runtime.snapshot",
"runtime.orchestrate",
"events.subscribe",
"agents.list",
"agent.start",
"agent.fork",
"agent.get",
"agent.prompt",
"agent.paste",
"agent.read",
"agent.wait",
"window.create",
"window.close",
"window.focus",
"tab.new",
"tab.close",
"tab.rename",
"tab.move",
"pane.split",
"pane.close",
"pane.zoom",
"pane.resize",
"pane.prompt",
"pane.paste",
"pane.read",
"pane.procs",
"pane.send_key",
"pane.run",
"pane.exec",
"pane.wait"
]
},
"params": {
"type": "object"
}
},
"additionalProperties": false,
"allOf": [
{
"if": { "properties": { "method": { "enum": ["runtime.describe", "runtime.snapshot", "window.create"] } } },
"then": { "properties": { "params": { "$ref": "#/$defs/empty_params" } } }
},
{
"if": { "properties": { "method": { "const": "runtime.orchestrate" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/orchestrate_params" } } }
},
{
"if": { "properties": { "method": { "const": "events.subscribe" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/subscribe_params" } } }
},
{
"if": { "properties": { "method": { "const": "agents.list" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/window_params" } } }
},
{
"if": { "properties": { "method": { "const": "agent.start" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/agent_start_params" } } }
},
{
"if": { "properties": { "method": { "const": "agent.fork" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/agent_fork_params" } } }
},
{
"if": { "properties": { "method": { "const": "agent.get" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/agent_target_params" } } }
},
{
"if": { "properties": { "method": { "const": "agent.prompt" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/agent_prompt_params" } } }
},
{
"if": { "properties": { "method": { "const": "agent.paste" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/agent_paste_params" } } }
},
{
"if": { "properties": { "method": { "const": "agent.read" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/agent_read_params" } } }
},
{
"if": { "properties": { "method": { "const": "agent.wait" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/agent_wait_params" } } }
},
{
"if": { "properties": { "method": { "const": "window.focus" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/focus_params" } } }
},
{
"if": { "properties": { "method": { "const": "window.close" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/window_params" } } }
},
{
"if": { "properties": { "method": { "const": "tab.new" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/tab_new_params" } } }
},
{
"if": { "properties": { "method": { "const": "tab.close" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/tab_target_params" } } }
},
{
"if": { "properties": { "method": { "const": "tab.rename" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/tab_rename_params" } } }
},
{
"if": { "properties": { "method": { "const": "tab.move" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/tab_move_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.split" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/split_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.zoom" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/pane_zoom_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.resize" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/pane_resize_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.prompt" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/prompt_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.paste" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/paste_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.read" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/read_params" } } }
},
{
"if": { "properties": { "method": { "enum": ["pane.close", "pane.procs"] } } },
"then": { "properties": { "params": { "$ref": "#/$defs/pane_target_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.send_key" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/send_key_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.run" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/run_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.exec" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/exec_params" } } }
},
{
"if": { "properties": { "method": { "const": "pane.wait" } } },
"then": { "properties": { "params": { "$ref": "#/$defs/wait_params" } } }
}
]
},
"empty_params": {
"type": "object",
"maxProperties": 0
},
"nullable_window_id": {
"type": ["integer", "null"],
"minimum": 0
},
"window_params": {
"type": "object",
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" }
},
"additionalProperties": false
},
"subscribe_params": {
"type": "object",
"properties": {
"since_revision": { "type": ["integer", "null"], "minimum": 0 }
},
"additionalProperties": false
},
"orchestrate_params": {
"type": "object",
"required": ["steps"],
"properties": {
"steps": {
"type": "array",
"minItems": 1,
"maxItems": 32,
"items": { "$ref": "#/$defs/orchestrate_step" }
},
"on_error": { "enum": ["stop", "continue"], "default": "stop" }
},
"additionalProperties": false
},
"orchestrate_step": {
"oneOf": [
{ "$ref": "#/$defs/orchestrate_new_tab" },
{ "$ref": "#/$defs/orchestrate_focus" },
{ "$ref": "#/$defs/orchestrate_split" },
{ "$ref": "#/$defs/orchestrate_prompt" },
{ "$ref": "#/$defs/orchestrate_run" },
{ "$ref": "#/$defs/orchestrate_agent_launch" },
{ "$ref": "#/$defs/orchestrate_wait" }
]
},
"orchestrate_step_id": {
"type": "string",
"pattern": "^[A-Za-z_][A-Za-z0-9_-]{0,63}$"
},
"orchestrate_pane_target": {
"oneOf": [
{
"type": "object",
"required": ["step", "field"],
"properties": {
"step": { "$ref": "#/$defs/orchestrate_step_id" },
"field": { "const": "pane_id" }
},
"additionalProperties": false
},
{
"type": "object",
"required": ["pane_id"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
}
]
},
"orchestrate_new_tab": {
"type": "object",
"required": ["id", "op"],
"properties": {
"id": { "$ref": "#/$defs/orchestrate_step_id" },
"op": { "const": "new_tab" },
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"cwd": { "type": ["string", "null"] }
},
"additionalProperties": false
},
"orchestrate_focus": {
"type": "object",
"required": ["id", "op", "target"],
"properties": {
"id": { "$ref": "#/$defs/orchestrate_step_id" },
"op": { "const": "focus" },
"target": { "$ref": "#/$defs/orchestrate_pane_target" }
},
"additionalProperties": false
},
"orchestrate_split": {
"type": "object",
"required": ["id", "op", "direction"],
"properties": {
"id": { "$ref": "#/$defs/orchestrate_step_id" },
"op": { "const": "split" },
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"target": { "$ref": "#/$defs/orchestrate_pane_target" },
"direction": { "enum": ["left_right", "top_bottom"] }
},
"additionalProperties": false
},
"orchestrate_prompt": {
"type": "object",
"required": ["id", "op", "target", "text"],
"properties": {
"id": { "$ref": "#/$defs/orchestrate_step_id" },
"op": { "const": "prompt" },
"target": { "$ref": "#/$defs/orchestrate_pane_target" },
"text": { "type": "string", "minLength": 1, "maxLength": 32768 },
"submit": { "type": "boolean", "default": true }
},
"additionalProperties": false
},
"orchestrate_run": {
"type": "object",
"required": ["id", "op", "target", "command"],
"properties": {
"id": { "$ref": "#/$defs/orchestrate_step_id" },
"op": { "const": "run" },
"target": { "$ref": "#/$defs/orchestrate_pane_target" },
"command": { "type": "string", "minLength": 1, "maxLength": 32768 },
"wait": { "type": "boolean", "default": true },
"timeout_ms": { "type": "integer", "minimum": 1, "maximum": 86400000, "default": 30000 },
"tail_lines": { "type": "integer", "minimum": 1, "maximum": 2000 }
},
"additionalProperties": false
},
"orchestrate_agent_launch": {
"type": "object",
"required": ["id", "op", "target", "name", "kind", "initial_prompt"],
"properties": {
"id": { "$ref": "#/$defs/orchestrate_step_id" },
"op": { "const": "agent_launch" },
"target": { "$ref": "#/$defs/orchestrate_pane_target" },
"name": { "type": "string", "minLength": 1, "maxLength": 64 },
"kind": { "$ref": "#/$defs/launch_agent_kind" },
"resume_session_id": { "type": ["string", "null"] },
"initial_prompt": { "type": "string", "minLength": 1, "maxLength": 32768 },
"ready_timeout_ms": { "type": "integer", "minimum": 1, "maximum": 86400000, "default": 10000 }
},
"additionalProperties": false
},
"orchestrate_wait": {
"type": "object",
"required": ["id", "op", "target", "state"],
"properties": {
"id": { "$ref": "#/$defs/orchestrate_step_id" },
"op": { "const": "wait" },
"target": { "$ref": "#/$defs/orchestrate_pane_target" },
"state": { "$ref": "#/$defs/wait_state" },
"timeout_ms": { "type": "integer", "minimum": 1, "maximum": 86400000, "default": 30000 },
"tail_lines": { "type": "integer", "minimum": 1, "maximum": 2000 }
},
"additionalProperties": false
},
"agent_start_params": {
"type": "object",
"required": ["name", "kind"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": ["integer", "null"], "minimum": 0 },
"name": { "type": "string", "minLength": 1, "maxLength": 64 },
"kind": { "$ref": "#/$defs/launch_agent_kind" },
"cwd": { "type": ["string", "null"] },
"resume_session_id": { "type": ["string", "null"] }
},
"additionalProperties": false
},
"agent_fork_params": {
"type": "object",
"required": ["name", "kind"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"source_pane_id": { "type": ["integer", "null"], "minimum": 0 },
"source_cwd": { "type": ["string", "null"] },
"name": { "type": "string", "minLength": 1, "maxLength": 64 },
"kind": { "$ref": "#/$defs/launch_agent_kind" },
"resume_session_id": { "type": ["string", "null"] },
"branch": { "type": ["string", "null"] },
"base": { "type": ["string", "null"] },
"path": { "type": ["string", "null"] },
"allow_dirty_source": { "type": "boolean", "default": false }
},
"anyOf": [
{ "required": ["source_pane_id"], "properties": { "source_pane_id": { "type": "integer" } } },
{ "required": ["source_cwd"], "properties": { "source_cwd": { "type": "string", "minLength": 1 } } }
],
"additionalProperties": false
},
"launch_agent_kind": {
"enum": ["claude", "codex", "opencode", "cursor", "pi", "omp", "kimi"],
"description": "Agent kinds with an officially verified interactive cold-start command."
},
"agent_target_params": {
"type": "object",
"required": ["agent"],
"properties": {
"agent": { "type": "string", "minLength": 1, "maxLength": 128 },
"generation": { "type": ["integer", "null"], "minimum": 1 }
},
"additionalProperties": false
},
"agent_prompt_params": {
"type": "object",
"required": ["agent", "text"],
"properties": {
"agent": { "type": "string", "minLength": 1, "maxLength": 128 },
"generation": { "type": ["integer", "null"], "minimum": 1 },
"text": { "type": "string", "minLength": 1, "maxLength": 32768 },
"submit": { "type": "boolean", "default": true }
},
"additionalProperties": false
},
"agent_paste_params": {
"type": "object",
"required": ["agent", "text"],
"properties": {
"agent": { "type": "string", "minLength": 1, "maxLength": 128 },
"generation": { "type": ["integer", "null"], "minimum": 1 },
"text": { "type": "string", "minLength": 1, "maxLength": 32768 },
"submit": { "type": "boolean", "default": true }
},
"additionalProperties": false
},
"agent_read_params": {
"type": "object",
"required": ["agent"],
"properties": {
"agent": { "type": "string", "minLength": 1, "maxLength": 128 },
"generation": { "type": ["integer", "null"], "minimum": 1 },
"lines": { "type": "integer", "minimum": 1, "maximum": 2000, "default": 120 }
},
"additionalProperties": false
},
"agent_wait_params": {
"type": "object",
"required": ["agent", "generation", "state", "timeout_ms"],
"properties": {
"agent": { "type": "string", "minLength": 1, "maxLength": 128 },
"generation": { "type": "integer", "minimum": 1 },
"state": { "$ref": "#/$defs/wait_state" },
"timeout_ms": { "type": "integer", "minimum": 1, "maximum": 86400000 },
"after_seq": { "type": ["integer", "null"], "minimum": 0 }
},
"additionalProperties": false
},
"focus_params": {
"type": "object",
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": ["integer", "null"], "minimum": 0 }
},
"additionalProperties": false
},
"tab_new_params": {
"type": "object",
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"cwd": { "type": ["string", "null"] }
},
"additionalProperties": false
},
"tab_target_params": {
"type": "object",
"required": ["tab_index"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"tab_index": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
},
"tab_rename_params": {
"type": "object",
"required": ["tab_index", "name"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"tab_index": { "type": "integer", "minimum": 0 },
"name": {
"type": "string",
"maxLength": 256,
"pattern": "^[^\\u0000-\\u001F\\u007F]*$",
"description": "The server additionally enforces a 256-byte UTF-8 limit. Empty restores the generated title."
}
},
"additionalProperties": false
},
"tab_move_params": {
"type": "object",
"required": ["tab_index", "to_index"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"tab_index": { "type": "integer", "minimum": 0 },
"to_index": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
},
"split_params": {
"type": "object",
"required": ["direction"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": ["integer", "null"], "minimum": 0 },
"direction": { "enum": ["left_right", "top_bottom"] }
},
"additionalProperties": false
},
"prompt_params": {
"type": "object",
"required": ["pane_id", "text"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"text": { "type": "string", "minLength": 1, "maxLength": 32768 },
"submit": { "type": "boolean", "default": true }
},
"additionalProperties": false
},
"paste_params": {
"type": "object",
"required": ["pane_id", "text"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"text": { "type": "string", "minLength": 1, "maxLength": 32768 },
"submit": { "type": "boolean", "default": true }
},
"additionalProperties": false
},
"read_params": {
"type": "object",
"required": ["pane_id"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"lines": { "type": "integer", "minimum": 1, "maximum": 2000, "default": 120 }
},
"additionalProperties": false
},
"pane_target_params": {
"type": "object",
"required": ["pane_id"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
},
"pane_zoom_params": {
"type": "object",
"required": ["pane_id", "zoomed"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"zoomed": { "type": "boolean" }
},
"additionalProperties": false
},
"pane_resize_params": {
"type": "object",
"required": ["pane_id", "ratio"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"ratio": { "type": "number", "minimum": 0.05, "maximum": 0.95 }
},
"additionalProperties": false
},
"send_key_params": {
"type": "object",
"required": ["pane_id", "key"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"key": {
"enum": [
"escape", "enter", "tab", "backspace", "up", "down", "left", "right",
"home", "end", "insert", "delete", "page_up", "page_down",
"f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12",
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
]
},
"modifiers": {
"type": "object",
"properties": {
"shift": { "type": "boolean", "default": false },
"alt": { "type": "boolean", "default": false },
"control": { "type": "boolean", "default": false }
},
"additionalProperties": false
},
"repeat": { "type": "integer", "minimum": 1, "maximum": 64, "default": 1 }
},
"additionalProperties": false
},
"run_params": {
"type": "object",
"required": ["pane_id", "command"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"command": { "type": "string", "minLength": 1, "maxLength": 32768 },
"wait": { "type": "boolean", "default": true },
"timeout_ms": { "type": "integer", "minimum": 1, "maximum": 86400000, "default": 30000 }
},
"additionalProperties": false
},
"exec_params": {
"type": "object",
"required": ["pane_id", "argv"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"argv": {
"type": "array",
"minItems": 1,
"maxItems": 256,
"items": { "type": "string" },
"description": "Direct program argv; no shell expansion is performed. The server enforces a 32768-byte aggregate limit."
},
"timeout_ms": { "type": "integer", "minimum": 1, "maximum": 86400000, "default": 30000 },
"max_output_bytes": { "type": "integer", "minimum": 1, "maximum": 16777216, "default": 1048576 }
},
"additionalProperties": false
},
"wait_state": {
"enum": ["idle", "running", "waiting_input", "attention", "finished", "failed", "settled"]
},
"wait_params": {
"type": "object",
"required": ["pane_id", "state", "timeout_ms"],
"properties": {
"window_id": { "$ref": "#/$defs/nullable_window_id" },
"pane_id": { "type": "integer", "minimum": 0 },
"state": { "$ref": "#/$defs/wait_state" },
"timeout_ms": { "type": "integer", "minimum": 1, "maximum": 86400000 },
"after_seq": { "type": ["integer", "null"], "minimum": 0 }
},
"additionalProperties": false
},
"response": {
"type": "object",
"required": [
"protocol",
"version",
"id",
"ok"
],
"properties": {
"protocol": {
"const": "nebula.runtime"
},
"version": {
"const": 1
},
"id": {
"type": "string"
},
"ok": {
"type": "boolean"
},
"result": {},
"error": {
"$ref": "#/$defs/error"
}
},
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
},
"details": {}
},
"additionalProperties": false
},
"event": {
"type": "object",
"required": [
"protocol",
"version",
"event",
"revision",
"data"
],
"properties": {
"protocol": {
"const": "nebula.runtime"
},
"version": {
"const": 1
},
"event": {
"const": "runtime.snapshot"
},
"revision": {
"type": "integer",
"minimum": 1
},
"data": {
"$ref": "#/$defs/snapshot"
}
},
"additionalProperties": false
},
"snapshot": {
"type": "object",
"required": [
"revision",
"process_id",
"app_version",
"protocol_version",
"detached_windows",
"windows"
],
"properties": {
"revision": {
"type": "integer",
"minimum": 0
},
"process_id": {
"type": "integer",
"minimum": 1
},
"app_version": {
"type": "string"
},
"protocol_version": {
"const": 1
},
"detached_windows": {
"type": "integer",
"minimum": 0
},
"windows": {
"type": "array",
"items": {
"$ref": "#/$defs/window"
}
},
"pane_lifecycles": {
"type": "array",
"items": { "$ref": "#/$defs/pane_lifecycle" }
}
},
"additionalProperties": false
},
"window": {
"type": "object",
"required": [
"id",
"focused",
"session_exempt",
"active_tab",
"focused_pane_id",
"tabs"
],
"properties": {
"id": {
"type": "integer",
"minimum": 0
},
"focused": {
"type": "boolean"
},
"session_exempt": {
"type": "boolean"
},
"active_tab": {
"type": "integer",
"minimum": 0
},
"focused_pane_id": {
"type": [
"integer",
"null"
]
},
"tabs": {
"type": "array",
"items": {
"$ref": "#/$defs/tab"
}
}
},
"additionalProperties": false
},
"tab": {
"type": "object",
"required": [
"index",
"active",
"label",
"kind",
"bell",
"focused_pane_id",
"zoomed_pane_id",
"layout",
"panes"
],
"properties": {
"index": {
"type": "integer",
"minimum": 0
},
"active": {
"type": "boolean"
},
"label": {
"type": "string"
},
"kind": {
"enum": [
"shell",
"profile",
"ssh",
"document",
"image",
"code",
"settings"
]
},
"bell": {
"type": "boolean"
},
"focused_pane_id": {
"type": [
"integer",
"null"
]
},
"zoomed_pane_id": {
"type": [
"integer",
"null"
]
},
"layout": {
"oneOf": [
{
"$ref": "#/$defs/layout"
},
{
"type": "null"
}
]
},
"panes": {
"type": "array",
"items": {
"$ref": "#/$defs/pane"
}
}
},
"additionalProperties": false
},
"layout": {
"oneOf": [
{
"type": "object",
"required": [
"type",
"pane_id"
],
"properties": {
"type": {
"const": "pane"
},
"pane_id": {
"type": "integer"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"type",
"direction",
"ratio",
"first",
"second"
],
"properties": {
"type": {
"const": "split"
},
"direction": {
"enum": [
"left_right",
"top_bottom"
]
},
"ratio": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"first": {
"$ref": "#/$defs/layout"
},
"second": {
"$ref": "#/$defs/layout"
}
},
"additionalProperties": false
}
]
},
"pane": {
"type": "object",
"required": [
"id",
"active",
"title",
"cwd",
"branch",
"ssh_destination",
"running_program",
"task_state",
"state_change_seq"
],
"properties": {
"id": {
"type": "integer",
"minimum": 0
},
"active": {
"type": "boolean"
},
"title": {
"type": "string"
},
"cwd": {
"type": "string"
},
"branch": {
"type": "string"
},
"ssh_destination": {
"type": [
"string",
"null"
]
},
"running_program": {
"type": [
"string",
"null"
]
},
"agent": {
"$ref": "#/$defs/agent"
},
"task_state": {
"enum": [
"idle",
"running",
"waiting_input",
"attention",
"finished",
"failed"
]
},
"state_change_seq": {
"description": "Monotonic per-pane counter, bumped every time task_state changes. Capture it before sending work, then pass it as wait's after_seq so an unchanged pane cannot satisfy the wait.",
"type": "integer",
"minimum": 1
},
"active_run": {
"$ref": "#/$defs/pane_run"
},
"last_run": {
"$ref": "#/$defs/run_outcome"
}
},
"additionalProperties": false
},
"agent": {
"type": "object",
"required": [
"kind",
"display_name",
"session_id",
"state_source",
"hook_seen"
],
"properties": {
"agent_id": {
"type": "string",
"minLength": 1
},
"generation": {
"type": "integer",
"minimum": 1
},
"name": {
"type": "string",
"minLength": 1
},
"worktree": {
"$ref": "#/$defs/worktree"
},
"kind": {
"type": "string",
"minLength": 1
},
"display_name": {
"type": "string",
"minLength": 1
},
"session_id": {
"type": [
"string",
"null"
]
},
"state_source": {
"enum": [
"hook",
"screen",
"process"
]
},
"state_rule": {
"type": "string"
},
"hook_seen": {
"type": "boolean"
}
},
"additionalProperties": false
},
"worktree": {
"type": "object",
"required": ["repo_root", "source_root", "path", "branch", "base_commit", "created"],
"properties": {
"repo_root": { "type": "string", "minLength": 1 },
"source_root": { "type": "string", "minLength": 1 },
"path": { "type": "string", "minLength": 1 },
"branch": { "type": "string", "minLength": 1 },
"base_commit": { "type": "string", "minLength": 1 },
"created": { "const": true }
},
"additionalProperties": false
},
"managed_agent": {
"type": "object",
"required": ["agent_id", "generation", "name", "kind", "window_id", "pane_id", "active", "observed"],
"properties": {
"agent_id": { "type": "string", "minLength": 1 },
"generation": { "type": "integer", "minimum": 1 },
"name": { "type": "string", "minLength": 1, "maxLength": 64 },
"kind": { "type": "string", "minLength": 1 },
"window_id": { "type": "integer", "minimum": 0 },
"pane_id": { "type": "integer", "minimum": 0 },
"session_id": { "type": "string" },
"worktree": { "$ref": "#/$defs/worktree" },
"active": { "type": "boolean" },
"observed": { "type": "boolean" },
"closed_reason": { "type": "string" }
},
"additionalProperties": false
},
"pane_lifecycle": {
"type": "object",
"required": ["sequence", "window_id", "pane_id", "event"],
"properties": {
"sequence": { "type": "integer", "minimum": 1 },
"window_id": { "type": "integer", "minimum": 0 },
"pane_id": { "type": "integer", "minimum": 0 },
"event": { "enum": ["closed", "exited"] }
},
"additionalProperties": false
},
"pane_run": {
"type": "object",
"required": ["run_id", "phase"],
"properties": {
"run_id": { "type": "integer", "minimum": 1 },
"phase": { "enum": ["submitted", "started"] }
},
"additionalProperties": false
},
"run_outcome": {
"type": "object",
"required": ["run_id", "state", "exit_code", "exit_code_capability"],
"properties": {
"run_id": { "type": "integer", "minimum": 1 },
"state": { "enum": ["finished", "failed", "unavailable"] },
"exit_code": { "type": ["integer", "null"] },
"exit_code_capability": { "enum": ["supported", "unavailable"] },
"unavailable_reason": { "type": "string" }
},
"additionalProperties": false
},
"agent_pane": {
"type": "object",
"required": [
"window_id",
"tab_index",
"tab_active",
"pane_id",
"pane_active",
"title",
"cwd",
"branch",
"ssh_destination",
"agent",
"task_state",
"state_change_seq"
],
"properties": {
"window_id": { "type": "integer", "minimum": 0 },
"tab_index": { "type": "integer", "minimum": 0 },
"tab_active": { "type": "boolean" },
"pane_id": { "type": "integer", "minimum": 0 },
"pane_active": { "type": "boolean" },
"title": { "type": "string" },
"cwd": { "type": "string" },
"branch": { "type": "string" },
"ssh_destination": { "type": ["string", "null"] },
"agent": { "$ref": "#/$defs/agent" },
"task_state": {
"enum": ["idle", "running", "waiting_input", "attention", "finished", "failed"]
},
"state_change_seq": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
},
"agents_result": {
"type": "object",
"required": ["revision", "agents"],
"properties": {
"revision": { "type": "integer", "minimum": 1 },
"agents": {
"type": "array",
"items": { "$ref": "#/$defs/agent_pane" }
}
},
"additionalProperties": false
},
"pane_read": {
"type": "object",
"required": [
"window_id",
"pane_id",
"text",
"requested_lines",
"returned_lines",
"history_available",
"truncated",
"task_state",
"exited"
],
"properties": {
"window_id": { "type": "integer", "minimum": 0 },
"pane_id": { "type": "integer", "minimum": 0 },
"text": { "type": "string" },
"requested_lines": { "type": "integer", "minimum": 1, "maximum": 2000 },
"returned_lines": { "type": "integer", "minimum": 0, "maximum": 2000 },
"history_available": { "type": "integer", "minimum": 0 },
"truncated": { "type": "boolean" },
"task_state": {
"enum": ["idle", "running", "waiting_input", "attention", "finished", "failed"]
},
"exited": { "type": "boolean" },
"exit_reason": { "type": "string" }
},
"additionalProperties": false
}
}
}