From ac7a4387aa1ddec1a25552ef6ec0b0392afdf923 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 2 Dec 2026 17:42:02 -0600 Subject: [PATCH 1/8] docs(elixir) Pin lifecycle guides and recording why: The generated API links and recorded session need the same published Elixir source as the executable guide. what: - Stage the pinned supervision and attachment guides with the model. - Resolve ExDoc extras and fragments in the shared site. - Record owned and borrowed sessions using the public lifecycle. --- scripts/lib/core-recipes/elixir.mjs | 143 +- scripts/stage-port-docs.mjs | 9 + .../ports/elixir/guides/attaching-to-tmux.md | 53 +- site/src/data/api-sources/elixir.json | 138 +- site/src/data/api/elixir.json | 2 +- site/src/data/api/elixir.nav.json | 2 +- site/src/data/api/elixir.paths.json | 2 +- site/src/data/core-recordings/elixir.json | 1567 ++--------------- site/src/data/home-examples.json | 21 +- site/src/data/port-guides/elixir.json | 26 +- site/src/lib/api-models.ts | 14 +- site/src/lib/port-documentation.ts | 9 + site/test/api-prose.test.ts | 19 +- site/test/core-scope-exit.test.ts | 2 +- 14 files changed, 430 insertions(+), 1577 deletions(-) diff --git a/scripts/lib/core-recipes/elixir.mjs b/scripts/lib/core-recipes/elixir.mjs index ea618fa08..c3ede4c19 100644 --- a/scripts/lib/core-recipes/elixir.mjs +++ b/scripts/lib/core-recipes/elixir.mjs @@ -5,47 +5,39 @@ import { checkoutOf, instrumentLines, quickstartSource, withoutMarks } from './c export { withoutMarks } -/** - * How Elixir's quickstart is recorded: the calls to mark, what to run, and - * how libtmux-elixir's own tmux preamble is recognised. - * - * HAND-WRITTEN: `steps` is a person's map from the calls of the program to - * their anchors and to an Elixir expression for the value each returned. It is - * checked against the program (every anchor must be found once and in the - * order the marks arrive), not derived from it. A generated map would read the - * calls from the program's syntax tree (`Code.string_to_quoted`: every call - * of an alias the program names) and take the value from the variable the - * statement binds; the recorder would not change. - */ - -/** Where Mix.install builds the checkout, on disk and apart from the sandbox, so the second run does not compile again. */ -const INSTALL_DIR = '/home/d/tmp-wave/elixir-core-player-install' - -/** - * The module the marked copy loads before the program (`elixir -r`). `mark` - * runs `LIBTMUX_DOCS_MARK` with the step and the value as JSON, and stops the - * program if that fails. `returned` is the value the last `System.cmd/3` or - * `Server.run/3` gave back, for a call whose result the program matches and - * drops: the call is traced and nothing else about it changes. The trace is - * installed by the first mark, because the library is loaded by then. - */ +/** Record return values for the three creations the quickstart does not bind. */ const ELIXIR_HELPER = `defmodule DocsMark do - @traced [{System, :cmd, 3}, {LibTmux.Server, :run, 3}] + @traced [{LibTmux.Server, :new_session!, 3}, {LibTmux.Pane, :split!, 3}, {LibTmux.Session, :new_window!, 4}] - def mark(step, value) do + def begin_scope(socket) do + Process.put(:docs_socket, socket) watch() + end + + def mark(step, value) do {_, status} = System.cmd(System.fetch_env!("LIBTMUX_DOCS_MARK"), [step, JSON.encode!(value)]) if status != 0 do - IO.puts(:stderr, "docs mark: #{step} failed") - System.halt(status) + raise "recording #{step} failed with exit #{status}" end end - # The last value each traced function returned. A trace message and a later request from the same process arrive in order. def returned(name) do + tracee = self() + delivered = :erlang.trace_delivered(tracee) + receive do + {:trace_delivered, ^tracee, ^delivered} -> :ok + after + 3_000 -> raise "trace delivery timed out for #{inspect(name)}" + end + send(:docs_mark_tracer, {:get, self(), name}) - receive do: ({:docs_mark, value} -> value) + receive do + {:docs_mark, {:ok, value}} -> value + {:docs_mark, :error} -> raise "no return recorded for #{inspect(name)}" + after + 3_000 -> raise "return lookup timed out for #{inspect(name)}" + end end defp watch do @@ -67,7 +59,7 @@ const ELIXIR_HELPER = `defmodule DocsMark do loop(Map.put(state, {module, function}, value)) {:get, from, name} -> - send(from, {:docs_mark, Map.fetch!(state, name)}) + send(from, {:docs_mark, Map.fetch(state, name)}) loop(state) _ -> @@ -82,83 +74,68 @@ export function instrumentElixir(source, steps) { return instrumentLines(source, steps, (step) => `DocsMark.mark(${JSON.stringify(step.id)}, ${step.value}) # docs:mark`, '#') } -/** A snapshot as a recording stores it: how many of each it holds. */ -const COUNTS = '%{sessions: map_size(snapshot.sessions), windows: map_size(snapshot.windows), panes: map_size(snapshot.panes)}' -/** A window, a pane and a reference as a recording stores them, from the variable the statement binds. */ -const WINDOW = (name) => `%{id: ${name}.id, name: ${name}.name}` -const PANE = (name) => `%{id: ${name}.id}` -const REF = (name) => `%{entity: ${name}.entity, id: ${name}.id}` - -const RUN = '(fn {:ok, result} -> %{exit_status: result.exit_status, stdout: result.stdout, stderr: result.stderr} end).(DocsMark.returned({LibTmux.Server, :run}))' +const shellArg = (value) => "'" + value.replaceAll("'", "'\"'\"'") + "'" +const elixirString = (value) => JSON.stringify(value).replaceAll('#{', '\\#{') +const counts = '%{sessions: map_size(snapshot.sessions), windows: map_size(snapshot.windows), panes: map_size(snapshot.panes)}' +const created = (module, method) => `Map.take(DocsMark.returned({LibTmux.${module}, :${method}!}), [:id])` export const RECIPES = { 'typed-graph': { capability: 'typed-graph', file: 'quickstart.exs', stepMap: 'hand-written', - /** What a pane runs once it has settled: the sandbox pins SHELL to /bin/sh. */ - paneCommands: ['sh'], + paneCommands: ['cat'], + inPlaceFirst: ['-D'], source: (root) => quickstartSource(root, 'elixir', 'quickstart.exs'), checkout: (port, env, expand) => checkoutOf(port, env, expand), - /** The program makes its socket directory under TMPDIR as `libtmux-`. */ socket: { pattern: 'libtmux-[0-9a-f]{16}', fixed: 'libtmux-0123456789abcdef' }, helpers: [{ file: 'docs_mark.exs', source: ELIXIR_HELPER }], - // In the order the calls run. The program starts its own daemon first (`System.cmd`, matched to status 0, before any mark can trace it), and kills it last. - // The reads of a snapshot send tmux nothing. The lookup of a window by its id is not marked: it falls between two reads that repeat. steps: [ - { id: 'daemon', label: 'System.cmd', anchor: '{_, 0} = System.cmd(', type: 'exit status', value: '%{status: 0}' }, - { id: 'server', label: 'Server.new', anchor: 'server = Server.new(', type: 'Server', value: '%{executable: server.executable, socket: server.socket}' }, - { id: 'snapshot-layout', label: 'Server.snapshot!', anchor: 'Server.snapshot!(server)', occurrence: 1, type: 'Snapshot', value: COUNTS }, + { id: 'create', label: 'Server.new_session!', anchor: 'Server.new_session!(', type: 'map', value: created('Server', 'new_session') }, + { id: 'layout', label: 'Server.snapshot!', anchor: 'Server.snapshot!(server)', occurrence: 1, type: 'Snapshot', value: counts }, { id: 'session', label: 'Selection.one!', anchor: 'Snapshot.sessions() |> Selection.one!()', type: 'Session', value: '%{id: session.id, name: session.name}' }, - { id: 'active-window', label: 'Session.active_window', anchor: 'Session.active_window(', type: 'Window', value: WINDOW('editor') }, - { id: 'ref-session', label: 'Ref.from_observation', anchor: 'Ref.from_observation(session)', type: 'Ref', value: REF('session_ref') }, - { id: 'ref-editor', label: 'Ref.from_observation', anchor: 'Ref.from_observation(editor)', type: 'Ref', value: REF('editor_ref') }, - { id: 'rename', label: 'Window.rename!', anchor: 'Window.rename!(', type: ':ok', value: ':ok' }, - { id: 'active-pane', label: 'Selection.one!', anchor: 'Selection.one!(window_id: editor.id', type: 'Pane', value: PANE('left') }, - { id: 'ref-left', label: 'Ref.from_observation', anchor: 'Ref.from_observation(left)', type: 'Ref', value: REF('left_ref') }, - { id: 'split', label: 'Pane.split!', anchor: 'Pane.split!(', type: 'map', value: '%{id: right_id}' }, - { id: 'new-window', label: 'Session.new_window!', anchor: 'Session.new_window!(', type: 'map', value: '%{id: logs_id}' }, - { id: 'ref-right', label: 'Ref.new', anchor: 'Ref.new(:pane', type: 'Ref', value: REF('right') }, - { id: 'send-text', label: 'Pane.send_text!', anchor: 'Pane.send_text!(', type: ':ok', value: ':ok' }, - { id: 'send-keys', label: 'Pane.send_keys!', anchor: 'Pane.send_keys!(', type: ':ok', value: ':ok' }, - { id: 'capture', label: 'Pane.capture!', anchor: 'Pane.capture!(', type: 'binary', value: 'screen', repeat: true }, - { id: 'command-select-pane', label: 'Command.new', anchor: 'select_pane = Command.new(', type: 'Command', value: '%{name: select_pane.name, args: select_pane.args}' }, - { id: 'command-select-window', label: 'Command.new', anchor: 'select_window = Command.new(', type: 'Command', value: '%{name: select_window.name, args: select_window.args}' }, - { id: 'select-pane', label: 'Server.run', anchor: 'Server.run(server, select_pane)', type: 'Result', value: RUN }, - { id: 'select-window', label: 'Server.run', anchor: 'Server.run(server, select_window)', type: 'Result', value: RUN }, - { id: 'snapshot', label: 'Server.snapshot!', anchor: 'Server.snapshot!(server)', occurrence: 2, type: 'Snapshot', value: COUNTS }, - { id: 'sessions', label: 'Snapshot.sessions', anchor: 'sessions = Snapshot.sessions(snapshot)', type: 'Selection', value: 'Enum.map(sessions, &%{id: &1.id, name: &1.name})' }, - { id: 'links', label: 'Snapshot.related', anchor: 'Snapshot.related(snapshot, :session, each.id', type: '[WindowLink]', value: 'Enum.map(links, &%{index: &1.index, window: &1.window_id})', repeat: true }, - { id: 'panes', label: 'Window.panes', anchor: 'Window.panes(snapshot, window)', type: 'Selection', value: 'Enum.map(panes, & &1.id)', repeat: true }, - { id: 'pane', label: 'Selection.one!', anchor: 'Selection.one!(id: right_id)', type: 'Pane', value: PANE('pane') }, - { id: 'pane-window', label: 'Snapshot.related', anchor: 'Snapshot.related(snapshot, :pane', type: 'Window', value: WINDOW('window') }, - { id: 'window-session', label: 'Snapshot.related', anchor: 'Snapshot.related(snapshot, :window, window.id', type: '[Session]', value: '%{id: owner.id, name: owner.name}' }, - { id: 'kill-server', label: 'System.cmd', anchor: '"kill-server"', type: 'exit status', value: '%{status: elem(DocsMark.returned({System, :cmd}), 1)}' }, + { id: 'pane', label: 'Selection.one!', anchor: 'Snapshot.panes() |> Selection.one!()', type: 'Pane', value: '%{id: pane.id}' }, + { id: 'session-ref', label: 'Ref.from_observation', anchor: 'Ref.from_observation(session)', type: 'Ref', value: '%{id: session_ref.id}' }, + { id: 'pane-ref', label: 'Ref.from_observation', anchor: 'Ref.from_observation(pane)', type: 'Ref', value: '%{id: pane_ref.id}' }, + { id: 'split', label: 'Pane.split!', anchor: 'Pane.split!(', type: 'map', value: created('Pane', 'split') }, + { id: 'new-window', label: 'Session.new_window!', anchor: 'Session.new_window!(', type: 'map', value: created('Session', 'new_window') }, + { id: 'snapshot', label: 'Server.snapshot!', anchor: 'Server.snapshot!(server)', occurrence: 2, type: 'Snapshot', value: counts }, + { id: 'windows', label: 'Selection.size', anchor: 'Snapshot.windows() |> Selection.size()', type: 'integer', value: 'windows' }, + { id: 'panes', label: 'Selection.size', anchor: 'Snapshot.panes() |> Selection.size()', type: 'integer', value: 'panes' }, + { id: 'retire', label: 'Server.with_owned', anchor: 'Server.with_owned(', marker: 'end)', scopeExit: true, stopsServer: true, type: 'socket removed', value: 'not File.exists?(Process.get(:docs_socket))' }, ], - // The library has no guard command of its own to hide. - fence: () => false, - /** A capture asks the daemon for its pid before and after it reads the graph, to know it was one server throughout. */ - probe: ({ commands }) => commands.length > 0 && commands.every((command) => command[0] === 'display-message' && command.includes('#{pid}')), - instrument: instrumentElixir, + probe: ({ commands }) => commands.length > 0 && commands.every((command) => command[0] === 'display-message' && command.some((word) => word.includes('#{pid}'))), + instrument(source, steps) { + const lines = source.split('\n') + const position = (anchor) => lines.findIndex((line) => line.includes(anchor)) + 1 + const marked = instrumentElixir(source, steps.map((step) => { + if (step.scopeExit) return { ...step, after: position(step.marker), indent: 0 } + return step + })).split('\n') + const opening = marked.findIndex((line) => line.includes('Server.with_owned(')) + marked.splice(opening + 1, 0, ' DocsMark.begin_scope(server.socket) # docs:mark') + return marked.join('\n') + }, command: (dir) => [join(dir, 'program')], toolchain: () => ({ elixir: /Elixir (\S+)/.exec(execFileSync('elixir', ['--version'], { encoding: 'utf8' }))?.[1] ?? 'unknown', otp: execFileSync('erl', ['-noshell', '-eval', 'io:format("~s", [erlang:system_info(otp_release)]), halt().'], { encoding: 'utf8' }) }), /** Write the displayed and the marked copy, each installing the checkout itself where the program names the registry, and build it once. */ build({ sandbox, checkout, code, marked, helpers }) { - const dependency = '{:libtmux, "0.1.1"}' + const dependency = '{:libtmux, "~> 0.1.2"}' + const installDir = join(sandbox, 'install') mkdirSync(join(sandbox, 'tmp'), { recursive: true }) - mkdirSync(INSTALL_DIR, { recursive: true }) + mkdirSync(installDir, { recursive: true }) for (const [dir, source] of [['exact', code], ['marked', marked]]) { mkdirSync(join(sandbox, dir), { recursive: true }) if (!source.includes(dependency)) throw new Error(`the program no longer installs ${dependency}`) - writeFileSync(join(sandbox, dir, this.file), source.replace(dependency, `{:libtmux, path: ${JSON.stringify(checkout)}}`)) - const preload = dir === 'marked' ? ` -r ${JSON.stringify(join(sandbox, dir, 'docs_mark.exs'))}` : '' - writeFileSync(join(sandbox, dir, 'program'), `#!/bin/sh\nTMPDIR=${JSON.stringify(join(sandbox, 'tmp'))}\nMIX_INSTALL_DIR=${JSON.stringify(INSTALL_DIR)}\nMIX_ENV=prod\nHEX_OFFLINE=1\nMIX_HOME=${JSON.stringify(join(INSTALL_DIR, 'home'))}\nexport TMPDIR MIX_INSTALL_DIR MIX_ENV HEX_OFFLINE MIX_HOME\nrm -rf "${join(sandbox, 'tmp')}"/libtmux-*\nexec elixir${preload} ${JSON.stringify(join(sandbox, dir, this.file))}\n`) + writeFileSync(join(sandbox, dir, this.file), source.replace(dependency, `{:libtmux, path: ${elixirString(checkout)}}`)) + const preload = dir === 'marked' ? ` -r ${shellArg(join(sandbox, dir, 'docs_mark.exs'))}` : '' + writeFileSync(join(sandbox, dir, 'program'), `#!/bin/sh\nTMPDIR=${shellArg(join(sandbox, 'tmp'))}\nMIX_INSTALL_DIR=${shellArg(installDir)}\nMIX_ENV=prod\nHEX_OFFLINE=1\nMIX_HOME=${shellArg(join(installDir, 'home'))}\nLIBTMUX_DOCS_WINDOW_NAMES=libtmux_io,tmux\nexport TMPDIR MIX_INSTALL_DIR MIX_ENV HEX_OFFLINE MIX_HOME LIBTMUX_DOCS_WINDOW_NAMES\nexec elixir${preload} ${shellArg(join(sandbox, dir, this.file))}\n`) chmodSync(join(sandbox, dir, 'program'), 0o755) } for (const helper of helpers) writeFileSync(join(sandbox, 'marked', helper.file), helper.source) // Compile the checkout now, so neither timed run does. - writeFileSync(join(sandbox, 'warm.exs'), `Mix.install([{:libtmux, path: ${JSON.stringify(checkout)}}])\n`) - execFileSync('elixir', [join(sandbox, 'warm.exs')], { stdio: ['ignore', 'inherit', 'inherit'], env: { ...process.env, MIX_INSTALL_DIR: INSTALL_DIR, MIX_ENV: 'prod', HEX_OFFLINE: '1', MIX_HOME: join(INSTALL_DIR, 'home') } }) + writeFileSync(join(sandbox, 'warm.exs'), `Mix.install([{:libtmux, path: ${elixirString(checkout)}}])\n`) + execFileSync('elixir', [join(sandbox, 'warm.exs')], { stdio: ['ignore', 'inherit', 'inherit'], env: { ...process.env, MIX_INSTALL_DIR: installDir, MIX_ENV: 'prod', HEX_OFFLINE: '1', MIX_HOME: join(installDir, 'home'), MIX_ARCHIVES: join(installDir, 'home/archives') } }) }, }, } diff --git a/scripts/stage-port-docs.mjs b/scripts/stage-port-docs.mjs index 924380902..cec96bf13 100644 --- a/scripts/stage-port-docs.mjs +++ b/scripts/stage-port-docs.mjs @@ -230,6 +230,15 @@ export function stagedPortGuides(port, artifact) { const nativeReferenceFiles = new Set() const nativeDeclarations = new Map() for (const redirect of sourceGuideRedirectsFor(port)) if (redirect.sourcePath) linkRoutes[redirect.sourcePath] = [redirect.target] + if (port === 'elixir') { + const { symbols } = JSON.parse(readFileSync(join(root, 'site/src/data/api/elixir.json'), 'utf8')) + for (const symbol of symbols) { + if (symbol.kind === 'function' && symbol.parent) { + const target = 'docs/' + symbol.parent + '.html#' + symbol.name + linkRoutes[target] = ['reference/' + symbol.slug] + } + } + } if (port === 'haskell') { const model = JSON.parse(readFileSync(join(root, 'site/src/data/api/haskell.json'), 'utf8')) if (model.revision !== artifact.source.revision) throw new Error('haskell: guide source differs from the Haskell API model') diff --git a/site/src/content/docs/ports/elixir/guides/attaching-to-tmux.md b/site/src/content/docs/ports/elixir/guides/attaching-to-tmux.md index f7fed25f0..1c84f310b 100644 --- a/site/src/content/docs/ports/elixir/guides/attaching-to-tmux.md +++ b/site/src/content/docs/ports/elixir/guides/attaching-to-tmux.md @@ -22,22 +22,17 @@ covers interactive attachment and detaching. Save the complete program as `connect.exs`. The environment variable `LIBTMUX_SOCKET_PATH` selects the existing server, and `print_work` connects -to it and finds `work`. Without the variable, the program starts a private -server of its own in a new temporary directory, creates `work` with -`new_session!`, and calls `print_work` with that socket through a second -`Server` value. The library works on a running server and does not -start one, so the program has `tmux` start the daemon. It stops the private -server with [`Server.run/3`](../../reference/libtmux-server-run-3/) and -removes the directory after success or failure. If the server does not stop, -the program reports the error and keeps the directory. - -The first line installs libtmux from Hex. Its requirement, `~> 0.1`, accepts -any release from 0.1.0 up to, but not including, 1.0.0. +to it and finds `work`. Without a socket path, `Server.start/1` starts a +private server. The program creates `work`, reads it through a second +descriptor, then stops the owned server with `Server.stop/2`. + +The first line installs libtmux 0.1.2 or a later 0.1 patch. Version 0.1.2 +introduced private server startup and cleanup. ```elixir title="connect.exs" role="program" -Mix.install([{:libtmux, "~> 0.1"}]) +Mix.install([{:libtmux, "~> 0.1.2"}]) -alias LibTmux.{Command, Selection, Server, Snapshot} +alias LibTmux.{Selection, Server, Snapshot} tmux = System.find_executable("tmux") || raise "tmux is not on PATH" @@ -49,32 +44,14 @@ print_work = fn socket -> end case System.get_env("LIBTMUX_SOCKET_PATH") do - nil -> - # No server was named: start one this program owns. - id = Base.encode16(:crypto.strong_rand_bytes(8), case: :lower) - dir = Path.join(System.tmp_dir!(), "libtmux-attach-" <> id) - socket = Path.join(dir, "tmux.sock") - owner = Server.new(executable: tmux, socket: socket) - File.mkdir!(dir) - File.chmod!(dir, 0o700) + value when value in [nil, ""] -> + {:ok, owner} = Server.start(executable: tmux) try do - # libtmux works on a running server, so tmux starts the daemon itself. - start = ~w(start-server ; set-option -s exit-empty off) - {_, 0} = System.cmd(tmux, ["-S", socket, "-f", "/dev/null" | start]) Server.new_session!(owner, "work", command: {:argv, ["/bin/cat"]}) - print_work.(socket) + print_work.(owner.socket) after - kill = Command.new("kill-server", []) - running = File.exists?(socket) - stopped = not running or match?({:ok, _}, Server.run(owner, kill)) - - if stopped do - File.rm_rf!(dir) - else - IO.puts(:stderr, "Cannot stop tmux; kept #{dir}") - System.halt(1) - end + :ok = Server.stop(owner) end socket -> @@ -90,8 +67,8 @@ sessions from that state without contacting tmux again, and [`Selection.one!/2`](../../reference/libtmux-selection-one-bang-2/) requires exactly one match. Reading or filtering captured values does not refresh them. -The server value describes the daemon. It does not own a process to close, and -the program does not destroy the caller's sessions. +The descriptor built by `Server.new/1` borrows the selected socket. Only the +private-server branch holds the owned descriptor passed to `Server.stop/2`. ## Setup and run @@ -118,5 +95,5 @@ between those operations. Handle the creation error as well as the lookup. [Capture a pane and read it](../../examples/capture-and-read/) is a complete program that runs against an isolated server. -The [library source revision](https://github.com/libtmux/libtmux-elixir/tree/cac4252bfc52069980d47db2b7803dc9b33f36f1) +The [library source revision](https://github.com/libtmux/libtmux-elixir/tree/v0.1.2) records the implementation used by this example. diff --git a/site/src/data/api-sources/elixir.json b/site/src/data/api-sources/elixir.json index 16dc86f3d..792f140ca 100644 --- a/site/src/data/api-sources/elixir.json +++ b/site/src/data/api-sources/elixir.json @@ -1,119 +1,143 @@ { "port": "elixir", "files": { + "lib/libtmux/action.ex": { + "repo": "libtmux/libtmux-elixir", + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "ac53100367a419f864d41b05a2f74e672a056d9ad7b5ad03c23344300979b80b", + "content": "defmodule LibTmux.Action do\n @moduledoc \"\"\"\n Shared results for explicit pane, window and session actions.\n\n Pass a `LibTmux.Server` for one-shot execution or a `LibTmux.Control` for\n managed execution in its qualified connection. No action changes transport,\n replays a mutation or refreshes an observation. Targeted one-shot actions\n check the server incarnation before execution; that check leaves a\n check/use race.\n\n Ordinary actions return `{:ok, result}` only for completed commands.\n Failed, skipped and unknown outcomes return\n `{:error, %LibTmux.Action.CompletionError{result: original_result}}`.\n `value` holds the completed command's value; `details` retains the\n transport's original bounded evidence. Domain bang functions return the\n completed value or raise `LibTmux.Action.CompletionError` with the original\n unsuccessful result. Acknowledgement does not prove that a program\n processed input or finished running.\n\n API errors use `LibTmux.Error`; admitted control errors preserve the recovery\n handle in `LibTmux.Control.ExecutionError`. Domain bang functions raise\n these errors unchanged. Lower-level `LibTmux.Control` and `LibTmux.Operation`\n bang functions retain canonical outcomes as values.\n\n Action errors with kind `:invalid_command` include a validation `path` such\n as `[:options, :size]` and a bounded `details.reason` describing accepted\n inputs. The reason appears in the exception message; rejected values are\n not retained in diagnostic details. Targeted one-shot actions validate both\n native process specifications before the identity read. Session creation\n has no observed target; it validates its command and runs without an identity\n read. Native byte/count refusals use paths such as `[:process, :argv]` or\n `[:process, :frame]`.\n Preparation does not check filesystem existence or guarantee execution.\n\n A nonzero one-shot client exit reports `:failed` with `:observed` certainty:\n its exit status is observed, not an authenticated tmux command reply or\n proof that no effects occurred.\n\n Kill actions run one-shot only: a Control connection returns\n `unsupported_transport` before any I/O, because it cannot kill what it is\n attached to. A kill command prints nothing, so a completed result has the\n value `:ok`.\n\n Optional session context checks physical membership at tmux's command\n resolution. It does not bind a particular WindowLink index when a window\n has multiple links in that session. WindowLink references are rejected.\n See `LibTmux.Pane.split/3`, `LibTmux.Pane.send_text/4` and\n `LibTmux.Window.rename/4` for caller examples.\n \"\"\"\n alias LibTmux.{Codec, Command, Control, Deadline, Error, Format, ProcessIdentity, Ref, Server}\n alias LibTmux.Control.Request\n alias LibTmux.Transport.Native\n\n @typedoc \"Explicitly selected one-shot descriptor or pinned qualified connection.\"\n @type connection :: Server.t() | Control.t()\n @typedoc \"A 1..600000ms execution budget, default 5000ms; optional exact session context for physical targets.\"\n @type option :: {:timeout, 1..600_000} | {:session, Ref.t()}\n @typedoc \"Detached creation on an existing server; default command/shell and directory unless supplied.\"\n @type creation_option ::\n {:timeout, 1..600_000}\n | {:cwd, binary()}\n | {:command, :default | {:shell, binary()} | {:argv, nonempty_list(binary())}}\n @typedoc \"A created native ID without a bound reference; capture a new observation before another targeted action.\"\n @type creation_value :: %{id: String.t(), ref: nil}\n @typedoc \"\"\"\n A completed action's value and original transport evidence.\n\n Only completed results appear in an action's `{:ok, result}` tuple. Command\n acknowledgement remains distinct from external program completion.\n\n A completed split carries `t:LibTmux.Pane.split_value/0`. See\n `LibTmux.Pane.split/3` for its identity and lifetime limits.\n \"\"\"\n @type result(value) ::\n %{\n outcome: :completed,\n certainty: Error.certainty(),\n evidence: atom(),\n transport: :one_shot | :control,\n value: value,\n details: map()\n }\n @typedoc \"A failed, skipped or unknown action outcome retained inside CompletionError.\"\n @type unsuccessful_result :: %{\n outcome: :failed | :skipped | :unknown,\n certainty: Error.certainty(),\n evidence: atom(),\n transport: :one_shot | :control,\n value: nil,\n details: map()\n }\n @typedoc \"An API refusal, unsuccessful outcome or managed execution error retaining recovery context.\"\n @type error ::\n Error.t() | LibTmux.Action.CompletionError.t() | LibTmux.Control.ExecutionError.t()\n\n @keys ~w(Enter Space Tab BTab BSpace Escape Up Down Left Right Home End PageUp PageDown Insert Delete)\n @modified_keys ~w(Up Down Left Right Home End PageUp PageDown Insert Delete)\n\n @doc false\n def run(kind, %Control{}, _target, _value, _options)\n when kind in [\n :capture,\n :new_session,\n :new_window,\n :kill_server,\n :kill_session,\n :kill_window,\n :kill_pane\n ],\n do: failure(:unsupported_transport)\n\n def run(:kill_server, %Server{} = server, nil, nil, options) do\n entered_at = System.monotonic_time(:millisecond)\n\n with {:ok, deadline, options} <- prepare_options(options, entered_at),\n {:ok, command} <- command(:kill_server, nil, nil, options, nil, :one_shot),\n {:ok, _payload} <- Server.prepare_command(server, command) do\n server\n |> execute(:kill_server, command, options, deadline)\n |> require_completion()\n end\n end\n\n def run(:new_session, %Server{} = server, nil, name, options) do\n entered_at = System.monotonic_time(:millisecond)\n\n with {:ok, deadline, options} <- prepare_options(options, entered_at),\n {:ok, command} <- command(:new_session, nil, name, options, nil, :one_shot),\n {:ok, _payload} <- Server.prepare_command(server, command) do\n execute(server, :new_session, command, options, deadline)\n |> created_value(:new_session, nil)\n |> require_completion()\n end\n end\n\n def run(kind, connection, %Ref{} = target, value, options) do\n entered_at = System.monotonic_time(:millisecond)\n lane = if match?(%Control{}, connection), do: :control, else: :one_shot\n\n with {:ok, deadline, options} <- prepare_options(options, entered_at),\n {:ok, command} <- command(kind, target, value, options, target.server_instance, lane) do\n case connection do\n %Control{} ->\n request = Request.action(kind, target, value, options)\n\n with {:ok, result} <- Control.execute_deadline(connection, request, deadline),\n do: {:ok, result(result, :control, action_value(kind, result))}\n\n %Server{} ->\n with {:ok, _payload} <- Server.prepare_command(connection, command),\n {:ok, _payload} <- Server.prepare_command(connection, identity_command()),\n :ok <- identify(connection, target, deadline) do\n execute(connection, kind, command, options, deadline)\n end\n end\n |> created_value(kind, target)\n |> require_completion()\n end\n end\n\n def run(_kind, _connection, _target, _value, _options), do: failure(:invalid_target)\n\n @doc false\n def unwrap({:ok, %{outcome: :completed, value: value}}), do: value\n def unwrap({:error, error}), do: raise(error)\n\n defp require_completion({:ok, %{outcome: :completed}} = result), do: result\n\n defp require_completion({:ok, %{outcome: outcome} = result})\n when outcome in [:failed, :skipped, :unknown],\n do: {:error, %LibTmux.Action.CompletionError{result: result}}\n\n defp require_completion({:error, _error} = error), do: error\n\n defp prepare_options(options, entered_at) do\n options = options!(options)\n {timeout, options} = Keyword.pop(options, :timeout, 5000)\n\n unless is_integer(timeout) and timeout in 1..600_000,\n do: invalid!([:options, :timeout], \"expected an integer timeout in 1..600000ms\")\n\n {:ok, Deadline.new(timeout, now: entered_at), options}\n rescue\n error in Error -> {:error, error}\n end\n\n @doc false\n def command(kind, target, value, options, instance, lane) do\n options = options!(options, defaults(kind))\n\n with :ok <- target(kind, target, instance),\n :ok <- session(options[:session], instance),\n :ok <- lane(kind, value, lane) do\n command = build(kind, target, value, options)\n if lane == :one_shot, do: validate_argv!(command)\n {:ok, command}\n end\n rescue\n error in Error -> {:error, error}\n end\n\n defp options!(options, defaults \\\\ nil) do\n unless Keyword.keyword?(options), do: invalid!([:options], \"expected a keyword list\")\n\n Enum.reduce(options, MapSet.new(), fn {key, _value}, seen ->\n if MapSet.member?(seen, key), do: invalid!([:options, key], \"expected each option once\")\n\n if defaults != nil and not Keyword.has_key?(defaults, key),\n do: invalid!([:options, key], \"unknown option for this action\")\n\n MapSet.put(seen, key)\n end)\n\n if defaults, do: Keyword.validate!(options, defaults), else: options\n end\n\n defp defaults(:split),\n do: [\n session: nil,\n axis: :vertical,\n size: nil,\n before: false,\n detached: true,\n cwd: nil,\n command: :default\n ]\n\n defp defaults(:capture),\n do: [session: nil, start_line: 0, end_line: :last, join_lines: false, max_bytes: 65_536]\n\n defp defaults(kind) when kind in [:rename_session, :kill_server, :kill_session], do: []\n\n defp defaults(kind) when kind in [:new_session, :new_window],\n do: [cwd: nil, command: :default]\n\n defp defaults(kind)\n when kind in [:rename_window, :send_text, :send_keys, :kill_window, :kill_pane],\n do: [session: nil]\n\n defp defaults(_kind), do: invalid!([:action], \"expected a supported domain action\")\n\n defp target(kind, nil, _instance) when kind in [:new_session, :kill_server], do: :ok\n\n defp target(kind, _target, _instance) when kind in [:new_session, :kill_server],\n do: failure(:invalid_target)\n\n defp target(kind, %Ref{entity: entity} = target, instance) do\n expected =\n case kind do\n kind when kind in [:rename_session, :new_window, :kill_session] -> :session\n kind when kind in [:rename_window, :kill_window] -> :window\n kind when kind in [:split, :send_text, :send_keys, :capture, :kill_pane] -> :pane\n end\n\n if expected == entity, do: Ref.validate(target, instance), else: failure(:invalid_target)\n end\n\n defp target(_kind, _target, _instance), do: failure(:invalid_target)\n\n defp session(nil, _instance), do: :ok\n defp session(%Ref{entity: :session} = session, instance), do: Ref.validate(session, instance)\n defp session(_session, _instance), do: failure(:invalid_target)\n\n defp lane(kind, _value, :control)\n when kind in [\n :capture,\n :new_session,\n :new_window,\n :kill_server,\n :kill_session,\n :kill_window,\n :kill_pane\n ],\n do: failure(:unsupported_transport)\n\n defp lane(_kind, _value, _lane), do: :ok\n\n defp target_string(%Ref{entity: :session, id: id}, nil), do: id\n defp target_string(%Ref{entity: :pane, id: id}, %Ref{id: session}), do: session <> \":.\" <> id\n defp target_string(%Ref{entity: :window, id: id}, %Ref{id: session}), do: session <> \":\" <> id\n defp target_string(%Ref{id: id}, nil), do: id\n\n defp build(kind, target, name, options) when kind in [:rename_session, :rename_window] do\n command = if kind == :rename_session, do: \"rename-session\", else: \"rename-window\"\n\n new_command!(command, [\n \"-t\",\n target_string(target, options[:session]),\n \"--\",\n name!(name)\n ])\n end\n\n defp build(:kill_server, nil, nil, _options), do: new_command!(\"kill-server\", [])\n\n defp build(kind, target, nil, options)\n when kind in [:kill_session, :kill_window, :kill_pane] do\n command = kind |> Atom.to_string() |> String.replace(\"_\", \"-\")\n new_command!(command, [\"-t\", target_string(target, options[:session])])\n end\n\n defp build(kind, target, name, options) when kind in [:new_session, :new_window] do\n name = name!(name)\n\n unless options[:command] == :default or match?({:shell, _}, options[:command]) or\n match?({:argv, _}, options[:command]),\n do:\n invalid!(\n [:options, :command],\n \"creation expects :default, {:shell, bytes} or {:argv, arguments}\"\n )\n\n {command, args, field} =\n case kind do\n :new_session -> {\"new-session\", [\"-s\", name], \"session_id\"}\n :new_window -> {\"new-window\", [\"-t\", target.id <> \":\", \"-n\", name], \"window_id\"}\n end\n\n new_command!(\n command,\n [\"-d\", \"-P\", \"-F\", \"\\#{\" <> field <> \"}\" | args] ++\n cwd_args(options[:cwd]) ++ [\"--\" | pane_command!(options[:command])]\n )\n end\n\n defp build(:split, target, _value, options) do\n axis =\n case options[:axis] do\n :horizontal -> \"-h\"\n :vertical -> \"-v\"\n _ -> invalid!([:options, :axis], \"expected :horizontal or :vertical\")\n end\n\n size =\n case options[:size] do\n nil -> []\n {:percent, n} when is_integer(n) and n in 1..99 -> [\"-l\", \"#{n}%\"]\n {:cells, n} when is_integer(n) and n in 1..32_767 -> [\"-l\", Integer.to_string(n)]\n _ -> invalid!([:options, :size], \"expected nil, {:cells, 1..32767} or {:percent, 1..99}\")\n end\n\n argv = pane_command!(options[:command])\n\n args =\n [\"-t\", target_string(target, options[:session]), \"-P\", \"-F\", ~S\"#{pane_id}\", axis] ++\n flag(options[:detached], \"-d\", :detached) ++\n flag(options[:before], \"-b\", :before) ++ size ++ cwd_args(options[:cwd]) ++ [\"--\" | argv]\n\n new_command!(\"split-window\", args)\n end\n\n defp build(:send_text, target, bytes, options) do\n # tmux 3.8 permits 1000 command argv entries: five fixed plus the input bytes.\n unless is_binary(bytes) and byte_size(bytes) <= 995,\n do: invalid!([:text], \"expected at most 995 bytes\")\n\n # Hex keys preserve individual bytes, including NUL and invalid UTF-8.\n encoded = for <>, do: Integer.to_string(byte, 16)\n args = [\"-H\", \"-t\", target_string(target, options[:session]), \"--\" | encoded]\n # Empty key lists would resend tmux's triggering key rather than send nothing.\n new_command!(\"send-keys\", if(encoded == [], do: args ++ [\"\"], else: args))\n end\n\n defp build(:send_keys, target, keys, options) do\n unless keys != [] and bounded_list?(keys, 128),\n do: invalid!([:keys], \"expected a list of 1..128 supported key names\")\n\n Enum.each(Enum.with_index(keys), fn {key, index} ->\n unless key?(key), do: invalid!([:keys, index], \"expected a supported tmux key name\")\n end)\n\n new_command!(\"send-keys\", [\"-t\", target_string(target, options[:session]), \"--\" | keys])\n end\n\n defp build(:capture, target, _value, options) do\n unless is_integer(options[:max_bytes]) and options[:max_bytes] in 0..1_048_576,\n do: invalid!([:options, :max_bytes], \"expected an integer in 0..1048576\")\n\n unless is_integer(options[:start_line]) and options[:start_line] in -32_768..32_767,\n do: invalid!([:options, :start_line], \"expected an integer in -32768..32767\")\n\n args =\n [\n \"-p\",\n \"-t\",\n target_string(target, options[:session]),\n \"-S\",\n line(options[:start_line]),\n \"-E\",\n line(options[:end_line])\n ] ++ flag(options[:join_lines], \"-J\", :join_lines)\n\n new_command!(\"capture-pane\", args)\n end\n\n defp name!(name) do\n unless is_binary(name) and byte_size(name) in 1..1024 and String.valid?(name) and\n not Regex.match?(~r/\\p{Cc}/u, name),\n do: invalid!([:name], \"expected 1..1024 UTF-8 bytes without control characters\")\n\n Format.literal(name)\n end\n\n defp cwd_args(nil), do: []\n defp cwd_args(cwd), do: [\"-c\", Format.literal(bytes!(cwd, [:options, :cwd]))]\n\n defp pane_command!(:default), do: []\n defp pane_command!(:empty), do: [\"\"]\n\n defp pane_command!({:shell, text}) do\n bytes!(text, [:options, :command, :shell])\n\n if text == \"\",\n do:\n invalid!(\n [:options, :command, :shell],\n \"expected a nonempty shell command\"\n )\n\n [text]\n end\n\n defp pane_command!({:argv, argv}) do\n path = [:options, :command, :argv]\n\n case command_arguments!(argv, path) do\n [] -> invalid!(path, \"expected 1..64 argv entries including a nonempty executable\")\n [\"\" | _] -> invalid!(path ++ [0], \"expected a nonempty executable\")\n [program] -> [Native.executable(), \"--exec-one\", program]\n arguments -> arguments\n end\n end\n\n defp pane_command!(_command),\n do:\n invalid!(\n [:options, :command],\n \"expected :default, :empty, {:shell, bytes} or {:argv, arguments}\"\n )\n\n defp command_arguments!(argv, path) do\n unless bounded_list?(argv, 64),\n do: invalid!(path, \"expected a list of at most 64 command arguments\")\n\n Enum.each(Enum.with_index(argv), fn {argument, index} ->\n bytes!(argument, path ++ [index])\n end)\n\n argv\n end\n\n defp line(:last), do: \"-\"\n defp line(n) when is_integer(n) and n in -32_768..32_767, do: Integer.to_string(n)\n\n defp line(_value),\n do: invalid!([:options, :end_line], \"expected :last or an integer in -32768..32767\")\n\n defp flag(true, flag, _key), do: [flag]\n defp flag(false, _flag, _key), do: []\n defp flag(_value, _flag, key), do: invalid!([:options, key], \"expected true or false\")\n\n defp bounded_list?([], _remaining), do: true\n\n defp bounded_list?([_head | tail], remaining) when remaining > 0,\n do: bounded_list?(tail, remaining - 1)\n\n defp bounded_list?(_value, _remaining), do: false\n\n defp bytes!(value, path) do\n unless is_binary(value) and :binary.match(value, <<0>>) == :nomatch,\n do: invalid!(path, \"expected NUL-free bytes\")\n\n value\n end\n\n defp new_command!(name, args) do\n Command.new(name, args)\n rescue\n error in ArgumentError -> invalid!([:command], Exception.message(error))\n end\n\n defp validate_argv!(command) do\n Command.argv(command)\n :ok\n rescue\n error in ArgumentError -> invalid!([:command], Exception.message(error))\n end\n\n defp invalid!(path, reason) do\n raise Error,\n kind: :invalid_command,\n phase: :validation,\n certainty: :no_write,\n path: path,\n details: %{reason: reason}\n end\n\n defp key?(key) when is_binary(key) and byte_size(key) <= 32 do\n case Regex.run(~r/\\A((?:(?:C|M|S)-){0,3})(.+)\\z/, key) do\n [_, prefixes, base] ->\n modifiers = String.split(prefixes, \"-\", trim: true)\n\n function_key = Regex.match?(~r/\\AF(?:[1-9]|1[0-2])\\z/, base)\n\n Enum.uniq(modifiers) == modifiers and\n cond do\n modifiers == [] -> base in @keys or function_key\n modifiers == [\"C\"] and Regex.match?(~r/\\A[a-z@\\[\\\\\\]\\^_? ]\\z/, base) -> true\n modifiers == [\"M\"] and byte_size(base) == 1 and base >= \" \" and base <= \"~\" -> true\n true -> base in @modified_keys or function_key\n end\n\n _ ->\n false\n end\n end\n\n defp key?(_key), do: false\n\n defp identity_command, do: Command.new(\"display-message\", [\"-p\", ~S\"#{pid}\"])\n\n defp identify(server, target, deadline) do\n with {:ok, output} <-\n Server.run(server, identity_command(),\n deadline: deadline,\n max_stdout_bytes: 64\n ),\n {:ok, pid} <- Codec.decode_field(output.stdout, :integer, min: 1, max: 2_147_483_647),\n {:ok, instance} <- ProcessIdentity.read(pid),\n :ok <- Ref.validate(target, instance) do\n :ok\n else\n {:error, error} -> {:error, %{error | certainty: :no_write}}\n end\n end\n\n defp execute(server, kind, command, options, deadline) do\n limit = if kind == :capture, do: Keyword.get(options, :max_bytes, 65_536), else: 65_536\n\n case Server.run(server, command, deadline: deadline, max_stdout_bytes: limit) do\n {:ok, output} ->\n case decode(kind, output.stdout) do\n {:ok, value} ->\n {:ok,\n result(\n Map.merge(output, %{\n outcome: :completed,\n certainty: :acknowledged,\n evidence: :process_exit\n }),\n :one_shot,\n value\n )}\n\n {:error, error} ->\n {:error, %{error | details: output}}\n end\n\n {:error, %Error{kind: :command_error, details: output}} ->\n {:ok,\n result(\n Map.merge(output, %{\n outcome: :failed,\n certainty: :observed,\n evidence: :process_exit\n }),\n :one_shot,\n nil\n )}\n\n error ->\n error\n end\n end\n\n defp decode(:capture, bytes), do: {:ok, bytes}\n\n defp decode(kind, bytes) when kind in [:split, :new_session, :new_window] do\n case :binary.split(bytes, \"\\n\") do\n [id, \"\"] ->\n case Ref.new(created_entity(kind), id, \"reply\") do\n {:ok, _ref} -> {:ok, id}\n _ -> invalid_reply()\n end\n\n _ ->\n invalid_reply()\n end\n end\n\n defp decode(_kind, \"\"), do: {:ok, :ok}\n defp decode(_kind, _bytes), do: invalid_reply()\n\n defp action_value(:split, %{outcome: :completed, lines: [id]}), do: id\n defp action_value(_kind, %{outcome: :completed}), do: :ok\n defp action_value(_kind, _result), do: nil\n\n defp created_value(\n {:ok, %{outcome: :completed, transport: :control, value: id} = result},\n :split,\n %Ref{server_instance: instance}\n ) do\n {:ok, ref} = Ref.new(:pane, id, instance)\n {:ok, %{result | value: %{id: id, ref: ref}}}\n end\n\n defp created_value({:ok, %{outcome: :completed, value: id} = result}, kind, _target)\n when kind in [:split, :new_session, :new_window],\n do: {:ok, %{result | value: %{id: id, ref: nil}}}\n\n defp created_value(result, _kind, _target), do: result\n\n defp created_entity(:split), do: :pane\n defp created_entity(:new_session), do: :session\n defp created_entity(:new_window), do: :window\n\n defp result(result, lane, value),\n do: %{\n outcome: result.outcome,\n certainty: result.certainty,\n evidence: result.evidence,\n transport: lane,\n value: value,\n details: result\n }\n\n defp failure(kind), do: {:error, %Error{kind: kind, phase: :validation, certainty: :no_write}}\n\n defp invalid_reply,\n do: {:error, %Error{kind: :invalid_reply, phase: :parse, certainty: :acknowledged}}\nend\n" + }, + "lib/libtmux/action/completion_error.ex": { + "repo": "libtmux/libtmux-elixir", + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "83007cb9b5617eca58624cef1a51f3f11f263e1bea9a52ca218c4735b22fa7cc", + "content": "defmodule LibTmux.Action.CompletionError do\n @moduledoc \"\"\"\n An action result did not meet an explicit completion requirement.\n\n Returned in an error tuple by domain actions such as `LibTmux.Pane.split/3`\n and raised by their bang variants. `result` preserves the original\n failed, skipped or unknown outcome, including certainty and transport\n evidence. An unknown outcome remains unknown; this exception does not\n cancel work or authorize replay. Its message omits transport output.\n \"\"\"\n\n defexception [:result]\n\n @typedoc \"The original action result that did not establish command completion.\"\n @type t :: %__MODULE__{result: LibTmux.Action.unsuccessful_result()}\n\n @impl true\n def message(%{result: %{outcome: outcome, certainty: certainty, transport: transport}})\n when outcome in [:failed, :skipped, :unknown] and\n certainty in [:acknowledged, :observed, :no_write, :unknown] and\n transport in [:one_shot, :control],\n do:\n \"action outcome #{inspect(outcome)} (#{inspect(certainty)}, #{inspect(transport)}); expected :completed\"\n\n def message(_exception), do: \"expected a completed action outcome\"\nend\n" + }, "lib/libtmux/capture.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "297a1b8964fc28866f1d2987d6ff5aea6ce3e2d5e8d0ed06bddf1e1840b8761f", - "content": "defmodule LibTmux.Capture do\n @moduledoc \"\"\"\n Builds a bounded one-shot observation of one existing Linux tmux server.\n\n Capture checks topology and OS server identity before and after field\n reads. At most two attempts share the original deadline and work budgets;\n `attempts` accepts 1–3. Only inconsistent topology or disappearing read\n targets retry. Decoding and coverage errors remain visible.\n\n Defaults: 1024 contextual entity rows, 512 commands, 8 MiB total response\n bytes, 64 KiB per response and 5000 ms. Exceeding a ceiling returns an\n error, never a partial success. Linked rows count against the work limit.\n Capture adds no control attachment. Hooks configured on list commands can\n still have effects; retries do not replay application mutations.\n \"\"\"\n\n alias LibTmux.{Codec, Command, Deadline, Error, Format, Schema, Server, Snapshot}\n\n @typedoc \"\"\"\n Capture-wide budgets shared by all attempts and reads.\n\n Each read uses the smaller of remaining `max_bytes` and `max_response_bytes`.\n That effective ceiling must fit OneShot's 16 MiB stdout limit. The shared\n deadline must have at most 600,000 ms remaining when OneShot validates a read.\n Invalid combinations raise `ArgumentError` before that command executes.\n \"\"\"\n @type option ::\n {:timeout, pos_integer()}\n | {:deadline, Deadline.t()}\n | {:attempts, 1..3}\n | {:max_entities | :max_commands | :max_bytes | :max_response_bytes, pos_integer()}\n @session_fields [:id, :attached_count]\n @window_fields [:width, :height, :zoomed]\n @link_fields [:session_id, :index, :window_id, :active]\n @pane_fields [:id, :window_id, :index, :active, :dead, :width, :height, :pid, :exit_status]\n @client_fields [:id, :session_id, :pid, :width, :height, :control_mode]\n @strings %{\n session: [:name],\n window: [:name, :layout],\n pane: [:current_command, :current_path, :title]\n }\n\n @doc \"\"\"\n Performs bounded capture through an explicit server descriptor.\n\n See `t:option/0` for the composed work, response and remaining-deadline\n constraints inherited from `LibTmux.Transport.OneShot.run/3`.\n \"\"\"\n @spec fetch(Server.t(), [option()]) :: {:ok, Snapshot.t()} | {:error, Error.t()}\n def fetch(%Server{} = server, options \\\\ []) do\n if Keyword.has_key?(options, :deadline) and Keyword.has_key?(options, :timeout),\n do: raise(ArgumentError, \"pass a deadline or timeout, not both\")\n\n deadline =\n Keyword.get_lazy(options, :deadline, fn ->\n Deadline.new(Keyword.get(options, :timeout, 5000))\n end)\n\n options =\n Keyword.validate!(options, [\n :deadline,\n :timeout,\n attempts: 2,\n max_entities: 1024,\n max_commands: 512,\n max_bytes: 8_388_608,\n max_response_bytes: 65_536\n ])\n\n unless options[:attempts] in 1..3 and\n Enum.all?([:max_entities, :max_commands, :max_bytes, :max_response_bytes], fn key ->\n is_integer(options[key]) and options[key] > 0\n end),\n do:\n raise(\n ArgumentError,\n \"capture budgets must be positive integers; attempts must be 1..3\"\n )\n\n state = %{\n server: server,\n deadline: deadline,\n options: Map.new(options),\n commands: 0,\n bytes: 0,\n rows: 0\n }\n\n attempt(state, 1)\n end\n\n defp attempt(state, number) do\n try do\n started = System.monotonic_time(:millisecond)\n {instance, state} = identity(state)\n {before, state} = topology(state)\n {rows, state} = text_fields(before, state)\n {after_rows, state} = topology(state)\n {after_instance, state} = identity(state)\n\n if instance != after_instance or signature(before) != signature(after_rows),\n do: stop(state, :topology_changed)\n\n fields =\n Map.new(Schema.entities(), fn entity -> {entity, Map.keys(Schema.fields(entity))} end)\n\n case Snapshot.new(rows,\n server_instance: instance,\n captured_from: started,\n captured_until: System.monotonic_time(:millisecond),\n fields: fields,\n complete: Schema.entities()\n ) do\n {:ok, snapshot} ->\n if Deadline.remaining(state.deadline) == 0, do: stop(state, :timeout)\n {:ok, snapshot}\n\n {:error, error} ->\n throw({:capture_error, error, state})\n end\n catch\n {:capture_error, error, state} ->\n if retryable?(error) do\n if number < state.options.attempts and Deadline.remaining(state.deadline) > 0 do\n attempt(state, number + 1)\n else\n {:error,\n %Error{\n kind: :inconsistent_snapshot,\n phase: :capture,\n details: %{\n attempts: number,\n last_kind: error.kind,\n commands: state.commands,\n bytes: state.bytes\n }\n }}\n end\n else\n {:error, error}\n end\n end\n end\n\n defp retryable?(%Error{kind: kind})\n when kind in [\n :topology_changed,\n :inconsistent_snapshot,\n :conflicting_rows,\n :conflicting_link\n ],\n do: true\n\n defp retryable?(%Error{kind: :command_error, details: %{code: :not_found}}), do: true\n defp retryable?(_error), do: false\n\n defp topology(state) do\n {sessions, state} = list(state, \"list-sessions\", [], :session, @session_fields)\n\n formats =\n Enum.map(@link_fields, &format(:window_link, &1)) ++\n Enum.map(@window_fields, &format(:window, &1))\n\n {windows, state} = rows(state, \"list-windows\", [\"-a\"], Enum.join(formats, \"\\t\"))\n\n {links_and_windows, state} =\n Enum.map_reduce(windows, state, fn line, acc ->\n fields =\n Enum.map(@link_fields, &{:window_link, &1}) ++ Enum.map(@window_fields, &{:window, &1})\n\n decoded = decode_row(acc, line, fields)\n link = Map.take(decoded, @link_fields)\n window = decoded |> Map.take(@window_fields) |> Map.put(:id, link.window_id)\n {{link, window}, acc}\n end)\n\n {panes, state} = list(state, \"list-panes\", [\"-a\"], :pane, @pane_fields)\n {clients, state} = list(state, \"list-clients\", [], :client, @client_fields)\n {links, windows} = Enum.unzip(links_and_windows)\n\n {%{session: sessions, window: windows, window_link: links, pane: panes, client: clients},\n state}\n end\n\n defp list(state, command, arguments, entity, fields) do\n expression = Enum.map_join(fields, \"\\t\", &format(entity, &1))\n {lines, state} = rows(state, command, arguments, expression)\n\n {Enum.map(lines, &decode_row(state, &1, Enum.map(fields, fn field -> {entity, field} end))),\n state}\n end\n\n defp rows(state, command, arguments, expression) do\n {output, state} = read(state, command, arguments ++ [\"-F\", expression])\n\n lines =\n case output do\n \"\" ->\n []\n\n _ ->\n unless :binary.last(output) == 10, do: stop(state, :codec_error)\n output |> binary_part(0, byte_size(output) - 1) |> :binary.split(\"\\n\", [:global])\n end\n\n state = %{state | rows: state.rows + length(lines)}\n\n if state.rows > state.options.max_entities,\n do: stop(state, :resource_limit, %{reason: :entity_rows})\n\n {lines, state}\n end\n\n defp decode_row(state, line, fields) do\n values = :binary.split(line, \"\\t\", [:global])\n unless length(values) == length(fields), do: stop(state, :codec_error, %{reason: :row_fields})\n\n Map.new(Enum.zip(fields, values), fn {{entity, field}, value} ->\n metadata = Schema.field(entity, field)\n {field, decode(state, value <> \"\\n\", metadata, entity, field)}\n end)\n end\n\n defp decode(state, output, metadata, entity, field) do\n {type, options} =\n case metadata.type do\n {:id, :client} -> {:string, [encoding: :escaped_v1]}\n {:id, _} -> {:string, []}\n :string -> {:string, [encoding: :escaped_v1]}\n :nullable_integer -> {:integer, [min: 0, max: 2_147_483_647]}\n :integer -> {:integer, [min: 0, max: 2_147_483_647]}\n :boolean -> {:boolean, []}\n end\n\n result =\n if metadata.nullable and output == \"\\n\",\n do: {:ok, nil},\n else: Codec.decode_field(output, type, options)\n\n case result do\n {:ok, value} ->\n unless Schema.valid_value?(metadata, value),\n do: stop(state, :invalid_field, %{entity: entity, field: field})\n\n value\n\n {:error, error} ->\n throw({:capture_error, %{error | path: [entity, field]}, state})\n end\n end\n\n defp format(entity, field) do\n metadata = Schema.field(entity, field)\n\n if metadata.type == :string or metadata.type == {:id, :client},\n do: Format.field(metadata.format),\n else: ~S\"#{\" <> metadata.format <> \"}\"\n end\n\n defp text_fields(rows, state) do\n Enum.reduce(@strings, {rows, state}, fn {entity, fields}, {rows, state} ->\n {values, state} =\n rows[entity]\n |> Enum.uniq_by(& &1.id)\n |> Enum.map_reduce(state, fn row, state ->\n Enum.reduce(fields, {row, state}, fn field, {row, state} ->\n {output, state} =\n read(state, \"display-message\", [\"-p\", \"-t\", row.id, format(entity, field)])\n\n value = decode(state, output, Schema.field(entity, field), entity, field)\n {Map.put(row, field, value), state}\n end)\n end)\n\n # Merge free-form fields into every contextual row so physical conflicts remain visible.\n by_id = Map.new(values, &{&1.id, Map.take(&1, fields)})\n rows = Map.update!(rows, entity, &Enum.map(&1, fn row -> Map.merge(row, by_id[row.id]) end))\n {rows, state}\n end)\n end\n\n defp signature(rows) do\n %{\n sessions: rows.session |> Enum.map(& &1.id) |> MapSet.new(),\n links:\n rows.window_link |> Enum.map(&{&1.session_id, &1.index, &1.window_id}) |> MapSet.new(),\n panes: rows.pane |> Enum.map(&{&1.id, &1.window_id}) |> MapSet.new(),\n clients: rows.client |> Enum.map(&{&1.id, &1.session_id}) |> MapSet.new()\n }\n end\n\n defp identity(state) do\n {output, state} = read(state, \"display-message\", [\"-p\", ~S\"#{pid}\"])\n\n case Codec.decode_field(output, :integer, min: 1, max: 2_147_483_647) do\n {:ok, pid} ->\n case LibTmux.ProcessIdentity.read(pid) do\n {:ok, token} -> {token, state}\n {:error, _error} -> stop(state, :identity_unavailable)\n end\n\n {:error, error} ->\n throw({:capture_error, error, state})\n end\n end\n\n defp read(state, command, arguments) do\n if state.commands >= state.options.max_commands,\n do: stop(state, :resource_limit, %{reason: :commands})\n\n remaining = state.options.max_bytes - state.bytes\n if remaining <= 0, do: stop(state, :resource_limit, %{reason: :bytes})\n limit = min(remaining, state.options.max_response_bytes)\n state = %{state | commands: state.commands + 1}\n\n result =\n Server.run(state.server, Command.new(command, arguments),\n deadline: state.deadline,\n max_stdout_bytes: limit,\n max_stderr_bytes: min(limit, 65_536),\n max_total_bytes: limit\n )\n\n data =\n case result do\n {:ok, data} -> data\n {:error, error} -> error.details\n end\n\n state = %{\n state\n | bytes:\n state.bytes + byte_size(Map.get(data, :stdout, \"\")) +\n byte_size(Map.get(data, :stderr, \"\"))\n }\n\n if state.bytes > state.options.max_bytes, do: stop(state, :resource_limit, %{reason: :bytes})\n\n case result do\n {:ok, result} ->\n {result.stdout, state}\n\n {:error, error} ->\n throw({:capture_error, error, state})\n end\n end\n\n defp stop(state, kind, details \\\\ %{}),\n do:\n throw(\n {:capture_error,\n %Error{\n kind: kind,\n phase: :capture,\n details: Map.merge(%{commands: state.commands, bytes: state.bytes}, details)\n }, state}\n )\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "7ce2cedfc97592578be47780965ca74ef57f83549ecb6ab1de296ad21315e452", + "content": "defmodule LibTmux.Capture do\n @moduledoc \"\"\"\n Builds a bounded one-shot observation of one existing Linux tmux server.\n\n Capture checks topology and OS server identity before and after field\n reads. Attempts share the original deadline and work budgets; `attempts`\n defaults to 2 and accepts 1–3. Only inconsistent topology or disappearing\n read targets retry. Decoding and coverage errors remain visible.\n\n Defaults: 1024 topology rows, 512 commands, 8 MiB total response bytes,\n 64 KiB per response and 5000 ms. Exhausted capture-wide budgets return an\n error, never a partial success. Both topology scans count contextual linked rows.\n Free-form fields use one encoded listing per entity kind. One successful\n attempt uses 13 commands when those three listings fit. After a listing\n exceeds the response ceiling and its client retires, capture reads that\n kind's physical entities individually. The failed listing still consumes\n commands, bytes and time. Duplicate linked text rows consume bytes.\n Capture adds no control attachment. Hooks configured on list commands can\n still have effects; retries do not replay application mutations.\n \"\"\"\n\n alias LibTmux.{Codec, Command, Deadline, Error, Format, Schema, Server, Snapshot}\n alias LibTmux.Capture.Row\n\n @typedoc \"\"\"\n Capture-wide budgets shared by all attempts and reads.\n\n Each read uses the smaller of remaining `max_bytes` and `max_response_bytes`.\n That effective ceiling must fit OneShot's 16 MiB stdout limit. The shared\n deadline must have at most 600,000 ms remaining when OneShot validates a read.\n Invalid combinations raise `ArgumentError` before that command executes.\n \"\"\"\n @type option ::\n {:timeout, pos_integer()}\n | {:deadline, Deadline.t()}\n | {:attempts, 1..3}\n | {:max_entities | :max_commands | :max_bytes | :max_response_bytes, pos_integer()}\n @session_fields [:id, :attached_count]\n @window_fields [:width, :height, :zoomed]\n @link_fields [:session_id, :index, :window_id, :active]\n @pane_fields [:id, :window_id, :index, :active, :dead, :width, :height, :pid, :exit_status]\n @client_fields [:id, :session_id, :pid, :width, :height, :control_mode]\n @strings %{\n session: [:name],\n window: [:name, :layout],\n pane: [:current_command, :current_path, :title]\n }\n\n @doc \"\"\"\n Performs bounded capture through an explicit server descriptor.\n\n See `t:option/0` for the composed work, response and remaining-deadline\n constraints inherited from `LibTmux.Transport.OneShot.run/3`.\n\n See the [worked example](first-task.html).\n \"\"\"\n @spec fetch(Server.t(), [option()]) :: {:ok, Snapshot.t()} | {:error, Error.t()}\n def fetch(%Server{} = server, options \\\\ []) do\n if Keyword.has_key?(options, :deadline) and Keyword.has_key?(options, :timeout),\n do: raise(ArgumentError, \"pass a deadline or timeout, not both\")\n\n deadline =\n Keyword.get_lazy(options, :deadline, fn ->\n Deadline.new(Keyword.get(options, :timeout, 5000))\n end)\n\n options =\n Keyword.validate!(options, [\n :deadline,\n :timeout,\n attempts: 2,\n max_entities: 1024,\n max_commands: 512,\n max_bytes: 8_388_608,\n max_response_bytes: 65_536\n ])\n\n unless options[:attempts] in 1..3 and\n Enum.all?([:max_entities, :max_commands, :max_bytes, :max_response_bytes], fn key ->\n is_integer(options[key]) and options[key] > 0\n end),\n do:\n raise(\n ArgumentError,\n \"capture budgets must be positive integers; attempts must be 1..3\"\n )\n\n state = %{\n server: server,\n deadline: deadline,\n options: Map.new(options),\n commands: 0,\n bytes: 0,\n rows: 0\n }\n\n attempt(state, 1)\n end\n\n defp attempt(state, number) do\n try do\n started = System.monotonic_time(:millisecond)\n {instance, state} = identity(state)\n {before, state} = topology(state)\n {rows, state} = text_fields(before, state)\n {after_rows, state} = topology(state)\n {after_instance, state} = identity(state)\n\n if instance != after_instance or signature(before) != signature(after_rows),\n do: stop(state, :topology_changed)\n\n fields =\n Map.new(Schema.entities(), fn entity -> {entity, Map.keys(Schema.fields(entity))} end)\n\n case Snapshot.new(rows,\n server_instance: instance,\n captured_from: started,\n captured_until: System.monotonic_time(:millisecond),\n fields: fields,\n complete: Schema.entities()\n ) do\n {:ok, snapshot} ->\n if Deadline.remaining(state.deadline) == 0, do: stop(state, :timeout)\n {:ok, snapshot}\n\n {:error, error} ->\n throw({:capture_error, error, state})\n end\n catch\n {:capture_error, error, state} ->\n if retryable?(error) do\n if number < state.options.attempts and Deadline.remaining(state.deadline) > 0 do\n attempt(state, number + 1)\n else\n {:error,\n %Error{\n kind: :inconsistent_snapshot,\n phase: :capture,\n details: %{\n attempts: number,\n last_kind: error.kind,\n commands: state.commands,\n bytes: state.bytes\n }\n }}\n end\n else\n {:error, error}\n end\n end\n end\n\n defp retryable?(%Error{kind: kind})\n when kind in [\n :topology_changed,\n :inconsistent_snapshot,\n :conflicting_rows,\n :conflicting_link\n ],\n do: true\n\n defp retryable?(%Error{kind: :command_error, details: %{code: :not_found}}), do: true\n defp retryable?(_error), do: false\n\n defp topology(state) do\n {sessions, state} = list(state, \"list-sessions\", [], :session, @session_fields)\n\n formats =\n Enum.map(@link_fields, &format(:window_link, &1)) ++\n Enum.map(@window_fields, &format(:window, &1))\n\n {windows, state} = rows(state, \"list-windows\", [\"-a\"], Enum.join(formats, \"\\t\"))\n\n {links_and_windows, state} =\n Enum.map_reduce(windows, state, fn line, acc ->\n fields =\n Enum.map(@link_fields, &{:window_link, &1}) ++ Enum.map(@window_fields, &{:window, &1})\n\n decoded = decode_row(acc, line, fields)\n link = Map.take(decoded, @link_fields)\n window = decoded |> Map.take(@window_fields) |> Map.put(:id, link.window_id)\n {{link, window}, acc}\n end)\n\n {panes, state} = list(state, \"list-panes\", [\"-a\"], :pane, @pane_fields)\n {clients, state} = list(state, \"list-clients\", [], :client, @client_fields)\n {links, windows} = Enum.unzip(links_and_windows)\n\n {%{session: sessions, window: windows, window_link: links, pane: panes, client: clients},\n state}\n end\n\n defp list(state, command, arguments, entity, fields) do\n expression = Enum.map_join(fields, \"\\t\", &format(entity, &1))\n {lines, state} = rows(state, command, arguments, expression)\n\n {Enum.map(lines, &decode_row(state, &1, Enum.map(fields, fn field -> {entity, field} end))),\n state}\n end\n\n defp rows(state, command, arguments, expression) do\n {output, state} = read(state, command, arguments ++ [\"-F\", expression])\n\n lines =\n case output do\n \"\" ->\n []\n\n _ ->\n unless :binary.last(output) == 10, do: stop(state, :codec_error)\n output |> binary_part(0, byte_size(output) - 1) |> :binary.split(\"\\n\", [:global])\n end\n\n state = %{state | rows: state.rows + length(lines)}\n\n if state.rows > state.options.max_entities,\n do: stop(state, :resource_limit, %{reason: :entity_rows})\n\n {lines, state}\n end\n\n defp decode_row(state, line, fields) do\n values = :binary.split(line, \"\\t\", [:global])\n unless length(values) == length(fields), do: stop(state, :codec_error, %{reason: :row_fields})\n\n Map.new(Enum.zip(fields, values), fn {{entity, field}, value} ->\n metadata = Schema.field(entity, field)\n {field, decode(state, value <> \"\\n\", metadata, entity, field)}\n end)\n end\n\n defp decode(state, output, metadata, entity, field, encoding \\\\ :escaped_v1) do\n {type, options} =\n case metadata.type do\n {:id, :client} -> {:string, [encoding: encoding]}\n {:id, _} -> {:string, []}\n :string -> {:string, [encoding: encoding]}\n :nullable_integer -> {:integer, [min: 0, max: 2_147_483_647]}\n :integer -> {:integer, [min: 0, max: 2_147_483_647]}\n :boolean -> {:boolean, []}\n end\n\n result =\n if metadata.nullable and output == \"\\n\",\n do: {:ok, nil},\n else: Codec.decode_field(output, type, options)\n\n case result do\n {:ok, value} ->\n unless Schema.valid_value?(metadata, value),\n do: stop(state, :invalid_field, %{entity: entity, field: field})\n\n value\n\n {:error, error} ->\n throw({:capture_error, %{error | path: [entity, field]}, state})\n end\n end\n\n defp format(entity, field) do\n metadata = Schema.field(entity, field)\n\n if metadata.type == :string or metadata.type == {:id, :client},\n do: Format.field(metadata.format),\n else: ~S\"#{\" <> metadata.format <> \"}\"\n end\n\n defp text_fields(rows, state) do\n Enum.reduce(@strings, {rows, state}, fn {entity, fields}, {rows, state} ->\n {by_id, state} =\n try do\n bulk_text_fields(entity, fields, state)\n catch\n {:capture_error,\n %Error{\n kind: :resource_limit,\n phase: :capture,\n details: %{reason: reason, cleanup: :retired}\n }, state}\n when reason in [:stdout_bytes, :total_bytes] ->\n individual_text_fields(rows[entity], entity, fields, state)\n end\n\n unless MapSet.new(Map.keys(by_id)) == MapSet.new(rows[entity], & &1.id),\n do: stop(state, :topology_changed)\n\n rows =\n Map.update!(\n rows,\n entity,\n &Enum.map(&1, fn row -> Map.merge(row, Map.fetch!(by_id, row.id)) end)\n )\n\n {rows, state}\n end)\n end\n\n defp bulk_text_fields(entity, fields, state) do\n {command, arguments} =\n case entity do\n :session -> {\"list-sessions\", []}\n :window -> {\"list-windows\", [\"-a\"]}\n :pane -> {\"list-panes\", [\"-a\"]}\n end\n\n expression = Row.format(Enum.map([:id | fields], &Schema.field(entity, &1).format))\n {output, state} = read(state, command, arguments ++ [\"-F\", expression])\n unless output == \"\" or :binary.last(output) == 10, do: stop(state, :codec_error)\n\n lines =\n if output == \"\",\n do: [],\n else: output |> binary_part(0, byte_size(output) - 1) |> :binary.split(\"\\n\", [:global])\n\n by_id =\n Enum.reduce(lines, %{}, fn line, found ->\n decoded = decode_text_fields(line <> \"\\n\", entity, [:id | fields], state)\n {id, values} = Map.pop!(decoded, :id)\n if Map.has_key?(found, id) and found[id] != values, do: stop(state, :conflicting_rows)\n Map.put(found, id, values)\n end)\n\n {by_id, state}\n end\n\n defp individual_text_fields(rows, entity, fields, state) do\n expression = Row.format(Enum.map(fields, &Schema.field(entity, &1).format))\n\n {values, state} =\n rows\n |> Enum.uniq_by(& &1.id)\n |> Enum.map_reduce(state, fn row, state ->\n {output, state} = read(state, \"display-message\", [\"-p\", \"-t\", row.id, expression])\n {{row.id, decode_text_fields(output, entity, fields, state)}, state}\n end)\n\n {Map.new(values), state}\n end\n\n defp decode_text_fields(output, entity, fields, state) do\n case Row.decode(output, length(fields), max_bytes: state.options.max_response_bytes) do\n {:ok, values} ->\n Map.new(Enum.zip(fields, values), fn {field, value} ->\n {field, decode(state, value <> \"\\n\", Schema.field(entity, field), entity, field, :raw)}\n end)\n\n {:error, error} ->\n path =\n case error.path do\n [index] -> [entity, Enum.at(fields, index)]\n _ -> [entity]\n end\n\n throw({:capture_error, %{error | path: path}, state})\n end\n end\n\n defp signature(rows) do\n %{\n sessions: rows.session |> Enum.map(& &1.id) |> MapSet.new(),\n links:\n rows.window_link |> Enum.map(&{&1.session_id, &1.index, &1.window_id}) |> MapSet.new(),\n panes: rows.pane |> Enum.map(&{&1.id, &1.window_id}) |> MapSet.new(),\n clients: rows.client |> Enum.map(&{&1.id, &1.session_id}) |> MapSet.new()\n }\n end\n\n defp identity(state) do\n {output, state} = read(state, \"display-message\", [\"-p\", ~S\"#{pid}\"])\n\n case Codec.decode_field(output, :integer, min: 1, max: 2_147_483_647) do\n {:ok, pid} ->\n case LibTmux.ProcessIdentity.read(pid) do\n {:ok, token} -> {token, state}\n {:error, _error} -> stop(state, :identity_unavailable)\n end\n\n {:error, error} ->\n throw({:capture_error, error, state})\n end\n end\n\n defp read(state, command, arguments) do\n if state.commands >= state.options.max_commands,\n do: stop(state, :resource_limit, %{reason: :commands})\n\n remaining = state.options.max_bytes - state.bytes\n if remaining <= 0, do: stop(state, :resource_limit, %{reason: :bytes})\n limit = min(remaining, state.options.max_response_bytes)\n state = %{state | commands: state.commands + 1}\n\n result =\n Server.run(state.server, Command.new(command, arguments),\n deadline: state.deadline,\n max_stdout_bytes: limit,\n max_stderr_bytes: min(limit, 65_536),\n max_total_bytes: limit\n )\n\n data =\n case result do\n {:ok, data} -> data\n {:error, error} -> error.details\n end\n\n state = %{\n state\n | bytes:\n state.bytes + byte_size(Map.get(data, :stdout, \"\")) +\n byte_size(Map.get(data, :stderr, \"\"))\n }\n\n if state.bytes > state.options.max_bytes, do: stop(state, :resource_limit, %{reason: :bytes})\n\n case result do\n {:ok, result} ->\n {result.stdout, state}\n\n {:error, error} ->\n throw({:capture_error, error, state})\n end\n end\n\n defp stop(state, kind, details \\\\ %{}),\n do:\n throw(\n {:capture_error,\n %Error{\n kind: kind,\n phase: :capture,\n details: Map.merge(%{commands: state.commands, bytes: state.bytes}, details)\n }, state}\n )\nend\n" }, "lib/libtmux/codec.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "092e832359dcb394daadb42089e801f8927367bb0a24f811b7bebb0635134fad", - "content": "defmodule LibTmux.Codec do\n @moduledoc \"\"\"\n Decodes bounded field responses and control-output bytes.\n\n A field response contains one free-form field and one framing newline.\n The default raw mode removes only its framing newline and requires a\n separately qualified raw source. Use `encoding: :escaped_v1` for output\n produced by `LibTmux.Format.field/1`, including tmux 3.4's print path.\n This is a conservative response codec, not a multi-field row codec.\n \"\"\"\n\n alias LibTmux.Error\n\n @typedoc \"The required decoded field category; string additionally requires valid UTF-8.\"\n @type field_type :: :bytes | :string | :integer | :boolean\n @typedoc \"Field framing and value validation options; min and max apply only to integer fields.\"\n @type field_option ::\n {:encoding, :raw | :escaped_v1}\n | {:max_bytes, pos_integer()}\n | {:min | :max, integer() | nil}\n\n @doc \"Removes one framing newline and validates the complete field value.\"\n @spec decode_field(binary(), :bytes | :string, [field_option()]) ::\n {:ok, binary()} | {:error, Error.t()}\n @spec decode_field(binary(), :integer, [field_option()]) ::\n {:ok, integer()} | {:error, Error.t()}\n @spec decode_field(binary(), :boolean, [field_option()]) ::\n {:ok, boolean()} | {:error, Error.t()}\n def decode_field(response, type, options \\\\ []) when is_binary(response) do\n cond do\n byte_size(response) > max_bytes(options) ->\n error(:resource_limit, :field_bytes)\n\n byte_size(response) == 0 or :binary.last(response) != 10 ->\n error(:codec_error, :missing_framing_newline)\n\n true ->\n value = binary_part(response, 0, byte_size(response) - 1)\n\n with {:ok, value} <- decode_encoding(value, Keyword.get(options, :encoding, :raw)) do\n decode_value(value, type, options)\n end\n end\n end\n\n @doc \"Decodes tmux's three-digit octal output escapes as bytes.\"\n @spec decode_output(binary(), [{:max_bytes, pos_integer()}]) ::\n {:ok, binary()} | {:error, Error.t()}\n def decode_output(value, options \\\\ []) when is_binary(value) do\n if byte_size(value) > max_bytes(options) do\n error(:resource_limit, :output_bytes)\n else\n output(value, <<>>)\n end\n end\n\n defp decode_encoding(value, :raw), do: {:ok, value}\n defp decode_encoding(<<\"v1:\", value::binary>>, :escaped_v1), do: output(value, <<>>)\n defp decode_encoding(_value, :escaped_v1), do: error(:codec_error, :field_marker)\n defp decode_encoding(_value, _encoding), do: raise(ArgumentError, \"unknown field encoding\")\n\n defp decode_value(value, :bytes, _options), do: {:ok, value}\n\n defp decode_value(value, :string, _options) do\n if String.valid?(value), do: {:ok, value}, else: error(:invalid_encoding, :utf8)\n end\n\n defp decode_value(\"0\", :boolean, _options), do: {:ok, false}\n defp decode_value(\"1\", :boolean, _options), do: {:ok, true}\n defp decode_value(_value, :boolean, _options), do: error(:codec_error, :boolean)\n\n defp decode_value(value, :integer, options) do\n minimum = Keyword.get(options, :min)\n maximum = Keyword.get(options, :max)\n\n unless (is_nil(minimum) or is_integer(minimum)) and\n (is_nil(maximum) or is_integer(maximum)) do\n raise ArgumentError, \"integer bounds must be integers\"\n end\n\n case Integer.parse(value) do\n {number, \"\"} ->\n if (is_nil(minimum) or number >= minimum) and (is_nil(maximum) or number <= maximum),\n do: {:ok, number},\n else: error(:codec_error, :integer_range)\n\n _ ->\n error(:codec_error, :integer)\n end\n end\n\n defp decode_value(_value, _type, _options), do: raise(ArgumentError, \"unknown field type\")\n\n defp output(<<>>, decoded), do: {:ok, decoded}\n\n defp output(<<92, a, b, c, rest::binary>>, decoded)\n when a in ?0..?3 and b in ?0..?7 and c in ?0..?7 do\n byte = (a - ?0) * 64 + (b - ?0) * 8 + c - ?0\n output(rest, <>)\n end\n\n defp output(<>, decoded) when byte >= 32 and byte != 92 do\n output(rest, <>)\n end\n\n defp output(_value, _reversed), do: error(:invalid_encoding, :output_escape)\n\n defp max_bytes(options) do\n case Keyword.get(options, :max_bytes, 1_048_576) do\n value when is_integer(value) and value > 0 -> value\n _ -> raise ArgumentError, \"max_bytes must be a positive integer\"\n end\n end\n\n defp error(kind, reason) do\n {:error, %Error{kind: kind, phase: :capture, details: %{reason: reason}}}\n end\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "5ec0f6d39d9fcb246d0190a2992e2ba5f8b38530e09aa3bee8e359629d2a661d", + "content": "defmodule LibTmux.Codec do\n @moduledoc \"\"\"\n Decodes bounded field responses and control-output bytes.\n\n A field response contains one free-form field and one framing newline.\n The default raw mode removes only its framing newline and requires a\n separately qualified raw source. Use `encoding: :escaped_v1` for output\n produced by `LibTmux.Format.field/1`, including tmux 3.4's print path.\n This is a conservative response codec, not a multi-field row codec.\n \"\"\"\n\n alias LibTmux.Error\n\n @typedoc \"The required decoded field category; string additionally requires valid UTF-8.\"\n @type field_type :: :bytes | :string | :integer | :boolean\n @typedoc \"Field framing and value validation options; min and max apply only to integer fields.\"\n @type field_option ::\n {:encoding, :raw | :escaped_v1}\n | {:max_bytes, pos_integer()}\n | {:min | :max, integer() | nil}\n\n @doc \"\"\"\n Removes one framing newline and validates the complete field value.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec decode_field(binary(), :bytes | :string, [field_option()]) ::\n {:ok, binary()} | {:error, Error.t()}\n @spec decode_field(binary(), :integer, [field_option()]) ::\n {:ok, integer()} | {:error, Error.t()}\n @spec decode_field(binary(), :boolean, [field_option()]) ::\n {:ok, boolean()} | {:error, Error.t()}\n def decode_field(response, type, options \\\\ [])\n\n # Literal category clauses improve consumer type inference.\n for type <- [:bytes, :string, :integer, :boolean] do\n def decode_field(response, unquote(type), options) when is_binary(response) do\n with {:ok, value} <- decode_framed(response, options) do\n decode_value(value, unquote(type), options)\n end\n end\n end\n\n def decode_field(response, type, options) when is_binary(response) do\n with {:ok, value} <- decode_framed(response, options), do: decode_value(value, type, options)\n end\n\n @doc \"\"\"\n Decodes tmux's three-digit octal output escapes as bytes.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec decode_output(binary(), [{:max_bytes, pos_integer()}]) ::\n {:ok, binary()} | {:error, Error.t()}\n def decode_output(value, options \\\\ []) when is_binary(value) do\n if byte_size(value) > max_bytes(options) do\n error(:resource_limit, :output_bytes)\n else\n output(value, <<>>)\n end\n end\n\n defp decode_framed(response, options) do\n cond do\n byte_size(response) > max_bytes(options) ->\n error(:resource_limit, :field_bytes)\n\n byte_size(response) == 0 or :binary.last(response) != 10 ->\n error(:codec_error, :missing_framing_newline)\n\n true ->\n value = binary_part(response, 0, byte_size(response) - 1)\n decode_encoding(value, Keyword.get(options, :encoding, :raw))\n end\n end\n\n defp decode_encoding(value, :raw), do: {:ok, value}\n defp decode_encoding(<<\"v1:\", value::binary>>, :escaped_v1), do: output(value, <<>>)\n defp decode_encoding(_value, :escaped_v1), do: error(:codec_error, :field_marker)\n defp decode_encoding(_value, _encoding), do: raise(ArgumentError, \"unknown field encoding\")\n\n defp decode_value(value, :bytes, _options), do: {:ok, value}\n\n defp decode_value(value, :string, _options) do\n if String.valid?(value), do: {:ok, value}, else: error(:invalid_encoding, :utf8)\n end\n\n defp decode_value(\"0\", :boolean, _options), do: {:ok, false}\n defp decode_value(\"1\", :boolean, _options), do: {:ok, true}\n defp decode_value(_value, :boolean, _options), do: error(:codec_error, :boolean)\n\n defp decode_value(value, :integer, options) do\n minimum = Keyword.get(options, :min)\n maximum = Keyword.get(options, :max)\n\n unless (is_nil(minimum) or is_integer(minimum)) and\n (is_nil(maximum) or is_integer(maximum)) do\n raise ArgumentError, \"integer bounds must be integers\"\n end\n\n case Integer.parse(value) do\n {number, \"\"} ->\n if (is_nil(minimum) or number >= minimum) and (is_nil(maximum) or number <= maximum),\n do: {:ok, number},\n else: error(:codec_error, :integer_range)\n\n _ ->\n error(:codec_error, :integer)\n end\n end\n\n defp decode_value(_value, _type, _options), do: raise(ArgumentError, \"unknown field type\")\n\n defp output(<<>>, decoded), do: {:ok, decoded}\n\n defp output(<<92, a, b, c, rest::binary>>, decoded)\n when a in ?0..?3 and b in ?0..?7 and c in ?0..?7 do\n byte = (a - ?0) * 64 + (b - ?0) * 8 + c - ?0\n output(rest, <>)\n end\n\n defp output(<>, decoded) when byte >= 32 and byte != 92 do\n output(rest, <>)\n end\n\n defp output(_value, _reversed), do: error(:invalid_encoding, :output_escape)\n\n defp max_bytes(options) do\n case Keyword.get(options, :max_bytes, 1_048_576) do\n value when is_integer(value) and value > 0 -> value\n _ -> raise ArgumentError, \"max_bytes must be a positive integer\"\n end\n end\n\n defp error(kind, reason) do\n {:error, %Error{kind: kind, phase: :capture, details: %{reason: reason}}}\n end\nend\n" }, "lib/libtmux/command.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "fbe4b99dcddbc581c927afc88f0e9fc20ff3bda442781b59c54aceae2408cebe", - "content": "defmodule LibTmux.Command do\n @moduledoc \"\"\"\n A command value with separate argv and tmux-text renderers.\n\n Construction performs no I/O. Arguments are bytes without NUL. Rendering\n protects command syntax; arguments interpreted as formats still require\n `LibTmux.Format`. A command value does not authorize a shared control lane\n or establish completion behavior, including configured hooks and aliases.\n \"\"\"\n\n @enforce_keys [:name, :args]\n defstruct [:name, :args]\n\n @typedoc \"Trusted command data without I/O. Format operands need separate encoding before execution.\"\n @opaque t :: %__MODULE__{name: String.t(), args: [binary()]}\n @typedoc \"A positive byte ceiling for the selected argv or text rendering; encoded output is charged separately.\"\n @type option :: {:max_bytes, pos_integer()}\n\n @doc \"Constructs a trusted command, rejecting invalid arguments and input size.\"\n @spec new(String.t(), [binary()], [option()]) :: t()\n def new(name, args, options \\\\ []) do\n limit = limit(options)\n\n unless is_binary(name) and byte_size(name) in 1..64 and\n Regex.match?(~r/\\A[a-zA-Z][a-zA-Z0-9_-]*\\z/, name) and is_list(args) and\n length(args) <= 1024 and Enum.all?(args, &argument?/1) do\n raise ArgumentError,\n \"command requires a valid name and at most 1024 NUL-free binary arguments\"\n end\n\n ensure_size!([name | args], limit)\n %__MODULE__{name: name, args: args}\n end\n\n @doc \"Returns process arguments, preserving terminal semicolons in tmux's argv parser.\"\n @spec argv(t(), [option()]) :: [binary()]\n def argv(%__MODULE__{name: name, args: args}, options \\\\ []) do\n _ = new(name, args, options)\n result = [name | Enum.map(args, &argv_argument/1)]\n ensure_size!(result, limit(options))\n result\n end\n\n @doc \"Renders one newline-free tmux command line within its encoded byte budget.\"\n @spec render(t(), [option()]) :: binary()\n def render(%__MODULE__{name: name, args: args}, options \\\\ []) do\n _ = new(name, args, options)\n\n size =\n byte_size(name) +\n Enum.reduce(args, 0, fn value, size -> size + 3 + 4 * byte_size(value) end)\n\n if size > limit(options), do: raise(ArgumentError, \"encoded command exceeds max_bytes\")\n\n [name | Enum.map(args, fn value -> [\" \", quote_argument(value)] end)]\n |> IO.iodata_to_binary()\n end\n\n defp quote_argument(value) do\n [\n \"\\\"\",\n for(<>,\n do: [\"\\\\\", byte |> Integer.to_string(8) |> String.pad_leading(3, \"0\")]\n ),\n \"\\\"\"\n ]\n end\n\n defp argv_argument(value) do\n if byte_size(value) > 0 and :binary.last(value) == ?; do\n binary_part(value, 0, byte_size(value) - 1) <> \"\\\\;\"\n else\n value\n end\n end\n\n defp argument?(value), do: is_binary(value) and :binary.match(value, <<0>>) == :nomatch\n\n defp ensure_size!(arguments, limit) do\n size = Enum.reduce(arguments, 0, fn argument, size -> size + byte_size(argument) + 1 end)\n if size > limit, do: raise(ArgumentError, \"command exceeds max_bytes\")\n end\n\n defp limit(options) do\n case Keyword.get(options, :max_bytes, 65_536) do\n value when is_integer(value) and value > 0 -> value\n _ -> raise ArgumentError, \"max_bytes must be a positive integer\"\n end\n end\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "fcc2ac234c7f6fd546c0734b891d6593fc6696b4a83354e3f7664e08754a9fe2", + "content": "defmodule LibTmux.Command do\n @moduledoc \"\"\"\n A command value with separate argv and tmux-text renderers.\n\n Construction performs no I/O. Arguments are bytes without NUL. Rendering\n protects command syntax; arguments interpreted as formats still require\n `LibTmux.Format`. A command value does not authorize a shared control lane\n or establish completion behavior, including configured hooks and aliases.\n \"\"\"\n\n @enforce_keys [:name, :args]\n defstruct [:name, :args]\n\n @typedoc \"Trusted command data without I/O. Format operands need separate encoding before execution.\"\n @opaque t :: %__MODULE__{name: String.t(), args: [binary()]}\n @typedoc \"A positive byte ceiling for the selected argv or text rendering; encoded output is charged separately.\"\n @type option :: {:max_bytes, pos_integer()}\n\n @doc \"\"\"\n Constructs a trusted command, rejecting invalid arguments and input size.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec new(String.t(), [binary()], [option()]) :: t()\n def new(name, args, options \\\\ []) do\n limit = limit(options)\n\n unless is_binary(name) and byte_size(name) in 1..64 and\n Regex.match?(~r/\\A[a-zA-Z][a-zA-Z0-9_-]*\\z/, name) and is_list(args) and\n length(args) <= 1024 and Enum.all?(args, &argument?/1) do\n raise ArgumentError,\n \"command requires a valid name and at most 1024 NUL-free binary arguments\"\n end\n\n ensure_size!([name | args], limit)\n %__MODULE__{name: name, args: args}\n end\n\n @doc \"\"\"\n Returns process arguments, preserving terminal semicolons in tmux's argv parser.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec argv(t(), [option()]) :: [binary()]\n def argv(%__MODULE__{name: name, args: args}, options \\\\ []) do\n _ = new(name, args, options)\n result = [name | Enum.map(args, &argv_argument/1)]\n ensure_size!(result, limit(options))\n result\n end\n\n @doc \"\"\"\n Renders one newline-free tmux command line within its encoded byte budget.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec render(t(), [option()]) :: binary()\n def render(%__MODULE__{name: name, args: args}, options \\\\ []) do\n _ = new(name, args, options)\n\n size =\n byte_size(name) +\n Enum.reduce(args, 0, fn value, size -> size + 3 + 4 * byte_size(value) end)\n\n if size > limit(options), do: raise(ArgumentError, \"encoded command exceeds max_bytes\")\n\n [name | Enum.map(args, fn value -> [\" \", quote_argument(value)] end)]\n |> IO.iodata_to_binary()\n end\n\n defp quote_argument(value) do\n [\n \"\\\"\",\n for(<>,\n do: [\"\\\\\", byte |> Integer.to_string(8) |> String.pad_leading(3, \"0\")]\n ),\n \"\\\"\"\n ]\n end\n\n defp argv_argument(value) do\n if byte_size(value) > 0 and :binary.last(value) == ?; do\n binary_part(value, 0, byte_size(value) - 1) <> \"\\\\;\"\n else\n value\n end\n end\n\n defp argument?(value), do: is_binary(value) and :binary.match(value, <<0>>) == :nomatch\n\n defp ensure_size!(arguments, limit) do\n size = Enum.reduce(arguments, 0, fn argument, size -> size + byte_size(argument) + 1 end)\n if size > limit, do: raise(ArgumentError, \"command exceeds max_bytes\")\n end\n\n defp limit(options) do\n case Keyword.get(options, :max_bytes, 65_536) do\n value when is_integer(value) and value > 0 -> value\n _ -> raise ArgumentError, \"max_bytes must be a positive integer\"\n end\n end\nend\n" }, "lib/libtmux/control.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "7ad2cfa188a526c78abb62eafdad81a62a80cbd4481726a4c11c8b9658496ce2", - "content": "defmodule LibTmux.Control do\n @moduledoc \"\"\"\n A connection handle pinned to one qualified control epoch.\n\n `submit/3` returns a retained `LibTmux.Operation` after bounded admission.\n It never retries, refreshes, attaches, creates sessions or changes transport.\n `request_close/1` closes write authority for the entire pinned epoch through\n reserved capacity; it does not prove retirement or roll back effects.\n\n `start_link/1` explicitly attaches to an existing session. Its host must qualify\n the server's effective hooks, aliases and stream writers for the whole lane;\n a pinned handle is not authentication against unqualified command output or\n arbitrary writes to internal tables. Reads and local selections never attach.\n \"\"\"\n\n alias LibTmux.{Deadline, Error, Operation}\n alias LibTmux.Control.{Admission, Exchange, Inbox, Lifetime, Records, Request, Start}\n\n @enforce_keys [:owner, :view, :lifetime, :endpoint]\n @derive {Inspect, only: []}\n defstruct @enforce_keys\n @typedoc \"A handle pinned to one owner and connection epoch; it never follows a replacement.\"\n @opaque t :: %__MODULE__{}\n\n @typedoc \"Explicit attachment policy and bounded startup settings; capacities count slots and timeouts use milliseconds.\"\n @type start_option ::\n {:server, LibTmux.Server.t()}\n | {:session, {:existing, String.t()}}\n | {:lane, :host_qualified}\n | {:timeout, 1..600_000}\n | {:capacity | :metadata_capacity | :waiter_capacity, 1..256}\n | {:retention_ms, 1..600_000}\n\n @typedoc \"A positive millisecond budget shared by all stages of one lifecycle or submission call.\"\n @type call_option :: {:timeout, pos_integer()}\n\n @typedoc \"A pinned epoch's current phase and identity; retirement and unknown cleanup are distinct.\"\n @type connection_status :: %{\n epoch: reference() | nil,\n generation: non_neg_integer(),\n phase: :starting | :ready | :closing | :retired | :unknown,\n instance: String.t() | nil\n }\n\n @doc \"\"\"\n Starts a linked connection and returns `{:ok, root, control}`.\n\n Require `server: %LibTmux.Server{}`, `session: {:existing, \"$id\"}` and\n `lane: :host_qualified`. No session is created. The attachment is visible in\n tmux's client counts and can update session state. `no-output,ignore-size`\n suppresses pane output and excludes this client from window sizing.\n\n `timeout` defaults to 5000ms and accepts 1..600000ms. One budget covers input\n preparation, Root startup, bootstrap, ready waiting and handoff. A fresh\n factory returns a ready handle. Runtime failures return a structured error;\n invalid trusted options raise `ArgumentError`. Ordinary OTP links remain:\n an asynchronous fatal Root exit can terminate a non-trapping caller.\n\n Failed startup fences its lifetime and requests exact-Root cleanup. Error\n details distinguish observed Root exit from a kill request; unknown native\n cleanup is never success. OTP can await Root exit after its initialization\n timer expires, so a strict wall-clock caller-return bound remains unqualified.\n\n Optional `capacity`, `metadata_capacity` and `waiter_capacity` default to 32\n and accept 1..256. `retention_ms` defaults to 60000 and accepts 1..600000.\n\n Ready connections buffer at most 64 KiB or 128 stdout chunks behind the\n reader. Overflow closes the whole epoch with `resource_limit`; it never\n replays commands. These receive limits do not cap borrowed-server memory.\n \"\"\"\n @spec start_link([start_option()]) :: {:ok, pid(), t()} | {:error, Error.t()}\n def start_link(options) do\n entered_at = System.monotonic_time(:millisecond)\n Start.start(options, entered_at)\n end\n\n @doc \"\"\"\n Builds a permanent supervisor child spec without attaching.\n\n Prepares bounded detached inputs and one lifetime shared by all factory\n invocations. Each invocation starts its own configured startup budget.\n A restarted nonfresh lifetime returns an inert handle and never attaches\n automatically. Proven retirement permits explicit `reconnect/2`; unknown\n cleanup refuses it. Old handles never follow a replacement Root or Manager.\n\n `Supervisor.start_child/2` and `Supervisor.restart_child/2` return the new\n handle as their third info element. After an automatic restart, use\n `Supervisor.terminate_child/2` followed by `Supervisor.restart_child/2` for\n fresh info. This does not clear unknown cleanup or authorize replay.\n \"\"\"\n @spec child_spec([start_option()]) :: Supervisor.child_spec()\n def child_spec(options), do: Start.child_spec(options)\n\n @doc false\n def from_descriptor(%{owner: owner, view: view, lifetime: lifetime}) do\n with {:ok, endpoint} <- read(owner, view, lifetime),\n :ok <- ready(endpoint),\n {:ok, _template} <- Operation.prepare(endpoint) do\n {:ok, %__MODULE__{owner: owner, view: view, lifetime: lifetime, endpoint: endpoint}}\n end\n end\n\n @doc false\n def from_start_descriptor(%{owner: owner, view: view, lifetime: lifetime}) do\n with {:ok, endpoint} <- read(owner, view, lifetime),\n true <-\n endpoint.records.pool === endpoint.pool and endpoint.pool.owner == endpoint.manager,\n true <-\n endpoint.inbox.owner == endpoint.manager and\n :connection in endpoint.inbox.kinds and\n endpoint.waiter_inbox.owner == endpoint.manager and\n :await in endpoint.waiter_inbox.kinds,\n :ok <- Records.validate(endpoint.records),\n :ok <- Inbox.validate(endpoint.inbox),\n :ok <- Inbox.validate(endpoint.waiter_inbox) do\n {:ok, %__MODULE__{owner: owner, view: view, lifetime: lifetime, endpoint: endpoint}}\n else\n false -> failure(:wrong_connection)\n error -> error\n end\n end\n\n @doc false\n def await_ready(%__MODULE__{endpoint: endpoint} = control, %Deadline{} = deadline) do\n with {:ok, acknowledged} <-\n Exchange.call(endpoint.inbox, endpoint.epoch, deadline, {:connection, :ready}),\n do: bind_reconnected(control, acknowledged)\n end\n\n @doc \"\"\"\n Admits one request and returns its retained operation handle.\n\n `timeout` defaults to 5000ms and covers validation, admission, queueing,\n writes and replies under one monotonic deadline. Request binaries are\n detached before publication. Invalid input, overload or stale context before\n admission returns a no-write error. Every successful admission returns its\n Operation, even if its context disappears before publication. Inspect that\n handle for the eventual canonical result or an explicit lost-context error.\n\n Closing the connection can affect sibling operations. Command replies do\n not prove external program exit. Caller timeout does not authorize replay.\n \"\"\"\n @spec submit(t(), Request.t(), [call_option()]) :: {:ok, Operation.t()} | {:error, Error.t()}\n def submit(%__MODULE__{} = control, %Request{} = request, options \\\\ []) do\n entered_at = System.monotonic_time(:millisecond)\n options = Keyword.validate!(options, timeout: 5000)\n deadline = Deadline.new(options[:timeout], now: entered_at)\n\n with :ok <- unexpired(deadline),\n {:ok, endpoint} <- current(control),\n :ok <- ready(endpoint),\n {:ok, request, line} <- Request.prepare(request, endpoint.instance),\n {:ok, template} <- Operation.prepare(endpoint),\n {:ok, lease} <-\n Admission.claim(\n endpoint.pool,\n endpoint.epoch,\n endpoint.router,\n deadline,\n byte_size(line)\n ) do\n %Operation{} = operation = Operation.bind(template, lease)\n publish(control, endpoint, lease, request, deadline)\n {:ok, operation}\n else\n {:error, %Error{} = error} -> {:error, %{error | certainty: :no_write}}\n {:error, _reason} -> failure(:resource_limit)\n end\n end\n\n @doc \"Admits a request or raises the same structured error.\"\n @spec submit!(t(), Request.t(), [call_option()]) :: Operation.t()\n def submit!(control, request, options \\\\ []), do: unwrap(submit(control, request, options))\n\n @doc \"Reads the pinned epoch's current phase and identity without contacting tmux.\"\n @spec status(t()) :: {:ok, connection_status()} | {:error, Error.t()}\n def status(%__MODULE__{} = control) do\n result =\n with {:ok, endpoint} <- current(control) do\n %{generation: generation, phase: phase} = Lifetime.status(control.lifetime)\n\n if generation == endpoint.generation do\n {:ok,\n %{\n epoch: endpoint.epoch,\n generation: generation,\n phase: phase,\n instance: endpoint.instance\n }}\n else\n failure(:stale_connection)\n end\n end\n\n case result do\n {:error, %Error{} = error} -> {:error, %{error | phase: :status, certainty: :unknown}}\n success -> success\n end\n end\n\n @doc \"Reads pinned connection status or raises the same structured error.\"\n @spec status!(t()) :: connection_status()\n def status!(control), do: unwrap(status(control))\n\n @doc \"\"\"\n Requests whole-epoch closure without claiming an operation or metadata slot.\n\n Repeated requests for the same closing or proven-retired generation return\n `:ok`. Success is a request or previously known retirement, not a cleanup\n acknowledgement. A replacement Manager or epoch is never followed.\n \"\"\"\n @spec request_close(t()) :: :ok | {:error, Error.t()}\n def request_close(%__MODULE__{} = control) do\n result =\n with {:ok, endpoint} <- current(control) do\n case Lifetime.status(control.lifetime) do\n %{generation: generation, phase: :retired} when generation == endpoint.generation ->\n :ok\n\n %{generation: 0, phase: :unknown} ->\n failure(:cleanup_unknown)\n\n _ ->\n Lifetime.revoke(control.lifetime, endpoint.generation)\n end\n end\n\n case result do\n {:error, %Error{} = error} -> {:error, %{error | phase: :close, certainty: :unknown}}\n :ok -> :ok\n end\n end\n\n @doc \"Requests epoch closure or raises the same structured error.\"\n @spec request_close!(t()) :: :ok\n def request_close!(control), do: unwrap(request_close(control))\n\n @doc \"\"\"\n Requests closure and waits for proven retirement of the pinned epoch.\n\n `timeout` defaults to 5000ms. The original budget includes validation and\n retirement waiting. Closure still happens if the bounded metadata wait cannot\n be admitted. Timeout, overload or lost ownership reports unknown certainty;\n it never proves cleanup. `:ok` requires known native and actor retirement.\n\n The connection supervisor and retained records remain available for explicit\n reconnect and inspection. This does not stop the supervisor or roll back\n sibling effects.\n \"\"\"\n @spec close(t(), [call_option()]) :: :ok | {:error, Error.t()}\n def close(%__MODULE__{} = control, options \\\\ []) do\n deadline = lifecycle_deadline(options)\n\n result =\n with :ok <- request_close(control),\n {:ok, endpoint} <- current(control) do\n case Lifetime.status(control.lifetime) do\n %{generation: generation, phase: :retired} when generation == endpoint.generation ->\n unexpired(deadline)\n\n _ ->\n Exchange.call(endpoint.inbox, endpoint.epoch, deadline, {:connection, :retired})\n end\n end\n\n lifecycle_result(result, :close)\n end\n\n @doc \"Waits for retirement or raises the same structured error.\"\n @spec close!(t(), [call_option()]) :: :ok\n def close!(control, options \\\\ []), do: unwrap(close(control, options))\n\n @doc \"\"\"\n Explicitly obtains the ready epoch, starting a replacement only after retirement.\n\n A ready epoch returns itself. Call `close/2` first to require replacement.\n The default 5000ms budget covers metadata admission, retirement and startup.\n A successful reply pins the acknowledged endpoint even if it becomes stale\n before this caller resumes. It never follows a later view or replays work.\n Errors report unknown certainty about existing effects. Attachment counts\n include the control client; reconnect can attach one replacement client.\n \"\"\"\n @spec reconnect(t(), [call_option()]) :: {:ok, t()} | {:error, Error.t()}\n def reconnect(%__MODULE__{} = control, options \\\\ []) do\n deadline = lifecycle_deadline(options)\n\n result =\n with {:ok, endpoint} <- current(control),\n {:ok, acknowledged} <-\n Exchange.call(endpoint.inbox, endpoint.epoch, deadline, {:reconnect, nil}) do\n bind_reconnected(control, acknowledged)\n end\n\n lifecycle_result(result, :connect)\n end\n\n @doc \"Obtains the ready epoch or raises the same structured error.\"\n @spec reconnect!(t(), [call_option()]) :: t()\n def reconnect!(control, options \\\\ []), do: unwrap(reconnect(control, options))\n\n defp bind_reconnected(control, acknowledged) do\n shared = [:manager, :pool, :records, :inbox, :waiter_inbox, :lifetime]\n original = control.endpoint\n\n epoch_matches =\n (acknowledged.generation == original.generation and acknowledged.epoch == original.epoch) or\n (acknowledged.generation == original.generation + 1 and\n acknowledged.epoch != original.epoch)\n\n if acknowledged.phase == :ready and epoch_matches and\n Map.take(acknowledged, shared) === Map.take(original, shared),\n do: {:ok, %{control | endpoint: acknowledged}},\n else: failure(:invalid_reply)\n end\n\n defp lifecycle_deadline(options) do\n entered_at = System.monotonic_time(:millisecond)\n options = Keyword.validate!(options, timeout: 5000)\n Deadline.new(options[:timeout], now: entered_at)\n end\n\n defp lifecycle_result({:error, %Error{} = error}, phase),\n do: {:error, %{error | phase: phase, certainty: :unknown}}\n\n defp lifecycle_result(result, _phase), do: result\n\n defp publish(control, endpoint, lease, request, deadline) do\n with {:ok, ^endpoint} <- current(control),\n :ok <- ready(endpoint),\n {:ok, :reserved} <- Admission.state(endpoint.pool, lease),\n true <- Deadline.remaining(deadline) > 0 do\n send(endpoint.router, {:submit, endpoint.epoch, lease, request})\n end\n\n :ok\n end\n\n defp current(control) do\n with {:ok, endpoint} <- read(control.owner, control.view, control.lifetime) do\n if Map.drop(endpoint, [:phase, :births]) === Map.drop(control.endpoint, [:phase, :births]),\n do: {:ok, endpoint},\n else: failure(:stale_connection)\n end\n end\n\n defp read(owner, view, lifetime) do\n case :ets.info(view, :owner) do\n :undefined ->\n failure(:connection_lost)\n\n ^owner ->\n with [{:context, %{owner: ^owner, lifetime: ^lifetime}}] <- :ets.lookup(view, :context),\n [{:connection, %{lifetime: ^lifetime, manager: manager} = endpoint}] <-\n :ets.lookup(view, :connection),\n true <- Process.alive?(owner) and Process.alive?(manager) do\n {:ok, endpoint}\n else\n _ -> failure(:stale_connection)\n end\n\n _ ->\n failure(:wrong_connection)\n end\n rescue\n ArgumentError -> failure(:connection_lost)\n end\n\n defp ready(%{phase: :ready} = endpoint) do\n if Lifetime.allows_write?(endpoint.lifetime, endpoint.generation),\n do: :ok,\n else: failure(:stale_epoch)\n end\n\n defp ready(_endpoint), do: failure(:not_ready)\n\n defp unexpired(deadline),\n do: if(Deadline.remaining(deadline) > 0, do: :ok, else: failure(:timeout))\n\n defp failure(kind), do: {:error, %Error{kind: kind, phase: :admission, certainty: :no_write}}\n defp unwrap({:ok, value}), do: value\n defp unwrap({:error, error}), do: raise(error)\n defp unwrap(:ok), do: :ok\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "fee390e3fb25701071a345877face9c82b3173c0df4060b9edb647a99dd2700c", + "content": "defmodule LibTmux.Control do\n @moduledoc \"\"\"\n A qualified control connection for scoped and managed execution.\n\n Start with `with_connection/2` to own startup and cleanup around a callback.\n Use `execute/3` to obtain a command outcome after wire retirement and record\n reclamation. Canonical `:failed`, `:skipped` and `:unknown` outcomes remain\n values, including from bang functions; acknowledgement does not prove\n external program completion. See the [managed control guide](managed-control.html).\n\n A successful scope returns `{:ok, callback_value}` after proven cleanup.\n `LibTmux.Control.ScopeFailure` preserves the callback outcome when cleanup\n fails. `LibTmux.Control.ExecutionError` carries the operation handle and\n recovery context for errors after admission.\n\n Starting a connection explicitly attaches to an existing session. The host\n must qualify effective hooks, aliases and stream writers for its lifetime;\n `lane: :host_qualified` declares that work without performing it. Each handle\n stays pinned to one epoch. Pinning does not authenticate unqualified output\n or defend against arbitrary writes to internal tables. Local selections\n never attach, and commands never replay, refresh or change transport.\n\n For independently retained results, use `submit/3` and `LibTmux.Operation`.\n Awaiting a retained result does not reclaim its record. See the\n [advanced execution guide](advanced-execution.html) for explicit ownership.\n `request_close/1` closes write authority for the entire epoch through reserved\n capacity; it neither proves retirement nor rolls back effects.\n \"\"\"\n\n alias LibTmux.{Deadline, Error, Operation}\n\n alias LibTmux.Control.{\n Admission,\n Exchange,\n ExecutionError,\n Inbox,\n Lifetime,\n Records,\n Request,\n Start\n }\n\n @enforce_keys [:owner, :view, :lifetime, :endpoint]\n @derive {Inspect, only: []}\n defstruct @enforce_keys\n @typedoc \"A handle pinned to one owner and connection epoch; it never follows a replacement.\"\n @opaque t :: %__MODULE__{}\n\n @typedoc \"Explicit attachment policy and bounded startup settings; capacities count slots and timeouts use milliseconds.\"\n @type start_option ::\n {:server, LibTmux.Server.t()}\n | {:session, {:existing, String.t()}}\n | {:lane, :host_qualified}\n | {:timeout, 1..600_000}\n | {:capacity | :metadata_capacity | :waiter_capacity, 1..256}\n | {:retention_ms, 1..600_000}\n\n @typedoc \"A positive millisecond budget shared by all stages of one lifecycle or submission call.\"\n @type call_option :: {:timeout, pos_integer()}\n\n @typedoc \"Startup options plus a separate cleanup allowance of 1..950ms, default 950ms; callback duration has no library timer.\"\n @type scope_option :: start_option() | {:cleanup_timeout, 1..950}\n\n @typedoc \"An observed close reason, its error phase and at most 8192 captured stderr bytes; not proof of effects or complete stderr.\"\n @type terminal_diagnostic :: %{reason: atom(), phase: atom(), stderr: binary()}\n\n @typedoc \"A pinned epoch's current phase, identity and terminal evidence; retirement and unknown cleanup are distinct.\"\n @type connection_status :: %{\n epoch: reference() | nil,\n generation: non_neg_integer(),\n phase: :starting | :ready | :closing | :retired | :unknown,\n instance: String.t() | nil,\n terminal: terminal_diagnostic() | nil | :unavailable\n }\n\n @doc \"\"\"\n Starts a linked connection and returns `{:ok, root, control}`.\n\n Require `server: %LibTmux.Server{}`, `session: {:existing, \"$id\"}` and\n `lane: :host_qualified`. No session is created. The attachment is visible in\n tmux's client counts and can update session state. `no-output,ignore-size`\n suppresses pane output and excludes this client from window sizing.\n\n `timeout` defaults to 5000ms and accepts 1..600000ms. One budget covers input\n preparation, Root startup, bootstrap, ready waiting and handoff. A fresh\n factory returns a ready handle. Runtime failures return a structured error;\n invalid trusted options raise `ArgumentError`. Ordinary OTP links remain:\n an asynchronous fatal Root exit can terminate a non-trapping caller.\n\n Failed startup fences its lifetime and requests exact-Root cleanup. Error\n details distinguish observed Root exit from a kill request; unknown native\n cleanup is never success. OTP can await Root exit after its initialization\n timer expires, so a strict wall-clock caller-return bound remains unqualified.\n\n Optional `capacity`, `metadata_capacity` and `waiter_capacity` default to 32\n and accept 1..256. `retention_ms` defaults to 60000 and accepts 1..600000.\n\n Ready connections buffer at most 64 KiB or 128 stdout chunks behind the\n reader. Overflow closes the whole epoch with `resource_limit`; it never\n replays commands. These receive limits do not cap borrowed-server memory.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec start_link([start_option()]) :: {:ok, pid(), t()} | {:error, Error.t()}\n def start_link(options) do\n entered_at = System.monotonic_time(:millisecond)\n Start.start(options, entered_at)\n end\n\n @doc \"\"\"\n Runs a callback with one connection and owns its native and supervisor cleanup.\n\n Takes the explicit server, existing session and host qualification options\n from `start_link/1`. The callback runs in the calling process. Its duration\n is separate from startup and `cleanup_timeout` (default 950ms). A dedicated\n connection owner also requests cleanup when that caller dies.\n\n Returns `{:ok, value}` after proven connection retirement and Root exit.\n Cleaned-up exceptions, throws and exits are re-raised with their original\n stacktrace. If cleanup fails, returns `{:error, ScopeFailure}` containing the\n callback's original value or exception and separate cleanup evidence.\n Startup failures return `{:error, Error}`; invalid options raise.\n\n The control handle is scoped to the callback. Explicit reconnect is allowed\n inside it; cleanup permanently fences new epochs and retires the current one.\n Escaped handles cannot reconnect after the scope. Startup retains `start_link/1`'s OTP initialization\n limitation; a timeout can report unknown cleanup while its owner is still\n unwinding startup. It does not promise a hard native process-exit deadline.\n\n alias LibTmux.Control\n\n Control.with_connection(options, fn control ->\n Control.execute(control, LibTmux.Control.Request.field(\"pid\"))\n end)\n \"\"\"\n @spec with_connection([scope_option()], (t() -> value)) ::\n {:ok, value} | {:error, Error.t() | LibTmux.Control.ScopeFailure.t(value)}\n when value: var\n def with_connection(options, callback), do: LibTmux.Control.Scope.run(options, callback)\n\n @doc false\n def scope_close(%__MODULE__{} = control, %Deadline{} = deadline) do\n :ok = Lifetime.shutdown(control.lifetime)\n\n result =\n with {:ok, endpoint} <- read(control.owner, control.view, control.lifetime),\n true <- endpoint.manager == control.endpoint.manager do\n Exchange.call(endpoint.inbox, endpoint.epoch, deadline, {:connection, :shutdown})\n else\n false -> failure(:stale_connection)\n error -> error\n end\n\n lifecycle_result(result, :close)\n end\n\n @doc \"\"\"\n Builds a permanent supervisor child spec without attaching.\n\n Prepares bounded detached inputs and one lifetime shared by all factory\n invocations. Each invocation starts its own configured startup budget.\n A restarted nonfresh lifetime returns an inert handle and never attaches\n automatically. Proven retirement permits explicit `reconnect/2`; unknown\n cleanup refuses it. Old handles never follow a replacement Root or Manager.\n\n `Supervisor.start_child/2` and `Supervisor.restart_child/2` return the new\n handle as their third info element. After an automatic restart, use\n `Supervisor.terminate_child/2` followed by `Supervisor.restart_child/2` for\n fresh info. This does not clear unknown cleanup or authorize replay.\n\n See the [worked example](supervised-control.html).\n \"\"\"\n @spec child_spec([start_option()]) :: Supervisor.child_spec()\n def child_spec(options), do: Start.child_spec(options)\n\n @doc false\n def from_descriptor(%{owner: owner, view: view, lifetime: lifetime}) do\n with {:ok, endpoint} <- read(owner, view, lifetime),\n :ok <- ready(endpoint),\n {:ok, _template} <- Operation.prepare(endpoint) do\n {:ok, %__MODULE__{owner: owner, view: view, lifetime: lifetime, endpoint: endpoint}}\n end\n end\n\n @doc false\n def from_start_descriptor(%{owner: owner, view: view, lifetime: lifetime}) do\n with {:ok, endpoint} <- read(owner, view, lifetime),\n true <-\n endpoint.records.pool === endpoint.pool and endpoint.pool.owner == endpoint.manager,\n true <-\n endpoint.inbox.owner == endpoint.manager and\n :connection in endpoint.inbox.kinds and\n endpoint.waiter_inbox.owner == endpoint.manager and\n :await in endpoint.waiter_inbox.kinds,\n :ok <- Records.validate(endpoint.records),\n :ok <- Inbox.validate(endpoint.inbox),\n :ok <- Inbox.validate(endpoint.waiter_inbox) do\n {:ok, %__MODULE__{owner: owner, view: view, lifetime: lifetime, endpoint: endpoint}}\n else\n false -> failure(:wrong_connection)\n error -> error\n end\n end\n\n @doc false\n def await_ready(%__MODULE__{endpoint: endpoint} = control, %Deadline{} = deadline) do\n with {:ok, acknowledged} <-\n Exchange.call(endpoint.inbox, endpoint.epoch, deadline, {:connection, :ready}),\n do: bind_reconnected(control, acknowledged)\n end\n\n @doc \"\"\"\n Admits one request and returns its retained operation handle.\n\n `timeout` defaults to 5000ms and covers validation, admission, queueing,\n writes and replies under one monotonic deadline. Request binaries are\n detached before publication. Invalid input, overload or stale context before\n admission returns a no-write error. Every successful admission returns its\n Operation, even if its context disappears before publication. Inspect that\n handle for the eventual canonical result or an explicit lost-context error.\n\n Closing the connection can affect sibling operations. Command replies do\n not prove external program exit. Caller timeout does not authorize replay.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec submit(t(), Request.t(), [call_option()]) :: {:ok, Operation.t()} | {:error, Error.t()}\n def submit(%__MODULE__{} = control, %Request{} = request, options \\\\ []) do\n entered_at = System.monotonic_time(:millisecond)\n options = Keyword.validate!(options, timeout: 5000)\n deadline = Deadline.new(options[:timeout], now: entered_at)\n\n admit(control, request, deadline, :retained)\n end\n\n @doc \"\"\"\n Executes one qualified request, returning its result after wire retirement\n and record reclamation. Repeated successful calls need no manual forget.\n\n The default 5000ms budget covers preparation, admission, execution and\n collection. Failed, skipped and unknown canonical outcomes remain values;\n acknowledgement does not establish external program completion.\n\n Pre-admission errors have no-write certainty. An error after admission is\n a `LibTmux.Control.ExecutionError` with the exact Operation and retained or\n lost context. Inspect that handle when available; never replay on timeout.\n The original caller owns recovery: its death permits reclamation after wire\n retirement, even if it passed the handle to another process. A live caller's\n timeout leaves the record subject to normal retention and explicit forget.\n `Operation.status/1` and `Operation.result/1` inspect it without a waiter.\n A new await needs its own slot; the expired collector releases its slot\n asynchronously when the owner processes closure.\n Use `submit/3` when a retained handle is required after successful waiting.\n\n alias LibTmux.Control\n\n Control.execute(control, LibTmux.Control.Request.field(\"pid\"))\n \"\"\"\n @spec execute(t(), Request.t(), [call_option()]) ::\n {:ok, Operation.result()} | {:error, Error.t() | ExecutionError.t()}\n def execute(%__MODULE__{} = control, %Request{} = request, options \\\\ []) do\n entered_at = System.monotonic_time(:millisecond)\n options = Keyword.validate!(options, timeout: 5000)\n deadline = Deadline.new(options[:timeout], now: entered_at)\n\n execute_deadline(control, request, deadline)\n end\n\n @doc false\n def execute_deadline(control, request, %Deadline{} = deadline) do\n with {:ok, operation} <- admit(control, request, deadline, :managed) do\n case Operation.collect(operation, deadline) do\n {:ok, result} ->\n {:ok, result}\n\n {:error, error} ->\n context =\n case Operation.status(operation) do\n {:ok, _status} -> :retained\n {:error, _error} -> :lost\n end\n\n {:error, %ExecutionError{error: error, operation: operation, context: context}}\n end\n end\n end\n\n @doc \"\"\"\n Executes and reclaims as in `execute/3`; raises API/context errors, preserving canonical failures as values.\n\n See the [worked example](managed-control.html).\n \"\"\"\n @spec execute!(t(), Request.t(), [call_option()]) :: Operation.result()\n def execute!(control, request, options \\\\ []) do\n case execute(control, request, options) do\n {:ok, result} -> result\n {:error, error} -> raise error\n end\n end\n\n defp admit(control, request, deadline, mode) do\n with :ok <- unexpired(deadline),\n {:ok, endpoint} <- current(control),\n :ok <- ready(endpoint),\n {:ok, request, line} <- Request.prepare(request, endpoint.instance),\n {:ok, template} <- Operation.prepare(endpoint),\n {:ok, lease} <-\n Admission.claim(\n endpoint.pool,\n endpoint.epoch,\n endpoint.router,\n deadline,\n byte_size(line),\n mode: mode\n ) do\n %Operation{} = operation = Operation.bind(template, lease)\n publish(control, endpoint, lease, request, deadline)\n {:ok, operation}\n else\n {:error, %Error{} = error} -> {:error, %{error | certainty: :no_write}}\n {:error, _reason} -> failure(:resource_limit)\n end\n end\n\n @doc \"\"\"\n Admits a request or raises the same structured error.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec submit!(t(), Request.t(), [call_option()]) :: Operation.t()\n def submit!(control, request, options \\\\ []), do: unwrap(submit(control, request, options))\n\n @doc \"\"\"\n Reads the pinned epoch's phase, identity and terminal diagnostics without I/O.\n\n `terminal` is `nil` before a terminal report, or `:unavailable` when the\n report is missing or an ended epoch has no report. A report contains `reason`, its error\n `phase` and at most 8192 raw `stderr` bytes. Empty stderr means no bytes were\n captured; the buffer may be incomplete and need not be UTF-8. It can contain\n application data and is never logged automatically.\n\n A terminal report can coexist with `:closing` or unknown cleanup. Its reason\n is an observed cause, not necessarily the original cause, and does not alter\n operation outcomes. Status fields are separate observations, not an atomic\n snapshot. A replacement epoch starts without the old report; old handles\n remain stale. Losing the status owner returns the existing context error.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec status(t()) :: {:ok, connection_status()} | {:error, Error.t()}\n def status(%__MODULE__{} = control) do\n result =\n with {:ok, endpoint} <- current(control) do\n %{generation: generation, phase: phase} = Lifetime.status(control.lifetime)\n\n if generation == endpoint.generation do\n with {:ok, terminal} <- terminal(control, endpoint, phase) do\n {:ok,\n %{\n epoch: endpoint.epoch,\n generation: generation,\n phase: phase,\n instance: endpoint.instance,\n terminal: terminal\n }}\n end\n else\n failure(:stale_connection)\n end\n end\n\n case result do\n {:error, %Error{} = error} -> {:error, %{error | phase: :status, certainty: :unknown}}\n success -> success\n end\n end\n\n @doc \"\"\"\n Reads pinned connection status or raises the same structured error.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec status!(t()) :: connection_status()\n def status!(control), do: unwrap(status(control))\n\n @doc \"\"\"\n Requests whole-epoch closure without claiming an operation or metadata slot.\n\n Repeated requests for the same closing or proven-retired generation return\n `:ok`. Success is a request or previously known retirement, not a cleanup\n acknowledgement. A replacement Manager or epoch is never followed.\n\n See the [worked example](supervised-control.html).\n \"\"\"\n @spec request_close(t()) :: :ok | {:error, Error.t()}\n def request_close(%__MODULE__{} = control) do\n result =\n with {:ok, endpoint} <- current(control) do\n case Lifetime.status(control.lifetime) do\n %{generation: generation, phase: :retired} when generation == endpoint.generation ->\n :ok\n\n %{generation: 0, phase: :unknown} ->\n failure(:cleanup_unknown)\n\n _ ->\n Lifetime.revoke(control.lifetime, endpoint.generation)\n end\n end\n\n case result do\n {:error, %Error{} = error} -> {:error, %{error | phase: :close, certainty: :unknown}}\n :ok -> :ok\n end\n end\n\n @doc \"\"\"\n Requests epoch closure or raises the same structured error.\n\n See the [worked example](supervised-control.html).\n \"\"\"\n @spec request_close!(t()) :: :ok\n def request_close!(control), do: unwrap(request_close(control))\n\n @doc \"\"\"\n Requests closure and waits for proven retirement of the pinned epoch.\n\n `timeout` defaults to 5000ms. The original budget includes validation and\n retirement waiting. Closure still happens if the bounded metadata wait cannot\n be admitted. Timeout, overload or lost ownership reports unknown certainty;\n it never proves cleanup. `:ok` requires known native and actor retirement.\n\n The connection supervisor and retained records remain available for explicit\n reconnect and inspection. This does not stop the supervisor or roll back\n sibling effects.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec close(t(), [call_option()]) :: :ok | {:error, Error.t()}\n def close(%__MODULE__{} = control, options \\\\ []) do\n deadline = lifecycle_deadline(options)\n\n result =\n with :ok <- request_close(control),\n {:ok, endpoint} <- current(control) do\n case Lifetime.status(control.lifetime) do\n %{generation: generation, phase: :retired} when generation == endpoint.generation ->\n unexpired(deadline)\n\n _ ->\n Exchange.call(endpoint.inbox, endpoint.epoch, deadline, {:connection, :retired})\n end\n end\n\n lifecycle_result(result, :close)\n end\n\n @doc \"\"\"\n Waits for retirement or raises the same structured error.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec close!(t(), [call_option()]) :: :ok\n def close!(control, options \\\\ []), do: unwrap(close(control, options))\n\n @doc \"\"\"\n Explicitly obtains the ready epoch, starting a replacement only after retirement.\n\n A ready epoch returns itself. Call `close/2` first to require replacement.\n The default 5000ms budget covers metadata admission, retirement and startup.\n A successful reply pins the acknowledged endpoint even if it becomes stale\n before this caller resumes. It never follows a later view or replays work.\n Errors report unknown certainty about existing effects. Attachment counts\n include the control client; reconnect can attach one replacement client.\n\n See the [worked example](supervised-control.html).\n \"\"\"\n @spec reconnect(t(), [call_option()]) :: {:ok, t()} | {:error, Error.t()}\n def reconnect(%__MODULE__{} = control, options \\\\ []) do\n deadline = lifecycle_deadline(options)\n\n result =\n with {:ok, endpoint} <- current(control),\n {:ok, acknowledged} <-\n Exchange.call(endpoint.inbox, endpoint.epoch, deadline, {:reconnect, nil}) do\n bind_reconnected(control, acknowledged)\n end\n\n lifecycle_result(result, :connect)\n end\n\n @doc \"\"\"\n Obtains the ready epoch or raises the same structured error.\n\n See the [worked example](supervised-control.html).\n \"\"\"\n @spec reconnect!(t(), [call_option()]) :: t()\n def reconnect!(control, options \\\\ []), do: unwrap(reconnect(control, options))\n\n defp bind_reconnected(control, acknowledged) do\n shared = [:manager, :pool, :records, :inbox, :waiter_inbox, :lifetime]\n original = control.endpoint\n\n epoch_matches =\n (acknowledged.generation == original.generation and acknowledged.epoch == original.epoch) or\n (acknowledged.generation == original.generation + 1 and\n acknowledged.epoch != original.epoch)\n\n if acknowledged.phase == :ready and epoch_matches and\n Map.take(acknowledged, shared) === Map.take(original, shared),\n do: {:ok, %{control | endpoint: acknowledged}},\n else: failure(:invalid_reply)\n end\n\n defp lifecycle_deadline(options) do\n entered_at = System.monotonic_time(:millisecond)\n options = Keyword.validate!(options, timeout: 5000)\n Deadline.new(options[:timeout], now: entered_at)\n end\n\n defp lifecycle_result({:error, %Error{} = error}, phase),\n do: {:error, %{error | phase: phase, certainty: :unknown}}\n\n defp lifecycle_result(result, _phase), do: result\n\n defp publish(control, endpoint, lease, request, deadline) do\n with {:ok, ^endpoint} <- current(control),\n :ok <- ready(endpoint),\n {:ok, :reserved} <- Admission.state(endpoint.pool, lease),\n true <- Deadline.remaining(deadline) > 0 do\n send(endpoint.router, {:submit, endpoint.epoch, lease, request})\n end\n\n :ok\n end\n\n defp current(control) do\n with {:ok, endpoint} <- read(control.owner, control.view, control.lifetime) do\n if Map.drop(endpoint, [:phase, :births]) === Map.drop(control.endpoint, [:phase, :births]),\n do: {:ok, endpoint},\n else: failure(:stale_connection)\n end\n end\n\n defp read(owner, view, lifetime) do\n case :ets.info(view, :owner) do\n :undefined ->\n failure(:connection_lost)\n\n ^owner ->\n with [{:context, %{owner: ^owner, lifetime: ^lifetime}}] <- :ets.lookup(view, :context),\n [{:connection, %{lifetime: ^lifetime, manager: manager} = endpoint}] <-\n :ets.lookup(view, :connection),\n true <- Process.alive?(owner) and Process.alive?(manager) do\n {:ok, endpoint}\n else\n _ -> failure(:stale_connection)\n end\n\n _ ->\n failure(:wrong_connection)\n end\n rescue\n ArgumentError -> failure(:connection_lost)\n end\n\n defp terminal(control, endpoint, phase) do\n case :ets.lookup(control.view, :terminal) do\n [{:terminal, epoch, generation, diagnostic}]\n when epoch == endpoint.epoch and generation == endpoint.generation ->\n {:ok,\n if(is_nil(diagnostic) and phase in [:retired, :unknown],\n do: :unavailable,\n else: diagnostic\n )}\n\n [] ->\n {:ok, :unavailable}\n\n _ ->\n failure(:stale_connection)\n end\n rescue\n ArgumentError -> failure(:connection_lost)\n end\n\n defp ready(%{phase: :ready} = endpoint) do\n if Lifetime.allows_write?(endpoint.lifetime, endpoint.generation),\n do: :ok,\n else: failure(:stale_epoch)\n end\n\n defp ready(_endpoint), do: failure(:not_ready)\n\n defp unexpired(deadline),\n do: if(Deadline.remaining(deadline) > 0, do: :ok, else: failure(:timeout))\n\n defp failure(kind), do: {:error, %Error{kind: kind, phase: :admission, certainty: :no_write}}\n defp unwrap({:ok, value}), do: value\n defp unwrap({:error, error}), do: raise(error)\n defp unwrap(:ok), do: :ok\nend\n" + }, + "lib/libtmux/control/execution_error.ex": { + "repo": "libtmux/libtmux-elixir", + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "6ed0b7ce5374be1f9bbe5e4443b2653bae3368990b3a057f6553071c79a430d9", + "content": "defmodule LibTmux.Control.ExecutionError do\n @moduledoc \"\"\"\n A managed execution reported an error after admission.\n\n `error` explains the wait or context failure. `operation` is the exact\n admitted handle. `context` reports whether its record was retained when\n inspected; expiry, Manager loss or death of the original `execute/3` caller\n can invalidate it later. Passing the handle to another process does not\n transfer recovery ownership; use `Control.submit/3` for durable retention\n independent of the submitting caller. `:lost` never\n establishes that the command was unwritten and does not authorize replay.\n Inspect a retained handle with `LibTmux.Operation.status/1` before leaving\n its owning scope. See the [recovery example](recovery.html).\n \"\"\"\n defexception [:error, :operation, :context]\n @typedoc \"Recovery evidence after admission; the original operation deadline is unchanged.\"\n @type t :: %__MODULE__{\n error: LibTmux.Error.t(),\n operation: LibTmux.Operation.t(),\n context: :retained | :lost\n }\n\n @impl true\n def message(exception),\n do: \"managed execution #{exception.error.kind}; operation context #{exception.context}\"\nend\n" }, "lib/libtmux/control/request.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "f56b3c4b8bfeca97b1d39f37c5fe67fec8043f202c7cd87043482a479502dd10", - "content": "defmodule LibTmux.Control.Request do\n @moduledoc \"\"\"\n Data for the qualified control lane's supported commands.\n\n Field reads encode one named variable losslessly. Server user options accept\n literal binary values. Constructing a request performs no I/O; submit it with\n `LibTmux.Control.submit/3`. Arbitrary commands, formats and raw control lines\n require separate qualification and are not accepted by this lane.\n \"\"\"\n alias LibTmux.{Codec, Command, Error, Format, Ref}\n\n @enforce_keys [:kind, :value]\n defstruct [:kind, :value, :target]\n\n @typedoc \"Command data for the qualified lane; construction does not validate admission or perform I/O.\"\n @opaque t :: %__MODULE__{}\n\n @doc \"\"\"\n Reads a named format variable, optionally from an exact instance-bound target.\n\n Existing empty fields succeed. A target that disappears before the read\n produces an acknowledged failed operation and leaves the connection usable.\n A reference does not reserve the object's lifetime.\n \"\"\"\n @spec field(String.t(), Ref.t() | nil) :: t()\n def field(variable, target \\\\ nil),\n do: %__MODULE__{kind: :field, value: variable, target: target}\n\n @doc \"Sets a server user option with an `@name` and a literal binary value.\"\n @spec set_user_option(String.t(), binary()) :: t()\n def set_user_option(name, value),\n do: %__MODULE__{kind: :set_user_option, value: {name, value}}\n\n @doc false\n def prepare(%__MODULE__{} = request, instance) do\n with {:ok, line} <- encode(request, instance),\n {:ok, request} <- LibTmux.Control.OwnedTerm.copy(request, 20_000),\n do: {:ok, request, line}\n end\n\n # Rebuilt at both publication boundaries; a struct is not a lane certificate.\n @doc false\n def encode(%__MODULE__{} = request, instance) do\n with :ok <- target(request, instance) do\n command =\n case request do\n %{kind: :field, value: variable} ->\n args = if request.target, do: [\"-t\", request.target.id], else: []\n\n Command.new(\n \"display-message\",\n [\"-p\" | args] ++ [field_format(variable, request.target)]\n )\n\n %{kind: :set_user_option, value: {name, value}}\n when is_binary(name) and byte_size(name) in 2..64 and is_binary(value) and\n byte_size(value) <= 16_000 ->\n unless Regex.match?(~r/\\A@[a-zA-Z][a-zA-Z0-9_]*\\z/, name),\n do: raise(ArgumentError, \"invalid user option\")\n\n Command.new(\"set-option\", [\"-s\", name, value])\n\n _ ->\n raise ArgumentError, \"request is outside the qualified command lane\"\n end\n\n line = Command.render(command, max_bytes: 65_535) <> \"\\n\"\n {:ok, line}\n end\n rescue\n _error in [ArgumentError, FunctionClauseError] ->\n {:error, %Error{kind: :invalid_command, phase: :validation, certainty: :no_write}}\n end\n\n @doc \"Checks a qualified request's reply shape; a tmux error reply remains a command outcome.\"\n @spec verify_reply(t(), :ok | :error, [binary()]) :: :ok | {:error, Error.t()}\n def verify_reply(request, status, lines) do\n with {:ok, _status, _lines} <- normalize_reply(request, status, lines), do: :ok\n end\n\n @doc false\n @spec normalize_reply(t(), :ok | :error, [binary()]) ::\n {:ok, :ok | :error, [binary()]} | {:error, Error.t()}\n def normalize_reply(_request, :error, lines), do: {:ok, :error, lines}\n\n def normalize_reply(%{kind: :field, target: %Ref{} = target}, :ok, [<<\"t1:\", rest::binary>>]) do\n case :binary.split(rest, \":\") do\n [resolved, field] ->\n with :ok <- validate_field(field) do\n cond do\n resolved == target.id -> {:ok, :ok, [field]}\n resolved == \"\" -> {:ok, :error, [\"can't find #{target.entity}: #{target.id}\"]}\n true -> invalid_reply()\n end\n end\n\n _ ->\n invalid_reply()\n end\n end\n\n def normalize_reply(%{kind: :field, target: nil}, :ok, [field]) do\n with :ok <- validate_field(field), do: {:ok, :ok, [field]}\n end\n\n def normalize_reply(%{kind: :set_user_option}, :ok, []), do: {:ok, :ok, []}\n def normalize_reply(_request, _status, _lines), do: invalid_reply()\n\n defp invalid_reply,\n do: {:error, %Error{kind: :invalid_reply, phase: :parse, certainty: :unknown}}\n\n defp validate_field(field) do\n case Codec.decode_field(field <> \"\\n\", :bytes, encoding: :escaped_v1) do\n {:ok, _value} -> :ok\n error -> error\n end\n end\n\n defp field_format(variable, nil), do: Format.field(variable)\n\n # display-message permits an unresolved target; qualify identity and value together.\n defp field_format(variable, %Ref{entity: entity}) do\n identity =\n case entity do\n :session -> \"session_id\"\n :window -> \"window_id\"\n :pane -> \"pane_id\"\n end\n\n \"t1:\" <> ~S\"#{\" <> identity <> \"}:\" <> Format.field(variable)\n end\n\n defp target(%{kind: :field, target: nil}, _instance), do: :ok\n defp target(%{kind: :set_user_option, target: nil}, _instance), do: :ok\n\n defp target(%{kind: :field, target: %Ref{entity: entity} = ref}, instance)\n when entity in [:session, :window, :pane], do: Ref.validate(ref, instance)\n\n defp target(_request, _instance),\n do: {:error, %Error{kind: :invalid_target, certainty: :no_write}}\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "ae9bffefa62063a77f031099b4e3330b15443372eb2ca361865ca3eb5504ee1f", + "content": "defmodule LibTmux.Control.Request do\n @moduledoc \"\"\"\n Data for the qualified control lane's supported commands.\n\n Field reads encode one named variable losslessly. Server user options accept\n literal binary values. Domain actions use the same lane for split, rename\n and literal/named input. Constructing a request performs no I/O; use\n `LibTmux.Control.execute/3` or retain a handle with `LibTmux.Control.submit/3`.\n The host must qualify hooks, aliases and mode-dependent input bindings along\n with other stream writers. Arbitrary commands, formats and raw control lines\n require separate qualification and are not accepted by this lane.\n \"\"\"\n alias LibTmux.{Codec, Command, Error, Format, Ref}\n\n @enforce_keys [:kind, :value]\n defstruct [:kind, :value, :target]\n\n @typedoc \"Command data for the qualified lane; construction does not validate admission or perform I/O.\"\n @opaque t :: %__MODULE__{}\n\n @doc \"\"\"\n Reads a named format variable, optionally from an exact instance-bound target.\n\n Existing empty fields succeed. A target that disappears before the read\n produces an acknowledged failed operation and leaves the connection usable.\n A reference does not reserve the object's lifetime.\n\n See the [worked example](managed-control.html).\n \"\"\"\n @spec field(String.t(), Ref.t() | nil) :: t()\n def field(variable, target \\\\ nil),\n do: %__MODULE__{kind: :field, value: variable, target: target}\n\n @doc \"\"\"\n Sets a server user option with an `@name` and a literal binary value.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec set_user_option(String.t(), binary()) :: t()\n def set_user_option(name, value),\n do: %__MODULE__{kind: :set_user_option, value: {name, value}}\n\n @doc false\n def action(kind, target, value, options),\n do: %__MODULE__{kind: :action, value: {kind, value, options}, target: target}\n\n @doc false\n def prepare(%__MODULE__{} = request, instance) do\n with {:ok, line} <- encode(request, instance),\n {:ok, request} <- LibTmux.Control.OwnedTerm.copy(request, 20_000),\n do: {:ok, request, line}\n end\n\n # Rebuilt at both publication boundaries; a struct is not a lane certificate.\n @doc false\n def encode(%__MODULE__{kind: :action, value: {kind, value, options}, target: target}, instance) do\n with {:ok, command} <-\n LibTmux.Action.command(kind, target, value, options, instance, :control) do\n render_action(command)\n end\n end\n\n def encode(%__MODULE__{} = request, instance) do\n with :ok <- target(request, instance) do\n command =\n case request do\n %{kind: :field, value: variable} ->\n args = if request.target, do: [\"-t\", request.target.id], else: []\n\n Command.new(\n \"display-message\",\n [\"-p\" | args] ++ [field_format(variable, request.target)]\n )\n\n %{kind: :set_user_option, value: {name, value}}\n when is_binary(name) and byte_size(name) in 2..64 and is_binary(value) and\n byte_size(value) <= 16_000 ->\n unless Regex.match?(~r/\\A@[a-zA-Z][a-zA-Z0-9_]*\\z/, name),\n do: raise(ArgumentError, \"invalid user option\")\n\n Command.new(\"set-option\", [\"-s\", name, value])\n\n _ ->\n raise ArgumentError, \"request is outside the qualified command lane\"\n end\n\n line = Command.render(command, max_bytes: 65_535) <> \"\\n\"\n {:ok, line}\n end\n rescue\n _error in [ArgumentError, FunctionClauseError] ->\n {:error, %Error{kind: :invalid_command, phase: :validation, certainty: :no_write}}\n end\n\n @doc \"\"\"\n Checks a qualified request's reply shape; a tmux error reply remains a command outcome.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec verify_reply(t(), :ok | :error, [binary()]) :: :ok | {:error, Error.t()}\n def verify_reply(request, status, lines) do\n with {:ok, _status, _lines} <- normalize_reply(request, status, lines), do: :ok\n end\n\n @doc false\n @spec normalize_reply(t(), :ok | :error, [binary()]) ::\n {:ok, :ok | :error, [binary()]} | {:error, Error.t()}\n def normalize_reply(_request, :error, lines), do: {:ok, :error, lines}\n\n def normalize_reply(%{kind: :action, value: {:split, _, _}}, :ok, [id]) do\n case Ref.new(:pane, id, \"reply\") do\n {:ok, _ref} -> {:ok, :ok, [id]}\n _ -> invalid_reply()\n end\n end\n\n def normalize_reply(%{kind: :action, value: {kind, _, _}}, :ok, [])\n when kind in [:rename_session, :rename_window, :send_text, :send_keys],\n do: {:ok, :ok, []}\n\n def normalize_reply(%{kind: :field, target: %Ref{} = target}, :ok, [<<\"t1:\", rest::binary>>]) do\n case :binary.split(rest, \":\") do\n [resolved, field] ->\n with :ok <- validate_field(field) do\n cond do\n resolved == target.id -> {:ok, :ok, [field]}\n resolved == \"\" -> {:ok, :error, [\"can't find #{target.entity}: #{target.id}\"]}\n true -> invalid_reply()\n end\n end\n\n _ ->\n invalid_reply()\n end\n end\n\n def normalize_reply(%{kind: :field, target: nil}, :ok, [field]) do\n with :ok <- validate_field(field), do: {:ok, :ok, [field]}\n end\n\n def normalize_reply(%{kind: :set_user_option}, :ok, []), do: {:ok, :ok, []}\n def normalize_reply(_request, _status, _lines), do: invalid_reply()\n\n defp invalid_reply,\n do: {:error, %Error{kind: :invalid_reply, phase: :parse, certainty: :unknown}}\n\n defp render_action(command) do\n {:ok, Command.render(command, max_bytes: 65_535) <> \"\\n\"}\n rescue\n error in ArgumentError ->\n {:error,\n %Error{\n kind: :invalid_command,\n phase: :validation,\n certainty: :no_write,\n path: [:command],\n details: %{reason: Exception.message(error)}\n }}\n end\n\n defp validate_field(field) do\n case Codec.decode_field(field <> \"\\n\", :bytes, encoding: :escaped_v1) do\n {:ok, _value} -> :ok\n error -> error\n end\n end\n\n defp field_format(variable, nil), do: Format.field(variable)\n\n # display-message permits an unresolved target; qualify identity and value together.\n defp field_format(variable, %Ref{entity: entity}) do\n identity =\n case entity do\n :session -> \"session_id\"\n :window -> \"window_id\"\n :pane -> \"pane_id\"\n end\n\n \"t1:\" <> ~S\"#{\" <> identity <> \"}:\" <> Format.field(variable)\n end\n\n defp target(%{kind: :field, target: nil}, _instance), do: :ok\n defp target(%{kind: :set_user_option, target: nil}, _instance), do: :ok\n\n defp target(%{kind: :field, target: %Ref{entity: entity} = ref}, instance)\n when entity in [:session, :window, :pane], do: Ref.validate(ref, instance)\n\n defp target(_request, _instance),\n do: {:error, %Error{kind: :invalid_target, certainty: :no_write}}\nend\n" + }, + "lib/libtmux/control/scope_failure.ex": { + "repo": "libtmux/libtmux-elixir", + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "ba106a6c62d69d6bee9048175f498add3565696e14d4ad93021abfb55fe4db9d", + "content": "defmodule LibTmux.Control.ScopeFailure do\n @moduledoc \"\"\"\n A scoped callback finished, but connection cleanup was not proved.\n\n `primary` preserves either `{:return, value}` or\n `{:raise, kind, reason, stacktrace}`. `cleanup` holds the separate structured\n cleanup error. Callback values stay in the calling process; this wrapper\n does not copy them through a bounded connection mailbox or discard them.\n See `LibTmux.Control.with_connection/2` for the complete return contract.\n \"\"\"\n defexception [:primary, :cleanup]\n\n @typedoc \"The callback's original value or caught exception, throw or exit with its stacktrace.\"\n @type primary(value) :: {:return, value} | {:raise, :error | :throw | :exit, term(), list()}\n @typedoc \"Both primary callback evidence and unproved cleanup; neither implies no command effects.\"\n @type t(value) :: %__MODULE__{primary: primary(value), cleanup: LibTmux.Error.t()}\n\n @impl true\n def message(exception), do: \"scoped connection cleanup failed: #{exception.cleanup.kind}\"\nend\n" }, "lib/libtmux/deadline.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "3f678dea1b67e8fd5e0e7383f2246fe7953e6b7e8cc9651244b9e6d3401c6f1c", - "content": "defmodule LibTmux.Deadline do\n @moduledoc \"\"\"\n A node-local monotonic deadline shared by every stage of an operation.\n\n Construct it once at admission. Passing it between stages preserves the\n original budget; it is not a portable timestamp or a wire value.\n \"\"\"\n\n @enforce_keys [:expires_at]\n defstruct [:expires_at]\n\n @typedoc \"A node-local monotonic millisecond cutoff. Share it between stages; never serialize it as a portable deadline.\"\n @opaque t :: %__MODULE__{expires_at: integer()}\n @typedoc \"An optional node-local monotonic clock sample in milliseconds, used instead of sampling the current clock.\"\n @type option :: {:now, integer()}\n\n @doc \"Creates a deadline from a positive millisecond budget.\"\n @spec new(pos_integer(), [option()]) :: t()\n def new(milliseconds, options \\\\ [])\n\n def new(milliseconds, options) when is_integer(milliseconds) and milliseconds > 0 do\n %__MODULE__{expires_at: now(options) + milliseconds}\n end\n\n def new(_milliseconds, _options) do\n raise ArgumentError, \"timeout must be a positive integer in milliseconds\"\n end\n\n @doc \"Returns the remaining milliseconds, clamped to zero after expiry.\"\n @spec remaining(t(), [option()]) :: non_neg_integer()\n def remaining(%__MODULE__{expires_at: expires_at}, options \\\\ []) do\n max(expires_at - now(options), 0)\n end\n\n defp now(options) do\n Keyword.get_lazy(options, :now, fn -> System.monotonic_time(:millisecond) end)\n end\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "4163ca272f1e59d087585c154fa9d6e6c0230f2a793b543144d452cf2b2d0263", + "content": "defmodule LibTmux.Deadline do\n @moduledoc \"\"\"\n A node-local monotonic deadline shared by every stage of an operation.\n\n Construct it once at admission. Passing it between stages preserves the\n original budget; it is not a portable timestamp or a wire value.\n \"\"\"\n\n @enforce_keys [:expires_at]\n defstruct [:expires_at]\n\n @typedoc \"A node-local monotonic millisecond cutoff. Share it between stages; never serialize it as a portable deadline.\"\n @opaque t :: %__MODULE__{expires_at: integer()}\n @typedoc \"An optional node-local monotonic clock sample in milliseconds, used instead of sampling the current clock.\"\n @type option :: {:now, integer()}\n\n @doc \"\"\"\n Creates a deadline from a positive millisecond budget.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec new(pos_integer(), [option()]) :: t()\n def new(milliseconds, options \\\\ [])\n\n def new(milliseconds, options) when is_integer(milliseconds) and milliseconds > 0 do\n %__MODULE__{expires_at: now(options) + milliseconds}\n end\n\n def new(_milliseconds, _options) do\n raise ArgumentError, \"timeout must be a positive integer in milliseconds\"\n end\n\n @doc \"\"\"\n Returns the remaining milliseconds, clamped to zero after expiry.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec remaining(t(), [option()]) :: non_neg_integer()\n def remaining(%__MODULE__{expires_at: expires_at}, options \\\\ []) do\n max(expires_at - now(options), 0)\n end\n\n defp now(options) do\n Keyword.get_lazy(options, :now, fn -> System.monotonic_time(:millisecond) end)\n end\nend\n" }, "lib/libtmux/entities.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "b7f564bca6684ddb7169f2c8e4968c86112249dc0e7c69d9773a5361e8421bf4", - "content": "defmodule LibTmux.Session do\n @moduledoc \"An immutable session observation. Attachment retains tmux's client count.\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n name: :unloaded,\n attached_count: :unloaded,\n attached: :unloaded\n ]\n\n @typedoc \"A session with explicit field coverage and an attachment count separate from its Boolean projection.\"\n @type t :: %__MODULE__{\n id: String.t(),\n server_instance: String.t(),\n name: LibTmux.Schema.observed(String.t()),\n attached_count: LibTmux.Schema.observed(non_neg_integer()),\n attached: LibTmux.Schema.observed(boolean())\n }\nend\n\ndefmodule LibTmux.Window do\n @moduledoc \"An immutable physical window, independent of session membership and index.\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n name: :unloaded,\n width: :unloaded,\n height: :unloaded,\n layout: :unloaded,\n zoomed: :unloaded\n ]\n\n @typedoc \"A physical window; session index and active-window state belong to a WindowLink.\"\n @type t :: %__MODULE__{\n id: String.t(),\n server_instance: String.t(),\n name: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n height: LibTmux.Schema.observed(non_neg_integer()),\n layout: LibTmux.Schema.observed(String.t()),\n zoomed: LibTmux.Schema.observed(boolean())\n }\nend\n\ndefmodule LibTmux.WindowLink do\n @moduledoc \"An observed session/index/window binding. Its key is not a link lifetime ID.\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n session_id: :unloaded,\n window_id: :unloaded,\n index: :unloaded,\n active: :unloaded\n ]\n\n @typedoc \"A captured session/index/window binding, including its session-relative active state.\"\n @type t :: %__MODULE__{\n id: {String.t(), non_neg_integer(), String.t()},\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n window_id: LibTmux.Schema.observed(String.t()),\n index: LibTmux.Schema.observed(non_neg_integer()),\n active: LibTmux.Schema.observed(boolean())\n }\nend\n\ndefmodule LibTmux.Pane do\n @moduledoc \"An immutable physical pane. It belongs to a window; text may be empty.\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n window_id: :unloaded,\n index: :unloaded,\n active: :unloaded,\n dead: :unloaded,\n width: :unloaded,\n height: :unloaded,\n pid: :unloaded,\n current_command: :unloaded,\n current_path: :unloaded,\n title: :unloaded,\n exit_status: :unloaded\n ]\n\n @typedoc \"A physical pane; exit status can be known absent, while other missing fields retain coverage sentinels.\"\n @type t :: %__MODULE__{\n id: String.t(),\n server_instance: String.t(),\n window_id: LibTmux.Schema.observed(String.t()),\n index: LibTmux.Schema.observed(non_neg_integer()),\n active: LibTmux.Schema.observed(boolean()),\n dead: LibTmux.Schema.observed(boolean()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n height: LibTmux.Schema.observed(non_neg_integer()),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n current_command: LibTmux.Schema.observed(String.t()),\n current_path: LibTmux.Schema.observed(String.t()),\n title: LibTmux.Schema.observed(String.t()),\n exit_status: LibTmux.Schema.observed(non_neg_integer() | nil)\n }\nend\n\ndefmodule LibTmux.Client do\n @moduledoc \"An immutable attached-client observation, keyed by validated client name.\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n session_id: :unloaded,\n pid: :unloaded,\n width: :unloaded,\n height: :unloaded,\n control_mode: :unloaded\n ]\n\n @typedoc \"An attached client; a known absent height is distinct from unloaded or unavailable coverage.\"\n @type t :: %__MODULE__{\n id: String.t(),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n height: LibTmux.Schema.observed(non_neg_integer() | nil),\n control_mode: LibTmux.Schema.observed(boolean())\n }\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "654386c61cc26c79d76c2b61a4bc7760981ce8fc766b31d4e1d1fe8d32939a2b", + "content": "defmodule LibTmux.Session do\n @moduledoc \"\"\"\n An immutable session observation with explicit actions. Attachment retains tmux's client count.\n\n ## What is on here\n\n A Session is a value captured in a `LibTmux.Snapshot`. Relationship functions\n read the snapshot you pass; actions take a `LibTmux.Ref` and a Server or\n Control connection. Start with these groups:\n\n **Finding the session.** Select sessions from a captured snapshot, or look one\n up by its exact ID. Neither contacts tmux. An ID that was not captured returns\n `{:error, error}` with kind `:not_found`. Turn the session into a reference\n tied to the server incarnation that supplied it, ready for an action.\n\n - Select: `LibTmux.Snapshot.sessions/1`\n - By ID: `LibTmux.Snapshot.fetch/3`\n - Reference: `LibTmux.Ref.from_observation/1`\n\n **Looking inside a session.** Read windows, panes and the active window from the\n snapshot, without I/O. A window linked more than once appears once, and a\n covered empty relation returns an empty selection. An invalid or stale\n identity, or a relationship the snapshot did not capture, raises\n `LibTmux.Error`. For per-session window indexes use `LibTmux.Snapshot.related/4`\n with `:window_links`.\n\n - Windows: `windows/2`\n - Panes: `panes/2`\n - Focused: `active_window/2`\n\n **Creating a window.** Create a named detached window in the session through\n one-shot execution. The completed value holds the new ID with `ref: nil`;\n capture a fresh observation to obtain a reference. A Control connection is\n unsupported, and a missing server is not started.\n\n - Create: `new_window/4`\n - Raise on failure: `new_window!/4`\n\n **Renaming.** Rename the session through a Server or a Control connection.\n A name holds 1..1024 UTF-8 bytes with no control characters, and tmux still\n normalizes it. Observations you already hold keep the old name.\n\n - Rename: `rename/4`\n - Raise on failure: `rename!/4`\n\n **Killing.** Kill the session and the windows and panes only it holds,\n through a Server. A Control connection returns `unsupported_transport`.\n Killing the last session ends a server that exits when empty.\n\n - Kill: `kill/3`\n - Raise on failure: `kill!/3`\n \"\"\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n name: :unloaded,\n attached_count: :unloaded,\n attached: :unloaded\n ]\n\n @typedoc \"A session with explicit field coverage and an attachment count separate from its Boolean projection.\"\n @type t :: %__MODULE__{\n id: String.t(),\n server_instance: String.t(),\n name: LibTmux.Schema.observed(String.t()),\n attached_count: LibTmux.Schema.observed(non_neg_integer()),\n attached: LibTmux.Schema.observed(boolean())\n }\n\n @doc \"\"\"\n Returns a selection of captured physical windows in first-link order.\n\n Repeated links to a window contribute it once. For membership indexes use\n `LibTmux.Snapshot.related/4` with `:window_links`.\n\n The supplied snapshot owns all returned fields and relationships. Only the\n session's ID and incarnation are used; its other fields may be older.\n Invalid or stale identities and missing source/relationship coverage raise\n `LibTmux.Error`. A covered empty relation returns an empty selection.\n No I/O occurs. The selection retains the supplied snapshot for filtering;\n relationship predicates still validate their whole captured source domain.\n Use `Enum.to_list/1` when only the list is needed.\n\n ## Examples\n\n iex> alias LibTmux.{Selection, Session, Snapshot}\n iex> rows = %{session: [%{id: \"$0\"}], window: [%{id: \"@7\"}],\n ...> window_link: [%{session_id: \"$0\", window_id: \"@7\", index: 0, active: true},\n ...> %{session_id: \"$0\", window_id: \"@7\", index: 3, active: false}],\n ...> pane: [%{id: \"%9\", window_id: \"@7\"}]}\n iex> {:ok, snapshot} = Snapshot.new(rows,\n ...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n ...> complete: [:window_link, :pane],\n ...> fields: %{window_link: [:session_id, :window_id, :active], pane: [:window_id]})\n iex> {:ok, session} = Snapshot.fetch(snapshot, :session, \"$0\")\n iex> {:ok, window} = Session.windows(snapshot, session) |> Selection.one()\n iex> window.id\n \"@7\"\n iex> Session.panes(snapshot, session) |> Enum.map(& &1.id)\n [\"%9\"]\n iex> Session.active_window(snapshot, session) == window\n true\n \"\"\"\n @spec windows(LibTmux.Snapshot.t(), t()) :: LibTmux.Selection.t(LibTmux.Window.t())\n def windows(snapshot, session),\n do: LibTmux.Snapshot.related_observation(snapshot, :session, session, :windows)\n\n @doc \"\"\"\n Returns a selection of captured physical panes in numeric pane-ID order.\n\n Linked windows contribute their panes once. Identity, coverage, empty-selection\n and no-I/O behavior follow `windows/2`, which includes a worked example.\n \"\"\"\n @spec panes(LibTmux.Snapshot.t(), t()) :: LibTmux.Selection.t(LibTmux.Pane.t())\n def panes(snapshot, session),\n do: LibTmux.Snapshot.related_observation(snapshot, :session, session, :panes)\n\n @doc \"\"\"\n Returns the captured active physical window, or `nil` when none is active.\n\n Multiple active links raise `LibTmux.Error`, even when they name the same\n window. Unrelated sessions do not affect this lookup. Identity, coverage\n and no-I/O behavior follow `windows/2`, which includes a worked example.\n \"\"\"\n @spec active_window(LibTmux.Snapshot.t(), t()) :: LibTmux.Window.t() | nil\n def active_window(snapshot, session),\n do: LibTmux.Snapshot.related_observation(snapshot, :session, session, :active_window)\n\n @doc \"\"\"\n Creates a named detached window in an exact session through one-shot execution.\n\n Returns `{:ok, result}` on completion, with `%{id: window_id, ref: nil}`\n as its value. Capture a fresh observation for a bound reference. The session\n reference is checked against the answering server before dispatch, with\n the usual one-shot check/use race. Missing servers are not started.\n Control connections are unsupported. tmux permits duplicate window names.\n\n Names, `timeout`, `cwd` and explicit `command` forms follow\n `LibTmux.Server.new_session/3`. The new window uses tmux's next available\n index in this session. Existing observations remain unchanged.\n\n alias LibTmux.Session\n\n Session.new_window(server, session_ref, \"logs\", command: {:argv, [\"/bin/cat\"]})\n \"\"\"\n @spec new_window(LibTmux.Server.t(), LibTmux.Ref.t(), binary(), [\n LibTmux.Action.creation_option()\n ]) ::\n {:ok, LibTmux.Action.result(LibTmux.Action.creation_value())}\n | {:error, LibTmux.Action.error()}\n def new_window(server, ref, name, options \\\\ []),\n do: LibTmux.Action.run(:new_window, server, ref, name, options)\n\n @doc \"Returns the created window value when `new_window/4` completes; raises the original error otherwise.\"\n @spec new_window!(LibTmux.Server.t(), LibTmux.Ref.t(), binary(), [\n LibTmux.Action.creation_option()\n ]) ::\n LibTmux.Action.creation_value()\n def new_window!(server, ref, name, options \\\\ []),\n do: server |> new_window(ref, name, options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Renames an exact session; returns `{:ok, result}` on command completion.\n\n Names contain 1..1024 UTF-8 bytes without Unicode control characters (Cc).\n Format syntax remains literal;\n tmux still normalizes names (including dollar/backslash escaping, and dots\n and colons on older releases). The only option is `timeout`, which defaults\n to 5000ms.\n Old observations stay unchanged. See `LibTmux.Action` for outcome semantics.\n\n alias LibTmux.Session\n\n Session.rename(server, session_ref, \"work\")\n \"\"\"\n @spec rename(LibTmux.Action.connection(), LibTmux.Ref.t(), binary(), [\n LibTmux.Control.call_option()\n ]) ::\n {:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}\n def rename(connection, ref, name, options \\\\ []),\n do: LibTmux.Action.run(:rename_session, connection, ref, name, options)\n\n @doc \"Returns `:ok` when `rename/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec rename!(LibTmux.Action.connection(), LibTmux.Ref.t(), binary(), [\n LibTmux.Control.call_option()\n ]) :: :ok\n def rename!(connection, ref, name, options \\\\ []),\n do: connection |> rename(ref, name, options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Kills an exact session through one-shot execution.\n\n Returns `{:ok, result}` on command completion. The only option is `timeout`, 5000ms by default. The reference is\n checked against the answering server before dispatch, with the usual one-shot\n check/use race. A reference to something that is already gone returns\n `{:error, %LibTmux.Action.CompletionError{}}` with the original evidence.\n Control connections return `unsupported_transport` before any I/O: a\n connection cannot kill what it is attached to. Observations you already hold\n keep describing the session.\n\n alias LibTmux.Session\n\n Session.kill(server, session_ref)\n \"\"\"\n @spec kill(LibTmux.Server.t(), LibTmux.Ref.t(), [LibTmux.Action.option()]) ::\n {:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}\n def kill(connection, ref, options \\\\ []),\n do: LibTmux.Action.run(:kill_session, connection, ref, nil, options)\n\n @doc \"Returns `:ok` when `kill/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec kill!(LibTmux.Server.t(), LibTmux.Ref.t(), [LibTmux.Action.option()]) :: :ok\n def kill!(connection, ref, options \\\\ []),\n do: connection |> kill(ref, options) |> LibTmux.Action.unwrap()\nend\n\ndefmodule LibTmux.Window do\n @moduledoc \"\"\"\n An immutable physical window with explicit actions, independent of session membership and index.\n\n ## What is on here\n\n A Window is a physical window captured in a `LibTmux.Snapshot`. Its session\n index and active state belong to a `LibTmux.WindowLink`, so one Window can\n belong to several sessions. Start with these groups:\n\n **Finding the window.** Select windows from a captured snapshot, or look one\n up by its exact ID. Neither contacts tmux. An ID that was not captured returns\n `{:error, error}` with kind `:not_found`. Turn the window into a reference\n tied to the server incarnation that supplied it, ready for an action.\n\n - Select: `LibTmux.Snapshot.windows/1`\n - By ID: `LibTmux.Snapshot.fetch/3`\n - Reference: `LibTmux.Ref.from_observation/1`\n\n **Looking inside a window.** Read its panes from the snapshot, in numeric\n pane-ID order and without I/O. An invalid or stale identity, or a relationship\n the snapshot did not capture, raises `LibTmux.Error`. To find the sessions\n that hold the window, select its links.\n\n - Panes: `panes/2`\n - Links: `LibTmux.Snapshot.window_links/1`\n\n **Renaming.** Rename the window across all its memberships through a Server or\n a Control connection. A name holds 1..1024 UTF-8 bytes with no control\n characters, and tmux still normalizes it. The optional `session:` reference\n requires membership in that session; it does not pick a link index.\n\n - Rename: `rename/4`\n - Raise on failure: `rename!/4`\n\n **Killing.** Kill the window, with its panes, in every session that links it,\n through a Server. A Control connection returns `unsupported_transport`.\n\n - Kill: `kill/3`\n - Raise on failure: `kill!/3`\n \"\"\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n name: :unloaded,\n width: :unloaded,\n height: :unloaded,\n layout: :unloaded,\n zoomed: :unloaded\n ]\n\n @typedoc \"A physical window; session index and active-window state belong to a WindowLink.\"\n @type t :: %__MODULE__{\n id: String.t(),\n server_instance: String.t(),\n name: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n height: LibTmux.Schema.observed(non_neg_integer()),\n layout: LibTmux.Schema.observed(String.t()),\n zoomed: LibTmux.Schema.observed(boolean())\n }\n\n @doc \"\"\"\n Returns a selection of captured physical panes in numeric pane-ID order.\n\n Uses the supplied snapshot and validates the window's ID and incarnation.\n Identity, coverage, empty-selection and no-I/O behavior follow\n `LibTmux.Session.windows/2`.\n\n ## Examples\n\n iex> alias LibTmux.{Selection, Snapshot, Window}\n iex> rows = %{window: [%{id: \"@0\"}], pane: [\n ...> %{id: \"%10\", window_id: \"@0\"}, %{id: \"%2\", window_id: \"@0\"}]}\n iex> {:ok, snapshot} = Snapshot.new(rows,\n ...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n ...> complete: [:pane], fields: %{pane: [:id, :window_id]})\n iex> {:ok, window} = Snapshot.fetch(snapshot, :window, \"@0\")\n iex> Window.panes(snapshot, window) |> Enum.map(& &1.id)\n [\"%2\", \"%10\"]\n iex> {:ok, pane} = Window.panes(snapshot, window)\n ...> |> Selection.where(id: \"%2\") |> Selection.one()\n iex> pane.id\n \"%2\"\n \"\"\"\n @spec panes(LibTmux.Snapshot.t(), t()) :: LibTmux.Selection.t(LibTmux.Pane.t())\n def panes(snapshot, window),\n do: LibTmux.Snapshot.related_observation(snapshot, :window, window, :panes)\n\n @doc \"\"\"\n Renames an exact physical window across all its memberships.\n\n Returns `{:ok, result}` on command completion; unsuccessful outcomes return\n `{:error, %LibTmux.Action.CompletionError{}}` with their original evidence.\n\n Names contain 1..1024 UTF-8 bytes without Unicode control characters (Cc),\n with literal format syntax.\n tmux still applies name normalization, including dollar/backslash escaping.\n Control characters fail before I/O on both transports. Optional `session: session_ref` requires\n membership in that exact session; it does not select a captured link index.\n `timeout` defaults to 5000ms. See `LibTmux.Action` for transport and outcomes.\n\n alias LibTmux.Window\n\n Window.rename(control, window_ref, \"editor\")\n \"\"\"\n @spec rename(LibTmux.Action.connection(), LibTmux.Ref.t(), binary(), [LibTmux.Action.option()]) ::\n {:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}\n def rename(connection, ref, name, options \\\\ []),\n do: LibTmux.Action.run(:rename_window, connection, ref, name, options)\n\n @doc \"Returns `:ok` when `rename/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec rename!(LibTmux.Action.connection(), LibTmux.Ref.t(), binary(), [LibTmux.Action.option()]) ::\n :ok\n def rename!(connection, ref, name, options \\\\ []),\n do: connection |> rename(ref, name, options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Kills an exact window through one-shot execution.\n\n Returns `{:ok, result}` on command completion. Optional `session: session_ref` requires membership in that exact session and `timeout` defaults to 5000ms. Killing a window removes it from every session that links it. The reference is\n checked against the answering server before dispatch, with the usual one-shot\n check/use race. A reference to something that is already gone returns\n `{:error, %LibTmux.Action.CompletionError{}}` with the original evidence.\n Control connections return `unsupported_transport` before any I/O: a\n connection cannot kill what it is attached to. Observations you already hold\n keep describing the window.\n\n alias LibTmux.Window\n\n Window.kill(server, window_ref)\n \"\"\"\n @spec kill(LibTmux.Server.t(), LibTmux.Ref.t(), [LibTmux.Action.option()]) ::\n {:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}\n def kill(connection, ref, options \\\\ []),\n do: LibTmux.Action.run(:kill_window, connection, ref, nil, options)\n\n @doc \"Returns `:ok` when `kill/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec kill!(LibTmux.Server.t(), LibTmux.Ref.t(), [LibTmux.Action.option()]) :: :ok\n def kill!(connection, ref, options \\\\ []),\n do: connection |> kill(ref, options) |> LibTmux.Action.unwrap()\nend\n\ndefmodule LibTmux.WindowLink do\n @moduledoc \"An observed session/index/window binding. Its key is not a link lifetime ID.\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n session_id: :unloaded,\n window_id: :unloaded,\n index: :unloaded,\n active: :unloaded\n ]\n\n @typedoc \"A captured session/index/window binding, including its session-relative active state.\"\n @type t :: %__MODULE__{\n id: {String.t(), non_neg_integer(), String.t()},\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n window_id: LibTmux.Schema.observed(String.t()),\n index: LibTmux.Schema.observed(non_neg_integer()),\n active: LibTmux.Schema.observed(boolean())\n }\nend\n\ndefmodule LibTmux.Pane do\n @moduledoc \"\"\"\n An immutable physical pane with explicit actions. It belongs to a window; text may be empty.\n\n ## What is on here\n\n A Pane is a value captured in a `LibTmux.Snapshot`. Actions take a\n `LibTmux.Ref` and a Server or Control connection. Start with these groups:\n\n **Finding the pane.** Select panes from a captured snapshot, or look one up by\n its exact ID. Neither contacts tmux. An ID that was not captured returns\n `{:error, error}` with kind `:not_found`. Turn the pane into a reference tied\n to the server incarnation that supplied it, ready for an action.\n\n - Select: `LibTmux.Snapshot.panes/1`\n - By ID: `LibTmux.Snapshot.fetch/3`\n - Reference: `LibTmux.Ref.from_observation/1`\n\n **Splitting.** Split the pane and get the new pane's ID in the completed value.\n A qualified Control connection also returns a bound reference; one-shot\n execution returns `ref: nil`. The defaults are a vertical, detached split at\n half size; options set the axis, size, directory and command.\n\n - Split: `split/3`\n - Raise on failure: `split!/3`\n\n **Sending input.** Send literal bytes, up to 995 of them, without interpreting\n key names, or send named keys such as `\"Enter\"` and `\"C-c\"`. An unknown key\n name is rejected. Acknowledgement does not prove the program consumed the\n input.\n\n - Literal bytes: `send_text/4`, `send_text!/4`\n - Named keys: `send_keys/4`, `send_keys!/4`\n\n **Reading the screen.** Capture the rendered screen through one-shot\n execution; a Control connection returns `unsupported_transport`. Output over\n the byte limit is an error, never a partial screen. This reads screen state,\n not the program's original output stream.\n\n - Capture: `capture/3`\n - Raise on failure: `capture!/3`\n\n **Killing.** Kill the pane through a Server. A Control connection returns\n `unsupported_transport`. Killing the last pane of a window removes the window.\n\n - Kill: `kill/3`\n - Raise on failure: `kill!/3`\n \"\"\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n window_id: :unloaded,\n index: :unloaded,\n active: :unloaded,\n dead: :unloaded,\n width: :unloaded,\n height: :unloaded,\n pid: :unloaded,\n current_command: :unloaded,\n current_path: :unloaded,\n title: :unloaded,\n exit_status: :unloaded\n ]\n\n @typedoc \"\"\"\n A physical pane; PID and exit status can be known absent, with separate coverage sentinels.\n\n `pid` is `nil` when tmux reports no PID. A reported PID or its absence does\n not establish process liveness or cleanup.\n \"\"\"\n @type t :: %__MODULE__{\n id: String.t(),\n server_instance: String.t(),\n window_id: LibTmux.Schema.observed(String.t()),\n index: LibTmux.Schema.observed(non_neg_integer()),\n active: LibTmux.Schema.observed(boolean()),\n dead: LibTmux.Schema.observed(boolean()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n height: LibTmux.Schema.observed(non_neg_integer()),\n pid: LibTmux.Schema.observed(non_neg_integer() | nil),\n current_command: LibTmux.Schema.observed(String.t()),\n current_path: LibTmux.Schema.observed(String.t()),\n title: LibTmux.Schema.observed(String.t()),\n exit_status: LibTmux.Schema.observed(non_neg_integer() | nil)\n }\n\n @typedoc \"A created pane ID; `ref` is bound for qualified control and `nil` for one-shot.\"\n @type split_value :: %{id: String.t(), ref: LibTmux.Ref.t() | nil}\n\n @typedoc \"Split geometry and process arguments.\"\n @type split_option ::\n LibTmux.Action.option()\n | {:axis, :horizontal | :vertical}\n | {:size, {:cells, 1..32_767} | {:percent, 1..99}}\n | {:before | :detached, boolean()}\n | {:cwd, binary()}\n | {:command,\n :default\n | :empty\n | {:shell, binary()}\n | {:argv, nonempty_list(binary())}}\n @typedoc \"Bounded one-shot screen capture; line numbers are relative to the visible screen, with negative history offsets.\"\n @type capture_option ::\n LibTmux.Action.option()\n | {:start_line, -32_768..32_767}\n | {:end_line, -32_768..32_767 | :last}\n | {:join_lines, boolean()}\n | {:max_bytes, 0..1_048_576}\n\n @doc \"\"\"\n Splits an exact pane and returns its ID and optional bound reference as `value`.\n\n A completed value contains `id` and `ref`. Qualified control binds the reference.\n Use it for another action without recapturing. It identifies the pane in\n that server incarnation, contains no fresh fields and does not reserve its\n lifetime. Closing the connection does not invalidate the reference while\n the pane and server remain. One-shot execution does not establish this\n binding and returns `ref: nil`. Unsuccessful outcomes return\n `{:error, %LibTmux.Action.CompletionError{}}` with the original result.\n\n Defaults: vertical split, half size, detached, after the target, and tmux's\n session default shell/command and directory. `axis: :horizontal` places panes\n side by side; `size: {:percent, n}` uses `-l n%` on every supported release.\n Optional `cwd` is literal format text. Choose `command: :default`, `:empty`,\n `{:shell, nonempty_bytes}` or `{:argv, [program | arguments]}`. Shell text\n uses the session's configured shell; argv uses `execvp` semantics, including\n PATH lookup and executable-text fallback. Empty argv/program and empty\n explicit shell text are rejected. At most 64 argv entries and the existing\n command byte bounds apply; bytes must be NUL-free.\n\n Singleton argv uses the packaged helper to preserve exactly one argument.\n It replaces itself with the pane program. tmux retains the helper path in\n `pane_start_command`; commandless respawn requires that installation to\n remain available. See [command forms](one-shot-actions.html#command-forms).\n Split acknowledgement does not prove program startup or completion.\n\n `session: session_ref` selects exact membership/context, not a WindowLink\n index. `timeout` defaults to 5000ms. No snapshot is changed; capture again\n when a new observation is needed. See `LibTmux.Action` for outcomes and the\n one-shot identity check/use limitation.\n\n alias LibTmux.Pane\n\n {:ok, %{value: %{ref: created}}} =\n Pane.split(control, pane_ref, axis: :horizontal, size: {:percent, 30})\n Pane.send_text(control, created, \"hello\")\n \"\"\"\n @spec split(LibTmux.Action.connection(), LibTmux.Ref.t(), [split_option()]) ::\n {:ok, LibTmux.Action.result(split_value())} | {:error, LibTmux.Action.error()}\n def split(connection, ref, options \\\\ []),\n do: LibTmux.Action.run(:split, connection, ref, nil, options)\n\n @doc \"Returns the created pane value when `split/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec split!(LibTmux.Action.connection(), LibTmux.Ref.t(), [split_option()]) ::\n split_value()\n def split!(connection, ref, options \\\\ []),\n do: connection |> split(ref, options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Sends 0..995 literal bytes to an exact pane, without interpreting key names.\n\n Hex-key encoding preserves NUL and invalid UTF-8. Empty input sends nothing.\n Both transports use the same limit, fitting tmux 3.8's command argument\n ceiling. Larger inputs fail validation before I/O; calls are never split.\n The terminal's line discipline, active mode and application still determine\n how input is handled; acknowledgement does not prove program consumption.\n Options and outcomes follow `LibTmux.Action`. For named keys use `send_keys/4`.\n\n alias LibTmux.Pane\n\n Pane.send_text(control, pane_ref, \"printf 'hello'\")\n \"\"\"\n @spec send_text(LibTmux.Action.connection(), LibTmux.Ref.t(), binary(), [\n LibTmux.Action.option()\n ]) ::\n {:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}\n def send_text(connection, ref, bytes, options \\\\ []),\n do: LibTmux.Action.run(:send_text, connection, ref, bytes, options)\n\n @doc \"Returns `:ok` when `send_text/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec send_text!(LibTmux.Action.connection(), LibTmux.Ref.t(), binary(), [\n LibTmux.Action.option()\n ]) :: :ok\n def send_text!(connection, ref, bytes, options \\\\ []),\n do: connection |> send_text(ref, bytes, options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Sends 1..128 named keys to an exact pane; unknown names are rejected.\n\n Supports Enter, Space, Tab, BTab, BSpace, Escape, arrows, Home, End, PageUp,\n PageDown, Insert, Delete and F1..F12. Distinct C-, M- and S- modifiers may\n prefix arrows, Home/End, PageUp/PageDown, Insert/Delete and F1..F12. Also\n accepts C-a..C-z, conventional ASCII control punctuation, and M- plus one\n printable ASCII character. Unsupported combinations such as S-a and C-Enter\n fail before admission; tmux could otherwise type their spelling as text.\n Options and outcomes follow `LibTmux.Action`.\n\n alias LibTmux.Pane\n\n Pane.send_keys(control, pane_ref, [\"Enter\", \"C-c\"])\n \"\"\"\n @spec send_keys(LibTmux.Action.connection(), LibTmux.Ref.t(), [String.t()], [\n LibTmux.Action.option()\n ]) ::\n {:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}\n def send_keys(connection, ref, keys, options \\\\ []),\n do: LibTmux.Action.run(:send_keys, connection, ref, keys, options)\n\n @doc \"Returns `:ok` when `send_keys/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec send_keys!(LibTmux.Action.connection(), LibTmux.Ref.t(), [String.t()], [\n LibTmux.Action.option()\n ]) :: :ok\n def send_keys!(connection, ref, keys, options \\\\ []),\n do: connection |> send_keys(ref, keys, options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Captures bounded screen bytes through explicit one-shot execution.\n\n Returns `{:ok, result}` with bytes as `value` after acknowledged completion\n and native retirement. Failed commands return\n `{:error, %LibTmux.Action.CompletionError{}}` with their original evidence.\n Defaults: visible lines 0 through `:last`, no line joining, 65536 stdout\n bytes, 65536 stderr bytes and 5000ms. `:last` is accepted only for `end_line`.\n Negative line numbers include history;\n tmux clamps the requested range to available lines. Output overflow is an\n error, never a successful partial screen. This observes rendered screen\n state, not the program's original output stream.\n\n A Control argument returns `unsupported_transport`: arbitrary screen bytes\n are not qualified for shared control framing. No fallback occurs.\n\n alias LibTmux.Pane\n\n Pane.capture(server, pane_ref, start_line: -100, max_bytes: 131_072)\n \"\"\"\n @spec capture(LibTmux.Action.connection(), LibTmux.Ref.t(), [capture_option()]) ::\n {:ok, LibTmux.Action.result(binary())}\n | {:error, LibTmux.Error.t() | LibTmux.Action.CompletionError.t()}\n def capture(connection, ref, options \\\\ []),\n do: LibTmux.Action.run(:capture, connection, ref, nil, options)\n\n @doc \"Returns screen bytes when `capture/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec capture!(LibTmux.Action.connection(), LibTmux.Ref.t(), [capture_option()]) ::\n binary()\n def capture!(connection, ref, options \\\\ []),\n do: connection |> capture(ref, options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Kills an exact pane through one-shot execution.\n\n Returns `{:ok, result}` on command completion. Optional `session: session_ref` requires the pane's window to belong to that exact session and `timeout` defaults to 5000ms. The reference is\n checked against the answering server before dispatch, with the usual one-shot\n check/use race. A reference to something that is already gone returns\n `{:error, %LibTmux.Action.CompletionError{}}` with the original evidence.\n Control connections return `unsupported_transport` before any I/O: a\n connection cannot kill what it is attached to. Observations you already hold\n keep describing the pane.\n\n alias LibTmux.Pane\n\n Pane.kill(server, pane_ref)\n \"\"\"\n @spec kill(LibTmux.Server.t(), LibTmux.Ref.t(), [LibTmux.Action.option()]) ::\n {:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}\n def kill(connection, ref, options \\\\ []),\n do: LibTmux.Action.run(:kill_pane, connection, ref, nil, options)\n\n @doc \"Returns `:ok` when `kill/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec kill!(LibTmux.Server.t(), LibTmux.Ref.t(), [LibTmux.Action.option()]) :: :ok\n def kill!(connection, ref, options \\\\ []),\n do: connection |> kill(ref, options) |> LibTmux.Action.unwrap()\nend\n\ndefmodule LibTmux.Client do\n @moduledoc \"An immutable attached-client observation, keyed by validated client name.\"\n @enforce_keys [:id, :server_instance]\n defstruct [\n :id,\n :server_instance,\n session_id: :unloaded,\n pid: :unloaded,\n width: :unloaded,\n height: :unloaded,\n control_mode: :unloaded\n ]\n\n @typedoc \"An attached client; a known absent height is distinct from unloaded or unavailable coverage.\"\n @type t :: %__MODULE__{\n id: String.t(),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n height: LibTmux.Schema.observed(non_neg_integer() | nil),\n control_mode: LibTmux.Schema.observed(boolean())\n }\nend\n" }, "lib/libtmux/error.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "f0bed995aaf15970457e29d4fc92d06fd415ead42c498a640ca47e1af7fbd487", - "content": "defmodule LibTmux.Error do\n @moduledoc \"\"\"\n An inspectable failure with its phase and certainty about effects.\n\n `retryable` describes a recovery option; it never authorizes replay of a\n mutation. Diagnostic details must stay within the producing operation's\n byte budget. Bang functions raise this same structure.\n \"\"\"\n\n defexception [\n :kind,\n phase: :validation,\n certainty: :unknown,\n retryable: false,\n path: [],\n details: %{}\n ]\n\n @typedoc \"Evidence about effects, independent of whether cleanup or arbitrary program completion is proved.\"\n @type certainty :: :no_write | :acknowledged | :observed | :unknown\n @typedoc \"A field, array index or observed identity locating an error; links retain their contextual tuple ID.\"\n @type path_component :: atom() | non_neg_integer() | LibTmux.Ref.id()\n @typedoc \"A structured API failure. Kind and phase are extensible; retryable never permits automatic mutation replay.\"\n @type t :: %__MODULE__{\n kind: atom(),\n phase: atom(),\n certainty: certainty(),\n retryable: boolean(),\n path: [path_component()],\n details: map()\n }\n\n @impl true\n def message(%__MODULE__{kind: kind, phase: phase, path: path}) do\n location = if path == [], do: \"\", else: \" at #{inspect(path)}\"\n \"#{kind} during #{phase}#{location}\"\n end\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "156f2ad4f4da0aafa8911b66d7daeee6bcf512b1e047ab057d8315eb3c80ddca", + "content": "defmodule LibTmux.Error do\n @moduledoc \"\"\"\n An inspectable failure with its phase and certainty about effects.\n\n `retryable` describes a recovery option; it never authorizes replay of a\n mutation. Diagnostic details must stay within the producing operation's\n byte budget. Bang functions raise this same structure.\n \"\"\"\n\n defexception [\n :kind,\n phase: :validation,\n certainty: :unknown,\n retryable: false,\n path: [],\n details: %{}\n ]\n\n @typedoc \"Evidence about effects, independent of whether cleanup or arbitrary program completion is proved.\"\n @type certainty :: :no_write | :acknowledged | :observed | :unknown\n @typedoc \"A field, array index or observed identity locating an error; links retain their contextual tuple ID.\"\n @type path_component :: atom() | non_neg_integer() | LibTmux.Ref.id()\n @typedoc \"A structured API failure. Kind and phase are extensible; retryable never permits automatic mutation replay.\"\n @type t :: %__MODULE__{\n kind: atom(),\n phase: atom(),\n certainty: certainty(),\n retryable: boolean(),\n path: [path_component()],\n details: map()\n }\n\n @impl true\n def message(%__MODULE__{kind: kind, phase: phase, path: path, details: details}) do\n location = if path == [], do: \"\", else: \" at #{inspect(path)}\"\n\n reason =\n case {kind, phase, details} do\n {:invalid_command, :validation, %{reason: reason}}\n when is_binary(reason) and byte_size(reason) <= 256 ->\n \": \" <> reason\n\n _ ->\n \"\"\n end\n\n \"#{kind} during #{phase}#{location}#{reason}\"\n end\nend\n" }, "lib/libtmux/filter.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "d568eb71ff30737afa40665b00fc73ed624e9c24d5f4547dd9658ee5e81c4a9a", - "content": "defmodule LibTmux.Filter do\n @moduledoc \"\"\"\n A validated portable predicate over one observed entity type.\n\n Keywords are trusted shorthand for maps. Fields in one object conjoin;\n duplicate keyword keys are rejected recursively. `not` at a field negates\n equality, while Boolean `not` takes one criteria object. Lists require an\n explicit operator. Native callbacks belong to `LibTmux.Selection.filter/2`.\n This value contains data; executable preparation remains separate.\n \"\"\"\n\n alias LibTmux.{Error, Schema}\n @enforce_keys [:entity, :tree]\n defstruct [:entity, :tree]\n\n @typedoc \"Local map criteria or keyword shorthand; field and operand domains are validated at construction.\"\n @type criteria :: %{optional(atom()) => term()} | keyword(term())\n @typedoc \"Trusted criteria data or a previously validated filter for the same entity.\"\n @type input :: criteria() | t()\n @typedoc \"A positive resource ceiling; byte, depth, node, list and string budgets validate independently.\"\n @type limit_option ::\n {:max_bytes, pos_integer()}\n | {:max_depth, pos_integer()}\n | {:max_nodes, pos_integer()}\n | {:max_list, pos_integer()}\n | {:max_string_bytes, pos_integer()}\n @typedoc \"Resolved constructor budgets; wire limits also cover the versioned envelope.\"\n @type limits :: %{\n max_bytes: pos_integer(),\n max_depth: pos_integer(),\n max_nodes: pos_integer(),\n max_list: pos_integer(),\n max_string_bytes: pos_integer()\n }\n @typep scalar :: binary() | non_neg_integer() | boolean() | nil | LibTmux.Ref.id()\n @typep predicate_node ::\n {:and | :or, [predicate_node()]}\n | {:not, predicate_node()}\n | {:field, atom(), Schema.operator(), scalar() | [scalar()]}\n | {:count, atom(), [{Schema.operator(), non_neg_integer() | [non_neg_integer()]}]}\n | {:relation, atom(), :some | :every | :none | :is | :is_not, predicate_node() | nil}\n\n @typedoc \"Validated portable predicate data; executable predicates are prepared separately.\"\n @opaque t :: %__MODULE__{entity: Schema.entity(), tree: predicate_node()}\n\n @doc \"\"\"\n Normalizes criteria and validates field/operator/value domains before evaluation.\n\n An existing filter retains its constructor's validation when no new limits\n are supplied. Explicit limits check the normalized tree directly, without\n expanding it into synthetic input syntax.\n \"\"\"\n @spec new(Schema.entity_selector(), input(), [limit_option()]) ::\n {:ok, t()} | {:error, Error.t()}\n def new(entity, criteria, options \\\\ [])\n\n def new(entity, %__MODULE__{} = filter, []) do\n if Schema.entity(entity) == filter.entity,\n do: {:ok, filter},\n else:\n {:error,\n %Error{\n kind: :invalid_filter,\n certainty: :no_write,\n path: [:entity],\n details: %{code: :entity_mismatch}\n }}\n end\n\n def new(entity, criteria, options) do\n entity = Schema.entity(entity)\n\n try do\n state = %{limits: limits(options), nodes: 0, bytes: 0}\n\n tree =\n case criteria do\n %__MODULE__{entity: ^entity, tree: tree} ->\n tree\n\n %__MODULE__{} ->\n invalid([:entity], :entity_mismatch)\n\n value ->\n {tree, _state} = normalize(entity, value, state, [], 0)\n tree\n end\n\n check_tree(tree, entity, state, [], 0)\n {:ok, %__MODULE__{entity: entity, tree: tree}}\n catch\n %Error{} = error -> {:error, error}\n end\n end\n\n @doc \"Constructs a filter or raises its structured validation error.\"\n @spec new!(Schema.entity_selector(), input(), [limit_option()]) :: t()\n def new!(entity, criteria, options \\\\ []) do\n case new(entity, criteria, options) do\n {:ok, filter} -> filter\n {:error, error} -> raise error\n end\n end\n\n @doc \"Prepares a local unary predicate after validating captured coverage, including empty domains.\"\n @spec to_predicate(t(), [{:snapshot, LibTmux.Snapshot.t()}]) ::\n (Schema.observation() -> boolean())\n def to_predicate(%__MODULE__{} = filter, options) do\n filter = new!(filter.entity, filter)\n LibTmux.Filter.Evaluator.prepare(filter, Keyword.fetch!(options, :snapshot))\n end\n\n @doc \"Decodes a whitelisted versioned map; raw JSON must use from_json to retain duplicate keys.\"\n @spec from_wire(Schema.entity_selector(), term(), [limit_option()]) ::\n {:ok, t()} | {:error, Error.t()}\n def from_wire(entity, payload, options \\\\ []),\n do: LibTmux.Filter.Wire.decode(entity, payload, options)\n\n @doc \"Decodes bounded JSON, rejecting duplicate object keys and trailing data.\"\n @spec from_json(Schema.entity_selector(), binary(), [limit_option()]) ::\n {:ok, t()} | {:error, Error.t()}\n def from_json(entity, json, options \\\\ []),\n do: LibTmux.Filter.Wire.decode_json(entity, json, options)\n\n @doc \"Returns the explicit versioned string-keyed wire representation.\"\n @spec to_wire(t()) :: LibTmux.Wire.object()\n def to_wire(%__MODULE__{} = filter), do: LibTmux.Filter.Wire.encode(new!(filter.entity, filter))\n\n @doc false\n @spec limits([limit_option()]) :: limits()\n def limits(options) do\n values =\n Keyword.validate!(options,\n max_bytes: 65_536,\n max_depth: 16,\n max_nodes: 1024,\n max_list: 256,\n max_string_bytes: 8192\n )\n\n unless Enum.all?(values, fn {_, value} -> is_integer(value) and value > 0 end),\n do: raise(ArgumentError, \"filter budgets must be positive integers\")\n\n Map.new(values)\n end\n\n defp normalize(entity, criteria, state, path, depth) do\n state = enter(state, path, depth)\n\n {nodes, state} =\n object(criteria, path)\n |> Enum.sort()\n |> Enum.map_reduce(state, fn {key, value}, state ->\n location = path ++ [key]\n\n cond do\n key in [:and, :or] ->\n unless (is_list(value) and not Keyword.keyword?(value)) or value == [],\n do: invalid(location, :expected_criteria_list)\n\n check_list(value, state, location)\n\n {children, state} =\n value\n |> Enum.with_index()\n |> Enum.map_reduce(state, fn {child, index}, state ->\n normalize(entity, child, state, location ++ [index], depth + 1)\n end)\n\n {{key, Enum.sort(Enum.uniq(children))}, state}\n\n key == :not ->\n {child, state} = normalize(entity, value, state, location, depth + 1)\n {{:not, child}, state}\n\n metadata = Schema.field(entity, key) ->\n {operators, state} = operators(metadata, value, state, location)\n\n {conjoin(Enum.map(operators, fn {op, operand} -> {:field, key, op, operand} end)),\n state}\n\n relation = Schema.relations(entity)[key] ->\n relation(entity, key, relation, value, state, location, depth + 1)\n\n true ->\n invalid(location, :unknown_field)\n end\n end)\n\n {conjoin(nodes), state}\n end\n\n defp relation(_entity, name, {cardinality, target}, criteria, state, path, depth) do\n pairs = object(criteria, path)\n if pairs == [], do: invalid(path, :empty_operators)\n\n {nodes, state} =\n Enum.sort(pairs)\n |> Enum.map_reduce(state, fn {op, value}, state ->\n location = path ++ [op]\n\n cond do\n cardinality == :many and op == :count ->\n {operators, state} =\n operators(%{type: :integer, nullable: false}, value, state, location)\n\n {{:count, name, operators}, state}\n\n cardinality == :many and op in [:some, :every, :none] ->\n {child, state} = normalize(target, value, state, location, depth)\n {{:relation, name, op, child}, state}\n\n cardinality == :one and op in [:is, :is_not] ->\n if is_nil(value) do\n {{:relation, name, op, nil}, enter(state, location, depth)}\n else\n {child, state} = normalize(target, value, state, location, depth)\n {{:relation, name, op, child}, state}\n end\n\n true ->\n invalid(location, :unsupported_operator)\n end\n end)\n\n {conjoin(nodes), state}\n end\n\n defp operators(metadata, criteria, state, path) do\n pairs =\n if is_map(criteria) or is_list(criteria),\n do: object(criteria, path),\n else: [equals: criteria]\n\n if pairs == [], do: invalid(path, :empty_operators)\n\n Enum.sort(pairs)\n |> Enum.map_reduce(state, fn {op, operand}, state ->\n location = path ++ [op]\n unless op in Schema.operators(metadata), do: invalid(location, :unsupported_operator)\n\n values =\n if op in [:in, :not_in] do\n check_list(operand, state, location)\n operand\n else\n [operand]\n end\n\n state =\n values\n |> Enum.with_index()\n |> Enum.reduce(state, fn {value, index}, state ->\n value_path = if op in [:in, :not_in], do: location ++ [index], else: location\n\n if op in [:lt, :lte, :gt, :gte, :contains, :starts_with, :ends_with] and is_nil(value),\n do: invalid(value_path, :invalid_value)\n\n unless Schema.valid_value?(metadata, value), do: invalid(value_path, :invalid_value)\n bytes = if is_binary(value), do: byte_size(value), else: 0\n\n if bytes > state.limits.max_string_bytes or state.bytes + bytes > state.limits.max_bytes,\n do: limited(value_path, :bytes)\n\n %{state | bytes: state.bytes + bytes}\n end)\n\n {{op, operand}, enter(state, location, 0)}\n end)\n end\n\n defp object(criteria, _path) when is_map(criteria) and not is_struct(criteria),\n do: Map.to_list(criteria)\n\n defp object(criteria, path) when is_list(criteria) do\n unless Keyword.keyword?(criteria), do: invalid(path, :expected_object)\n keys = Keyword.keys(criteria)\n if length(keys) != MapSet.size(MapSet.new(keys)), do: invalid(path, :duplicate_key)\n criteria\n end\n\n defp object(_criteria, path), do: invalid(path, :expected_object)\n\n defp enter(state, path, depth) do\n if depth > state.limits.max_depth, do: limited(path, :depth)\n if state.nodes >= state.limits.max_nodes, do: limited(path, :nodes)\n %{state | nodes: state.nodes + 1}\n end\n\n defp check_list(value, state, path) do\n unless is_list(value), do: invalid(path, :expected_list)\n if length(value) > state.limits.max_list, do: limited(path, :list)\n end\n\n defp conjoin(nodes) do\n nodes = nodes |> Enum.flat_map(&conjuncts/1) |> Enum.uniq() |> Enum.sort()\n\n case nodes do\n [node] -> node\n _ -> {:and, nodes}\n end\n end\n\n defp conjuncts({:and, children}), do: Enum.flat_map(children, &conjuncts/1)\n defp conjuncts(node), do: [node]\n\n defp check_tree({kind, children}, entity, state, path, depth) when kind in [:and, :or] do\n state = enter(state, path, depth)\n check_list(children, state, path)\n child_depth = if kind == :and, do: depth, else: depth + 1\n\n children\n |> Enum.with_index()\n |> Enum.reduce(state, fn {child, index}, state ->\n check_tree(child, entity, state, path ++ [kind, index], child_depth)\n end)\n end\n\n defp check_tree({:not, child}, entity, state, path, depth) do\n check_tree(child, entity, enter(state, path, depth), path ++ [:not], depth + 1)\n end\n\n defp check_tree({:field, field, op, value}, entity, state, path, depth) do\n if depth > state.limits.max_depth, do: limited(path, :depth)\n metadata = Schema.field(entity, field) || invalid(path ++ [field], :unknown_field)\n {_, state} = operators(metadata, %{op => value}, state, path ++ [field])\n state\n end\n\n defp check_tree({:count, relation, ops}, entity, state, path, depth) do\n if depth > state.limits.max_depth, do: limited(path, :depth)\n\n unless match?({:many, _}, Schema.relations(entity)[relation]),\n do: invalid(path ++ [relation], :unsupported_operator)\n\n {_, state} =\n operators(%{type: :integer, nullable: false}, ops, state, path ++ [relation, :count])\n\n state\n end\n\n defp check_tree({:relation, relation, op, child}, entity, state, path, depth) do\n state = enter(state, path, depth)\n\n case Schema.relations(entity)[relation] do\n {:many, target} when op in [:some, :every, :none] ->\n check_tree(child, target, state, path ++ [relation, op], depth + 1)\n\n {:one, _target} when op in [:is, :is_not] and is_nil(child) ->\n state\n\n {:one, target} when op in [:is, :is_not] ->\n check_tree(child, target, state, path ++ [relation, op], depth + 1)\n\n _ ->\n invalid(path ++ [relation], :unsupported_operator)\n end\n end\n\n defp check_tree(_tree, _entity, _state, path, _depth), do: invalid(path, :invalid_tree)\n\n defp invalid(path, code),\n do:\n throw(%Error{\n kind: :invalid_filter,\n certainty: :no_write,\n path: path,\n details: %{code: code}\n })\n\n defp limited(path, code),\n do:\n throw(%Error{\n kind: :resource_limit,\n certainty: :no_write,\n path: path,\n details: %{code: code}\n })\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "a9ed5bba343d306ee1710c2fce5d0f28e7e6d1559744ca69fabc14482ec33741", + "content": "defmodule LibTmux.Filter do\n @moduledoc \"\"\"\n A validated portable predicate over one observed entity type.\n\n Keywords are trusted shorthand for maps. Fields in one object conjoin;\n duplicate keyword keys are rejected recursively. `not` at a field negates\n equality, while Boolean `not` takes one criteria object. Lists require an\n explicit operator. Native callbacks belong to `LibTmux.Selection.filter/2`.\n This value contains data; executable preparation remains separate.\n \"\"\"\n\n alias LibTmux.{Error, Schema}\n @enforce_keys [:entity, :tree]\n defstruct [:entity, :tree]\n\n @typedoc \"Local map criteria or keyword shorthand; field and operand domains are validated at construction.\"\n @type criteria :: %{optional(atom()) => term()} | keyword(term())\n @typedoc \"Trusted criteria data or a previously validated filter for the same entity.\"\n @type input :: criteria() | t()\n @typedoc \"A positive resource ceiling; byte, depth, node, list and string budgets validate independently.\"\n @type limit_option ::\n {:max_bytes, pos_integer()}\n | {:max_depth, pos_integer()}\n | {:max_nodes, pos_integer()}\n | {:max_list, pos_integer()}\n | {:max_string_bytes, pos_integer()}\n @typedoc \"Resolved constructor budgets; wire limits also cover the versioned envelope.\"\n @type limits :: %{\n max_bytes: pos_integer(),\n max_depth: pos_integer(),\n max_nodes: pos_integer(),\n max_list: pos_integer(),\n max_string_bytes: pos_integer()\n }\n @typep scalar :: binary() | non_neg_integer() | boolean() | nil | LibTmux.Ref.id()\n @typep predicate_node ::\n {:and | :or, [predicate_node()]}\n | {:not, predicate_node()}\n | {:field, atom(), Schema.operator(), scalar() | [scalar()]}\n | {:count, atom(), [{Schema.operator(), non_neg_integer() | [non_neg_integer()]}]}\n | {:relation, atom(), :some | :every | :none | :is | :is_not, predicate_node() | nil}\n\n @typedoc \"Validated portable predicate data; executable predicates are prepared separately.\"\n @opaque t :: %__MODULE__{entity: Schema.entity(), tree: predicate_node()}\n\n @doc \"\"\"\n Normalizes criteria and validates field/operator/value domains before evaluation.\n\n An existing filter retains its constructor's validation when no new limits\n are supplied. Explicit limits check the normalized tree directly, without\n expanding it into synthetic input syntax.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec new(Schema.entity_selector(), input(), [limit_option()]) ::\n {:ok, t()} | {:error, Error.t()}\n def new(entity, criteria, options \\\\ [])\n\n def new(entity, %__MODULE__{} = filter, []) do\n if Schema.entity(entity) == filter.entity,\n do: {:ok, filter},\n else:\n {:error,\n %Error{\n kind: :invalid_filter,\n certainty: :no_write,\n path: [:entity],\n details: %{code: :entity_mismatch}\n }}\n end\n\n def new(entity, criteria, options) do\n entity = Schema.entity(entity)\n\n try do\n state = %{limits: limits(options), nodes: 0, bytes: 0}\n\n tree =\n case criteria do\n %__MODULE__{entity: ^entity, tree: tree} ->\n tree\n\n %__MODULE__{} ->\n invalid([:entity], :entity_mismatch)\n\n value ->\n {tree, _state} = normalize(entity, value, state, [], 0)\n tree\n end\n\n check_tree(tree, entity, state, [], 0)\n {:ok, %__MODULE__{entity: entity, tree: tree}}\n catch\n %Error{} = error -> {:error, error}\n end\n end\n\n @doc \"\"\"\n Constructs a filter or raises its structured validation error.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec new!(Schema.entity_selector(), input(), [limit_option()]) :: t()\n def new!(entity, criteria, options \\\\ []) do\n case new(entity, criteria, options) do\n {:ok, filter} -> filter\n {:error, error} -> raise error\n end\n end\n\n @doc \"\"\"\n Prepares a local unary predicate after validating captured coverage, including empty domains.\n\n Relationship and count predicates require each input to equal the\n observation stored under its ID in `snapshot`. A missing or different\n observation raises `LibTmux.Error` with kind `:observation_mismatch`.\n Related values always come from the prepared snapshot; equal inputs from\n another capture are accepted.\n\n Scalar-only predicates read the supplied observation and may be reused\n across captures. Each referenced field must be loaded: `:unloaded` raises\n `:field_not_loaded` and `:unavailable` raises `:field_unavailable` before\n Boolean evaluation. Known nullable values keep their comparison semantics;\n unreferenced fields need not be loaded. The snapshot validates coverage\n when preparing the predicate.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec to_predicate(t(), [{:snapshot, LibTmux.Snapshot.t()}]) ::\n (Schema.observation() -> boolean())\n def to_predicate(%__MODULE__{} = filter, options) do\n filter = new!(filter.entity, filter)\n LibTmux.Filter.Evaluator.prepare(filter, Keyword.fetch!(options, :snapshot))\n end\n\n @doc \"\"\"\n Decodes a whitelisted versioned map; raw JSON must use from_json to retain duplicate keys.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec from_wire(Schema.entity_selector(), term(), [limit_option()]) ::\n {:ok, t()} | {:error, Error.t()}\n def from_wire(entity, payload, options \\\\ []),\n do: LibTmux.Filter.Wire.decode(entity, payload, options)\n\n @doc \"\"\"\n Decodes bounded JSON, rejecting duplicate object keys and trailing data.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec from_json(Schema.entity_selector(), binary(), [limit_option()]) ::\n {:ok, t()} | {:error, Error.t()}\n def from_json(entity, json, options \\\\ []),\n do: LibTmux.Filter.Wire.decode_json(entity, json, options)\n\n @doc \"\"\"\n Returns the explicit versioned string-keyed wire representation.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec to_wire(t()) :: LibTmux.Wire.object()\n def to_wire(%__MODULE__{} = filter), do: LibTmux.Filter.Wire.encode(new!(filter.entity, filter))\n\n @doc false\n @spec limits([limit_option()]) :: limits()\n def limits(options) do\n values =\n Keyword.validate!(options,\n max_bytes: 65_536,\n max_depth: 16,\n max_nodes: 1024,\n max_list: 256,\n max_string_bytes: 8192\n )\n\n unless Enum.all?(values, fn {_, value} -> is_integer(value) and value > 0 end),\n do: raise(ArgumentError, \"filter budgets must be positive integers\")\n\n Map.new(values)\n end\n\n defp normalize(entity, criteria, state, path, depth) do\n state = enter(state, path, depth)\n\n {nodes, state} =\n object(criteria, path)\n |> Enum.sort()\n |> Enum.map_reduce(state, fn {key, value}, state ->\n location = path ++ [key]\n\n cond do\n key in [:and, :or] ->\n unless (is_list(value) and not Keyword.keyword?(value)) or value == [],\n do: invalid(location, :expected_criteria_list)\n\n check_list(value, state, location)\n\n {children, state} =\n value\n |> Enum.with_index()\n |> Enum.map_reduce(state, fn {child, index}, state ->\n normalize(entity, child, state, location ++ [index], depth + 1)\n end)\n\n {{key, Enum.sort(Enum.uniq(children))}, state}\n\n key == :not ->\n {child, state} = normalize(entity, value, state, location, depth + 1)\n {{:not, child}, state}\n\n metadata = Schema.field(entity, key) ->\n {operators, state} = operators(metadata, value, state, location)\n\n {conjoin(Enum.map(operators, fn {op, operand} -> {:field, key, op, operand} end)),\n state}\n\n relation = Schema.relations(entity)[key] ->\n relation(entity, key, relation, value, state, location, depth + 1)\n\n true ->\n invalid(location, :unknown_field)\n end\n end)\n\n {conjoin(nodes), state}\n end\n\n defp relation(_entity, name, {cardinality, target}, criteria, state, path, depth) do\n pairs = object(criteria, path)\n if pairs == [], do: invalid(path, :empty_operators)\n\n {nodes, state} =\n Enum.sort(pairs)\n |> Enum.map_reduce(state, fn {op, value}, state ->\n location = path ++ [op]\n\n cond do\n cardinality == :many and op == :count ->\n {operators, state} =\n operators(%{type: :integer, nullable: false}, value, state, location)\n\n {{:count, name, operators}, state}\n\n cardinality == :many and op in [:some, :every, :none] ->\n {child, state} = normalize(target, value, state, location, depth)\n {{:relation, name, op, child}, state}\n\n cardinality == :one and op in [:is, :is_not] ->\n if is_nil(value) do\n {{:relation, name, op, nil}, enter(state, location, depth)}\n else\n {child, state} = normalize(target, value, state, location, depth)\n {{:relation, name, op, child}, state}\n end\n\n true ->\n invalid(location, :unsupported_operator)\n end\n end)\n\n {conjoin(nodes), state}\n end\n\n defp operators(metadata, criteria, state, path) do\n pairs =\n if is_map(criteria) or is_list(criteria),\n do: object(criteria, path),\n else: [equals: criteria]\n\n if pairs == [], do: invalid(path, :empty_operators)\n\n Enum.sort(pairs)\n |> Enum.map_reduce(state, fn {op, operand}, state ->\n location = path ++ [op]\n unless op in Schema.operators(metadata), do: invalid(location, :unsupported_operator)\n\n values =\n if op in [:in, :not_in] do\n check_list(operand, state, location)\n operand\n else\n [operand]\n end\n\n state =\n values\n |> Enum.with_index()\n |> Enum.reduce(state, fn {value, index}, state ->\n value_path = if op in [:in, :not_in], do: location ++ [index], else: location\n\n if op in [:lt, :lte, :gt, :gte, :contains, :starts_with, :ends_with] and is_nil(value),\n do: invalid(value_path, :invalid_value)\n\n unless Schema.valid_value?(metadata, value), do: invalid(value_path, :invalid_value)\n bytes = if is_binary(value), do: byte_size(value), else: 0\n\n if bytes > state.limits.max_string_bytes or state.bytes + bytes > state.limits.max_bytes,\n do: limited(value_path, :bytes)\n\n %{state | bytes: state.bytes + bytes}\n end)\n\n {{op, operand}, enter(state, location, 0)}\n end)\n end\n\n defp object(criteria, _path) when is_map(criteria) and not is_struct(criteria),\n do: Map.to_list(criteria)\n\n defp object(criteria, path) when is_list(criteria) do\n unless Keyword.keyword?(criteria), do: invalid(path, :expected_object)\n keys = Keyword.keys(criteria)\n if length(keys) != MapSet.size(MapSet.new(keys)), do: invalid(path, :duplicate_key)\n criteria\n end\n\n defp object(_criteria, path), do: invalid(path, :expected_object)\n\n defp enter(state, path, depth) do\n if depth > state.limits.max_depth, do: limited(path, :depth)\n if state.nodes >= state.limits.max_nodes, do: limited(path, :nodes)\n %{state | nodes: state.nodes + 1}\n end\n\n defp check_list(value, state, path) do\n unless is_list(value), do: invalid(path, :expected_list)\n if length(value) > state.limits.max_list, do: limited(path, :list)\n end\n\n defp conjoin(nodes) do\n nodes = nodes |> Enum.flat_map(&conjuncts/1) |> Enum.uniq() |> Enum.sort()\n\n case nodes do\n [node] -> node\n _ -> {:and, nodes}\n end\n end\n\n defp conjuncts({:and, children}), do: Enum.flat_map(children, &conjuncts/1)\n defp conjuncts(node), do: [node]\n\n defp check_tree({kind, children}, entity, state, path, depth) when kind in [:and, :or] do\n state = enter(state, path, depth)\n check_list(children, state, path)\n child_depth = if kind == :and, do: depth, else: depth + 1\n\n children\n |> Enum.with_index()\n |> Enum.reduce(state, fn {child, index}, state ->\n check_tree(child, entity, state, path ++ [kind, index], child_depth)\n end)\n end\n\n defp check_tree({:not, child}, entity, state, path, depth) do\n check_tree(child, entity, enter(state, path, depth), path ++ [:not], depth + 1)\n end\n\n defp check_tree({:field, field, op, value}, entity, state, path, depth) do\n if depth > state.limits.max_depth, do: limited(path, :depth)\n metadata = Schema.field(entity, field) || invalid(path ++ [field], :unknown_field)\n {_, state} = operators(metadata, %{op => value}, state, path ++ [field])\n state\n end\n\n defp check_tree({:count, relation, ops}, entity, state, path, depth) do\n if depth > state.limits.max_depth, do: limited(path, :depth)\n\n unless match?({:many, _}, Schema.relations(entity)[relation]),\n do: invalid(path ++ [relation], :unsupported_operator)\n\n {_, state} =\n operators(%{type: :integer, nullable: false}, ops, state, path ++ [relation, :count])\n\n state\n end\n\n defp check_tree({:relation, relation, op, child}, entity, state, path, depth) do\n state = enter(state, path, depth)\n\n case Schema.relations(entity)[relation] do\n {:many, target} when op in [:some, :every, :none] ->\n check_tree(child, target, state, path ++ [relation, op], depth + 1)\n\n {:one, _target} when op in [:is, :is_not] and is_nil(child) ->\n state\n\n {:one, target} when op in [:is, :is_not] ->\n check_tree(child, target, state, path ++ [relation, op], depth + 1)\n\n _ ->\n invalid(path ++ [relation], :unsupported_operator)\n end\n end\n\n defp check_tree(_tree, _entity, _state, path, _depth), do: invalid(path, :invalid_tree)\n\n defp invalid(path, code),\n do:\n throw(%Error{\n kind: :invalid_filter,\n certainty: :no_write,\n path: path,\n details: %{code: code}\n })\n\n defp limited(path, code),\n do:\n throw(%Error{\n kind: :resource_limit,\n certainty: :no_write,\n path: path,\n details: %{code: code}\n })\nend\n" }, "lib/libtmux/format.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "ca5dc85f4c6dbb0f5c4b2763875d7240fdaaeba562d98240c9cfb4e9854132fb", - "content": "defmodule LibTmux.Format do\n @moduledoc \"\"\"\n Constructs literal operands for tmux formats without evaluating their text.\n\n Command quoting and format quoting are separate. A literal may contain\n newlines or arbitrary non-NUL bytes; this does not qualify its output for\n a shared line-oriented control lane.\n \"\"\"\n\n @syntax_bytes [35, 123, 125, 44, 58, 59]\n\n @field_modifiers Enum.map_join([92, 36 | Enum.to_list(1..31) ++ [127]], \";\", fn byte ->\n pattern =\n case byte do\n 92 -> \"\\\\\\\\\"\n 36 -> \"\\\\$\"\n _ -> <>\n end\n\n replacement =\n \"\\\\\\\\\" <> (byte |> Integer.to_string(8) |> String.pad_leading(3, \"0\"))\n\n \"s|\" <> pattern <> \"|\" <> replacement <> \"|\"\n end)\n\n @doc \"\"\"\n Encodes one named field for `LibTmux.Codec.decode_field/3` with `encoding: :escaped_v1`.\n\n Backslashes are replaced first, then dollars and ASCII control bytes.\n This protects values from tmux 3.4's ambiguous print escaping. The `v1:`\n prefix and encoded newlines prevent field text from becoming reply guards.\n This is one field per response, not a delimiter-framed row or arbitrary\n format wrapper. The caller must still bound the response and validate the\n field against its schema and the connected server's capabilities.\n \"\"\"\n @spec field(String.t()) :: binary()\n def field(name) when is_binary(name) do\n unless byte_size(name) in 1..64 and Regex.match?(~r/\\A@?[a-zA-Z][a-zA-Z0-9_]*\\z/, name),\n do: raise(ArgumentError, \"field must be a tmux variable or named user option\")\n\n \"v1:\" <> ~S\"#{\" <> @field_modifiers <> \":\" <> name <> \"}\"\n end\n\n @doc \"Returns a format expression that expands to exactly the supplied non-NUL bytes.\"\n @spec literal(binary()) :: binary()\n def literal(value) when is_binary(value) do\n if :binary.match(value, <<0>>) != :nomatch do\n raise ArgumentError, \"tmux format literals cannot contain NUL\"\n end\n\n for <>, into: \"\" do\n if byte in @syntax_bytes do\n ~S\"#{a:\" <> Integer.to_string(byte) <> \"}\"\n else\n <>\n end\n end\n end\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "204658005014420ca63033f0bb216dade63dafe8108f26d67e6c0673104394e1", + "content": "defmodule LibTmux.Format do\n @moduledoc \"\"\"\n Constructs literal operands for tmux formats without evaluating their text.\n\n Command quoting and format quoting are separate. A literal may contain\n newlines or arbitrary non-NUL bytes; this does not qualify its output for\n a shared line-oriented control lane.\n \"\"\"\n\n @syntax_bytes [35, 123, 125, 44, 58, 59]\n\n @field_modifiers Enum.map_join([92, 36 | Enum.to_list(1..31) ++ [127]], \";\", fn byte ->\n pattern =\n case byte do\n 92 -> \"\\\\\\\\\"\n 36 -> \"\\\\$\"\n _ -> <>\n end\n\n replacement =\n \"\\\\\\\\\" <> (byte |> Integer.to_string(8) |> String.pad_leading(3, \"0\"))\n\n \"s|\" <> pattern <> \"|\" <> replacement <> \"|\"\n end)\n\n @doc \"\"\"\n Encodes one named field for `LibTmux.Codec.decode_field/3` with `encoding: :escaped_v1`.\n\n Backslashes are replaced first, then dollars and ASCII control bytes.\n This protects values from tmux 3.4's ambiguous print escaping. The `v1:`\n prefix and encoded newlines prevent field text from becoming reply guards.\n This encodes one field. Capture composes these fields inside its versioned\n row framing; this is not an arbitrary format wrapper. The caller must still\n bound the response and validate the\n field against its schema and the connected server's capabilities.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec field(String.t()) :: binary()\n def field(name) when is_binary(name) do\n unless byte_size(name) in 1..64 and Regex.match?(~r/\\A@?[a-zA-Z][a-zA-Z0-9_]*\\z/, name),\n do: raise(ArgumentError, \"field must be a tmux variable or named user option\")\n\n \"v1:\" <> ~S\"#{\" <> @field_modifiers <> \":\" <> name <> \"}\"\n end\n\n @doc \"\"\"\n Returns a format expression that expands to exactly the supplied non-NUL bytes.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec literal(binary()) :: binary()\n def literal(value) when is_binary(value) do\n if :binary.match(value, <<0>>) != :nomatch do\n raise ArgumentError, \"tmux format literals cannot contain NUL\"\n end\n\n for <>, into: \"\" do\n if byte in @syntax_bytes do\n ~S\"#{a:\" <> Integer.to_string(byte) <> \"}\"\n else\n <>\n end\n end\n end\nend\n" }, "lib/libtmux/operation.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "b3cbccc29af70b1374ba5a386f7124c65fbc7ac27313d892d51da8d80ae9e54b", - "content": "defmodule LibTmux.Operation do\n @moduledoc \"\"\"\n A retained operation handle pinned to its original owner, tables and epoch.\n\n `result/1` and `status/1` read local retained values. `await/2` owns a separate\n bounded waiter; its timeout never stops the operation. `stop/1` requests\n closure of the operation's entire connection epoch, including siblings.\n It does not roll back effects or prove native cleanup.\n\n Canonical results carry `outcome`, `certainty` and `evidence`. Completed,\n failed, skipped and unknown outcomes remain values, including in bang APIs.\n Bang functions raise only API or metadata errors. A command reply is distinct\n from wire retirement and arbitrary program exit.\n\n Normal reconnect preserves retained records until forget or expiry. Owner\n replacement loses those tables; a handle never follows a replacement view.\n \"\"\"\n\n alias LibTmux.{Deadline, Error}\n alias LibTmux.Control.{Admission, Births, Exchange, Inbox, Lifetime, Records}\n alias LibTmux.Operation.Lifecycle\n\n @enforce_keys [:records, :lease, :inbox, :waiter_inbox, :births]\n @derive {Inspect, only: []}\n defstruct @enforce_keys\n @typedoc \"A retained owner-bound operation handle; it is not a command result or a reservation.\"\n @opaque t :: %__MODULE__{}\n @typedoc \"A qualified command reply, independently of wire retirement or program completion.\"\n @type command_result :: %{\n outcome: :completed | :failed,\n certainty: :acknowledged,\n evidence: :command_reply,\n guard: LibTmux.Protocol.guard_id(),\n lines: [binary()]\n }\n @typedoc \"A canonical no-write outcome, with the reason it was skipped before dispatch.\"\n @type skipped_result :: %{\n outcome: :skipped,\n certainty: :no_write,\n evidence: :cancelled | :timeout | :epoch_closed\n }\n @typedoc \"An epoch closed without enough evidence to classify the operation's effects.\"\n @type unknown_result :: %{outcome: :unknown, certainty: :unknown, evidence: :epoch_closed}\n @typedoc \"The immutable canonical outcome; failed, skipped and unknown outcomes remain values.\"\n @type result :: command_result() | skipped_result() | unknown_result()\n @typedoc \"Wire progress for this operation; retired wire does not prove connection cleanup.\"\n @type wire :: :unpublished | :unsent | :writing | :awaiting | :closing | :retired\n @typedoc \"Retained wire progress and the canonical result, or nil while no outcome is established.\"\n @type status :: %{wire: wire(), result: result() | nil}\n @typedoc \"A positive millisecond budget for one waiter or record-reclamation call.\"\n @type option :: {:timeout, pos_integer()}\n\n @doc false\n def new(endpoint, %Admission.Lease{} = lease) do\n with {:ok, template} <- prepare(endpoint),\n true <- endpoint.epoch === lease.epoch and endpoint.router === lease.destination,\n current when current == :pending or is_tuple(current) <-\n Records.fetch(endpoint.records, lease) do\n case current do\n {:error, _error} -> raise ArgumentError, \"operation requires a current admitted lease\"\n _ -> bind(template, lease)\n end\n else\n _ -> raise ArgumentError, \"operation requires matching Manager and epoch resources\"\n end\n end\n\n @doc false\n def prepare(endpoint) do\n operation = %__MODULE__{\n records: endpoint.records,\n lease: nil,\n inbox: endpoint.inbox,\n waiter_inbox: endpoint.waiter_inbox,\n births: endpoint.births\n }\n\n valid =\n endpoint.manager == operation.records.pool.owner and\n endpoint.pool === operation.records.pool and\n endpoint.epoch === operation.births.epoch and\n endpoint.lifetime === operation.births.lifetime and\n endpoint.generation === operation.births.generation\n\n with true <- valid,\n :ok <- Records.validate(operation.records),\n :ok <- inbox_context(operation, operation.inbox, :forget),\n :ok <- inbox_context(operation, operation.waiter_inbox, :await),\n {:ok, %{roles: %{router: router}}} <- Births.snapshot(operation.births),\n true <- operation.births.owner == endpoint.manager and router === endpoint.router do\n {:ok, operation}\n else\n false -> failure(:wrong_operation)\n error -> error\n end\n end\n\n # Admission already produced this exact lease. Binding performs no live reads.\n @doc false\n def bind(\n %__MODULE__{lease: nil, records: records, births: births} = template,\n %Admission.Lease{} = lease\n )\n when lease.table == records.pool.table and lease.epoch == births.epoch,\n do: %{template | lease: lease}\n\n @doc \"Reads retained wire state and canonical result without contacting tmux.\"\n @spec status(t()) :: {:ok, status()} | {:error, Error.t()}\n def status(%__MODULE__{} = operation) do\n case Records.fetch(operation.records, operation.lease) do\n :pending -> {:ok, %{wire: :unpublished, result: nil}}\n {:ok, %{life: life}} -> {:ok, %{wire: life.wire, result: life.result}}\n error -> normalize(error, :operation)\n end\n end\n\n @doc \"Reads retained status or raises the same structured error.\"\n @spec status!(t()) :: status()\n def status!(operation), do: unwrap(status(operation))\n\n @doc \"Returns a canonical result, `:pending`, or a retained-context error.\"\n @spec result(t()) :: :pending | {:ok, result()} | {:error, Error.t()}\n def result(%__MODULE__{} = operation) do\n case status(operation) do\n {:ok, %{result: nil}} -> :pending\n {:ok, %{result: result}} -> {:ok, result}\n error -> error\n end\n end\n\n @doc \"Reads a result or `:pending`; raises API errors, preserving all canonical outcomes.\"\n @spec result!(t()) :: :pending | result()\n def result!(operation), do: unwrap(result(operation))\n\n @doc \"\"\"\n Waits for a canonical result under one positive millisecond timeout.\n\n The default is 5000ms. Every call claims an independent bounded waiter slot,\n including terminal operations; use `result/1` for immediate inspection.\n Completed waiter copies survive record reclamation until this caller reads\n them. Timeout, overload and caller death affect only this waiter.\n \"\"\"\n @spec await(t(), [option()]) :: {:ok, result()} | {:error, Error.t()}\n def await(%__MODULE__{} = operation, options \\\\ []) do\n deadline = deadline(options)\n exchange(operation, operation.waiter_inbox, :await, deadline, :wait)\n end\n\n @doc \"Waits or raises API errors; canonical failed, skipped and unknown outcomes remain values.\"\n @spec await!(t(), [option()]) :: result()\n def await!(operation, options \\\\ []), do: unwrap(await(operation, options))\n\n @doc \"\"\"\n Requests exact-record reclamation with a default 5000ms timeout.\n\n Wire-active records cannot be forgotten. An owner-accepted request remains\n owned after caller timeout. Successful reclamation invalidates this record\n handle while preserving already-accepted waiter copies.\n \"\"\"\n @spec forget(t(), [option()]) :: :ok | {:error, Error.t()}\n def forget(%__MODULE__{} = operation, options \\\\ []) do\n deadline = deadline(options)\n exchange(operation, operation.inbox, :forget, deadline, :forget)\n end\n\n @doc \"Forgets the retained record or raises the same structured error.\"\n @spec forget!(t(), [option()]) :: :ok\n def forget!(operation, options \\\\ []), do: unwrap(forget(operation, options))\n\n @doc \"\"\"\n Requests closure of the pinned epoch through reserved capacity.\n\n Returns `:ok` for an already wire-retired operation or an accepted closure\n request, and `{:error, error}` otherwise. Closure can affect sibling work;\n success does not prove retirement or change the canonical result. A stale\n handle cannot revoke a replacement epoch.\n \"\"\"\n @spec stop(t()) :: :ok | {:error, Error.t()}\n def stop(%__MODULE__{} = operation) do\n result =\n case Records.fetch(operation.records, operation.lease) do\n {:ok, %{life: life}} ->\n if Lifecycle.wire_retired?(life), do: :ok, else: revoke(operation)\n\n :pending ->\n revoke(operation)\n\n error ->\n error\n end\n\n normalize(result, :stop)\n end\n\n @doc \"Requests epoch closure or raises the same structured error.\"\n @spec stop!(t()) :: :ok\n def stop!(operation), do: unwrap(stop(operation))\n\n defp revoke(operation) do\n with {:ok, births} <- stop_context(operation),\n do: Lifetime.revoke(births.lifetime, births.generation)\n end\n\n defp stop_context(%{births: %Births{} = births, records: records, lease: lease}) do\n with {:ok, %{roles: %{router: router}}} <- Births.snapshot(births) do\n if births.owner == records.pool.owner and births.epoch === lease.epoch and\n router === lease.destination,\n do: {:ok, births},\n else: failure(:wrong_operation)\n end\n end\n\n defp exchange(operation, inbox, kind, deadline, phase) do\n outcome =\n with :ok <- inbox_context(operation, inbox, kind),\n current when current == :pending or is_tuple(current) <-\n Records.fetch(operation.records, operation.lease) do\n case current do\n {:error, _error} = error -> error\n _ -> Exchange.call(inbox, operation.lease.epoch, deadline, {kind, operation.lease})\n end\n end\n\n normalize(outcome, phase)\n end\n\n defp inbox_context(operation, %Inbox{} = inbox, kind) do\n with :ok <- Inbox.validate(inbox) do\n if inbox.owner == operation.records.pool.owner and kind in inbox.kinds,\n do: :ok,\n else: failure(:wrong_operation)\n end\n end\n\n defp deadline(options) do\n options = Keyword.validate!(options, timeout: 5000)\n Deadline.new(options[:timeout])\n end\n\n defp normalize({:error, %Error{} = error}, phase) do\n certainty = if error.certainty == :no_write, do: :unknown, else: error.certainty\n {:error, %{error | phase: phase, certainty: certainty}}\n end\n\n defp normalize(outcome, _phase), do: outcome\n defp unwrap({:ok, value}), do: value\n defp unwrap({:error, %Error{} = error}), do: raise(error)\n defp unwrap(value), do: value\n defp failure(kind), do: {:error, %Error{kind: kind, certainty: :unknown}}\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "a963380b1e69c471e1f50b583bb9606c1b9b5ca552c11c28b1ff793864719f3f", + "content": "defmodule LibTmux.Operation do\n @moduledoc \"\"\"\n A retained operation handle pinned to its original owner, tables and epoch.\n\n `result/1` and `status/1` read local retained values. `await/2` owns a separate\n bounded waiter; its timeout never stops the operation. `stop/1` requests\n closure of the operation's entire connection epoch, including siblings.\n It does not roll back effects or prove native cleanup.\n\n Canonical results carry `outcome`, `certainty` and `evidence`. Completed,\n failed, skipped and unknown outcomes remain values, including in bang APIs.\n Bang functions raise only API or metadata errors. A command reply is distinct\n from wire retirement and arbitrary program exit.\n\n Normal reconnect preserves retained records until forget or expiry. Owner\n replacement loses those tables; a handle never follows a replacement view.\n Handles recovered from `LibTmux.Control.execute/3` errors also remain owned\n by that original caller: its death permits reclamation after wire retirement.\n \"\"\"\n\n alias LibTmux.{Deadline, Error}\n alias LibTmux.Control.{Admission, Births, Exchange, Inbox, Lifetime, Records}\n alias LibTmux.Operation.Lifecycle\n\n @enforce_keys [:records, :lease, :inbox, :waiter_inbox, :births]\n @derive {Inspect, only: []}\n defstruct @enforce_keys\n @typedoc \"A retained owner-bound operation handle; it is not a command result or a reservation.\"\n @opaque t :: %__MODULE__{}\n @typedoc \"A qualified command reply, independently of wire retirement or program completion.\"\n @type command_result :: %{\n outcome: :completed | :failed,\n certainty: :acknowledged,\n evidence: :command_reply,\n guard: LibTmux.Protocol.guard_id(),\n lines: [binary()]\n }\n @typedoc \"A canonical no-write outcome, with the reason it was skipped before dispatch.\"\n @type skipped_result :: %{\n outcome: :skipped,\n certainty: :no_write,\n evidence: :cancelled | :timeout | :epoch_closed\n }\n @typedoc \"An epoch closed without enough evidence to classify the operation's effects.\"\n @type unknown_result :: %{outcome: :unknown, certainty: :unknown, evidence: :epoch_closed}\n @typedoc \"The immutable canonical outcome; failed, skipped and unknown outcomes remain values.\"\n @type result :: command_result() | skipped_result() | unknown_result()\n @typedoc \"Wire progress for this operation; retired wire does not prove connection cleanup.\"\n @type wire :: :unpublished | :unsent | :writing | :awaiting | :closing | :retired\n @typedoc \"Retained wire progress and the canonical result, or nil while no outcome is established.\"\n @type status :: %{wire: wire(), result: result() | nil}\n @typedoc \"A positive millisecond budget for one waiter or record-reclamation call.\"\n @type option :: {:timeout, pos_integer()}\n\n @doc false\n def new(endpoint, %Admission.Lease{} = lease) do\n with {:ok, template} <- prepare(endpoint),\n true <- endpoint.epoch === lease.epoch and endpoint.router === lease.destination,\n current when current == :pending or is_tuple(current) <-\n Records.fetch(endpoint.records, lease) do\n case current do\n {:error, _error} -> raise ArgumentError, \"operation requires a current admitted lease\"\n _ -> bind(template, lease)\n end\n else\n _ -> raise ArgumentError, \"operation requires matching Manager and epoch resources\"\n end\n end\n\n @doc false\n def prepare(endpoint) do\n operation = %__MODULE__{\n records: endpoint.records,\n lease: nil,\n inbox: endpoint.inbox,\n waiter_inbox: endpoint.waiter_inbox,\n births: endpoint.births\n }\n\n valid =\n endpoint.manager == operation.records.pool.owner and\n endpoint.pool === operation.records.pool and\n endpoint.epoch === operation.births.epoch and\n endpoint.lifetime === operation.births.lifetime and\n endpoint.generation === operation.births.generation\n\n with true <- valid,\n :ok <- Records.validate(operation.records),\n :ok <- inbox_context(operation, operation.inbox, :forget),\n :ok <- inbox_context(operation, operation.waiter_inbox, :await),\n {:ok, %{roles: %{router: router}}} <- Births.snapshot(operation.births),\n true <- operation.births.owner == endpoint.manager and router === endpoint.router do\n {:ok, operation}\n else\n false -> failure(:wrong_operation)\n error -> error\n end\n end\n\n # Admission already produced this exact lease. Binding performs no live reads.\n @doc false\n def bind(\n %__MODULE__{lease: nil, records: records, births: births} = template,\n %Admission.Lease{} = lease\n )\n when lease.table == records.pool.table and lease.epoch == births.epoch,\n do: %{template | lease: lease}\n\n @doc \"\"\"\n Reads retained wire state and canonical result without contacting tmux.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec status(t()) :: {:ok, status()} | {:error, Error.t()}\n def status(%__MODULE__{} = operation) do\n case Records.fetch(operation.records, operation.lease) do\n :pending -> {:ok, %{wire: :unpublished, result: nil}}\n {:ok, %{life: life}} -> {:ok, %{wire: life.wire, result: life.result}}\n error -> normalize(error, :operation)\n end\n end\n\n @doc \"\"\"\n Reads retained status or raises the same structured error.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec status!(t()) :: status()\n def status!(operation), do: unwrap(status(operation))\n\n @doc \"\"\"\n Returns a canonical result, `:pending`, or a retained-context error.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec result(t()) :: :pending | {:ok, result()} | {:error, Error.t()}\n def result(%__MODULE__{} = operation) do\n case status(operation) do\n {:ok, %{result: nil}} -> :pending\n {:ok, %{result: result}} -> {:ok, result}\n error -> error\n end\n end\n\n @doc \"\"\"\n Reads a result or `:pending`; raises API errors, preserving all canonical outcomes.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec result!(t()) :: :pending | result()\n def result!(operation), do: unwrap(result(operation))\n\n @doc \"\"\"\n Waits for a canonical result under one positive millisecond timeout.\n\n The default is 5000ms. Every call claims an independent bounded waiter slot,\n including terminal operations; use `result/1` for immediate inspection.\n Completed waiter copies survive record reclamation until this caller reads\n them. Timeout, overload and caller death affect only this waiter.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec await(t(), [option()]) :: {:ok, result()} | {:error, Error.t()}\n def await(%__MODULE__{} = operation, options \\\\ []) do\n deadline = deadline(options)\n exchange(operation, operation.waiter_inbox, :await, deadline, :wait)\n end\n\n @doc \"\"\"\n Waits or raises API errors; canonical failed, skipped and unknown outcomes remain values.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec await!(t(), [option()]) :: result()\n def await!(operation, options \\\\ []), do: unwrap(await(operation, options))\n\n @doc false\n def collect(%__MODULE__{} = operation, %Deadline{} = deadline),\n do: exchange(operation, operation.waiter_inbox, :collect, deadline, :collect)\n\n @doc \"\"\"\n Requests exact-record reclamation with a default 5000ms timeout.\n\n Wire-active records cannot be forgotten. An owner-accepted request remains\n owned after caller timeout. Successful reclamation invalidates this record\n handle while preserving already-accepted waiter copies.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec forget(t(), [option()]) :: :ok | {:error, Error.t()}\n def forget(%__MODULE__{} = operation, options \\\\ []) do\n deadline = deadline(options)\n exchange(operation, operation.inbox, :forget, deadline, :forget)\n end\n\n @doc \"\"\"\n Forgets the retained record or raises the same structured error.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec forget!(t(), [option()]) :: :ok\n def forget!(operation, options \\\\ []), do: unwrap(forget(operation, options))\n\n @doc \"\"\"\n Requests closure of the pinned epoch through reserved capacity.\n\n Returns `:ok` for an already wire-retired operation or an accepted closure\n request, and `{:error, error}` otherwise. Closure can affect sibling work;\n success does not prove retirement or change the canonical result. A stale\n handle cannot revoke a replacement epoch.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec stop(t()) :: :ok | {:error, Error.t()}\n def stop(%__MODULE__{} = operation) do\n result =\n case Records.fetch(operation.records, operation.lease) do\n {:ok, %{life: life}} ->\n if Lifecycle.wire_retired?(life), do: :ok, else: revoke(operation)\n\n :pending ->\n revoke(operation)\n\n error ->\n error\n end\n\n normalize(result, :stop)\n end\n\n @doc \"\"\"\n Requests epoch closure or raises the same structured error.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec stop!(t()) :: :ok\n def stop!(operation), do: unwrap(stop(operation))\n\n defp revoke(operation) do\n with {:ok, births} <- stop_context(operation),\n do: Lifetime.revoke(births.lifetime, births.generation)\n end\n\n defp stop_context(%{births: %Births{} = births, records: records, lease: lease}) do\n with {:ok, %{roles: %{router: router}}} <- Births.snapshot(births) do\n if births.owner == records.pool.owner and births.epoch === lease.epoch and\n router === lease.destination,\n do: {:ok, births},\n else: failure(:wrong_operation)\n end\n end\n\n defp exchange(operation, inbox, kind, deadline, phase) do\n outcome =\n with :ok <- inbox_context(operation, inbox, kind),\n current when current == :pending or is_tuple(current) <-\n Records.fetch(operation.records, operation.lease) do\n case current do\n {:error, _error} = error -> error\n _ -> Exchange.call(inbox, operation.lease.epoch, deadline, {kind, operation.lease})\n end\n end\n\n normalize(outcome, phase)\n end\n\n defp inbox_context(operation, %Inbox{} = inbox, kind) do\n with :ok <- Inbox.validate(inbox) do\n if inbox.owner == operation.records.pool.owner and kind in inbox.kinds,\n do: :ok,\n else: failure(:wrong_operation)\n end\n end\n\n defp deadline(options) do\n options = Keyword.validate!(options, timeout: 5000)\n Deadline.new(options[:timeout])\n end\n\n defp normalize({:error, %Error{} = error}, phase) do\n certainty = if error.certainty == :no_write, do: :unknown, else: error.certainty\n {:error, %{error | phase: phase, certainty: certainty}}\n end\n\n defp normalize(outcome, _phase), do: outcome\n defp unwrap({:ok, value}), do: value\n defp unwrap({:error, %Error{} = error}), do: raise(error)\n defp unwrap(value), do: value\n defp failure(kind), do: {:error, %Error{kind: kind, certainty: :unknown}}\nend\n" }, "lib/libtmux/protocol.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "09417df9a7423bcefc10abec1c8fbcce5da572ef8d71c06113bedf83ef2b0713", - "content": "defmodule LibTmux.Protocol do\n @moduledoc \"\"\"\n Assembles bounded control-mode replies and lexical notifications from bytes.\n\n Reply guards retain timestamp, command number and flags. Inside a block,\n notification-looking output stays data. The parser cannot authenticate\n injected matching guards: shared lanes must separately qualify commands,\n hooks and subscription expansion. Notification payloads need semantic\n validation before they can update a graph.\n\n A parse error retains already completed events in `error.details.events`.\n Its owner must retire the lane rather than reuse the rejected state.\n \"\"\"\n\n alias LibTmux.Error\n\n @limits %{\n max_chunk_bytes: 65_536,\n max_line_bytes: 65_536,\n max_frame_bytes: 262_144,\n max_frame_lines: 4096,\n max_events: 1024\n }\n\n @notifications %{\n \"client-detached\" => :client_detached,\n \"client-session-changed\" => :client_session_changed,\n \"config-error\" => :config_error,\n \"continue\" => :continue,\n \"exit\" => :exit,\n \"extended-output\" => :extended_output,\n \"layout-change\" => :layout_change,\n \"message\" => :message,\n \"output\" => :output,\n \"pane-mode-changed\" => :pane_mode_changed,\n \"pause\" => :pause,\n \"session-changed\" => :session_changed,\n \"session-renamed\" => :session_renamed,\n \"session-window-changed\" => :session_window_changed,\n \"sessions-changed\" => :sessions_changed,\n \"subscription-changed\" => :subscription_changed,\n \"unlinked-window-add\" => :unlinked_window_add,\n \"unlinked-window-close\" => :unlinked_window_close,\n \"unlinked-window-renamed\" => :unlinked_window_renamed,\n \"window-add\" => :window_add,\n \"window-close\" => :window_close,\n \"window-pane-changed\" => :window_pane_changed,\n \"window-renamed\" => :window_renamed\n }\n\n defstruct carry: \"\", guard: nil, lines: [], frame_bytes: 0, frame_lines: 0, limits: @limits\n\n @typedoc \"A complete tmux reply guard: timestamp, command number and flags, retained for correlation.\"\n @type guard_id :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}\n @typedoc \"A framed reply or lexical notification. Payloads still require semantic validation before graph updates.\"\n @type event ::\n {:reply, :ok | :error, guard_id(), [binary()]}\n | {:notification, atom(), binary()}\n | {:unknown, binary()}\n @typedoc \"Immutable parser carry and bounded in-flight frame state; discard it after any parse error.\"\n @opaque t :: %__MODULE__{}\n @typedoc \"A positive parser ceiling, measured in bytes, lines or emitted events as named.\"\n @type option ::\n {:max_chunk_bytes | :max_line_bytes | :max_frame_bytes | :max_frame_lines | :max_events,\n pos_integer()}\n\n @doc \"Constructs a parser with positive byte, line and event limits.\"\n @spec new([option()]) :: t()\n def new(options \\\\ []) do\n limits = options |> Keyword.validate!(Map.to_list(@limits)) |> Map.new()\n\n Enum.each(limits, fn {key, value} ->\n unless is_integer(value) and value > 0,\n do: raise(ArgumentError, \"#{key} must be a positive integer\")\n end)\n\n %__MODULE__{limits: limits}\n end\n\n @doc \"Consumes one byte chunk without performing I/O.\"\n @spec feed(t(), binary()) :: {:ok, [event()], t()} | {:error, Error.t()}\n def feed(%__MODULE__{} = state, chunk) when is_binary(chunk) do\n if byte_size(chunk) > state.limits.max_chunk_bytes do\n error(:resource_limit, :chunk_bytes, [])\n else\n parse(%{state | carry: \"\"}, state.carry <> chunk, [], 0)\n end\n end\n\n @doc \"Rejects a stream ending inside a line or reply block.\"\n @spec finish(t()) :: :ok | {:error, Error.t()}\n def finish(%__MODULE__{carry: \"\", guard: nil}), do: :ok\n def finish(%__MODULE__{}), do: error(:protocol_error, :truncated_stream, [])\n\n defp parse(state, buffer, events, count) do\n case :binary.match(buffer, \"\\n\") do\n :nomatch ->\n if byte_size(buffer) > state.limits.max_line_bytes,\n do: error(:resource_limit, :line_bytes, events),\n else: {:ok, Enum.reverse(events), %{state | carry: :binary.copy(buffer)}}\n\n {size, 1} ->\n if size > state.limits.max_line_bytes do\n error(:resource_limit, :line_bytes, events)\n else\n <> = buffer\n\n case line(state, line) do\n {:ok, next, nil} ->\n parse(next, rest, events, count)\n\n {:ok, _next, _event} when count >= state.limits.max_events ->\n error(:resource_limit, :events, events)\n\n {:ok, next, event} ->\n parse(next, rest, [event | events], count + 1)\n\n {:error, kind, reason} ->\n error(kind, reason, events)\n end\n end\n end\n end\n\n defp line(%{guard: nil} = state, line) do\n case guard(line) do\n {:ok, \"%begin\", id} ->\n {:ok, %{state | guard: id}, nil}\n\n {:ok, _end, _id} ->\n {:error, :protocol_error, :unexpected_guard}\n\n :invalid ->\n {:error, :protocol_error, :invalid_guard}\n\n :none ->\n {:ok, state, notification(line)}\n end\n end\n\n defp line(state, line) do\n case guard(line) do\n {:ok, kind, id} when kind in [\"%end\", \"%error\"] and id == state.guard ->\n status = if kind == \"%end\", do: :ok, else: :error\n event = {:reply, status, id, Enum.reverse(state.lines)}\n {:ok, %{state | guard: nil, lines: [], frame_bytes: 0, frame_lines: 0}, event}\n\n _ ->\n bytes = state.frame_bytes + byte_size(line) + 1\n lines = state.frame_lines + 1\n\n if bytes > state.limits.max_frame_bytes or lines > state.limits.max_frame_lines do\n {:error, :resource_limit, :frame_size}\n else\n {:ok,\n %{\n state\n | lines: [:binary.copy(line) | state.lines],\n frame_bytes: bytes,\n frame_lines: lines\n }, nil}\n end\n end\n end\n\n defp guard(line) do\n case :binary.split(line, \" \") do\n [kind, rest] when kind in [\"%begin\", \"%end\", \"%error\"] and byte_size(rest) <= 62 ->\n guard_values(kind, rest)\n\n [kind | _] when kind in [\"%begin\", \"%end\", \"%error\"] ->\n :invalid\n\n _ ->\n :none\n end\n end\n\n defp guard_values(kind, rest) do\n case :binary.split(rest, \" \", [:global]) do\n [time, number, flags] ->\n with {:ok, time} <- unsigned(time),\n {:ok, number} <- unsigned(number),\n {:ok, flags} <- unsigned(flags) do\n {:ok, kind, {time, number, flags}}\n else\n _ -> :invalid\n end\n\n _ ->\n :invalid\n end\n end\n\n defp unsigned(value) when byte_size(value) in 1..20 do\n if Enum.all?(:binary.bin_to_list(value), &(&1 in ?0..?9)),\n do: {:ok, String.to_integer(value)},\n else: :invalid\n end\n\n defp unsigned(_value), do: :invalid\n\n defp notification(<<\"%\", body::binary>> = raw) do\n [name | rest] = :binary.split(body, \" \")\n\n case Map.fetch(@notifications, name) do\n {:ok, name} -> {:notification, name, Enum.at(rest, 0, \"\") |> :binary.copy()}\n :error -> {:unknown, :binary.copy(raw)}\n end\n end\n\n defp notification(raw), do: {:unknown, :binary.copy(raw)}\n\n defp error(kind, reason, events) do\n {:error,\n %Error{\n kind: kind,\n phase: :parse,\n path: [:control],\n details: %{reason: reason, events: Enum.reverse(events)}\n }}\n end\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "d391c9b1a5560fca17a090a007260aaf20be4f995b7e1fecf3ac99662abecf3c", + "content": "defmodule LibTmux.Protocol do\n @moduledoc \"\"\"\n Assembles bounded control-mode replies and lexical notifications from bytes.\n\n Reply guards retain timestamp, command number and flags. Inside a block,\n notification-looking output stays data. The parser cannot authenticate\n injected matching guards: shared lanes must separately qualify commands,\n hooks and subscription expansion. Notification payloads need semantic\n validation before they can update a graph.\n\n A parse error retains already completed events in `error.details.events`.\n Its owner must retire the lane rather than reuse the rejected state.\n \"\"\"\n\n alias LibTmux.Error\n\n @limits %{\n max_chunk_bytes: 65_536,\n max_line_bytes: 65_536,\n max_frame_bytes: 262_144,\n max_frame_lines: 4096,\n max_events: 1024\n }\n\n @notifications %{\n \"client-detached\" => :client_detached,\n \"client-session-changed\" => :client_session_changed,\n \"config-error\" => :config_error,\n \"continue\" => :continue,\n \"exit\" => :exit,\n \"extended-output\" => :extended_output,\n \"layout-change\" => :layout_change,\n \"message\" => :message,\n \"output\" => :output,\n \"pane-mode-changed\" => :pane_mode_changed,\n \"pause\" => :pause,\n \"session-changed\" => :session_changed,\n \"session-renamed\" => :session_renamed,\n \"session-window-changed\" => :session_window_changed,\n \"sessions-changed\" => :sessions_changed,\n \"subscription-changed\" => :subscription_changed,\n \"unlinked-window-add\" => :unlinked_window_add,\n \"unlinked-window-close\" => :unlinked_window_close,\n \"unlinked-window-renamed\" => :unlinked_window_renamed,\n \"window-add\" => :window_add,\n \"window-close\" => :window_close,\n \"window-pane-changed\" => :window_pane_changed,\n \"window-renamed\" => :window_renamed\n }\n\n defstruct carry: \"\", guard: nil, lines: [], frame_bytes: 0, frame_lines: 0, limits: @limits\n\n @typedoc \"A complete tmux reply guard: timestamp, command number and flags, retained for correlation.\"\n @type guard_id :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}\n @typedoc \"A framed reply or lexical notification. Payloads still require semantic validation before graph updates.\"\n @type event ::\n {:reply, :ok | :error, guard_id(), [binary()]}\n | {:notification, atom(), binary()}\n | {:unknown, binary()}\n @typedoc \"Immutable parser carry and bounded in-flight frame state; discard it after any parse error.\"\n @opaque t :: %__MODULE__{}\n @typedoc \"A positive parser ceiling, measured in bytes, lines or emitted events as named.\"\n @type option ::\n {:max_chunk_bytes | :max_line_bytes | :max_frame_bytes | :max_frame_lines | :max_events,\n pos_integer()}\n\n @doc \"\"\"\n Constructs a parser with positive byte, line and event limits.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec new([option()]) :: t()\n def new(options \\\\ []) do\n limits = options |> Keyword.validate!(Map.to_list(@limits)) |> Map.new()\n\n Enum.each(limits, fn {key, value} ->\n unless is_integer(value) and value > 0,\n do: raise(ArgumentError, \"#{key} must be a positive integer\")\n end)\n\n %__MODULE__{limits: limits}\n end\n\n @doc \"\"\"\n Consumes one byte chunk without performing I/O.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec feed(t(), binary()) :: {:ok, [event()], t()} | {:error, Error.t()}\n def feed(%__MODULE__{} = state, chunk) when is_binary(chunk) do\n if byte_size(chunk) > state.limits.max_chunk_bytes do\n error(:resource_limit, :chunk_bytes, [])\n else\n parse(%{state | carry: \"\"}, state.carry <> chunk, [], 0)\n end\n end\n\n @doc \"\"\"\n Rejects a stream ending inside a line or reply block.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec finish(t()) :: :ok | {:error, Error.t()}\n def finish(%__MODULE__{carry: \"\", guard: nil}), do: :ok\n def finish(%__MODULE__{}), do: error(:protocol_error, :truncated_stream, [])\n\n defp parse(state, buffer, events, count) do\n case :binary.match(buffer, \"\\n\") do\n :nomatch ->\n if byte_size(buffer) > state.limits.max_line_bytes,\n do: error(:resource_limit, :line_bytes, events),\n else: {:ok, Enum.reverse(events), %{state | carry: :binary.copy(buffer)}}\n\n {size, 1} ->\n if size > state.limits.max_line_bytes do\n error(:resource_limit, :line_bytes, events)\n else\n <> = buffer\n\n case line(state, line) do\n {:ok, next, nil} ->\n parse(next, rest, events, count)\n\n {:ok, _next, _event} when count >= state.limits.max_events ->\n error(:resource_limit, :events, events)\n\n {:ok, next, event} ->\n parse(next, rest, [event | events], count + 1)\n\n {:error, kind, reason} ->\n error(kind, reason, events)\n end\n end\n end\n end\n\n defp line(%{guard: nil} = state, line) do\n case guard(line) do\n {:ok, \"%begin\", id} ->\n {:ok, %{state | guard: id}, nil}\n\n {:ok, _end, _id} ->\n {:error, :protocol_error, :unexpected_guard}\n\n :invalid ->\n {:error, :protocol_error, :invalid_guard}\n\n :none ->\n {:ok, state, notification(line)}\n end\n end\n\n defp line(state, line) do\n case guard(line) do\n {:ok, kind, id} when kind in [\"%end\", \"%error\"] and id == state.guard ->\n status = if kind == \"%end\", do: :ok, else: :error\n event = {:reply, status, id, Enum.reverse(state.lines)}\n {:ok, %{state | guard: nil, lines: [], frame_bytes: 0, frame_lines: 0}, event}\n\n _ ->\n bytes = state.frame_bytes + byte_size(line) + 1\n lines = state.frame_lines + 1\n\n if bytes > state.limits.max_frame_bytes or lines > state.limits.max_frame_lines do\n {:error, :resource_limit, :frame_size}\n else\n {:ok,\n %{\n state\n | lines: [:binary.copy(line) | state.lines],\n frame_bytes: bytes,\n frame_lines: lines\n }, nil}\n end\n end\n end\n\n defp guard(line) do\n case :binary.split(line, \" \") do\n [kind, rest] when kind in [\"%begin\", \"%end\", \"%error\"] and byte_size(rest) <= 62 ->\n guard_values(kind, rest)\n\n [kind | _] when kind in [\"%begin\", \"%end\", \"%error\"] ->\n :invalid\n\n _ ->\n :none\n end\n end\n\n defp guard_values(kind, rest) do\n case :binary.split(rest, \" \", [:global]) do\n [time, number, flags] ->\n with {:ok, time} <- unsigned(time),\n {:ok, number} <- unsigned(number),\n {:ok, flags} <- unsigned(flags) do\n {:ok, kind, {time, number, flags}}\n else\n _ -> :invalid\n end\n\n _ ->\n :invalid\n end\n end\n\n defp unsigned(value) when byte_size(value) in 1..20 do\n if Enum.all?(:binary.bin_to_list(value), &(&1 in ?0..?9)),\n do: {:ok, String.to_integer(value)},\n else: :invalid\n end\n\n defp unsigned(_value), do: :invalid\n\n defp notification(<<\"%\", body::binary>> = raw) do\n [name | rest] = :binary.split(body, \" \")\n\n case Map.fetch(@notifications, name) do\n {:ok, name} -> {:notification, name, Enum.at(rest, 0, \"\") |> :binary.copy()}\n :error -> {:unknown, :binary.copy(raw)}\n end\n end\n\n defp notification(raw), do: {:unknown, :binary.copy(raw)}\n\n defp error(kind, reason, events) do\n {:error,\n %Error{\n kind: kind,\n phase: :parse,\n path: [:control],\n details: %{reason: reason, events: Enum.reverse(events)}\n }}\n end\nend\n" }, "lib/libtmux/ref.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "8055eb6833915f11d449200f6fc7d2dea053c65231bb22c079a888baeee4f739", - "content": "defmodule LibTmux.Ref do\n @moduledoc \"\"\"\n An exact observed target bound to one server instance.\n\n A window-link ID is its observed `{session_id, index, window_id}` binding,\n not a unique lifetime identifier. Validation detects known stale instances;\n it does not reserve an object or close a one-shot check/use race.\n \"\"\"\n\n alias LibTmux.Error\n\n @enforce_keys [:entity, :id, :server_instance]\n defstruct [:entity, :id, :server_instance]\n\n @typedoc \"The target kind; physical windows and session-relative links have different identities.\"\n @type entity :: :session | :window | :pane | :window_link | :client\n @typedoc \"A native ID or observed session/index/window link binding; neither reserves an object's lifetime.\"\n @type id :: String.t() | {String.t(), non_neg_integer(), String.t()}\n @typedoc \"An exact observed identity bound to a tmux server incarnation, separate from a connection epoch.\"\n @type t :: %__MODULE__{entity: entity(), id: id(), server_instance: String.t()}\n\n @doc \"Validates a native identity and binds it to a nonempty instance token.\"\n @spec new(entity(), id(), String.t()) :: {:ok, t()} | {:error, Error.t()}\n def new(entity, id, instance) do\n if valid_id?(entity, id) and valid_token?(instance) do\n {:ok, %__MODULE__{entity: entity, id: id, server_instance: instance}}\n else\n {:error, %Error{kind: :invalid_target, certainty: :no_write, path: [:target]}}\n end\n end\n\n @doc \"Rejects malformed references and known server-instance mismatches.\"\n @spec validate(t(), String.t()) :: :ok | {:error, Error.t()}\n def validate(%__MODULE__{} = ref, instance) do\n case new(ref.entity, ref.id, ref.server_instance) do\n {:ok, _} when ref.server_instance == instance ->\n :ok\n\n {:ok, _} ->\n {:error, %Error{kind: :stale_target, certainty: :no_write, path: [:target]}}\n\n {:error, _} = error ->\n error\n end\n end\n\n defp valid_id?(:session, id), do: numbered_id?(id, ?$)\n defp valid_id?(:window, id), do: numbered_id?(id, ?@)\n defp valid_id?(:pane, id), do: numbered_id?(id, ?%)\n defp valid_id?(:client, id), do: valid_token?(id)\n\n defp valid_id?(:window_link, {session, index, window}) do\n numbered_id?(session, ?$) and is_integer(index) and index >= 0 and numbered_id?(window, ?@)\n end\n\n defp valid_id?(_entity, _id), do: false\n\n defp numbered_id?(<>, prefix) when byte_size(digits) in 1..20 do\n case Integer.parse(digits) do\n {number, \"\"} when number >= 0 -> Integer.to_string(number) == digits\n _ -> false\n end\n end\n\n defp numbered_id?(_id, _prefix), do: false\n\n defp valid_token?(value) when is_binary(value) and byte_size(value) in 1..256 do\n String.valid?(value) and :binary.match(value, [<<0>>, \"\\n\", \"\\r\"]) == :nomatch\n end\n\n defp valid_token?(_value), do: false\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "f6456c836a12991bf0316d368b159af569bdc4bd9f7ec6589f010fbb94bdc738", + "content": "defmodule LibTmux.Ref do\n @moduledoc \"\"\"\n An exact observed target bound to one server instance.\n\n A window-link ID is its observed `{session_id, index, window_id}` binding,\n not a unique lifetime identifier. Validation detects known stale instances;\n it does not reserve an object or close a one-shot check/use race.\n \"\"\"\n\n alias LibTmux.{Client, Error, Pane, Schema, Session, Window, WindowLink}\n\n @enforce_keys [:entity, :id, :server_instance]\n defstruct [:entity, :id, :server_instance]\n\n @typedoc \"The target kind; physical windows and session-relative links have different identities.\"\n @type entity :: :session | :window | :pane | :window_link | :client\n @typedoc \"A native ID or observed session/index/window link binding; neither reserves an object's lifetime.\"\n @type id :: String.t() | {String.t(), non_neg_integer(), String.t()}\n @typedoc \"An exact observed identity bound to a tmux server incarnation, separate from a connection epoch.\"\n @type t :: %__MODULE__{entity: entity(), id: id(), server_instance: String.t()}\n\n @doc \"\"\"\n Validates a native identity and binds it to a nonempty instance token.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec new(entity(), id(), String.t()) :: {:ok, t()} | {:error, Error.t()}\n def new(entity, id, instance) do\n if valid_id?(entity, id) and valid_token?(instance) do\n {:ok, %__MODULE__{entity: entity, id: id, server_instance: instance}}\n else\n {:error, %Error{kind: :invalid_target, certainty: :no_write, path: [:target]}}\n end\n end\n\n @doc \"\"\"\n Builds a reference from an observation's own identity and server instance.\n\n Validates the identity with `new/3` without I/O or a fresh observation.\n Malformed identities and other inputs return an `:invalid_target` error.\n Other captured fields may remain unloaded or unavailable. A reference does\n not prove that its target still exists. Window links retain their tuple\n binding and lifetime limitation; domain actions reject window-link refs.\n\n ## Examples\n\n iex> pane = %LibTmux.Pane{id: \"%7\", server_instance: \"instance-a\"}\n iex> {:ok, ref} = LibTmux.Ref.from_observation(pane)\n iex> {ref.entity, ref.id, ref.server_instance}\n {:pane, \"%7\", \"instance-a\"}\n \"\"\"\n @spec from_observation(Schema.observation()) :: {:ok, t()} | {:error, Error.t()}\n def from_observation(%Session{id: id, server_instance: instance}),\n do: new(:session, id, instance)\n\n def from_observation(%Window{id: id, server_instance: instance}),\n do: new(:window, id, instance)\n\n def from_observation(%WindowLink{id: id, server_instance: instance}),\n do: new(:window_link, id, instance)\n\n def from_observation(%Pane{id: id, server_instance: instance}),\n do: new(:pane, id, instance)\n\n def from_observation(%Client{id: id, server_instance: instance}),\n do: new(:client, id, instance)\n\n def from_observation(_observation),\n do: {:error, %Error{kind: :invalid_target, certainty: :no_write, path: [:target]}}\n\n @doc \"\"\"\n Rejects malformed references and known server-instance mismatches.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec validate(t(), String.t()) :: :ok | {:error, Error.t()}\n def validate(%__MODULE__{} = ref, instance) do\n case new(ref.entity, ref.id, ref.server_instance) do\n {:ok, _} when ref.server_instance == instance ->\n :ok\n\n {:ok, _} ->\n {:error, %Error{kind: :stale_target, certainty: :no_write, path: [:target]}}\n\n {:error, _} = error ->\n error\n end\n end\n\n defp valid_id?(:session, id), do: numbered_id?(id, ?$)\n defp valid_id?(:window, id), do: numbered_id?(id, ?@)\n defp valid_id?(:pane, id), do: numbered_id?(id, ?%)\n defp valid_id?(:client, id), do: valid_token?(id)\n\n defp valid_id?(:window_link, {session, index, window}) do\n numbered_id?(session, ?$) and is_integer(index) and index >= 0 and numbered_id?(window, ?@)\n end\n\n defp valid_id?(_entity, _id), do: false\n\n defp numbered_id?(<>, prefix) when byte_size(digits) in 1..20 do\n case Integer.parse(digits) do\n {number, \"\"} when number >= 0 -> Integer.to_string(number) == digits\n _ -> false\n end\n end\n\n defp numbered_id?(_id, _prefix), do: false\n\n defp valid_token?(value) when is_binary(value) and byte_size(value) in 1..256 do\n String.valid?(value) and :binary.match(value, [<<0>>, \"\\n\", \"\\r\"]) == :nomatch\n end\n\n defp valid_token?(_value), do: false\nend\n" }, "lib/libtmux/schema.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "5e2c436db61fa76ac945821ada8143a6a7450f293eae5d1115dabeecf2cd9bbe", - "content": "defmodule LibTmux.Schema do\n @moduledoc \"\"\"\n Defines observed fields, wire names and graph relations.\n\n The table is a semantic overlay on tmux 3.3 format variables. It drives\n observation validation, portable filtering and reference generation. Empty text\n remains text; only explicitly nullable fields admit `nil`.\n \"\"\"\n\n @typedoc \"An entity's canonical local name. Physical windows and membership links are distinct.\"\n @type entity :: :session | :window | :window_link | :pane | :client\n\n @typedoc \"The observation struct modules accepted alongside canonical entity names.\"\n @type entity_module ::\n LibTmux.Session | LibTmux.Window | LibTmux.WindowLink | LibTmux.Pane | LibTmux.Client\n\n @typedoc \"A canonical entity atom or its corresponding observation module.\"\n @type entity_selector :: entity() | entity_module()\n\n @typedoc \"A known value, unloaded coverage, or an unavailable capability; nil belongs to the value type.\"\n @type observed(value) :: value | :unloaded | :unavailable\n\n @typedoc \"One physical or contextual observation from a captured graph.\"\n @type observation ::\n LibTmux.Session.t()\n | LibTmux.Window.t()\n | LibTmux.WindowLink.t()\n | LibTmux.Pane.t()\n | LibTmux.Client.t()\n\n @typedoc \"A field's validation category; integer fields use the schema's nonnegative 32-bit range.\"\n @type value_type :: :string | :integer | :nullable_integer | :boolean | {:id, entity()}\n @typedoc \"Field metadata shared by validation and documentation; nil format identifies a derived field.\"\n @type field :: %{\n name: atom(),\n wire: String.t(),\n format: String.t() | nil,\n type: value_type(),\n since: String.t(),\n nullable: boolean()\n }\n @typedoc \"The cardinality and target entity of one indexed graph relation.\"\n @type relation :: {:one | :many, entity()}\n @typedoc \"A scalar filter operator; each field category permits only its applicable subset.\"\n @type operator ::\n :equals\n | :not\n | :in\n | :not_in\n | :lt\n | :lte\n | :gt\n | :gte\n | :contains\n | :starts_with\n | :ends_with\n\n @entities [:session, :window, :window_link, :pane, :client]\n @modules %{\n session: LibTmux.Session,\n window: LibTmux.Window,\n window_link: LibTmux.WindowLink,\n pane: LibTmux.Pane,\n client: LibTmux.Client\n }\n @fields %{\n session: [\n {:id, \"id\", \"session_id\", {:id, :session}},\n {:name, \"name\", \"session_name\", :string},\n {:attached_count, \"attachedCount\", \"session_attached\", :integer},\n {:attached, \"attached\", nil, :boolean}\n ],\n window: [\n {:id, \"id\", \"window_id\", {:id, :window}},\n {:name, \"name\", \"window_name\", :string},\n {:width, \"width\", \"window_width\", :integer},\n {:height, \"height\", \"window_height\", :integer},\n {:layout, \"layout\", \"window_layout\", :string},\n {:zoomed, \"zoomed\", \"window_zoomed_flag\", :boolean}\n ],\n window_link: [\n {:id, \"id\", nil, {:id, :window_link}},\n {:session_id, \"sessionId\", \"session_id\", {:id, :session}},\n {:window_id, \"windowId\", \"window_id\", {:id, :window}},\n {:index, \"index\", \"window_index\", :integer},\n {:active, \"active\", \"window_active\", :boolean}\n ],\n pane: [\n {:id, \"id\", \"pane_id\", {:id, :pane}},\n {:window_id, \"windowId\", \"window_id\", {:id, :window}},\n {:index, \"index\", \"pane_index\", :integer},\n {:active, \"active\", \"pane_active\", :boolean},\n {:dead, \"dead\", \"pane_dead\", :boolean},\n {:width, \"width\", \"pane_width\", :integer},\n {:height, \"height\", \"pane_height\", :integer},\n {:pid, \"pid\", \"pane_pid\", :integer},\n {:current_command, \"currentCommand\", \"pane_current_command\", :string},\n {:current_path, \"currentPath\", \"pane_current_path\", :string},\n {:title, \"title\", \"pane_title\", :string},\n {:exit_status, \"exitStatus\", \"pane_dead_status\", :nullable_integer}\n ],\n client: [\n {:id, \"id\", \"client_name\", {:id, :client}},\n {:session_id, \"sessionId\", \"session_id\", {:id, :session}},\n {:pid, \"pid\", \"client_pid\", :integer},\n {:width, \"width\", \"client_width\", :integer},\n {:height, \"height\", \"client_height\", :nullable_integer},\n {:control_mode, \"controlMode\", \"client_control_mode\", :boolean}\n ]\n }\n @relations %{\n session: %{\n active_window: {:one, :window},\n windows: {:many, :window},\n window_links: {:many, :window_link},\n panes: {:many, :pane},\n clients: {:many, :client}\n },\n window: %{\n sessions: {:many, :session},\n window_links: {:many, :window_link},\n panes: {:many, :pane}\n },\n pane: %{window: {:one, :window}},\n window_link: %{session: {:one, :session}, window: {:one, :window}},\n client: %{session: {:one, :session}}\n }\n @relation_names %{\n active_window: \"activeWindow\",\n windows: \"windows\",\n window_links: \"windowLinks\",\n panes: \"panes\",\n clients: \"clients\",\n sessions: \"sessions\",\n session: \"session\",\n window: \"window\"\n }\n\n @doc \"Returns supported entity names in a stable order.\"\n @spec entities() :: [entity()]\n def entities, do: @entities\n\n @doc \"Returns the ordinary observation struct module for an entity.\"\n @spec module(entity()) :: entity_module()\n def module(entity), do: Map.fetch!(@modules, entity)\n\n @doc \"Resolves an entity atom or its observation module.\"\n @spec entity(entity_selector()) :: entity()\n def entity(entity) when entity in @entities, do: entity\n\n def entity(module),\n do:\n Enum.find_value(@modules, fn {entity, value} -> if value == module, do: entity end) ||\n raise(ArgumentError, \"unknown entity\")\n\n @doc \"Returns the whitelisted field metadata for an entity.\"\n @spec fields(entity_selector()) :: %{atom() => field()}\n def fields(entity) do\n Map.new(Map.fetch!(@fields, entity(entity)), fn {name, wire, format, type} ->\n {name,\n %{\n name: name,\n wire: wire,\n format: format,\n type: type,\n since: \"3.3\",\n nullable: type == :nullable_integer\n }}\n end)\n end\n\n @doc \"Returns field metadata, or nil for a field outside the schema.\"\n @spec field(entity_selector(), atom()) :: field() | nil\n def field(entity, name), do: Map.get(fields(entity), name)\n\n @doc \"Returns each relation's cardinality and target entity.\"\n @spec relations(entity_selector()) :: %{atom() => relation()}\n def relations(entity), do: Map.fetch!(@relations, entity(entity))\n\n @doc \"Returns a relation's explicit stable wire name.\"\n @spec relation_wire(atom()) :: String.t()\n def relation_wire(name), do: Map.fetch!(@relation_names, name)\n\n @doc \"Returns the portable operators allowed by a scalar field's value category.\"\n @spec operators(field()) :: [operator()]\n def operators(%{type: type}) do\n [:equals, :not, :in, :not_in] ++\n case type do\n type when type in [:integer, :nullable_integer] -> [:lt, :lte, :gt, :gte]\n :string -> [:contains, :starts_with, :ends_with]\n _ -> []\n end\n end\n\n @doc false\n def valid_value?(%{nullable: true}, nil), do: true\n\n def valid_value?(%{type: type}, value) when type in [:integer, :nullable_integer],\n do: is_integer(value) and value in 0..2_147_483_647\n\n def valid_value?(%{type: :boolean}, value), do: is_boolean(value)\n\n def valid_value?(%{type: :string}, value),\n do: is_binary(value) and String.valid?(value) and :binary.match(value, <<0>>) == :nomatch\n\n def valid_value?(%{type: {:id, :window_link}}, {_session, index, _window} = value),\n do:\n is_integer(index) and index in 0..2_147_483_647 and\n match?({:ok, _}, LibTmux.Ref.new(:window_link, value, \"schema\"))\n\n def valid_value?(%{type: {:id, :window_link}}, _value), do: false\n\n def valid_value?(%{type: {:id, entity}}, value),\n do: match?({:ok, _}, LibTmux.Ref.new(entity, value, \"schema\"))\n\n def valid_value?(_field, _value), do: false\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "7f140b56ccf7cf86e2b420b5f1e0e3b3b08b6d22e5c7dda66926a07b77946178", + "content": "defmodule LibTmux.Schema do\n @moduledoc \"\"\"\n Defines observed fields, wire names and graph relations.\n\n The table is a semantic overlay on tmux 3.3 format variables. It drives\n observation validation, portable filtering and reference generation. Empty text\n remains text; only explicitly nullable fields admit `nil`.\n \"\"\"\n\n @typedoc \"An entity's canonical local name. Physical windows and membership links are distinct.\"\n @type entity :: :session | :window | :window_link | :pane | :client\n\n @typedoc \"The observation struct modules accepted alongside canonical entity names.\"\n @type entity_module ::\n LibTmux.Session | LibTmux.Window | LibTmux.WindowLink | LibTmux.Pane | LibTmux.Client\n\n @typedoc \"A canonical entity atom or its corresponding observation module.\"\n @type entity_selector :: entity() | entity_module()\n\n @typedoc \"A known value, unloaded coverage, or an unavailable capability; nil belongs to the value type.\"\n @type observed(value) :: value | :unloaded | :unavailable\n\n @typedoc \"One physical or contextual observation from a captured graph.\"\n @type observation ::\n LibTmux.Session.t()\n | LibTmux.Window.t()\n | LibTmux.WindowLink.t()\n | LibTmux.Pane.t()\n | LibTmux.Client.t()\n\n @typedoc \"A field's validation category; integer fields use the schema's nonnegative 32-bit range.\"\n @type value_type :: :string | :integer | :nullable_integer | :boolean | {:id, entity()}\n @typedoc \"Field metadata shared by validation and documentation; nil format identifies a derived field.\"\n @type field :: %{\n name: atom(),\n wire: String.t(),\n format: String.t() | nil,\n type: value_type(),\n since: String.t(),\n nullable: boolean()\n }\n @typedoc \"The cardinality and target entity of one indexed graph relation.\"\n @type relation :: {:one | :many, entity()}\n @typedoc \"A scalar filter operator; each field category permits only its applicable subset.\"\n @type operator ::\n :equals\n | :not\n | :in\n | :not_in\n | :lt\n | :lte\n | :gt\n | :gte\n | :contains\n | :starts_with\n | :ends_with\n\n @entities [:session, :window, :window_link, :pane, :client]\n @modules %{\n session: LibTmux.Session,\n window: LibTmux.Window,\n window_link: LibTmux.WindowLink,\n pane: LibTmux.Pane,\n client: LibTmux.Client\n }\n @fields %{\n session: [\n {:id, \"id\", \"session_id\", {:id, :session}},\n {:name, \"name\", \"session_name\", :string},\n {:attached_count, \"attachedCount\", \"session_attached\", :integer},\n {:attached, \"attached\", nil, :boolean}\n ],\n window: [\n {:id, \"id\", \"window_id\", {:id, :window}},\n {:name, \"name\", \"window_name\", :string},\n {:width, \"width\", \"window_width\", :integer},\n {:height, \"height\", \"window_height\", :integer},\n {:layout, \"layout\", \"window_layout\", :string},\n {:zoomed, \"zoomed\", \"window_zoomed_flag\", :boolean}\n ],\n window_link: [\n {:id, \"id\", nil, {:id, :window_link}},\n {:session_id, \"sessionId\", \"session_id\", {:id, :session}},\n {:window_id, \"windowId\", \"window_id\", {:id, :window}},\n {:index, \"index\", \"window_index\", :integer},\n {:active, \"active\", \"window_active\", :boolean}\n ],\n pane: [\n {:id, \"id\", \"pane_id\", {:id, :pane}},\n {:window_id, \"windowId\", \"window_id\", {:id, :window}},\n {:index, \"index\", \"pane_index\", :integer},\n {:active, \"active\", \"pane_active\", :boolean},\n {:dead, \"dead\", \"pane_dead\", :boolean},\n {:width, \"width\", \"pane_width\", :integer},\n {:height, \"height\", \"pane_height\", :integer},\n {:pid, \"pid\", \"pane_pid\", :nullable_integer},\n {:current_command, \"currentCommand\", \"pane_current_command\", :string},\n {:current_path, \"currentPath\", \"pane_current_path\", :string},\n {:title, \"title\", \"pane_title\", :string},\n {:exit_status, \"exitStatus\", \"pane_dead_status\", :nullable_integer}\n ],\n client: [\n {:id, \"id\", \"client_name\", {:id, :client}},\n {:session_id, \"sessionId\", \"session_id\", {:id, :session}},\n {:pid, \"pid\", \"client_pid\", :integer},\n {:width, \"width\", \"client_width\", :integer},\n {:height, \"height\", \"client_height\", :nullable_integer},\n {:control_mode, \"controlMode\", \"client_control_mode\", :boolean}\n ]\n }\n @relations %{\n session: %{\n active_window: {:one, :window},\n windows: {:many, :window},\n window_links: {:many, :window_link},\n panes: {:many, :pane},\n clients: {:many, :client}\n },\n window: %{\n sessions: {:many, :session},\n window_links: {:many, :window_link},\n panes: {:many, :pane}\n },\n pane: %{window: {:one, :window}},\n window_link: %{session: {:one, :session}, window: {:one, :window}},\n client: %{session: {:one, :session}}\n }\n @relation_names %{\n active_window: \"activeWindow\",\n windows: \"windows\",\n window_links: \"windowLinks\",\n panes: \"panes\",\n clients: \"clients\",\n sessions: \"sessions\",\n session: \"session\",\n window: \"window\"\n }\n\n @doc \"\"\"\n Returns supported entity names in a stable order.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec entities() :: [entity()]\n def entities, do: @entities\n\n @doc \"\"\"\n Returns the ordinary observation struct module for an entity.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec module(entity()) :: entity_module()\n def module(entity), do: Map.fetch!(@modules, entity)\n\n @doc \"\"\"\n Resolves an entity atom or its observation module.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec entity(entity_selector()) :: entity()\n def entity(entity) when entity in @entities, do: entity\n\n def entity(module),\n do:\n Enum.find_value(@modules, fn {entity, value} -> if value == module, do: entity end) ||\n raise(ArgumentError, \"unknown entity\")\n\n @doc \"\"\"\n Returns the whitelisted field metadata for an entity.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec fields(entity_selector()) :: %{atom() => field()}\n def fields(entity) do\n Map.new(Map.fetch!(@fields, entity(entity)), fn {name, wire, format, type} ->\n {name,\n %{\n name: name,\n wire: wire,\n format: format,\n type: type,\n since: \"3.3\",\n nullable: type == :nullable_integer\n }}\n end)\n end\n\n @doc \"\"\"\n Returns field metadata, or nil for a field outside the schema.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec field(entity_selector(), atom()) :: field() | nil\n def field(entity, name), do: Map.get(fields(entity), name)\n\n @doc \"\"\"\n Returns each relation's cardinality and target entity.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec relations(entity_selector()) :: %{atom() => relation()}\n def relations(entity), do: Map.fetch!(@relations, entity(entity))\n\n @doc \"\"\"\n Returns a relation's explicit stable wire name.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec relation_wire(atom()) :: String.t()\n def relation_wire(name), do: Map.fetch!(@relation_names, name)\n\n @doc \"\"\"\n Returns the portable operators allowed by a scalar field's value category.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec operators(field()) :: [operator()]\n def operators(%{type: type}) do\n [:equals, :not, :in, :not_in] ++\n case type do\n type when type in [:integer, :nullable_integer] -> [:lt, :lte, :gt, :gte]\n :string -> [:contains, :starts_with, :ends_with]\n _ -> []\n end\n end\n\n @doc false\n def valid_value?(%{nullable: true}, nil), do: true\n\n def valid_value?(%{type: type}, value) when type in [:integer, :nullable_integer],\n do: is_integer(value) and value in 0..2_147_483_647\n\n def valid_value?(%{type: :boolean}, value), do: is_boolean(value)\n\n def valid_value?(%{type: :string}, value),\n do: is_binary(value) and String.valid?(value) and :binary.match(value, <<0>>) == :nomatch\n\n def valid_value?(%{type: {:id, :window_link}}, {_session, index, _window} = value),\n do:\n is_integer(index) and index in 0..2_147_483_647 and\n match?({:ok, _}, LibTmux.Ref.new(:window_link, value, \"schema\"))\n\n def valid_value?(%{type: {:id, :window_link}}, _value), do: false\n\n def valid_value?(%{type: {:id, entity}}, value),\n do: match?({:ok, _}, LibTmux.Ref.new(entity, value, \"schema\"))\n\n def valid_value?(_field, _value), do: false\nend\n" }, "lib/libtmux/selection.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "bcab9130bc60096c5817bd1a54c7de0f6fe588aac5e0c93e6894602f6317e413", - "content": "defmodule LibTmux.Selection do\n @moduledoc \"\"\"\n An ordered, materialized Enumerable over one captured entity type.\n\n Enumeration never refreshes or performs I/O. `where/2` accepts predicate\n data; `filter/2` accepts unary Elixir functions with Enum truthiness.\n Holding a selection retains its snapshot graph. `Enum.to_list/1` projects\n ordinary values when graph context is no longer needed.\n \"\"\"\n\n alias LibTmux.{Error, Filter, Schema, Snapshot}\n @enforce_keys [:entity, :items, :count, :snapshot]\n defstruct [:entity, :items, :count, :snapshot]\n\n @typedoc \"An ordered selection retaining items of one observation type and their originating snapshot.\"\n @opaque t(item) :: %__MODULE__{\n entity: Schema.entity_module(),\n items: [item],\n count: non_neg_integer(),\n snapshot: Snapshot.t()\n }\n @typedoc \"A selection without a concrete observation type; use `t:t/1` to preserve item types.\"\n @type t :: t(Schema.observation())\n\n @doc \"Materializes the observed items of an entity without I/O.\"\n @spec new(Snapshot.t(), :session | LibTmux.Session) :: t(LibTmux.Session.t())\n @spec new(Snapshot.t(), :window | LibTmux.Window) :: t(LibTmux.Window.t())\n @spec new(Snapshot.t(), :pane | LibTmux.Pane) :: t(LibTmux.Pane.t())\n @spec new(Snapshot.t(), :window_link | LibTmux.WindowLink) :: t(LibTmux.WindowLink.t())\n @spec new(Snapshot.t(), :client | LibTmux.Client) :: t(LibTmux.Client.t())\n def new(%Snapshot{} = snapshot, entity) do\n entity = Schema.entity(entity)\n items = Snapshot.items(snapshot, entity)\n\n %__MODULE__{\n entity: Schema.module(entity),\n items: items,\n count: length(items),\n snapshot: snapshot\n }\n end\n\n @doc \"Returns cached materialized size in constant time.\"\n @spec size(t()) :: non_neg_integer()\n def size(%__MODULE__{count: count}), do: count\n\n @doc \"Filters validated data while retaining order and captured graph context.\"\n @spec where(t(item), Filter.input()) :: t(item) when item: Schema.observation()\n def where(%__MODULE__{} = selection, criteria) do\n filter(selection, predicate(selection, criteria))\n end\n\n @doc \"Filters with a unary local function; normal predicate exceptions propagate.\"\n @spec filter(t(item), (item -> as_boolean(term()))) :: t(item)\n when item: Schema.observation()\n def filter(%__MODULE__{} = selection, predicate) when is_function(predicate, 1) do\n items = Enum.filter(selection.items, predicate)\n %{selection | items: items, count: length(items)}\n end\n\n def filter(%__MODULE__{}, _predicate),\n do: raise(ArgumentError, \"filter requires a unary function\")\n\n @doc \"Checks native identity separately from Enumerable element membership.\"\n @spec member_id?(t(), LibTmux.Ref.id()) :: boolean()\n def member_id?(selection, id), do: Enum.any?(selection.items, &(&1.id == id))\n\n @doc \"Returns exactly one match, or a structured cardinality error; stops at the second match.\"\n @spec one(t(item), Filter.input()) :: {:ok, item} | {:error, Error.t()}\n when item: Schema.observation()\n def one(selection, criteria \\\\ []), do: cardinality(selection, criteria, false)\n\n @doc \"Returns exactly one match or raises its cardinality error.\"\n @spec one!(t(item), Filter.input()) :: item when item: Schema.observation()\n def one!(selection, criteria \\\\ []), do: unwrap(one(selection, criteria))\n\n @doc \"Returns one match or nil; a second match remains an error.\"\n @spec one_or_nil(t(item), Filter.input()) :: {:ok, item | nil} | {:error, Error.t()}\n when item: Schema.observation()\n def one_or_nil(selection, criteria \\\\ []), do: cardinality(selection, criteria, true)\n\n @doc \"Returns one match or nil, raising on multiple matches.\"\n @spec one_or_nil!(t(item), Filter.input()) :: item | nil when item: Schema.observation()\n def one_or_nil!(selection, criteria \\\\ []), do: unwrap(one_or_nil(selection, criteria))\n\n @doc \"Returns true on the first matching observed item.\"\n @spec exists?(t(), Filter.input()) :: boolean()\n def exists?(selection, criteria \\\\ []),\n do: Enum.any?(selection.items, predicate(selection, criteria))\n\n @doc \"Counts observed matching items; use size/1 for cached unfiltered size.\"\n @spec count(t(), Filter.input()) :: non_neg_integer()\n def count(selection, criteria \\\\ []),\n do: Enum.count(selection.items, predicate(selection, criteria))\n\n defp predicate(selection, criteria) do\n selection.entity |> Filter.new!(criteria) |> Filter.to_predicate(snapshot: selection.snapshot)\n end\n\n defp cardinality(selection, criteria, allow_nil) do\n predicate = predicate(selection, criteria)\n\n matches =\n Enum.reduce_while(selection.items, [], fn item, matches ->\n if predicate.(item) do\n case matches do\n [] -> {:cont, [item]}\n [_] -> {:halt, :multiple}\n end\n else\n {:cont, matches}\n end\n end)\n\n case matches do\n [item] ->\n {:ok, item}\n\n [] when allow_nil ->\n {:ok, nil}\n\n [] ->\n {:error, %Error{kind: :no_match, phase: :evaluation, certainty: :no_write}}\n\n :multiple ->\n {:error,\n %Error{\n kind: :multiple_matches,\n phase: :evaluation,\n certainty: :no_write,\n details: %{at_least: 2}\n }}\n end\n end\n\n defp unwrap({:ok, result}), do: result\n defp unwrap({:error, error}), do: raise(error)\nend\n\ndefimpl Enumerable, for: LibTmux.Selection do\n def reduce(%{items: items}, accumulator, reducer),\n do: Enumerable.List.reduce(items, accumulator, reducer)\n\n def count(%{count: count}), do: {:ok, count}\n def member?(_selection, _value), do: {:error, __MODULE__}\n def slice(_selection), do: {:error, __MODULE__}\nend\n\ndefimpl Inspect, for: LibTmux.Selection do\n import Inspect.Algebra\n\n def inspect(selection, _options) do\n concat([\n \"#LibTmux.Selection<\",\n selection.entity |> Module.split() |> List.last(),\n \" count=\",\n Integer.to_string(selection.count),\n \" snapshot=\",\n Integer.to_string(selection.snapshot.id),\n \">\"\n ])\n end\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "b6cd467f5c4807fcbd9df4dbfb5fdfe230c3f468c395b114724f798d5b4004d8", + "content": "defmodule LibTmux.Selection do\n @moduledoc \"\"\"\n An ordered, materialized Enumerable over one captured entity type.\n\n Enumeration never refreshes or performs I/O. `where/2` accepts predicate\n data; `filter/2` accepts unary Elixir functions with Enum truthiness.\n Holding a selection retains its snapshot graph. `Enum.to_list/1` projects\n ordinary values when graph context is no longer needed.\n \"\"\"\n\n alias LibTmux.{Error, Filter, Schema, Snapshot}\n @enforce_keys [:entity, :items, :count, :snapshot]\n defstruct [:entity, :items, :count, :snapshot]\n\n @typedoc \"An ordered selection retaining items of one observation type and their originating snapshot.\"\n @opaque t(item) :: %__MODULE__{\n entity: Schema.entity_module(),\n items: [item],\n count: non_neg_integer(),\n snapshot: Snapshot.t()\n }\n @typedoc \"A selection without a concrete observation type; use `t:t/1` to preserve item types.\"\n @type t :: t(Schema.observation())\n\n @doc \"\"\"\n Materializes the observed items of an entity without I/O.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec new(Snapshot.t(), :session | LibTmux.Session) :: t(LibTmux.Session.t())\n @spec new(Snapshot.t(), :window | LibTmux.Window) :: t(LibTmux.Window.t())\n @spec new(Snapshot.t(), :pane | LibTmux.Pane) :: t(LibTmux.Pane.t())\n @spec new(Snapshot.t(), :window_link | LibTmux.WindowLink) :: t(LibTmux.WindowLink.t())\n @spec new(Snapshot.t(), :client | LibTmux.Client) :: t(LibTmux.Client.t())\n def new(%Snapshot{} = snapshot, entity) do\n entity = Schema.entity(entity)\n items = Snapshot.items(snapshot, entity)\n\n %__MODULE__{\n entity: Schema.module(entity),\n items: items,\n count: length(items),\n snapshot: snapshot\n }\n end\n\n @doc \"\"\"\n Returns cached materialized size in constant time.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec size(t()) :: non_neg_integer()\n def size(%__MODULE__{count: count}), do: count\n\n @doc \"\"\"\n Filters validated data while retaining order and captured graph context.\n\n ## Examples\n\n One pane must satisfy both conditions inside `some`. Window `@0` has an\n active shell and an inactive editor; only `@1` has an active editor.\n See [filtering](filtering.html#predicate-grammar) for the complete semantics.\n\n iex> alias LibTmux.{Selection, Snapshot}\n iex> rows = %{window: [%{id: \"@0\"}, %{id: \"@1\"}], pane: [\n ...> %{id: \"%0\", window_id: \"@0\", active: true, current_command: \"bash\"},\n ...> %{id: \"%1\", window_id: \"@0\", active: false, current_command: \"nvim\"},\n ...> %{id: \"%2\", window_id: \"@1\", active: true, current_command: \"nvim\"}]}\n iex> {:ok, snapshot} = Snapshot.new(rows,\n ...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n ...> complete: [:pane], fields: %{pane: [:window_id, :active, :current_command]})\n iex> snapshot |> Snapshot.windows()\n ...> |> Selection.where(panes: [some: [active: true, current_command: \"nvim\"]])\n ...> |> Enum.map(& &1.id)\n [\"@1\"]\n \"\"\"\n @spec where(t(item), Filter.input()) :: t(item) when item: Schema.observation()\n def where(%__MODULE__{} = selection, criteria) do\n filter(selection, predicate(selection, criteria))\n end\n\n @doc \"\"\"\n Filters with a unary local function; normal predicate exceptions propagate.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec filter(t(item), (item -> as_boolean(term()))) :: t(item)\n when item: Schema.observation()\n def filter(%__MODULE__{} = selection, predicate) when is_function(predicate, 1) do\n items = Enum.filter(selection.items, predicate)\n %{selection | items: items, count: length(items)}\n end\n\n def filter(%__MODULE__{}, _predicate),\n do: raise(ArgumentError, \"filter requires a unary function\")\n\n @doc \"\"\"\n Checks native identity separately from Enumerable element membership.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec member_id?(t(), LibTmux.Ref.id()) :: boolean()\n def member_id?(selection, id), do: Enum.any?(selection.items, &(&1.id == id))\n\n @doc \"\"\"\n Returns exactly one match, or a structured cardinality error; stops at the second match.\n\n ## Examples\n\n iex> alias LibTmux.{Selection, Snapshot}\n iex> {:ok, snapshot} = Snapshot.new(%{pane: [%{id: \"%0\"}, %{id: \"%1\"}]},\n ...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n ...> fields: %{pane: [:id]})\n iex> panes = Snapshot.panes(snapshot)\n iex> {:ok, pane} = Selection.one(panes, id: \"%1\")\n iex> pane.id\n \"%1\"\n iex> {:error, error} = Selection.one(panes, id: \"%9\")\n iex> error.kind\n :no_match\n iex> {:error, error} = Selection.one(panes)\n iex> error.kind\n :multiple_matches\n \"\"\"\n @spec one(t(item), Filter.input()) :: {:ok, item} | {:error, Error.t()}\n when item: Schema.observation()\n def one(selection, criteria \\\\ []), do: cardinality(selection, criteria, false)\n\n @doc \"\"\"\n Returns exactly one match or raises its cardinality error.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec one!(t(item), Filter.input()) :: item when item: Schema.observation()\n def one!(selection, criteria \\\\ []), do: unwrap(one(selection, criteria))\n\n @doc \"\"\"\n Returns one match or nil; a second match remains an error.\n\n ## Examples\n\n iex> alias LibTmux.{Selection, Snapshot}\n iex> {:ok, snapshot} = Snapshot.new(%{pane: [%{id: \"%0\"}, %{id: \"%1\"}]},\n ...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n ...> fields: %{pane: [:id]})\n iex> panes = Snapshot.panes(snapshot)\n iex> Selection.one_or_nil(panes, id: \"%9\")\n {:ok, nil}\n iex> {:ok, pane} = Selection.one_or_nil(panes, id: \"%0\")\n iex> pane.id\n \"%0\"\n iex> {:error, error} = Selection.one_or_nil(panes)\n iex> error.kind\n :multiple_matches\n \"\"\"\n @spec one_or_nil(t(item), Filter.input()) :: {:ok, item | nil} | {:error, Error.t()}\n when item: Schema.observation()\n def one_or_nil(selection, criteria \\\\ []), do: cardinality(selection, criteria, true)\n\n @doc \"\"\"\n Returns one match or nil, raising on multiple matches.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec one_or_nil!(t(item), Filter.input()) :: item | nil when item: Schema.observation()\n def one_or_nil!(selection, criteria \\\\ []), do: unwrap(one_or_nil(selection, criteria))\n\n @doc \"\"\"\n Returns true on the first matching observed item.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec exists?(t(), Filter.input()) :: boolean()\n def exists?(selection, criteria \\\\ []),\n do: Enum.any?(selection.items, predicate(selection, criteria))\n\n @doc \"\"\"\n Counts observed matching items; use size/1 for cached unfiltered size.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec count(t(), Filter.input()) :: non_neg_integer()\n def count(selection, criteria \\\\ []),\n do: Enum.count(selection.items, predicate(selection, criteria))\n\n defp predicate(selection, criteria) do\n selection.entity |> Filter.new!(criteria) |> Filter.to_predicate(snapshot: selection.snapshot)\n end\n\n defp cardinality(selection, criteria, allow_nil) do\n predicate = predicate(selection, criteria)\n\n matches =\n Enum.reduce_while(selection.items, [], fn item, matches ->\n if predicate.(item) do\n case matches do\n [] -> {:cont, [item]}\n [_] -> {:halt, :multiple}\n end\n else\n {:cont, matches}\n end\n end)\n\n case matches do\n [item] ->\n {:ok, item}\n\n [] when allow_nil ->\n {:ok, nil}\n\n [] ->\n {:error, %Error{kind: :no_match, phase: :evaluation, certainty: :no_write}}\n\n :multiple ->\n {:error,\n %Error{\n kind: :multiple_matches,\n phase: :evaluation,\n certainty: :no_write,\n details: %{at_least: 2}\n }}\n end\n end\n\n defp unwrap({:ok, result}), do: result\n defp unwrap({:error, error}), do: raise(error)\nend\n\ndefimpl Enumerable, for: LibTmux.Selection do\n def reduce(%{items: items}, accumulator, reducer),\n do: Enumerable.List.reduce(items, accumulator, reducer)\n\n def count(%{count: count}), do: {:ok, count}\n def member?(_selection, _value), do: {:error, __MODULE__}\n def slice(_selection), do: {:error, __MODULE__}\nend\n\ndefimpl Inspect, for: LibTmux.Selection do\n import Inspect.Algebra\n\n def inspect(selection, _options) do\n concat([\n \"#LibTmux.Selection<\",\n selection.entity |> Module.split() |> List.last(),\n \" count=\",\n Integer.to_string(selection.count),\n \" snapshot=\",\n Integer.to_string(selection.snapshot.id),\n \">\"\n ])\n end\nend\n" }, "lib/libtmux/server.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "8174ab2224e12a3f36b9f6884d6b92a39f1725b7bc4b4f4b1740a3aed9debf9f", - "content": "defmodule LibTmux.Server do\n @moduledoc \"\"\"\n An explicit local tmux server descriptor.\n\n `new/1` performs no I/O. One-shot commands use an absolute executable and\n socket with `-N`, so they cannot start a missing server or attach a client.\n Configured server hooks remain environmental effects. Reads observe an\n interval; one-shot identity checks leave a check/use race. Persistent\n incarnation-bound mutations require a separately qualified connection.\n \"\"\"\n\n alias LibTmux.{Capture, Command, Error}\n alias LibTmux.Transport.OneShot\n @enforce_keys [:executable, :socket, :cwd, :env]\n @derive {Inspect, only: []}\n defstruct [:executable, :socket, :cwd, :env]\n\n @typedoc \"An explicit local server descriptor; constructing it neither connects nor reserves server identity.\"\n @type t :: %__MODULE__{\n executable: String.t(),\n socket: String.t(),\n cwd: String.t(),\n env: %{optional(binary()) => binary()}\n }\n @typedoc \"Descriptor inputs; executable, socket and cwd are absolute NUL-free paths.\"\n @type option ::\n {:executable | :socket | :cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n\n @doc \"Constructs a descriptor for an existing server without connecting or creating it.\"\n @spec new([option()]) :: t()\n def new(options) do\n options =\n Keyword.validate!(options, [:executable, :socket, cwd: File.cwd!(), env: System.get_env()])\n\n executable = Keyword.fetch!(options, :executable)\n socket = Keyword.fetch!(options, :socket)\n\n unless Enum.all?([executable, socket, options[:cwd]], fn value ->\n is_binary(value) and Path.type(value) == :absolute and\n :binary.match(value, <<0>>) == :nomatch\n end),\n do:\n raise(\n ArgumentError,\n \"server executable, socket and cwd must be absolute NUL-free paths\"\n )\n\n %__MODULE__{executable: executable, socket: socket, cwd: options[:cwd], env: options[:env]}\n end\n\n @doc \"Runs one trusted command without attaching; returns bounded output and exit evidence.\"\n @spec run(t(), Command.t(), [OneShot.option()]) :: {:ok, OneShot.result()} | {:error, Error.t()}\n def run(%__MODULE__{} = server, %Command{} = command, options \\\\ []) do\n arguments = [\"-N\", \"-u\", \"-S\", server.socket | Command.argv(command)]\n options = Keyword.merge([cwd: server.cwd, env: server.env], options)\n\n case OneShot.run(server.executable, arguments, options) do\n {:ok, %{exit_status: 0} = result} ->\n {:ok, result}\n\n {:ok, result} ->\n code =\n if Regex.match?(~r/\\Acan't find (?:pane|window|session):/, result.stderr),\n do: :not_found,\n else: :other\n\n {:error,\n %Error{kind: :command_error, phase: :command, details: Map.put(result, :code, code)}}\n\n {:error, _} = error ->\n error\n end\n end\n\n @doc \"Captures a new graph explicitly, with bounded work and read retries.\"\n @spec snapshot(t(), [Capture.option()]) :: {:ok, LibTmux.Snapshot.t()} | {:error, Error.t()}\n def snapshot(server, options \\\\ []), do: Capture.fetch(server, options)\n\n @doc \"Captures a graph or raises the same structured capture error.\"\n @spec snapshot!(t(), [Capture.option()]) :: LibTmux.Snapshot.t()\n def snapshot!(server, options \\\\ []) do\n case snapshot(server, options) do\n {:ok, snapshot} -> snapshot\n {:error, error} -> raise error\n end\n end\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "b7ea7f92dffece1f88a4aafdfd66a9b9be52275cce94a73ee20eaae17488a01d", + "content": "defmodule LibTmux.Server do\n @moduledoc \"\"\"\n Describes a local tmux server for capturing state and running commands.\n\n `new/1` takes an absolute `:executable` path. Use\n `System.find_executable/1` to resolve a name such as `\"tmux\"` through PATH\n before construction. The optional `:cwd` and `:env` default to the caller's\n working directory and environment. Construction validates the path forms\n without checking that the executable or socket exists. A Server is an\n immutable value; constructing one with `new/1` neither connects to tmux nor\n starts it. Commands use `-N`, so a missing daemon is never started\n implicitly. `start/1` and `with_owned/2` start a private server and return\n a Server that `stop/2` can retire.\n\n ## Choosing the server\n\n `new/1` picks the socket in this order, and the first rule that applies\n wins:\n\n 1. `:socket`, an absolute socket path, passes `-S`.\n 2. `:socket_name`, a socket name, passes `-L`. Pass at most one of\n `:socket` and `:socket_name`.\n 3. The `LIBTMUX_SOCKET_PATH` variable passes `-S` with its path.\n 4. The `LIBTMUX_SOCKET` variable passes `-L` with its name.\n 5. Otherwise no socket is passed, and tmux chooses. It follows the server\n that `TMUX` names when `:env` has one, and otherwise uses its default\n socket: `default` in the `tmux-UID` directory of `TMUX_TMPDIR`, or of\n `/tmp`.\n\n An explicit option ignores both variables, even an invalid one. When both\n variables are set, the path wins, as `-S` does over `-L` in tmux. A variable\n that is empty counts as unset, each one alone. The variables come from the\n `:env` option, which defaults to the caller's environment, so a Server built\n with its own `:env` ignores the caller's variables. A set variable with an\n invalid value raises `ArgumentError` that names the variable and never\n repeats its value.\n\n The choice is made once, in `new/1`, and `t:t/0` records it. A Server that\n chose a socket removes `TMUX` and `TMUX_PANE` from the environment it gives\n tmux, so a surrounding tmux session cannot redirect it. A Server that chose\n none keeps both, for one-shot execution and for control connections alike,\n so a program run inside tmux reaches the server it runs in. Leave `TMUX` out\n of `:env` to send a Server with no socket to tmux's default socket instead.\n\n ## What is on here\n\n Server describes the endpoint. In Elixir, observation, selection and action\n functions live in their own modules. Start with these groups:\n\n **Connecting.** Describe the server for one-shot commands, which do not attach\n a client. Attach a control client to an existing session for the length of a\n callback; the client closes afterwards. Run a control client under application\n supervision. See the [managed control guide](managed-control.html) for\n connection setup and the host's hook and command-alias requirements.\n\n - Describe: `new/1`\n - Attach for a callback: `LibTmux.Control.with_connection/2`\n - Supervise: `LibTmux.Control.start_link/1`, `LibTmux.Control.child_spec/1`\n\n **Owning a private server.** Start a tmux server in a private directory,\n with no inherited `TMUX` or `TMUX_PANE`, and stop it when you are done.\n `with_owned/2` does both around a function, so a program needs no shell step\n to start or clean up tmux. The process that starts the server owns it, and the\n server stops when that process exits. `stop/2` refuses a Server that\n `start/1` did not create; `kill/2` sends `kill-server` to any Server.\n\n - Start and stop around a function: `with_owned/2`\n - Start: `start/1`\n - Stop: `stop/2`\n - Kill any server: `kill/2`\n - Raise on failure: `kill!/2`\n\n **Finding one thing.** Capture a snapshot, then require one match or allow no\n match. Both reject multiple matches. Turn the chosen observation into a\n reference tied to the daemon that supplied it, ready for an action.\n\n - Capture: `snapshot/2`\n - Require one: `LibTmux.Selection.one/2`\n - Allow none: `LibTmux.Selection.one_or_nil/2`\n - Reference: `LibTmux.Ref.from_observation/1`\n\n **Listing everything.** Capture sessions, physical windows, window links, panes\n and attached clients as a `LibTmux.Snapshot`. One accessor per kind returns a\n selection from that captured graph without contacting tmux again. Capture\n failures return an error, not an empty server. Capture covers an interval\n rather than an atomic transaction; take another snapshot when fresh state is\n needed.\n\n - Capture: `snapshot/2`\n - Select: `LibTmux.Snapshot.sessions/1`, `LibTmux.Snapshot.windows/1`,\n `LibTmux.Snapshot.window_links/1`, `LibTmux.Snapshot.panes/1`,\n `LibTmux.Snapshot.clients/1`\n\n **Querying things and getting around.** Select by criteria such as\n `active: true`, or by an Elixir function; selections work with `Enum` and\n `Stream`. Navigation functions use the supplied snapshot. Plural helpers return\n selections for further filtering; a `LibTmux.WindowLink` preserves a window's\n membership in one session.\n\n - By criteria: `LibTmux.Selection.where/2`\n - By function: `LibTmux.Selection.filter/2`\n - Down: `LibTmux.Session.windows/2`, `LibTmux.Session.panes/2`,\n `LibTmux.Window.panes/2`\n - Focused: `LibTmux.Session.active_window/2`\n - Other relationships: `LibTmux.Snapshot.related/4`\n\n **Changing things.** Create detached sessions and windows on an existing server\n using one-shot execution. Each returns the created ID with `ref: nil`; capture\n a fresh observation to obtain a reference. Split a pane to create a pane and\n get its ID in the completed result. A qualified Control connection also\n supplies a bound reference; one-shot split returns `ref: nil`. Rename a session\n or a window. Send literal bytes or named keys such as `\"Enter\"` to a pane.\n Split, rename and input take a Server or Control connection followed by a\n reference. Domain bang variants return completed values or raise; nonbang\n variants return `{:ok, result}` for completed commands and `{:error, error}`\n otherwise. See the [action guide](one-shot-actions.html) and\n [recovery guide](recovery.html).\n\n - Create: `new_session/3`, `LibTmux.Session.new_window/4`\n - Split: `LibTmux.Pane.split/3`\n - Rename: `LibTmux.Session.rename/4`, `LibTmux.Window.rename/4`\n - Send literal bytes: `LibTmux.Pane.send_text/4`\n - Send named keys: `LibTmux.Pane.send_keys/4`\n\n **Reading screens, options and formats.** Capture pane screen bytes through\n one-shot execution, which requires a Server. On a control connection, execute a\n request that reads a field or writes a server user option. Submit the request\n and keep the returned `LibTmux.Operation` when the result needs to remain\n available for independent inspection.\n\n - Screen: `LibTmux.Pane.capture/3`\n - Execute: `LibTmux.Control.execute/3`\n - Read a field: `LibTmux.Control.Request.field/2`\n - Write a user option: `LibTmux.Control.Request.set_user_option/2`\n - Submit: `LibTmux.Control.submit/3`\n\n **Running any other command.** Build a command to run any other tmux command.\n Running executes one command with literal arguments and returns bounded output\n and exit evidence. Configured server hooks can still run. Targeted one-shot\n actions check the observed server identity before writing, leaving a race if\n the daemon is replaced between that check and the command. Use a qualified\n Control connection for mutations bound to one daemon instance.\n\n - Build: `LibTmux.Command.new/2`\n - Run: `run/3`\n\n ## Examples\n\n Start a private server for the length of a function. This creates a\n session, lists its panes, and leaves nothing behind:\n\n alias LibTmux.{Selection, Server, Snapshot}\n\n tmux = System.find_executable(\"tmux\")\n\n Server.with_owned([executable: tmux], fn server ->\n {:ok, _} = Server.new_session(server, \"demo\", command: {:argv, [\"/bin/cat\"]})\n\n server\n |> Server.snapshot!()\n |> Snapshot.panes()\n |> Enum.map(& &1.id)\n end)\n\n The result is `[\"%0\"]`. To inspect a server that already runs, set\n `executable` to the absolute tmux executable and `socket` to the\n absolute socket path of that server. Leave out\n `socket` to follow `LIBTMUX_SOCKET_PATH`, `LIBTMUX_SOCKET` or tmux's default\n socket. This example captures once and lists each physical window's active\n pane:\n\n alias LibTmux.{Selection, Server, Snapshot}\n\n server =\n Server.new(\n executable: executable,\n socket: socket,\n env: Map.drop(System.get_env(), [\"TMUX\", \"TMUX_PANE\"])\n )\n\n snapshot = Server.snapshot!(server)\n\n snapshot\n |> Snapshot.panes()\n |> Selection.where(active: true)\n |> Enum.map(& &1.id)\n\n The result is a list of pane IDs, such as `[\"%0\", \"%2\"]`, with linked\n windows counted once. The [capture and filter guide](first-task.html) has\n a complete command-line program. For an isolated server and cleanup, use\n the [owned-server recipe](owned-server.html).\n \"\"\"\n\n alias LibTmux.{Capture, Command, Error}\n alias LibTmux.Transport.OneShot\n\n @invalid_paths \"server executable, socket and cwd must be absolute NUL-free paths\"\n @invalid_name \"one file name with no slash or NUL byte, and not a dot directory entry\"\n\n @enforce_keys [:executable, :cwd, :env]\n @derive {Inspect, only: []}\n defstruct [:executable, :socket, :socket_name, :cwd, :env, :daemon]\n\n @typedoc \"\"\"\n A local server descriptor; constructing it neither connects nor reserves server identity.\n\n At most one of `:socket` and `:socket_name` is set. Both are `nil` when tmux\n chooses its default socket. `daemon` names the process that owns a server\n created by `start/1`, and is `nil` for every other Server.\n \"\"\"\n @type t :: %__MODULE__{\n executable: String.t(),\n socket: String.t() | nil,\n socket_name: String.t() | nil,\n cwd: String.t(),\n env: %{optional(binary()) => binary()},\n daemon: pid() | nil\n }\n @typedoc \"\"\"\n Descriptor inputs.\n\n The executable, `:socket` and cwd are absolute NUL-free paths. `:socket_name`\n is a single file name without a slash or NUL that is not `.` or `..`.\n \"\"\"\n @type option ::\n {:executable | :socket | :socket_name | :cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n\n @doc \"\"\"\n Constructs a descriptor for an existing server without connecting or creating it.\n\n `:socket` selects the socket by path and `:socket_name` by name; pass at most\n one. With neither, the descriptor reads `LIBTMUX_SOCKET_PATH`, then\n `LIBTMUX_SOCKET`, from `:env`, and selects no socket when neither is set, so\n tmux uses its default. See \"Choosing the server\" in the module\n documentation. Raises `ArgumentError` for conflicting or invalid input,\n naming a variable but never its value.\n\n See the [worked example](first-task.html).\n \"\"\"\n @spec new([option()]) :: t()\n def new(options) do\n options =\n Keyword.validate!(options, [\n :executable,\n :socket,\n :socket_name,\n cwd: File.cwd!(),\n env: System.get_env()\n ])\n\n executable = Keyword.fetch!(options, :executable)\n\n unless path?(executable) and path?(options[:cwd]),\n do: raise(ArgumentError, @invalid_paths)\n\n {socket, socket_name} =\n case Keyword.take(options, [:socket, :socket_name]) do\n [] -> from_environment(options[:env])\n [{:socket, socket}] -> {path!(socket, @invalid_paths), nil}\n [{:socket_name, name}] -> {nil, name!(name, \":socket_name must be #{@invalid_name}\")}\n [_, _] -> raise ArgumentError, \"pass at most one of :socket and :socket_name\"\n end\n\n %__MODULE__{\n executable: executable,\n socket: socket,\n socket_name: socket_name,\n cwd: options[:cwd],\n env: options[:env]\n }\n end\n\n defp from_environment(env) do\n cond do\n path = variable(env, \"LIBTMUX_SOCKET_PATH\") ->\n {path!(path, \"LIBTMUX_SOCKET_PATH must be an absolute NUL-free path\"), nil}\n\n name = variable(env, \"LIBTMUX_SOCKET\") ->\n {nil, name!(name, \"LIBTMUX_SOCKET must be #{@invalid_name}\")}\n\n true ->\n {nil, nil}\n end\n end\n\n defp variable(env, name) when is_map(env) do\n case Map.get(env, name) do\n \"\" -> nil\n value -> value\n end\n end\n\n defp variable(_env, _name), do: nil\n\n defp path?(value),\n do:\n is_binary(value) and Path.type(value) == :absolute and\n :binary.match(value, <<0>>) == :nomatch\n\n defp path!(value, message),\n do: if(path?(value), do: value, else: raise(ArgumentError, message))\n\n defp name!(value, message),\n do: if(name?(value), do: value, else: raise(ArgumentError, message))\n\n defp name?(value),\n do:\n is_binary(value) and value not in [\"\", \".\", \"..\"] and\n :binary.match(value, [<<0>>, \"/\"]) == :nomatch\n\n @typedoc \"\"\"\n Inputs for `start/1`.\n\n `:executable` is required. `:root` is the directory that holds the private\n directory and defaults to `System.tmp_dir!/0`. `:config_file` defaults to\n `\"/dev/null\"`. `:env` overlays the daemon's environment; `TMUX` and\n `TMUX_PANE` never reach it. `:timeout` bounds startup, in milliseconds.\n \"\"\"\n @type start_option ::\n {:executable, String.t()}\n | {:root, String.t()}\n | {:config_file, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:timeout, 1..600_000}\n\n @doc \"\"\"\n Starts a private tmux server and returns a Server for it.\n\n The server runs in the foreground under libtmux's native helper, in a\n directory of its own below `:root`: the directory has mode 700, holds the\n socket and is `TMUX_TMPDIR` for the daemon and its panes. The daemon never\n inherits `TMUX` or `TMUX_PANE`, reads `:config_file` (an empty file by\n default), and stays up with no session. `start/1` returns when the socket\n answers, or when `:timeout` (5000 ms by default) ends.\n\n The process that calls `start/1` owns the server. When it exits, the daemon\n stops and its directory is removed. If the VM is killed, the native helper\n still retires the daemon, but the directory stays. Other processes may use\n the returned Server. Stop it with `stop/2` as soon as the work is done, or\n use `with_owned/2`.\n\n Returns `{:error, error}` for an invalid option, a socket path that would\n exceed the 107 usable bytes of `sun_path`, a daemon that cannot start or\n exits before it answers, and a timeout. A failed start leaves no directory\n behind. It starts only on Linux, like the rest of libtmux.\n\n alias LibTmux.Server\n\n {:ok, server} = Server.start(executable: System.find_executable(\"tmux\"))\n {:ok, _} = Server.new_session(server, \"demo\", command: {:argv, [\"/bin/cat\"]})\n :ok = Server.stop(server)\n \"\"\"\n @spec start([start_option()]) :: {:ok, t()} | {:error, Error.t()}\n def start(options), do: LibTmux.Server.Daemon.start(options, self())\n\n @doc \"\"\"\n Stops a server that `start/1` created and removes its directory.\n\n Sends `kill-server`, waits until the native helper proves that the daemon\n has exited, and removes the directory. Stopping a server\n that already stopped returns `:ok`. If the daemon still answers when\n `:timeout` (5000 ms by default) ends, or the directory cannot be removed,\n it returns `{:error, error}` and keeps the directory; call it again to\n retry.\n\n Returns `{:error, error}` with kind `:not_owned` for a Server that `new/1`\n built or that another process started and already stopped.\n \"\"\"\n @spec stop(t(), [{:timeout, 1..600_000}]) :: :ok | {:error, Error.t()}\n def stop(server, options \\\\ []) do\n timeout = Keyword.get(options, :timeout, 5000)\n\n unless Keyword.keys(options) -- [:timeout] == [] and is_integer(timeout) and\n timeout in 1..600_000,\n do: raise(ArgumentError, \"the only stop option is :timeout, in 1..600000 ms\")\n\n LibTmux.Server.Daemon.stop(server, timeout)\n end\n\n @doc \"\"\"\n Starts a private server, calls `fun` with it and stops it afterwards.\n\n Takes the options of `start/1`. Returns the value of `fun`. A start failure\n raises its `LibTmux.Error` before `fun` runs. The server stops when `fun`\n returns, raises, throws or exits. If `fun` completes and the stop fails,\n `with_owned/2` raises the stop error; a failing stop never replaces an\n exception from `fun`.\n\n alias LibTmux.Server\n\n Server.with_owned([executable: System.find_executable(\"tmux\")], fn server ->\n {:ok, _} = Server.new_session(server, \"demo\", command: {:argv, [\"/bin/cat\"]})\n Server.snapshot!(server)\n end)\n \"\"\"\n @spec with_owned([start_option()], (t() -> result)) :: result when result: term()\n def with_owned(options, fun) when is_function(fun, 1) do\n case start(options) do\n {:ok, server} ->\n outcome =\n try do\n {:ok, fun.(server)}\n catch\n kind, reason -> {kind, reason, __STACKTRACE__}\n end\n\n stopped = stop(server)\n\n case {outcome, stopped} do\n {{:ok, value}, :ok} -> value\n {{:ok, _value}, {:error, error}} -> raise error\n {{kind, reason, stacktrace}, _stopped} -> :erlang.raise(kind, reason, stacktrace)\n end\n\n {:error, error} ->\n raise error\n end\n end\n\n @doc \"\"\"\n Kills the server with `kill-server`, whoever started it.\n\n Returns `{:ok, result}` when tmux acknowledges the command and\n `{:error, error}` otherwise, for example when no server answers. The\n command ends every session and pane on the server. It does not remove the\n directory of a server from `start/1`; use `stop/2` for that. The only\n option is `timeout` (5000 ms by default). See `LibTmux.Action` for outcomes.\n\n alias LibTmux.Server\n\n Server.kill(server)\n \"\"\"\n @spec kill(t(), [LibTmux.Action.option()]) ::\n {:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}\n def kill(server, options \\\\ []),\n do: LibTmux.Action.run(:kill_server, server, nil, nil, options)\n\n @doc \"Returns `:ok` when `kill/2` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.\"\n @spec kill!(t(), [LibTmux.Action.option()]) :: :ok\n def kill!(server, options \\\\ []), do: server |> kill(options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Creates a named detached session on an existing server through one-shot execution.\n\n Returns `{:ok, result}` on completion, with `%{id: session_id, ref: nil}`\n as its value. Capture a fresh observation for a bound reference. There is\n no observed target to validate; this command acts on the server answering\n at the descriptor's endpoint. It never starts a missing server. A missing\n endpoint or duplicate session name returns an error with execution evidence.\n Control connections are unsupported.\n\n Names contain 1..1024 UTF-8 bytes without control characters. Format syntax\n stays literal; tmux's version-dependent name normalization still applies.\n Options are `timeout` (5000ms), literal `cwd`, and `command`: `:default`,\n `{:shell, nonempty_bytes}` or `{:argv, [program | arguments]}`. Command forms\n follow `LibTmux.Pane.split/3`, except `:empty` is unsupported for creation.\n Acknowledgement does not prove that the program started or finished.\n See `LibTmux.Action` for completion and failure handling.\n\n alias LibTmux.Server\n\n Server.new_session(server, \"extra-work\", command: {:argv, [\"/bin/cat\"]})\n \"\"\"\n @spec new_session(t(), binary(), [LibTmux.Action.creation_option()]) ::\n {:ok, LibTmux.Action.result(LibTmux.Action.creation_value())}\n | {:error, LibTmux.Action.error()}\n def new_session(server, name, options \\\\ []),\n do: LibTmux.Action.run(:new_session, server, nil, name, options)\n\n @doc \"Returns the created session value when `new_session/3` completes; raises the original error otherwise.\"\n @spec new_session!(t(), binary(), [LibTmux.Action.creation_option()]) ::\n LibTmux.Action.creation_value()\n def new_session!(server, name, options \\\\ []),\n do: server |> new_session(name, options) |> LibTmux.Action.unwrap()\n\n @doc \"\"\"\n Runs one trusted command without attaching; returns bounded output and exit evidence.\n\n The options are those of `LibTmux.Transport.OneShot.run/3`, except\n `:keep_tmux_context`: the Server decides it from its socket, and a value\n passed here is ignored. Raises `ArgumentError` for a Server built by hand\n whose `socket` or `socket_name` is not `nil` or a string, or that sets both.\n\n See the [worked example](advanced-execution.html).\n \"\"\"\n @spec run(t(), Command.t(), [OneShot.option()]) :: {:ok, OneShot.result()} | {:error, Error.t()}\n def run(%__MODULE__{} = server, %Command{} = command, options \\\\ []) do\n options =\n [cwd: server.cwd, env: server.env]\n |> Keyword.merge(options)\n |> Keyword.put(:keep_tmux_context, follows_tmux?(server))\n\n case OneShot.run(server.executable, arguments(server, command), options) do\n {:ok, %{exit_status: 0} = result} ->\n {:ok, result}\n\n {:ok, result} ->\n code =\n if Regex.match?(~r/\\Acan't find (?:pane|window|session):/, result.stderr),\n do: :not_found,\n else: :other\n\n {:error,\n %Error{kind: :command_error, phase: :command, details: Map.put(result, :code, code)}}\n\n {:error, _} = error ->\n error\n end\n end\n\n @doc false\n def prepare_command(%__MODULE__{} = server, %Command{} = command) do\n LibTmux.Transport.Native.Protocol.prepare_process(\n server.executable,\n arguments(server, command),\n cwd: server.cwd,\n env: server.env,\n keep_tmux_context: follows_tmux?(server)\n )\n end\n\n @doc false\n def follows_tmux?(%__MODULE__{socket: nil, socket_name: nil}), do: true\n def follows_tmux?(%__MODULE__{}), do: false\n\n defp arguments(server, command),\n do: [\"-N\", \"-u\" | socket_arguments(server)] ++ Command.argv(command)\n\n @doc false\n def socket_arguments(%__MODULE__{socket: nil, socket_name: nil}), do: []\n\n def socket_arguments(%__MODULE__{socket: socket, socket_name: nil}) when is_binary(socket),\n do: [\"-S\", socket]\n\n def socket_arguments(%__MODULE__{socket: nil, socket_name: name}) when is_binary(name),\n do: [\"-L\", name]\n\n def socket_arguments(%__MODULE__{}),\n do: raise(ArgumentError, \"a server names at most one socket, as a string\")\n\n @doc false\n def valid_socket?(%__MODULE__{socket: nil, socket_name: nil}), do: true\n\n def valid_socket?(%__MODULE__{socket: socket, socket_name: nil}),\n do: path?(socket) and byte_size(socket) <= 32_000\n\n def valid_socket?(%__MODULE__{socket: nil, socket_name: name}),\n do: name?(name)\n\n def valid_socket?(%__MODULE__{}), do: false\n\n @doc \"\"\"\n Captures a new graph explicitly, with bounded work and read retries.\n\n See the [worked example](first-task.html).\n \"\"\"\n @spec snapshot(t(), [Capture.option()]) :: {:ok, LibTmux.Snapshot.t()} | {:error, Error.t()}\n def snapshot(server, options \\\\ []), do: Capture.fetch(server, options)\n\n @doc \"\"\"\n Captures a graph or raises the same structured capture error.\n\n See the [worked example](first-task.html).\n \"\"\"\n @spec snapshot!(t(), [Capture.option()]) :: LibTmux.Snapshot.t()\n def snapshot!(server, options \\\\ []) do\n case snapshot(server, options) do\n {:ok, snapshot} -> snapshot\n {:error, error} -> raise error\n end\n end\nend\n" }, "lib/libtmux/snapshot.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "b4b1e19890f5bcb039cb062774b4675a65928c558f26b13de00c6c7bd62fe3da", - "content": "defmodule LibTmux.Snapshot do\n @moduledoc \"\"\"\n An indexed immutable graph observed over a capture interval.\n\n Construction and traversal perform no I/O. `fields` declares loaded fields\n over the supplied entity IDs; `complete` declares complete server entity\n sets. Missing declarations remain unloaded, including on empty sets.\n Unavailable capabilities use a separate declaration. Relations require\n complete join domains. A snapshot reserves no tmux objects.\n \"\"\"\n\n alias LibTmux.{Error, Ref, Schema}\n\n @collections %{\n session: :sessions,\n window: :windows,\n window_link: :window_links,\n pane: :panes,\n client: :clients\n }\n @foreign_keys %{\n pane: [window_id: :window],\n window_link: [session_id: :session, window_id: :window],\n client: [session_id: :session]\n }\n @enforce_keys [:id, :server_instance, :captured_from, :captured_until, :coverage]\n defstruct [\n :id,\n :server_instance,\n :captured_from,\n :captured_until,\n :coverage,\n schema_version: 1,\n sessions: %{},\n windows: %{},\n window_links: %{},\n panes: %{},\n clients: %{},\n order: %{},\n indexes: %{}\n ]\n\n @typedoc \"Coverage of one captured entity domain; missing field entries are unloaded.\"\n @type entity_coverage :: %{\n ids: MapSet.t(Ref.id()),\n complete: boolean(),\n fields: %{optional(atom()) => :loaded | :unavailable}\n }\n @typedoc \"Declared entity sets and field availability; completeness is separate from an empty captured set.\"\n @type coverage :: %{entities: %{Schema.entity() => entity_coverage()}}\n @typedoc \"Maps each session ID to the IDs of its window links and clients, and each window ID to the IDs of its window links and panes. Traverse with `related/4`; the layout is not part of the contract.\"\n @opaque indexes :: %{\n session_links: %{optional(String.t()) => [Ref.id()]},\n window_links: %{optional(String.t()) => [Ref.id()]},\n window_panes: %{optional(Schema.observed(String.t())) => [String.t()]},\n session_clients: %{optional(Schema.observed(String.t())) => [String.t()]}\n }\n @typedoc \"Observed rows grouped by canonical entity; construction validates and deduplicates their identities.\"\n @type rows :: %{optional(Schema.entity()) => [map() | Schema.observation()]}\n @typedoc \"Construction metadata: one server instance, ordered millisecond timestamps and explicit coverage declarations.\"\n @type option ::\n {:server_instance, String.t()}\n | {:captured_from, integer()}\n | {:captured_until, integer()}\n | {:fields, %{optional(Schema.entity()) => [atom()]}}\n | {:complete, [Schema.entity()]}\n | {:unavailable, %{optional(Schema.entity()) => [atom()]}}\n\n @typedoc \"An immutable observation interval with indexed entities and explicit coverage.\"\n @type t :: %__MODULE__{\n id: pos_integer(),\n server_instance: String.t(),\n captured_from: integer(),\n captured_until: integer(),\n coverage: coverage(),\n schema_version: 1,\n sessions: %{optional(String.t()) => LibTmux.Session.t()},\n windows: %{optional(String.t()) => LibTmux.Window.t()},\n window_links: %{optional(Ref.id()) => LibTmux.WindowLink.t()},\n panes: %{optional(String.t()) => LibTmux.Pane.t()},\n clients: %{optional(String.t()) => LibTmux.Client.t()},\n order: %{Schema.entity() => [Ref.id()]},\n indexes: indexes()\n }\n\n @doc \"Validates observed rows, rejecting conflicts, invalid fields and dangling covered references.\"\n @spec new(rows(), [option()]) :: {:ok, t()} | {:error, Error.t()}\n def new(rows, options) do\n options =\n Keyword.validate!(options, [\n :server_instance,\n :captured_from,\n :captured_until,\n :fields,\n complete: [],\n unavailable: %{}\n ])\n\n instance = Keyword.fetch!(options, :server_instance)\n from = Keyword.fetch!(options, :captured_from)\n until = Keyword.fetch!(options, :captured_until)\n\n unless is_integer(from) and is_integer(until) and from <= until,\n do: raise(ArgumentError, \"capture interval must be ordered integer timestamps\")\n\n unless match?({:ok, _}, Ref.new(:session, \"$0\", instance)),\n do: raise(ArgumentError, \"invalid server instance\")\n\n try do\n options = validate_declarations!(options)\n\n for entity <- Map.keys(rows),\n entity not in Schema.entities(),\n do: fail(:invalid_entity, [entity])\n\n maps =\n Map.new(Schema.entities(), fn entity ->\n {entity,\n index_rows(\n entity,\n Map.get(rows, entity, []),\n instance,\n Map.get(options[:unavailable], entity, [])\n )}\n end)\n\n validate_links!(maps.window_link)\n coverage = coverage(maps, options)\n validate_references!(maps, coverage)\n\n snapshot =\n struct!(\n __MODULE__,\n Map.merge(Map.new(@collections, fn {entity, name} -> {name, maps[entity]} end), %{\n id: System.unique_integer([:positive, :monotonic]),\n server_instance: instance,\n captured_from: from,\n captured_until: until,\n coverage: coverage,\n order:\n Map.new(maps, fn {entity, items} ->\n {entity, items |> Map.keys() |> Enum.sort_by(&sort_key(entity, &1))}\n end),\n indexes: indexes(maps)\n })\n )\n\n {:ok, snapshot}\n catch\n %Error{} = error -> {:error, error}\n end\n end\n\n @doc \"Returns plain observed items in stable identity order without loading data.\"\n @spec items(t(), Schema.entity_selector()) :: [Schema.observation()]\n def items(%__MODULE__{} = snapshot, entity) do\n entity = Schema.entity(entity)\n table = table(snapshot, entity)\n Enum.map(snapshot.order[entity], &Map.fetch!(table, &1))\n end\n\n @doc \"Returns a materialized session selection without I/O.\"\n @spec sessions(t()) :: LibTmux.Selection.t(LibTmux.Session.t())\n def sessions(snapshot), do: LibTmux.Selection.new(snapshot, :session)\n @doc \"Returns a materialized physical window selection without I/O.\"\n @spec windows(t()) :: LibTmux.Selection.t(LibTmux.Window.t())\n def windows(snapshot), do: LibTmux.Selection.new(snapshot, :window)\n @doc \"Returns a materialized physical pane selection without I/O.\"\n @spec panes(t()) :: LibTmux.Selection.t(LibTmux.Pane.t())\n def panes(snapshot), do: LibTmux.Selection.new(snapshot, :pane)\n @doc \"Returns a materialized membership selection without I/O.\"\n @spec window_links(t()) :: LibTmux.Selection.t(LibTmux.WindowLink.t())\n def window_links(snapshot), do: LibTmux.Selection.new(snapshot, :window_link)\n @doc \"Returns a materialized attached-client selection without I/O.\"\n @spec clients(t()) :: LibTmux.Selection.t(LibTmux.Client.t())\n def clients(snapshot), do: LibTmux.Selection.new(snapshot, :client)\n\n @doc \"Looks up one exact observed ID without I/O.\"\n @spec fetch(t(), Schema.entity_selector(), Ref.id()) ::\n {:ok, Schema.observation()} | {:error, Error.t()}\n def fetch(%__MODULE__{} = snapshot, entity, id) do\n entity = Schema.entity(entity)\n\n case Map.fetch(table(snapshot, entity), id) do\n {:ok, item} ->\n {:ok, item}\n\n :error ->\n {:error,\n %Error{kind: :not_found, phase: :evaluation, certainty: :no_write, path: [entity, id]}}\n end\n end\n\n @doc \"Requires a declared complete entity set, even when it has no rows.\"\n @spec require_complete!(t(), Schema.entity_selector()) :: :ok\n def require_complete!(snapshot, entity) do\n entity = Schema.entity(entity)\n\n unless snapshot.coverage.entities[entity].complete,\n do: raise_error(:entity_not_loaded, [entity])\n\n :ok\n end\n\n @doc \"Requires a loaded field over the captured entity domain before evaluation.\"\n @spec require_field!(t(), Schema.entity_selector(), atom()) :: :ok\n def require_field!(snapshot, entity, field) do\n entity = Schema.entity(entity)\n unless Schema.field(entity, field), do: raise_error(:invalid_field, [entity, field])\n\n case Map.get(snapshot.coverage.entities[entity].fields, field, :unloaded) do\n :loaded -> :ok\n :unavailable -> raise_error(:field_unavailable, [entity, field])\n :unloaded -> raise_error(:field_not_loaded, [entity, field])\n end\n end\n\n @doc \"Requires a complete relation domain, including known-empty domains.\"\n @spec require_relation!(t(), Schema.entity_selector(), atom(), :all | [Ref.id()]) :: :ok\n def require_relation!(snapshot, entity, relation, ids \\\\ :all) do\n entity = Schema.entity(entity)\n\n unless Map.has_key?(Schema.relations(entity), relation),\n do: raise_error(:invalid_relation, [entity, relation])\n\n coverage = relation_coverage(snapshot, entity, relation)\n ids = if ids == :all, do: snapshot.order[entity], else: ids\n\n unless coverage.loaded and Enum.all?(ids, &MapSet.member?(coverage.ids, &1)),\n do: raise_error(:relation_not_loaded, [entity, relation])\n\n :ok\n end\n\n @doc \"Resolves a covered relation through captured indexes; never refreshes.\"\n @spec related(t(), Schema.entity_selector(), Ref.id(), atom()) ::\n Schema.observation() | nil | [Schema.observation()]\n def related(snapshot, entity, id, relation) do\n entity = Schema.entity(entity)\n require_relation!(snapshot, entity, relation, [id])\n {:ok, item} = fetch(snapshot, entity, id)\n project(snapshot, entity, item, relation)\n end\n\n defp index_rows(entity, rows, instance, unavailable) when is_list(rows) do\n Enum.reduce(rows, %{}, fn row, acc ->\n row = if is_struct(row), do: Map.from_struct(row), else: row\n fields = Schema.fields(entity)\n\n for key <- Map.keys(row),\n key != :server_instance and not Map.has_key?(fields, key),\n do: fail(:invalid_field, [entity, key])\n\n if Map.has_key?(row, :server_instance) and row.server_instance != instance,\n do: fail(:stale_target, [entity])\n\n row = if entity == :window_link, do: bind_link(row), else: row\n id = row[:id]\n\n unless match?({:ok, _}, Ref.new(entity, id, instance)),\n do: fail(:invalid_target, [entity, id])\n\n Enum.each(row, fn\n {:server_instance, _} ->\n :ok\n\n {_key, value} when value in [:unloaded, :unavailable] ->\n :ok\n\n {key, value} ->\n unless Schema.valid_value?(fields[key], value),\n do: fail(:invalid_field, [entity, id, key])\n end)\n\n row =\n Enum.reduce(unavailable, row, fn field, current ->\n unless Map.get(current, field, :unloaded) in [:unloaded, :unavailable],\n do: fail(:inconsistent_coverage, [entity, field])\n\n Map.put(current, field, :unavailable)\n end)\n\n row =\n if entity == :session,\n do: Map.put(row, :attached, attached(Map.get(row, :attached_count, :unloaded))),\n else: row\n\n item = struct!(Schema.module(entity), Map.put(row, :server_instance, instance))\n\n case Map.fetch(acc, id) do\n {:ok, ^item} -> acc\n {:ok, _other} -> fail(:conflicting_rows, [entity, id])\n :error -> Map.put(acc, id, item)\n end\n end)\n end\n\n defp bind_link(row) do\n id = {row[:session_id], row[:index], row[:window_id]}\n if Map.has_key?(row, :id) and row.id != id, do: fail(:invalid_target, [:window_link, row.id])\n Map.put(row, :id, id)\n end\n\n defp attached(count) when is_integer(count), do: count > 0\n defp attached(state), do: state\n\n defp validate_links!(links) do\n Enum.reduce(links, %{}, fn {_, link}, seen ->\n key = {link.session_id, link.index}\n\n if Map.has_key?(seen, key) and seen[key] != link.window_id,\n do: fail(:conflicting_link, [:window_link, link.id])\n\n Map.put(seen, key, link.window_id)\n end)\n end\n\n defp coverage(maps, options) do\n declared = Keyword.get(options, :fields, %{})\n unavailable = options[:unavailable]\n complete = options[:complete]\n\n for entity <- Map.keys(declared) ++ Map.keys(unavailable) ++ complete,\n entity not in Schema.entities(),\n do: fail(:invalid_entity, [entity])\n\n entities =\n Map.new(maps, fn {entity, items} ->\n fields = Map.get(declared, entity, [])\n missing = Map.get(unavailable, entity, [])\n\n for field <- fields ++ missing,\n is_nil(Schema.field(entity, field)),\n do: fail(:invalid_field, [entity, field])\n\n if Enum.any?(fields, &(&1 in missing)), do: fail(:inconsistent_coverage, [entity])\n\n fields =\n if entity == :session and :attached_count in fields,\n do: Enum.uniq([:attached | fields]),\n else: fields\n\n Enum.each(fields, fn field ->\n if Enum.any?(items, fn {_, item} ->\n Map.fetch!(item, field) in [:unloaded, :unavailable]\n end),\n do: fail(:inconsistent_coverage, [entity, field])\n end)\n\n Enum.each(missing, fn field ->\n if Enum.any?(items, fn {_, item} ->\n Map.fetch!(item, field) not in [:unloaded, :unavailable]\n end),\n do: fail(:inconsistent_coverage, [entity, field])\n end)\n\n states = Map.merge(Map.new(fields, &{&1, :loaded}), Map.new(missing, &{&1, :unavailable}))\n\n {entity,\n %{ids: MapSet.new(Map.keys(items)), complete: entity in complete, fields: states}}\n end)\n\n %{entities: entities}\n end\n\n defp validate_declarations!(options) do\n fields = Keyword.get(options, :fields, %{})\n unavailable = options[:unavailable]\n\n for entity <- Map.keys(fields) ++ Map.keys(unavailable) ++ options[:complete],\n entity not in Schema.entities(),\n do: fail(:invalid_entity, [entity])\n\n for declarations <- [fields, unavailable],\n {entity, names} <- declarations,\n name <- names,\n is_nil(Schema.field(entity, name)),\n do: fail(:invalid_field, [entity, name])\n\n fields = derived_coverage(fields)\n unavailable = derived_coverage(unavailable)\n\n for entity <- Schema.entities(),\n field <- Map.get(fields, entity, []),\n field in Map.get(unavailable, entity, []),\n do: fail(:inconsistent_coverage, [entity, field])\n\n options |> Keyword.put(:fields, fields) |> Keyword.put(:unavailable, unavailable)\n end\n\n defp derived_coverage(declarations) do\n names = Map.get(declarations, :session, [])\n\n if :attached in names and :attached_count not in names,\n do: fail(:inconsistent_coverage, [:session, :attached])\n\n if :attached_count in names,\n do: Map.put(declarations, :session, Enum.uniq([:attached | names])),\n else: declarations\n end\n\n defp validate_references!(maps, coverage) do\n for {entity, keys} <- @foreign_keys, {_, item} <- maps[entity], {field, target} <- keys do\n value = Map.fetch!(item, field)\n\n if value not in [:unloaded, :unavailable, nil] and coverage.entities[target].complete and\n not Map.has_key?(maps[target], value),\n do: fail(:inconsistent_snapshot, [entity, item.id, field])\n end\n end\n\n defp indexes(maps) do\n %{\n session_links: grouped(maps.window_link, :session_id, & &1.index),\n window_links: grouped(maps.window_link, :window_id, &sort_key(:window_link, &1.id)),\n window_panes: grouped(maps.pane, :window_id, &sort_key(:pane, &1.id)),\n session_clients: grouped(maps.client, :session_id, & &1.id)\n }\n end\n\n defp grouped(items, field, order) do\n items\n |> Map.values()\n |> Enum.group_by(&Map.fetch!(&1, field))\n |> Map.new(fn {id, rows} -> {id, rows |> Enum.sort_by(order) |> Enum.map(& &1.id)} end)\n end\n\n defp relation_coverage(snapshot, entity, relation) do\n {complete, required} = requirements(entity, relation)\n\n loaded =\n Enum.all?(complete, &snapshot.coverage.entities[&1].complete) and\n Enum.all?(required, fn {e, f} -> snapshot.coverage.entities[e].fields[f] == :loaded end)\n\n ids =\n if loaded,\n do:\n Enum.filter(snapshot.order[entity], fn id ->\n relation_targets_present?(snapshot, entity, id, relation)\n end),\n else: []\n\n %{loaded: loaded, ids: MapSet.new(ids)}\n end\n\n defp requirements(:pane, :window), do: {[], [pane: :window_id]}\n defp requirements(:client, :session), do: {[], [client: :session_id]}\n defp requirements(:window_link, :session), do: {[], [window_link: :session_id]}\n defp requirements(:window_link, :window), do: {[], [window_link: :window_id]}\n defp requirements(:window, :panes), do: {[:pane], [pane: :window_id]}\n defp requirements(:session, :clients), do: {[:client], [client: :session_id]}\n\n defp requirements(:session, :active_window),\n do:\n {[:window_link], [window_link: :session_id, window_link: :window_id, window_link: :active]}\n\n defp requirements(:session, :panes),\n do:\n {[:window_link, :pane],\n [window_link: :session_id, window_link: :window_id, pane: :window_id]}\n\n defp requirements(_entity, _relation),\n do: {[:window_link], [window_link: :session_id, window_link: :window_id]}\n\n defp relation_targets_present?(snapshot, :session, id, :active_window) do\n case active_link(snapshot, snapshot.sessions[id]) do\n nil -> true\n link -> Map.has_key?(snapshot.windows, link.window_id)\n end\n end\n\n defp relation_targets_present?(snapshot, entity, id, relation) do\n {cardinality, _target} = Schema.relations(entity)[relation]\n result = project(snapshot, entity, table(snapshot, entity)[id], relation)\n if cardinality == :one, do: not is_nil(result), else: Enum.all?(result, &(not is_nil(&1)))\n end\n\n defp project(s, :pane, item, :window), do: s.windows[item.window_id]\n defp project(s, :client, item, :session), do: s.sessions[item.session_id]\n defp project(s, :window_link, item, :session), do: s.sessions[item.session_id]\n defp project(s, :window_link, item, :window), do: s.windows[item.window_id]\n\n defp project(s, :session, item, :active_window) do\n case active_link(s, item) do\n nil -> nil\n link -> s.windows[link.window_id]\n end\n end\n\n defp project(s, :window, item, :panes),\n do: Enum.map(Map.get(s.indexes.window_panes, item.id, []), &s.panes[&1])\n\n defp project(s, :session, item, :clients),\n do: Enum.map(Map.get(s.indexes.session_clients, item.id, []), &s.clients[&1])\n\n defp project(s, :session, item, :window_links),\n do: Enum.map(Map.get(s.indexes.session_links, item.id, []), &s.window_links[&1])\n\n defp project(s, :window, item, :window_links),\n do: Enum.map(Map.get(s.indexes.window_links, item.id, []), &s.window_links[&1])\n\n defp project(s, :session, item, :windows),\n do:\n project(s, :session, item, :window_links)\n |> Enum.map(&s.windows[&1.window_id])\n |> Enum.uniq_by(&if(&1, do: &1.id))\n\n defp project(s, :window, item, :sessions),\n do:\n project(s, :window, item, :window_links)\n |> Enum.map(&s.sessions[&1.session_id])\n |> Enum.uniq_by(&if(&1, do: &1.id))\n |> Enum.sort_by(&if(&1, do: sort_key(:session, &1.id)))\n\n defp project(s, :session, item, :panes) do\n windows =\n project(s, :session, item, :window_links) |> Enum.map(& &1.window_id) |> MapSet.new()\n\n items(s, :pane) |> Enum.filter(&MapSet.member?(windows, &1.window_id))\n end\n\n defp table(snapshot, entity), do: Map.fetch!(snapshot, @collections[entity])\n\n defp active_link(snapshot, session) do\n case Enum.filter(project(snapshot, :session, session, :window_links), & &1.active) do\n [] -> nil\n [link] -> link\n _ -> raise_error(:ambiguous_relation, [:session, session.id, :active_window])\n end\n end\n\n defp sort_key(:window_link, {session, index, window}),\n do: {sort_key(:session, session), index, sort_key(:window, window)}\n\n defp sort_key(:client, id), do: id\n defp sort_key(_entity, <<_prefix, digits::binary>>), do: String.to_integer(digits)\n\n defp fail(kind, path),\n do: throw(%Error{kind: kind, phase: :capture, certainty: :no_write, path: path})\n\n defp raise_error(kind, path),\n do: raise(Error, kind: kind, phase: :evaluation, certainty: :no_write, path: path)\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "662c29cf16416d565bea3211fc5a2b5f154dd2e93343d210809144c40e7fdcbf", + "content": "defmodule LibTmux.Snapshot do\n @moduledoc \"\"\"\n An indexed immutable graph observed over a capture interval.\n\n Construction and traversal perform no I/O. `fields` declares loaded fields\n over the supplied entity IDs; `complete` declares complete server entity\n sets. Missing declarations remain unloaded, including on empty sets.\n Unavailable capabilities use a separate declaration. Relations require\n complete join domains. A snapshot reserves no tmux objects.\n \"\"\"\n\n alias LibTmux.{Error, Ref, Schema}\n\n @collections %{\n session: :sessions,\n window: :windows,\n window_link: :window_links,\n pane: :panes,\n client: :clients\n }\n @foreign_keys %{\n pane: [window_id: :window],\n window_link: [session_id: :session, window_id: :window],\n client: [session_id: :session]\n }\n @enforce_keys [:id, :server_instance, :captured_from, :captured_until, :coverage]\n defstruct [\n :id,\n :server_instance,\n :captured_from,\n :captured_until,\n :coverage,\n schema_version: 1,\n sessions: %{},\n windows: %{},\n window_links: %{},\n panes: %{},\n clients: %{},\n order: %{},\n indexes: %{}\n ]\n\n @typedoc \"Coverage of one captured entity domain; missing field entries are unloaded.\"\n @type entity_coverage :: %{\n ids: MapSet.t(Ref.id()),\n complete: boolean(),\n fields: %{optional(atom()) => :loaded | :unavailable}\n }\n @typedoc \"Declared entity sets and field availability; completeness is separate from an empty captured set.\"\n @type coverage :: %{entities: %{Schema.entity() => entity_coverage()}}\n @typedoc \"Maps each session ID to the IDs of its window links and clients, and each window ID to the IDs of its window links and panes. Traverse with `related/4`; the layout is not part of the contract.\"\n @opaque indexes :: %{\n session_links: %{optional(String.t()) => [Ref.id()]},\n window_links: %{optional(String.t()) => [Ref.id()]},\n window_panes: %{optional(Schema.observed(String.t())) => [String.t()]},\n session_clients: %{optional(Schema.observed(String.t())) => [String.t()]}\n }\n @typedoc \"Observed rows grouped by canonical entity; construction validates and deduplicates their identities.\"\n @type rows :: %{optional(Schema.entity()) => [map() | Schema.observation()]}\n @typedoc \"Construction metadata: one server instance, ordered millisecond timestamps and explicit coverage declarations.\"\n @type option ::\n {:server_instance, String.t()}\n | {:captured_from, integer()}\n | {:captured_until, integer()}\n | {:fields, %{optional(Schema.entity()) => [atom()]}}\n | {:complete, [Schema.entity()]}\n | {:unavailable, %{optional(Schema.entity()) => [atom()]}}\n\n @typedoc \"An immutable observation interval with indexed entities and explicit coverage.\"\n @type t :: %__MODULE__{\n id: pos_integer(),\n server_instance: String.t(),\n captured_from: integer(),\n captured_until: integer(),\n coverage: coverage(),\n schema_version: 1,\n sessions: %{optional(String.t()) => LibTmux.Session.t()},\n windows: %{optional(String.t()) => LibTmux.Window.t()},\n window_links: %{optional(Ref.id()) => LibTmux.WindowLink.t()},\n panes: %{optional(String.t()) => LibTmux.Pane.t()},\n clients: %{optional(String.t()) => LibTmux.Client.t()},\n order: %{Schema.entity() => [Ref.id()]},\n indexes: indexes()\n }\n\n @doc \"\"\"\n Validates observed rows, rejecting conflicts, invalid fields and dangling covered references.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec new(rows(), [option()]) :: {:ok, t()} | {:error, Error.t()}\n def new(rows, options) do\n options =\n Keyword.validate!(options, [\n :server_instance,\n :captured_from,\n :captured_until,\n :fields,\n complete: [],\n unavailable: %{}\n ])\n\n instance = Keyword.fetch!(options, :server_instance)\n from = Keyword.fetch!(options, :captured_from)\n until = Keyword.fetch!(options, :captured_until)\n\n unless is_integer(from) and is_integer(until) and from <= until,\n do: raise(ArgumentError, \"capture interval must be ordered integer timestamps\")\n\n unless match?({:ok, _}, Ref.new(:session, \"$0\", instance)),\n do: raise(ArgumentError, \"invalid server instance\")\n\n try do\n options = validate_declarations!(options)\n\n for entity <- Map.keys(rows),\n entity not in Schema.entities(),\n do: fail(:invalid_entity, [entity])\n\n maps =\n Map.new(Schema.entities(), fn entity ->\n {entity,\n index_rows(\n entity,\n Map.get(rows, entity, []),\n instance,\n Map.get(options[:unavailable], entity, [])\n )}\n end)\n\n validate_links!(maps.window_link)\n coverage = coverage(maps, options)\n validate_references!(maps, coverage)\n\n snapshot =\n struct!(\n __MODULE__,\n Map.merge(Map.new(@collections, fn {entity, name} -> {name, maps[entity]} end), %{\n id: System.unique_integer([:positive, :monotonic]),\n server_instance: instance,\n captured_from: from,\n captured_until: until,\n coverage: coverage,\n order:\n Map.new(maps, fn {entity, items} ->\n {entity, items |> Map.keys() |> Enum.sort_by(&sort_key(entity, &1))}\n end),\n indexes: indexes(maps)\n })\n )\n\n {:ok, snapshot}\n catch\n %Error{} = error -> {:error, error}\n end\n end\n\n @doc \"\"\"\n Returns plain observed items in stable identity order without loading data.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec items(t(), Schema.entity_selector()) :: [Schema.observation()]\n def items(%__MODULE__{} = snapshot, entity) do\n entity = Schema.entity(entity)\n table = table(snapshot, entity)\n Enum.map(snapshot.order[entity], &Map.fetch!(table, &1))\n end\n\n @doc \"\"\"\n Returns a materialized session selection without I/O.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec sessions(t()) :: LibTmux.Selection.t(LibTmux.Session.t())\n def sessions(snapshot), do: LibTmux.Selection.new(snapshot, :session)\n\n @doc \"\"\"\n Returns a materialized physical window selection without I/O.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec windows(t()) :: LibTmux.Selection.t(LibTmux.Window.t())\n def windows(snapshot), do: LibTmux.Selection.new(snapshot, :window)\n\n @doc \"\"\"\n Returns a materialized physical pane selection without I/O.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec panes(t()) :: LibTmux.Selection.t(LibTmux.Pane.t())\n def panes(snapshot), do: LibTmux.Selection.new(snapshot, :pane)\n\n @doc \"\"\"\n Returns a materialized membership selection without I/O.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec window_links(t()) :: LibTmux.Selection.t(LibTmux.WindowLink.t())\n def window_links(snapshot), do: LibTmux.Selection.new(snapshot, :window_link)\n\n @doc \"\"\"\n Returns a materialized attached-client selection without I/O.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec clients(t()) :: LibTmux.Selection.t(LibTmux.Client.t())\n def clients(snapshot), do: LibTmux.Selection.new(snapshot, :client)\n\n @doc \"\"\"\n Looks up one exact observed ID without I/O.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec fetch(t(), Schema.entity_selector(), Ref.id()) ::\n {:ok, Schema.observation()} | {:error, Error.t()}\n def fetch(%__MODULE__{} = snapshot, entity, id) do\n entity = Schema.entity(entity)\n\n case Map.fetch(table(snapshot, entity), id) do\n {:ok, item} ->\n {:ok, item}\n\n :error ->\n {:error,\n %Error{kind: :not_found, phase: :evaluation, certainty: :no_write, path: [entity, id]}}\n end\n end\n\n @doc \"\"\"\n Requires a declared complete entity set, even when it has no rows.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec require_complete!(t(), Schema.entity_selector()) :: :ok\n def require_complete!(snapshot, entity) do\n entity = Schema.entity(entity)\n\n unless snapshot.coverage.entities[entity].complete,\n do: raise_error(:entity_not_loaded, [entity])\n\n :ok\n end\n\n @doc \"\"\"\n Requires a loaded field over the captured entity domain before evaluation.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec require_field!(t(), Schema.entity_selector(), atom()) :: :ok\n def require_field!(snapshot, entity, field) do\n entity = Schema.entity(entity)\n unless Schema.field(entity, field), do: raise_error(:invalid_field, [entity, field])\n\n case Map.get(snapshot.coverage.entities[entity].fields, field, :unloaded) do\n :loaded -> :ok\n :unavailable -> raise_error(:field_unavailable, [entity, field])\n :unloaded -> raise_error(:field_not_loaded, [entity, field])\n end\n end\n\n @doc \"\"\"\n Requires relation coverage for the requested source IDs, including known-empty relations.\n\n The default `:all` validates the entire captured source domain. An explicit\n ID list does not resolve unrelated sources or their ambiguous relationships.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec require_relation!(t(), Schema.entity_selector(), atom(), :all | [Ref.id()]) :: :ok\n def require_relation!(snapshot, entity, relation, ids \\\\ :all) do\n entity = Schema.entity(entity)\n\n unless Map.has_key?(Schema.relations(entity), relation),\n do: raise_error(:invalid_relation, [entity, relation])\n\n ids = if ids == :all, do: snapshot.order[entity], else: ids\n\n unless relation_covered?(snapshot, entity, relation, ids),\n do: raise_error(:relation_not_loaded, [entity, relation])\n\n :ok\n end\n\n @doc \"\"\"\n Resolves one source's covered relation through captured indexes; never refreshes.\n\n Ambiguity in another source does not affect this lookup. Whole-selection\n filtering still validates its entire required relationship domain first.\n\n See the [worked example](api-examples.html#local-graph-and-filtering).\n \"\"\"\n @spec related(t(), Schema.entity_selector(), Ref.id(), atom()) ::\n Schema.observation() | nil | [Schema.observation()]\n def related(snapshot, entity, id, relation) do\n entity = Schema.entity(entity)\n require_relation!(snapshot, entity, relation, [id])\n {:ok, item} = fetch(snapshot, entity, id)\n project(snapshot, entity, item, relation)\n end\n\n @doc false\n def related_observation(%__MODULE__{} = snapshot, entity, observation, relation) do\n with {:ok, %Ref{entity: ^entity} = ref} <- Ref.from_observation(observation),\n :ok <- Ref.validate(ref, snapshot.server_instance) do\n items = related(snapshot, entity, ref.id, relation)\n\n case Schema.relations(entity)[relation] do\n {:many, target} ->\n %LibTmux.Selection{\n entity: Schema.module(target),\n items: items,\n count: length(items),\n snapshot: snapshot\n }\n\n {:one, _target} ->\n items\n end\n else\n {:ok, _wrong_kind} -> raise_error(:invalid_target, [:target])\n {:error, error} -> raise %{error | phase: :evaluation}\n end\n end\n\n @doc false\n def prepare_relation!(snapshot, entity, relation) do\n entity = Schema.entity(entity)\n require_relation!(snapshot, entity, relation)\n sources = table(snapshot, entity)\n\n fn id ->\n case Map.fetch(sources, id) do\n {:ok, item} -> project(snapshot, entity, item, relation)\n :error -> raise_error(:relation_not_loaded, [entity, relation])\n end\n end\n end\n\n defp index_rows(entity, rows, instance, unavailable) when is_list(rows) do\n Enum.reduce(rows, %{}, fn row, acc ->\n row = if is_struct(row), do: Map.from_struct(row), else: row\n fields = Schema.fields(entity)\n\n for key <- Map.keys(row),\n key != :server_instance and not Map.has_key?(fields, key),\n do: fail(:invalid_field, [entity, key])\n\n if Map.has_key?(row, :server_instance) and row.server_instance != instance,\n do: fail(:stale_target, [entity])\n\n row = if entity == :window_link, do: bind_link(row), else: row\n id = row[:id]\n\n unless match?({:ok, _}, Ref.new(entity, id, instance)),\n do: fail(:invalid_target, [entity, id])\n\n Enum.each(row, fn\n {:server_instance, _} ->\n :ok\n\n {_key, value} when value in [:unloaded, :unavailable] ->\n :ok\n\n {key, value} ->\n unless Schema.valid_value?(fields[key], value),\n do: fail(:invalid_field, [entity, id, key])\n end)\n\n row =\n Enum.reduce(unavailable, row, fn field, current ->\n unless Map.get(current, field, :unloaded) in [:unloaded, :unavailable],\n do: fail(:inconsistent_coverage, [entity, field])\n\n Map.put(current, field, :unavailable)\n end)\n\n row =\n if entity == :session,\n do: Map.put(row, :attached, attached(Map.get(row, :attached_count, :unloaded))),\n else: row\n\n item = struct!(Schema.module(entity), Map.put(row, :server_instance, instance))\n\n case Map.fetch(acc, id) do\n {:ok, ^item} -> acc\n {:ok, _other} -> fail(:conflicting_rows, [entity, id])\n :error -> Map.put(acc, id, item)\n end\n end)\n end\n\n defp bind_link(row) do\n id = {row[:session_id], row[:index], row[:window_id]}\n if Map.has_key?(row, :id) and row.id != id, do: fail(:invalid_target, [:window_link, row.id])\n Map.put(row, :id, id)\n end\n\n defp attached(count) when is_integer(count), do: count > 0\n defp attached(state), do: state\n\n defp validate_links!(links) do\n Enum.reduce(links, %{}, fn {_, link}, seen ->\n key = {link.session_id, link.index}\n\n if Map.has_key?(seen, key) and seen[key] != link.window_id,\n do: fail(:conflicting_link, [:window_link, link.id])\n\n Map.put(seen, key, link.window_id)\n end)\n end\n\n defp coverage(maps, options) do\n declared = Keyword.get(options, :fields, %{})\n unavailable = options[:unavailable]\n complete = options[:complete]\n\n for entity <- Map.keys(declared) ++ Map.keys(unavailable) ++ complete,\n entity not in Schema.entities(),\n do: fail(:invalid_entity, [entity])\n\n entities =\n Map.new(maps, fn {entity, items} ->\n fields = Map.get(declared, entity, [])\n missing = Map.get(unavailable, entity, [])\n\n for field <- fields ++ missing,\n is_nil(Schema.field(entity, field)),\n do: fail(:invalid_field, [entity, field])\n\n if Enum.any?(fields, &(&1 in missing)), do: fail(:inconsistent_coverage, [entity])\n\n fields =\n if entity == :session and :attached_count in fields,\n do: Enum.uniq([:attached | fields]),\n else: fields\n\n Enum.each(fields, fn field ->\n if Enum.any?(items, fn {_, item} ->\n Map.fetch!(item, field) in [:unloaded, :unavailable]\n end),\n do: fail(:inconsistent_coverage, [entity, field])\n end)\n\n Enum.each(missing, fn field ->\n if Enum.any?(items, fn {_, item} ->\n Map.fetch!(item, field) not in [:unloaded, :unavailable]\n end),\n do: fail(:inconsistent_coverage, [entity, field])\n end)\n\n states = Map.merge(Map.new(fields, &{&1, :loaded}), Map.new(missing, &{&1, :unavailable}))\n\n {entity,\n %{ids: MapSet.new(Map.keys(items)), complete: entity in complete, fields: states}}\n end)\n\n %{entities: entities}\n end\n\n defp validate_declarations!(options) do\n fields = Keyword.get(options, :fields, %{})\n unavailable = options[:unavailable]\n\n for entity <- Map.keys(fields) ++ Map.keys(unavailable) ++ options[:complete],\n entity not in Schema.entities(),\n do: fail(:invalid_entity, [entity])\n\n for declarations <- [fields, unavailable],\n {entity, names} <- declarations,\n name <- names,\n is_nil(Schema.field(entity, name)),\n do: fail(:invalid_field, [entity, name])\n\n fields = derived_coverage(fields)\n unavailable = derived_coverage(unavailable)\n\n for entity <- Schema.entities(),\n field <- Map.get(fields, entity, []),\n field in Map.get(unavailable, entity, []),\n do: fail(:inconsistent_coverage, [entity, field])\n\n options |> Keyword.put(:fields, fields) |> Keyword.put(:unavailable, unavailable)\n end\n\n defp derived_coverage(declarations) do\n names = Map.get(declarations, :session, [])\n\n if :attached in names and :attached_count not in names,\n do: fail(:inconsistent_coverage, [:session, :attached])\n\n if :attached_count in names,\n do: Map.put(declarations, :session, Enum.uniq([:attached | names])),\n else: declarations\n end\n\n defp validate_references!(maps, coverage) do\n for {entity, keys} <- @foreign_keys, {_, item} <- maps[entity], {field, target} <- keys do\n value = Map.fetch!(item, field)\n\n if value not in [:unloaded, :unavailable, nil] and coverage.entities[target].complete and\n not Map.has_key?(maps[target], value),\n do: fail(:inconsistent_snapshot, [entity, item.id, field])\n end\n end\n\n defp indexes(maps) do\n %{\n session_links: grouped(maps.window_link, :session_id, & &1.index),\n window_links: grouped(maps.window_link, :window_id, &sort_key(:window_link, &1.id)),\n window_panes: grouped(maps.pane, :window_id, &sort_key(:pane, &1.id)),\n session_clients: grouped(maps.client, :session_id, & &1.id)\n }\n end\n\n defp grouped(items, field, order) do\n items\n |> Map.values()\n |> Enum.group_by(&Map.fetch!(&1, field))\n |> Map.new(fn {id, rows} -> {id, rows |> Enum.sort_by(order) |> Enum.map(& &1.id)} end)\n end\n\n defp relation_covered?(snapshot, entity, relation, ids) do\n {complete, required} = requirements(entity, relation)\n\n loaded =\n Enum.all?(complete, &snapshot.coverage.entities[&1].complete) and\n Enum.all?(required, fn {e, f} -> snapshot.coverage.entities[e].fields[f] == :loaded end)\n\n if loaded do\n sources = table(snapshot, entity)\n\n # Visit the whole requested domain so later ambiguity remains visible.\n Enum.reduce(ids, true, fn id, covered ->\n present =\n Map.has_key?(sources, id) and relation_targets_present?(snapshot, entity, id, relation)\n\n present and covered\n end)\n else\n false\n end\n end\n\n defp requirements(:pane, :window), do: {[], [pane: :window_id]}\n defp requirements(:client, :session), do: {[], [client: :session_id]}\n defp requirements(:window_link, :session), do: {[], [window_link: :session_id]}\n defp requirements(:window_link, :window), do: {[], [window_link: :window_id]}\n defp requirements(:window, :panes), do: {[:pane], [pane: :window_id]}\n defp requirements(:session, :clients), do: {[:client], [client: :session_id]}\n\n defp requirements(:session, :active_window),\n do:\n {[:window_link], [window_link: :session_id, window_link: :window_id, window_link: :active]}\n\n defp requirements(:session, :panes),\n do:\n {[:window_link, :pane],\n [window_link: :session_id, window_link: :window_id, pane: :window_id]}\n\n defp requirements(_entity, _relation),\n do: {[:window_link], [window_link: :session_id, window_link: :window_id]}\n\n defp relation_targets_present?(snapshot, :session, id, :active_window) do\n case active_link(snapshot, snapshot.sessions[id]) do\n nil -> true\n link -> Map.has_key?(snapshot.windows, link.window_id)\n end\n end\n\n defp relation_targets_present?(snapshot, entity, id, relation) do\n {cardinality, _target} = Schema.relations(entity)[relation]\n result = project(snapshot, entity, table(snapshot, entity)[id], relation)\n if cardinality == :one, do: not is_nil(result), else: Enum.all?(result, &(not is_nil(&1)))\n end\n\n defp project(s, :pane, item, :window), do: s.windows[item.window_id]\n defp project(s, :client, item, :session), do: s.sessions[item.session_id]\n defp project(s, :window_link, item, :session), do: s.sessions[item.session_id]\n defp project(s, :window_link, item, :window), do: s.windows[item.window_id]\n\n defp project(s, :session, item, :active_window) do\n case active_link(s, item) do\n nil -> nil\n link -> s.windows[link.window_id]\n end\n end\n\n defp project(s, :window, item, :panes),\n do: Enum.map(Map.get(s.indexes.window_panes, item.id, []), &s.panes[&1])\n\n defp project(s, :session, item, :clients),\n do: Enum.map(Map.get(s.indexes.session_clients, item.id, []), &s.clients[&1])\n\n defp project(s, :session, item, :window_links),\n do: Enum.map(Map.get(s.indexes.session_links, item.id, []), &s.window_links[&1])\n\n defp project(s, :window, item, :window_links),\n do: Enum.map(Map.get(s.indexes.window_links, item.id, []), &s.window_links[&1])\n\n defp project(s, :session, item, :windows),\n do:\n project(s, :session, item, :window_links)\n |> Enum.map(&s.windows[&1.window_id])\n |> Enum.uniq_by(&if(&1, do: &1.id))\n\n defp project(s, :window, item, :sessions),\n do:\n project(s, :window, item, :window_links)\n |> Enum.map(&s.sessions[&1.session_id])\n |> Enum.uniq_by(&if(&1, do: &1.id))\n |> Enum.sort_by(&if(&1, do: sort_key(:session, &1.id)))\n\n defp project(s, :session, item, :panes) do\n project(s, :session, item, :window_links)\n |> Enum.map(& &1.window_id)\n |> Enum.uniq()\n |> Enum.flat_map(&Map.get(s.indexes.window_panes, &1, []))\n |> Enum.sort_by(&sort_key(:pane, &1))\n |> Enum.map(&s.panes[&1])\n end\n\n defp table(snapshot, entity), do: Map.fetch!(snapshot, @collections[entity])\n\n defp active_link(snapshot, session) do\n case Enum.filter(project(snapshot, :session, session, :window_links), & &1.active) do\n [] -> nil\n [link] -> link\n _ -> raise_error(:ambiguous_relation, [:session, session.id, :active_window])\n end\n end\n\n defp sort_key(:window_link, {session, index, window}),\n do: {sort_key(:session, session), index, sort_key(:window, window)}\n\n defp sort_key(:client, id), do: id\n defp sort_key(_entity, <<_prefix, digits::binary>>), do: String.to_integer(digits)\n\n defp fail(kind, path),\n do: throw(%Error{kind: kind, phase: :capture, certainty: :no_write, path: path})\n\n defp raise_error(kind, path),\n do: raise(Error, kind: kind, phase: :evaluation, certainty: :no_write, path: path)\nend\n" }, "lib/libtmux/transport/oneshot.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "edeafca772d8482d48df39bf25bfbd7dcd63ca5618173eb2883461c979fe00a7", - "content": "defmodule LibTmux.Transport.OneShot do\n @moduledoc \"\"\"\n Executes one explicitly selected executable with bounded captured output.\n\n This Linux transport owns a native helper and its ordinary finite process\n tree. It never uses a shell. A worker owns the Port and observes caller\n death; the helper detects pipe closure after worker or VM death.\n Target environment entries travel as bytes to child `execve`, preserving\n empty values. The helper inherits the trusted host environment; requested\n target variables do not configure the helper. `TMUX` and `TMUX_PANE` are\n removed from the target environment.\n\n Limits apply per call: stdout defaults to 1 MiB, stderr to 64 KiB, and\n retained chunks to 4096. `max_total_bytes` additionally bounds both streams\n together; it defaults to their summed limits. Overload returns an error\n with a bounded prefix.\n Independent caller processes require admission limits at their host or\n server boundary; this primitive maintains no shared request queue.\n\n A positive timeout becomes one execution deadline. Retirement can take\n up to a separate 750 ms cleanup allowance after expiry. Missing retirement\n proof remains `:unknown`. No result authorizes replay. Helper SIGKILL,\n hostile escape and uninterruptible kernel tasks are outside the ordinary\n tree guarantee. Building the native helper requires a C11 compiler.\n \"\"\"\n\n alias LibTmux.{Deadline, Error}\n alias LibTmux.Transport.Native\n alias LibTmux.Transport.Native.Protocol, as: NativeProtocol\n\n @typedoc \"Captured bytes and child exit status after proven owned-process retirement; nonzero exit remains a transport result.\"\n @type result :: %{\n stdout: binary(),\n stderr: binary(),\n exit_status: non_neg_integer(),\n cleanup: :retired\n }\n\n @typedoc \"\"\"\n Per-call input and capture limits; bytes and chunks are bounded independently.\n\n Timeout and deadline are exclusive. A supplied deadline must have at most\n 600,000 ms remaining at validation; it preserves its original cutoff.\n \"\"\"\n @type option ::\n {:timeout, 1..600_000}\n | {:deadline, Deadline.t()}\n | {:cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:max_stdout_bytes | :max_stderr_bytes, 0..16_777_216}\n | {:max_total_bytes, nil | 0..33_554_432}\n | {:max_chunks, 1..65_536}\n\n @cleanup_ms 750\n @chunk_bytes 8192\n\n @doc \"Runs argv without a shell, retaining exit status separately from stdout and stderr.\"\n @spec run(binary(), [binary()], [option()]) :: {:ok, result()} | {:error, Error.t()}\n def run(executable, arguments, options \\\\ []) do\n if length(options) != map_size(Map.new(options)),\n do: raise(ArgumentError, \"duplicate transport options\")\n\n if Keyword.has_key?(options, :deadline) and Keyword.has_key?(options, :timeout),\n do: raise(ArgumentError, \"pass a deadline or timeout, not both\")\n\n deadline =\n Keyword.get_lazy(options, :deadline, fn ->\n Deadline.new(Keyword.get(options, :timeout, 5000))\n end)\n\n options =\n Keyword.validate!(options, [\n :deadline,\n :env,\n :timeout,\n cwd: File.cwd!(),\n max_stdout_bytes: 1_048_576,\n max_stderr_bytes: 65_536,\n max_total_bytes: nil,\n max_chunks: 4096\n ])\n\n spec = validate(executable, arguments, options, deadline)\n\n if :os.type() == {:unix, :linux},\n do: run_worker(spec),\n else: {:error, %Error{kind: :unsupported_platform, phase: :spawn, certainty: :no_write}}\n end\n\n @doc \"Runs argv, raising the same structured transport error on failure.\"\n @spec run!(binary(), [binary()], [option()]) :: result()\n def run!(executable, arguments, options \\\\ []) do\n case run(executable, arguments, options) do\n {:ok, result} -> result\n {:error, error} -> raise error\n end\n end\n\n defp validate(executable, arguments, options, %Deadline{} = deadline) do\n limits = %{1 => options[:max_stdout_bytes], 2 => options[:max_stderr_bytes]}\n\n unless Enum.all?(limits, fn {_, limit} -> is_integer(limit) and limit in 0..16_777_216 end),\n do: raise(ArgumentError, \"stream limits must be 0..16 MiB\")\n\n total_limit =\n case options[:max_total_bytes] do\n nil -> Enum.sum(Map.values(limits))\n value -> value\n end\n\n unless is_integer(total_limit) and total_limit in 0..33_554_432 and\n is_integer(options[:max_chunks]) and options[:max_chunks] in 1..65_536 and\n Deadline.remaining(deadline) <= 600_000 do\n raise ArgumentError,\n \"limits require 0..32 MiB combined, 1..65536 chunks and at most 600000 ms\"\n end\n\n payload =\n NativeProtocol.process(executable, arguments,\n cwd: options[:cwd],\n env: Keyword.get_lazy(options, :env, &System.get_env/0)\n )\n\n %{\n payload: payload,\n limits: limits,\n total_limit: total_limit,\n max_chunks: options[:max_chunks],\n deadline: deadline\n }\n end\n\n defp run_worker(spec) do\n caller = self()\n reply = :erlang.alias()\n token = make_ref()\n\n {worker, monitor} =\n spawn_monitor(fn ->\n Process.flag(:trap_exit, true)\n parent_monitor = Process.monitor(caller)\n result = execute(Map.merge(spec, %{parent_monitor: parent_monitor, token: token}))\n send(reply, {token, result})\n end)\n\n try do\n receive do\n {^token, result} ->\n result\n\n {:DOWN, ^monitor, :process, ^worker, reason} ->\n {:error,\n %Error{\n kind: :worker_failed,\n phase: :capture,\n details: %{reason: classify_exit(reason), cleanup: :unknown}\n }}\n after\n Deadline.remaining(spec.deadline) + @cleanup_ms ->\n send(worker, {:retire, token})\n {:error, %Error{kind: :timeout, phase: :retire, details: %{cleanup: :unknown}}}\n end\n after\n LibTmux.Transport.Reply.close(reply, token)\n Process.demonitor(monitor, [:flush])\n end\n end\n\n defp execute(spec) do\n if Deadline.remaining(spec.deadline) == 0,\n do: {:error, %Error{kind: :timeout, phase: :admission, certainty: :no_write}},\n else: open(spec)\n end\n\n defp open(spec) do\n case start_port(spec) do\n {:error, error} ->\n {:error, error}\n\n {:ok, port} ->\n state =\n Map.merge(spec, %{\n port: port,\n chunks: %{1 => [], 2 => []},\n bytes: %{1 => 0, 2 => 0},\n count: 0,\n started: false\n })\n\n try do\n remaining = Deadline.remaining(spec.deadline)\n\n cond do\n remaining == 0 ->\n abort(state, :timeout, :admission, %{}, :no_write)\n\n send_port(\n port,\n NativeProtocol.open_frame(spec.payload, input: :closed, timeout: remaining)\n ) ->\n await(state)\n\n true ->\n abort(state, :resource_limit, :write, %{reason: :helper_busy}, :no_write)\n end\n after\n close_port(port)\n end\n end\n end\n\n defp start_port(_spec) do\n {:ok,\n Port.open({:spawn_executable, Native.executable()}, [\n :binary,\n :exit_status,\n {:packet, 2}\n ])}\n rescue\n error in ErlangError ->\n {:error,\n %Error{\n kind: :launch_failed,\n phase: :spawn,\n certainty: :no_write,\n details: %{reason: classify_exit(error.original)}\n }}\n end\n\n defp await(state) do\n port = state.port\n parent = state.parent_monitor\n token = state.token\n\n receive do\n {^port, {:data, data}} ->\n frame(state, data)\n\n {^port, {:exit_status, status}} ->\n failure(state, :transport_closed, :capture, %{helper_status: status, cleanup: :unknown})\n\n {:EXIT, ^port, :normal} ->\n await(state)\n\n {:EXIT, ^port, reason} ->\n failure(state, :transport_closed, :capture, %{\n reason: classify_exit(reason),\n cleanup: :unknown\n })\n\n {:DOWN, ^parent, :process, _caller, _reason} ->\n abort(state, :cancelled, :capture)\n\n {:retire, ^token} ->\n abort(state, :timeout, :capture)\n after\n Deadline.remaining(state.deadline) -> abort(state, :timeout, :capture)\n end\n end\n\n defp frame(%{started: false} = state, <>) do\n state = %{state | started: true}\n grant(state, 1)\n grant(state, 2)\n await(state)\n end\n\n defp frame(%{started: true} = state, <>)\n when stream in [1, 2] and byte_size(data) in 1..@chunk_bytes do\n if state.count >= state.max_chunks do\n abort(state, :resource_limit, :capture, %{reason: :chunks})\n else\n retain(state, stream, data)\n end\n end\n\n defp frame(state, <>) when stream in [1, 2], do: await(state)\n\n defp frame(state, <>) when reason in 0..3 do\n send_port(state.port, \"T\")\n cleanup = retire(state.port, Deadline.new(@cleanup_ms), true)\n\n if cleanup == :retired and reason == 0 and Deadline.remaining(state.deadline) > 0 do\n {:ok, Map.merge(capture(state), %{exit_status: status, cleanup: :retired})}\n else\n failure(\n state,\n if(reason == 2 or Deadline.remaining(state.deadline) == 0,\n do: :timeout,\n else: :transport_closed\n ),\n :capture,\n %{exit_status: status, cleanup: cleanup}\n )\n end\n end\n\n defp frame(state, <>) when kind in 1..4 do\n if kind != 4, do: send_port(state.port, \"T\")\n cleanup = retire(state.port, Deadline.new(@cleanup_ms), kind != 4)\n\n if kind == 2,\n do: failure(state, :launch_failed, :spawn, %{errno: number, cleanup: cleanup}, :no_write),\n else:\n failure(state, :transport_failed, :capture, %{\n reason: kind,\n errno: number,\n cleanup: cleanup\n })\n end\n\n defp frame(state, _data), do: abort(state, :protocol_error, :parse)\n\n defp retain(state, stream, data) do\n stream_available = max(state.limits[stream] - state.bytes[stream], 0)\n total_available = max(state.total_limit - state.bytes[1] - state.bytes[2], 0)\n available = min(stream_available, total_available)\n retained = binary_part(data, 0, min(byte_size(data), available)) |> :binary.copy()\n\n state = %{\n state\n | chunks: Map.update!(state.chunks, stream, &[retained | &1]),\n bytes: Map.update!(state.bytes, stream, &(&1 + byte_size(data))),\n count: state.count + 1\n }\n\n if byte_size(data) > available do\n abort(state, :resource_limit, :capture, %{\n reason:\n if(total_available < stream_available,\n do: :total_bytes,\n else: if(stream == 1, do: :stdout_bytes, else: :stderr_bytes)\n )\n })\n else\n grant(state, stream)\n await(state)\n end\n end\n\n defp grant(state, stream) do\n available =\n min(\n state.limits[stream] - state.bytes[stream],\n state.total_limit - state.bytes[1] - state.bytes[2]\n )\n\n size = min(@chunk_bytes, max(available + 1, 1))\n send_port(state.port, <>)\n end\n\n defp abort(state, kind, phase, details \\\\ %{}, certainty \\\\ :unknown) do\n send_port(state.port, \"Q\")\n cleanup = retire(state.port, Deadline.new(@cleanup_ms), false)\n failure(state, kind, phase, Map.put(details, :cleanup, cleanup), certainty)\n end\n\n defp retire(port, deadline, evidence) do\n receive do\n {^port, {:data, <>}} ->\n send_port(port, \"T\")\n retire(port, deadline, true)\n\n {^port, {:data, <>}} when kind in 1..4 ->\n if kind != 4, do: send_port(port, \"T\")\n retire(port, deadline, evidence or kind != 4)\n\n {^port, {:data, _data}} ->\n retire(port, deadline, evidence)\n\n {^port, {:exit_status, _status}} ->\n if(evidence, do: :retired, else: :unknown)\n\n {:EXIT, ^port, :normal} ->\n retire(port, deadline, evidence)\n\n {:EXIT, ^port, _reason} ->\n :unknown\n after\n Deadline.remaining(deadline) -> :unknown\n end\n end\n\n defp capture(state) do\n %{\n stdout: state.chunks[1] |> Enum.reverse() |> IO.iodata_to_binary(),\n stderr: state.chunks[2] |> Enum.reverse() |> IO.iodata_to_binary()\n }\n end\n\n defp failure(state, kind, phase, details, certainty \\\\ :unknown) do\n {:error,\n %Error{\n kind: kind,\n phase: phase,\n certainty: certainty,\n details: Map.merge(capture(state), details)\n }}\n end\n\n defp send_port(port, data) do\n Port.command(port, data, [:nosuspend])\n rescue\n ArgumentError -> false\n end\n\n defp close_port(port) do\n if Port.info(port), do: Port.close(port)\n rescue\n ArgumentError -> :ok\n end\n\n defp classify_exit(reason) when is_atom(reason), do: reason\n defp classify_exit(_reason), do: :other\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "9216b90dffab49f22eaf29dadc842c62aed17c803aa26899b230a4fd567901df", + "content": "defmodule LibTmux.Transport.OneShot do\n @moduledoc \"\"\"\n Executes one explicitly selected executable with bounded captured output.\n\n This Linux transport owns a native helper and its ordinary finite process\n tree. It never uses a shell. A worker owns the Port and observes caller\n death; the helper detects pipe closure after worker or VM death.\n Target environment entries travel as bytes to child `execve`, preserving\n empty values. The helper inherits the trusted host environment; requested\n target variables do not configure the helper. `TMUX` and `TMUX_PANE` are\n removed from the target environment unless `keep_tmux_context: true`, which\n `LibTmux.Server.run/3` passes only for a Server that chose no socket.\n\n Limits apply per call: stdout defaults to 1 MiB, stderr to 64 KiB, and\n retained chunks to 4096. `max_total_bytes` additionally bounds both streams\n together; it defaults to their summed limits. Overload returns an error\n with a bounded prefix.\n Independent caller processes require admission limits at their host or\n server boundary; this primitive maintains no shared request queue.\n\n A positive timeout becomes one execution deadline. Retirement can take\n up to a separate 750 ms cleanup allowance after expiry. Missing retirement\n proof remains `:unknown`. No result authorizes replay. Helper SIGKILL,\n hostile escape and uninterruptible kernel tasks are outside the ordinary\n tree guarantee. Building the native helper requires a C11 compiler.\n \"\"\"\n\n alias LibTmux.{Deadline, Error}\n alias LibTmux.Transport.Native\n alias LibTmux.Transport.Native.Protocol, as: NativeProtocol\n\n @typedoc \"Captured bytes and child exit status after proven owned-process retirement; nonzero exit remains a transport result.\"\n @type result :: %{\n stdout: binary(),\n stderr: binary(),\n exit_status: non_neg_integer(),\n cleanup: :retired\n }\n\n @typedoc \"\"\"\n Per-call input and capture limits; bytes and chunks are bounded independently.\n\n Timeout and deadline are exclusive. A supplied deadline must have at most\n 600,000 ms remaining at validation; it preserves its original cutoff.\n \"\"\"\n @type option ::\n {:timeout, 1..600_000}\n | {:deadline, Deadline.t()}\n | {:cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:keep_tmux_context, boolean()}\n | {:max_stdout_bytes | :max_stderr_bytes, 0..16_777_216}\n | {:max_total_bytes, nil | 0..33_554_432}\n | {:max_chunks, 1..65_536}\n\n @cleanup_ms 750\n @chunk_bytes 8192\n\n @doc \"\"\"\n Runs argv without a shell, retaining exit status separately from stdout and stderr.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec run(binary(), [binary()], [option()]) :: {:ok, result()} | {:error, Error.t()}\n def run(executable, arguments, options \\\\ []) do\n if length(options) != map_size(Map.new(options)),\n do: raise(ArgumentError, \"duplicate transport options\")\n\n if Keyword.has_key?(options, :deadline) and Keyword.has_key?(options, :timeout),\n do: raise(ArgumentError, \"pass a deadline or timeout, not both\")\n\n deadline =\n Keyword.get_lazy(options, :deadline, fn ->\n Deadline.new(Keyword.get(options, :timeout, 5000))\n end)\n\n options =\n Keyword.validate!(options, [\n :deadline,\n :env,\n :timeout,\n cwd: File.cwd!(),\n keep_tmux_context: false,\n max_stdout_bytes: 1_048_576,\n max_stderr_bytes: 65_536,\n max_total_bytes: nil,\n max_chunks: 4096\n ])\n\n spec = validate(executable, arguments, options, deadline)\n\n if :os.type() == {:unix, :linux},\n do: run_worker(spec),\n else: {:error, %Error{kind: :unsupported_platform, phase: :spawn, certainty: :no_write}}\n end\n\n @doc \"\"\"\n Runs argv, raising the same structured transport error on failure.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec run!(binary(), [binary()], [option()]) :: result()\n def run!(executable, arguments, options \\\\ []) do\n case run(executable, arguments, options) do\n {:ok, result} -> result\n {:error, error} -> raise error\n end\n end\n\n defp validate(executable, arguments, options, %Deadline{} = deadline) do\n limits = %{1 => options[:max_stdout_bytes], 2 => options[:max_stderr_bytes]}\n\n unless Enum.all?(limits, fn {_, limit} -> is_integer(limit) and limit in 0..16_777_216 end),\n do: raise(ArgumentError, \"stream limits must be 0..16 MiB\")\n\n total_limit =\n case options[:max_total_bytes] do\n nil -> Enum.sum(Map.values(limits))\n value -> value\n end\n\n unless is_integer(total_limit) and total_limit in 0..33_554_432 and\n is_integer(options[:max_chunks]) and options[:max_chunks] in 1..65_536 and\n Deadline.remaining(deadline) <= 600_000 do\n raise ArgumentError,\n \"limits require 0..32 MiB combined, 1..65536 chunks and at most 600000 ms\"\n end\n\n payload =\n NativeProtocol.process(executable, arguments,\n cwd: options[:cwd],\n env: Keyword.get_lazy(options, :env, &System.get_env/0),\n keep_tmux_context: options[:keep_tmux_context]\n )\n\n %{\n payload: payload,\n limits: limits,\n total_limit: total_limit,\n max_chunks: options[:max_chunks],\n deadline: deadline\n }\n end\n\n defp run_worker(spec) do\n caller = self()\n reply = :erlang.alias()\n token = make_ref()\n\n {worker, monitor} =\n spawn_monitor(fn ->\n Process.flag(:trap_exit, true)\n parent_monitor = Process.monitor(caller)\n result = execute(Map.merge(spec, %{parent_monitor: parent_monitor, token: token}))\n send(reply, {token, result})\n end)\n\n try do\n receive do\n {^token, result} ->\n result\n\n {:DOWN, ^monitor, :process, ^worker, reason} ->\n {:error,\n %Error{\n kind: :worker_failed,\n phase: :capture,\n details: %{reason: classify_exit(reason), cleanup: :unknown}\n }}\n after\n Deadline.remaining(spec.deadline) + @cleanup_ms ->\n send(worker, {:retire, token})\n {:error, %Error{kind: :timeout, phase: :retire, details: %{cleanup: :unknown}}}\n end\n after\n LibTmux.Transport.Reply.close(reply, token)\n Process.demonitor(monitor, [:flush])\n end\n end\n\n defp execute(spec) do\n if Deadline.remaining(spec.deadline) == 0,\n do: {:error, %Error{kind: :timeout, phase: :admission, certainty: :no_write}},\n else: open(spec)\n end\n\n defp open(spec) do\n case start_port(spec) do\n {:error, error} ->\n {:error, error}\n\n {:ok, port} ->\n state =\n Map.merge(spec, %{\n port: port,\n chunks: %{1 => [], 2 => []},\n bytes: %{1 => 0, 2 => 0},\n count: 0,\n started: false\n })\n\n try do\n remaining = Deadline.remaining(spec.deadline)\n\n cond do\n remaining == 0 ->\n abort(state, :timeout, :admission, %{}, :no_write)\n\n send_port(\n port,\n NativeProtocol.open_frame(spec.payload, input: :closed, timeout: remaining)\n ) ->\n await(state)\n\n true ->\n abort(state, :resource_limit, :write, %{reason: :helper_busy}, :no_write)\n end\n after\n close_port(port)\n end\n end\n end\n\n defp start_port(_spec) do\n {:ok,\n Port.open({:spawn_executable, Native.executable()}, [\n :binary,\n :exit_status,\n {:packet, 2}\n ])}\n rescue\n error in ErlangError ->\n {:error,\n %Error{\n kind: :launch_failed,\n phase: :spawn,\n certainty: :no_write,\n details: %{reason: classify_exit(error.original)}\n }}\n end\n\n defp await(state) do\n port = state.port\n parent = state.parent_monitor\n token = state.token\n\n receive do\n {^port, {:data, data}} ->\n frame(state, data)\n\n {^port, {:exit_status, status}} ->\n failure(state, :transport_closed, :capture, %{helper_status: status, cleanup: :unknown})\n\n {:EXIT, ^port, :normal} ->\n await(state)\n\n {:EXIT, ^port, reason} ->\n failure(state, :transport_closed, :capture, %{\n reason: classify_exit(reason),\n cleanup: :unknown\n })\n\n {:DOWN, ^parent, :process, _caller, _reason} ->\n abort(state, :cancelled, :capture)\n\n {:retire, ^token} ->\n abort(state, :timeout, :capture)\n after\n Deadline.remaining(state.deadline) -> abort(state, :timeout, :capture)\n end\n end\n\n defp frame(%{started: false} = state, <>) do\n state = %{state | started: true}\n grant(state, 1)\n grant(state, 2)\n await(state)\n end\n\n defp frame(%{started: true} = state, <>)\n when stream in [1, 2] and byte_size(data) in 1..@chunk_bytes do\n if state.count >= state.max_chunks do\n abort(state, :resource_limit, :capture, %{reason: :chunks})\n else\n retain(state, stream, data)\n end\n end\n\n defp frame(state, <>) when stream in [1, 2], do: await(state)\n\n defp frame(state, <>) when reason in 0..3 do\n send_port(state.port, \"T\")\n cleanup = retire(state.port, Deadline.new(@cleanup_ms), true)\n\n if cleanup == :retired and reason == 0 and Deadline.remaining(state.deadline) > 0 do\n {:ok, Map.merge(capture(state), %{exit_status: status, cleanup: :retired})}\n else\n failure(\n state,\n if(reason == 2 or Deadline.remaining(state.deadline) == 0,\n do: :timeout,\n else: :transport_closed\n ),\n :capture,\n %{exit_status: status, cleanup: cleanup}\n )\n end\n end\n\n defp frame(state, <>) when kind in 1..4 do\n if kind != 4, do: send_port(state.port, \"T\")\n cleanup = retire(state.port, Deadline.new(@cleanup_ms), kind != 4)\n\n if kind == 2,\n do: failure(state, :launch_failed, :spawn, %{errno: number, cleanup: cleanup}, :no_write),\n else:\n failure(state, :transport_failed, :capture, %{\n reason: kind,\n errno: number,\n cleanup: cleanup\n })\n end\n\n defp frame(state, _data), do: abort(state, :protocol_error, :parse)\n\n defp retain(state, stream, data) do\n stream_available = max(state.limits[stream] - state.bytes[stream], 0)\n total_available = max(state.total_limit - state.bytes[1] - state.bytes[2], 0)\n available = min(stream_available, total_available)\n retained = binary_part(data, 0, min(byte_size(data), available)) |> :binary.copy()\n\n state = %{\n state\n | chunks: Map.update!(state.chunks, stream, &[retained | &1]),\n bytes: Map.update!(state.bytes, stream, &(&1 + byte_size(data))),\n count: state.count + 1\n }\n\n if byte_size(data) > available do\n abort(state, :resource_limit, :capture, %{\n reason:\n if(total_available < stream_available,\n do: :total_bytes,\n else: if(stream == 1, do: :stdout_bytes, else: :stderr_bytes)\n )\n })\n else\n grant(state, stream)\n await(state)\n end\n end\n\n defp grant(state, stream) do\n available =\n min(\n state.limits[stream] - state.bytes[stream],\n state.total_limit - state.bytes[1] - state.bytes[2]\n )\n\n size = min(@chunk_bytes, max(available + 1, 1))\n send_port(state.port, <>)\n end\n\n defp abort(state, kind, phase, details \\\\ %{}, certainty \\\\ :unknown) do\n send_port(state.port, \"Q\")\n cleanup = retire(state.port, Deadline.new(@cleanup_ms), false)\n failure(state, kind, phase, Map.put(details, :cleanup, cleanup), certainty)\n end\n\n defp retire(port, deadline, evidence) do\n receive do\n {^port, {:data, <>}} ->\n send_port(port, \"T\")\n retire(port, deadline, true)\n\n {^port, {:data, <>}} when kind in 1..4 ->\n if kind != 4, do: send_port(port, \"T\")\n retire(port, deadline, evidence or kind != 4)\n\n {^port, {:data, _data}} ->\n retire(port, deadline, evidence)\n\n {^port, {:exit_status, _status}} ->\n if(evidence, do: :retired, else: :unknown)\n\n {:EXIT, ^port, :normal} ->\n retire(port, deadline, evidence)\n\n {:EXIT, ^port, _reason} ->\n :unknown\n after\n Deadline.remaining(deadline) -> :unknown\n end\n end\n\n defp capture(state) do\n %{\n stdout: state.chunks[1] |> Enum.reverse() |> IO.iodata_to_binary(),\n stderr: state.chunks[2] |> Enum.reverse() |> IO.iodata_to_binary()\n }\n end\n\n defp failure(state, kind, phase, details, certainty \\\\ :unknown) do\n {:error,\n %Error{\n kind: kind,\n phase: phase,\n certainty: certainty,\n details: Map.merge(capture(state), details)\n }}\n end\n\n defp send_port(port, data) do\n Port.command(port, data, [:nosuspend])\n rescue\n ArgumentError -> false\n end\n\n defp close_port(port) do\n if Port.info(port), do: Port.close(port)\n rescue\n ArgumentError -> :ok\n end\n\n defp classify_exit(reason) when is_atom(reason), do: reason\n defp classify_exit(_reason), do: :other\nend\n" }, "lib/libtmux/wire.ex": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", - "sha256": "068dc9dcd0924a46f31fd2e496b6e79fd6088a027751d1a266827a02ee6801ec", - "content": "defmodule LibTmux.Wire do\n @moduledoc \"\"\"\n Bounded JSON decoding with duplicate keys preserved until validation.\n\n Uses the built-in JSON decoder callbacks. Object keys stay strings; no\n atoms are created. Byte, nesting, node, array and string ceilings apply\n before conversion to public maps. Parsing failures retain root paths and\n offsets where supplied; duplicate-key failures identify the object path.\n Depth starts at zero for the root value and increases for every object\n member or array element; the maximum is inclusive for maps and JSON alike.\n \"\"\"\n\n alias LibTmux.{Error, Filter}\n\n @typedoc \"A JSON value with string-keyed objects; invalid external terms return a validation error.\"\n @type value :: nil | boolean() | integer() | float() | String.t() | [value()] | object()\n @typedoc \"A JSON object whose keys remain strings; validation never creates atoms from external names.\"\n @type object :: %{optional(String.t()) => value()}\n\n @doc \"Decodes one complete bounded JSON value, rejecting duplicate keys and trailing data.\"\n @spec decode(binary(), [Filter.limit_option()]) :: {:ok, value()} | {:error, Error.t()}\n def decode(binary, options \\\\ []) when is_binary(binary) do\n limits = Filter.limits(options)\n\n try do\n if byte_size(binary) > limits.max_bytes, do: fail(:resource_limit, [], :bytes)\n\n start = fn old ->\n if old.depth > limits.max_depth, do: fail(:resource_limit, [], :depth)\n %{depth: old.depth + 1, nodes: old.nodes, values: [], count: 0}\n end\n\n push = fn value, acc, maximum ->\n if acc.count >= maximum, do: fail(:resource_limit, [], :list)\n if acc.nodes >= limits.max_nodes, do: fail(:resource_limit, [], :nodes)\n %{acc | values: [value | acc.values], count: acc.count + 1, nodes: acc.nodes + 1}\n end\n\n decoders = [\n array_start: start,\n object_start: start,\n array_push: fn value, acc -> push.(value, acc, limits.max_list) end,\n object_push: fn key, value, acc -> push.({key, value}, acc, 256) end,\n array_finish: fn acc, old -> {Enum.reverse(acc.values), %{old | nodes: acc.nodes}} end,\n object_finish: fn acc, old ->\n {{:json_object, Enum.reverse(acc.values)}, %{old | nodes: acc.nodes}}\n end,\n string: fn value ->\n if byte_size(value) > limits.max_string_bytes,\n do: fail(:resource_limit, [], :string_bytes)\n\n value\n end,\n integer: fn value ->\n if byte_size(value) > 20, do: fail(:resource_limit, [], :number_bytes)\n String.to_integer(value)\n end,\n float: fn value ->\n if byte_size(value) > 64, do: fail(:resource_limit, [], :number_bytes)\n String.to_float(value)\n end\n ]\n\n case JSON.decode(binary, %{depth: 0, nodes: 1}, decoders) do\n {value, _acc, \"\"} -> validate(objects(value, []), options)\n {_value, _acc, _rest} -> fail(:invalid_json, [], :trailing_data)\n {:error, reason} -> fail(:invalid_json, [], :syntax, %{reason: reason})\n end\n rescue\n ArgumentError ->\n {:error,\n %Error{\n kind: :invalid_json,\n phase: :parse,\n certainty: :no_write,\n details: %{code: :invalid_number}\n }}\n catch\n %Error{} = error -> {:error, error}\n end\n end\n\n @doc \"Validates already-decoded JSON data and its complete encoded byte size.\"\n @spec validate(term(), [Filter.limit_option()]) :: {:ok, value()} | {:error, Error.t()}\n def validate(value, options \\\\ []) do\n limits = Filter.limits(options)\n\n try do\n walk(value, [], 0, %{nodes: 0, bytes: 0, limits: limits})\n {:ok, value}\n catch\n %Error{} = error -> {:error, error}\n end\n end\n\n defp objects({:json_object, pairs}, path) do\n Enum.reduce(pairs, %{}, fn {key, value}, acc ->\n if Map.has_key?(acc, key), do: fail(:invalid_json, path ++ [key], :duplicate_key)\n Map.put(acc, key, objects(value, path ++ [key]))\n end)\n end\n\n defp objects(values, path) when is_list(values),\n do:\n values\n |> Enum.with_index()\n |> Enum.map(fn {value, index} -> objects(value, path ++ [index]) end)\n\n defp objects(value, _path), do: value\n\n defp walk(value, path, depth, state) do\n if depth > state.limits.max_depth, do: fail(:resource_limit, path, :depth)\n if state.nodes >= state.limits.max_nodes, do: fail(:resource_limit, path, :nodes)\n state = %{state | nodes: state.nodes + 1}\n\n cond do\n is_map(value) and not is_struct(value) ->\n if map_size(value) > 256, do: fail(:resource_limit, path, :object_members)\n state = charge(state, 2 + max(map_size(value) - 1, 0), path)\n\n Enum.reduce(value, state, fn {key, child}, state ->\n unless is_binary(key), do: fail(:invalid_json, path, :string_keys_required)\n state = charge_string(state, key, path ++ [key]) |> charge(1, path)\n walk(child, path ++ [key], depth + 1, state)\n end)\n\n is_list(value) ->\n if length(value) > state.limits.max_list, do: fail(:resource_limit, path, :list)\n state = charge(state, 2 + max(length(value) - 1, 0), path)\n\n value\n |> Enum.with_index()\n |> Enum.reduce(state, fn {child, index}, state ->\n walk(child, path ++ [index], depth + 1, state)\n end)\n\n is_binary(value) ->\n charge_string(state, value, path)\n\n is_integer(value) and value in -9_223_372_036_854_775_808..9_223_372_036_854_775_807 ->\n charge(state, byte_size(Integer.to_string(value)), path)\n\n is_float(value) ->\n charge(state, byte_size(JSON.encode!(value)), path)\n\n value in [true, false, nil] ->\n charge(state, byte_size(JSON.encode!(value)), path)\n\n true ->\n fail(:invalid_json, path, :unsupported_value)\n end\n end\n\n defp charge_string(state, value, path) do\n unless String.valid?(value), do: fail(:invalid_json, path, :utf8)\n\n if byte_size(value) > state.limits.max_string_bytes,\n do: fail(:resource_limit, path, :string_bytes)\n\n charge(state, IO.iodata_length(JSON.encode_to_iodata!(value)), path)\n end\n\n defp charge(state, bytes, path) do\n if state.bytes + bytes > state.limits.max_bytes, do: fail(:resource_limit, path, :bytes)\n %{state | bytes: state.bytes + bytes}\n end\n\n defp fail(kind, path, code, details \\\\ %{}),\n do:\n throw(%Error{\n kind: kind,\n phase: :parse,\n certainty: :no_write,\n path: path,\n details: Map.put(details, :code, code)\n })\nend\n" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sha256": "bdb83f5e8cba2e7eab2c655e30fd2b464f53cd87b1d9f6db34646f067f6d4479", + "content": "defmodule LibTmux.Wire do\n @moduledoc \"\"\"\n Bounded JSON decoding with duplicate keys preserved until validation.\n\n Uses the built-in JSON decoder callbacks. Object keys stay strings; no\n atoms are created. Byte, nesting, node, array and string ceilings apply\n before conversion to public maps. Parsing failures retain root paths and\n offsets where supplied; duplicate-key failures identify the object path.\n Depth starts at zero for the root value and increases for every object\n member or array element; the maximum is inclusive for maps and JSON alike.\n \"\"\"\n\n alias LibTmux.{Error, Filter}\n\n @typedoc \"A JSON value with string-keyed objects; invalid external terms return a validation error.\"\n @type value :: nil | boolean() | integer() | float() | String.t() | [value()] | object()\n @typedoc \"A JSON object whose keys remain strings; validation never creates atoms from external names.\"\n @type object :: %{optional(String.t()) => value()}\n\n @doc \"\"\"\n Decodes one complete bounded JSON value, rejecting duplicate keys and trailing data.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec decode(binary(), [Filter.limit_option()]) :: {:ok, value()} | {:error, Error.t()}\n def decode(binary, options \\\\ []) when is_binary(binary) do\n limits = Filter.limits(options)\n\n try do\n if byte_size(binary) > limits.max_bytes, do: fail(:resource_limit, [], :bytes)\n\n start = fn old ->\n if old.depth > limits.max_depth, do: fail(:resource_limit, [], :depth)\n %{depth: old.depth + 1, nodes: old.nodes, values: [], count: 0}\n end\n\n push = fn value, acc, maximum ->\n if acc.count >= maximum, do: fail(:resource_limit, [], :list)\n if acc.nodes >= limits.max_nodes, do: fail(:resource_limit, [], :nodes)\n %{acc | values: [value | acc.values], count: acc.count + 1, nodes: acc.nodes + 1}\n end\n\n decoders = [\n array_start: start,\n object_start: start,\n array_push: fn value, acc -> push.(value, acc, limits.max_list) end,\n object_push: fn key, value, acc -> push.({key, value}, acc, 256) end,\n array_finish: fn acc, old -> {Enum.reverse(acc.values), %{old | nodes: acc.nodes}} end,\n object_finish: fn acc, old ->\n {{:json_object, Enum.reverse(acc.values)}, %{old | nodes: acc.nodes}}\n end,\n string: fn value ->\n if byte_size(value) > limits.max_string_bytes,\n do: fail(:resource_limit, [], :string_bytes)\n\n value\n end,\n integer: fn value ->\n if byte_size(value) > 20, do: fail(:resource_limit, [], :number_bytes)\n String.to_integer(value)\n end,\n float: fn value ->\n if byte_size(value) > 64, do: fail(:resource_limit, [], :number_bytes)\n String.to_float(value)\n end\n ]\n\n case JSON.decode(binary, %{depth: 0, nodes: 1}, decoders) do\n {value, _acc, \"\"} -> validate(objects(value, []), options)\n {_value, _acc, _rest} -> fail(:invalid_json, [], :trailing_data)\n {:error, reason} -> fail(:invalid_json, [], :syntax, %{reason: reason})\n end\n rescue\n ArgumentError ->\n {:error,\n %Error{\n kind: :invalid_json,\n phase: :parse,\n certainty: :no_write,\n details: %{code: :invalid_number}\n }}\n catch\n %Error{} = error -> {:error, error}\n end\n end\n\n @doc \"\"\"\n Validates already-decoded JSON data and its complete encoded byte size.\n\n Arrays must be proper lists; a malformed tail reports the containing\n array's path. An excess prefix returns the list limit before inspecting its tail.\n\n See the [worked example](api-examples.html#encoding-and-protocol).\n \"\"\"\n @spec validate(term(), [Filter.limit_option()]) :: {:ok, value()} | {:error, Error.t()}\n def validate(value, options \\\\ []) do\n limits = Filter.limits(options)\n\n try do\n walk(value, [], 0, %{nodes: 0, bytes: 0, limits: limits})\n {:ok, value}\n catch\n %Error{} = error -> {:error, error}\n end\n end\n\n defp objects({:json_object, pairs}, path) do\n Enum.reduce(pairs, %{}, fn {key, value}, acc ->\n if Map.has_key?(acc, key), do: fail(:invalid_json, path ++ [key], :duplicate_key)\n Map.put(acc, key, objects(value, path ++ [key]))\n end)\n end\n\n defp objects(values, path) when is_list(values),\n do:\n values\n |> Enum.with_index()\n |> Enum.map(fn {value, index} -> objects(value, path ++ [index]) end)\n\n defp objects(value, _path), do: value\n\n defp walk(value, path, depth, state) do\n if depth > state.limits.max_depth, do: fail(:resource_limit, path, :depth)\n if state.nodes >= state.limits.max_nodes, do: fail(:resource_limit, path, :nodes)\n state = %{state | nodes: state.nodes + 1}\n\n cond do\n is_map(value) and not is_struct(value) ->\n if map_size(value) > 256, do: fail(:resource_limit, path, :object_members)\n state = charge(state, 2 + max(map_size(value) - 1, 0), path)\n\n Enum.reduce(value, state, fn {key, child}, state ->\n unless is_binary(key), do: fail(:invalid_json, path, :string_keys_required)\n state = charge_string(state, key, path ++ [key]) |> charge(1, path)\n walk(child, path ++ [key], depth + 1, state)\n end)\n\n is_list(value) ->\n count = list_length(value, path, state.limits.max_list, 0)\n state = charge(state, 2 + max(count - 1, 0), path)\n\n value\n |> Enum.with_index()\n |> Enum.reduce(state, fn {child, index}, state ->\n walk(child, path ++ [index], depth + 1, state)\n end)\n\n is_binary(value) ->\n charge_string(state, value, path)\n\n is_integer(value) and value in -9_223_372_036_854_775_808..9_223_372_036_854_775_807 ->\n charge(state, byte_size(Integer.to_string(value)), path)\n\n is_float(value) ->\n charge(state, byte_size(JSON.encode!(value)), path)\n\n value in [true, false, nil] ->\n charge(state, byte_size(JSON.encode!(value)), path)\n\n true ->\n fail(:invalid_json, path, :unsupported_value)\n end\n end\n\n defp list_length([], _path, _maximum, count), do: count\n\n defp list_length([_ | tail], path, maximum, count) when count < maximum,\n do: list_length(tail, path, maximum, count + 1)\n\n defp list_length([_ | _], path, _maximum, _count), do: fail(:resource_limit, path, :list)\n defp list_length(_tail, path, _maximum, _count), do: fail(:invalid_json, path, :improper_list)\n\n defp charge_string(state, value, path) do\n unless String.valid?(value), do: fail(:invalid_json, path, :utf8)\n\n if byte_size(value) > state.limits.max_string_bytes,\n do: fail(:resource_limit, path, :string_bytes)\n\n charge(state, IO.iodata_length(JSON.encode_to_iodata!(value)), path)\n end\n\n defp charge(state, bytes, path) do\n if state.bytes + bytes > state.limits.max_bytes, do: fail(:resource_limit, path, :bytes)\n %{state | bytes: state.bytes + bytes}\n end\n\n defp fail(kind, path, code, details \\\\ %{}),\n do:\n throw(%Error{\n kind: kind,\n phase: :parse,\n certainty: :no_write,\n path: path,\n details: Map.put(details, :code, code)\n })\nend\n" } } } diff --git a/site/src/data/api/elixir.json b/site/src/data/api/elixir.json index 0a9fb5c09..1e5c47265 100644 --- a/site/src/data/api/elixir.json +++ b/site/src/data/api/elixir.json @@ -1 +1 @@ -{"port":"elixir","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractor":"@libtmux/api-model@0.0.1 (Elixir EEP-48 documentation chunks and Code.Typespec v1)","nativeProvenance":{"files":[{"path":"lib/libtmux/capture.ex","sha256":"297a1b8964fc28866f1d2987d6ff5aea6ce3e2d5e8d0ed06bddf1e1840b8761f"},{"path":"lib/libtmux/codec.ex","sha256":"092e832359dcb394daadb42089e801f8927367bb0a24f811b7bebb0635134fad"},{"path":"lib/libtmux/command.ex","sha256":"fbe4b99dcddbc581c927afc88f0e9fc20ff3bda442781b59c54aceae2408cebe"},{"path":"lib/libtmux/control.ex","sha256":"7ad2cfa188a526c78abb62eafdad81a62a80cbd4481726a4c11c8b9658496ce2"},{"path":"lib/libtmux/control/admission.ex","sha256":"0e5d950c86dbb2a5baf00760f9f812099fcc798e218f37a0cd47cfeeba3ee18c"},{"path":"lib/libtmux/control/births.ex","sha256":"169095e1e1fb89c0580d3a450cfc4ac29159961dfa63254ff8afe296996efec7"},{"path":"lib/libtmux/control/bootstrap.ex","sha256":"91cc62d85b00ca09fd6daa5cf58bdc8baefc79d5765cb15d86ee87b1e09a4fc6"},{"path":"lib/libtmux/control/connection_supervisor.ex","sha256":"14b12e40c46cd52df11a1065737e6da95b476f4563a94d2273a4af33bb872535"},{"path":"lib/libtmux/control/epoch_host.ex","sha256":"874239ea92a067f4622c91a11639861a8375b2146c58aaa39fff9c299a6c36a9"},{"path":"lib/libtmux/control/epoch_supervisor.ex","sha256":"16c64e39002c17d5d08bfb97dd0bb5a2415b9b3692480dd7418f1c048ebbd5ba"},{"path":"lib/libtmux/control/exchange.ex","sha256":"41256315d3bdafcc7cf62b223a1b2b40f3935a113a5e183e491323e80130ee51"},{"path":"lib/libtmux/control/guardian.ex","sha256":"0d4396bde7f804957d9491564355b36ca4f3b624d1aaa17e65753e8df4dd91a6"},{"path":"lib/libtmux/control/inbox.ex","sha256":"33f75a29cbfd744a17e8e0975608fc6cee77769d918dbb8237cf400473f91fa3"},{"path":"lib/libtmux/control/lifetime.ex","sha256":"a8ee9bd0692af064870c152d7479ca8ab9a7b17fb4fb8c2e9377acc8c58f20aa"},{"path":"lib/libtmux/control/manager.ex","sha256":"1a2c6501d68d6988714a10952e42faac9ffdf2f8fd1115b23f5ff8fbc849cd89"},{"path":"lib/libtmux/control/owned_term.ex","sha256":"22236edb147924c981a231a3a160e786e8777da5276f38c365962dc57db5b357"},{"path":"lib/libtmux/control/records.ex","sha256":"0d493ec24e9abe91724ec5a9729066316cd80f7a71d83291ba5031d8a5198d2b"},{"path":"lib/libtmux/control/request.ex","sha256":"f56b3c4b8bfeca97b1d39f37c5fe67fec8043f202c7cd87043482a479502dd10"},{"path":"lib/libtmux/control/router.ex","sha256":"17bc94b85db8280382fa89d19867f23454c572c3b022a1b276caac1c8292b51c"},{"path":"lib/libtmux/control/start.ex","sha256":"7e699b18d7aefe7a4af13abe6ab8b7ad7d074bacec701fbd1da08e101293e535"},{"path":"lib/libtmux/control/supervisor_start.ex","sha256":"78a698f9281045800d1b112ca7c91ace693be0d4dfa5f2199be71a8d3ebd0013"},{"path":"lib/libtmux/control/waiters.ex","sha256":"e49d8af88dd622a32e0a4c3633ca36bce3e56088eecada37ec3b60f0a3ffb25d"},{"path":"lib/libtmux/deadline.ex","sha256":"3f678dea1b67e8fd5e0e7383f2246fe7953e6b7e8cc9651244b9e6d3401c6f1c"},{"path":"lib/libtmux/entities.ex","sha256":"b7f564bca6684ddb7169f2c8e4968c86112249dc0e7c69d9773a5361e8421bf4"},{"path":"lib/libtmux/error.ex","sha256":"f0bed995aaf15970457e29d4fc92d06fd415ead42c498a640ca47e1af7fbd487"},{"path":"lib/libtmux/filter.ex","sha256":"d568eb71ff30737afa40665b00fc73ed624e9c24d5f4547dd9658ee5e81c4a9a"},{"path":"lib/libtmux/filter/evaluator.ex","sha256":"fb3dcdade4306c8a6ff12c547fe8a1fc6f729518e9561a2df3f99358ce41a359"},{"path":"lib/libtmux/filter/wire.ex","sha256":"183928fcd937ed76a5e1718b7bbdf5f4a38be3ea02592ca42207cc087890e8ad"},{"path":"lib/libtmux/format.ex","sha256":"ca5dc85f4c6dbb0f5c4b2763875d7240fdaaeba562d98240c9cfb4e9854132fb"},{"path":"lib/libtmux/operation.ex","sha256":"b3cbccc29af70b1374ba5a386f7124c65fbc7ac27313d892d51da8d80ae9e54b"},{"path":"lib/libtmux/operation/lifecycle.ex","sha256":"0221ea46f5395f4b2aa86f9846cff7b0ebe932abb91f7ee118d298f68b1f7e8f"},{"path":"lib/libtmux/process_identity.ex","sha256":"5936b66347b803525d90a04bbd596790389bea97bdf8a82554b1d8bd1f6641e5"},{"path":"lib/libtmux/protocol.ex","sha256":"09417df9a7423bcefc10abec1c8fbcce5da572ef8d71c06113bedf83ef2b0713"},{"path":"lib/libtmux/ref.ex","sha256":"8055eb6833915f11d449200f6fc7d2dea053c65231bb22c079a888baeee4f739"},{"path":"lib/libtmux/schema.ex","sha256":"5e2c436db61fa76ac945821ada8143a6a7450f293eae5d1115dabeecf2cd9bbe"},{"path":"lib/libtmux/selection.ex","sha256":"bcab9130bc60096c5817bd1a54c7de0f6fe588aac5e0c93e6894602f6317e413"},{"path":"lib/libtmux/server.ex","sha256":"8174ab2224e12a3f36b9f6884d6b92a39f1725b7bc4b4f4b1740a3aed9debf9f"},{"path":"lib/libtmux/snapshot.ex","sha256":"b4b1e19890f5bcb039cb062774b4675a65928c558f26b13de00c6c7bd62fe3da"},{"path":"lib/libtmux/transport/native.ex","sha256":"4ec14f18472e94d848462f6acc598fdc8124532fe1b55bbf56e845d762852d3a"},{"path":"lib/libtmux/transport/native/driver.ex","sha256":"91a85c2d9ff593bc127d27432bc5d57822949d2b3aa905d35840c492db23028e"},{"path":"lib/libtmux/transport/native/protocol.ex","sha256":"a18735142c4b1da906f4ea251691d57fcaf88778010b1b1cc505b8ea2044aad1"},{"path":"lib/libtmux/transport/oneshot.ex","sha256":"edeafca772d8482d48df39bf25bfbd7dcd63ca5618173eb2883461c979fe00a7"},{"path":"lib/libtmux/transport/reply.ex","sha256":"be1bad8d3b00b3ecf609a2887daee001bb9a84e49cb147780ea0c52f58caddf1"},{"path":"lib/libtmux/wire.ex","sha256":"068dc9dcd0924a46f31fd2e496b6e79fd6088a027751d1a266827a02ee6801ec"},{"path":"mix.exs","sha256":"c2ee791be07b5d5c04f5e9b4ac73f703fa9441b557d42a5e33af93471ace4ef1"}],"exporter":{"name":"Elixir EEP-48 documentation chunks and Code.Typespec","version":1,"elixir":"1.20.4","otp":"29.1.2","columns":60}},"sources":[{"product":"core","package":"libtmux","version":"0.0.1-alpha.1","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"}],"symbols":[{"id":"LibTmux.Capture","publicId":"LibTmux.Capture","name":"Capture","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Builds a bounded one-shot observation of one existing Linux tmux server.","body":"Capture checks topology and OS server identity before and after field\nreads. At most two attempts share the original deadline and work budgets;\n`attempts` accepts 1–3. Only inconsistent topology or disappearing read\ntargets retry. Decoding and coverage errors remain visible.\n\nDefaults: 1024 contextual entity rows, 512 commands, 8 MiB total response\nbytes, 64 KiB per response and 5000 ms. Exceeding a ceiling returns an\nerror, never a partial success. Linked rows count against the work limit.\nCapture adds no control attachment. Hooks configured on list commands can\nstill have effects; retries do not replay application mutations."},"source":{"file":"lib/libtmux/capture.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-capture"},{"id":"LibTmux.Capture.option/0","publicId":"LibTmux.Capture.option/0","name":"option/0","namespace":"LibTmux.Capture","parent":"LibTmux.Capture","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:timeout, pos_integer()}\n | {:deadline, LibTmux.Deadline.t()}\n | {:attempts, 1..3}\n | {:max_entities\n | :max_commands\n | :max_bytes\n | :max_response_bytes, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:timeout, pos_integer()}\n | {:deadline, LibTmux.Deadline.t()}\n | {:attempts, 1..3}\n | {:max_entities\n | :max_commands\n | :max_bytes\n | :max_response_bytes, pos_integer()}","doc":{"summary":"Capture-wide budgets shared by all attempts and reads.","body":"Each read uses the smaller of remaining `max_bytes` and `max_response_bytes`.\nThat effective ceiling must fit OneShot's 16 MiB stdout limit. The shared\ndeadline must have at most 600,000 ms remaining when OneShot validates a read.\nInvalid combinations raise `ArgumentError` before that command executes."},"source":{"file":"lib/libtmux/capture.ex","line":19,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-capture-option-0"},{"id":"LibTmux.Capture.fetch/2","publicId":"LibTmux.Capture.fetch/2","name":"fetch/2","namespace":"LibTmux.Capture","parent":"LibTmux.Capture","kind":"function","modifiers":[],"signatures":[{"raw":"fetch(server, options \\\\ [])\n@spec fetch(LibTmux.Server.t(), [option()]) ::\n {:ok, LibTmux.Snapshot.t()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"server","type":"LibTmux.Server.t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"{:ok, LibTmux.Snapshot.t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Performs bounded capture through an explicit server descriptor.","body":"See `t:option/0` for the composed work, response and remaining-deadline\nconstraints inherited from `LibTmux.Transport.OneShot.run/3`."},"source":{"file":"lib/libtmux/capture.ex","line":43,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-capture-fetch-2"},{"id":"LibTmux.Client","publicId":"LibTmux.Client","name":"Client","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An immutable attached-client observation, keyed by validated client name."},"source":{"file":"lib/libtmux/entities.ex","line":107,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client"},{"id":"LibTmux.Client.id","publicId":"LibTmux.Client.id","name":"id","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client-id"},{"id":"LibTmux.Client.server_instance","publicId":"LibTmux.Client.server_instance","name":"server_instance","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client-server_instance"},{"id":"LibTmux.Client.session_id","publicId":"LibTmux.Client.session_id","name":"session_id","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client-session_id"},{"id":"LibTmux.Client.pid","publicId":"LibTmux.Client.pid","name":"pid","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client-pid"},{"id":"LibTmux.Client.width","publicId":"LibTmux.Client.width","name":"width","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client-width"},{"id":"LibTmux.Client.height","publicId":"LibTmux.Client.height","name":"height","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer() | nil)","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client-height"},{"id":"LibTmux.Client.control_mode","publicId":"LibTmux.Client.control_mode","name":"control_mode","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client-control_mode"},{"id":"LibTmux.Client.t/0","publicId":"LibTmux.Client.t/0","name":"t/0","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Client{\n control_mode: LibTmux.Schema.observed(boolean()),\n height:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n id: String.t(),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer())\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Client{\n control_mode: LibTmux.Schema.observed(boolean()),\n height:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n id: String.t(),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer())\n }","doc":{"summary":"An attached client; a known absent height is distinct from unloaded or unavailable coverage."},"source":{"file":"lib/libtmux/entities.ex","line":120,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-client-t-0"},{"id":"LibTmux.Codec","publicId":"LibTmux.Codec","name":"Codec","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes bounded field responses and control-output bytes.","body":"A field response contains one free-form field and one framing newline.\nThe default raw mode removes only its framing newline and requires a\nseparately qualified raw source. Use `encoding: :escaped_v1` for output\nproduced by `LibTmux.Format.field/1`, including tmux 3.4's print path.\nThis is a conservative response codec, not a multi-field row codec."},"source":{"file":"lib/libtmux/codec.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-codec"},{"id":"LibTmux.Codec.field_type/0","publicId":"LibTmux.Codec.field_type/0","name":"field_type/0","namespace":"LibTmux.Codec","parent":"LibTmux.Codec","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type field_type() :: :bytes | :string | :integer | :boolean","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"field_type() :: :bytes | :string | :integer | :boolean","doc":{"summary":"The required decoded field category; string additionally requires valid UTF-8."},"source":{"file":"lib/libtmux/codec.ex","line":14,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-codec-field_type-0"},{"id":"LibTmux.Codec.field_option/0","publicId":"LibTmux.Codec.field_option/0","name":"field_option/0","namespace":"LibTmux.Codec","parent":"LibTmux.Codec","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type field_option() ::\n {:encoding, :raw | :escaped_v1}\n | {:max_bytes, pos_integer()}\n | {:min | :max, integer() | nil}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"field_option() ::\n {:encoding, :raw | :escaped_v1}\n | {:max_bytes, pos_integer()}\n | {:min | :max, integer() | nil}","doc":{"summary":"Field framing and value validation options; min and max apply only to integer fields."},"source":{"file":"lib/libtmux/codec.ex","line":16,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-codec-field_option-0"},{"id":"LibTmux.Codec.decode_field/3","publicId":"LibTmux.Codec.decode_field/3","name":"decode_field/3","namespace":"LibTmux.Codec","parent":"LibTmux.Codec","kind":"function","modifiers":["overload"],"signatures":[{"raw":"decode_field(response, type, options \\\\ [])\n@spec decode_field(binary(), :bytes | :string, [\n field_option()\n ]) ::\n {:ok, binary()} | {:error, LibTmux.Error.t()}","params":[{"name":"response","type":"binary()"},{"name":"type","type":":bytes | :string"},{"name":"options","type":"[field_option()]","default":"[]"}],"returns":"{:ok, binary()} | {:error, LibTmux.Error.t()}"},{"raw":"decode_field(response, type, options \\\\ [])\n@spec decode_field(binary(), :integer, [field_option()]) ::\n {:ok, integer()} | {:error, LibTmux.Error.t()}","params":[{"name":"response","type":"binary()"},{"name":"type","type":":integer"},{"name":"options","type":"[field_option()]","default":"[]"}],"returns":"{:ok, integer()} | {:error, LibTmux.Error.t()}"},{"raw":"decode_field(response, type, options \\\\ [])\n@spec decode_field(binary(), :boolean, [field_option()]) ::\n {:ok, boolean()} | {:error, LibTmux.Error.t()}","params":[{"name":"response","type":"binary()"},{"name":"type","type":":boolean"},{"name":"options","type":"[field_option()]","default":"[]"}],"returns":"{:ok, boolean()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Removes one framing newline and validates the complete field value."},"source":{"file":"lib/libtmux/codec.ex","line":22,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-codec-decode_field-3"},{"id":"LibTmux.Codec.decode_output/2","publicId":"LibTmux.Codec.decode_output/2","name":"decode_output/2","namespace":"LibTmux.Codec","parent":"LibTmux.Codec","kind":"function","modifiers":[],"signatures":[{"raw":"decode_output(value, options \\\\ [])\n@spec decode_output(binary(), [\n {:max_bytes, pos_integer()}\n ]) ::\n {:ok, binary()} | {:error, LibTmux.Error.t()}","params":[{"name":"value","type":"binary()"},{"name":"options","type":"[{:max_bytes, pos_integer()}]","default":"[]"}],"returns":"{:ok, binary()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes tmux's three-digit octal output escapes as bytes."},"source":{"file":"lib/libtmux/codec.ex","line":46,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-codec-decode_output-2"},{"id":"LibTmux.Command","publicId":"LibTmux.Command","name":"Command","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A command value with separate argv and tmux-text renderers.","body":"Construction performs no I/O. Arguments are bytes without NUL. Rendering\nprotects command syntax; arguments interpreted as formats still require\n`LibTmux.Format`. A command value does not authorize a shared control lane\nor establish completion behavior, including configured hooks and aliases."},"source":{"file":"lib/libtmux/command.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-command"},{"id":"LibTmux.Command.t/0","publicId":"LibTmux.Command.t/0","name":"t/0","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Trusted command data without I/O. Format operands need separate encoding before execution."},"source":{"file":"lib/libtmux/command.ex","line":14,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-command-t-0"},{"id":"LibTmux.Command.option/0","publicId":"LibTmux.Command.option/0","name":"option/0","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() :: {:max_bytes, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() :: {:max_bytes, pos_integer()}","doc":{"summary":"A positive byte ceiling for the selected argv or text rendering; encoded output is charged separately."},"source":{"file":"lib/libtmux/command.ex","line":16,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-command-option-0"},{"id":"LibTmux.Command.new/3","publicId":"LibTmux.Command.new/3","name":"new/3","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"function","modifiers":[],"signatures":[{"raw":"new(name, args, options \\\\ [])\n@spec new(String.t(), [binary()], [option()]) :: t()","params":[{"name":"name","type":"String.t()"},{"name":"args","type":"[binary()]"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs a trusted command, rejecting invalid arguments and input size."},"source":{"file":"lib/libtmux/command.ex","line":19,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-command-new-3"},{"id":"LibTmux.Command.argv/2","publicId":"LibTmux.Command.argv/2","name":"argv/2","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"function","modifiers":[],"signatures":[{"raw":"argv(command, options \\\\ [])\n@spec argv(t(), [option()]) :: [binary()]","params":[{"name":"command","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"[binary()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns process arguments, preserving terminal semicolons in tmux's argv parser."},"source":{"file":"lib/libtmux/command.ex","line":35,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-command-argv-2"},{"id":"LibTmux.Command.render/2","publicId":"LibTmux.Command.render/2","name":"render/2","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"function","modifiers":[],"signatures":[{"raw":"render(command, options \\\\ [])\n@spec render(t(), [option()]) :: binary()","params":[{"name":"command","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"binary()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Renders one newline-free tmux command line within its encoded byte budget."},"source":{"file":"lib/libtmux/command.ex","line":44,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-command-render-2"},{"id":"LibTmux.Control","publicId":"LibTmux.Control","name":"Control","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A connection handle pinned to one qualified control epoch.","body":"`submit/3` returns a retained `LibTmux.Operation` after bounded admission.\nIt never retries, refreshes, attaches, creates sessions or changes transport.\n`request_close/1` closes write authority for the entire pinned epoch through\nreserved capacity; it does not prove retirement or roll back effects.\n\n`start_link/1` explicitly attaches to an existing session. Its host must qualify\nthe server's effective hooks, aliases and stream writers for the whole lane;\na pinned handle is not authentication against unqualified command output or\narbitrary writes to internal tables. Reads and local selections never attach."},"source":{"file":"lib/libtmux/control.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control"},{"id":"LibTmux.Control.t/0","publicId":"LibTmux.Control.t/0","name":"t/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A handle pinned to one owner and connection epoch; it never follows a replacement."},"source":{"file":"lib/libtmux/control.ex","line":22,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-t-0"},{"id":"LibTmux.Control.start_option/0","publicId":"LibTmux.Control.start_option/0","name":"start_option/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type start_option() ::\n {:server, LibTmux.Server.t()}\n | {:session, {:existing, String.t()}}\n | {:lane, :host_qualified}\n | {:timeout, 1..600_000}\n | {:capacity\n | :metadata_capacity\n | :waiter_capacity, 1..256}\n | {:retention_ms, 1..600_000}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"start_option() ::\n {:server, LibTmux.Server.t()}\n | {:session, {:existing, String.t()}}\n | {:lane, :host_qualified}\n | {:timeout, 1..600_000}\n | {:capacity\n | :metadata_capacity\n | :waiter_capacity, 1..256}\n | {:retention_ms, 1..600_000}","doc":{"summary":"Explicit attachment policy and bounded startup settings; capacities count slots and timeouts use milliseconds."},"source":{"file":"lib/libtmux/control.ex","line":25,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-start_option-0"},{"id":"LibTmux.Control.call_option/0","publicId":"LibTmux.Control.call_option/0","name":"call_option/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type call_option() :: {:timeout, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"call_option() :: {:timeout, pos_integer()}","doc":{"summary":"A positive millisecond budget shared by all stages of one lifecycle or submission call."},"source":{"file":"lib/libtmux/control.ex","line":34,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-call_option-0"},{"id":"LibTmux.Control.connection_status/0","publicId":"LibTmux.Control.connection_status/0","name":"connection_status/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type connection_status() :: %{\n epoch: reference() | nil,\n generation: non_neg_integer(),\n phase:\n :starting\n | :ready\n | :closing\n | :retired\n | :unknown,\n instance: String.t() | nil\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"connection_status() :: %{\n epoch: reference() | nil,\n generation: non_neg_integer(),\n phase:\n :starting\n | :ready\n | :closing\n | :retired\n | :unknown,\n instance: String.t() | nil\n }","doc":{"summary":"A pinned epoch's current phase and identity; retirement and unknown cleanup are distinct."},"source":{"file":"lib/libtmux/control.ex","line":37,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-connection_status-0"},{"id":"LibTmux.Control.start_link/1","publicId":"LibTmux.Control.start_link/1","name":"start_link/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"start_link(options)\n@spec start_link([start_option()]) ::\n {:ok, pid(), t()} | {:error, LibTmux.Error.t()}","params":[{"name":"options","type":"[start_option()]"}],"returns":"{:ok, pid(), t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Starts a linked connection and returns `{:ok, root, control}`.","body":"Require `server: %LibTmux.Server{}`, `session: {:existing, \"$id\"}` and\n`lane: :host_qualified`. No session is created. The attachment is visible in\ntmux's client counts and can update session state. `no-output,ignore-size`\nsuppresses pane output and excludes this client from window sizing.\n\n`timeout` defaults to 5000ms and accepts 1..600000ms. One budget covers input\npreparation, Root startup, bootstrap, ready waiting and handoff. A fresh\nfactory returns a ready handle. Runtime failures return a structured error;\ninvalid trusted options raise `ArgumentError`. Ordinary OTP links remain:\nan asynchronous fatal Root exit can terminate a non-trapping caller.\n\nFailed startup fences its lifetime and requests exact-Root cleanup. Error\ndetails distinguish observed Root exit from a kill request; unknown native\ncleanup is never success. OTP can await Root exit after its initialization\ntimer expires, so a strict wall-clock caller-return bound remains unqualified.\n\nOptional `capacity`, `metadata_capacity` and `waiter_capacity` default to 32\nand accept 1..256. `retention_ms` defaults to 60000 and accepts 1..600000.\n\nReady connections buffer at most 64 KiB or 128 stdout chunks behind the\nreader. Overflow closes the whole epoch with `resource_limit`; it never\nreplays commands. These receive limits do not cap borrowed-server memory."},"source":{"file":"lib/libtmux/control.ex","line":45,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-start_link-1"},{"id":"LibTmux.Control.child_spec/1","publicId":"LibTmux.Control.child_spec/1","name":"child_spec/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"child_spec(options)\n@spec child_spec([start_option()]) ::\n Supervisor.child_spec()","params":[{"name":"options","type":"[start_option()]"}],"returns":"Supervisor.child_spec()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Builds a permanent supervisor child spec without attaching.","body":"Prepares bounded detached inputs and one lifetime shared by all factory\ninvocations. Each invocation starts its own configured startup budget.\nA restarted nonfresh lifetime returns an inert handle and never attaches\nautomatically. Proven retirement permits explicit `reconnect/2`; unknown\ncleanup refuses it. Old handles never follow a replacement Root or Manager.\n\n`Supervisor.start_child/2` and `Supervisor.restart_child/2` return the new\nhandle as their third info element. After an automatic restart, use\n`Supervisor.terminate_child/2` followed by `Supervisor.restart_child/2` for\nfresh info. This does not clear unknown cleanup or authorize replay."},"source":{"file":"lib/libtmux/control.ex","line":77,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-child_spec-1"},{"id":"LibTmux.Control.submit/3","publicId":"LibTmux.Control.submit/3","name":"submit/3","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"submit(control, request, options \\\\ [])\n@spec submit(t(), LibTmux.Control.Request.t(), [\n call_option()\n ]) ::\n {:ok, LibTmux.Operation.t()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"},{"name":"request","type":"LibTmux.Control.Request.t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"{:ok, LibTmux.Operation.t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Admits one request and returns its retained operation handle.","body":"`timeout` defaults to 5000ms and covers validation, admission, queueing,\nwrites and replies under one monotonic deadline. Request binaries are\ndetached before publication. Invalid input, overload or stale context before\nadmission returns a no-write error. Every successful admission returns its\nOperation, even if its context disappears before publication. Inspect that\nhandle for the eventual canonical result or an explicit lost-context error.\n\nClosing the connection can affect sibling operations. Command replies do\nnot prove external program exit. Caller timeout does not authorize replay."},"source":{"file":"lib/libtmux/control.ex","line":130,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-submit-3"},{"id":"LibTmux.Control.submit!/3","publicId":"LibTmux.Control.submit!/3","name":"submit!/3","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"submit!(control, request, options \\\\ [])\n@spec submit!(t(), LibTmux.Control.Request.t(), [\n call_option()\n ]) :: LibTmux.Operation.t()","params":[{"name":"control","type":"t()"},{"name":"request","type":"LibTmux.Control.Request.t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"LibTmux.Operation.t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Admits a request or raises the same structured error."},"source":{"file":"lib/libtmux/control.ex","line":171,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-submit-bang-3"},{"id":"LibTmux.Control.status/1","publicId":"LibTmux.Control.status/1","name":"status/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"status(control)\n@spec status(t()) ::\n {:ok, connection_status()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"}],"returns":"{:ok, connection_status()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads the pinned epoch's current phase and identity without contacting tmux."},"source":{"file":"lib/libtmux/control.ex","line":175,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-status-1"},{"id":"LibTmux.Control.status!/1","publicId":"LibTmux.Control.status!/1","name":"status!/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"status!(control)\n@spec status!(t()) :: connection_status()","params":[{"name":"control","type":"t()"}],"returns":"connection_status()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads pinned connection status or raises the same structured error."},"source":{"file":"lib/libtmux/control.ex","line":201,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-status-bang-1"},{"id":"LibTmux.Control.request_close/1","publicId":"LibTmux.Control.request_close/1","name":"request_close/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"request_close(control)\n@spec request_close(t()) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests whole-epoch closure without claiming an operation or metadata slot.","body":"Repeated requests for the same closing or proven-retired generation return\n`:ok`. Success is a request or previously known retirement, not a cleanup\nacknowledgement. A replacement Manager or epoch is never followed."},"source":{"file":"lib/libtmux/control.ex","line":205,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-request_close-1"},{"id":"LibTmux.Control.request_close!/1","publicId":"LibTmux.Control.request_close!/1","name":"request_close!/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"request_close!(control)\n@spec request_close!(t()) :: :ok","params":[{"name":"control","type":"t()"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests epoch closure or raises the same structured error."},"source":{"file":"lib/libtmux/control.ex","line":234,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-request_close-bang-1"},{"id":"LibTmux.Control.close/2","publicId":"LibTmux.Control.close/2","name":"close/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"close(control, options \\\\ [])\n@spec close(t(), [call_option()]) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests closure and waits for proven retirement of the pinned epoch.","body":"`timeout` defaults to 5000ms. The original budget includes validation and\nretirement waiting. Closure still happens if the bounded metadata wait cannot\nbe admitted. Timeout, overload or lost ownership reports unknown certainty;\nit never proves cleanup. `:ok` requires known native and actor retirement.\n\nThe connection supervisor and retained records remain available for explicit\nreconnect and inspection. This does not stop the supervisor or roll back\nsibling effects."},"source":{"file":"lib/libtmux/control.ex","line":238,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-close-2"},{"id":"LibTmux.Control.close!/2","publicId":"LibTmux.Control.close!/2","name":"close!/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"close!(control, options \\\\ [])\n@spec close!(t(), [call_option()]) :: :ok","params":[{"name":"control","type":"t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Waits for retirement or raises the same structured error."},"source":{"file":"lib/libtmux/control.ex","line":269,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-close-bang-2"},{"id":"LibTmux.Control.reconnect/2","publicId":"LibTmux.Control.reconnect/2","name":"reconnect/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"reconnect(control, options \\\\ [])\n@spec reconnect(t(), [call_option()]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Explicitly obtains the ready epoch, starting a replacement only after retirement.","body":"A ready epoch returns itself. Call `close/2` first to require replacement.\nThe default 5000ms budget covers metadata admission, retirement and startup.\nA successful reply pins the acknowledged endpoint even if it becomes stale\nbefore this caller resumes. It never follows a later view or replays work.\nErrors report unknown certainty about existing effects. Attachment counts\ninclude the control client; reconnect can attach one replacement client."},"source":{"file":"lib/libtmux/control.ex","line":273,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-reconnect-2"},{"id":"LibTmux.Control.reconnect!/2","publicId":"LibTmux.Control.reconnect!/2","name":"reconnect!/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"reconnect!(control, options \\\\ [])\n@spec reconnect!(t(), [call_option()]) :: t()","params":[{"name":"control","type":"t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Obtains the ready epoch or raises the same structured error."},"source":{"file":"lib/libtmux/control.ex","line":297,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-reconnect-bang-2"},{"id":"LibTmux.Control.Request","publicId":"LibTmux.Control.Request","name":"Request","namespace":"LibTmux.Control","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Data for the qualified control lane's supported commands.","body":"Field reads encode one named variable losslessly. Server user options accept\nliteral binary values. Constructing a request performs no I/O; submit it with\n`LibTmux.Control.submit/3`. Arbitrary commands, formats and raw control lines\nrequire separate qualification and are not accepted by this lane."},"source":{"file":"lib/libtmux/control/request.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-request"},{"id":"LibTmux.Control.Request.t/0","publicId":"LibTmux.Control.Request.t/0","name":"t/0","namespace":"LibTmux.Control.Request","parent":"LibTmux.Control.Request","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Command data for the qualified lane; construction does not validate admission or perform I/O."},"source":{"file":"lib/libtmux/control/request.ex","line":15,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-request-t-0"},{"id":"LibTmux.Control.Request.field/2","publicId":"LibTmux.Control.Request.field/2","name":"field/2","namespace":"LibTmux.Control.Request","parent":"LibTmux.Control.Request","kind":"function","modifiers":[],"signatures":[{"raw":"field(variable, target \\\\ nil)\n@spec field(String.t(), LibTmux.Ref.t() | nil) :: t()","params":[{"name":"variable","type":"String.t()"},{"name":"target","type":"LibTmux.Ref.t() | nil","default":"nil"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads a named format variable, optionally from an exact instance-bound target.","body":"Existing empty fields succeed. A target that disappears before the read\nproduces an acknowledged failed operation and leaves the connection usable.\nA reference does not reserve the object's lifetime."},"source":{"file":"lib/libtmux/control/request.ex","line":18,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-request-field-2"},{"id":"LibTmux.Control.Request.set_user_option/2","publicId":"LibTmux.Control.Request.set_user_option/2","name":"set_user_option/2","namespace":"LibTmux.Control.Request","parent":"LibTmux.Control.Request","kind":"function","modifiers":[],"signatures":[{"raw":"set_user_option(name, value)\n@spec set_user_option(String.t(), binary()) :: t()","params":[{"name":"name","type":"String.t()"},{"name":"value","type":"binary()"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Sets a server user option with an `@name` and a literal binary value."},"source":{"file":"lib/libtmux/control/request.ex","line":29,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-request-set_user_option-2"},{"id":"LibTmux.Control.Request.verify_reply/3","publicId":"LibTmux.Control.Request.verify_reply/3","name":"verify_reply/3","namespace":"LibTmux.Control.Request","parent":"LibTmux.Control.Request","kind":"function","modifiers":[],"signatures":[{"raw":"verify_reply(request, status, lines)\n@spec verify_reply(t(), :ok | :error, [binary()]) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"request","type":"t()"},{"name":"status","type":":ok | :error"},{"name":"lines","type":"[binary()]"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Checks a qualified request's reply shape; a tmux error reply remains a command outcome."},"source":{"file":"lib/libtmux/control/request.ex","line":75,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-control-request-verify_reply-3"},{"id":"LibTmux.Deadline","publicId":"LibTmux.Deadline","name":"Deadline","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A node-local monotonic deadline shared by every stage of an operation.","body":"Construct it once at admission. Passing it between stages preserves the\noriginal budget; it is not a portable timestamp or a wire value."},"source":{"file":"lib/libtmux/deadline.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-deadline"},{"id":"LibTmux.Deadline.t/0","publicId":"LibTmux.Deadline.t/0","name":"t/0","namespace":"LibTmux.Deadline","parent":"LibTmux.Deadline","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A node-local monotonic millisecond cutoff. Share it between stages; never serialize it as a portable deadline."},"source":{"file":"lib/libtmux/deadline.ex","line":12,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-deadline-t-0"},{"id":"LibTmux.Deadline.option/0","publicId":"LibTmux.Deadline.option/0","name":"option/0","namespace":"LibTmux.Deadline","parent":"LibTmux.Deadline","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() :: {:now, integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() :: {:now, integer()}","doc":{"summary":"An optional node-local monotonic clock sample in milliseconds, used instead of sampling the current clock."},"source":{"file":"lib/libtmux/deadline.ex","line":14,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-deadline-option-0"},{"id":"LibTmux.Deadline.new/2","publicId":"LibTmux.Deadline.new/2","name":"new/2","namespace":"LibTmux.Deadline","parent":"LibTmux.Deadline","kind":"function","modifiers":[],"signatures":[{"raw":"new(milliseconds, options \\\\ [])\n@spec new(pos_integer(), [option()]) :: t()","params":[{"name":"milliseconds","type":"pos_integer()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Creates a deadline from a positive millisecond budget."},"source":{"file":"lib/libtmux/deadline.ex","line":17,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-deadline-new-2"},{"id":"LibTmux.Deadline.remaining/2","publicId":"LibTmux.Deadline.remaining/2","name":"remaining/2","namespace":"LibTmux.Deadline","parent":"LibTmux.Deadline","kind":"function","modifiers":[],"signatures":[{"raw":"remaining(deadline, options \\\\ [])\n@spec remaining(t(), [option()]) :: non_neg_integer()","params":[{"name":"deadline","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"non_neg_integer()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the remaining milliseconds, clamped to zero after expiry."},"source":{"file":"lib/libtmux/deadline.ex","line":29,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-deadline-remaining-2"},{"id":"LibTmux.Error","publicId":"LibTmux.Error","name":"Error","namespace":"LibTmux","kind":"exception","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An inspectable failure with its phase and certainty about effects.","body":"`retryable` describes a recovery option; it never authorizes replay of a\nmutation. Diagnostic details must stay within the producing operation's\nbyte budget. Bang functions raise this same structure."},"extends":["Exception"],"source":{"file":"lib/libtmux/error.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error"},{"id":"LibTmux.Error.kind","publicId":"LibTmux.Error.kind","name":"kind","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"atom()","value":"nil","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-kind"},{"id":"LibTmux.Error.phase","publicId":"LibTmux.Error.phase","name":"phase","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"atom()","value":":validation","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-phase"},{"id":"LibTmux.Error.certainty","publicId":"LibTmux.Error.certainty","name":"certainty","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"certainty()","value":":unknown","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-certainty"},{"id":"LibTmux.Error.retryable","publicId":"LibTmux.Error.retryable","name":"retryable","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"boolean()","value":"false","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-retryable"},{"id":"LibTmux.Error.path","publicId":"LibTmux.Error.path","name":"path","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"[path_component()]","value":"[]","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-path"},{"id":"LibTmux.Error.details","publicId":"LibTmux.Error.details","name":"details","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"map()","value":"%{}","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-details"},{"id":"LibTmux.Error.certainty/0","publicId":"LibTmux.Error.certainty/0","name":"certainty/0","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type certainty() ::\n :no_write | :acknowledged | :observed | :unknown","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"certainty() ::\n :no_write | :acknowledged | :observed | :unknown","doc":{"summary":"Evidence about effects, independent of whether cleanup or arbitrary program completion is proved."},"source":{"file":"lib/libtmux/error.ex","line":19,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-certainty-0"},{"id":"LibTmux.Error.path_component/0","publicId":"LibTmux.Error.path_component/0","name":"path_component/0","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type path_component() ::\n atom() | non_neg_integer() | LibTmux.Ref.id()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"path_component() ::\n atom() | non_neg_integer() | LibTmux.Ref.id()","doc":{"summary":"A field, array index or observed identity locating an error; links retain their contextual tuple ID."},"source":{"file":"lib/libtmux/error.ex","line":21,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-path_component-0"},{"id":"LibTmux.Error.t/0","publicId":"LibTmux.Error.t/0","name":"t/0","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Error{\n __exception__: term(),\n certainty: certainty(),\n details: map(),\n kind: atom(),\n path: [path_component()],\n phase: atom(),\n retryable: boolean()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Error{\n __exception__: term(),\n certainty: certainty(),\n details: map(),\n kind: atom(),\n path: [path_component()],\n phase: atom(),\n retryable: boolean()\n }","doc":{"summary":"A structured API failure. Kind and phase are extensible; retryable never permits automatic mutation replay."},"source":{"file":"lib/libtmux/error.ex","line":23,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-error-t-0"},{"id":"LibTmux.Filter","publicId":"LibTmux.Filter","name":"Filter","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A validated portable predicate over one observed entity type.","body":"Keywords are trusted shorthand for maps. Fields in one object conjoin;\nduplicate keyword keys are rejected recursively. `not` at a field negates\nequality, while Boolean `not` takes one criteria object. Lists require an\nexplicit operator. Native callbacks belong to `LibTmux.Selection.filter/2`.\nThis value contains data; executable preparation remains separate."},"source":{"file":"lib/libtmux/filter.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter"},{"id":"LibTmux.Filter.criteria/0","publicId":"LibTmux.Filter.criteria/0","name":"criteria/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type criteria() ::\n %{optional(atom()) => term()} | keyword(term())","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"criteria() ::\n %{optional(atom()) => term()} | keyword(term())","doc":{"summary":"Local map criteria or keyword shorthand; field and operand domains are validated at construction."},"source":{"file":"lib/libtmux/filter.ex","line":16,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-criteria-0"},{"id":"LibTmux.Filter.input/0","publicId":"LibTmux.Filter.input/0","name":"input/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type input() :: criteria() | t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"input() :: criteria() | t()","doc":{"summary":"Trusted criteria data or a previously validated filter for the same entity."},"source":{"file":"lib/libtmux/filter.ex","line":18,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-input-0"},{"id":"LibTmux.Filter.limit_option/0","publicId":"LibTmux.Filter.limit_option/0","name":"limit_option/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type limit_option() ::\n {:max_bytes, pos_integer()}\n | {:max_depth, pos_integer()}\n | {:max_nodes, pos_integer()}\n | {:max_list, pos_integer()}\n | {:max_string_bytes, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"limit_option() ::\n {:max_bytes, pos_integer()}\n | {:max_depth, pos_integer()}\n | {:max_nodes, pos_integer()}\n | {:max_list, pos_integer()}\n | {:max_string_bytes, pos_integer()}","doc":{"summary":"A positive resource ceiling; byte, depth, node, list and string budgets validate independently."},"source":{"file":"lib/libtmux/filter.ex","line":20,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-limit_option-0"},{"id":"LibTmux.Filter.limits/0","publicId":"LibTmux.Filter.limits/0","name":"limits/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type limits() :: %{\n max_bytes: pos_integer(),\n max_depth: pos_integer(),\n max_nodes: pos_integer(),\n max_list: pos_integer(),\n max_string_bytes: pos_integer()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"limits() :: %{\n max_bytes: pos_integer(),\n max_depth: pos_integer(),\n max_nodes: pos_integer(),\n max_list: pos_integer(),\n max_string_bytes: pos_integer()\n }","doc":{"summary":"Resolved constructor budgets; wire limits also cover the versioned envelope."},"source":{"file":"lib/libtmux/filter.ex","line":27,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-limits-0"},{"id":"LibTmux.Filter.t/0","publicId":"LibTmux.Filter.t/0","name":"t/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Validated portable predicate data; executable predicates are prepared separately."},"source":{"file":"lib/libtmux/filter.ex","line":43,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-t-0"},{"id":"LibTmux.Filter.new/3","publicId":"LibTmux.Filter.new/3","name":"new/3","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"new(entity, criteria, options \\\\ [])\n@spec new(LibTmux.Schema.entity_selector(), input(), [\n limit_option()\n ]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"criteria","type":"input()"},{"name":"options","type":"[limit_option()]","default":"[]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Normalizes criteria and validates field/operator/value domains before evaluation.","body":"An existing filter retains its constructor's validation when no new limits\nare supplied. Explicit limits check the normalized tree directly, without\nexpanding it into synthetic input syntax."},"source":{"file":"lib/libtmux/filter.ex","line":46,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-new-3"},{"id":"LibTmux.Filter.new!/3","publicId":"LibTmux.Filter.new!/3","name":"new!/3","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"new!(entity, criteria, options \\\\ [])\n@spec new!(LibTmux.Schema.entity_selector(), input(), [\n limit_option()\n ]) :: t()","params":[{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"criteria","type":"input()"},{"name":"options","type":"[limit_option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs a filter or raises its structured validation error."},"source":{"file":"lib/libtmux/filter.ex","line":96,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-new-bang-3"},{"id":"LibTmux.Filter.to_predicate/2","publicId":"LibTmux.Filter.to_predicate/2","name":"to_predicate/2","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"to_predicate(filter, options)\n@spec to_predicate(t(), [\n {:snapshot, LibTmux.Snapshot.t()}\n ]) :: (LibTmux.Schema.observation() ->\n boolean())","params":[{"name":"filter","type":"t()"},{"name":"options","type":"[{:snapshot, LibTmux.Snapshot.t()}]"}],"returns":"(LibTmux.Schema.observation() -> boolean())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Prepares a local unary predicate after validating captured coverage, including empty domains."},"source":{"file":"lib/libtmux/filter.ex","line":105,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-to_predicate-2"},{"id":"LibTmux.Filter.from_wire/3","publicId":"LibTmux.Filter.from_wire/3","name":"from_wire/3","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"from_wire(entity, payload, options \\\\ [])\n@spec from_wire(LibTmux.Schema.entity_selector(), term(), [\n limit_option()\n ]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"payload","type":"term()"},{"name":"options","type":"[limit_option()]","default":"[]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes a whitelisted versioned map; raw JSON must use from_json to retain duplicate keys."},"source":{"file":"lib/libtmux/filter.ex","line":113,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-from_wire-3"},{"id":"LibTmux.Filter.from_json/3","publicId":"LibTmux.Filter.from_json/3","name":"from_json/3","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"from_json(entity, json, options \\\\ [])\n@spec from_json(\n LibTmux.Schema.entity_selector(),\n binary(),\n [limit_option()]\n ) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"json","type":"binary()"},{"name":"options","type":"[limit_option()]","default":"[]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes bounded JSON, rejecting duplicate object keys and trailing data."},"source":{"file":"lib/libtmux/filter.ex","line":119,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-from_json-3"},{"id":"LibTmux.Filter.to_wire/1","publicId":"LibTmux.Filter.to_wire/1","name":"to_wire/1","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"to_wire(filter)\n@spec to_wire(t()) :: LibTmux.Wire.object()","params":[{"name":"filter","type":"t()"}],"returns":"LibTmux.Wire.object()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the explicit versioned string-keyed wire representation."},"source":{"file":"lib/libtmux/filter.ex","line":125,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-filter-to_wire-1"},{"id":"LibTmux.Format","publicId":"LibTmux.Format","name":"Format","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs literal operands for tmux formats without evaluating their text.","body":"Command quoting and format quoting are separate. A literal may contain\nnewlines or arbitrary non-NUL bytes; this does not qualify its output for\na shared line-oriented control lane."},"source":{"file":"lib/libtmux/format.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-format"},{"id":"LibTmux.Format.field/1","publicId":"LibTmux.Format.field/1","name":"field/1","namespace":"LibTmux.Format","parent":"LibTmux.Format","kind":"function","modifiers":[],"signatures":[{"raw":"field(name)\n@spec field(String.t()) :: binary()","params":[{"name":"name","type":"String.t()"}],"returns":"binary()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Encodes one named field for `LibTmux.Codec.decode_field/3` with `encoding: :escaped_v1`.","body":"Backslashes are replaced first, then dollars and ASCII control bytes.\nThis protects values from tmux 3.4's ambiguous print escaping. The `v1:`\nprefix and encoded newlines prevent field text from becoming reply guards.\nThis is one field per response, not a delimiter-framed row or arbitrary\nformat wrapper. The caller must still bound the response and validate the\nfield against its schema and the connected server's capabilities."},"source":{"file":"lib/libtmux/format.ex","line":26,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-format-field-1"},{"id":"LibTmux.Format.literal/1","publicId":"LibTmux.Format.literal/1","name":"literal/1","namespace":"LibTmux.Format","parent":"LibTmux.Format","kind":"function","modifiers":[],"signatures":[{"raw":"literal(value)\n@spec literal(binary()) :: binary()","params":[{"name":"value","type":"binary()"}],"returns":"binary()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a format expression that expands to exactly the supplied non-NUL bytes."},"source":{"file":"lib/libtmux/format.ex","line":44,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-format-literal-1"},{"id":"LibTmux.Operation","publicId":"LibTmux.Operation","name":"Operation","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A retained operation handle pinned to its original owner, tables and epoch.","body":"`result/1` and `status/1` read local retained values. `await/2` owns a separate\nbounded waiter; its timeout never stops the operation. `stop/1` requests\nclosure of the operation's entire connection epoch, including siblings.\nIt does not roll back effects or prove native cleanup.\n\nCanonical results carry `outcome`, `certainty` and `evidence`. Completed,\nfailed, skipped and unknown outcomes remain values, including in bang APIs.\nBang functions raise only API or metadata errors. A command reply is distinct\nfrom wire retirement and arbitrary program exit.\n\nNormal reconnect preserves retained records until forget or expiry. Owner\nreplacement loses those tables; a handle never follows a replacement view."},"source":{"file":"lib/libtmux/operation.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation"},{"id":"LibTmux.Operation.t/0","publicId":"LibTmux.Operation.t/0","name":"t/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A retained owner-bound operation handle; it is not a command result or a reservation."},"source":{"file":"lib/libtmux/operation.ex","line":26,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-t-0"},{"id":"LibTmux.Operation.command_result/0","publicId":"LibTmux.Operation.command_result/0","name":"command_result/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type command_result() :: %{\n outcome: :completed | :failed,\n certainty: :acknowledged,\n evidence: :command_reply,\n guard: LibTmux.Protocol.guard_id(),\n lines: [binary()]\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"command_result() :: %{\n outcome: :completed | :failed,\n certainty: :acknowledged,\n evidence: :command_reply,\n guard: LibTmux.Protocol.guard_id(),\n lines: [binary()]\n }","doc":{"summary":"A qualified command reply, independently of wire retirement or program completion."},"source":{"file":"lib/libtmux/operation.ex","line":28,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-command_result-0"},{"id":"LibTmux.Operation.skipped_result/0","publicId":"LibTmux.Operation.skipped_result/0","name":"skipped_result/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type skipped_result() :: %{\n outcome: :skipped,\n certainty: :no_write,\n evidence: :cancelled | :timeout | :epoch_closed\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"skipped_result() :: %{\n outcome: :skipped,\n certainty: :no_write,\n evidence: :cancelled | :timeout | :epoch_closed\n }","doc":{"summary":"A canonical no-write outcome, with the reason it was skipped before dispatch."},"source":{"file":"lib/libtmux/operation.ex","line":36,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-skipped_result-0"},{"id":"LibTmux.Operation.unknown_result/0","publicId":"LibTmux.Operation.unknown_result/0","name":"unknown_result/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type unknown_result() :: %{\n outcome: :unknown,\n certainty: :unknown,\n evidence: :epoch_closed\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"unknown_result() :: %{\n outcome: :unknown,\n certainty: :unknown,\n evidence: :epoch_closed\n }","doc":{"summary":"An epoch closed without enough evidence to classify the operation's effects."},"source":{"file":"lib/libtmux/operation.ex","line":42,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-unknown_result-0"},{"id":"LibTmux.Operation.result/0","publicId":"LibTmux.Operation.result/0","name":"result/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type result() ::\n command_result()\n | skipped_result()\n | unknown_result()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"result() ::\n command_result()\n | skipped_result()\n | unknown_result()","doc":{"summary":"The immutable canonical outcome; failed, skipped and unknown outcomes remain values."},"source":{"file":"lib/libtmux/operation.ex","line":44,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-result-0"},{"id":"LibTmux.Operation.wire/0","publicId":"LibTmux.Operation.wire/0","name":"wire/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type wire() ::\n :unpublished\n | :unsent\n | :writing\n | :awaiting\n | :closing\n | :retired","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"wire() ::\n :unpublished\n | :unsent\n | :writing\n | :awaiting\n | :closing\n | :retired","doc":{"summary":"Wire progress for this operation; retired wire does not prove connection cleanup."},"source":{"file":"lib/libtmux/operation.ex","line":46,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-wire-0"},{"id":"LibTmux.Operation.status/0","publicId":"LibTmux.Operation.status/0","name":"status/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type status() :: %{wire: wire(), result: result() | nil}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"status() :: %{wire: wire(), result: result() | nil}","doc":{"summary":"Retained wire progress and the canonical result, or nil while no outcome is established."},"source":{"file":"lib/libtmux/operation.ex","line":48,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-status-0"},{"id":"LibTmux.Operation.option/0","publicId":"LibTmux.Operation.option/0","name":"option/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() :: {:timeout, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() :: {:timeout, pos_integer()}","doc":{"summary":"A positive millisecond budget for one waiter or record-reclamation call."},"source":{"file":"lib/libtmux/operation.ex","line":50,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-option-0"},{"id":"LibTmux.Operation.status/1","publicId":"LibTmux.Operation.status/1","name":"status/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"status(operation)\n@spec status(t()) ::\n {:ok, status()} | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"}],"returns":"{:ok, status()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads retained wire state and canonical result without contacting tmux."},"source":{"file":"lib/libtmux/operation.ex","line":107,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-status-1"},{"id":"LibTmux.Operation.status!/1","publicId":"LibTmux.Operation.status!/1","name":"status!/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"status!(operation)\n@spec status!(t()) :: status()","params":[{"name":"operation","type":"t()"}],"returns":"status()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads retained status or raises the same structured error."},"source":{"file":"lib/libtmux/operation.ex","line":117,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-status-bang-1"},{"id":"LibTmux.Operation.result/1","publicId":"LibTmux.Operation.result/1","name":"result/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"result(operation)\n@spec result(t()) ::\n :pending\n | {:ok, result()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"}],"returns":":pending | {:ok, result()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a canonical result, `:pending`, or a retained-context error."},"source":{"file":"lib/libtmux/operation.ex","line":121,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-result-1"},{"id":"LibTmux.Operation.result!/1","publicId":"LibTmux.Operation.result!/1","name":"result!/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"result!(operation)\n@spec result!(t()) :: :pending | result()","params":[{"name":"operation","type":"t()"}],"returns":":pending | result()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads a result or `:pending`; raises API errors, preserving all canonical outcomes."},"source":{"file":"lib/libtmux/operation.ex","line":131,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-result-bang-1"},{"id":"LibTmux.Operation.await/2","publicId":"LibTmux.Operation.await/2","name":"await/2","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"await(operation, options \\\\ [])\n@spec await(t(), [option()]) ::\n {:ok, result()} | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"{:ok, result()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Waits for a canonical result under one positive millisecond timeout.","body":"The default is 5000ms. Every call claims an independent bounded waiter slot,\nincluding terminal operations; use `result/1` for immediate inspection.\nCompleted waiter copies survive record reclamation until this caller reads\nthem. Timeout, overload and caller death affect only this waiter."},"source":{"file":"lib/libtmux/operation.ex","line":135,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-await-2"},{"id":"LibTmux.Operation.await!/2","publicId":"LibTmux.Operation.await!/2","name":"await!/2","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"await!(operation, options \\\\ [])\n@spec await!(t(), [option()]) :: result()","params":[{"name":"operation","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"result()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Waits or raises API errors; canonical failed, skipped and unknown outcomes remain values."},"source":{"file":"lib/libtmux/operation.ex","line":149,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-await-bang-2"},{"id":"LibTmux.Operation.forget/2","publicId":"LibTmux.Operation.forget/2","name":"forget/2","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"forget(operation, options \\\\ [])\n@spec forget(t(), [option()]) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests exact-record reclamation with a default 5000ms timeout.","body":"Wire-active records cannot be forgotten. An owner-accepted request remains\nowned after caller timeout. Successful reclamation invalidates this record\nhandle while preserving already-accepted waiter copies."},"source":{"file":"lib/libtmux/operation.ex","line":153,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-forget-2"},{"id":"LibTmux.Operation.forget!/2","publicId":"LibTmux.Operation.forget!/2","name":"forget!/2","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"forget!(operation, options \\\\ [])\n@spec forget!(t(), [option()]) :: :ok","params":[{"name":"operation","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Forgets the retained record or raises the same structured error."},"source":{"file":"lib/libtmux/operation.ex","line":166,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-forget-bang-2"},{"id":"LibTmux.Operation.stop/1","publicId":"LibTmux.Operation.stop/1","name":"stop/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"stop(operation)\n@spec stop(t()) :: :ok | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests closure of the pinned epoch through reserved capacity.","body":"Returns `:ok` for an already wire-retired operation or an accepted closure\nrequest, and `{:error, error}` otherwise. Closure can affect sibling work;\nsuccess does not prove retirement or change the canonical result. A stale\nhandle cannot revoke a replacement epoch."},"source":{"file":"lib/libtmux/operation.ex","line":170,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-stop-1"},{"id":"LibTmux.Operation.stop!/1","publicId":"LibTmux.Operation.stop!/1","name":"stop!/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"stop!(operation)\n@spec stop!(t()) :: :ok","params":[{"name":"operation","type":"t()"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests epoch closure or raises the same structured error."},"source":{"file":"lib/libtmux/operation.ex","line":195,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-operation-stop-bang-1"},{"id":"LibTmux.Pane","publicId":"LibTmux.Pane","name":"Pane","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An immutable physical pane. It belongs to a window; text may be empty."},"source":{"file":"lib/libtmux/entities.ex","line":70,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane"},{"id":"LibTmux.Pane.id","publicId":"LibTmux.Pane.id","name":"id","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-id"},{"id":"LibTmux.Pane.server_instance","publicId":"LibTmux.Pane.server_instance","name":"server_instance","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-server_instance"},{"id":"LibTmux.Pane.window_id","publicId":"LibTmux.Pane.window_id","name":"window_id","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-window_id"},{"id":"LibTmux.Pane.index","publicId":"LibTmux.Pane.index","name":"index","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-index"},{"id":"LibTmux.Pane.active","publicId":"LibTmux.Pane.active","name":"active","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-active"},{"id":"LibTmux.Pane.dead","publicId":"LibTmux.Pane.dead","name":"dead","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-dead"},{"id":"LibTmux.Pane.width","publicId":"LibTmux.Pane.width","name":"width","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-width"},{"id":"LibTmux.Pane.height","publicId":"LibTmux.Pane.height","name":"height","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-height"},{"id":"LibTmux.Pane.pid","publicId":"LibTmux.Pane.pid","name":"pid","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-pid"},{"id":"LibTmux.Pane.current_command","publicId":"LibTmux.Pane.current_command","name":"current_command","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-current_command"},{"id":"LibTmux.Pane.current_path","publicId":"LibTmux.Pane.current_path","name":"current_path","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-current_path"},{"id":"LibTmux.Pane.title","publicId":"LibTmux.Pane.title","name":"title","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-title"},{"id":"LibTmux.Pane.exit_status","publicId":"LibTmux.Pane.exit_status","name":"exit_status","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer() | nil)","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-exit_status"},{"id":"LibTmux.Pane.t/0","publicId":"LibTmux.Pane.t/0","name":"t/0","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Pane{\n active: LibTmux.Schema.observed(boolean()),\n current_command:\n LibTmux.Schema.observed(String.t()),\n current_path: LibTmux.Schema.observed(String.t()),\n dead: LibTmux.Schema.observed(boolean()),\n exit_status:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n height: LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n index: LibTmux.Schema.observed(non_neg_integer()),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n title: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n window_id: LibTmux.Schema.observed(String.t())\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Pane{\n active: LibTmux.Schema.observed(boolean()),\n current_command:\n LibTmux.Schema.observed(String.t()),\n current_path: LibTmux.Schema.observed(String.t()),\n dead: LibTmux.Schema.observed(boolean()),\n exit_status:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n height: LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n index: LibTmux.Schema.observed(non_neg_integer()),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n title: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n window_id: LibTmux.Schema.observed(String.t())\n }","doc":{"summary":"A physical pane; exit status can be known absent, while other missing fields retain coverage sentinels."},"source":{"file":"lib/libtmux/entities.ex","line":89,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-pane-t-0"},{"id":"LibTmux.Protocol","publicId":"LibTmux.Protocol","name":"Protocol","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Assembles bounded control-mode replies and lexical notifications from bytes.","body":"Reply guards retain timestamp, command number and flags. Inside a block,\nnotification-looking output stays data. The parser cannot authenticate\ninjected matching guards: shared lanes must separately qualify commands,\nhooks and subscription expansion. Notification payloads need semantic\nvalidation before they can update a graph.\n\nA parse error retains already completed events in `error.details.events`.\nIts owner must retire the lane rather than reuse the rejected state."},"source":{"file":"lib/libtmux/protocol.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-protocol"},{"id":"LibTmux.Protocol.guard_id/0","publicId":"LibTmux.Protocol.guard_id/0","name":"guard_id/0","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type guard_id() ::\n {non_neg_integer(), non_neg_integer(),\n non_neg_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"guard_id() ::\n {non_neg_integer(), non_neg_integer(),\n non_neg_integer()}","doc":{"summary":"A complete tmux reply guard: timestamp, command number and flags, retained for correlation."},"source":{"file":"lib/libtmux/protocol.ex","line":53,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-protocol-guard_id-0"},{"id":"LibTmux.Protocol.event/0","publicId":"LibTmux.Protocol.event/0","name":"event/0","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type event() ::\n {:reply, :ok | :error, guard_id(), [binary()]}\n | {:notification, atom(), binary()}\n | {:unknown, binary()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"event() ::\n {:reply, :ok | :error, guard_id(), [binary()]}\n | {:notification, atom(), binary()}\n | {:unknown, binary()}","doc":{"summary":"A framed reply or lexical notification. Payloads still require semantic validation before graph updates."},"source":{"file":"lib/libtmux/protocol.ex","line":55,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-protocol-event-0"},{"id":"LibTmux.Protocol.t/0","publicId":"LibTmux.Protocol.t/0","name":"t/0","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Immutable parser carry and bounded in-flight frame state; discard it after any parse error."},"source":{"file":"lib/libtmux/protocol.ex","line":60,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-protocol-t-0"},{"id":"LibTmux.Protocol.option/0","publicId":"LibTmux.Protocol.option/0","name":"option/0","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:max_chunk_bytes\n | :max_line_bytes\n | :max_frame_bytes\n | :max_frame_lines\n | :max_events, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:max_chunk_bytes\n | :max_line_bytes\n | :max_frame_bytes\n | :max_frame_lines\n | :max_events, pos_integer()}","doc":{"summary":"A positive parser ceiling, measured in bytes, lines or emitted events as named."},"source":{"file":"lib/libtmux/protocol.ex","line":62,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-protocol-option-0"},{"id":"LibTmux.Protocol.new/1","publicId":"LibTmux.Protocol.new/1","name":"new/1","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"function","modifiers":[],"signatures":[{"raw":"new(options \\\\ [])\n@spec new([option()]) :: t()","params":[{"name":"options","type":"[option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs a parser with positive byte, line and event limits."},"source":{"file":"lib/libtmux/protocol.ex","line":67,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-protocol-new-1"},{"id":"LibTmux.Protocol.feed/2","publicId":"LibTmux.Protocol.feed/2","name":"feed/2","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"function","modifiers":[],"signatures":[{"raw":"feed(state, chunk)\n@spec feed(t(), binary()) ::\n {:ok, [event()], t()} | {:error, LibTmux.Error.t()}","params":[{"name":"state","type":"t()"},{"name":"chunk","type":"binary()"}],"returns":"{:ok, [event()], t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Consumes one byte chunk without performing I/O."},"source":{"file":"lib/libtmux/protocol.ex","line":80,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-protocol-feed-2"},{"id":"LibTmux.Protocol.finish/1","publicId":"LibTmux.Protocol.finish/1","name":"finish/1","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"function","modifiers":[],"signatures":[{"raw":"finish(protocol)\n@spec finish(t()) :: :ok | {:error, LibTmux.Error.t()}","params":[{"name":"protocol","type":"t()"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Rejects a stream ending inside a line or reply block."},"source":{"file":"lib/libtmux/protocol.ex","line":90,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-protocol-finish-1"},{"id":"LibTmux.Ref","publicId":"LibTmux.Ref","name":"Ref","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An exact observed target bound to one server instance.","body":"A window-link ID is its observed `{session_id, index, window_id}` binding,\nnot a unique lifetime identifier. Validation detects known stale instances;\nit does not reserve an object or close a one-shot check/use race."},"source":{"file":"lib/libtmux/ref.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref"},{"id":"LibTmux.Ref.entity","publicId":"LibTmux.Ref.entity","name":"entity","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"entity()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/ref.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref-entity"},{"id":"LibTmux.Ref.id","publicId":"LibTmux.Ref.id","name":"id","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"id()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/ref.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref-id"},{"id":"LibTmux.Ref.server_instance","publicId":"LibTmux.Ref.server_instance","name":"server_instance","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/ref.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref-server_instance"},{"id":"LibTmux.Ref.entity/0","publicId":"LibTmux.Ref.entity/0","name":"entity/0","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity() ::\n :session | :window | :pane | :window_link | :client","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity() ::\n :session | :window | :pane | :window_link | :client","doc":{"summary":"The target kind; physical windows and session-relative links have different identities."},"source":{"file":"lib/libtmux/ref.ex","line":15,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref-entity-0"},{"id":"LibTmux.Ref.id/0","publicId":"LibTmux.Ref.id/0","name":"id/0","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type id() ::\n String.t()\n | {String.t(), non_neg_integer(), String.t()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"id() ::\n String.t()\n | {String.t(), non_neg_integer(), String.t()}","doc":{"summary":"A native ID or observed session/index/window link binding; neither reserves an object's lifetime."},"source":{"file":"lib/libtmux/ref.ex","line":17,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref-id-0"},{"id":"LibTmux.Ref.t/0","publicId":"LibTmux.Ref.t/0","name":"t/0","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Ref{\n entity: entity(),\n id: id(),\n server_instance: String.t()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Ref{\n entity: entity(),\n id: id(),\n server_instance: String.t()\n }","doc":{"summary":"An exact observed identity bound to a tmux server incarnation, separate from a connection epoch."},"source":{"file":"lib/libtmux/ref.ex","line":19,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref-t-0"},{"id":"LibTmux.Ref.new/3","publicId":"LibTmux.Ref.new/3","name":"new/3","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"function","modifiers":[],"signatures":[{"raw":"new(entity, id, instance)\n@spec new(entity(), id(), String.t()) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"entity","type":"entity()"},{"name":"id","type":"id()"},{"name":"instance","type":"String.t()"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Validates a native identity and binds it to a nonempty instance token."},"source":{"file":"lib/libtmux/ref.ex","line":22,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref-new-3"},{"id":"LibTmux.Ref.validate/2","publicId":"LibTmux.Ref.validate/2","name":"validate/2","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"function","modifiers":[],"signatures":[{"raw":"validate(ref, instance)\n@spec validate(t(), String.t()) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"ref","type":"t()"},{"name":"instance","type":"String.t()"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Rejects malformed references and known server-instance mismatches."},"source":{"file":"lib/libtmux/ref.ex","line":32,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-ref-validate-2"},{"id":"LibTmux.Schema","publicId":"LibTmux.Schema","name":"Schema","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Defines observed fields, wire names and graph relations.","body":"The table is a semantic overlay on tmux 3.3 format variables. It drives\nobservation validation, portable filtering and reference generation. Empty text\nremains text; only explicitly nullable fields admit `nil`."},"source":{"file":"lib/libtmux/schema.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema"},{"id":"LibTmux.Schema.entity/0","publicId":"LibTmux.Schema.entity/0","name":"entity/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity() ::\n :session | :window | :window_link | :pane | :client","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity() ::\n :session | :window | :window_link | :pane | :client","doc":{"summary":"An entity's canonical local name. Physical windows and membership links are distinct."},"source":{"file":"lib/libtmux/schema.ex","line":10,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-entity-0"},{"id":"LibTmux.Schema.entity_module/0","publicId":"LibTmux.Schema.entity_module/0","name":"entity_module/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity_module() ::\n LibTmux.Session\n | LibTmux.Window\n | LibTmux.WindowLink\n | LibTmux.Pane\n | LibTmux.Client","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity_module() ::\n LibTmux.Session\n | LibTmux.Window\n | LibTmux.WindowLink\n | LibTmux.Pane\n | LibTmux.Client","doc":{"summary":"The observation struct modules accepted alongside canonical entity names."},"source":{"file":"lib/libtmux/schema.ex","line":13,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-entity_module-0"},{"id":"LibTmux.Schema.entity_selector/0","publicId":"LibTmux.Schema.entity_selector/0","name":"entity_selector/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity_selector() :: entity() | entity_module()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity_selector() :: entity() | entity_module()","doc":{"summary":"A canonical entity atom or its corresponding observation module."},"source":{"file":"lib/libtmux/schema.ex","line":17,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-entity_selector-0"},{"id":"LibTmux.Schema.observed/1","publicId":"LibTmux.Schema.observed/1","name":"observed/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type observed(value) :: value | :unloaded | :unavailable","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","typeParams":["value"],"type":"observed(value) :: value | :unloaded | :unavailable","doc":{"summary":"A known value, unloaded coverage, or an unavailable capability; nil belongs to the value type."},"source":{"file":"lib/libtmux/schema.ex","line":20,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-observed-1"},{"id":"LibTmux.Schema.observation/0","publicId":"LibTmux.Schema.observation/0","name":"observation/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type observation() ::\n LibTmux.Session.t()\n | LibTmux.Window.t()\n | LibTmux.WindowLink.t()\n | LibTmux.Pane.t()\n | LibTmux.Client.t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"observation() ::\n LibTmux.Session.t()\n | LibTmux.Window.t()\n | LibTmux.WindowLink.t()\n | LibTmux.Pane.t()\n | LibTmux.Client.t()","doc":{"summary":"One physical or contextual observation from a captured graph."},"source":{"file":"lib/libtmux/schema.ex","line":23,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-observation-0"},{"id":"LibTmux.Schema.value_type/0","publicId":"LibTmux.Schema.value_type/0","name":"value_type/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type value_type() ::\n :string\n | :integer\n | :nullable_integer\n | :boolean\n | {:id, entity()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"value_type() ::\n :string\n | :integer\n | :nullable_integer\n | :boolean\n | {:id, entity()}","doc":{"summary":"A field's validation category; integer fields use the schema's nonnegative 32-bit range."},"source":{"file":"lib/libtmux/schema.ex","line":31,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-value_type-0"},{"id":"LibTmux.Schema.field/0","publicId":"LibTmux.Schema.field/0","name":"field/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type field() :: %{\n name: atom(),\n wire: String.t(),\n format: String.t() | nil,\n type: value_type(),\n since: String.t(),\n nullable: boolean()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"field() :: %{\n name: atom(),\n wire: String.t(),\n format: String.t() | nil,\n type: value_type(),\n since: String.t(),\n nullable: boolean()\n }","doc":{"summary":"Field metadata shared by validation and documentation; nil format identifies a derived field."},"source":{"file":"lib/libtmux/schema.ex","line":33,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-field-0"},{"id":"LibTmux.Schema.relation/0","publicId":"LibTmux.Schema.relation/0","name":"relation/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type relation() :: {:one | :many, entity()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"relation() :: {:one | :many, entity()}","doc":{"summary":"The cardinality and target entity of one indexed graph relation."},"source":{"file":"lib/libtmux/schema.ex","line":42,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-relation-0"},{"id":"LibTmux.Schema.operator/0","publicId":"LibTmux.Schema.operator/0","name":"operator/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type operator() ::\n :equals\n | :not\n | :in\n | :not_in\n | :lt\n | :lte\n | :gt\n | :gte\n | :contains\n | :starts_with\n | :ends_with","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"operator() ::\n :equals\n | :not\n | :in\n | :not_in\n | :lt\n | :lte\n | :gt\n | :gte\n | :contains\n | :starts_with\n | :ends_with","doc":{"summary":"A scalar filter operator; each field category permits only its applicable subset."},"source":{"file":"lib/libtmux/schema.ex","line":44,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-operator-0"},{"id":"LibTmux.Schema.entities/0","publicId":"LibTmux.Schema.entities/0","name":"entities/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"entities()\n@spec entities() :: [entity()]","params":[],"returns":"[entity()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns supported entity names in a stable order."},"source":{"file":"lib/libtmux/schema.ex","line":139,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-entities-0"},{"id":"LibTmux.Schema.module/1","publicId":"LibTmux.Schema.module/1","name":"module/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"module(entity)\n@spec module(entity()) :: entity_module()","params":[{"name":"entity","type":"entity()"}],"returns":"entity_module()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the ordinary observation struct module for an entity."},"source":{"file":"lib/libtmux/schema.ex","line":143,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-module-1"},{"id":"LibTmux.Schema.entity/1","publicId":"LibTmux.Schema.entity/1","name":"entity/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"entity(entity)\n@spec entity(entity_selector()) :: entity()","params":[{"name":"entity","type":"entity_selector()"}],"returns":"entity()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Resolves an entity atom or its observation module."},"source":{"file":"lib/libtmux/schema.ex","line":147,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-entity-1"},{"id":"LibTmux.Schema.fields/1","publicId":"LibTmux.Schema.fields/1","name":"fields/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"fields(entity)\n@spec fields(entity_selector()) :: %{\n required(atom()) => field()\n }","params":[{"name":"entity","type":"entity_selector()"}],"returns":"%{required(atom()) => field()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the whitelisted field metadata for an entity."},"source":{"file":"lib/libtmux/schema.ex","line":156,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-fields-1"},{"id":"LibTmux.Schema.field/2","publicId":"LibTmux.Schema.field/2","name":"field/2","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"field(entity, name)\n@spec field(entity_selector(), atom()) :: field() | nil","params":[{"name":"entity","type":"entity_selector()"},{"name":"name","type":"atom()"}],"returns":"field() | nil"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns field metadata, or nil for a field outside the schema."},"source":{"file":"lib/libtmux/schema.ex","line":172,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-field-2"},{"id":"LibTmux.Schema.relations/1","publicId":"LibTmux.Schema.relations/1","name":"relations/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"relations(entity)\n@spec relations(entity_selector()) :: %{\n required(atom()) => relation()\n }","params":[{"name":"entity","type":"entity_selector()"}],"returns":"%{required(atom()) => relation()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns each relation's cardinality and target entity."},"source":{"file":"lib/libtmux/schema.ex","line":176,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-relations-1"},{"id":"LibTmux.Schema.relation_wire/1","publicId":"LibTmux.Schema.relation_wire/1","name":"relation_wire/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"relation_wire(name)\n@spec relation_wire(atom()) :: String.t()","params":[{"name":"name","type":"atom()"}],"returns":"String.t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a relation's explicit stable wire name."},"source":{"file":"lib/libtmux/schema.ex","line":180,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-relation_wire-1"},{"id":"LibTmux.Schema.operators/1","publicId":"LibTmux.Schema.operators/1","name":"operators/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"operators(map)\n@spec operators(field()) :: [operator()]","params":[{"name":"map","type":"field()"}],"returns":"[operator()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the portable operators allowed by a scalar field's value category."},"source":{"file":"lib/libtmux/schema.ex","line":184,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-schema-operators-1"},{"id":"LibTmux.Selection","publicId":"LibTmux.Selection","name":"Selection","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An ordered, materialized Enumerable over one captured entity type.","body":"Enumeration never refreshes or performs I/O. `where/2` accepts predicate\ndata; `filter/2` accepts unary Elixir functions with Enum truthiness.\nHolding a selection retains its snapshot graph. `Enum.to_list/1` projects\nordinary values when graph context is no longer needed."},"source":{"file":"lib/libtmux/selection.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection"},{"id":"LibTmux.Selection.t/1","publicId":"LibTmux.Selection.t/1","name":"t/1","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t(item)","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","typeParams":["item"],"doc":{"summary":"An ordered selection retaining items of one observation type and their originating snapshot."},"source":{"file":"lib/libtmux/selection.ex","line":15,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-t-1"},{"id":"LibTmux.Selection.t/0","publicId":"LibTmux.Selection.t/0","name":"t/0","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: t(LibTmux.Schema.observation())","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: t(LibTmux.Schema.observation())","doc":{"summary":"A selection without a concrete observation type; use `t:t/1` to preserve item types."},"source":{"file":"lib/libtmux/selection.ex","line":22,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-t-0"},{"id":"LibTmux.Selection.new/2","publicId":"LibTmux.Selection.new/2","name":"new/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":["overload"],"signatures":[{"raw":"new(snapshot, entity)\n@spec new(\n LibTmux.Snapshot.t(),\n :session | LibTmux.Session\n ) :: t(LibTmux.Session.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":session | LibTmux.Session"}],"returns":"t(LibTmux.Session.t())"},{"raw":"new(snapshot, entity)\n@spec new(LibTmux.Snapshot.t(), :window | LibTmux.Window) ::\n t(LibTmux.Window.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":window | LibTmux.Window"}],"returns":"t(LibTmux.Window.t())"},{"raw":"new(snapshot, entity)\n@spec new(LibTmux.Snapshot.t(), :pane | LibTmux.Pane) ::\n t(LibTmux.Pane.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":pane | LibTmux.Pane"}],"returns":"t(LibTmux.Pane.t())"},{"raw":"new(snapshot, entity)\n@spec new(\n LibTmux.Snapshot.t(),\n :window_link | LibTmux.WindowLink\n ) :: t(LibTmux.WindowLink.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":window_link | LibTmux.WindowLink"}],"returns":"t(LibTmux.WindowLink.t())"},{"raw":"new(snapshot, entity)\n@spec new(LibTmux.Snapshot.t(), :client | LibTmux.Client) ::\n t(LibTmux.Client.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":client | LibTmux.Client"}],"returns":"t(LibTmux.Client.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Materializes the observed items of an entity without I/O."},"source":{"file":"lib/libtmux/selection.ex","line":25,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-new-2"},{"id":"LibTmux.Selection.size/1","publicId":"LibTmux.Selection.size/1","name":"size/1","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"size(selection)\n@spec size(t()) :: non_neg_integer()","params":[{"name":"selection","type":"t()"}],"returns":"non_neg_integer()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns cached materialized size in constant time."},"source":{"file":"lib/libtmux/selection.ex","line":43,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-size-1"},{"id":"LibTmux.Selection.where/2","publicId":"LibTmux.Selection.where/2","name":"where/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"where(selection, criteria)\n@spec where(t(item), LibTmux.Filter.input()) :: t(item)\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()"}],"returns":"t(item)","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Filters validated data while retaining order and captured graph context."},"source":{"file":"lib/libtmux/selection.ex","line":47,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-where-2"},{"id":"LibTmux.Selection.filter/2","publicId":"LibTmux.Selection.filter/2","name":"filter/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"filter(selection, predicate)\n@spec filter(t(item), (item -> as_boolean(term()))) ::\n t(item)\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"predicate","type":"(item -> as_boolean(term()))"}],"returns":"t(item)","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Filters with a unary local function; normal predicate exceptions propagate."},"source":{"file":"lib/libtmux/selection.ex","line":53,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-filter-2"},{"id":"LibTmux.Selection.member_id?/2","publicId":"LibTmux.Selection.member_id?/2","name":"member_id?/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"member_id?(selection, id)\n@spec member_id?(t(), LibTmux.Ref.id()) :: boolean()","params":[{"name":"selection","type":"t()"},{"name":"id","type":"LibTmux.Ref.id()"}],"returns":"boolean()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Checks native identity separately from Enumerable element membership."},"source":{"file":"lib/libtmux/selection.ex","line":64,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-member_id-question-2"},{"id":"LibTmux.Selection.one/2","publicId":"LibTmux.Selection.one/2","name":"one/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"one(selection, criteria \\\\ [])\n@spec one(t(item), LibTmux.Filter.input()) ::\n {:ok, item} | {:error, LibTmux.Error.t()}\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"{:ok, item} | {:error, LibTmux.Error.t()}","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns exactly one match, or a structured cardinality error; stops at the second match."},"source":{"file":"lib/libtmux/selection.ex","line":68,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-one-2"},{"id":"LibTmux.Selection.one!/2","publicId":"LibTmux.Selection.one!/2","name":"one!/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"one!(selection, criteria \\\\ [])\n@spec one!(t(item), LibTmux.Filter.input()) :: item\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"item","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns exactly one match or raises its cardinality error."},"source":{"file":"lib/libtmux/selection.ex","line":73,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-one-bang-2"},{"id":"LibTmux.Selection.one_or_nil/2","publicId":"LibTmux.Selection.one_or_nil/2","name":"one_or_nil/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"one_or_nil(selection, criteria \\\\ [])\n@spec one_or_nil(t(item), LibTmux.Filter.input()) ::\n {:ok, item | nil} | {:error, LibTmux.Error.t()}\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"{:ok, item | nil} | {:error, LibTmux.Error.t()}","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns one match or nil; a second match remains an error."},"source":{"file":"lib/libtmux/selection.ex","line":77,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-one_or_nil-2"},{"id":"LibTmux.Selection.one_or_nil!/2","publicId":"LibTmux.Selection.one_or_nil!/2","name":"one_or_nil!/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"one_or_nil!(selection, criteria \\\\ [])\n@spec one_or_nil!(t(item), LibTmux.Filter.input()) ::\n item | nil\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"item | nil","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns one match or nil, raising on multiple matches."},"source":{"file":"lib/libtmux/selection.ex","line":82,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-one_or_nil-bang-2"},{"id":"LibTmux.Selection.exists?/2","publicId":"LibTmux.Selection.exists?/2","name":"exists?/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"exists?(selection, criteria \\\\ [])\n@spec exists?(t(), LibTmux.Filter.input()) :: boolean()","params":[{"name":"selection","type":"t()"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"boolean()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns true on the first matching observed item."},"source":{"file":"lib/libtmux/selection.ex","line":86,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-exists-question-2"},{"id":"LibTmux.Selection.count/2","publicId":"LibTmux.Selection.count/2","name":"count/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"count(selection, criteria \\\\ [])\n@spec count(t(), LibTmux.Filter.input()) ::\n non_neg_integer()","params":[{"name":"selection","type":"t()"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"non_neg_integer()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Counts observed matching items; use size/1 for cached unfiltered size."},"source":{"file":"lib/libtmux/selection.ex","line":91,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-selection-count-2"},{"id":"LibTmux.Server","publicId":"LibTmux.Server","name":"Server","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An explicit local tmux server descriptor.","body":"`new/1` performs no I/O. One-shot commands use an absolute executable and\nsocket with `-N`, so they cannot start a missing server or attach a client.\nConfigured server hooks remain environmental effects. Reads observe an\ninterval; one-shot identity checks leave a check/use race. Persistent\nincarnation-bound mutations require a separately qualified connection."},"source":{"file":"lib/libtmux/server.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server"},{"id":"LibTmux.Server.executable","publicId":"LibTmux.Server.executable","name":"executable","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-executable"},{"id":"LibTmux.Server.socket","publicId":"LibTmux.Server.socket","name":"socket","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-socket"},{"id":"LibTmux.Server.cwd","publicId":"LibTmux.Server.cwd","name":"cwd","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-cwd"},{"id":"LibTmux.Server.env","publicId":"LibTmux.Server.env","name":"env","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(binary()) => binary()}","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-env"},{"id":"LibTmux.Server.t/0","publicId":"LibTmux.Server.t/0","name":"t/0","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Server{\n cwd: String.t(),\n env: %{optional(binary()) => binary()},\n executable: String.t(),\n socket: String.t()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Server{\n cwd: String.t(),\n env: %{optional(binary()) => binary()},\n executable: String.t(),\n socket: String.t()\n }","doc":{"summary":"An explicit local server descriptor; constructing it neither connects nor reserves server identity."},"source":{"file":"lib/libtmux/server.ex","line":18,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-t-0"},{"id":"LibTmux.Server.option/0","publicId":"LibTmux.Server.option/0","name":"option/0","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:executable | :socket | :cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:executable | :socket | :cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}","doc":{"summary":"Descriptor inputs; executable, socket and cwd are absolute NUL-free paths."},"source":{"file":"lib/libtmux/server.ex","line":25,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-option-0"},{"id":"LibTmux.Server.new/1","publicId":"LibTmux.Server.new/1","name":"new/1","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"new(options)\n@spec new([option()]) :: t()","params":[{"name":"options","type":"[option()]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs a descriptor for an existing server without connecting or creating it."},"source":{"file":"lib/libtmux/server.ex","line":30,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-new-1"},{"id":"LibTmux.Server.run/3","publicId":"LibTmux.Server.run/3","name":"run/3","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"run(server, command, options \\\\ [])\n@spec run(t(), LibTmux.Command.t(), [\n LibTmux.Transport.OneShot.option()\n ]) ::\n {:ok, LibTmux.Transport.OneShot.result()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"server","type":"t()"},{"name":"command","type":"LibTmux.Command.t()"},{"name":"options","type":"[LibTmux.Transport.OneShot.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Transport.OneShot.result()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Runs one trusted command without attaching; returns bounded output and exit evidence."},"source":{"file":"lib/libtmux/server.ex","line":52,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-run-3"},{"id":"LibTmux.Server.snapshot/2","publicId":"LibTmux.Server.snapshot/2","name":"snapshot/2","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"snapshot(server, options \\\\ [])\n@spec snapshot(t(), [LibTmux.Capture.option()]) ::\n {:ok, LibTmux.Snapshot.t()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"server","type":"t()"},{"name":"options","type":"[LibTmux.Capture.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Snapshot.t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Captures a new graph explicitly, with bounded work and read retries."},"source":{"file":"lib/libtmux/server.ex","line":76,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-snapshot-2"},{"id":"LibTmux.Server.snapshot!/2","publicId":"LibTmux.Server.snapshot!/2","name":"snapshot!/2","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"snapshot!(server, options \\\\ [])\n@spec snapshot!(t(), [LibTmux.Capture.option()]) ::\n LibTmux.Snapshot.t()","params":[{"name":"server","type":"t()"},{"name":"options","type":"[LibTmux.Capture.option()]","default":"[]"}],"returns":"LibTmux.Snapshot.t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Captures a graph or raises the same structured capture error."},"source":{"file":"lib/libtmux/server.ex","line":80,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-server-snapshot-bang-2"},{"id":"LibTmux.Session","publicId":"LibTmux.Session","name":"Session","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An immutable session observation. Attachment retains tmux's client count."},"source":{"file":"lib/libtmux/entities.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-session"},{"id":"LibTmux.Session.id","publicId":"LibTmux.Session.id","name":"id","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-session-id"},{"id":"LibTmux.Session.server_instance","publicId":"LibTmux.Session.server_instance","name":"server_instance","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-session-server_instance"},{"id":"LibTmux.Session.name","publicId":"LibTmux.Session.name","name":"name","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-session-name"},{"id":"LibTmux.Session.attached_count","publicId":"LibTmux.Session.attached_count","name":"attached_count","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-session-attached_count"},{"id":"LibTmux.Session.attached","publicId":"LibTmux.Session.attached","name":"attached","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-session-attached"},{"id":"LibTmux.Session.t/0","publicId":"LibTmux.Session.t/0","name":"t/0","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Session{\n attached: LibTmux.Schema.observed(boolean()),\n attached_count:\n LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n name: LibTmux.Schema.observed(String.t()),\n server_instance: String.t()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Session{\n attached: LibTmux.Schema.observed(boolean()),\n attached_count:\n LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n name: LibTmux.Schema.observed(String.t()),\n server_instance: String.t()\n }","doc":{"summary":"A session with explicit field coverage and an attachment count separate from its Boolean projection."},"source":{"file":"lib/libtmux/entities.ex","line":12,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-session-t-0"},{"id":"LibTmux.Snapshot","publicId":"LibTmux.Snapshot","name":"Snapshot","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An indexed immutable graph observed over a capture interval.","body":"Construction and traversal perform no I/O. `fields` declares loaded fields\nover the supplied entity IDs; `complete` declares complete server entity\nsets. Missing declarations remain unloaded, including on empty sets.\nUnavailable capabilities use a separate declaration. Relations require\ncomplete join domains. A snapshot reserves no tmux objects."},"source":{"file":"lib/libtmux/snapshot.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot"},{"id":"LibTmux.Snapshot.id","publicId":"LibTmux.Snapshot.id","name":"id","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"pos_integer()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-id"},{"id":"LibTmux.Snapshot.server_instance","publicId":"LibTmux.Snapshot.server_instance","name":"server_instance","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-server_instance"},{"id":"LibTmux.Snapshot.captured_from","publicId":"LibTmux.Snapshot.captured_from","name":"captured_from","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"integer()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-captured_from"},{"id":"LibTmux.Snapshot.captured_until","publicId":"LibTmux.Snapshot.captured_until","name":"captured_until","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"integer()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-captured_until"},{"id":"LibTmux.Snapshot.coverage","publicId":"LibTmux.Snapshot.coverage","name":"coverage","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"coverage()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-coverage"},{"id":"LibTmux.Snapshot.schema_version","publicId":"LibTmux.Snapshot.schema_version","name":"schema_version","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"1","value":"1","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-schema_version"},{"id":"LibTmux.Snapshot.sessions","publicId":"LibTmux.Snapshot.sessions","name":"sessions","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(String.t()) => LibTmux.Session.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-sessions"},{"id":"LibTmux.Snapshot.windows","publicId":"LibTmux.Snapshot.windows","name":"windows","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(String.t()) => LibTmux.Window.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-windows"},{"id":"LibTmux.Snapshot.window_links","publicId":"LibTmux.Snapshot.window_links","name":"window_links","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(LibTmux.Ref.id()) => LibTmux.WindowLink.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-window_links"},{"id":"LibTmux.Snapshot.panes","publicId":"LibTmux.Snapshot.panes","name":"panes","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(String.t()) => LibTmux.Pane.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-panes"},{"id":"LibTmux.Snapshot.clients","publicId":"LibTmux.Snapshot.clients","name":"clients","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(String.t()) => LibTmux.Client.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-clients"},{"id":"LibTmux.Snapshot.order","publicId":"LibTmux.Snapshot.order","name":"order","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{required(LibTmux.Schema.entity()) => [LibTmux.Ref.id()]}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-order"},{"id":"LibTmux.Snapshot.indexes","publicId":"LibTmux.Snapshot.indexes","name":"indexes","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"indexes()","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-indexes"},{"id":"LibTmux.Snapshot.entity_coverage/0","publicId":"LibTmux.Snapshot.entity_coverage/0","name":"entity_coverage/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity_coverage() :: %{\n ids: MapSet.t(LibTmux.Ref.id()),\n complete: boolean(),\n fields: %{\n optional(atom()) => :loaded | :unavailable\n }\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity_coverage() :: %{\n ids: MapSet.t(LibTmux.Ref.id()),\n complete: boolean(),\n fields: %{\n optional(atom()) => :loaded | :unavailable\n }\n }","doc":{"summary":"Coverage of one captured entity domain; missing field entries are unloaded."},"source":{"file":"lib/libtmux/snapshot.ex","line":43,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-entity_coverage-0"},{"id":"LibTmux.Snapshot.coverage/0","publicId":"LibTmux.Snapshot.coverage/0","name":"coverage/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type coverage() :: %{\n entities: %{\n required(LibTmux.Schema.entity()) =>\n entity_coverage()\n }\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"coverage() :: %{\n entities: %{\n required(LibTmux.Schema.entity()) =>\n entity_coverage()\n }\n }","doc":{"summary":"Declared entity sets and field availability; completeness is separate from an empty captured set."},"source":{"file":"lib/libtmux/snapshot.ex","line":49,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-coverage-0"},{"id":"LibTmux.Snapshot.indexes/0","publicId":"LibTmux.Snapshot.indexes/0","name":"indexes/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque indexes()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Maps each session ID to the IDs of its window links and clients, and each window ID to the IDs of its window links and panes. Traverse with `related/4`; the layout is not part of the contract."},"source":{"file":"lib/libtmux/snapshot.ex","line":51,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-indexes-0"},{"id":"LibTmux.Snapshot.rows/0","publicId":"LibTmux.Snapshot.rows/0","name":"rows/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type rows() :: %{\n optional(LibTmux.Schema.entity()) => [\n map() | LibTmux.Schema.observation()\n ]\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"rows() :: %{\n optional(LibTmux.Schema.entity()) => [\n map() | LibTmux.Schema.observation()\n ]\n }","doc":{"summary":"Observed rows grouped by canonical entity; construction validates and deduplicates their identities."},"source":{"file":"lib/libtmux/snapshot.ex","line":58,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-rows-0"},{"id":"LibTmux.Snapshot.option/0","publicId":"LibTmux.Snapshot.option/0","name":"option/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:server_instance, String.t()}\n | {:captured_from, integer()}\n | {:captured_until, integer()}\n | {:fields,\n %{optional(LibTmux.Schema.entity()) => [atom()]}}\n | {:complete, [LibTmux.Schema.entity()]}\n | {:unavailable,\n %{optional(LibTmux.Schema.entity()) => [atom()]}}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:server_instance, String.t()}\n | {:captured_from, integer()}\n | {:captured_until, integer()}\n | {:fields,\n %{optional(LibTmux.Schema.entity()) => [atom()]}}\n | {:complete, [LibTmux.Schema.entity()]}\n | {:unavailable,\n %{optional(LibTmux.Schema.entity()) => [atom()]}}","doc":{"summary":"Construction metadata: one server instance, ordered millisecond timestamps and explicit coverage declarations."},"source":{"file":"lib/libtmux/snapshot.ex","line":60,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-option-0"},{"id":"LibTmux.Snapshot.t/0","publicId":"LibTmux.Snapshot.t/0","name":"t/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Snapshot{\n captured_from: integer(),\n captured_until: integer(),\n clients: %{\n optional(String.t()) => LibTmux.Client.t()\n },\n coverage: coverage(),\n id: pos_integer(),\n indexes: indexes(),\n order: %{\n required(LibTmux.Schema.entity()) => [\n LibTmux.Ref.id()\n ]\n },\n panes: %{optional(String.t()) => LibTmux.Pane.t()},\n schema_version: 1,\n server_instance: String.t(),\n sessions: %{\n optional(String.t()) => LibTmux.Session.t()\n },\n window_links: %{\n optional(LibTmux.Ref.id()) =>\n LibTmux.WindowLink.t()\n },\n windows: %{\n optional(String.t()) => LibTmux.Window.t()\n }\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Snapshot{\n captured_from: integer(),\n captured_until: integer(),\n clients: %{\n optional(String.t()) => LibTmux.Client.t()\n },\n coverage: coverage(),\n id: pos_integer(),\n indexes: indexes(),\n order: %{\n required(LibTmux.Schema.entity()) => [\n LibTmux.Ref.id()\n ]\n },\n panes: %{optional(String.t()) => LibTmux.Pane.t()},\n schema_version: 1,\n server_instance: String.t(),\n sessions: %{\n optional(String.t()) => LibTmux.Session.t()\n },\n window_links: %{\n optional(LibTmux.Ref.id()) =>\n LibTmux.WindowLink.t()\n },\n windows: %{\n optional(String.t()) => LibTmux.Window.t()\n }\n }","doc":{"summary":"An immutable observation interval with indexed entities and explicit coverage."},"source":{"file":"lib/libtmux/snapshot.ex","line":69,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-t-0"},{"id":"LibTmux.Snapshot.new/2","publicId":"LibTmux.Snapshot.new/2","name":"new/2","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"new(rows, options)\n@spec new(rows(), [option()]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"rows","type":"rows()"},{"name":"options","type":"[option()]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Validates observed rows, rejecting conflicts, invalid fields and dangling covered references."},"source":{"file":"lib/libtmux/snapshot.ex","line":86,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-new-2"},{"id":"LibTmux.Snapshot.items/2","publicId":"LibTmux.Snapshot.items/2","name":"items/2","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"items(snapshot, entity)\n@spec items(t(), LibTmux.Schema.entity_selector()) :: [\n LibTmux.Schema.observation()\n ]","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"}],"returns":"[LibTmux.Schema.observation()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns plain observed items in stable identity order without loading data."},"source":{"file":"lib/libtmux/snapshot.ex","line":154,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-items-2"},{"id":"LibTmux.Snapshot.sessions/1","publicId":"LibTmux.Snapshot.sessions/1","name":"sessions/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"sessions(snapshot)\n@spec sessions(t()) ::\n LibTmux.Selection.t(LibTmux.Session.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Session.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized session selection without I/O."},"source":{"file":"lib/libtmux/snapshot.ex","line":162,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-sessions-1"},{"id":"LibTmux.Snapshot.windows/1","publicId":"LibTmux.Snapshot.windows/1","name":"windows/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"windows(snapshot)\n@spec windows(t()) ::\n LibTmux.Selection.t(LibTmux.Window.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Window.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized physical window selection without I/O."},"source":{"file":"lib/libtmux/snapshot.ex","line":165,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-windows-1"},{"id":"LibTmux.Snapshot.panes/1","publicId":"LibTmux.Snapshot.panes/1","name":"panes/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"panes(snapshot)\n@spec panes(t()) :: LibTmux.Selection.t(LibTmux.Pane.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Pane.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized physical pane selection without I/O."},"source":{"file":"lib/libtmux/snapshot.ex","line":168,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-panes-1"},{"id":"LibTmux.Snapshot.window_links/1","publicId":"LibTmux.Snapshot.window_links/1","name":"window_links/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"window_links(snapshot)\n@spec window_links(t()) ::\n LibTmux.Selection.t(LibTmux.WindowLink.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.WindowLink.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized membership selection without I/O."},"source":{"file":"lib/libtmux/snapshot.ex","line":171,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-window_links-1"},{"id":"LibTmux.Snapshot.clients/1","publicId":"LibTmux.Snapshot.clients/1","name":"clients/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"clients(snapshot)\n@spec clients(t()) ::\n LibTmux.Selection.t(LibTmux.Client.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Client.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized attached-client selection without I/O."},"source":{"file":"lib/libtmux/snapshot.ex","line":174,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-clients-1"},{"id":"LibTmux.Snapshot.fetch/3","publicId":"LibTmux.Snapshot.fetch/3","name":"fetch/3","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"fetch(snapshot, entity, id)\n@spec fetch(\n t(),\n LibTmux.Schema.entity_selector(),\n LibTmux.Ref.id()\n ) ::\n {:ok, LibTmux.Schema.observation()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"id","type":"LibTmux.Ref.id()"}],"returns":"{:ok, LibTmux.Schema.observation()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Looks up one exact observed ID without I/O."},"source":{"file":"lib/libtmux/snapshot.ex","line":178,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-fetch-3"},{"id":"LibTmux.Snapshot.require_complete!/2","publicId":"LibTmux.Snapshot.require_complete!/2","name":"require_complete!/2","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"require_complete!(snapshot, entity)\n@spec require_complete!(\n t(),\n LibTmux.Schema.entity_selector()\n ) :: :ok","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requires a declared complete entity set, even when it has no rows."},"source":{"file":"lib/libtmux/snapshot.ex","line":194,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-require_complete-bang-2"},{"id":"LibTmux.Snapshot.require_field!/3","publicId":"LibTmux.Snapshot.require_field!/3","name":"require_field!/3","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"require_field!(snapshot, entity, field)\n@spec require_field!(\n t(),\n LibTmux.Schema.entity_selector(),\n atom()\n ) :: :ok","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"field","type":"atom()"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requires a loaded field over the captured entity domain before evaluation."},"source":{"file":"lib/libtmux/snapshot.ex","line":205,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-require_field-bang-3"},{"id":"LibTmux.Snapshot.require_relation!/4","publicId":"LibTmux.Snapshot.require_relation!/4","name":"require_relation!/4","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"require_relation!(snapshot, entity, relation, ids \\\\ :all)\n@spec require_relation!(\n t(),\n LibTmux.Schema.entity_selector(),\n atom(),\n :all | [LibTmux.Ref.id()]\n ) :: :ok","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"relation","type":"atom()"},{"name":"ids","type":":all | [LibTmux.Ref.id()]","default":":all"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requires a complete relation domain, including known-empty domains."},"source":{"file":"lib/libtmux/snapshot.ex","line":218,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-require_relation-bang-4"},{"id":"LibTmux.Snapshot.related/4","publicId":"LibTmux.Snapshot.related/4","name":"related/4","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"related(snapshot, entity, id, relation)\n@spec related(\n t(),\n LibTmux.Schema.entity_selector(),\n LibTmux.Ref.id(),\n atom()\n ) ::\n LibTmux.Schema.observation()\n | nil\n | [LibTmux.Schema.observation()]","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"id","type":"LibTmux.Ref.id()"},{"name":"relation","type":"atom()"}],"returns":"LibTmux.Schema.observation() | nil | [LibTmux.Schema.observation()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Resolves a covered relation through captured indexes; never refreshes."},"source":{"file":"lib/libtmux/snapshot.ex","line":235,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-snapshot-related-4"},{"id":"LibTmux.Transport.OneShot","publicId":"LibTmux.Transport.OneShot","name":"OneShot","namespace":"LibTmux.Transport","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Executes one explicitly selected executable with bounded captured output.","body":"This Linux transport owns a native helper and its ordinary finite process\ntree. It never uses a shell. A worker owns the Port and observes caller\ndeath; the helper detects pipe closure after worker or VM death.\nTarget environment entries travel as bytes to child `execve`, preserving\nempty values. The helper inherits the trusted host environment; requested\ntarget variables do not configure the helper. `TMUX` and `TMUX_PANE` are\nremoved from the target environment.\n\nLimits apply per call: stdout defaults to 1 MiB, stderr to 64 KiB, and\nretained chunks to 4096. `max_total_bytes` additionally bounds both streams\ntogether; it defaults to their summed limits. Overload returns an error\nwith a bounded prefix.\nIndependent caller processes require admission limits at their host or\nserver boundary; this primitive maintains no shared request queue.\n\nA positive timeout becomes one execution deadline. Retirement can take\nup to a separate 750 ms cleanup allowance after expiry. Missing retirement\nproof remains `:unknown`. No result authorizes replay. Helper SIGKILL,\nhostile escape and uninterruptible kernel tasks are outside the ordinary\ntree guarantee. Building the native helper requires a C11 compiler."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-transport-oneshot"},{"id":"LibTmux.Transport.OneShot.result/0","publicId":"LibTmux.Transport.OneShot.result/0","name":"result/0","namespace":"LibTmux.Transport.OneShot","parent":"LibTmux.Transport.OneShot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type result() :: %{\n stdout: binary(),\n stderr: binary(),\n exit_status: non_neg_integer(),\n cleanup: :retired\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"result() :: %{\n stdout: binary(),\n stderr: binary(),\n exit_status: non_neg_integer(),\n cleanup: :retired\n }","doc":{"summary":"Captured bytes and child exit status after proven owned-process retirement; nonzero exit remains a transport result."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":31,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-transport-oneshot-result-0"},{"id":"LibTmux.Transport.OneShot.option/0","publicId":"LibTmux.Transport.OneShot.option/0","name":"option/0","namespace":"LibTmux.Transport.OneShot","parent":"LibTmux.Transport.OneShot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:timeout, 1..600_000}\n | {:deadline, LibTmux.Deadline.t()}\n | {:cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:max_stdout_bytes | :max_stderr_bytes,\n 0..16_777_216}\n | {:max_total_bytes, nil | 0..33_554_432}\n | {:max_chunks, 1..65536}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:timeout, 1..600_000}\n | {:deadline, LibTmux.Deadline.t()}\n | {:cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:max_stdout_bytes | :max_stderr_bytes,\n 0..16_777_216}\n | {:max_total_bytes, nil | 0..33_554_432}\n | {:max_chunks, 1..65536}","doc":{"summary":"Per-call input and capture limits; bytes and chunks are bounded independently.","body":"Timeout and deadline are exclusive. A supplied deadline must have at most\n600,000 ms remaining at validation; it preserves its original cutoff."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":39,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-transport-oneshot-option-0"},{"id":"LibTmux.Transport.OneShot.run/3","publicId":"LibTmux.Transport.OneShot.run/3","name":"run/3","namespace":"LibTmux.Transport.OneShot","parent":"LibTmux.Transport.OneShot","kind":"function","modifiers":[],"signatures":[{"raw":"run(executable, arguments, options \\\\ [])\n@spec run(binary(), [binary()], [option()]) ::\n {:ok, result()} | {:error, LibTmux.Error.t()}","params":[{"name":"executable","type":"binary()"},{"name":"arguments","type":"[binary()]"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"{:ok, result()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Runs argv without a shell, retaining exit status separately from stdout and stderr."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":57,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-transport-oneshot-run-3"},{"id":"LibTmux.Transport.OneShot.run!/3","publicId":"LibTmux.Transport.OneShot.run!/3","name":"run!/3","namespace":"LibTmux.Transport.OneShot","parent":"LibTmux.Transport.OneShot","kind":"function","modifiers":[],"signatures":[{"raw":"run!(executable, arguments, options \\\\ [])\n@spec run!(binary(), [binary()], [option()]) :: result()","params":[{"name":"executable","type":"binary()"},{"name":"arguments","type":"[binary()]"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"result()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Runs argv, raising the same structured transport error on failure."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":90,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-transport-oneshot-run-bang-3"},{"id":"LibTmux.Window","publicId":"LibTmux.Window","name":"Window","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An immutable physical window, independent of session membership and index."},"source":{"file":"lib/libtmux/entities.ex","line":22,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window"},{"id":"LibTmux.Window.id","publicId":"LibTmux.Window.id","name":"id","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window-id"},{"id":"LibTmux.Window.server_instance","publicId":"LibTmux.Window.server_instance","name":"server_instance","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window-server_instance"},{"id":"LibTmux.Window.name","publicId":"LibTmux.Window.name","name":"name","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window-name"},{"id":"LibTmux.Window.width","publicId":"LibTmux.Window.width","name":"width","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window-width"},{"id":"LibTmux.Window.height","publicId":"LibTmux.Window.height","name":"height","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window-height"},{"id":"LibTmux.Window.layout","publicId":"LibTmux.Window.layout","name":"layout","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window-layout"},{"id":"LibTmux.Window.zoomed","publicId":"LibTmux.Window.zoomed","name":"zoomed","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window-zoomed"},{"id":"LibTmux.Window.t/0","publicId":"LibTmux.Window.t/0","name":"t/0","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Window{\n height: LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n layout: LibTmux.Schema.observed(String.t()),\n name: LibTmux.Schema.observed(String.t()),\n server_instance: String.t(),\n width: LibTmux.Schema.observed(non_neg_integer()),\n zoomed: LibTmux.Schema.observed(boolean())\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Window{\n height: LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n layout: LibTmux.Schema.observed(String.t()),\n name: LibTmux.Schema.observed(String.t()),\n server_instance: String.t(),\n width: LibTmux.Schema.observed(non_neg_integer()),\n zoomed: LibTmux.Schema.observed(boolean())\n }","doc":{"summary":"A physical window; session index and active-window state belong to a WindowLink."},"source":{"file":"lib/libtmux/entities.ex","line":35,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-window-t-0"},{"id":"LibTmux.WindowLink","publicId":"LibTmux.WindowLink","name":"WindowLink","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An observed session/index/window binding. Its key is not a link lifetime ID."},"source":{"file":"lib/libtmux/entities.ex","line":47,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-windowlink"},{"id":"LibTmux.WindowLink.id","publicId":"LibTmux.WindowLink.id","name":"id","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"{String.t(), non_neg_integer(), String.t()}","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-windowlink-id"},{"id":"LibTmux.WindowLink.server_instance","publicId":"LibTmux.WindowLink.server_instance","name":"server_instance","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-windowlink-server_instance"},{"id":"LibTmux.WindowLink.session_id","publicId":"LibTmux.WindowLink.session_id","name":"session_id","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-windowlink-session_id"},{"id":"LibTmux.WindowLink.window_id","publicId":"LibTmux.WindowLink.window_id","name":"window_id","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-windowlink-window_id"},{"id":"LibTmux.WindowLink.index","publicId":"LibTmux.WindowLink.index","name":"index","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-windowlink-index"},{"id":"LibTmux.WindowLink.active","publicId":"LibTmux.WindowLink.active","name":"active","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-windowlink-active"},{"id":"LibTmux.WindowLink.t/0","publicId":"LibTmux.WindowLink.t/0","name":"t/0","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.WindowLink{\n active: LibTmux.Schema.observed(boolean()),\n id: {String.t(), non_neg_integer(), String.t()},\n index: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n window_id: LibTmux.Schema.observed(String.t())\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.WindowLink{\n active: LibTmux.Schema.observed(boolean()),\n id: {String.t(), non_neg_integer(), String.t()},\n index: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n window_id: LibTmux.Schema.observed(String.t())\n }","doc":{"summary":"A captured session/index/window binding, including its session-relative active state."},"source":{"file":"lib/libtmux/entities.ex","line":59,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-windowlink-t-0"},{"id":"LibTmux.Wire","publicId":"LibTmux.Wire","name":"Wire","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Bounded JSON decoding with duplicate keys preserved until validation.","body":"Uses the built-in JSON decoder callbacks. Object keys stay strings; no\natoms are created. Byte, nesting, node, array and string ceilings apply\nbefore conversion to public maps. Parsing failures retain root paths and\noffsets where supplied; duplicate-key failures identify the object path.\nDepth starts at zero for the root value and increases for every object\nmember or array element; the maximum is inclusive for maps and JSON alike."},"source":{"file":"lib/libtmux/wire.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-wire"},{"id":"LibTmux.Wire.value/0","publicId":"LibTmux.Wire.value/0","name":"value/0","namespace":"LibTmux.Wire","parent":"LibTmux.Wire","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type value() ::\n nil\n | boolean()\n | integer()\n | float()\n | String.t()\n | [value()]\n | object()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"value() ::\n nil\n | boolean()\n | integer()\n | float()\n | String.t()\n | [value()]\n | object()","doc":{"summary":"A JSON value with string-keyed objects; invalid external terms return a validation error."},"source":{"file":"lib/libtmux/wire.ex","line":15,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-wire-value-0"},{"id":"LibTmux.Wire.object/0","publicId":"LibTmux.Wire.object/0","name":"object/0","namespace":"LibTmux.Wire","parent":"LibTmux.Wire","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type object() :: %{optional(String.t()) => value()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"object() :: %{optional(String.t()) => value()}","doc":{"summary":"A JSON object whose keys remain strings; validation never creates atoms from external names."},"source":{"file":"lib/libtmux/wire.ex","line":17,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-wire-object-0"},{"id":"LibTmux.Wire.decode/2","publicId":"LibTmux.Wire.decode/2","name":"decode/2","namespace":"LibTmux.Wire","parent":"LibTmux.Wire","kind":"function","modifiers":[],"signatures":[{"raw":"decode(binary, options \\\\ [])\n@spec decode(binary(), [LibTmux.Filter.limit_option()]) ::\n {:ok, value()} | {:error, LibTmux.Error.t()}","params":[{"name":"binary","type":"binary()"},{"name":"options","type":"[LibTmux.Filter.limit_option()]","default":"[]"}],"returns":"{:ok, value()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes one complete bounded JSON value, rejecting duplicate keys and trailing data."},"source":{"file":"lib/libtmux/wire.ex","line":20,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-wire-decode-2"},{"id":"LibTmux.Wire.validate/2","publicId":"LibTmux.Wire.validate/2","name":"validate/2","namespace":"LibTmux.Wire","parent":"LibTmux.Wire","kind":"function","modifiers":[],"signatures":[{"raw":"validate(value, options \\\\ [])\n@spec validate(term(), [LibTmux.Filter.limit_option()]) ::\n {:ok, value()} | {:error, LibTmux.Error.t()}","params":[{"name":"value","type":"term()"},{"name":"options","type":"[LibTmux.Filter.limit_option()]","default":"[]"}],"returns":"{:ok, value()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Validates already-decoded JSON data and its complete encoded byte size."},"source":{"file":"lib/libtmux/wire.ex","line":83,"repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","extractedRevision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476"},"slug":"libtmux-wire-validate-2"}]} +{"port":"elixir","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractor":"@libtmux/api-model@0.0.1 (Elixir EEP-48 documentation chunks and Code.Typespec v1)","nativeProvenance":{"files":[{"path":"lib/libtmux/action.ex","sha256":"ac53100367a419f864d41b05a2f74e672a056d9ad7b5ad03c23344300979b80b"},{"path":"lib/libtmux/action/completion_error.ex","sha256":"83007cb9b5617eca58624cef1a51f3f11f263e1bea9a52ca218c4735b22fa7cc"},{"path":"lib/libtmux/capture.ex","sha256":"7ce2cedfc97592578be47780965ca74ef57f83549ecb6ab1de296ad21315e452"},{"path":"lib/libtmux/capture/row.ex","sha256":"678bf3b63fe5de2d8b0eb2f3600d70ebc4fbb6fb8c5c28bcc15be074aec41cf6"},{"path":"lib/libtmux/codec.ex","sha256":"5ec0f6d39d9fcb246d0190a2992e2ba5f8b38530e09aa3bee8e359629d2a661d"},{"path":"lib/libtmux/command.ex","sha256":"fcc2ac234c7f6fd546c0734b891d6593fc6696b4a83354e3f7664e08754a9fe2"},{"path":"lib/libtmux/control.ex","sha256":"fee390e3fb25701071a345877face9c82b3173c0df4060b9edb647a99dd2700c"},{"path":"lib/libtmux/control/admission.ex","sha256":"49b59e6a9c740b057842800a8a3110e578807ab3d7336dc35e3a4cfc79051411"},{"path":"lib/libtmux/control/births.ex","sha256":"b5d6aac8ca88c1e55f6db09cbb80694d0567f5d9ad99c01e6be995476387a105"},{"path":"lib/libtmux/control/bootstrap.ex","sha256":"ba74e1d6fa9d22cffef9aa39ebe606d31ce562b2869840bdea6da9bf9b88f037"},{"path":"lib/libtmux/control/connection_supervisor.ex","sha256":"14b12e40c46cd52df11a1065737e6da95b476f4563a94d2273a4af33bb872535"},{"path":"lib/libtmux/control/epoch_host.ex","sha256":"874239ea92a067f4622c91a11639861a8375b2146c58aaa39fff9c299a6c36a9"},{"path":"lib/libtmux/control/epoch_supervisor.ex","sha256":"16c64e39002c17d5d08bfb97dd0bb5a2415b9b3692480dd7418f1c048ebbd5ba"},{"path":"lib/libtmux/control/exchange.ex","sha256":"d496f628edfd3a54d70ad106f4cfe759c9a887c7ac763d239ff2889ebdebf1c1"},{"path":"lib/libtmux/control/execution_error.ex","sha256":"6ed0b7ce5374be1f9bbe5e4443b2653bae3368990b3a057f6553071c79a430d9"},{"path":"lib/libtmux/control/guardian.ex","sha256":"0d4396bde7f804957d9491564355b36ca4f3b624d1aaa17e65753e8df4dd91a6"},{"path":"lib/libtmux/control/inbox.ex","sha256":"34b069ca454a043ac44f669143dd8edfc843bee580f7c765bf92b770d68ae0c4"},{"path":"lib/libtmux/control/lifetime.ex","sha256":"f2057e838250f808f67da41f79692b2a4fcfc4a39abc2c7d9cae17580932e66a"},{"path":"lib/libtmux/control/manager.ex","sha256":"1d7b945c260ffb4b3e8b82d2db218a3cb9682a003326dbbfdfcf74fa7d9de9ec"},{"path":"lib/libtmux/control/owned_term.ex","sha256":"22236edb147924c981a231a3a160e786e8777da5276f38c365962dc57db5b357"},{"path":"lib/libtmux/control/records.ex","sha256":"0d493ec24e9abe91724ec5a9729066316cd80f7a71d83291ba5031d8a5198d2b"},{"path":"lib/libtmux/control/request.ex","sha256":"ae9bffefa62063a77f031099b4e3330b15443372eb2ca361865ca3eb5504ee1f"},{"path":"lib/libtmux/control/router.ex","sha256":"17bc94b85db8280382fa89d19867f23454c572c3b022a1b276caac1c8292b51c"},{"path":"lib/libtmux/control/scope.ex","sha256":"b10638e6fd3f994bc74ddbb8032060225d576fe454cc3645af42e3f5855db5e5"},{"path":"lib/libtmux/control/scope_failure.ex","sha256":"ba106a6c62d69d6bee9048175f498add3565696e14d4ad93021abfb55fe4db9d"},{"path":"lib/libtmux/control/start.ex","sha256":"54a93f995d44be3c2baeeb22dd81c4a554c4fb831e5d6b10de7dccccd8b07257"},{"path":"lib/libtmux/control/supervisor_start.ex","sha256":"70e06a9ba3f69b7e3f9bfdeffc293eed570304db28396a396a5a682255e4060a"},{"path":"lib/libtmux/control/waiters.ex","sha256":"30ed3c3605e8166a28519f58f1b6e01c59020d1831c969bcb58466d07736f734"},{"path":"lib/libtmux/deadline.ex","sha256":"4163ca272f1e59d087585c154fa9d6e6c0230f2a793b543144d452cf2b2d0263"},{"path":"lib/libtmux/entities.ex","sha256":"654386c61cc26c79d76c2b61a4bc7760981ce8fc766b31d4e1d1fe8d32939a2b"},{"path":"lib/libtmux/error.ex","sha256":"156f2ad4f4da0aafa8911b66d7daeee6bcf512b1e047ab057d8315eb3c80ddca"},{"path":"lib/libtmux/filter.ex","sha256":"a9ed5bba343d306ee1710c2fce5d0f28e7e6d1559744ca69fabc14482ec33741"},{"path":"lib/libtmux/filter/evaluator.ex","sha256":"502d7c09e209ff6c167e2ab74b485b77b589d1f8981b8d1a9ba580b07a43a68e"},{"path":"lib/libtmux/filter/wire.ex","sha256":"183928fcd937ed76a5e1718b7bbdf5f4a38be3ea02592ca42207cc087890e8ad"},{"path":"lib/libtmux/format.ex","sha256":"204658005014420ca63033f0bb216dade63dafe8108f26d67e6c0673104394e1"},{"path":"lib/libtmux/operation.ex","sha256":"a963380b1e69c471e1f50b583bb9606c1b9b5ca552c11c28b1ff793864719f3f"},{"path":"lib/libtmux/operation/lifecycle.ex","sha256":"0221ea46f5395f4b2aa86f9846cff7b0ebe932abb91f7ee118d298f68b1f7e8f"},{"path":"lib/libtmux/process_identity.ex","sha256":"5936b66347b803525d90a04bbd596790389bea97bdf8a82554b1d8bd1f6641e5"},{"path":"lib/libtmux/protocol.ex","sha256":"d391c9b1a5560fca17a090a007260aaf20be4f995b7e1fecf3ac99662abecf3c"},{"path":"lib/libtmux/ref.ex","sha256":"f6456c836a12991bf0316d368b159af569bdc4bd9f7ec6589f010fbb94bdc738"},{"path":"lib/libtmux/schema.ex","sha256":"7f140b56ccf7cf86e2b420b5f1e0e3b3b08b6d22e5c7dda66926a07b77946178"},{"path":"lib/libtmux/selection.ex","sha256":"b6cd467f5c4807fcbd9df4dbfb5fdfe230c3f468c395b114724f798d5b4004d8"},{"path":"lib/libtmux/server.ex","sha256":"b7ea7f92dffece1f88a4aafdfd66a9b9be52275cce94a73ee20eaae17488a01d"},{"path":"lib/libtmux/server/daemon.ex","sha256":"93d9d6cf291cebab02f9f136dce912cbbe7fba1e86625cb7f3e497148bff4cb3"},{"path":"lib/libtmux/snapshot.ex","sha256":"662c29cf16416d565bea3211fc5a2b5f154dd2e93343d210809144c40e7fdcbf"},{"path":"lib/libtmux/transport/native.ex","sha256":"4ec14f18472e94d848462f6acc598fdc8124532fe1b55bbf56e845d762852d3a"},{"path":"lib/libtmux/transport/native/driver.ex","sha256":"91a85c2d9ff593bc127d27432bc5d57822949d2b3aa905d35840c492db23028e"},{"path":"lib/libtmux/transport/native/protocol.ex","sha256":"7032f92e640f5d8cfe4b099cb43cdbd684fd8d54a04379259184cc7cb4012a78"},{"path":"lib/libtmux/transport/oneshot.ex","sha256":"9216b90dffab49f22eaf29dadc842c62aed17c803aa26899b230a4fd567901df"},{"path":"lib/libtmux/transport/reply.ex","sha256":"be1bad8d3b00b3ecf609a2887daee001bb9a84e49cb147780ea0c52f58caddf1"},{"path":"lib/libtmux/wire.ex","sha256":"bdb83f5e8cba2e7eab2c655e30fd2b464f53cd87b1d9f6db34646f067f6d4479"},{"path":"mix.exs","sha256":"c16e2678d8cba2ee9e73946d2a3fc1a863c4e60679600b59bd9e609181adf5c5"}],"exporter":{"name":"Elixir EEP-48 documentation chunks and Code.Typespec","version":1,"elixir":"1.20.5","otp":"29.1.3","columns":60}},"sources":[{"product":"core","package":"libtmux","version":"0.1.3","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"}],"symbols":[{"id":"LibTmux.Action","publicId":"LibTmux.Action","name":"Action","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Shared results for explicit pane, window and session actions.","body":"Pass a `LibTmux.Server` for one-shot execution or a `LibTmux.Control` for\nmanaged execution in its qualified connection. No action changes transport,\nreplays a mutation or refreshes an observation. Targeted one-shot actions\ncheck the server incarnation before execution; that check leaves a\ncheck/use race.\n\nOrdinary actions return `{:ok, result}` only for completed commands.\nFailed, skipped and unknown outcomes return\n`{:error, %LibTmux.Action.CompletionError{result: original_result}}`.\n`value` holds the completed command's value; `details` retains the\ntransport's original bounded evidence. Domain bang functions return the\ncompleted value or raise `LibTmux.Action.CompletionError` with the original\nunsuccessful result. Acknowledgement does not prove that a program\nprocessed input or finished running.\n\nAPI errors use `LibTmux.Error`; admitted control errors preserve the recovery\nhandle in `LibTmux.Control.ExecutionError`. Domain bang functions raise\nthese errors unchanged. Lower-level `LibTmux.Control` and `LibTmux.Operation`\nbang functions retain canonical outcomes as values.\n\nAction errors with kind `:invalid_command` include a validation `path` such\nas `[:options, :size]` and a bounded `details.reason` describing accepted\ninputs. The reason appears in the exception message; rejected values are\nnot retained in diagnostic details. Targeted one-shot actions validate both\nnative process specifications before the identity read. Session creation\nhas no observed target; it validates its command and runs without an identity\nread. Native byte/count refusals use paths such as `[:process, :argv]` or\n`[:process, :frame]`.\nPreparation does not check filesystem existence or guarantee execution.\n\nA nonzero one-shot client exit reports `:failed` with `:observed` certainty:\nits exit status is observed, not an authenticated tmux command reply or\nproof that no effects occurred.\n\nKill actions run one-shot only: a Control connection returns\n`unsupported_transport` before any I/O, because it cannot kill what it is\nattached to. A kill command prints nothing, so a completed result has the\nvalue `:ok`.\n\nOptional session context checks physical membership at tmux's command\nresolution. It does not bind a particular WindowLink index when a window\nhas multiple links in that session. WindowLink references are rejected.\nSee `LibTmux.Pane.split/3`, `LibTmux.Pane.send_text/4` and\n`LibTmux.Window.rename/4` for caller examples."},"source":{"file":"lib/libtmux/action.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action"},{"id":"LibTmux.Action.connection/0","publicId":"LibTmux.Action.connection/0","name":"connection/0","namespace":"LibTmux.Action","parent":"LibTmux.Action","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type connection() ::\n LibTmux.Server.t() | LibTmux.Control.t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"connection() ::\n LibTmux.Server.t() | LibTmux.Control.t()","doc":{"summary":"Explicitly selected one-shot descriptor or pinned qualified connection."},"source":{"file":"lib/libtmux/action.ex","line":54,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-connection-0"},{"id":"LibTmux.Action.option/0","publicId":"LibTmux.Action.option/0","name":"option/0","namespace":"LibTmux.Action","parent":"LibTmux.Action","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:timeout, 1..600_000} | {:session, LibTmux.Ref.t()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:timeout, 1..600_000} | {:session, LibTmux.Ref.t()}","doc":{"summary":"A 1..600000ms execution budget, default 5000ms; optional exact session context for physical targets."},"source":{"file":"lib/libtmux/action.ex","line":56,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-option-0"},{"id":"LibTmux.Action.creation_option/0","publicId":"LibTmux.Action.creation_option/0","name":"creation_option/0","namespace":"LibTmux.Action","parent":"LibTmux.Action","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type creation_option() ::\n {:timeout, 1..600_000}\n | {:cwd, binary()}\n | {:command,\n :default\n | {:shell, binary()}\n | {:argv, [binary(), ...]}}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"creation_option() ::\n {:timeout, 1..600_000}\n | {:cwd, binary()}\n | {:command,\n :default\n | {:shell, binary()}\n | {:argv, [binary(), ...]}}","doc":{"summary":"Detached creation on an existing server; default command/shell and directory unless supplied."},"source":{"file":"lib/libtmux/action.ex","line":58,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-creation_option-0"},{"id":"LibTmux.Action.creation_value/0","publicId":"LibTmux.Action.creation_value/0","name":"creation_value/0","namespace":"LibTmux.Action","parent":"LibTmux.Action","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type creation_value() :: %{id: String.t(), ref: nil}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"creation_value() :: %{id: String.t(), ref: nil}","doc":{"summary":"A created native ID without a bound reference; capture a new observation before another targeted action."},"source":{"file":"lib/libtmux/action.ex","line":63,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-creation_value-0"},{"id":"LibTmux.Action.result/1","publicId":"LibTmux.Action.result/1","name":"result/1","namespace":"LibTmux.Action","parent":"LibTmux.Action","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type result(value) :: %{\n outcome: :completed,\n certainty: LibTmux.Error.certainty(),\n evidence: atom(),\n transport: :one_shot | :control,\n value: value,\n details: map()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","typeParams":["value"],"type":"result(value) :: %{\n outcome: :completed,\n certainty: LibTmux.Error.certainty(),\n evidence: atom(),\n transport: :one_shot | :control,\n value: value,\n details: map()\n }","doc":{"summary":"A completed action's value and original transport evidence.","body":"Only completed results appear in an action's `{:ok, result}` tuple. Command\nacknowledgement remains distinct from external program completion.\n\nA completed split carries `t:LibTmux.Pane.split_value/0`. See\n`LibTmux.Pane.split/3` for its identity and lifetime limits."},"source":{"file":"lib/libtmux/action.ex","line":65,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-result-1"},{"id":"LibTmux.Action.unsuccessful_result/0","publicId":"LibTmux.Action.unsuccessful_result/0","name":"unsuccessful_result/0","namespace":"LibTmux.Action","parent":"LibTmux.Action","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type unsuccessful_result() :: %{\n outcome: :failed | :skipped | :unknown,\n certainty: LibTmux.Error.certainty(),\n evidence: atom(),\n transport: :one_shot | :control,\n value: nil,\n details: map()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"unsuccessful_result() :: %{\n outcome: :failed | :skipped | :unknown,\n certainty: LibTmux.Error.certainty(),\n evidence: atom(),\n transport: :one_shot | :control,\n value: nil,\n details: map()\n }","doc":{"summary":"A failed, skipped or unknown action outcome retained inside CompletionError."},"source":{"file":"lib/libtmux/action.ex","line":83,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-unsuccessful_result-0"},{"id":"LibTmux.Action.error/0","publicId":"LibTmux.Action.error/0","name":"error/0","namespace":"LibTmux.Action","parent":"LibTmux.Action","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type error() ::\n LibTmux.Error.t()\n | LibTmux.Action.CompletionError.t()\n | LibTmux.Control.ExecutionError.t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"error() ::\n LibTmux.Error.t()\n | LibTmux.Action.CompletionError.t()\n | LibTmux.Control.ExecutionError.t()","doc":{"summary":"An API refusal, unsuccessful outcome or managed execution error retaining recovery context."},"source":{"file":"lib/libtmux/action.ex","line":92,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-error-0"},{"id":"LibTmux.Action.CompletionError","publicId":"LibTmux.Action.CompletionError","name":"CompletionError","namespace":"LibTmux.Action","kind":"exception","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An action result did not meet an explicit completion requirement.","body":"Returned in an error tuple by domain actions such as `LibTmux.Pane.split/3`\nand raised by their bang variants. `result` preserves the original\nfailed, skipped or unknown outcome, including certainty and transport\nevidence. An unknown outcome remains unknown; this exception does not\ncancel work or authorize replay. Its message omits transport output."},"extends":["Exception"],"source":{"file":"lib/libtmux/action/completion_error.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-completionerror"},{"id":"LibTmux.Action.CompletionError.result","publicId":"LibTmux.Action.CompletionError.result","name":"result","namespace":"LibTmux.Action.CompletionError","parent":"LibTmux.Action.CompletionError","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Action.unsuccessful_result()","value":"nil","source":{"file":"lib/libtmux/action/completion_error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-completionerror-result"},{"id":"LibTmux.Action.CompletionError.t/0","publicId":"LibTmux.Action.CompletionError.t/0","name":"t/0","namespace":"LibTmux.Action.CompletionError","parent":"LibTmux.Action.CompletionError","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Action.CompletionError{\n __exception__: term(),\n result: LibTmux.Action.unsuccessful_result()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Action.CompletionError{\n __exception__: term(),\n result: LibTmux.Action.unsuccessful_result()\n }","doc":{"summary":"The original action result that did not establish command completion."},"source":{"file":"lib/libtmux/action/completion_error.ex","line":14,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-action-completionerror-t-0"},{"id":"LibTmux.Capture","publicId":"LibTmux.Capture","name":"Capture","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Builds a bounded one-shot observation of one existing Linux tmux server.","body":"Capture checks topology and OS server identity before and after field\nreads. Attempts share the original deadline and work budgets; `attempts`\ndefaults to 2 and accepts 1–3. Only inconsistent topology or disappearing\nread targets retry. Decoding and coverage errors remain visible.\n\nDefaults: 1024 topology rows, 512 commands, 8 MiB total response bytes,\n64 KiB per response and 5000 ms. Exhausted capture-wide budgets return an\nerror, never a partial success. Both topology scans count contextual linked rows.\nFree-form fields use one encoded listing per entity kind. One successful\nattempt uses 13 commands when those three listings fit. After a listing\nexceeds the response ceiling and its client retires, capture reads that\nkind's physical entities individually. The failed listing still consumes\ncommands, bytes and time. Duplicate linked text rows consume bytes.\nCapture adds no control attachment. Hooks configured on list commands can\nstill have effects; retries do not replay application mutations."},"source":{"file":"lib/libtmux/capture.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-capture"},{"id":"LibTmux.Capture.option/0","publicId":"LibTmux.Capture.option/0","name":"option/0","namespace":"LibTmux.Capture","parent":"LibTmux.Capture","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:timeout, pos_integer()}\n | {:deadline, LibTmux.Deadline.t()}\n | {:attempts, 1..3}\n | {:max_entities\n | :max_commands\n | :max_bytes\n | :max_response_bytes, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:timeout, pos_integer()}\n | {:deadline, LibTmux.Deadline.t()}\n | {:attempts, 1..3}\n | {:max_entities\n | :max_commands\n | :max_bytes\n | :max_response_bytes, pos_integer()}","doc":{"summary":"Capture-wide budgets shared by all attempts and reads.","body":"Each read uses the smaller of remaining `max_bytes` and `max_response_bytes`.\nThat effective ceiling must fit OneShot's 16 MiB stdout limit. The shared\ndeadline must have at most 600,000 ms remaining when OneShot validates a read.\nInvalid combinations raise `ArgumentError` before that command executes."},"source":{"file":"lib/libtmux/capture.ex","line":25,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-capture-option-0"},{"id":"LibTmux.Capture.fetch/2","publicId":"LibTmux.Capture.fetch/2","name":"fetch/2","namespace":"LibTmux.Capture","parent":"LibTmux.Capture","kind":"function","modifiers":[],"signatures":[{"raw":"fetch(server, options \\\\ [])\n@spec fetch(LibTmux.Server.t(), [option()]) ::\n {:ok, LibTmux.Snapshot.t()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"server","type":"LibTmux.Server.t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"{:ok, LibTmux.Snapshot.t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Performs bounded capture through an explicit server descriptor.","body":"See `t:option/0` for the composed work, response and remaining-deadline\nconstraints inherited from `LibTmux.Transport.OneShot.run/3`.\n\nSee the [worked example](first-task.html)."},"source":{"file":"lib/libtmux/capture.ex","line":49,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-capture-fetch-2"},{"id":"LibTmux.Client","publicId":"LibTmux.Client","name":"Client","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An immutable attached-client observation, keyed by validated client name."},"source":{"file":"lib/libtmux/entities.ex","line":658,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client"},{"id":"LibTmux.Client.id","publicId":"LibTmux.Client.id","name":"id","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client-id"},{"id":"LibTmux.Client.server_instance","publicId":"LibTmux.Client.server_instance","name":"server_instance","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client-server_instance"},{"id":"LibTmux.Client.session_id","publicId":"LibTmux.Client.session_id","name":"session_id","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client-session_id"},{"id":"LibTmux.Client.pid","publicId":"LibTmux.Client.pid","name":"pid","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client-pid"},{"id":"LibTmux.Client.width","publicId":"LibTmux.Client.width","name":"width","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client-width"},{"id":"LibTmux.Client.height","publicId":"LibTmux.Client.height","name":"height","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer() | nil)","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client-height"},{"id":"LibTmux.Client.control_mode","publicId":"LibTmux.Client.control_mode","name":"control_mode","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client-control_mode"},{"id":"LibTmux.Client.t/0","publicId":"LibTmux.Client.t/0","name":"t/0","namespace":"LibTmux.Client","parent":"LibTmux.Client","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Client{\n control_mode: LibTmux.Schema.observed(boolean()),\n height:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n id: String.t(),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer())\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Client{\n control_mode: LibTmux.Schema.observed(boolean()),\n height:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n id: String.t(),\n pid: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer())\n }","doc":{"summary":"An attached client; a known absent height is distinct from unloaded or unavailable coverage."},"source":{"file":"lib/libtmux/entities.ex","line":671,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-client-t-0"},{"id":"LibTmux.Codec","publicId":"LibTmux.Codec","name":"Codec","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes bounded field responses and control-output bytes.","body":"A field response contains one free-form field and one framing newline.\nThe default raw mode removes only its framing newline and requires a\nseparately qualified raw source. Use `encoding: :escaped_v1` for output\nproduced by `LibTmux.Format.field/1`, including tmux 3.4's print path.\nThis is a conservative response codec, not a multi-field row codec."},"source":{"file":"lib/libtmux/codec.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-codec"},{"id":"LibTmux.Codec.field_type/0","publicId":"LibTmux.Codec.field_type/0","name":"field_type/0","namespace":"LibTmux.Codec","parent":"LibTmux.Codec","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type field_type() :: :bytes | :string | :integer | :boolean","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"field_type() :: :bytes | :string | :integer | :boolean","doc":{"summary":"The required decoded field category; string additionally requires valid UTF-8."},"source":{"file":"lib/libtmux/codec.ex","line":14,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-codec-field_type-0"},{"id":"LibTmux.Codec.field_option/0","publicId":"LibTmux.Codec.field_option/0","name":"field_option/0","namespace":"LibTmux.Codec","parent":"LibTmux.Codec","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type field_option() ::\n {:encoding, :raw | :escaped_v1}\n | {:max_bytes, pos_integer()}\n | {:min | :max, integer() | nil}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"field_option() ::\n {:encoding, :raw | :escaped_v1}\n | {:max_bytes, pos_integer()}\n | {:min | :max, integer() | nil}","doc":{"summary":"Field framing and value validation options; min and max apply only to integer fields."},"source":{"file":"lib/libtmux/codec.ex","line":16,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-codec-field_option-0"},{"id":"LibTmux.Codec.decode_field/3","publicId":"LibTmux.Codec.decode_field/3","name":"decode_field/3","namespace":"LibTmux.Codec","parent":"LibTmux.Codec","kind":"function","modifiers":["overload"],"signatures":[{"raw":"decode_field(response, type, options \\\\ [])\n@spec decode_field(binary(), :bytes | :string, [\n field_option()\n ]) ::\n {:ok, binary()} | {:error, LibTmux.Error.t()}","params":[{"name":"response","type":"binary()"},{"name":"type","type":":bytes | :string"},{"name":"options","type":"[field_option()]","default":"[]"}],"returns":"{:ok, binary()} | {:error, LibTmux.Error.t()}"},{"raw":"decode_field(response, type, options \\\\ [])\n@spec decode_field(binary(), :integer, [field_option()]) ::\n {:ok, integer()} | {:error, LibTmux.Error.t()}","params":[{"name":"response","type":"binary()"},{"name":"type","type":":integer"},{"name":"options","type":"[field_option()]","default":"[]"}],"returns":"{:ok, integer()} | {:error, LibTmux.Error.t()}"},{"raw":"decode_field(response, type, options \\\\ [])\n@spec decode_field(binary(), :boolean, [field_option()]) ::\n {:ok, boolean()} | {:error, LibTmux.Error.t()}","params":[{"name":"response","type":"binary()"},{"name":"type","type":":boolean"},{"name":"options","type":"[field_option()]","default":"[]"}],"returns":"{:ok, boolean()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Removes one framing newline and validates the complete field value.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/codec.ex","line":22,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-codec-decode_field-3"},{"id":"LibTmux.Codec.decode_output/2","publicId":"LibTmux.Codec.decode_output/2","name":"decode_output/2","namespace":"LibTmux.Codec","parent":"LibTmux.Codec","kind":"function","modifiers":[],"signatures":[{"raw":"decode_output(value, options \\\\ [])\n@spec decode_output(binary(), [\n {:max_bytes, pos_integer()}\n ]) ::\n {:ok, binary()} | {:error, LibTmux.Error.t()}","params":[{"name":"value","type":"binary()"},{"name":"options","type":"[{:max_bytes, pos_integer()}]","default":"[]"}],"returns":"{:ok, binary()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes tmux's three-digit octal output escapes as bytes.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/codec.ex","line":48,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-codec-decode_output-2"},{"id":"LibTmux.Command","publicId":"LibTmux.Command","name":"Command","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A command value with separate argv and tmux-text renderers.","body":"Construction performs no I/O. Arguments are bytes without NUL. Rendering\nprotects command syntax; arguments interpreted as formats still require\n`LibTmux.Format`. A command value does not authorize a shared control lane\nor establish completion behavior, including configured hooks and aliases."},"source":{"file":"lib/libtmux/command.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-command"},{"id":"LibTmux.Command.t/0","publicId":"LibTmux.Command.t/0","name":"t/0","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Trusted command data without I/O. Format operands need separate encoding before execution."},"source":{"file":"lib/libtmux/command.ex","line":14,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-command-t-0"},{"id":"LibTmux.Command.option/0","publicId":"LibTmux.Command.option/0","name":"option/0","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() :: {:max_bytes, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() :: {:max_bytes, pos_integer()}","doc":{"summary":"A positive byte ceiling for the selected argv or text rendering; encoded output is charged separately."},"source":{"file":"lib/libtmux/command.ex","line":16,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-command-option-0"},{"id":"LibTmux.Command.new/3","publicId":"LibTmux.Command.new/3","name":"new/3","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"function","modifiers":[],"signatures":[{"raw":"new(name, args, options \\\\ [])\n@spec new(String.t(), [binary()], [option()]) :: t()","params":[{"name":"name","type":"String.t()"},{"name":"args","type":"[binary()]"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs a trusted command, rejecting invalid arguments and input size.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/command.ex","line":19,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-command-new-3"},{"id":"LibTmux.Command.argv/2","publicId":"LibTmux.Command.argv/2","name":"argv/2","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"function","modifiers":[],"signatures":[{"raw":"argv(command, options \\\\ [])\n@spec argv(t(), [option()]) :: [binary()]","params":[{"name":"command","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"[binary()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns process arguments, preserving terminal semicolons in tmux's argv parser.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/command.ex","line":39,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-command-argv-2"},{"id":"LibTmux.Command.render/2","publicId":"LibTmux.Command.render/2","name":"render/2","namespace":"LibTmux.Command","parent":"LibTmux.Command","kind":"function","modifiers":[],"signatures":[{"raw":"render(command, options \\\\ [])\n@spec render(t(), [option()]) :: binary()","params":[{"name":"command","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"binary()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Renders one newline-free tmux command line within its encoded byte budget.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/command.ex","line":52,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-command-render-2"},{"id":"LibTmux.Control","publicId":"LibTmux.Control","name":"Control","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A qualified control connection for scoped and managed execution.","body":"Start with `with_connection/2` to own startup and cleanup around a callback.\nUse `execute/3` to obtain a command outcome after wire retirement and record\nreclamation. Canonical `:failed`, `:skipped` and `:unknown` outcomes remain\nvalues, including from bang functions; acknowledgement does not prove\nexternal program completion. See the [managed control guide](managed-control.html).\n\nA successful scope returns `{:ok, callback_value}` after proven cleanup.\n`LibTmux.Control.ScopeFailure` preserves the callback outcome when cleanup\nfails. `LibTmux.Control.ExecutionError` carries the operation handle and\nrecovery context for errors after admission.\n\nStarting a connection explicitly attaches to an existing session. The host\nmust qualify effective hooks, aliases and stream writers for its lifetime;\n`lane: :host_qualified` declares that work without performing it. Each handle\nstays pinned to one epoch. Pinning does not authenticate unqualified output\nor defend against arbitrary writes to internal tables. Local selections\nnever attach, and commands never replay, refresh or change transport.\n\nFor independently retained results, use `submit/3` and `LibTmux.Operation`.\nAwaiting a retained result does not reclaim its record. See the\n[advanced execution guide](advanced-execution.html) for explicit ownership.\n`request_close/1` closes write authority for the entire epoch through reserved\ncapacity; it neither proves retirement nor rolls back effects."},"source":{"file":"lib/libtmux/control.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control"},{"id":"LibTmux.Control.t/0","publicId":"LibTmux.Control.t/0","name":"t/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A handle pinned to one owner and connection epoch; it never follows a replacement."},"source":{"file":"lib/libtmux/control.ex","line":46,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-t-0"},{"id":"LibTmux.Control.start_option/0","publicId":"LibTmux.Control.start_option/0","name":"start_option/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type start_option() ::\n {:server, LibTmux.Server.t()}\n | {:session, {:existing, String.t()}}\n | {:lane, :host_qualified}\n | {:timeout, 1..600_000}\n | {:capacity\n | :metadata_capacity\n | :waiter_capacity, 1..256}\n | {:retention_ms, 1..600_000}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"start_option() ::\n {:server, LibTmux.Server.t()}\n | {:session, {:existing, String.t()}}\n | {:lane, :host_qualified}\n | {:timeout, 1..600_000}\n | {:capacity\n | :metadata_capacity\n | :waiter_capacity, 1..256}\n | {:retention_ms, 1..600_000}","doc":{"summary":"Explicit attachment policy and bounded startup settings; capacities count slots and timeouts use milliseconds."},"source":{"file":"lib/libtmux/control.ex","line":49,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-start_option-0"},{"id":"LibTmux.Control.call_option/0","publicId":"LibTmux.Control.call_option/0","name":"call_option/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type call_option() :: {:timeout, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"call_option() :: {:timeout, pos_integer()}","doc":{"summary":"A positive millisecond budget shared by all stages of one lifecycle or submission call."},"source":{"file":"lib/libtmux/control.ex","line":58,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-call_option-0"},{"id":"LibTmux.Control.scope_option/0","publicId":"LibTmux.Control.scope_option/0","name":"scope_option/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type scope_option() ::\n start_option() | {:cleanup_timeout, 1..950}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"scope_option() ::\n start_option() | {:cleanup_timeout, 1..950}","doc":{"summary":"Startup options plus a separate cleanup allowance of 1..950ms, default 950ms; callback duration has no library timer."},"source":{"file":"lib/libtmux/control.ex","line":61,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-scope_option-0"},{"id":"LibTmux.Control.terminal_diagnostic/0","publicId":"LibTmux.Control.terminal_diagnostic/0","name":"terminal_diagnostic/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type terminal_diagnostic() :: %{\n reason: atom(),\n phase: atom(),\n stderr: binary()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"terminal_diagnostic() :: %{\n reason: atom(),\n phase: atom(),\n stderr: binary()\n }","doc":{"summary":"An observed close reason, its error phase and at most 8192 captured stderr bytes; not proof of effects or complete stderr."},"source":{"file":"lib/libtmux/control.ex","line":64,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-terminal_diagnostic-0"},{"id":"LibTmux.Control.connection_status/0","publicId":"LibTmux.Control.connection_status/0","name":"connection_status/0","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type connection_status() :: %{\n epoch: reference() | nil,\n generation: non_neg_integer(),\n phase:\n :starting\n | :ready\n | :closing\n | :retired\n | :unknown,\n instance: String.t() | nil,\n terminal: terminal_diagnostic() | nil | :unavailable\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"connection_status() :: %{\n epoch: reference() | nil,\n generation: non_neg_integer(),\n phase:\n :starting\n | :ready\n | :closing\n | :retired\n | :unknown,\n instance: String.t() | nil,\n terminal: terminal_diagnostic() | nil | :unavailable\n }","doc":{"summary":"A pinned epoch's current phase, identity and terminal evidence; retirement and unknown cleanup are distinct."},"source":{"file":"lib/libtmux/control.ex","line":67,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-connection_status-0"},{"id":"LibTmux.Control.start_link/1","publicId":"LibTmux.Control.start_link/1","name":"start_link/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"start_link(options)\n@spec start_link([start_option()]) ::\n {:ok, pid(), t()} | {:error, LibTmux.Error.t()}","params":[{"name":"options","type":"[start_option()]"}],"returns":"{:ok, pid(), t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Starts a linked connection and returns `{:ok, root, control}`.","body":"Require `server: %LibTmux.Server{}`, `session: {:existing, \"$id\"}` and\n`lane: :host_qualified`. No session is created. The attachment is visible in\ntmux's client counts and can update session state. `no-output,ignore-size`\nsuppresses pane output and excludes this client from window sizing.\n\n`timeout` defaults to 5000ms and accepts 1..600000ms. One budget covers input\npreparation, Root startup, bootstrap, ready waiting and handoff. A fresh\nfactory returns a ready handle. Runtime failures return a structured error;\ninvalid trusted options raise `ArgumentError`. Ordinary OTP links remain:\nan asynchronous fatal Root exit can terminate a non-trapping caller.\n\nFailed startup fences its lifetime and requests exact-Root cleanup. Error\ndetails distinguish observed Root exit from a kill request; unknown native\ncleanup is never success. OTP can await Root exit after its initialization\ntimer expires, so a strict wall-clock caller-return bound remains unqualified.\n\nOptional `capacity`, `metadata_capacity` and `waiter_capacity` default to 32\nand accept 1..256. `retention_ms` defaults to 60000 and accepts 1..600000.\n\nReady connections buffer at most 64 KiB or 128 stdout chunks behind the\nreader. Overflow closes the whole epoch with `resource_limit`; it never\nreplays commands. These receive limits do not cap borrowed-server memory.\n\nSee the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/control.ex","line":76,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-start_link-1"},{"id":"LibTmux.Control.with_connection/2","publicId":"LibTmux.Control.with_connection/2","name":"with_connection/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"with_connection(options, callback)\n@spec with_connection([scope_option()], (t() -> value)) ::\n {:ok, value}\n | {:error,\n LibTmux.Error.t()\n | LibTmux.Control.ScopeFailure.t(value)}\n when value: var","params":[{"name":"options","type":"[scope_option()]"},{"name":"callback","type":"(t() -> value)"}],"returns":"{:ok, value} | {:error, LibTmux.Error.t() | LibTmux.Control.ScopeFailure.t(value)}","typeParams":["value: var"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Runs a callback with one connection and owns its native and supervisor cleanup.","body":"Takes the explicit server, existing session and host qualification options\nfrom `start_link/1`. The callback runs in the calling process. Its duration\nis separate from startup and `cleanup_timeout` (default 950ms). A dedicated\nconnection owner also requests cleanup when that caller dies.\n\nReturns `{:ok, value}` after proven connection retirement and Root exit.\nCleaned-up exceptions, throws and exits are re-raised with their original\nstacktrace. If cleanup fails, returns `{:error, ScopeFailure}` containing the\ncallback's original value or exception and separate cleanup evidence.\nStartup failures return `{:error, Error}`; invalid options raise.\n\nThe control handle is scoped to the callback. Explicit reconnect is allowed\ninside it; cleanup permanently fences new epochs and retires the current one.\nEscaped handles cannot reconnect after the scope. Startup retains `start_link/1`'s OTP initialization\nlimitation; a timeout can report unknown cleanup while its owner is still\nunwinding startup. It does not promise a hard native process-exit deadline.\n\n alias LibTmux.Control\n\n Control.with_connection(options, fn control ->\n Control.execute(control, LibTmux.Control.Request.field(\"pid\"))\n end)"},"source":{"file":"lib/libtmux/control.ex","line":110,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-with_connection-2"},{"id":"LibTmux.Control.child_spec/1","publicId":"LibTmux.Control.child_spec/1","name":"child_spec/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"child_spec(options)\n@spec child_spec([start_option()]) ::\n Supervisor.child_spec()","params":[{"name":"options","type":"[start_option()]"}],"returns":"Supervisor.child_spec()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Builds a permanent supervisor child spec without attaching.","body":"Prepares bounded detached inputs and one lifetime shared by all factory\ninvocations. Each invocation starts its own configured startup budget.\nA restarted nonfresh lifetime returns an inert handle and never attaches\nautomatically. Proven retirement permits explicit `reconnect/2`; unknown\ncleanup refuses it. Old handles never follow a replacement Root or Manager.\n\n`Supervisor.start_child/2` and `Supervisor.restart_child/2` return the new\nhandle as their third info element. After an automatic restart, use\n`Supervisor.terminate_child/2` followed by `Supervisor.restart_child/2` for\nfresh info. This does not clear unknown cleanup or authorize replay.\n\nSee the [worked example](supervised-control.html)."},"source":{"file":"lib/libtmux/control.ex","line":157,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-child_spec-1"},{"id":"LibTmux.Control.submit/3","publicId":"LibTmux.Control.submit/3","name":"submit/3","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"submit(control, request, options \\\\ [])\n@spec submit(t(), LibTmux.Control.Request.t(), [\n call_option()\n ]) ::\n {:ok, LibTmux.Operation.t()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"},{"name":"request","type":"LibTmux.Control.Request.t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"{:ok, LibTmux.Operation.t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Admits one request and returns its retained operation handle.","body":"`timeout` defaults to 5000ms and covers validation, admission, queueing,\nwrites and replies under one monotonic deadline. Request binaries are\ndetached before publication. Invalid input, overload or stale context before\nadmission returns a no-write error. Every successful admission returns its\nOperation, even if its context disappears before publication. Inspect that\nhandle for the eventual canonical result or an explicit lost-context error.\n\nClosing the connection can affect sibling operations. Command replies do\nnot prove external program exit. Caller timeout does not authorize replay.\n\nSee the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/control.ex","line":212,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-submit-3"},{"id":"LibTmux.Control.execute/3","publicId":"LibTmux.Control.execute/3","name":"execute/3","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"execute(control, request, options \\\\ [])\n@spec execute(t(), LibTmux.Control.Request.t(), [\n call_option()\n ]) ::\n {:ok, LibTmux.Operation.result()}\n | {:error,\n LibTmux.Error.t()\n | LibTmux.Control.ExecutionError.t()}","params":[{"name":"control","type":"t()"},{"name":"request","type":"LibTmux.Control.Request.t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"{:ok, LibTmux.Operation.result()} | {:error, LibTmux.Error.t() | LibTmux.Control.ExecutionError.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Executes one qualified request, returning its result after wire retirement and record reclamation. Repeated successful calls need no manual forget.","body":"The default 5000ms budget covers preparation, admission, execution and\ncollection. Failed, skipped and unknown canonical outcomes remain values;\nacknowledgement does not establish external program completion.\n\nPre-admission errors have no-write certainty. An error after admission is\na `LibTmux.Control.ExecutionError` with the exact Operation and retained or\nlost context. Inspect that handle when available; never replay on timeout.\nThe original caller owns recovery: its death permits reclamation after wire\nretirement, even if it passed the handle to another process. A live caller's\ntimeout leaves the record subject to normal retention and explicit forget.\n`Operation.status/1` and `Operation.result/1` inspect it without a waiter.\nA new await needs its own slot; the expired collector releases its slot\nasynchronously when the owner processes closure.\nUse `submit/3` when a retained handle is required after successful waiting.\n\n alias LibTmux.Control\n\n Control.execute(control, LibTmux.Control.Request.field(\"pid\"))"},"source":{"file":"lib/libtmux/control.ex","line":236,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-execute-3"},{"id":"LibTmux.Control.execute!/3","publicId":"LibTmux.Control.execute!/3","name":"execute!/3","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"execute!(control, request, options \\\\ [])\n@spec execute!(t(), LibTmux.Control.Request.t(), [\n call_option()\n ]) :: LibTmux.Operation.result()","params":[{"name":"control","type":"t()"},{"name":"request","type":"LibTmux.Control.Request.t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"LibTmux.Operation.result()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Executes and reclaims as in `execute/3`; raises API/context errors, preserving canonical failures as values.","body":"See the [worked example](managed-control.html)."},"source":{"file":"lib/libtmux/control.ex","line":288,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-execute-bang-3"},{"id":"LibTmux.Control.submit!/3","publicId":"LibTmux.Control.submit!/3","name":"submit!/3","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"submit!(control, request, options \\\\ [])\n@spec submit!(t(), LibTmux.Control.Request.t(), [\n call_option()\n ]) :: LibTmux.Operation.t()","params":[{"name":"control","type":"t()"},{"name":"request","type":"LibTmux.Control.Request.t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"LibTmux.Operation.t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Admits a request or raises the same structured error.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/control.ex","line":325,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-submit-bang-3"},{"id":"LibTmux.Control.status/1","publicId":"LibTmux.Control.status/1","name":"status/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"status(control)\n@spec status(t()) ::\n {:ok, connection_status()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"}],"returns":"{:ok, connection_status()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads the pinned epoch's phase, identity and terminal diagnostics without I/O.","body":"`terminal` is `nil` before a terminal report, or `:unavailable` when the\nreport is missing or an ended epoch has no report. A report contains `reason`, its error\n`phase` and at most 8192 raw `stderr` bytes. Empty stderr means no bytes were\ncaptured; the buffer may be incomplete and need not be UTF-8. It can contain\napplication data and is never logged automatically.\n\nA terminal report can coexist with `:closing` or unknown cleanup. Its reason\nis an observed cause, not necessarily the original cause, and does not alter\noperation outcomes. Status fields are separate observations, not an atomic\nsnapshot. A replacement epoch starts without the old report; old handles\nremain stale. Losing the status owner returns the existing context error.\n\nSee the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/control.ex","line":333,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-status-1"},{"id":"LibTmux.Control.status!/1","publicId":"LibTmux.Control.status!/1","name":"status!/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"status!(control)\n@spec status!(t()) :: connection_status()","params":[{"name":"control","type":"t()"}],"returns":"connection_status()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads pinned connection status or raises the same structured error.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/control.ex","line":378,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-status-bang-1"},{"id":"LibTmux.Control.request_close/1","publicId":"LibTmux.Control.request_close/1","name":"request_close/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"request_close(control)\n@spec request_close(t()) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests whole-epoch closure without claiming an operation or metadata slot.","body":"Repeated requests for the same closing or proven-retired generation return\n`:ok`. Success is a request or previously known retirement, not a cleanup\nacknowledgement. A replacement Manager or epoch is never followed.\n\nSee the [worked example](supervised-control.html)."},"source":{"file":"lib/libtmux/control.ex","line":386,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-request_close-1"},{"id":"LibTmux.Control.request_close!/1","publicId":"LibTmux.Control.request_close!/1","name":"request_close!/1","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"request_close!(control)\n@spec request_close!(t()) :: :ok","params":[{"name":"control","type":"t()"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests epoch closure or raises the same structured error.","body":"See the [worked example](supervised-control.html)."},"source":{"file":"lib/libtmux/control.ex","line":417,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-request_close-bang-1"},{"id":"LibTmux.Control.close/2","publicId":"LibTmux.Control.close/2","name":"close/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"close(control, options \\\\ [])\n@spec close(t(), [call_option()]) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests closure and waits for proven retirement of the pinned epoch.","body":"`timeout` defaults to 5000ms. The original budget includes validation and\nretirement waiting. Closure still happens if the bounded metadata wait cannot\nbe admitted. Timeout, overload or lost ownership reports unknown certainty;\nit never proves cleanup. `:ok` requires known native and actor retirement.\n\nThe connection supervisor and retained records remain available for explicit\nreconnect and inspection. This does not stop the supervisor or roll back\nsibling effects.\n\nSee the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/control.ex","line":425,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-close-2"},{"id":"LibTmux.Control.close!/2","publicId":"LibTmux.Control.close!/2","name":"close!/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"close!(control, options \\\\ [])\n@spec close!(t(), [call_option()]) :: :ok","params":[{"name":"control","type":"t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Waits for retirement or raises the same structured error.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/control.ex","line":458,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-close-bang-2"},{"id":"LibTmux.Control.reconnect/2","publicId":"LibTmux.Control.reconnect/2","name":"reconnect/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"reconnect(control, options \\\\ [])\n@spec reconnect(t(), [call_option()]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"control","type":"t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Explicitly obtains the ready epoch, starting a replacement only after retirement.","body":"A ready epoch returns itself. Call `close/2` first to require replacement.\nThe default 5000ms budget covers metadata admission, retirement and startup.\nA successful reply pins the acknowledged endpoint even if it becomes stale\nbefore this caller resumes. It never follows a later view or replays work.\nErrors report unknown certainty about existing effects. Attachment counts\ninclude the control client; reconnect can attach one replacement client.\n\nSee the [worked example](supervised-control.html)."},"source":{"file":"lib/libtmux/control.ex","line":466,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-reconnect-2"},{"id":"LibTmux.Control.reconnect!/2","publicId":"LibTmux.Control.reconnect!/2","name":"reconnect!/2","namespace":"LibTmux.Control","parent":"LibTmux.Control","kind":"function","modifiers":[],"signatures":[{"raw":"reconnect!(control, options \\\\ [])\n@spec reconnect!(t(), [call_option()]) :: t()","params":[{"name":"control","type":"t()"},{"name":"options","type":"[call_option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Obtains the ready epoch or raises the same structured error.","body":"See the [worked example](supervised-control.html)."},"source":{"file":"lib/libtmux/control.ex","line":492,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-reconnect-bang-2"},{"id":"LibTmux.Control.ExecutionError","publicId":"LibTmux.Control.ExecutionError","name":"ExecutionError","namespace":"LibTmux.Control","kind":"exception","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A managed execution reported an error after admission.","body":"`error` explains the wait or context failure. `operation` is the exact\nadmitted handle. `context` reports whether its record was retained when\ninspected; expiry, Manager loss or death of the original `execute/3` caller\ncan invalidate it later. Passing the handle to another process does not\ntransfer recovery ownership; use `Control.submit/3` for durable retention\nindependent of the submitting caller. `:lost` never\nestablishes that the command was unwritten and does not authorize replay.\nInspect a retained handle with `LibTmux.Operation.status/1` before leaving\nits owning scope. See the [recovery example](recovery.html)."},"extends":["Exception"],"source":{"file":"lib/libtmux/control/execution_error.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-executionerror"},{"id":"LibTmux.Control.ExecutionError.error","publicId":"LibTmux.Control.ExecutionError.error","name":"error","namespace":"LibTmux.Control.ExecutionError","parent":"LibTmux.Control.ExecutionError","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Error.t()","value":"nil","source":{"file":"lib/libtmux/control/execution_error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-executionerror-error"},{"id":"LibTmux.Control.ExecutionError.operation","publicId":"LibTmux.Control.ExecutionError.operation","name":"operation","namespace":"LibTmux.Control.ExecutionError","parent":"LibTmux.Control.ExecutionError","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Operation.t()","value":"nil","source":{"file":"lib/libtmux/control/execution_error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-executionerror-operation"},{"id":"LibTmux.Control.ExecutionError.context","publicId":"LibTmux.Control.ExecutionError.context","name":"context","namespace":"LibTmux.Control.ExecutionError","parent":"LibTmux.Control.ExecutionError","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":":retained | :lost","value":"nil","source":{"file":"lib/libtmux/control/execution_error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-executionerror-context"},{"id":"LibTmux.Control.ExecutionError.t/0","publicId":"LibTmux.Control.ExecutionError.t/0","name":"t/0","namespace":"LibTmux.Control.ExecutionError","parent":"LibTmux.Control.ExecutionError","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Control.ExecutionError{\n __exception__: term(),\n context: :retained | :lost,\n error: LibTmux.Error.t(),\n operation: LibTmux.Operation.t()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Control.ExecutionError{\n __exception__: term(),\n context: :retained | :lost,\n error: LibTmux.Error.t(),\n operation: LibTmux.Operation.t()\n }","doc":{"summary":"Recovery evidence after admission; the original operation deadline is unchanged."},"source":{"file":"lib/libtmux/control/execution_error.ex","line":16,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-executionerror-t-0"},{"id":"LibTmux.Control.Request","publicId":"LibTmux.Control.Request","name":"Request","namespace":"LibTmux.Control","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Data for the qualified control lane's supported commands.","body":"Field reads encode one named variable losslessly. Server user options accept\nliteral binary values. Domain actions use the same lane for split, rename\nand literal/named input. Constructing a request performs no I/O; use\n`LibTmux.Control.execute/3` or retain a handle with `LibTmux.Control.submit/3`.\nThe host must qualify hooks, aliases and mode-dependent input bindings along\nwith other stream writers. Arbitrary commands, formats and raw control lines\nrequire separate qualification and are not accepted by this lane."},"source":{"file":"lib/libtmux/control/request.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-request"},{"id":"LibTmux.Control.Request.t/0","publicId":"LibTmux.Control.Request.t/0","name":"t/0","namespace":"LibTmux.Control.Request","parent":"LibTmux.Control.Request","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Command data for the qualified lane; construction does not validate admission or perform I/O."},"source":{"file":"lib/libtmux/control/request.ex","line":18,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-request-t-0"},{"id":"LibTmux.Control.Request.field/2","publicId":"LibTmux.Control.Request.field/2","name":"field/2","namespace":"LibTmux.Control.Request","parent":"LibTmux.Control.Request","kind":"function","modifiers":[],"signatures":[{"raw":"field(variable, target \\\\ nil)\n@spec field(String.t(), LibTmux.Ref.t() | nil) :: t()","params":[{"name":"variable","type":"String.t()"},{"name":"target","type":"LibTmux.Ref.t() | nil","default":"nil"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads a named format variable, optionally from an exact instance-bound target.","body":"Existing empty fields succeed. A target that disappears before the read\nproduces an acknowledged failed operation and leaves the connection usable.\nA reference does not reserve the object's lifetime.\n\nSee the [worked example](managed-control.html)."},"source":{"file":"lib/libtmux/control/request.ex","line":21,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-request-field-2"},{"id":"LibTmux.Control.Request.set_user_option/2","publicId":"LibTmux.Control.Request.set_user_option/2","name":"set_user_option/2","namespace":"LibTmux.Control.Request","parent":"LibTmux.Control.Request","kind":"function","modifiers":[],"signatures":[{"raw":"set_user_option(name, value)\n@spec set_user_option(String.t(), binary()) :: t()","params":[{"name":"name","type":"String.t()"},{"name":"value","type":"binary()"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Sets a server user option with an `@name` and a literal binary value.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/control/request.ex","line":34,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-request-set_user_option-2"},{"id":"LibTmux.Control.Request.verify_reply/3","publicId":"LibTmux.Control.Request.verify_reply/3","name":"verify_reply/3","namespace":"LibTmux.Control.Request","parent":"LibTmux.Control.Request","kind":"function","modifiers":[],"signatures":[{"raw":"verify_reply(request, status, lines)\n@spec verify_reply(t(), :ok | :error, [binary()]) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"request","type":"t()"},{"name":"status","type":":ok | :error"},{"name":"lines","type":"[binary()]"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Checks a qualified request's reply shape; a tmux error reply remains a command outcome.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/control/request.ex","line":95,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-request-verify_reply-3"},{"id":"LibTmux.Control.ScopeFailure","publicId":"LibTmux.Control.ScopeFailure","name":"ScopeFailure","namespace":"LibTmux.Control","kind":"exception","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A scoped callback finished, but connection cleanup was not proved.","body":"`primary` preserves either `{:return, value}` or\n`{:raise, kind, reason, stacktrace}`. `cleanup` holds the separate structured\ncleanup error. Callback values stay in the calling process; this wrapper\ndoes not copy them through a bounded connection mailbox or discard them.\nSee `LibTmux.Control.with_connection/2` for the complete return contract."},"extends":["Exception"],"source":{"file":"lib/libtmux/control/scope_failure.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-scopefailure"},{"id":"LibTmux.Control.ScopeFailure.primary/1","publicId":"LibTmux.Control.ScopeFailure.primary/1","name":"primary/1","namespace":"LibTmux.Control.ScopeFailure","parent":"LibTmux.Control.ScopeFailure","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type primary(value) ::\n {:return, value}\n | {:raise, :error | :throw | :exit, term(), list()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","typeParams":["value"],"type":"primary(value) ::\n {:return, value}\n | {:raise, :error | :throw | :exit, term(), list()}","doc":{"summary":"The callback's original value or caught exception, throw or exit with its stacktrace."},"source":{"file":"lib/libtmux/control/scope_failure.ex","line":13,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-scopefailure-primary-1"},{"id":"LibTmux.Control.ScopeFailure.t/1","publicId":"LibTmux.Control.ScopeFailure.t/1","name":"t/1","namespace":"LibTmux.Control.ScopeFailure","parent":"LibTmux.Control.ScopeFailure","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t(value) :: %LibTmux.Control.ScopeFailure{\n __exception__: term(),\n cleanup: LibTmux.Error.t(),\n primary: primary(value)\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","typeParams":["value"],"type":"t(value) :: %LibTmux.Control.ScopeFailure{\n __exception__: term(),\n cleanup: LibTmux.Error.t(),\n primary: primary(value)\n }","doc":{"summary":"Both primary callback evidence and unproved cleanup; neither implies no command effects."},"source":{"file":"lib/libtmux/control/scope_failure.ex","line":15,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-control-scopefailure-t-1"},{"id":"LibTmux.Deadline","publicId":"LibTmux.Deadline","name":"Deadline","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A node-local monotonic deadline shared by every stage of an operation.","body":"Construct it once at admission. Passing it between stages preserves the\noriginal budget; it is not a portable timestamp or a wire value."},"source":{"file":"lib/libtmux/deadline.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-deadline"},{"id":"LibTmux.Deadline.t/0","publicId":"LibTmux.Deadline.t/0","name":"t/0","namespace":"LibTmux.Deadline","parent":"LibTmux.Deadline","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A node-local monotonic millisecond cutoff. Share it between stages; never serialize it as a portable deadline."},"source":{"file":"lib/libtmux/deadline.ex","line":12,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-deadline-t-0"},{"id":"LibTmux.Deadline.option/0","publicId":"LibTmux.Deadline.option/0","name":"option/0","namespace":"LibTmux.Deadline","parent":"LibTmux.Deadline","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() :: {:now, integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() :: {:now, integer()}","doc":{"summary":"An optional node-local monotonic clock sample in milliseconds, used instead of sampling the current clock."},"source":{"file":"lib/libtmux/deadline.ex","line":14,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-deadline-option-0"},{"id":"LibTmux.Deadline.new/2","publicId":"LibTmux.Deadline.new/2","name":"new/2","namespace":"LibTmux.Deadline","parent":"LibTmux.Deadline","kind":"function","modifiers":[],"signatures":[{"raw":"new(milliseconds, options \\\\ [])\n@spec new(pos_integer(), [option()]) :: t()","params":[{"name":"milliseconds","type":"pos_integer()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Creates a deadline from a positive millisecond budget.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/deadline.ex","line":17,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-deadline-new-2"},{"id":"LibTmux.Deadline.remaining/2","publicId":"LibTmux.Deadline.remaining/2","name":"remaining/2","namespace":"LibTmux.Deadline","parent":"LibTmux.Deadline","kind":"function","modifiers":[],"signatures":[{"raw":"remaining(deadline, options \\\\ [])\n@spec remaining(t(), [option()]) :: non_neg_integer()","params":[{"name":"deadline","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"non_neg_integer()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the remaining milliseconds, clamped to zero after expiry.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/deadline.ex","line":33,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-deadline-remaining-2"},{"id":"LibTmux.Error","publicId":"LibTmux.Error","name":"Error","namespace":"LibTmux","kind":"exception","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An inspectable failure with its phase and certainty about effects.","body":"`retryable` describes a recovery option; it never authorizes replay of a\nmutation. Diagnostic details must stay within the producing operation's\nbyte budget. Bang functions raise this same structure."},"extends":["Exception"],"source":{"file":"lib/libtmux/error.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error"},{"id":"LibTmux.Error.kind","publicId":"LibTmux.Error.kind","name":"kind","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"atom()","value":"nil","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-kind"},{"id":"LibTmux.Error.phase","publicId":"LibTmux.Error.phase","name":"phase","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"atom()","value":":validation","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-phase"},{"id":"LibTmux.Error.certainty","publicId":"LibTmux.Error.certainty","name":"certainty","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"certainty()","value":":unknown","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-certainty"},{"id":"LibTmux.Error.retryable","publicId":"LibTmux.Error.retryable","name":"retryable","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"boolean()","value":"false","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-retryable"},{"id":"LibTmux.Error.path","publicId":"LibTmux.Error.path","name":"path","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"[path_component()]","value":"[]","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-path"},{"id":"LibTmux.Error.details","publicId":"LibTmux.Error.details","name":"details","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"map()","value":"%{}","source":{"file":"lib/libtmux/error.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-details"},{"id":"LibTmux.Error.certainty/0","publicId":"LibTmux.Error.certainty/0","name":"certainty/0","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type certainty() ::\n :no_write | :acknowledged | :observed | :unknown","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"certainty() ::\n :no_write | :acknowledged | :observed | :unknown","doc":{"summary":"Evidence about effects, independent of whether cleanup or arbitrary program completion is proved."},"source":{"file":"lib/libtmux/error.ex","line":19,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-certainty-0"},{"id":"LibTmux.Error.path_component/0","publicId":"LibTmux.Error.path_component/0","name":"path_component/0","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type path_component() ::\n atom() | non_neg_integer() | LibTmux.Ref.id()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"path_component() ::\n atom() | non_neg_integer() | LibTmux.Ref.id()","doc":{"summary":"A field, array index or observed identity locating an error; links retain their contextual tuple ID."},"source":{"file":"lib/libtmux/error.ex","line":21,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-path_component-0"},{"id":"LibTmux.Error.t/0","publicId":"LibTmux.Error.t/0","name":"t/0","namespace":"LibTmux.Error","parent":"LibTmux.Error","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Error{\n __exception__: term(),\n certainty: certainty(),\n details: map(),\n kind: atom(),\n path: [path_component()],\n phase: atom(),\n retryable: boolean()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Error{\n __exception__: term(),\n certainty: certainty(),\n details: map(),\n kind: atom(),\n path: [path_component()],\n phase: atom(),\n retryable: boolean()\n }","doc":{"summary":"A structured API failure. Kind and phase are extensible; retryable never permits automatic mutation replay."},"source":{"file":"lib/libtmux/error.ex","line":23,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-error-t-0"},{"id":"LibTmux.Filter","publicId":"LibTmux.Filter","name":"Filter","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A validated portable predicate over one observed entity type.","body":"Keywords are trusted shorthand for maps. Fields in one object conjoin;\nduplicate keyword keys are rejected recursively. `not` at a field negates\nequality, while Boolean `not` takes one criteria object. Lists require an\nexplicit operator. Native callbacks belong to `LibTmux.Selection.filter/2`.\nThis value contains data; executable preparation remains separate."},"source":{"file":"lib/libtmux/filter.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter"},{"id":"LibTmux.Filter.criteria/0","publicId":"LibTmux.Filter.criteria/0","name":"criteria/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type criteria() ::\n %{optional(atom()) => term()} | keyword(term())","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"criteria() ::\n %{optional(atom()) => term()} | keyword(term())","doc":{"summary":"Local map criteria or keyword shorthand; field and operand domains are validated at construction."},"source":{"file":"lib/libtmux/filter.ex","line":16,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-criteria-0"},{"id":"LibTmux.Filter.input/0","publicId":"LibTmux.Filter.input/0","name":"input/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type input() :: criteria() | t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"input() :: criteria() | t()","doc":{"summary":"Trusted criteria data or a previously validated filter for the same entity."},"source":{"file":"lib/libtmux/filter.ex","line":18,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-input-0"},{"id":"LibTmux.Filter.limit_option/0","publicId":"LibTmux.Filter.limit_option/0","name":"limit_option/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type limit_option() ::\n {:max_bytes, pos_integer()}\n | {:max_depth, pos_integer()}\n | {:max_nodes, pos_integer()}\n | {:max_list, pos_integer()}\n | {:max_string_bytes, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"limit_option() ::\n {:max_bytes, pos_integer()}\n | {:max_depth, pos_integer()}\n | {:max_nodes, pos_integer()}\n | {:max_list, pos_integer()}\n | {:max_string_bytes, pos_integer()}","doc":{"summary":"A positive resource ceiling; byte, depth, node, list and string budgets validate independently."},"source":{"file":"lib/libtmux/filter.ex","line":20,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-limit_option-0"},{"id":"LibTmux.Filter.limits/0","publicId":"LibTmux.Filter.limits/0","name":"limits/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type limits() :: %{\n max_bytes: pos_integer(),\n max_depth: pos_integer(),\n max_nodes: pos_integer(),\n max_list: pos_integer(),\n max_string_bytes: pos_integer()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"limits() :: %{\n max_bytes: pos_integer(),\n max_depth: pos_integer(),\n max_nodes: pos_integer(),\n max_list: pos_integer(),\n max_string_bytes: pos_integer()\n }","doc":{"summary":"Resolved constructor budgets; wire limits also cover the versioned envelope."},"source":{"file":"lib/libtmux/filter.ex","line":27,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-limits-0"},{"id":"LibTmux.Filter.t/0","publicId":"LibTmux.Filter.t/0","name":"t/0","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Validated portable predicate data; executable predicates are prepared separately."},"source":{"file":"lib/libtmux/filter.ex","line":43,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-t-0"},{"id":"LibTmux.Filter.new/3","publicId":"LibTmux.Filter.new/3","name":"new/3","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"new(entity, criteria, options \\\\ [])\n@spec new(LibTmux.Schema.entity_selector(), input(), [\n limit_option()\n ]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"criteria","type":"input()"},{"name":"options","type":"[limit_option()]","default":"[]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Normalizes criteria and validates field/operator/value domains before evaluation.","body":"An existing filter retains its constructor's validation when no new limits\nare supplied. Explicit limits check the normalized tree directly, without\nexpanding it into synthetic input syntax.\n\nSee the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/filter.ex","line":46,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-new-3"},{"id":"LibTmux.Filter.new!/3","publicId":"LibTmux.Filter.new!/3","name":"new!/3","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"new!(entity, criteria, options \\\\ [])\n@spec new!(LibTmux.Schema.entity_selector(), input(), [\n limit_option()\n ]) :: t()","params":[{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"criteria","type":"input()"},{"name":"options","type":"[limit_option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs a filter or raises its structured validation error.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/filter.ex","line":98,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-new-bang-3"},{"id":"LibTmux.Filter.to_predicate/2","publicId":"LibTmux.Filter.to_predicate/2","name":"to_predicate/2","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"to_predicate(filter, options)\n@spec to_predicate(t(), [\n {:snapshot, LibTmux.Snapshot.t()}\n ]) :: (LibTmux.Schema.observation() ->\n boolean())","params":[{"name":"filter","type":"t()"},{"name":"options","type":"[{:snapshot, LibTmux.Snapshot.t()}]"}],"returns":"(LibTmux.Schema.observation() -> boolean())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Prepares a local unary predicate after validating captured coverage, including empty domains.","body":"Relationship and count predicates require each input to equal the\nobservation stored under its ID in `snapshot`. A missing or different\nobservation raises `LibTmux.Error` with kind `:observation_mismatch`.\nRelated values always come from the prepared snapshot; equal inputs from\nanother capture are accepted.\n\nScalar-only predicates read the supplied observation and may be reused\nacross captures. Each referenced field must be loaded: `:unloaded` raises\n`:field_not_loaded` and `:unavailable` raises `:field_unavailable` before\nBoolean evaluation. Known nullable values keep their comparison semantics;\nunreferenced fields need not be loaded. The snapshot validates coverage\nwhen preparing the predicate.\n\nSee the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/filter.ex","line":111,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-to_predicate-2"},{"id":"LibTmux.Filter.from_wire/3","publicId":"LibTmux.Filter.from_wire/3","name":"from_wire/3","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"from_wire(entity, payload, options \\\\ [])\n@spec from_wire(LibTmux.Schema.entity_selector(), term(), [\n limit_option()\n ]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"payload","type":"term()"},{"name":"options","type":"[limit_option()]","default":"[]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes a whitelisted versioned map; raw JSON must use from_json to retain duplicate keys.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/filter.ex","line":136,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-from_wire-3"},{"id":"LibTmux.Filter.from_json/3","publicId":"LibTmux.Filter.from_json/3","name":"from_json/3","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"from_json(entity, json, options \\\\ [])\n@spec from_json(\n LibTmux.Schema.entity_selector(),\n binary(),\n [limit_option()]\n ) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"json","type":"binary()"},{"name":"options","type":"[limit_option()]","default":"[]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes bounded JSON, rejecting duplicate object keys and trailing data.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/filter.ex","line":146,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-from_json-3"},{"id":"LibTmux.Filter.to_wire/1","publicId":"LibTmux.Filter.to_wire/1","name":"to_wire/1","namespace":"LibTmux.Filter","parent":"LibTmux.Filter","kind":"function","modifiers":[],"signatures":[{"raw":"to_wire(filter)\n@spec to_wire(t()) :: LibTmux.Wire.object()","params":[{"name":"filter","type":"t()"}],"returns":"LibTmux.Wire.object()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the explicit versioned string-keyed wire representation.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/filter.ex","line":156,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-filter-to_wire-1"},{"id":"LibTmux.Format","publicId":"LibTmux.Format","name":"Format","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs literal operands for tmux formats without evaluating their text.","body":"Command quoting and format quoting are separate. A literal may contain\nnewlines or arbitrary non-NUL bytes; this does not qualify its output for\na shared line-oriented control lane."},"source":{"file":"lib/libtmux/format.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-format"},{"id":"LibTmux.Format.field/1","publicId":"LibTmux.Format.field/1","name":"field/1","namespace":"LibTmux.Format","parent":"LibTmux.Format","kind":"function","modifiers":[],"signatures":[{"raw":"field(name)\n@spec field(String.t()) :: binary()","params":[{"name":"name","type":"String.t()"}],"returns":"binary()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Encodes one named field for `LibTmux.Codec.decode_field/3` with `encoding: :escaped_v1`.","body":"Backslashes are replaced first, then dollars and ASCII control bytes.\nThis protects values from tmux 3.4's ambiguous print escaping. The `v1:`\nprefix and encoded newlines prevent field text from becoming reply guards.\nThis encodes one field. Capture composes these fields inside its versioned\nrow framing; this is not an arbitrary format wrapper. The caller must still\nbound the response and validate the\nfield against its schema and the connected server's capabilities.\n\nSee the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/format.ex","line":26,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-format-field-1"},{"id":"LibTmux.Format.literal/1","publicId":"LibTmux.Format.literal/1","name":"literal/1","namespace":"LibTmux.Format","parent":"LibTmux.Format","kind":"function","modifiers":[],"signatures":[{"raw":"literal(value)\n@spec literal(binary()) :: binary()","params":[{"name":"value","type":"binary()"}],"returns":"binary()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a format expression that expands to exactly the supplied non-NUL bytes.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/format.ex","line":47,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-format-literal-1"},{"id":"LibTmux.Operation","publicId":"LibTmux.Operation","name":"Operation","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A retained operation handle pinned to its original owner, tables and epoch.","body":"`result/1` and `status/1` read local retained values. `await/2` owns a separate\nbounded waiter; its timeout never stops the operation. `stop/1` requests\nclosure of the operation's entire connection epoch, including siblings.\nIt does not roll back effects or prove native cleanup.\n\nCanonical results carry `outcome`, `certainty` and `evidence`. Completed,\nfailed, skipped and unknown outcomes remain values, including in bang APIs.\nBang functions raise only API or metadata errors. A command reply is distinct\nfrom wire retirement and arbitrary program exit.\n\nNormal reconnect preserves retained records until forget or expiry. Owner\nreplacement loses those tables; a handle never follows a replacement view.\nHandles recovered from `LibTmux.Control.execute/3` errors also remain owned\nby that original caller: its death permits reclamation after wire retirement."},"source":{"file":"lib/libtmux/operation.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation"},{"id":"LibTmux.Operation.t/0","publicId":"LibTmux.Operation.t/0","name":"t/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"A retained owner-bound operation handle; it is not a command result or a reservation."},"source":{"file":"lib/libtmux/operation.ex","line":28,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-t-0"},{"id":"LibTmux.Operation.command_result/0","publicId":"LibTmux.Operation.command_result/0","name":"command_result/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type command_result() :: %{\n outcome: :completed | :failed,\n certainty: :acknowledged,\n evidence: :command_reply,\n guard: LibTmux.Protocol.guard_id(),\n lines: [binary()]\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"command_result() :: %{\n outcome: :completed | :failed,\n certainty: :acknowledged,\n evidence: :command_reply,\n guard: LibTmux.Protocol.guard_id(),\n lines: [binary()]\n }","doc":{"summary":"A qualified command reply, independently of wire retirement or program completion."},"source":{"file":"lib/libtmux/operation.ex","line":30,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-command_result-0"},{"id":"LibTmux.Operation.skipped_result/0","publicId":"LibTmux.Operation.skipped_result/0","name":"skipped_result/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type skipped_result() :: %{\n outcome: :skipped,\n certainty: :no_write,\n evidence: :cancelled | :timeout | :epoch_closed\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"skipped_result() :: %{\n outcome: :skipped,\n certainty: :no_write,\n evidence: :cancelled | :timeout | :epoch_closed\n }","doc":{"summary":"A canonical no-write outcome, with the reason it was skipped before dispatch."},"source":{"file":"lib/libtmux/operation.ex","line":38,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-skipped_result-0"},{"id":"LibTmux.Operation.unknown_result/0","publicId":"LibTmux.Operation.unknown_result/0","name":"unknown_result/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type unknown_result() :: %{\n outcome: :unknown,\n certainty: :unknown,\n evidence: :epoch_closed\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"unknown_result() :: %{\n outcome: :unknown,\n certainty: :unknown,\n evidence: :epoch_closed\n }","doc":{"summary":"An epoch closed without enough evidence to classify the operation's effects."},"source":{"file":"lib/libtmux/operation.ex","line":44,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-unknown_result-0"},{"id":"LibTmux.Operation.result/0","publicId":"LibTmux.Operation.result/0","name":"result/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type result() ::\n command_result()\n | skipped_result()\n | unknown_result()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"result() ::\n command_result()\n | skipped_result()\n | unknown_result()","doc":{"summary":"The immutable canonical outcome; failed, skipped and unknown outcomes remain values."},"source":{"file":"lib/libtmux/operation.ex","line":46,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-result-0"},{"id":"LibTmux.Operation.wire/0","publicId":"LibTmux.Operation.wire/0","name":"wire/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type wire() ::\n :unpublished\n | :unsent\n | :writing\n | :awaiting\n | :closing\n | :retired","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"wire() ::\n :unpublished\n | :unsent\n | :writing\n | :awaiting\n | :closing\n | :retired","doc":{"summary":"Wire progress for this operation; retired wire does not prove connection cleanup."},"source":{"file":"lib/libtmux/operation.ex","line":48,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-wire-0"},{"id":"LibTmux.Operation.status/0","publicId":"LibTmux.Operation.status/0","name":"status/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type status() :: %{wire: wire(), result: result() | nil}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"status() :: %{wire: wire(), result: result() | nil}","doc":{"summary":"Retained wire progress and the canonical result, or nil while no outcome is established."},"source":{"file":"lib/libtmux/operation.ex","line":50,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-status-0"},{"id":"LibTmux.Operation.option/0","publicId":"LibTmux.Operation.option/0","name":"option/0","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() :: {:timeout, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() :: {:timeout, pos_integer()}","doc":{"summary":"A positive millisecond budget for one waiter or record-reclamation call."},"source":{"file":"lib/libtmux/operation.ex","line":52,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-option-0"},{"id":"LibTmux.Operation.status/1","publicId":"LibTmux.Operation.status/1","name":"status/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"status(operation)\n@spec status(t()) ::\n {:ok, status()} | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"}],"returns":"{:ok, status()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads retained wire state and canonical result without contacting tmux.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":109,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-status-1"},{"id":"LibTmux.Operation.status!/1","publicId":"LibTmux.Operation.status!/1","name":"status!/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"status!(operation)\n@spec status!(t()) :: status()","params":[{"name":"operation","type":"t()"}],"returns":"status()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads retained status or raises the same structured error.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":123,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-status-bang-1"},{"id":"LibTmux.Operation.result/1","publicId":"LibTmux.Operation.result/1","name":"result/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"result(operation)\n@spec result(t()) ::\n :pending\n | {:ok, result()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"}],"returns":":pending | {:ok, result()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a canonical result, `:pending`, or a retained-context error.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":131,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-result-1"},{"id":"LibTmux.Operation.result!/1","publicId":"LibTmux.Operation.result!/1","name":"result!/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"result!(operation)\n@spec result!(t()) :: :pending | result()","params":[{"name":"operation","type":"t()"}],"returns":":pending | result()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Reads a result or `:pending`; raises API errors, preserving all canonical outcomes.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":145,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-result-bang-1"},{"id":"LibTmux.Operation.await/2","publicId":"LibTmux.Operation.await/2","name":"await/2","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"await(operation, options \\\\ [])\n@spec await(t(), [option()]) ::\n {:ok, result()} | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"{:ok, result()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Waits for a canonical result under one positive millisecond timeout.","body":"The default is 5000ms. Every call claims an independent bounded waiter slot,\nincluding terminal operations; use `result/1` for immediate inspection.\nCompleted waiter copies survive record reclamation until this caller reads\nthem. Timeout, overload and caller death affect only this waiter.\n\nSee the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":153,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-await-2"},{"id":"LibTmux.Operation.await!/2","publicId":"LibTmux.Operation.await!/2","name":"await!/2","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"await!(operation, options \\\\ [])\n@spec await!(t(), [option()]) :: result()","params":[{"name":"operation","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"result()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Waits or raises API errors; canonical failed, skipped and unknown outcomes remain values.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":169,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-await-bang-2"},{"id":"LibTmux.Operation.forget/2","publicId":"LibTmux.Operation.forget/2","name":"forget/2","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"forget(operation, options \\\\ [])\n@spec forget(t(), [option()]) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests exact-record reclamation with a default 5000ms timeout.","body":"Wire-active records cannot be forgotten. An owner-accepted request remains\nowned after caller timeout. Successful reclamation invalidates this record\nhandle while preserving already-accepted waiter copies.\n\nSee the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":181,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-forget-2"},{"id":"LibTmux.Operation.forget!/2","publicId":"LibTmux.Operation.forget!/2","name":"forget!/2","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"forget!(operation, options \\\\ [])\n@spec forget!(t(), [option()]) :: :ok","params":[{"name":"operation","type":"t()"},{"name":"options","type":"[option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Forgets the retained record or raises the same structured error.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":196,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-forget-bang-2"},{"id":"LibTmux.Operation.stop/1","publicId":"LibTmux.Operation.stop/1","name":"stop/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"stop(operation)\n@spec stop(t()) :: :ok | {:error, LibTmux.Error.t()}","params":[{"name":"operation","type":"t()"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests closure of the pinned epoch through reserved capacity.","body":"Returns `:ok` for an already wire-retired operation or an accepted closure\nrequest, and `{:error, error}` otherwise. Closure can affect sibling work;\nsuccess does not prove retirement or change the canonical result. A stale\nhandle cannot revoke a replacement epoch.\n\nSee the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":204,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-stop-1"},{"id":"LibTmux.Operation.stop!/1","publicId":"LibTmux.Operation.stop!/1","name":"stop!/1","namespace":"LibTmux.Operation","parent":"LibTmux.Operation","kind":"function","modifiers":[],"signatures":[{"raw":"stop!(operation)\n@spec stop!(t()) :: :ok","params":[{"name":"operation","type":"t()"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requests epoch closure or raises the same structured error.","body":"See the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/operation.ex","line":231,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-operation-stop-bang-1"},{"id":"LibTmux.Pane","publicId":"LibTmux.Pane","name":"Pane","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An immutable physical pane with explicit actions. It belongs to a window; text may be empty.","body":"## What is on here\n\nA Pane is a value captured in a `LibTmux.Snapshot`. Actions take a\n`LibTmux.Ref` and a Server or Control connection. Start with these groups:\n\n**Finding the pane.** Select panes from a captured snapshot, or look one up by\nits exact ID. Neither contacts tmux. An ID that was not captured returns\n`{:error, error}` with kind `:not_found`. Turn the pane into a reference tied\nto the server incarnation that supplied it, ready for an action.\n\n- Select: `LibTmux.Snapshot.panes/1`\n- By ID: `LibTmux.Snapshot.fetch/3`\n- Reference: `LibTmux.Ref.from_observation/1`\n\n**Splitting.** Split the pane and get the new pane's ID in the completed value.\nA qualified Control connection also returns a bound reference; one-shot\nexecution returns `ref: nil`. The defaults are a vertical, detached split at\nhalf size; options set the axis, size, directory and command.\n\n- Split: `split/3`\n- Raise on failure: `split!/3`\n\n**Sending input.** Send literal bytes, up to 995 of them, without interpreting\nkey names, or send named keys such as `\"Enter\"` and `\"C-c\"`. An unknown key\nname is rejected. Acknowledgement does not prove the program consumed the\ninput.\n\n- Literal bytes: `send_text/4`, `send_text!/4`\n- Named keys: `send_keys/4`, `send_keys!/4`\n\n**Reading the screen.** Capture the rendered screen through one-shot\nexecution; a Control connection returns `unsupported_transport`. Output over\nthe byte limit is an error, never a partial screen. This reads screen state,\nnot the program's original output stream.\n\n- Capture: `capture/3`\n- Raise on failure: `capture!/3`\n\n**Killing.** Kill the pane through a Server. A Control connection returns\n`unsupported_transport`. Killing the last pane of a window removes the window.\n\n- Kill: `kill/3`\n- Raise on failure: `kill!/3`"},"source":{"file":"lib/libtmux/entities.ex","line":384,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane"},{"id":"LibTmux.Pane.id","publicId":"LibTmux.Pane.id","name":"id","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-id"},{"id":"LibTmux.Pane.server_instance","publicId":"LibTmux.Pane.server_instance","name":"server_instance","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-server_instance"},{"id":"LibTmux.Pane.window_id","publicId":"LibTmux.Pane.window_id","name":"window_id","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-window_id"},{"id":"LibTmux.Pane.index","publicId":"LibTmux.Pane.index","name":"index","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-index"},{"id":"LibTmux.Pane.active","publicId":"LibTmux.Pane.active","name":"active","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-active"},{"id":"LibTmux.Pane.dead","publicId":"LibTmux.Pane.dead","name":"dead","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-dead"},{"id":"LibTmux.Pane.width","publicId":"LibTmux.Pane.width","name":"width","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-width"},{"id":"LibTmux.Pane.height","publicId":"LibTmux.Pane.height","name":"height","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-height"},{"id":"LibTmux.Pane.pid","publicId":"LibTmux.Pane.pid","name":"pid","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer() | nil)","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-pid"},{"id":"LibTmux.Pane.current_command","publicId":"LibTmux.Pane.current_command","name":"current_command","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-current_command"},{"id":"LibTmux.Pane.current_path","publicId":"LibTmux.Pane.current_path","name":"current_path","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-current_path"},{"id":"LibTmux.Pane.title","publicId":"LibTmux.Pane.title","name":"title","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-title"},{"id":"LibTmux.Pane.exit_status","publicId":"LibTmux.Pane.exit_status","name":"exit_status","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer() | nil)","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-exit_status"},{"id":"LibTmux.Pane.t/0","publicId":"LibTmux.Pane.t/0","name":"t/0","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Pane{\n active: LibTmux.Schema.observed(boolean()),\n current_command:\n LibTmux.Schema.observed(String.t()),\n current_path: LibTmux.Schema.observed(String.t()),\n dead: LibTmux.Schema.observed(boolean()),\n exit_status:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n height: LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n index: LibTmux.Schema.observed(non_neg_integer()),\n pid:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n server_instance: String.t(),\n title: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n window_id: LibTmux.Schema.observed(String.t())\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Pane{\n active: LibTmux.Schema.observed(boolean()),\n current_command:\n LibTmux.Schema.observed(String.t()),\n current_path: LibTmux.Schema.observed(String.t()),\n dead: LibTmux.Schema.observed(boolean()),\n exit_status:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n height: LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n index: LibTmux.Schema.observed(non_neg_integer()),\n pid:\n LibTmux.Schema.observed(non_neg_integer() | nil),\n server_instance: String.t(),\n title: LibTmux.Schema.observed(String.t()),\n width: LibTmux.Schema.observed(non_neg_integer()),\n window_id: LibTmux.Schema.observed(String.t())\n }","doc":{"summary":"A physical pane; PID and exit status can be known absent, with separate coverage sentinels.","body":"`pid` is `nil` when tmux reports no PID. A reported PID or its absence does\nnot establish process liveness or cleanup."},"source":{"file":"lib/libtmux/entities.ex","line":449,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-t-0"},{"id":"LibTmux.Pane.split_value/0","publicId":"LibTmux.Pane.split_value/0","name":"split_value/0","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type split_value() :: %{\n id: String.t(),\n ref: LibTmux.Ref.t() | nil\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"split_value() :: %{\n id: String.t(),\n ref: LibTmux.Ref.t() | nil\n }","doc":{"summary":"A created pane ID; `ref` is bound for qualified control and `nil` for one-shot."},"source":{"file":"lib/libtmux/entities.ex","line":471,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-split_value-0"},{"id":"LibTmux.Pane.split_option/0","publicId":"LibTmux.Pane.split_option/0","name":"split_option/0","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type split_option() ::\n LibTmux.Action.option()\n | {:axis, :horizontal | :vertical}\n | {:size, {:cells, 1..32767} | {:percent, 1..99}}\n | {:before | :detached, boolean()}\n | {:cwd, binary()}\n | {:command,\n :default\n | :empty\n | {:shell, binary()}\n | {:argv, [binary(), ...]}}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"split_option() ::\n LibTmux.Action.option()\n | {:axis, :horizontal | :vertical}\n | {:size, {:cells, 1..32767} | {:percent, 1..99}}\n | {:before | :detached, boolean()}\n | {:cwd, binary()}\n | {:command,\n :default\n | :empty\n | {:shell, binary()}\n | {:argv, [binary(), ...]}}","doc":{"summary":"Split geometry and process arguments."},"source":{"file":"lib/libtmux/entities.ex","line":474,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-split_option-0"},{"id":"LibTmux.Pane.capture_option/0","publicId":"LibTmux.Pane.capture_option/0","name":"capture_option/0","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type capture_option() ::\n LibTmux.Action.option()\n | {:start_line, -32768..32767}\n | {:end_line, -32768..32767 | :last}\n | {:join_lines, boolean()}\n | {:max_bytes, 0..1_048_576}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"capture_option() ::\n LibTmux.Action.option()\n | {:start_line, -32768..32767}\n | {:end_line, -32768..32767 | :last}\n | {:join_lines, boolean()}\n | {:max_bytes, 0..1_048_576}","doc":{"summary":"Bounded one-shot screen capture; line numbers are relative to the visible screen, with negative history offsets."},"source":{"file":"lib/libtmux/entities.ex","line":486,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-capture_option-0"},{"id":"LibTmux.Pane.split/3","publicId":"LibTmux.Pane.split/3","name":"split/3","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"split(connection, ref, options \\\\ [])\n@spec split(LibTmux.Action.connection(), LibTmux.Ref.t(), [\n split_option()\n ]) ::\n {:ok, LibTmux.Action.result(split_value())}\n | {:error, LibTmux.Action.error()}","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[split_option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(split_value())} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Splits an exact pane and returns its ID and optional bound reference as `value`.","body":"A completed value contains `id` and `ref`. Qualified control binds the reference.\nUse it for another action without recapturing. It identifies the pane in\nthat server incarnation, contains no fresh fields and does not reserve its\nlifetime. Closing the connection does not invalidate the reference while\nthe pane and server remain. One-shot execution does not establish this\nbinding and returns `ref: nil`. Unsuccessful outcomes return\n`{:error, %LibTmux.Action.CompletionError{}}` with the original result.\n\nDefaults: vertical split, half size, detached, after the target, and tmux's\nsession default shell/command and directory. `axis: :horizontal` places panes\nside by side; `size: {:percent, n}` uses `-l n%` on every supported release.\nOptional `cwd` is literal format text. Choose `command: :default`, `:empty`,\n`{:shell, nonempty_bytes}` or `{:argv, [program | arguments]}`. Shell text\nuses the session's configured shell; argv uses `execvp` semantics, including\nPATH lookup and executable-text fallback. Empty argv/program and empty\nexplicit shell text are rejected. At most 64 argv entries and the existing\ncommand byte bounds apply; bytes must be NUL-free.\n\nSingleton argv uses the packaged helper to preserve exactly one argument.\nIt replaces itself with the pane program. tmux retains the helper path in\n`pane_start_command`; commandless respawn requires that installation to\nremain available. See [command forms](one-shot-actions.html#command-forms).\nSplit acknowledgement does not prove program startup or completion.\n\n`session: session_ref` selects exact membership/context, not a WindowLink\nindex. `timeout` defaults to 5000ms. No snapshot is changed; capture again\nwhen a new observation is needed. See `LibTmux.Action` for outcomes and the\none-shot identity check/use limitation.\n\n alias LibTmux.Pane\n\n {:ok, %{value: %{ref: created}}} =\n Pane.split(control, pane_ref, axis: :horizontal, size: {:percent, 30})\n Pane.send_text(control, created, \"hello\")"},"source":{"file":"lib/libtmux/entities.ex","line":494,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-split-3"},{"id":"LibTmux.Pane.split!/3","publicId":"LibTmux.Pane.split!/3","name":"split!/3","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"split!(connection, ref, options \\\\ [])\n@spec split!(LibTmux.Action.connection(), LibTmux.Ref.t(), [\n split_option()\n ]) :: split_value()","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[split_option()]","default":"[]"}],"returns":"split_value()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the created pane value when `split/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":537,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-split-bang-3"},{"id":"LibTmux.Pane.send_text/4","publicId":"LibTmux.Pane.send_text/4","name":"send_text/4","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"send_text(connection, ref, bytes, options \\\\ [])\n@spec send_text(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n binary(),\n [LibTmux.Action.option()]\n ) ::\n {:ok, LibTmux.Action.result(:ok)}\n | {:error, LibTmux.Action.error()}","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"bytes","type":"binary()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Sends 0..995 literal bytes to an exact pane, without interpreting key names.","body":"Hex-key encoding preserves NUL and invalid UTF-8. Empty input sends nothing.\nBoth transports use the same limit, fitting tmux 3.8's command argument\nceiling. Larger inputs fail validation before I/O; calls are never split.\nThe terminal's line discipline, active mode and application still determine\nhow input is handled; acknowledgement does not prove program consumption.\nOptions and outcomes follow `LibTmux.Action`. For named keys use `send_keys/4`.\n\n alias LibTmux.Pane\n\n Pane.send_text(control, pane_ref, \"printf 'hello'\")"},"source":{"file":"lib/libtmux/entities.ex","line":543,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-send_text-4"},{"id":"LibTmux.Pane.send_text!/4","publicId":"LibTmux.Pane.send_text!/4","name":"send_text!/4","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"send_text!(connection, ref, bytes, options \\\\ [])\n@spec send_text!(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n binary(),\n [LibTmux.Action.option()]\n ) ::\n :ok","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"bytes","type":"binary()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns `:ok` when `send_text/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":564,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-send_text-bang-4"},{"id":"LibTmux.Pane.send_keys/4","publicId":"LibTmux.Pane.send_keys/4","name":"send_keys/4","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"send_keys(connection, ref, keys, options \\\\ [])\n@spec send_keys(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n [String.t()],\n [LibTmux.Action.option()]\n ) ::\n {:ok, LibTmux.Action.result(:ok)}\n | {:error, LibTmux.Action.error()}","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"keys","type":"[String.t()]"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Sends 1..128 named keys to an exact pane; unknown names are rejected.","body":"Supports Enter, Space, Tab, BTab, BSpace, Escape, arrows, Home, End, PageUp,\nPageDown, Insert, Delete and F1..F12. Distinct C-, M- and S- modifiers may\nprefix arrows, Home/End, PageUp/PageDown, Insert/Delete and F1..F12. Also\naccepts C-a..C-z, conventional ASCII control punctuation, and M- plus one\nprintable ASCII character. Unsupported combinations such as S-a and C-Enter\nfail before admission; tmux could otherwise type their spelling as text.\nOptions and outcomes follow `LibTmux.Action`.\n\n alias LibTmux.Pane\n\n Pane.send_keys(control, pane_ref, [\"Enter\", \"C-c\"])"},"source":{"file":"lib/libtmux/entities.ex","line":571,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-send_keys-4"},{"id":"LibTmux.Pane.send_keys!/4","publicId":"LibTmux.Pane.send_keys!/4","name":"send_keys!/4","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"send_keys!(connection, ref, keys, options \\\\ [])\n@spec send_keys!(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n [String.t()],\n [LibTmux.Action.option()]\n ) ::\n :ok","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"keys","type":"[String.t()]"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns `:ok` when `send_keys/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":593,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-send_keys-bang-4"},{"id":"LibTmux.Pane.capture/3","publicId":"LibTmux.Pane.capture/3","name":"capture/3","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"capture(connection, ref, options \\\\ [])\n@spec capture(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n [capture_option()]\n ) ::\n {:ok, LibTmux.Action.result(binary())}\n | {:error,\n LibTmux.Error.t()\n | LibTmux.Action.CompletionError.t()}","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[capture_option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(binary())} | {:error, LibTmux.Error.t() | LibTmux.Action.CompletionError.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Captures bounded screen bytes through explicit one-shot execution.","body":"Returns `{:ok, result}` with bytes as `value` after acknowledged completion\nand native retirement. Failed commands return\n`{:error, %LibTmux.Action.CompletionError{}}` with their original evidence.\nDefaults: visible lines 0 through `:last`, no line joining, 65536 stdout\nbytes, 65536 stderr bytes and 5000ms. `:last` is accepted only for `end_line`.\nNegative line numbers include history;\ntmux clamps the requested range to available lines. Output overflow is an\nerror, never a successful partial screen. This observes rendered screen\nstate, not the program's original output stream.\n\nA Control argument returns `unsupported_transport`: arbitrary screen bytes\nare not qualified for shared control framing. No fallback occurs.\n\n alias LibTmux.Pane\n\n Pane.capture(server, pane_ref, start_line: -100, max_bytes: 131_072)"},"source":{"file":"lib/libtmux/entities.ex","line":600,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-capture-3"},{"id":"LibTmux.Pane.capture!/3","publicId":"LibTmux.Pane.capture!/3","name":"capture!/3","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"capture!(connection, ref, options \\\\ [])\n@spec capture!(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n [capture_option()]\n ) :: binary()","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[capture_option()]","default":"[]"}],"returns":"binary()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns screen bytes when `capture/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":626,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-capture-bang-3"},{"id":"LibTmux.Pane.kill/3","publicId":"LibTmux.Pane.kill/3","name":"kill/3","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"kill(connection, ref, options \\\\ [])\n@spec kill(LibTmux.Server.t(), LibTmux.Ref.t(), [\n LibTmux.Action.option()\n ]) ::\n {:ok, LibTmux.Action.result(:ok)}\n | {:error, LibTmux.Action.error()}","params":[{"name":"connection","type":"LibTmux.Server.t()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Kills an exact pane through one-shot execution.","body":"Returns `{:ok, result}` on command completion. Optional `session: session_ref` requires the pane's window to belong to that exact session and `timeout` defaults to 5000ms. The reference is\nchecked against the answering server before dispatch, with the usual one-shot\ncheck/use race. A reference to something that is already gone returns\n`{:error, %LibTmux.Action.CompletionError{}}` with the original evidence.\nControl connections return `unsupported_transport` before any I/O: a\nconnection cannot kill what it is attached to. Observations you already hold\nkeep describing the pane.\n\n alias LibTmux.Pane\n\n Pane.kill(server, pane_ref)"},"source":{"file":"lib/libtmux/entities.ex","line":632,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-kill-3"},{"id":"LibTmux.Pane.kill!/3","publicId":"LibTmux.Pane.kill!/3","name":"kill!/3","namespace":"LibTmux.Pane","parent":"LibTmux.Pane","kind":"function","modifiers":[],"signatures":[{"raw":"kill!(connection, ref, options \\\\ [])\n@spec kill!(LibTmux.Server.t(), LibTmux.Ref.t(), [\n LibTmux.Action.option()\n ]) :: :ok","params":[{"name":"connection","type":"LibTmux.Server.t()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns `:ok` when `kill/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":652,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-pane-kill-bang-3"},{"id":"LibTmux.Protocol","publicId":"LibTmux.Protocol","name":"Protocol","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Assembles bounded control-mode replies and lexical notifications from bytes.","body":"Reply guards retain timestamp, command number and flags. Inside a block,\nnotification-looking output stays data. The parser cannot authenticate\ninjected matching guards: shared lanes must separately qualify commands,\nhooks and subscription expansion. Notification payloads need semantic\nvalidation before they can update a graph.\n\nA parse error retains already completed events in `error.details.events`.\nIts owner must retire the lane rather than reuse the rejected state."},"source":{"file":"lib/libtmux/protocol.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-protocol"},{"id":"LibTmux.Protocol.guard_id/0","publicId":"LibTmux.Protocol.guard_id/0","name":"guard_id/0","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type guard_id() ::\n {non_neg_integer(), non_neg_integer(),\n non_neg_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"guard_id() ::\n {non_neg_integer(), non_neg_integer(),\n non_neg_integer()}","doc":{"summary":"A complete tmux reply guard: timestamp, command number and flags, retained for correlation."},"source":{"file":"lib/libtmux/protocol.ex","line":53,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-protocol-guard_id-0"},{"id":"LibTmux.Protocol.event/0","publicId":"LibTmux.Protocol.event/0","name":"event/0","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type event() ::\n {:reply, :ok | :error, guard_id(), [binary()]}\n | {:notification, atom(), binary()}\n | {:unknown, binary()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"event() ::\n {:reply, :ok | :error, guard_id(), [binary()]}\n | {:notification, atom(), binary()}\n | {:unknown, binary()}","doc":{"summary":"A framed reply or lexical notification. Payloads still require semantic validation before graph updates."},"source":{"file":"lib/libtmux/protocol.ex","line":55,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-protocol-event-0"},{"id":"LibTmux.Protocol.t/0","publicId":"LibTmux.Protocol.t/0","name":"t/0","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Immutable parser carry and bounded in-flight frame state; discard it after any parse error."},"source":{"file":"lib/libtmux/protocol.ex","line":60,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-protocol-t-0"},{"id":"LibTmux.Protocol.option/0","publicId":"LibTmux.Protocol.option/0","name":"option/0","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:max_chunk_bytes\n | :max_line_bytes\n | :max_frame_bytes\n | :max_frame_lines\n | :max_events, pos_integer()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:max_chunk_bytes\n | :max_line_bytes\n | :max_frame_bytes\n | :max_frame_lines\n | :max_events, pos_integer()}","doc":{"summary":"A positive parser ceiling, measured in bytes, lines or emitted events as named."},"source":{"file":"lib/libtmux/protocol.ex","line":62,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-protocol-option-0"},{"id":"LibTmux.Protocol.new/1","publicId":"LibTmux.Protocol.new/1","name":"new/1","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"function","modifiers":[],"signatures":[{"raw":"new(options \\\\ [])\n@spec new([option()]) :: t()","params":[{"name":"options","type":"[option()]","default":"[]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs a parser with positive byte, line and event limits.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/protocol.ex","line":67,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-protocol-new-1"},{"id":"LibTmux.Protocol.feed/2","publicId":"LibTmux.Protocol.feed/2","name":"feed/2","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"function","modifiers":[],"signatures":[{"raw":"feed(state, chunk)\n@spec feed(t(), binary()) ::\n {:ok, [event()], t()} | {:error, LibTmux.Error.t()}","params":[{"name":"state","type":"t()"},{"name":"chunk","type":"binary()"}],"returns":"{:ok, [event()], t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Consumes one byte chunk without performing I/O.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/protocol.ex","line":84,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-protocol-feed-2"},{"id":"LibTmux.Protocol.finish/1","publicId":"LibTmux.Protocol.finish/1","name":"finish/1","namespace":"LibTmux.Protocol","parent":"LibTmux.Protocol","kind":"function","modifiers":[],"signatures":[{"raw":"finish(protocol)\n@spec finish(t()) :: :ok | {:error, LibTmux.Error.t()}","params":[{"name":"protocol","type":"t()"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Rejects a stream ending inside a line or reply block.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/protocol.ex","line":98,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-protocol-finish-1"},{"id":"LibTmux.Ref","publicId":"LibTmux.Ref","name":"Ref","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An exact observed target bound to one server instance.","body":"A window-link ID is its observed `{session_id, index, window_id}` binding,\nnot a unique lifetime identifier. Validation detects known stale instances;\nit does not reserve an object or close a one-shot check/use race."},"source":{"file":"lib/libtmux/ref.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref"},{"id":"LibTmux.Ref.entity","publicId":"LibTmux.Ref.entity","name":"entity","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"entity()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/ref.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-entity"},{"id":"LibTmux.Ref.id","publicId":"LibTmux.Ref.id","name":"id","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"id()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/ref.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-id"},{"id":"LibTmux.Ref.server_instance","publicId":"LibTmux.Ref.server_instance","name":"server_instance","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/ref.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-server_instance"},{"id":"LibTmux.Ref.entity/0","publicId":"LibTmux.Ref.entity/0","name":"entity/0","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity() ::\n :session | :window | :pane | :window_link | :client","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity() ::\n :session | :window | :pane | :window_link | :client","doc":{"summary":"The target kind; physical windows and session-relative links have different identities."},"source":{"file":"lib/libtmux/ref.ex","line":15,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-entity-0"},{"id":"LibTmux.Ref.id/0","publicId":"LibTmux.Ref.id/0","name":"id/0","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type id() ::\n String.t()\n | {String.t(), non_neg_integer(), String.t()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"id() ::\n String.t()\n | {String.t(), non_neg_integer(), String.t()}","doc":{"summary":"A native ID or observed session/index/window link binding; neither reserves an object's lifetime."},"source":{"file":"lib/libtmux/ref.ex","line":17,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-id-0"},{"id":"LibTmux.Ref.t/0","publicId":"LibTmux.Ref.t/0","name":"t/0","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Ref{\n entity: entity(),\n id: id(),\n server_instance: String.t()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Ref{\n entity: entity(),\n id: id(),\n server_instance: String.t()\n }","doc":{"summary":"An exact observed identity bound to a tmux server incarnation, separate from a connection epoch."},"source":{"file":"lib/libtmux/ref.ex","line":19,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-t-0"},{"id":"LibTmux.Ref.new/3","publicId":"LibTmux.Ref.new/3","name":"new/3","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"function","modifiers":[],"signatures":[{"raw":"new(entity, id, instance)\n@spec new(entity(), id(), String.t()) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"entity","type":"entity()"},{"name":"id","type":"id()"},{"name":"instance","type":"String.t()"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Validates a native identity and binds it to a nonempty instance token.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/ref.ex","line":22,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-new-3"},{"id":"LibTmux.Ref.from_observation/1","publicId":"LibTmux.Ref.from_observation/1","name":"from_observation/1","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"function","modifiers":[],"signatures":[{"raw":"from_observation(arg1)\n@spec from_observation(LibTmux.Schema.observation()) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"arg1","type":"LibTmux.Schema.observation()"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Builds a reference from an observation's own identity and server instance.","body":"Validates the identity with `new/3` without I/O or a fresh observation.\nMalformed identities and other inputs return an `:invalid_target` error.\nOther captured fields may remain unloaded or unavailable. A reference does\nnot prove that its target still exists. Window links retain their tuple\nbinding and lifetime limitation; domain actions reject window-link refs.","examples":[{"lang":"elixir","code":"iex> pane = %LibTmux.Pane{id: \"%7\", server_instance: \"instance-a\"}\niex> {:ok, ref} = LibTmux.Ref.from_observation(pane)\niex> {ref.entity, ref.id, ref.server_instance}\n{:pane, \"%7\", \"instance-a\"}"}]},"source":{"file":"lib/libtmux/ref.ex","line":36,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-from_observation-1"},{"id":"LibTmux.Ref.validate/2","publicId":"LibTmux.Ref.validate/2","name":"validate/2","namespace":"LibTmux.Ref","parent":"LibTmux.Ref","kind":"function","modifiers":[],"signatures":[{"raw":"validate(ref, instance)\n@spec validate(t(), String.t()) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"ref","type":"t()"},{"name":"instance","type":"String.t()"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Rejects malformed references and known server-instance mismatches.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/ref.ex","line":71,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-ref-validate-2"},{"id":"LibTmux.Schema","publicId":"LibTmux.Schema","name":"Schema","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Defines observed fields, wire names and graph relations.","body":"The table is a semantic overlay on tmux 3.3 format variables. It drives\nobservation validation, portable filtering and reference generation. Empty text\nremains text; only explicitly nullable fields admit `nil`."},"source":{"file":"lib/libtmux/schema.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema"},{"id":"LibTmux.Schema.entity/0","publicId":"LibTmux.Schema.entity/0","name":"entity/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity() ::\n :session | :window | :window_link | :pane | :client","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity() ::\n :session | :window | :window_link | :pane | :client","doc":{"summary":"An entity's canonical local name. Physical windows and membership links are distinct."},"source":{"file":"lib/libtmux/schema.ex","line":10,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-entity-0"},{"id":"LibTmux.Schema.entity_module/0","publicId":"LibTmux.Schema.entity_module/0","name":"entity_module/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity_module() ::\n LibTmux.Session\n | LibTmux.Window\n | LibTmux.WindowLink\n | LibTmux.Pane\n | LibTmux.Client","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity_module() ::\n LibTmux.Session\n | LibTmux.Window\n | LibTmux.WindowLink\n | LibTmux.Pane\n | LibTmux.Client","doc":{"summary":"The observation struct modules accepted alongside canonical entity names."},"source":{"file":"lib/libtmux/schema.ex","line":13,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-entity_module-0"},{"id":"LibTmux.Schema.entity_selector/0","publicId":"LibTmux.Schema.entity_selector/0","name":"entity_selector/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity_selector() :: entity() | entity_module()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity_selector() :: entity() | entity_module()","doc":{"summary":"A canonical entity atom or its corresponding observation module."},"source":{"file":"lib/libtmux/schema.ex","line":17,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-entity_selector-0"},{"id":"LibTmux.Schema.observed/1","publicId":"LibTmux.Schema.observed/1","name":"observed/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type observed(value) :: value | :unloaded | :unavailable","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","typeParams":["value"],"type":"observed(value) :: value | :unloaded | :unavailable","doc":{"summary":"A known value, unloaded coverage, or an unavailable capability; nil belongs to the value type."},"source":{"file":"lib/libtmux/schema.ex","line":20,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-observed-1"},{"id":"LibTmux.Schema.observation/0","publicId":"LibTmux.Schema.observation/0","name":"observation/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type observation() ::\n LibTmux.Session.t()\n | LibTmux.Window.t()\n | LibTmux.WindowLink.t()\n | LibTmux.Pane.t()\n | LibTmux.Client.t()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"observation() ::\n LibTmux.Session.t()\n | LibTmux.Window.t()\n | LibTmux.WindowLink.t()\n | LibTmux.Pane.t()\n | LibTmux.Client.t()","doc":{"summary":"One physical or contextual observation from a captured graph."},"source":{"file":"lib/libtmux/schema.ex","line":23,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-observation-0"},{"id":"LibTmux.Schema.value_type/0","publicId":"LibTmux.Schema.value_type/0","name":"value_type/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type value_type() ::\n :string\n | :integer\n | :nullable_integer\n | :boolean\n | {:id, entity()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"value_type() ::\n :string\n | :integer\n | :nullable_integer\n | :boolean\n | {:id, entity()}","doc":{"summary":"A field's validation category; integer fields use the schema's nonnegative 32-bit range."},"source":{"file":"lib/libtmux/schema.ex","line":31,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-value_type-0"},{"id":"LibTmux.Schema.field/0","publicId":"LibTmux.Schema.field/0","name":"field/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type field() :: %{\n name: atom(),\n wire: String.t(),\n format: String.t() | nil,\n type: value_type(),\n since: String.t(),\n nullable: boolean()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"field() :: %{\n name: atom(),\n wire: String.t(),\n format: String.t() | nil,\n type: value_type(),\n since: String.t(),\n nullable: boolean()\n }","doc":{"summary":"Field metadata shared by validation and documentation; nil format identifies a derived field."},"source":{"file":"lib/libtmux/schema.ex","line":33,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-field-0"},{"id":"LibTmux.Schema.relation/0","publicId":"LibTmux.Schema.relation/0","name":"relation/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type relation() :: {:one | :many, entity()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"relation() :: {:one | :many, entity()}","doc":{"summary":"The cardinality and target entity of one indexed graph relation."},"source":{"file":"lib/libtmux/schema.ex","line":42,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-relation-0"},{"id":"LibTmux.Schema.operator/0","publicId":"LibTmux.Schema.operator/0","name":"operator/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type operator() ::\n :equals\n | :not\n | :in\n | :not_in\n | :lt\n | :lte\n | :gt\n | :gte\n | :contains\n | :starts_with\n | :ends_with","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"operator() ::\n :equals\n | :not\n | :in\n | :not_in\n | :lt\n | :lte\n | :gt\n | :gte\n | :contains\n | :starts_with\n | :ends_with","doc":{"summary":"A scalar filter operator; each field category permits only its applicable subset."},"source":{"file":"lib/libtmux/schema.ex","line":44,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-operator-0"},{"id":"LibTmux.Schema.entities/0","publicId":"LibTmux.Schema.entities/0","name":"entities/0","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"entities()\n@spec entities() :: [entity()]","params":[],"returns":"[entity()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns supported entity names in a stable order.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/schema.ex","line":139,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-entities-0"},{"id":"LibTmux.Schema.module/1","publicId":"LibTmux.Schema.module/1","name":"module/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"module(entity)\n@spec module(entity()) :: entity_module()","params":[{"name":"entity","type":"entity()"}],"returns":"entity_module()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the ordinary observation struct module for an entity.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/schema.ex","line":147,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-module-1"},{"id":"LibTmux.Schema.entity/1","publicId":"LibTmux.Schema.entity/1","name":"entity/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"entity(entity)\n@spec entity(entity_selector()) :: entity()","params":[{"name":"entity","type":"entity_selector()"}],"returns":"entity()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Resolves an entity atom or its observation module.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/schema.ex","line":155,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-entity-1"},{"id":"LibTmux.Schema.fields/1","publicId":"LibTmux.Schema.fields/1","name":"fields/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"fields(entity)\n@spec fields(entity_selector()) :: %{\n required(atom()) => field()\n }","params":[{"name":"entity","type":"entity_selector()"}],"returns":"%{required(atom()) => field()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the whitelisted field metadata for an entity.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/schema.ex","line":168,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-fields-1"},{"id":"LibTmux.Schema.field/2","publicId":"LibTmux.Schema.field/2","name":"field/2","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"field(entity, name)\n@spec field(entity_selector(), atom()) :: field() | nil","params":[{"name":"entity","type":"entity_selector()"},{"name":"name","type":"atom()"}],"returns":"field() | nil"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns field metadata, or nil for a field outside the schema.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/schema.ex","line":188,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-field-2"},{"id":"LibTmux.Schema.relations/1","publicId":"LibTmux.Schema.relations/1","name":"relations/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"relations(entity)\n@spec relations(entity_selector()) :: %{\n required(atom()) => relation()\n }","params":[{"name":"entity","type":"entity_selector()"}],"returns":"%{required(atom()) => relation()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns each relation's cardinality and target entity.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/schema.ex","line":196,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-relations-1"},{"id":"LibTmux.Schema.relation_wire/1","publicId":"LibTmux.Schema.relation_wire/1","name":"relation_wire/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"relation_wire(name)\n@spec relation_wire(atom()) :: String.t()","params":[{"name":"name","type":"atom()"}],"returns":"String.t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a relation's explicit stable wire name.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/schema.ex","line":204,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-relation_wire-1"},{"id":"LibTmux.Schema.operators/1","publicId":"LibTmux.Schema.operators/1","name":"operators/1","namespace":"LibTmux.Schema","parent":"LibTmux.Schema","kind":"function","modifiers":[],"signatures":[{"raw":"operators(map)\n@spec operators(field()) :: [operator()]","params":[{"name":"map","type":"field()"}],"returns":"[operator()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the portable operators allowed by a scalar field's value category.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/schema.ex","line":212,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-schema-operators-1"},{"id":"LibTmux.Selection","publicId":"LibTmux.Selection","name":"Selection","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An ordered, materialized Enumerable over one captured entity type.","body":"Enumeration never refreshes or performs I/O. `where/2` accepts predicate\ndata; `filter/2` accepts unary Elixir functions with Enum truthiness.\nHolding a selection retains its snapshot graph. `Enum.to_list/1` projects\nordinary values when graph context is no longer needed."},"source":{"file":"lib/libtmux/selection.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection"},{"id":"LibTmux.Selection.t/1","publicId":"LibTmux.Selection.t/1","name":"t/1","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque t(item)","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","typeParams":["item"],"doc":{"summary":"An ordered selection retaining items of one observation type and their originating snapshot."},"source":{"file":"lib/libtmux/selection.ex","line":15,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-t-1"},{"id":"LibTmux.Selection.t/0","publicId":"LibTmux.Selection.t/0","name":"t/0","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: t(LibTmux.Schema.observation())","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: t(LibTmux.Schema.observation())","doc":{"summary":"A selection without a concrete observation type; use `t:t/1` to preserve item types."},"source":{"file":"lib/libtmux/selection.ex","line":22,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-t-0"},{"id":"LibTmux.Selection.new/2","publicId":"LibTmux.Selection.new/2","name":"new/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":["overload"],"signatures":[{"raw":"new(snapshot, entity)\n@spec new(\n LibTmux.Snapshot.t(),\n :session | LibTmux.Session\n ) :: t(LibTmux.Session.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":session | LibTmux.Session"}],"returns":"t(LibTmux.Session.t())"},{"raw":"new(snapshot, entity)\n@spec new(LibTmux.Snapshot.t(), :window | LibTmux.Window) ::\n t(LibTmux.Window.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":window | LibTmux.Window"}],"returns":"t(LibTmux.Window.t())"},{"raw":"new(snapshot, entity)\n@spec new(LibTmux.Snapshot.t(), :pane | LibTmux.Pane) ::\n t(LibTmux.Pane.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":pane | LibTmux.Pane"}],"returns":"t(LibTmux.Pane.t())"},{"raw":"new(snapshot, entity)\n@spec new(\n LibTmux.Snapshot.t(),\n :window_link | LibTmux.WindowLink\n ) :: t(LibTmux.WindowLink.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":window_link | LibTmux.WindowLink"}],"returns":"t(LibTmux.WindowLink.t())"},{"raw":"new(snapshot, entity)\n@spec new(LibTmux.Snapshot.t(), :client | LibTmux.Client) ::\n t(LibTmux.Client.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"entity","type":":client | LibTmux.Client"}],"returns":"t(LibTmux.Client.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Materializes the observed items of an entity without I/O.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/selection.ex","line":25,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-new-2"},{"id":"LibTmux.Selection.size/1","publicId":"LibTmux.Selection.size/1","name":"size/1","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"size(selection)\n@spec size(t()) :: non_neg_integer()","params":[{"name":"selection","type":"t()"}],"returns":"non_neg_integer()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns cached materialized size in constant time.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/selection.ex","line":47,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-size-1"},{"id":"LibTmux.Selection.where/2","publicId":"LibTmux.Selection.where/2","name":"where/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"where(selection, criteria)\n@spec where(t(item), LibTmux.Filter.input()) :: t(item)\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()"}],"returns":"t(item)","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Filters validated data while retaining order and captured graph context.","examples":[{"lang":"elixir","code":"iex> alias LibTmux.{Selection, Snapshot}\niex> rows = %{window: [%{id: \"@0\"}, %{id: \"@1\"}], pane: [\n...> %{id: \"%0\", window_id: \"@0\", active: true, current_command: \"bash\"},\n...> %{id: \"%1\", window_id: \"@0\", active: false, current_command: \"nvim\"},\n...> %{id: \"%2\", window_id: \"@1\", active: true, current_command: \"nvim\"}]}\niex> {:ok, snapshot} = Snapshot.new(rows,\n...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n...> complete: [:pane], fields: %{pane: [:window_id, :active, :current_command]})\niex> snapshot |> Snapshot.windows()\n...> |> Selection.where(panes: [some: [active: true, current_command: \"nvim\"]])\n...> |> Enum.map(& &1.id)\n[\"@1\"]","intro":"One pane must satisfy both conditions inside `some`. Window `@0` has an active shell and an inactive editor; only `@1` has an active editor. See [filtering](filtering.html#predicate-grammar) for the complete semantics."}]},"source":{"file":"lib/libtmux/selection.ex","line":55,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-where-2"},{"id":"LibTmux.Selection.filter/2","publicId":"LibTmux.Selection.filter/2","name":"filter/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"filter(selection, predicate)\n@spec filter(t(item), (item -> as_boolean(term()))) ::\n t(item)\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"predicate","type":"(item -> as_boolean(term()))"}],"returns":"t(item)","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Filters with a unary local function; normal predicate exceptions propagate.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/selection.ex","line":82,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-filter-2"},{"id":"LibTmux.Selection.member_id?/2","publicId":"LibTmux.Selection.member_id?/2","name":"member_id?/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"member_id?(selection, id)\n@spec member_id?(t(), LibTmux.Ref.id()) :: boolean()","params":[{"name":"selection","type":"t()"},{"name":"id","type":"LibTmux.Ref.id()"}],"returns":"boolean()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Checks native identity separately from Enumerable element membership.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/selection.ex","line":97,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-member_id-question-2"},{"id":"LibTmux.Selection.one/2","publicId":"LibTmux.Selection.one/2","name":"one/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"one(selection, criteria \\\\ [])\n@spec one(t(item), LibTmux.Filter.input()) ::\n {:ok, item} | {:error, LibTmux.Error.t()}\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"{:ok, item} | {:error, LibTmux.Error.t()}","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns exactly one match, or a structured cardinality error; stops at the second match.","examples":[{"lang":"elixir","code":"iex> alias LibTmux.{Selection, Snapshot}\niex> {:ok, snapshot} = Snapshot.new(%{pane: [%{id: \"%0\"}, %{id: \"%1\"}]},\n...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n...> fields: %{pane: [:id]})\niex> panes = Snapshot.panes(snapshot)\niex> {:ok, pane} = Selection.one(panes, id: \"%1\")\niex> pane.id\n\"%1\"\niex> {:error, error} = Selection.one(panes, id: \"%9\")\niex> error.kind\n:no_match\niex> {:error, error} = Selection.one(panes)\niex> error.kind\n:multiple_matches"}]},"source":{"file":"lib/libtmux/selection.ex","line":105,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-one-2"},{"id":"LibTmux.Selection.one!/2","publicId":"LibTmux.Selection.one!/2","name":"one!/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"one!(selection, criteria \\\\ [])\n@spec one!(t(item), LibTmux.Filter.input()) :: item\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"item","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns exactly one match or raises its cardinality error.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/selection.ex","line":129,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-one-bang-2"},{"id":"LibTmux.Selection.one_or_nil/2","publicId":"LibTmux.Selection.one_or_nil/2","name":"one_or_nil/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"one_or_nil(selection, criteria \\\\ [])\n@spec one_or_nil(t(item), LibTmux.Filter.input()) ::\n {:ok, item | nil} | {:error, LibTmux.Error.t()}\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"{:ok, item | nil} | {:error, LibTmux.Error.t()}","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns one match or nil; a second match remains an error.","examples":[{"lang":"elixir","code":"iex> alias LibTmux.{Selection, Snapshot}\niex> {:ok, snapshot} = Snapshot.new(%{pane: [%{id: \"%0\"}, %{id: \"%1\"}]},\n...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n...> fields: %{pane: [:id]})\niex> panes = Snapshot.panes(snapshot)\niex> Selection.one_or_nil(panes, id: \"%9\")\n{:ok, nil}\niex> {:ok, pane} = Selection.one_or_nil(panes, id: \"%0\")\niex> pane.id\n\"%0\"\niex> {:error, error} = Selection.one_or_nil(panes)\niex> error.kind\n:multiple_matches"}]},"source":{"file":"lib/libtmux/selection.ex","line":137,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-one_or_nil-2"},{"id":"LibTmux.Selection.one_or_nil!/2","publicId":"LibTmux.Selection.one_or_nil!/2","name":"one_or_nil!/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"one_or_nil!(selection, criteria \\\\ [])\n@spec one_or_nil!(t(item), LibTmux.Filter.input()) ::\n item | nil\n when item: LibTmux.Schema.observation()","params":[{"name":"selection","type":"t(item)"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"item | nil","typeParams":["item: LibTmux.Schema.observation()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns one match or nil, raising on multiple matches.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/selection.ex","line":160,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-one_or_nil-bang-2"},{"id":"LibTmux.Selection.exists?/2","publicId":"LibTmux.Selection.exists?/2","name":"exists?/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"exists?(selection, criteria \\\\ [])\n@spec exists?(t(), LibTmux.Filter.input()) :: boolean()","params":[{"name":"selection","type":"t()"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"boolean()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns true on the first matching observed item.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/selection.ex","line":168,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-exists-question-2"},{"id":"LibTmux.Selection.count/2","publicId":"LibTmux.Selection.count/2","name":"count/2","namespace":"LibTmux.Selection","parent":"LibTmux.Selection","kind":"function","modifiers":[],"signatures":[{"raw":"count(selection, criteria \\\\ [])\n@spec count(t(), LibTmux.Filter.input()) ::\n non_neg_integer()","params":[{"name":"selection","type":"t()"},{"name":"criteria","type":"LibTmux.Filter.input()","default":"[]"}],"returns":"non_neg_integer()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Counts observed matching items; use size/1 for cached unfiltered size.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/selection.ex","line":177,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-selection-count-2"},{"id":"LibTmux.Server","publicId":"LibTmux.Server","name":"Server","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Describes a local tmux server for capturing state and running commands.","body":"`new/1` takes an absolute `:executable` path. Use\n`System.find_executable/1` to resolve a name such as `\"tmux\"` through PATH\nbefore construction. The optional `:cwd` and `:env` default to the caller's\nworking directory and environment. Construction validates the path forms\nwithout checking that the executable or socket exists. A Server is an\nimmutable value; constructing one with `new/1` neither connects to tmux nor\nstarts it. Commands use `-N`, so a missing daemon is never started\nimplicitly. `start/1` and `with_owned/2` start a private server and return\na Server that `stop/2` can retire.\n\n## Choosing the server\n\n`new/1` picks the socket in this order, and the first rule that applies\nwins:\n\n1. `:socket`, an absolute socket path, passes `-S`.\n2. `:socket_name`, a socket name, passes `-L`. Pass at most one of\n `:socket` and `:socket_name`.\n3. The `LIBTMUX_SOCKET_PATH` variable passes `-S` with its path.\n4. The `LIBTMUX_SOCKET` variable passes `-L` with its name.\n5. Otherwise no socket is passed, and tmux chooses. It follows the server\n that `TMUX` names when `:env` has one, and otherwise uses its default\n socket: `default` in the `tmux-UID` directory of `TMUX_TMPDIR`, or of\n `/tmp`.\n\nAn explicit option ignores both variables, even an invalid one. When both\nvariables are set, the path wins, as `-S` does over `-L` in tmux. A variable\nthat is empty counts as unset, each one alone. The variables come from the\n`:env` option, which defaults to the caller's environment, so a Server built\nwith its own `:env` ignores the caller's variables. A set variable with an\ninvalid value raises `ArgumentError` that names the variable and never\nrepeats its value.\n\nThe choice is made once, in `new/1`, and `t:t/0` records it. A Server that\nchose a socket removes `TMUX` and `TMUX_PANE` from the environment it gives\ntmux, so a surrounding tmux session cannot redirect it. A Server that chose\nnone keeps both, for one-shot execution and for control connections alike,\nso a program run inside tmux reaches the server it runs in. Leave `TMUX` out\nof `:env` to send a Server with no socket to tmux's default socket instead.\n\n## What is on here\n\nServer describes the endpoint. In Elixir, observation, selection and action\nfunctions live in their own modules. Start with these groups:\n\n**Connecting.** Describe the server for one-shot commands, which do not attach\na client. Attach a control client to an existing session for the length of a\ncallback; the client closes afterwards. Run a control client under application\nsupervision. See the [managed control guide](managed-control.html) for\nconnection setup and the host's hook and command-alias requirements.\n\n- Describe: `new/1`\n- Attach for a callback: `LibTmux.Control.with_connection/2`\n- Supervise: `LibTmux.Control.start_link/1`, `LibTmux.Control.child_spec/1`\n\n**Owning a private server.** Start a tmux server in a private directory,\nwith no inherited `TMUX` or `TMUX_PANE`, and stop it when you are done.\n`with_owned/2` does both around a function, so a program needs no shell step\nto start or clean up tmux. The process that starts the server owns it, and the\nserver stops when that process exits. `stop/2` refuses a Server that\n`start/1` did not create; `kill/2` sends `kill-server` to any Server.\n\n- Start and stop around a function: `with_owned/2`\n- Start: `start/1`\n- Stop: `stop/2`\n- Kill any server: `kill/2`\n- Raise on failure: `kill!/2`\n\n**Finding one thing.** Capture a snapshot, then require one match or allow no\nmatch. Both reject multiple matches. Turn the chosen observation into a\nreference tied to the daemon that supplied it, ready for an action.\n\n- Capture: `snapshot/2`\n- Require one: `LibTmux.Selection.one/2`\n- Allow none: `LibTmux.Selection.one_or_nil/2`\n- Reference: `LibTmux.Ref.from_observation/1`\n\n**Listing everything.** Capture sessions, physical windows, window links, panes\nand attached clients as a `LibTmux.Snapshot`. One accessor per kind returns a\nselection from that captured graph without contacting tmux again. Capture\nfailures return an error, not an empty server. Capture covers an interval\nrather than an atomic transaction; take another snapshot when fresh state is\nneeded.\n\n- Capture: `snapshot/2`\n- Select: `LibTmux.Snapshot.sessions/1`, `LibTmux.Snapshot.windows/1`,\n `LibTmux.Snapshot.window_links/1`, `LibTmux.Snapshot.panes/1`,\n `LibTmux.Snapshot.clients/1`\n\n**Querying things and getting around.** Select by criteria such as\n`active: true`, or by an Elixir function; selections work with `Enum` and\n`Stream`. Navigation functions use the supplied snapshot. Plural helpers return\nselections for further filtering; a `LibTmux.WindowLink` preserves a window's\nmembership in one session.\n\n- By criteria: `LibTmux.Selection.where/2`\n- By function: `LibTmux.Selection.filter/2`\n- Down: `LibTmux.Session.windows/2`, `LibTmux.Session.panes/2`,\n `LibTmux.Window.panes/2`\n- Focused: `LibTmux.Session.active_window/2`\n- Other relationships: `LibTmux.Snapshot.related/4`\n\n**Changing things.** Create detached sessions and windows on an existing server\nusing one-shot execution. Each returns the created ID with `ref: nil`; capture\na fresh observation to obtain a reference. Split a pane to create a pane and\nget its ID in the completed result. A qualified Control connection also\nsupplies a bound reference; one-shot split returns `ref: nil`. Rename a session\nor a window. Send literal bytes or named keys such as `\"Enter\"` to a pane.\nSplit, rename and input take a Server or Control connection followed by a\nreference. Domain bang variants return completed values or raise; nonbang\nvariants return `{:ok, result}` for completed commands and `{:error, error}`\notherwise. See the [action guide](one-shot-actions.html) and\n[recovery guide](recovery.html).\n\n- Create: `new_session/3`, `LibTmux.Session.new_window/4`\n- Split: `LibTmux.Pane.split/3`\n- Rename: `LibTmux.Session.rename/4`, `LibTmux.Window.rename/4`\n- Send literal bytes: `LibTmux.Pane.send_text/4`\n- Send named keys: `LibTmux.Pane.send_keys/4`\n\n**Reading screens, options and formats.** Capture pane screen bytes through\none-shot execution, which requires a Server. On a control connection, execute a\nrequest that reads a field or writes a server user option. Submit the request\nand keep the returned `LibTmux.Operation` when the result needs to remain\navailable for independent inspection.\n\n- Screen: `LibTmux.Pane.capture/3`\n- Execute: `LibTmux.Control.execute/3`\n- Read a field: `LibTmux.Control.Request.field/2`\n- Write a user option: `LibTmux.Control.Request.set_user_option/2`\n- Submit: `LibTmux.Control.submit/3`\n\n**Running any other command.** Build a command to run any other tmux command.\nRunning executes one command with literal arguments and returns bounded output\nand exit evidence. Configured server hooks can still run. Targeted one-shot\nactions check the observed server identity before writing, leaving a race if\nthe daemon is replaced between that check and the command. Use a qualified\nControl connection for mutations bound to one daemon instance.\n\n- Build: `LibTmux.Command.new/2`\n- Run: `run/3`"},"source":{"file":"lib/libtmux/server.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server"},{"id":"LibTmux.Server.executable","publicId":"LibTmux.Server.executable","name":"executable","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-executable"},{"id":"LibTmux.Server.socket","publicId":"LibTmux.Server.socket","name":"socket","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t() | nil","value":"nil","source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-socket"},{"id":"LibTmux.Server.socket_name","publicId":"LibTmux.Server.socket_name","name":"socket_name","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t() | nil","value":"nil","source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-socket_name"},{"id":"LibTmux.Server.cwd","publicId":"LibTmux.Server.cwd","name":"cwd","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-cwd"},{"id":"LibTmux.Server.env","publicId":"LibTmux.Server.env","name":"env","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(binary()) => binary()}","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-env"},{"id":"LibTmux.Server.daemon","publicId":"LibTmux.Server.daemon","name":"daemon","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"pid() | nil","value":"nil","source":{"file":"lib/libtmux/server.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-daemon"},{"id":"LibTmux.Server.t/0","publicId":"LibTmux.Server.t/0","name":"t/0","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Server{\n cwd: String.t(),\n daemon: pid() | nil,\n env: %{optional(binary()) => binary()},\n executable: String.t(),\n socket: String.t() | nil,\n socket_name: String.t() | nil\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Server{\n cwd: String.t(),\n daemon: pid() | nil,\n env: %{optional(binary()) => binary()},\n executable: String.t(),\n socket: String.t() | nil,\n socket_name: String.t() | nil\n }","doc":{"summary":"A local server descriptor; constructing it neither connects nor reserves server identity.","body":"At most one of `:socket` and `:socket_name` is set. Both are `nil` when tmux\nchooses its default socket. `daemon` names the process that owns a server\ncreated by `start/1`, and is `nil` for every other Server."},"source":{"file":"lib/libtmux/server.ex","line":204,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-t-0"},{"id":"LibTmux.Server.option/0","publicId":"LibTmux.Server.option/0","name":"option/0","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:executable | :socket | :socket_name | :cwd,\n String.t()}\n | {:env, %{optional(binary()) => binary()}}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:executable | :socket | :socket_name | :cwd,\n String.t()}\n | {:env, %{optional(binary()) => binary()}}","doc":{"summary":"Descriptor inputs.","body":"The executable, `:socket` and cwd are absolute NUL-free paths. `:socket_name`\nis a single file name without a slash or NUL that is not `.` or `..`."},"source":{"file":"lib/libtmux/server.ex","line":219,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-option-0"},{"id":"LibTmux.Server.new/1","publicId":"LibTmux.Server.new/1","name":"new/1","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"new(options)\n@spec new([option()]) :: t()","params":[{"name":"options","type":"[option()]"}],"returns":"t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Constructs a descriptor for an existing server without connecting or creating it.","body":"`:socket` selects the socket by path and `:socket_name` by name; pass at most\none. With neither, the descriptor reads `LIBTMUX_SOCKET_PATH`, then\n`LIBTMUX_SOCKET`, from `:env`, and selects no socket when neither is set, so\ntmux uses its default. See \"Choosing the server\" in the module\ndocumentation. Raises `ArgumentError` for conflicting or invalid input,\nnaming a variable but never its value.\n\nSee the [worked example](first-task.html)."},"source":{"file":"lib/libtmux/server.ex","line":229,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-new-1"},{"id":"LibTmux.Server.start_option/0","publicId":"LibTmux.Server.start_option/0","name":"start_option/0","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type start_option() ::\n {:executable, String.t()}\n | {:root, String.t()}\n | {:config_file, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:timeout, 1..600_000}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"start_option() ::\n {:executable, String.t()}\n | {:root, String.t()}\n | {:config_file, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:timeout, 1..600_000}","doc":{"summary":"Inputs for `start/1`.","body":"`:executable` is required. `:root` is the directory that holds the private\ndirectory and defaults to `System.tmp_dir!/0`. `:config_file` defaults to\n`\"/dev/null\"`. `:env` overlays the daemon's environment; `TMUX` and\n`TMUX_PANE` never reach it. `:timeout` bounds startup, in milliseconds."},"source":{"file":"lib/libtmux/server.ex","line":312,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-start_option-0"},{"id":"LibTmux.Server.start/1","publicId":"LibTmux.Server.start/1","name":"start/1","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"start(options)\n@spec start([start_option()]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"options","type":"[start_option()]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Starts a private tmux server and returns a Server for it.","body":"The server runs in the foreground under libtmux's native helper, in a\ndirectory of its own below `:root`: the directory has mode 700, holds the\nsocket and is `TMUX_TMPDIR` for the daemon and its panes. The daemon never\ninherits `TMUX` or `TMUX_PANE`, reads `:config_file` (an empty file by\ndefault), and stays up with no session. `start/1` returns when the socket\nanswers, or when `:timeout` (5000 ms by default) ends.\n\nThe process that calls `start/1` owns the server. When it exits, the daemon\nstops and its directory is removed. If the VM is killed, the native helper\nstill retires the daemon, but the directory stays. Other processes may use\nthe returned Server. Stop it with `stop/2` as soon as the work is done, or\nuse `with_owned/2`.\n\nReturns `{:error, error}` for an invalid option, a socket path that would\nexceed the 107 usable bytes of `sun_path`, a daemon that cannot start or\nexits before it answers, and a timeout. A failed start leaves no directory\nbehind. It starts only on Linux, like the rest of libtmux.\n\n alias LibTmux.Server\n\n {:ok, server} = Server.start(executable: System.find_executable(\"tmux\"))\n {:ok, _} = Server.new_session(server, \"demo\", command: {:argv, [\"/bin/cat\"]})\n :ok = Server.stop(server)"},"source":{"file":"lib/libtmux/server.ex","line":327,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-start-1"},{"id":"LibTmux.Server.stop/2","publicId":"LibTmux.Server.stop/2","name":"stop/2","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"stop(server, options \\\\ [])\n@spec stop(t(), [{:timeout, 1..600_000}]) ::\n :ok | {:error, LibTmux.Error.t()}","params":[{"name":"server","type":"t()"},{"name":"options","type":"[{:timeout, 1..600_000}]","default":"[]"}],"returns":":ok | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Stops a server that `start/1` created and removes its directory.","body":"Sends `kill-server`, waits until the native helper proves that the daemon\nhas exited, and removes the directory. Stopping a server\nthat already stopped returns `:ok`. If the daemon still answers when\n`:timeout` (5000 ms by default) ends, or the directory cannot be removed,\nit returns `{:error, error}` and keeps the directory; call it again to\nretry.\n\nReturns `{:error, error}` with kind `:not_owned` for a Server that `new/1`\nbuilt or that another process started and already stopped."},"source":{"file":"lib/libtmux/server.ex","line":357,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-stop-2"},{"id":"LibTmux.Server.with_owned/2","publicId":"LibTmux.Server.with_owned/2","name":"with_owned/2","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"with_owned(options, fun)\n@spec with_owned([start_option()], (t() -> result)) ::\n result\n when result: term()","params":[{"name":"options","type":"[start_option()]"},{"name":"fun","type":"(t() -> result)"}],"returns":"result","typeParams":["result: term()"]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Starts a private server, calls `fun` with it and stops it afterwards.","body":"Takes the options of `start/1`. Returns the value of `fun`. A start failure\nraises its `LibTmux.Error` before `fun` runs. The server stops when `fun`\nreturns, raises, throws or exits. If `fun` completes and the stop fails,\n`with_owned/2` raises the stop error; a failing stop never replaces an\nexception from `fun`.\n\n alias LibTmux.Server\n\n Server.with_owned([executable: System.find_executable(\"tmux\")], fn server ->\n {:ok, _} = Server.new_session(server, \"demo\", command: {:argv, [\"/bin/cat\"]})\n Server.snapshot!(server)\n end)"},"source":{"file":"lib/libtmux/server.ex","line":381,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-with_owned-2"},{"id":"LibTmux.Server.kill/2","publicId":"LibTmux.Server.kill/2","name":"kill/2","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"kill(server, options \\\\ [])\n@spec kill(t(), [LibTmux.Action.option()]) ::\n {:ok, LibTmux.Action.result(:ok)}\n | {:error, LibTmux.Action.error()}","params":[{"name":"server","type":"t()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Kills the server with `kill-server`, whoever started it.","body":"Returns `{:ok, result}` when tmux acknowledges the command and\n`{:error, error}` otherwise, for example when no server answers. The\ncommand ends every session and pane on the server. It does not remove the\ndirectory of a server from `start/1`; use `stop/2` for that. The only\noption is `timeout` (5000 ms by default). See `LibTmux.Action` for outcomes.\n\n alias LibTmux.Server\n\n Server.kill(server)"},"source":{"file":"lib/libtmux/server.ex","line":421,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-kill-2"},{"id":"LibTmux.Server.kill!/2","publicId":"LibTmux.Server.kill!/2","name":"kill!/2","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"kill!(server, options \\\\ [])\n@spec kill!(t(), [LibTmux.Action.option()]) :: :ok","params":[{"name":"server","type":"t()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns `:ok` when `kill/2` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/server.ex","line":439,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-kill-bang-2"},{"id":"LibTmux.Server.new_session/3","publicId":"LibTmux.Server.new_session/3","name":"new_session/3","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"new_session(server, name, options \\\\ [])\n@spec new_session(t(), binary(), [\n LibTmux.Action.creation_option()\n ]) ::\n {:ok,\n LibTmux.Action.result(\n LibTmux.Action.creation_value()\n )}\n | {:error, LibTmux.Action.error()}","params":[{"name":"server","type":"t()"},{"name":"name","type":"binary()"},{"name":"options","type":"[LibTmux.Action.creation_option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(LibTmux.Action.creation_value())} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Creates a named detached session on an existing server through one-shot execution.","body":"Returns `{:ok, result}` on completion, with `%{id: session_id, ref: nil}`\nas its value. Capture a fresh observation for a bound reference. There is\nno observed target to validate; this command acts on the server answering\nat the descriptor's endpoint. It never starts a missing server. A missing\nendpoint or duplicate session name returns an error with execution evidence.\nControl connections are unsupported.\n\nNames contain 1..1024 UTF-8 bytes without control characters. Format syntax\nstays literal; tmux's version-dependent name normalization still applies.\nOptions are `timeout` (5000ms), literal `cwd`, and `command`: `:default`,\n`{:shell, nonempty_bytes}` or `{:argv, [program | arguments]}`. Command forms\nfollow `LibTmux.Pane.split/3`, except `:empty` is unsupported for creation.\nAcknowledgement does not prove that the program started or finished.\nSee `LibTmux.Action` for completion and failure handling.\n\n alias LibTmux.Server\n\n Server.new_session(server, \"extra-work\", command: {:argv, [\"/bin/cat\"]})"},"source":{"file":"lib/libtmux/server.ex","line":443,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-new_session-3"},{"id":"LibTmux.Server.new_session!/3","publicId":"LibTmux.Server.new_session!/3","name":"new_session!/3","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"new_session!(server, name, options \\\\ [])\n@spec new_session!(t(), binary(), [\n LibTmux.Action.creation_option()\n ]) :: LibTmux.Action.creation_value()","params":[{"name":"server","type":"t()"},{"name":"name","type":"binary()"},{"name":"options","type":"[LibTmux.Action.creation_option()]","default":"[]"}],"returns":"LibTmux.Action.creation_value()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the created session value when `new_session/3` completes; raises the original error otherwise."},"source":{"file":"lib/libtmux/server.ex","line":471,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-new_session-bang-3"},{"id":"LibTmux.Server.run/3","publicId":"LibTmux.Server.run/3","name":"run/3","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"run(server, command, options \\\\ [])\n@spec run(t(), LibTmux.Command.t(), [\n LibTmux.Transport.OneShot.option()\n ]) ::\n {:ok, LibTmux.Transport.OneShot.result()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"server","type":"t()"},{"name":"command","type":"LibTmux.Command.t()"},{"name":"options","type":"[LibTmux.Transport.OneShot.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Transport.OneShot.result()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Runs one trusted command without attaching; returns bounded output and exit evidence.","body":"The options are those of `LibTmux.Transport.OneShot.run/3`, except\n`:keep_tmux_context`: the Server decides it from its socket, and a value\npassed here is ignored. Raises `ArgumentError` for a Server built by hand\nwhose `socket` or `socket_name` is not `nil` or a string, or that sets both.\n\nSee the [worked example](advanced-execution.html)."},"source":{"file":"lib/libtmux/server.ex","line":477,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-run-3"},{"id":"LibTmux.Server.snapshot/2","publicId":"LibTmux.Server.snapshot/2","name":"snapshot/2","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"snapshot(server, options \\\\ [])\n@spec snapshot(t(), [LibTmux.Capture.option()]) ::\n {:ok, LibTmux.Snapshot.t()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"server","type":"t()"},{"name":"options","type":"[LibTmux.Capture.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Snapshot.t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Captures a new graph explicitly, with bounded work and read retries.","body":"See the [worked example](first-task.html)."},"source":{"file":"lib/libtmux/server.ex","line":553,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-snapshot-2"},{"id":"LibTmux.Server.snapshot!/2","publicId":"LibTmux.Server.snapshot!/2","name":"snapshot!/2","namespace":"LibTmux.Server","parent":"LibTmux.Server","kind":"function","modifiers":[],"signatures":[{"raw":"snapshot!(server, options \\\\ [])\n@spec snapshot!(t(), [LibTmux.Capture.option()]) ::\n LibTmux.Snapshot.t()","params":[{"name":"server","type":"t()"},{"name":"options","type":"[LibTmux.Capture.option()]","default":"[]"}],"returns":"LibTmux.Snapshot.t()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Captures a graph or raises the same structured capture error.","body":"See the [worked example](first-task.html)."},"source":{"file":"lib/libtmux/server.ex","line":561,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-server-snapshot-bang-2"},{"id":"LibTmux.Session","publicId":"LibTmux.Session","name":"Session","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An immutable session observation with explicit actions. Attachment retains tmux's client count.","body":"## What is on here\n\nA Session is a value captured in a `LibTmux.Snapshot`. Relationship functions\nread the snapshot you pass; actions take a `LibTmux.Ref` and a Server or\nControl connection. Start with these groups:\n\n**Finding the session.** Select sessions from a captured snapshot, or look one\nup by its exact ID. Neither contacts tmux. An ID that was not captured returns\n`{:error, error}` with kind `:not_found`. Turn the session into a reference\ntied to the server incarnation that supplied it, ready for an action.\n\n- Select: `LibTmux.Snapshot.sessions/1`\n- By ID: `LibTmux.Snapshot.fetch/3`\n- Reference: `LibTmux.Ref.from_observation/1`\n\n**Looking inside a session.** Read windows, panes and the active window from the\nsnapshot, without I/O. A window linked more than once appears once, and a\ncovered empty relation returns an empty selection. An invalid or stale\nidentity, or a relationship the snapshot did not capture, raises\n`LibTmux.Error`. For per-session window indexes use `LibTmux.Snapshot.related/4`\nwith `:window_links`.\n\n- Windows: `windows/2`\n- Panes: `panes/2`\n- Focused: `active_window/2`\n\n**Creating a window.** Create a named detached window in the session through\none-shot execution. The completed value holds the new ID with `ref: nil`;\ncapture a fresh observation to obtain a reference. A Control connection is\nunsupported, and a missing server is not started.\n\n- Create: `new_window/4`\n- Raise on failure: `new_window!/4`\n\n**Renaming.** Rename the session through a Server or a Control connection.\nA name holds 1..1024 UTF-8 bytes with no control characters, and tmux still\nnormalizes it. Observations you already hold keep the old name.\n\n- Rename: `rename/4`\n- Raise on failure: `rename!/4`\n\n**Killing.** Kill the session and the windows and panes only it holds,\nthrough a Server. A Control connection returns `unsupported_transport`.\nKilling the last session ends a server that exits when empty.\n\n- Kill: `kill/3`\n- Raise on failure: `kill!/3`"},"source":{"file":"lib/libtmux/entities.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session"},{"id":"LibTmux.Session.id","publicId":"LibTmux.Session.id","name":"id","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-id"},{"id":"LibTmux.Session.server_instance","publicId":"LibTmux.Session.server_instance","name":"server_instance","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-server_instance"},{"id":"LibTmux.Session.name","publicId":"LibTmux.Session.name","name":"name","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-name"},{"id":"LibTmux.Session.attached_count","publicId":"LibTmux.Session.attached_count","name":"attached_count","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-attached_count"},{"id":"LibTmux.Session.attached","publicId":"LibTmux.Session.attached","name":"attached","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-attached"},{"id":"LibTmux.Session.t/0","publicId":"LibTmux.Session.t/0","name":"t/0","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Session{\n attached: LibTmux.Schema.observed(boolean()),\n attached_count:\n LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n name: LibTmux.Schema.observed(String.t()),\n server_instance: String.t()\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Session{\n attached: LibTmux.Schema.observed(boolean()),\n attached_count:\n LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n name: LibTmux.Schema.observed(String.t()),\n server_instance: String.t()\n }","doc":{"summary":"A session with explicit field coverage and an attachment count separate from its Boolean projection."},"source":{"file":"lib/libtmux/entities.ex","line":62,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-t-0"},{"id":"LibTmux.Session.windows/2","publicId":"LibTmux.Session.windows/2","name":"windows/2","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"windows(snapshot, session)\n@spec windows(LibTmux.Snapshot.t(), t()) ::\n LibTmux.Selection.t(LibTmux.Window.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"session","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Window.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a selection of captured physical windows in first-link order.","body":"Repeated links to a window contribute it once. For membership indexes use\n`LibTmux.Snapshot.related/4` with `:window_links`.\n\nThe supplied snapshot owns all returned fields and relationships. Only the\nsession's ID and incarnation are used; its other fields may be older.\nInvalid or stale identities and missing source/relationship coverage raise\n`LibTmux.Error`. A covered empty relation returns an empty selection.\nNo I/O occurs. The selection retains the supplied snapshot for filtering;\nrelationship predicates still validate their whole captured source domain.\nUse `Enum.to_list/1` when only the list is needed.","examples":[{"lang":"elixir","code":"iex> alias LibTmux.{Selection, Session, Snapshot}\niex> rows = %{session: [%{id: \"$0\"}], window: [%{id: \"@7\"}],\n...> window_link: [%{session_id: \"$0\", window_id: \"@7\", index: 0, active: true},\n...> %{session_id: \"$0\", window_id: \"@7\", index: 3, active: false}],\n...> pane: [%{id: \"%9\", window_id: \"@7\"}]}\niex> {:ok, snapshot} = Snapshot.new(rows,\n...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n...> complete: [:window_link, :pane],\n...> fields: %{window_link: [:session_id, :window_id, :active], pane: [:window_id]})\niex> {:ok, session} = Snapshot.fetch(snapshot, :session, \"$0\")\niex> {:ok, window} = Session.windows(snapshot, session) |> Selection.one()\niex> window.id\n\"@7\"\niex> Session.panes(snapshot, session) |> Enum.map(& &1.id)\n[\"%9\"]\niex> Session.active_window(snapshot, session) == window\ntrue"}]},"source":{"file":"lib/libtmux/entities.ex","line":71,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-windows-2"},{"id":"LibTmux.Session.panes/2","publicId":"LibTmux.Session.panes/2","name":"panes/2","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"panes(snapshot, session)\n@spec panes(LibTmux.Snapshot.t(), t()) ::\n LibTmux.Selection.t(LibTmux.Pane.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"session","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Pane.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a selection of captured physical panes in numeric pane-ID order.","body":"Linked windows contribute their panes once. Identity, coverage, empty-selection\nand no-I/O behavior follow `windows/2`, which includes a worked example."},"source":{"file":"lib/libtmux/entities.ex","line":109,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-panes-2"},{"id":"LibTmux.Session.active_window/2","publicId":"LibTmux.Session.active_window/2","name":"active_window/2","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"active_window(snapshot, session)\n@spec active_window(LibTmux.Snapshot.t(), t()) ::\n LibTmux.Window.t() | nil","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"session","type":"t()"}],"returns":"LibTmux.Window.t() | nil"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the captured active physical window, or `nil` when none is active.","body":"Multiple active links raise `LibTmux.Error`, even when they name the same\nwindow. Unrelated sessions do not affect this lookup. Identity, coverage\nand no-I/O behavior follow `windows/2`, which includes a worked example."},"source":{"file":"lib/libtmux/entities.ex","line":119,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-active_window-2"},{"id":"LibTmux.Session.new_window/4","publicId":"LibTmux.Session.new_window/4","name":"new_window/4","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"new_window(server, ref, name, options \\\\ [])\n@spec new_window(\n LibTmux.Server.t(),\n LibTmux.Ref.t(),\n binary(),\n [LibTmux.Action.creation_option()]\n ) ::\n {:ok,\n LibTmux.Action.result(\n LibTmux.Action.creation_value()\n )}\n | {:error, LibTmux.Action.error()}","params":[{"name":"server","type":"LibTmux.Server.t()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"name","type":"binary()"},{"name":"options","type":"[LibTmux.Action.creation_option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(LibTmux.Action.creation_value())} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Creates a named detached window in an exact session through one-shot execution.","body":"Returns `{:ok, result}` on completion, with `%{id: window_id, ref: nil}`\nas its value. Capture a fresh observation for a bound reference. The session\nreference is checked against the answering server before dispatch, with\nthe usual one-shot check/use race. Missing servers are not started.\nControl connections are unsupported. tmux permits duplicate window names.\n\nNames, `timeout`, `cwd` and explicit `command` forms follow\n`LibTmux.Server.new_session/3`. The new window uses tmux's next available\nindex in this session. Existing observations remain unchanged.\n\n alias LibTmux.Session\n\n Session.new_window(server, session_ref, \"logs\", command: {:argv, [\"/bin/cat\"]})"},"source":{"file":"lib/libtmux/entities.ex","line":130,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-new_window-4"},{"id":"LibTmux.Session.new_window!/4","publicId":"LibTmux.Session.new_window!/4","name":"new_window!/4","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"new_window!(server, ref, name, options \\\\ [])\n@spec new_window!(\n LibTmux.Server.t(),\n LibTmux.Ref.t(),\n binary(),\n [LibTmux.Action.creation_option()]\n ) ::\n LibTmux.Action.creation_value()","params":[{"name":"server","type":"LibTmux.Server.t()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"name","type":"binary()"},{"name":"options","type":"[LibTmux.Action.creation_option()]","default":"[]"}],"returns":"LibTmux.Action.creation_value()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns the created window value when `new_window/4` completes; raises the original error otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":155,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-new_window-bang-4"},{"id":"LibTmux.Session.rename/4","publicId":"LibTmux.Session.rename/4","name":"rename/4","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"rename(connection, ref, name, options \\\\ [])\n@spec rename(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n binary(),\n [LibTmux.Control.call_option()]\n ) ::\n {:ok, LibTmux.Action.result(:ok)}\n | {:error, LibTmux.Action.error()}","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"name","type":"binary()"},{"name":"options","type":"[LibTmux.Control.call_option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Renames an exact session; returns `{:ok, result}` on command completion.","body":"Names contain 1..1024 UTF-8 bytes without Unicode control characters (Cc).\nFormat syntax remains literal;\ntmux still normalizes names (including dollar/backslash escaping, and dots\nand colons on older releases). The only option is `timeout`, which defaults\nto 5000ms.\nOld observations stay unchanged. See `LibTmux.Action` for outcome semantics.\n\n alias LibTmux.Session\n\n Session.rename(server, session_ref, \"work\")"},"source":{"file":"lib/libtmux/entities.ex","line":163,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-rename-4"},{"id":"LibTmux.Session.rename!/4","publicId":"LibTmux.Session.rename!/4","name":"rename!/4","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"rename!(connection, ref, name, options \\\\ [])\n@spec rename!(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n binary(),\n [LibTmux.Control.call_option()]\n ) ::\n :ok","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"name","type":"binary()"},{"name":"options","type":"[LibTmux.Control.call_option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns `:ok` when `rename/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":184,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-rename-bang-4"},{"id":"LibTmux.Session.kill/3","publicId":"LibTmux.Session.kill/3","name":"kill/3","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"kill(connection, ref, options \\\\ [])\n@spec kill(LibTmux.Server.t(), LibTmux.Ref.t(), [\n LibTmux.Action.option()\n ]) ::\n {:ok, LibTmux.Action.result(:ok)}\n | {:error, LibTmux.Action.error()}","params":[{"name":"connection","type":"LibTmux.Server.t()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Kills an exact session through one-shot execution.","body":"Returns `{:ok, result}` on command completion. The only option is `timeout`, 5000ms by default. The reference is\nchecked against the answering server before dispatch, with the usual one-shot\ncheck/use race. A reference to something that is already gone returns\n`{:error, %LibTmux.Action.CompletionError{}}` with the original evidence.\nControl connections return `unsupported_transport` before any I/O: a\nconnection cannot kill what it is attached to. Observations you already hold\nkeep describing the session.\n\n alias LibTmux.Session\n\n Session.kill(server, session_ref)"},"source":{"file":"lib/libtmux/entities.ex","line":191,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-kill-3"},{"id":"LibTmux.Session.kill!/3","publicId":"LibTmux.Session.kill!/3","name":"kill!/3","namespace":"LibTmux.Session","parent":"LibTmux.Session","kind":"function","modifiers":[],"signatures":[{"raw":"kill!(connection, ref, options \\\\ [])\n@spec kill!(LibTmux.Server.t(), LibTmux.Ref.t(), [\n LibTmux.Action.option()\n ]) :: :ok","params":[{"name":"connection","type":"LibTmux.Server.t()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns `:ok` when `kill/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":211,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-session-kill-bang-3"},{"id":"LibTmux.Snapshot","publicId":"LibTmux.Snapshot","name":"Snapshot","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An indexed immutable graph observed over a capture interval.","body":"Construction and traversal perform no I/O. `fields` declares loaded fields\nover the supplied entity IDs; `complete` declares complete server entity\nsets. Missing declarations remain unloaded, including on empty sets.\nUnavailable capabilities use a separate declaration. Relations require\ncomplete join domains. A snapshot reserves no tmux objects."},"source":{"file":"lib/libtmux/snapshot.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot"},{"id":"LibTmux.Snapshot.id","publicId":"LibTmux.Snapshot.id","name":"id","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"pos_integer()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-id"},{"id":"LibTmux.Snapshot.server_instance","publicId":"LibTmux.Snapshot.server_instance","name":"server_instance","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-server_instance"},{"id":"LibTmux.Snapshot.captured_from","publicId":"LibTmux.Snapshot.captured_from","name":"captured_from","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"integer()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-captured_from"},{"id":"LibTmux.Snapshot.captured_until","publicId":"LibTmux.Snapshot.captured_until","name":"captured_until","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"integer()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-captured_until"},{"id":"LibTmux.Snapshot.coverage","publicId":"LibTmux.Snapshot.coverage","name":"coverage","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"coverage()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-coverage"},{"id":"LibTmux.Snapshot.schema_version","publicId":"LibTmux.Snapshot.schema_version","name":"schema_version","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"1","value":"1","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-schema_version"},{"id":"LibTmux.Snapshot.sessions","publicId":"LibTmux.Snapshot.sessions","name":"sessions","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(String.t()) => LibTmux.Session.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-sessions"},{"id":"LibTmux.Snapshot.windows","publicId":"LibTmux.Snapshot.windows","name":"windows","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(String.t()) => LibTmux.Window.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-windows"},{"id":"LibTmux.Snapshot.window_links","publicId":"LibTmux.Snapshot.window_links","name":"window_links","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(LibTmux.Ref.id()) => LibTmux.WindowLink.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-window_links"},{"id":"LibTmux.Snapshot.panes","publicId":"LibTmux.Snapshot.panes","name":"panes","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(String.t()) => LibTmux.Pane.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-panes"},{"id":"LibTmux.Snapshot.clients","publicId":"LibTmux.Snapshot.clients","name":"clients","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{optional(String.t()) => LibTmux.Client.t()}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-clients"},{"id":"LibTmux.Snapshot.order","publicId":"LibTmux.Snapshot.order","name":"order","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"%{required(LibTmux.Schema.entity()) => [LibTmux.Ref.id()]}","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-order"},{"id":"LibTmux.Snapshot.indexes","publicId":"LibTmux.Snapshot.indexes","name":"indexes","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"indexes()","value":"%{}","source":{"file":"lib/libtmux/snapshot.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-indexes"},{"id":"LibTmux.Snapshot.entity_coverage/0","publicId":"LibTmux.Snapshot.entity_coverage/0","name":"entity_coverage/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type entity_coverage() :: %{\n ids: MapSet.t(LibTmux.Ref.id()),\n complete: boolean(),\n fields: %{\n optional(atom()) => :loaded | :unavailable\n }\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"entity_coverage() :: %{\n ids: MapSet.t(LibTmux.Ref.id()),\n complete: boolean(),\n fields: %{\n optional(atom()) => :loaded | :unavailable\n }\n }","doc":{"summary":"Coverage of one captured entity domain; missing field entries are unloaded."},"source":{"file":"lib/libtmux/snapshot.ex","line":43,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-entity_coverage-0"},{"id":"LibTmux.Snapshot.coverage/0","publicId":"LibTmux.Snapshot.coverage/0","name":"coverage/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type coverage() :: %{\n entities: %{\n required(LibTmux.Schema.entity()) =>\n entity_coverage()\n }\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"coverage() :: %{\n entities: %{\n required(LibTmux.Schema.entity()) =>\n entity_coverage()\n }\n }","doc":{"summary":"Declared entity sets and field availability; completeness is separate from an empty captured set."},"source":{"file":"lib/libtmux/snapshot.ex","line":49,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-coverage-0"},{"id":"LibTmux.Snapshot.indexes/0","publicId":"LibTmux.Snapshot.indexes/0","name":"indexes/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":["opaque"],"signatures":[{"raw":"@opaque indexes()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Maps each session ID to the IDs of its window links and clients, and each window ID to the IDs of its window links and panes. Traverse with `related/4`; the layout is not part of the contract."},"source":{"file":"lib/libtmux/snapshot.ex","line":51,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-indexes-0"},{"id":"LibTmux.Snapshot.rows/0","publicId":"LibTmux.Snapshot.rows/0","name":"rows/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type rows() :: %{\n optional(LibTmux.Schema.entity()) => [\n map() | LibTmux.Schema.observation()\n ]\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"rows() :: %{\n optional(LibTmux.Schema.entity()) => [\n map() | LibTmux.Schema.observation()\n ]\n }","doc":{"summary":"Observed rows grouped by canonical entity; construction validates and deduplicates their identities."},"source":{"file":"lib/libtmux/snapshot.ex","line":58,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-rows-0"},{"id":"LibTmux.Snapshot.option/0","publicId":"LibTmux.Snapshot.option/0","name":"option/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:server_instance, String.t()}\n | {:captured_from, integer()}\n | {:captured_until, integer()}\n | {:fields,\n %{optional(LibTmux.Schema.entity()) => [atom()]}}\n | {:complete, [LibTmux.Schema.entity()]}\n | {:unavailable,\n %{optional(LibTmux.Schema.entity()) => [atom()]}}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:server_instance, String.t()}\n | {:captured_from, integer()}\n | {:captured_until, integer()}\n | {:fields,\n %{optional(LibTmux.Schema.entity()) => [atom()]}}\n | {:complete, [LibTmux.Schema.entity()]}\n | {:unavailable,\n %{optional(LibTmux.Schema.entity()) => [atom()]}}","doc":{"summary":"Construction metadata: one server instance, ordered millisecond timestamps and explicit coverage declarations."},"source":{"file":"lib/libtmux/snapshot.ex","line":60,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-option-0"},{"id":"LibTmux.Snapshot.t/0","publicId":"LibTmux.Snapshot.t/0","name":"t/0","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Snapshot{\n captured_from: integer(),\n captured_until: integer(),\n clients: %{\n optional(String.t()) => LibTmux.Client.t()\n },\n coverage: coverage(),\n id: pos_integer(),\n indexes: indexes(),\n order: %{\n required(LibTmux.Schema.entity()) => [\n LibTmux.Ref.id()\n ]\n },\n panes: %{optional(String.t()) => LibTmux.Pane.t()},\n schema_version: 1,\n server_instance: String.t(),\n sessions: %{\n optional(String.t()) => LibTmux.Session.t()\n },\n window_links: %{\n optional(LibTmux.Ref.id()) =>\n LibTmux.WindowLink.t()\n },\n windows: %{\n optional(String.t()) => LibTmux.Window.t()\n }\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Snapshot{\n captured_from: integer(),\n captured_until: integer(),\n clients: %{\n optional(String.t()) => LibTmux.Client.t()\n },\n coverage: coverage(),\n id: pos_integer(),\n indexes: indexes(),\n order: %{\n required(LibTmux.Schema.entity()) => [\n LibTmux.Ref.id()\n ]\n },\n panes: %{optional(String.t()) => LibTmux.Pane.t()},\n schema_version: 1,\n server_instance: String.t(),\n sessions: %{\n optional(String.t()) => LibTmux.Session.t()\n },\n window_links: %{\n optional(LibTmux.Ref.id()) =>\n LibTmux.WindowLink.t()\n },\n windows: %{\n optional(String.t()) => LibTmux.Window.t()\n }\n }","doc":{"summary":"An immutable observation interval with indexed entities and explicit coverage."},"source":{"file":"lib/libtmux/snapshot.ex","line":69,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-t-0"},{"id":"LibTmux.Snapshot.new/2","publicId":"LibTmux.Snapshot.new/2","name":"new/2","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"new(rows, options)\n@spec new(rows(), [option()]) ::\n {:ok, t()} | {:error, LibTmux.Error.t()}","params":[{"name":"rows","type":"rows()"},{"name":"options","type":"[option()]"}],"returns":"{:ok, t()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Validates observed rows, rejecting conflicts, invalid fields and dangling covered references.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":86,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-new-2"},{"id":"LibTmux.Snapshot.items/2","publicId":"LibTmux.Snapshot.items/2","name":"items/2","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"items(snapshot, entity)\n@spec items(t(), LibTmux.Schema.entity_selector()) :: [\n LibTmux.Schema.observation()\n ]","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"}],"returns":"[LibTmux.Schema.observation()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns plain observed items in stable identity order without loading data.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":158,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-items-2"},{"id":"LibTmux.Snapshot.sessions/1","publicId":"LibTmux.Snapshot.sessions/1","name":"sessions/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"sessions(snapshot)\n@spec sessions(t()) ::\n LibTmux.Selection.t(LibTmux.Session.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Session.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized session selection without I/O.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":170,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-sessions-1"},{"id":"LibTmux.Snapshot.windows/1","publicId":"LibTmux.Snapshot.windows/1","name":"windows/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"windows(snapshot)\n@spec windows(t()) ::\n LibTmux.Selection.t(LibTmux.Window.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Window.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized physical window selection without I/O.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":178,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-windows-1"},{"id":"LibTmux.Snapshot.panes/1","publicId":"LibTmux.Snapshot.panes/1","name":"panes/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"panes(snapshot)\n@spec panes(t()) :: LibTmux.Selection.t(LibTmux.Pane.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Pane.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized physical pane selection without I/O.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":186,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-panes-1"},{"id":"LibTmux.Snapshot.window_links/1","publicId":"LibTmux.Snapshot.window_links/1","name":"window_links/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"window_links(snapshot)\n@spec window_links(t()) ::\n LibTmux.Selection.t(LibTmux.WindowLink.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.WindowLink.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized membership selection without I/O.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":194,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-window_links-1"},{"id":"LibTmux.Snapshot.clients/1","publicId":"LibTmux.Snapshot.clients/1","name":"clients/1","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"clients(snapshot)\n@spec clients(t()) ::\n LibTmux.Selection.t(LibTmux.Client.t())","params":[{"name":"snapshot","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Client.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a materialized attached-client selection without I/O.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":202,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-clients-1"},{"id":"LibTmux.Snapshot.fetch/3","publicId":"LibTmux.Snapshot.fetch/3","name":"fetch/3","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"fetch(snapshot, entity, id)\n@spec fetch(\n t(),\n LibTmux.Schema.entity_selector(),\n LibTmux.Ref.id()\n ) ::\n {:ok, LibTmux.Schema.observation()}\n | {:error, LibTmux.Error.t()}","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"id","type":"LibTmux.Ref.id()"}],"returns":"{:ok, LibTmux.Schema.observation()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Looks up one exact observed ID without I/O.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":210,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-fetch-3"},{"id":"LibTmux.Snapshot.require_complete!/2","publicId":"LibTmux.Snapshot.require_complete!/2","name":"require_complete!/2","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"require_complete!(snapshot, entity)\n@spec require_complete!(\n t(),\n LibTmux.Schema.entity_selector()\n ) :: :ok","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requires a declared complete entity set, even when it has no rows.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":230,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-require_complete-bang-2"},{"id":"LibTmux.Snapshot.require_field!/3","publicId":"LibTmux.Snapshot.require_field!/3","name":"require_field!/3","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"require_field!(snapshot, entity, field)\n@spec require_field!(\n t(),\n LibTmux.Schema.entity_selector(),\n atom()\n ) :: :ok","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"field","type":"atom()"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requires a loaded field over the captured entity domain before evaluation.","body":"See the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":245,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-require_field-bang-3"},{"id":"LibTmux.Snapshot.require_relation!/4","publicId":"LibTmux.Snapshot.require_relation!/4","name":"require_relation!/4","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"require_relation!(snapshot, entity, relation, ids \\\\ :all)\n@spec require_relation!(\n t(),\n LibTmux.Schema.entity_selector(),\n atom(),\n :all | [LibTmux.Ref.id()]\n ) :: :ok","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"relation","type":"atom()"},{"name":"ids","type":":all | [LibTmux.Ref.id()]","default":":all"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Requires relation coverage for the requested source IDs, including known-empty relations.","body":"The default `:all` validates the entire captured source domain. An explicit\nID list does not resolve unrelated sources or their ambiguous relationships.\n\nSee the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":262,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-require_relation-bang-4"},{"id":"LibTmux.Snapshot.related/4","publicId":"LibTmux.Snapshot.related/4","name":"related/4","namespace":"LibTmux.Snapshot","parent":"LibTmux.Snapshot","kind":"function","modifiers":[],"signatures":[{"raw":"related(snapshot, entity, id, relation)\n@spec related(\n t(),\n LibTmux.Schema.entity_selector(),\n LibTmux.Ref.id(),\n atom()\n ) ::\n LibTmux.Schema.observation()\n | nil\n | [LibTmux.Schema.observation()]","params":[{"name":"snapshot","type":"t()"},{"name":"entity","type":"LibTmux.Schema.entity_selector()"},{"name":"id","type":"LibTmux.Ref.id()"},{"name":"relation","type":"atom()"}],"returns":"LibTmux.Schema.observation() | nil | [LibTmux.Schema.observation()]"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Resolves one source's covered relation through captured indexes; never refreshes.","body":"Ambiguity in another source does not affect this lookup. Whole-selection\nfiltering still validates its entire required relationship domain first.\n\nSee the [worked example](api-examples.html#local-graph-and-filtering)."},"source":{"file":"lib/libtmux/snapshot.ex","line":285,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-snapshot-related-4"},{"id":"LibTmux.Transport.OneShot","publicId":"LibTmux.Transport.OneShot","name":"OneShot","namespace":"LibTmux.Transport","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Executes one explicitly selected executable with bounded captured output.","body":"This Linux transport owns a native helper and its ordinary finite process\ntree. It never uses a shell. A worker owns the Port and observes caller\ndeath; the helper detects pipe closure after worker or VM death.\nTarget environment entries travel as bytes to child `execve`, preserving\nempty values. The helper inherits the trusted host environment; requested\ntarget variables do not configure the helper. `TMUX` and `TMUX_PANE` are\nremoved from the target environment unless `keep_tmux_context: true`, which\n`LibTmux.Server.run/3` passes only for a Server that chose no socket.\n\nLimits apply per call: stdout defaults to 1 MiB, stderr to 64 KiB, and\nretained chunks to 4096. `max_total_bytes` additionally bounds both streams\ntogether; it defaults to their summed limits. Overload returns an error\nwith a bounded prefix.\nIndependent caller processes require admission limits at their host or\nserver boundary; this primitive maintains no shared request queue.\n\nA positive timeout becomes one execution deadline. Retirement can take\nup to a separate 750 ms cleanup allowance after expiry. Missing retirement\nproof remains `:unknown`. No result authorizes replay. Helper SIGKILL,\nhostile escape and uninterruptible kernel tasks are outside the ordinary\ntree guarantee. Building the native helper requires a C11 compiler."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-transport-oneshot"},{"id":"LibTmux.Transport.OneShot.result/0","publicId":"LibTmux.Transport.OneShot.result/0","name":"result/0","namespace":"LibTmux.Transport.OneShot","parent":"LibTmux.Transport.OneShot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type result() :: %{\n stdout: binary(),\n stderr: binary(),\n exit_status: non_neg_integer(),\n cleanup: :retired\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"result() :: %{\n stdout: binary(),\n stderr: binary(),\n exit_status: non_neg_integer(),\n cleanup: :retired\n }","doc":{"summary":"Captured bytes and child exit status after proven owned-process retirement; nonzero exit remains a transport result."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":32,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-transport-oneshot-result-0"},{"id":"LibTmux.Transport.OneShot.option/0","publicId":"LibTmux.Transport.OneShot.option/0","name":"option/0","namespace":"LibTmux.Transport.OneShot","parent":"LibTmux.Transport.OneShot","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type option() ::\n {:timeout, 1..600_000}\n | {:deadline, LibTmux.Deadline.t()}\n | {:cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:keep_tmux_context, boolean()}\n | {:max_stdout_bytes | :max_stderr_bytes,\n 0..16_777_216}\n | {:max_total_bytes, nil | 0..33_554_432}\n | {:max_chunks, 1..65536}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"option() ::\n {:timeout, 1..600_000}\n | {:deadline, LibTmux.Deadline.t()}\n | {:cwd, String.t()}\n | {:env, %{optional(binary()) => binary()}}\n | {:keep_tmux_context, boolean()}\n | {:max_stdout_bytes | :max_stderr_bytes,\n 0..16_777_216}\n | {:max_total_bytes, nil | 0..33_554_432}\n | {:max_chunks, 1..65536}","doc":{"summary":"Per-call input and capture limits; bytes and chunks are bounded independently.","body":"Timeout and deadline are exclusive. A supplied deadline must have at most\n600,000 ms remaining at validation; it preserves its original cutoff."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":40,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-transport-oneshot-option-0"},{"id":"LibTmux.Transport.OneShot.run/3","publicId":"LibTmux.Transport.OneShot.run/3","name":"run/3","namespace":"LibTmux.Transport.OneShot","parent":"LibTmux.Transport.OneShot","kind":"function","modifiers":[],"signatures":[{"raw":"run(executable, arguments, options \\\\ [])\n@spec run(binary(), [binary()], [option()]) ::\n {:ok, result()} | {:error, LibTmux.Error.t()}","params":[{"name":"executable","type":"binary()"},{"name":"arguments","type":"[binary()]"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"{:ok, result()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Runs argv without a shell, retaining exit status separately from stdout and stderr.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":59,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-transport-oneshot-run-3"},{"id":"LibTmux.Transport.OneShot.run!/3","publicId":"LibTmux.Transport.OneShot.run!/3","name":"run!/3","namespace":"LibTmux.Transport.OneShot","parent":"LibTmux.Transport.OneShot","kind":"function","modifiers":[],"signatures":[{"raw":"run!(executable, arguments, options \\\\ [])\n@spec run!(binary(), [binary()], [option()]) :: result()","params":[{"name":"executable","type":"binary()"},{"name":"arguments","type":"[binary()]"},{"name":"options","type":"[option()]","default":"[]"}],"returns":"result()"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Runs argv, raising the same structured transport error on failure.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/transport/oneshot.ex","line":97,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-transport-oneshot-run-bang-3"},{"id":"LibTmux.Window","publicId":"LibTmux.Window","name":"Window","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An immutable physical window with explicit actions, independent of session membership and index.","body":"## What is on here\n\nA Window is a physical window captured in a `LibTmux.Snapshot`. Its session\nindex and active state belong to a `LibTmux.WindowLink`, so one Window can\nbelong to several sessions. Start with these groups:\n\n**Finding the window.** Select windows from a captured snapshot, or look one\nup by its exact ID. Neither contacts tmux. An ID that was not captured returns\n`{:error, error}` with kind `:not_found`. Turn the window into a reference\ntied to the server incarnation that supplied it, ready for an action.\n\n- Select: `LibTmux.Snapshot.windows/1`\n- By ID: `LibTmux.Snapshot.fetch/3`\n- Reference: `LibTmux.Ref.from_observation/1`\n\n**Looking inside a window.** Read its panes from the snapshot, in numeric\npane-ID order and without I/O. An invalid or stale identity, or a relationship\nthe snapshot did not capture, raises `LibTmux.Error`. To find the sessions\nthat hold the window, select its links.\n\n- Panes: `panes/2`\n- Links: `LibTmux.Snapshot.window_links/1`\n\n**Renaming.** Rename the window across all its memberships through a Server or\na Control connection. A name holds 1..1024 UTF-8 bytes with no control\ncharacters, and tmux still normalizes it. The optional `session:` reference\nrequires membership in that session; it does not pick a link index.\n\n- Rename: `rename/4`\n- Raise on failure: `rename!/4`\n\n**Killing.** Kill the window, with its panes, in every session that links it,\nthrough a Server. A Control connection returns `unsupported_transport`.\n\n- Kill: `kill/3`\n- Raise on failure: `kill!/3`"},"source":{"file":"lib/libtmux/entities.ex","line":217,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window"},{"id":"LibTmux.Window.id","publicId":"LibTmux.Window.id","name":"id","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-id"},{"id":"LibTmux.Window.server_instance","publicId":"LibTmux.Window.server_instance","name":"server_instance","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-server_instance"},{"id":"LibTmux.Window.name","publicId":"LibTmux.Window.name","name":"name","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-name"},{"id":"LibTmux.Window.width","publicId":"LibTmux.Window.width","name":"width","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-width"},{"id":"LibTmux.Window.height","publicId":"LibTmux.Window.height","name":"height","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-height"},{"id":"LibTmux.Window.layout","publicId":"LibTmux.Window.layout","name":"layout","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-layout"},{"id":"LibTmux.Window.zoomed","publicId":"LibTmux.Window.zoomed","name":"zoomed","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-zoomed"},{"id":"LibTmux.Window.t/0","publicId":"LibTmux.Window.t/0","name":"t/0","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.Window{\n height: LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n layout: LibTmux.Schema.observed(String.t()),\n name: LibTmux.Schema.observed(String.t()),\n server_instance: String.t(),\n width: LibTmux.Schema.observed(non_neg_integer()),\n zoomed: LibTmux.Schema.observed(boolean())\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.Window{\n height: LibTmux.Schema.observed(non_neg_integer()),\n id: String.t(),\n layout: LibTmux.Schema.observed(String.t()),\n name: LibTmux.Schema.observed(String.t()),\n server_instance: String.t(),\n width: LibTmux.Schema.observed(non_neg_integer()),\n zoomed: LibTmux.Schema.observed(boolean())\n }","doc":{"summary":"A physical window; session index and active-window state belong to a WindowLink."},"source":{"file":"lib/libtmux/entities.ex","line":269,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-t-0"},{"id":"LibTmux.Window.panes/2","publicId":"LibTmux.Window.panes/2","name":"panes/2","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"function","modifiers":[],"signatures":[{"raw":"panes(snapshot, window)\n@spec panes(LibTmux.Snapshot.t(), t()) ::\n LibTmux.Selection.t(LibTmux.Pane.t())","params":[{"name":"snapshot","type":"LibTmux.Snapshot.t()"},{"name":"window","type":"t()"}],"returns":"LibTmux.Selection.t(LibTmux.Pane.t())"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns a selection of captured physical panes in numeric pane-ID order.","body":"Uses the supplied snapshot and validates the window's ID and incarnation.\nIdentity, coverage, empty-selection and no-I/O behavior follow\n`LibTmux.Session.windows/2`.","examples":[{"lang":"elixir","code":"iex> alias LibTmux.{Selection, Snapshot, Window}\niex> rows = %{window: [%{id: \"@0\"}], pane: [\n...> %{id: \"%10\", window_id: \"@0\"}, %{id: \"%2\", window_id: \"@0\"}]}\niex> {:ok, snapshot} = Snapshot.new(rows,\n...> server_instance: \"example\", captured_from: 0, captured_until: 0,\n...> complete: [:pane], fields: %{pane: [:id, :window_id]})\niex> {:ok, window} = Snapshot.fetch(snapshot, :window, \"@0\")\niex> Window.panes(snapshot, window) |> Enum.map(& &1.id)\n[\"%2\", \"%10\"]\niex> {:ok, pane} = Window.panes(snapshot, window)\n...> |> Selection.where(id: \"%2\") |> Selection.one()\niex> pane.id\n\"%2\""}]},"source":{"file":"lib/libtmux/entities.ex","line":280,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-panes-2"},{"id":"LibTmux.Window.rename/4","publicId":"LibTmux.Window.rename/4","name":"rename/4","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"function","modifiers":[],"signatures":[{"raw":"rename(connection, ref, name, options \\\\ [])\n@spec rename(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n binary(),\n [LibTmux.Action.option()]\n ) ::\n {:ok, LibTmux.Action.result(:ok)}\n | {:error, LibTmux.Action.error()}","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"name","type":"binary()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Renames an exact physical window across all its memberships.","body":"Returns `{:ok, result}` on command completion; unsuccessful outcomes return\n`{:error, %LibTmux.Action.CompletionError{}}` with their original evidence.\n\nNames contain 1..1024 UTF-8 bytes without Unicode control characters (Cc),\nwith literal format syntax.\ntmux still applies name normalization, including dollar/backslash escaping.\nControl characters fail before I/O on both transports. Optional `session: session_ref` requires\nmembership in that exact session; it does not select a captured link index.\n`timeout` defaults to 5000ms. See `LibTmux.Action` for transport and outcomes.\n\n alias LibTmux.Window\n\n Window.rename(control, window_ref, \"editor\")"},"source":{"file":"lib/libtmux/entities.ex","line":307,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-rename-4"},{"id":"LibTmux.Window.rename!/4","publicId":"LibTmux.Window.rename!/4","name":"rename!/4","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"function","modifiers":[],"signatures":[{"raw":"rename!(connection, ref, name, options \\\\ [])\n@spec rename!(\n LibTmux.Action.connection(),\n LibTmux.Ref.t(),\n binary(),\n [LibTmux.Action.option()]\n ) :: :ok","params":[{"name":"connection","type":"LibTmux.Action.connection()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"name","type":"binary()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns `:ok` when `rename/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":329,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-rename-bang-4"},{"id":"LibTmux.Window.kill/3","publicId":"LibTmux.Window.kill/3","name":"kill/3","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"function","modifiers":[],"signatures":[{"raw":"kill(connection, ref, options \\\\ [])\n@spec kill(LibTmux.Server.t(), LibTmux.Ref.t(), [\n LibTmux.Action.option()\n ]) ::\n {:ok, LibTmux.Action.result(:ok)}\n | {:error, LibTmux.Action.error()}","params":[{"name":"connection","type":"LibTmux.Server.t()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":"{:ok, LibTmux.Action.result(:ok)} | {:error, LibTmux.Action.error()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Kills an exact window through one-shot execution.","body":"Returns `{:ok, result}` on command completion. Optional `session: session_ref` requires membership in that exact session and `timeout` defaults to 5000ms. Killing a window removes it from every session that links it. The reference is\nchecked against the answering server before dispatch, with the usual one-shot\ncheck/use race. A reference to something that is already gone returns\n`{:error, %LibTmux.Action.CompletionError{}}` with the original evidence.\nControl connections return `unsupported_transport` before any I/O: a\nconnection cannot kill what it is attached to. Observations you already hold\nkeep describing the window.\n\n alias LibTmux.Window\n\n Window.kill(server, window_ref)"},"source":{"file":"lib/libtmux/entities.ex","line":335,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-kill-3"},{"id":"LibTmux.Window.kill!/3","publicId":"LibTmux.Window.kill!/3","name":"kill!/3","namespace":"LibTmux.Window","parent":"LibTmux.Window","kind":"function","modifiers":[],"signatures":[{"raw":"kill!(connection, ref, options \\\\ [])\n@spec kill!(LibTmux.Server.t(), LibTmux.Ref.t(), [\n LibTmux.Action.option()\n ]) :: :ok","params":[{"name":"connection","type":"LibTmux.Server.t()"},{"name":"ref","type":"LibTmux.Ref.t()"},{"name":"options","type":"[LibTmux.Action.option()]","default":"[]"}],"returns":":ok"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Returns `:ok` when `kill/3` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise."},"source":{"file":"lib/libtmux/entities.ex","line":355,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-window-kill-bang-3"},{"id":"LibTmux.WindowLink","publicId":"LibTmux.WindowLink","name":"WindowLink","namespace":"LibTmux","kind":"struct","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"An observed session/index/window binding. Its key is not a link lifetime ID."},"source":{"file":"lib/libtmux/entities.ex","line":361,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-windowlink"},{"id":"LibTmux.WindowLink.id","publicId":"LibTmux.WindowLink.id","name":"id","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"{String.t(), non_neg_integer(), String.t()}","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-windowlink-id"},{"id":"LibTmux.WindowLink.server_instance","publicId":"LibTmux.WindowLink.server_instance","name":"server_instance","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"String.t()","doc":{"summary":"Required: building the struct without this key is an error."},"source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-windowlink-server_instance"},{"id":"LibTmux.WindowLink.session_id","publicId":"LibTmux.WindowLink.session_id","name":"session_id","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-windowlink-session_id"},{"id":"LibTmux.WindowLink.window_id","publicId":"LibTmux.WindowLink.window_id","name":"window_id","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(String.t())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-windowlink-window_id"},{"id":"LibTmux.WindowLink.index","publicId":"LibTmux.WindowLink.index","name":"index","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(non_neg_integer())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-windowlink-index"},{"id":"LibTmux.WindowLink.active","publicId":"LibTmux.WindowLink.active","name":"active","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"property","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","type":"LibTmux.Schema.observed(boolean())","value":":unloaded","source":{"file":"lib/libtmux/entities.ex","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-windowlink-active"},{"id":"LibTmux.WindowLink.t/0","publicId":"LibTmux.WindowLink.t/0","name":"t/0","namespace":"LibTmux.WindowLink","parent":"LibTmux.WindowLink","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type t() :: %LibTmux.WindowLink{\n active: LibTmux.Schema.observed(boolean()),\n id: {String.t(), non_neg_integer(), String.t()},\n index: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n window_id: LibTmux.Schema.observed(String.t())\n }","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"t() :: %LibTmux.WindowLink{\n active: LibTmux.Schema.observed(boolean()),\n id: {String.t(), non_neg_integer(), String.t()},\n index: LibTmux.Schema.observed(non_neg_integer()),\n server_instance: String.t(),\n session_id: LibTmux.Schema.observed(String.t()),\n window_id: LibTmux.Schema.observed(String.t())\n }","doc":{"summary":"A captured session/index/window binding, including its session-relative active state."},"source":{"file":"lib/libtmux/entities.ex","line":373,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-windowlink-t-0"},{"id":"LibTmux.Wire","publicId":"LibTmux.Wire","name":"Wire","namespace":"LibTmux","kind":"module","modifiers":[],"signatures":[],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Bounded JSON decoding with duplicate keys preserved until validation.","body":"Uses the built-in JSON decoder callbacks. Object keys stay strings; no\natoms are created. Byte, nesting, node, array and string ceilings apply\nbefore conversion to public maps. Parsing failures retain root paths and\noffsets where supplied; duplicate-key failures identify the object path.\nDepth starts at zero for the root value and increases for every object\nmember or array element; the maximum is inclusive for maps and JSON alike."},"source":{"file":"lib/libtmux/wire.ex","line":1,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-wire"},{"id":"LibTmux.Wire.value/0","publicId":"LibTmux.Wire.value/0","name":"value/0","namespace":"LibTmux.Wire","parent":"LibTmux.Wire","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type value() ::\n nil\n | boolean()\n | integer()\n | float()\n | String.t()\n | [value()]\n | object()","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"value() ::\n nil\n | boolean()\n | integer()\n | float()\n | String.t()\n | [value()]\n | object()","doc":{"summary":"A JSON value with string-keyed objects; invalid external terms return a validation error."},"source":{"file":"lib/libtmux/wire.ex","line":15,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-wire-value-0"},{"id":"LibTmux.Wire.object/0","publicId":"LibTmux.Wire.object/0","name":"object/0","namespace":"LibTmux.Wire","parent":"LibTmux.Wire","kind":"typealias","modifiers":[],"signatures":[{"raw":"@type object() :: %{optional(String.t()) => value()}","params":[]}],"package":"libtmux","product":"core","apiScope":"exported","type":"object() :: %{optional(String.t()) => value()}","doc":{"summary":"A JSON object whose keys remain strings; validation never creates atoms from external names."},"source":{"file":"lib/libtmux/wire.ex","line":17,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-wire-object-0"},{"id":"LibTmux.Wire.decode/2","publicId":"LibTmux.Wire.decode/2","name":"decode/2","namespace":"LibTmux.Wire","parent":"LibTmux.Wire","kind":"function","modifiers":[],"signatures":[{"raw":"decode(binary, options \\\\ [])\n@spec decode(binary(), [LibTmux.Filter.limit_option()]) ::\n {:ok, value()} | {:error, LibTmux.Error.t()}","params":[{"name":"binary","type":"binary()"},{"name":"options","type":"[LibTmux.Filter.limit_option()]","default":"[]"}],"returns":"{:ok, value()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Decodes one complete bounded JSON value, rejecting duplicate keys and trailing data.","body":"See the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/wire.ex","line":20,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-wire-decode-2"},{"id":"LibTmux.Wire.validate/2","publicId":"LibTmux.Wire.validate/2","name":"validate/2","namespace":"LibTmux.Wire","parent":"LibTmux.Wire","kind":"function","modifiers":[],"signatures":[{"raw":"validate(value, options \\\\ [])\n@spec validate(term(), [LibTmux.Filter.limit_option()]) ::\n {:ok, value()} | {:error, LibTmux.Error.t()}","params":[{"name":"value","type":"term()"},{"name":"options","type":"[LibTmux.Filter.limit_option()]","default":"[]"}],"returns":"{:ok, value()} | {:error, LibTmux.Error.t()}"}],"package":"libtmux","product":"core","apiScope":"exported","doc":{"summary":"Validates already-decoded JSON data and its complete encoded byte size.","body":"Arrays must be proper lists; a malformed tail reports the containing\narray's path. An excess prefix returns the list limit before inspecting its tail.\n\nSee the [worked example](api-examples.html#encoding-and-protocol)."},"source":{"file":"lib/libtmux/wire.ex","line":87,"repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","extractedRevision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688"},"slug":"libtmux-wire-validate-2"}]} diff --git a/site/src/data/api/elixir.nav.json b/site/src/data/api/elixir.nav.json index c47b5f052..2057de5e6 100644 --- a/site/src/data/api/elixir.nav.json +++ b/site/src/data/api/elixir.nav.json @@ -1 +1 @@ -{"port":"elixir","buckets":[{"id":"server","label":"Server","collapsed":false},{"id":"session","label":"Session","collapsed":false},{"id":"window","label":"Window","collapsed":false},{"id":"pane","label":"Pane","collapsed":false},{"id":"client","label":"Client","collapsed":false},{"id":"hooks","label":"Hooks","collapsed":false},{"id":"options","label":"Options","collapsed":false,"children":[{"id":"options-functions","label":"Functions","collapsed":false},{"id":"options-constants","label":"Constants and variables","collapsed":false}]},{"id":"keys","label":"Keys and bindings","collapsed":false},{"id":"buffers","label":"Buffers","collapsed":false},{"id":"layout","label":"Layout and geometry","collapsed":false},{"id":"environment","label":"Environment","collapsed":false},{"id":"capabilities","label":"Terminal capabilities","collapsed":false},{"id":"version","label":"Versions","collapsed":false},{"id":"commands","label":"Commands","collapsed":false},{"id":"control","label":"Control mode","collapsed":false},{"id":"formats","label":"Formats","collapsed":false},{"id":"queries","label":"Queries","collapsed":false,"children":[{"id":"queries-fields","label":"Fields","collapsed":false},{"id":"queries-operators","label":"Operators","collapsed":false},{"id":"queries-expressions","label":"Expressions","collapsed":false}]},{"id":"snapshots","label":"Snapshots","collapsed":false},{"id":"workspace","label":"Workspaces","collapsed":false,"children":[{"id":"workspace-plan","label":"Plans","collapsed":false},{"id":"workspace-steps","label":"Steps","collapsed":false},{"id":"workspace-targets","label":"Targets and slots","collapsed":false},{"id":"workspace-session","label":"Session","collapsed":false},{"id":"workspace-window","label":"Window","collapsed":false},{"id":"workspace-pane","label":"Pane","collapsed":false},{"id":"workspace-functions","label":"Functions","collapsed":false},{"id":"workspace-constants","label":"Constants and variables","collapsed":false}]},{"id":"requests","label":"Requests","collapsed":true,"children":[{"id":"requests-server","label":"Server","collapsed":false},{"id":"requests-session","label":"Session","collapsed":false},{"id":"requests-window","label":"Window","collapsed":false},{"id":"requests-pane","label":"Pane","collapsed":false},{"id":"requests-client","label":"Client","collapsed":false}]},{"id":"errors","label":"Errors","collapsed":true,"children":[{"id":"errors-server","label":"Server","collapsed":false},{"id":"errors-session","label":"Session","collapsed":false},{"id":"errors-window","label":"Window","collapsed":false},{"id":"errors-pane","label":"Pane","collapsed":false}]},{"id":"constants","label":"Constants and enums","collapsed":true,"children":[{"id":"constants-server","label":"Server","collapsed":false},{"id":"constants-session","label":"Session","collapsed":false},{"id":"constants-window","label":"Window","collapsed":false},{"id":"constants-pane","label":"Pane","collapsed":false},{"id":"constants-client","label":"Client","collapsed":false}]},{"id":"runtime","label":"Runtime adapters","collapsed":false},{"id":"async","label":"Async","collapsed":false},{"id":"mcp","label":"MCP","collapsed":true,"children":[{"id":"mcp-functions","label":"Functions","collapsed":false},{"id":"mcp-constants","label":"Constants and variables","collapsed":false}]},{"id":"testing","label":"Testing utilities","collapsed":true},{"id":"internal","label":"Internal","collapsed":true,"children":[{"id":"internal-commands","label":"Commands","collapsed":false},{"id":"internal-options","label":"Options","collapsed":false}]}],"assignments":{"server":[{"id":"LibTmux.Server","name":"Server","slug":"libtmux-server","kind":"struct"}],"session":[{"id":"LibTmux.Session","name":"Session","slug":"libtmux-session","kind":"struct"}],"window":[{"id":"LibTmux.Window","name":"Window","slug":"libtmux-window","kind":"struct"},{"id":"LibTmux.WindowLink","name":"WindowLink","slug":"libtmux-windowlink","kind":"struct"}],"pane":[{"id":"LibTmux.Pane","name":"Pane","slug":"libtmux-pane","kind":"struct"}],"client":[{"id":"LibTmux.Client","name":"Client","slug":"libtmux-client","kind":"struct"}],"hooks":[],"options":[],"options-functions":[],"options-constants":[],"keys":[],"buffers":[],"layout":[],"environment":[],"capabilities":[],"version":[],"commands":[{"id":"LibTmux.Command","name":"Command","slug":"libtmux-command","kind":"struct"},{"id":"LibTmux.Deadline","name":"Deadline","slug":"libtmux-deadline","kind":"struct"},{"id":"LibTmux.Operation","name":"Operation","slug":"libtmux-operation","kind":"struct"},{"id":"LibTmux.Transport.OneShot","name":"OneShot","slug":"libtmux-transport-oneshot","kind":"module"}],"control":[{"id":"LibTmux.Control","name":"Control","slug":"libtmux-control","kind":"struct"},{"id":"LibTmux.Protocol","name":"Protocol","slug":"libtmux-protocol","kind":"struct"}],"formats":[{"id":"LibTmux.Codec","name":"Codec","slug":"libtmux-codec","kind":"module"},{"id":"LibTmux.Format","name":"Format","slug":"libtmux-format","kind":"module"}],"queries":[{"id":"LibTmux.Filter","name":"Filter","slug":"libtmux-filter","kind":"struct"},{"id":"LibTmux.Schema","name":"Schema","slug":"libtmux-schema","kind":"module"},{"id":"LibTmux.Selection","name":"Selection","slug":"libtmux-selection","kind":"struct"},{"id":"LibTmux.Wire","name":"Wire","slug":"libtmux-wire","kind":"module"}],"queries-fields":[],"queries-operators":[],"queries-expressions":[],"snapshots":[{"id":"LibTmux.Capture","name":"Capture","slug":"libtmux-capture","kind":"module"},{"id":"LibTmux.Ref","name":"Ref","slug":"libtmux-ref","kind":"struct"},{"id":"LibTmux.Snapshot","name":"Snapshot","slug":"libtmux-snapshot","kind":"struct"}],"workspace":[],"workspace-plan":[],"workspace-steps":[],"workspace-targets":[],"workspace-session":[],"workspace-window":[],"workspace-pane":[],"workspace-functions":[],"workspace-constants":[],"requests":[{"id":"LibTmux.Control.Request","name":"Request","slug":"libtmux-control-request","kind":"struct"}],"requests-server":[],"requests-session":[],"requests-window":[],"requests-pane":[],"requests-client":[],"errors":[{"id":"LibTmux.Error","name":"Error","slug":"libtmux-error","kind":"exception"}],"errors-server":[],"errors-session":[],"errors-window":[],"errors-pane":[],"constants":[],"constants-server":[],"constants-session":[],"constants-window":[],"constants-pane":[],"constants-client":[],"runtime":[],"async":[],"mcp":[],"mcp-functions":[],"mcp-constants":[],"testing":[],"internal":[],"internal-commands":[],"internal-options":[]},"placement":{"LibTmux.Server":"server","LibTmux.Session":"session","LibTmux.Window":"window","LibTmux.WindowLink":"window","LibTmux.Pane":"pane","LibTmux.Client":"client","LibTmux.Command":"commands","LibTmux.Deadline":"commands","LibTmux.Operation":"commands","LibTmux.Transport.OneShot":"commands","LibTmux.Control":"control","LibTmux.Protocol":"control","LibTmux.Codec":"formats","LibTmux.Format":"formats","LibTmux.Filter":"queries","LibTmux.Schema":"queries","LibTmux.Selection":"queries","LibTmux.Wire":"queries","LibTmux.Capture":"snapshots","LibTmux.Ref":"snapshots","LibTmux.Snapshot":"snapshots","LibTmux.Control.Request":"requests","LibTmux.Error":"errors"},"unplaced":[],"diagnostics":{"unmatched":[],"deadBuckets":["hooks","options","options-functions","options-constants","keys","buffers","layout","environment","capabilities","version","queries-fields","queries-operators","queries-expressions","workspace","workspace-plan","workspace-steps","workspace-targets","workspace-session","workspace-window","workspace-pane","workspace-functions","workspace-constants","requests-server","requests-session","requests-window","requests-pane","requests-client","errors-server","errors-session","errors-window","errors-pane","constants","constants-server","constants-session","constants-window","constants-pane","constants-client","runtime","async","mcp","mcp-functions","mcp-constants","testing","internal","internal-commands","internal-options"],"ambiguous":[],"staleUnsettled":[]}} +{"port":"elixir","buckets":[{"id":"server","label":"Server","collapsed":false},{"id":"session","label":"Session","collapsed":false},{"id":"window","label":"Window","collapsed":false},{"id":"pane","label":"Pane","collapsed":false},{"id":"client","label":"Client","collapsed":false},{"id":"hooks","label":"Hooks","collapsed":false},{"id":"options","label":"Options","collapsed":false,"children":[{"id":"options-functions","label":"Functions","collapsed":false},{"id":"options-constants","label":"Constants and variables","collapsed":false}]},{"id":"keys","label":"Keys and bindings","collapsed":false},{"id":"buffers","label":"Buffers","collapsed":false},{"id":"layout","label":"Layout and geometry","collapsed":false},{"id":"environment","label":"Environment","collapsed":false},{"id":"capabilities","label":"Terminal capabilities","collapsed":false},{"id":"version","label":"Versions","collapsed":false},{"id":"commands","label":"Commands","collapsed":false},{"id":"control","label":"Control mode","collapsed":false},{"id":"formats","label":"Formats","collapsed":false},{"id":"queries","label":"Queries","collapsed":false,"children":[{"id":"queries-fields","label":"Fields","collapsed":false},{"id":"queries-operators","label":"Operators","collapsed":false},{"id":"queries-expressions","label":"Expressions","collapsed":false}]},{"id":"snapshots","label":"Snapshots","collapsed":false},{"id":"workspace","label":"Workspaces","collapsed":false,"children":[{"id":"workspace-plan","label":"Plans","collapsed":false},{"id":"workspace-steps","label":"Steps","collapsed":false},{"id":"workspace-targets","label":"Targets and slots","collapsed":false},{"id":"workspace-session","label":"Session","collapsed":false},{"id":"workspace-window","label":"Window","collapsed":false},{"id":"workspace-pane","label":"Pane","collapsed":false},{"id":"workspace-functions","label":"Functions","collapsed":false},{"id":"workspace-constants","label":"Constants and variables","collapsed":false}]},{"id":"requests","label":"Requests","collapsed":true,"children":[{"id":"requests-server","label":"Server","collapsed":false},{"id":"requests-session","label":"Session","collapsed":false},{"id":"requests-window","label":"Window","collapsed":false},{"id":"requests-pane","label":"Pane","collapsed":false},{"id":"requests-client","label":"Client","collapsed":false}]},{"id":"errors","label":"Errors","collapsed":true,"children":[{"id":"errors-server","label":"Server","collapsed":false},{"id":"errors-session","label":"Session","collapsed":false},{"id":"errors-window","label":"Window","collapsed":false},{"id":"errors-pane","label":"Pane","collapsed":false}]},{"id":"constants","label":"Constants and enums","collapsed":true,"children":[{"id":"constants-server","label":"Server","collapsed":false},{"id":"constants-session","label":"Session","collapsed":false},{"id":"constants-window","label":"Window","collapsed":false},{"id":"constants-pane","label":"Pane","collapsed":false},{"id":"constants-client","label":"Client","collapsed":false}]},{"id":"runtime","label":"Runtime adapters","collapsed":false},{"id":"async","label":"Async","collapsed":false},{"id":"mcp","label":"MCP","collapsed":true,"children":[{"id":"mcp-functions","label":"Functions","collapsed":false},{"id":"mcp-constants","label":"Constants and variables","collapsed":false}]},{"id":"testing","label":"Testing utilities","collapsed":true},{"id":"internal","label":"Internal","collapsed":true,"children":[{"id":"internal-commands","label":"Commands","collapsed":false},{"id":"internal-options","label":"Options","collapsed":false}]}],"assignments":{"server":[{"id":"LibTmux.Server","name":"Server","slug":"libtmux-server","kind":"struct"}],"session":[{"id":"LibTmux.Session","name":"Session","slug":"libtmux-session","kind":"struct"}],"window":[{"id":"LibTmux.Window","name":"Window","slug":"libtmux-window","kind":"struct"},{"id":"LibTmux.WindowLink","name":"WindowLink","slug":"libtmux-windowlink","kind":"struct"}],"pane":[{"id":"LibTmux.Pane","name":"Pane","slug":"libtmux-pane","kind":"struct"}],"client":[{"id":"LibTmux.Client","name":"Client","slug":"libtmux-client","kind":"struct"}],"hooks":[],"options":[],"options-functions":[],"options-constants":[],"keys":[],"buffers":[],"layout":[],"environment":[],"capabilities":[],"version":[],"commands":[{"id":"LibTmux.Command","name":"Command","slug":"libtmux-command","kind":"struct"},{"id":"LibTmux.Deadline","name":"Deadline","slug":"libtmux-deadline","kind":"struct"},{"id":"LibTmux.Operation","name":"Operation","slug":"libtmux-operation","kind":"struct"},{"id":"LibTmux.Transport.OneShot","name":"OneShot","slug":"libtmux-transport-oneshot","kind":"module"}],"control":[{"id":"LibTmux.Control","name":"Control","slug":"libtmux-control","kind":"struct"},{"id":"LibTmux.Protocol","name":"Protocol","slug":"libtmux-protocol","kind":"struct"}],"formats":[{"id":"LibTmux.Codec","name":"Codec","slug":"libtmux-codec","kind":"module"},{"id":"LibTmux.Format","name":"Format","slug":"libtmux-format","kind":"module"}],"queries":[{"id":"LibTmux.Filter","name":"Filter","slug":"libtmux-filter","kind":"struct"},{"id":"LibTmux.Schema","name":"Schema","slug":"libtmux-schema","kind":"module"},{"id":"LibTmux.Selection","name":"Selection","slug":"libtmux-selection","kind":"struct"},{"id":"LibTmux.Wire","name":"Wire","slug":"libtmux-wire","kind":"module"}],"queries-fields":[],"queries-operators":[],"queries-expressions":[],"snapshots":[{"id":"LibTmux.Capture","name":"Capture","slug":"libtmux-capture","kind":"module"},{"id":"LibTmux.Ref","name":"Ref","slug":"libtmux-ref","kind":"struct"},{"id":"LibTmux.Snapshot","name":"Snapshot","slug":"libtmux-snapshot","kind":"struct"}],"workspace":[],"workspace-plan":[],"workspace-steps":[],"workspace-targets":[],"workspace-session":[],"workspace-window":[],"workspace-pane":[],"workspace-functions":[],"workspace-constants":[],"requests":[{"id":"LibTmux.Control.Request","name":"Request","slug":"libtmux-control-request","kind":"struct"}],"requests-server":[],"requests-session":[],"requests-window":[],"requests-pane":[],"requests-client":[],"errors":[{"id":"LibTmux.Action.CompletionError","name":"CompletionError","slug":"libtmux-action-completionerror","kind":"exception"},{"id":"LibTmux.Control.ExecutionError","name":"ExecutionError","slug":"libtmux-control-executionerror","kind":"exception"},{"id":"LibTmux.Control.ScopeFailure","name":"ScopeFailure","slug":"libtmux-control-scopefailure","kind":"exception"},{"id":"LibTmux.Error","name":"Error","slug":"libtmux-error","kind":"exception"}],"errors-server":[],"errors-session":[],"errors-window":[],"errors-pane":[],"constants":[{"id":"LibTmux.Action","name":"Action","slug":"libtmux-action","kind":"module"}],"constants-server":[],"constants-session":[],"constants-window":[],"constants-pane":[],"constants-client":[],"runtime":[],"async":[],"mcp":[],"mcp-functions":[],"mcp-constants":[],"testing":[],"internal":[],"internal-commands":[],"internal-options":[]},"placement":{"LibTmux.Server":"server","LibTmux.Session":"session","LibTmux.Window":"window","LibTmux.WindowLink":"window","LibTmux.Pane":"pane","LibTmux.Client":"client","LibTmux.Command":"commands","LibTmux.Deadline":"commands","LibTmux.Operation":"commands","LibTmux.Transport.OneShot":"commands","LibTmux.Control":"control","LibTmux.Protocol":"control","LibTmux.Codec":"formats","LibTmux.Format":"formats","LibTmux.Filter":"queries","LibTmux.Schema":"queries","LibTmux.Selection":"queries","LibTmux.Wire":"queries","LibTmux.Capture":"snapshots","LibTmux.Ref":"snapshots","LibTmux.Snapshot":"snapshots","LibTmux.Control.Request":"requests","LibTmux.Action.CompletionError":"errors","LibTmux.Control.ExecutionError":"errors","LibTmux.Control.ScopeFailure":"errors","LibTmux.Error":"errors","LibTmux.Action":"constants"},"unplaced":[],"diagnostics":{"unmatched":[],"deadBuckets":["hooks","options","options-functions","options-constants","keys","buffers","layout","environment","capabilities","version","queries-fields","queries-operators","queries-expressions","workspace","workspace-plan","workspace-steps","workspace-targets","workspace-session","workspace-window","workspace-pane","workspace-functions","workspace-constants","requests-server","requests-session","requests-window","requests-pane","requests-client","errors-server","errors-session","errors-window","errors-pane","constants-server","constants-session","constants-window","constants-pane","constants-client","runtime","async","mcp","mcp-functions","mcp-constants","testing","internal","internal-commands","internal-options"],"ambiguous":[],"staleUnsettled":[]}} diff --git a/site/src/data/api/elixir.paths.json b/site/src/data/api/elixir.paths.json index ca2c2708d..e69be83f2 100644 --- a/site/src/data/api/elixir.paths.json +++ b/site/src/data/api/elixir.paths.json @@ -1 +1 @@ -{"port":"elixir","repo":"libtmux/libtmux-elixir","revision":"6e6e88e886bdd9267fcd8be66f561dc5d5462476","paths":[".formatter.exs",".github/CONTRIBUTING.md",".github/WRITING.md",".github/workflows/docs-preview-cleanup.yml",".github/workflows/docs.yml",".github/workflows/release.yml",".github/workflows/scaffold.yml",".gitignore",".tool-versions","AGENTS.md","CHANGELOG.md","CLAUDE.md","LICENSE","README.md","c_src/README.md","c_src/owned_io.c","docs/assets/apple-touch-icon-dark.png","docs/assets/apple-touch-icon-light.png","docs/assets/favicon.ico","docs/assets/logo-32.png","docs/assets/logo-512.png","docs/assets/logo.svg","docs/assets/opengraph-dark.png","docs/assets/opengraph-light.png","docs/assets/source.json","docs/assets/twitter-dark.png","docs/assets/twitter-light.png","docs/branding.md","docs/design.md","docs/encoding.md","docs/filtering.md","docs/first-task.md","docs/implementation.md","docs/mental-model.md","docs/observations.md","docs/ownership.md","docs/schema.md","examples/capture_and_read.exs","examples/quickstart.exs","lib/libtmux/capture.ex","lib/libtmux/codec.ex","lib/libtmux/command.ex","lib/libtmux/control.ex","lib/libtmux/control/admission.ex","lib/libtmux/control/births.ex","lib/libtmux/control/bootstrap.ex","lib/libtmux/control/connection_supervisor.ex","lib/libtmux/control/epoch_host.ex","lib/libtmux/control/epoch_supervisor.ex","lib/libtmux/control/exchange.ex","lib/libtmux/control/guardian.ex","lib/libtmux/control/inbox.ex","lib/libtmux/control/lifetime.ex","lib/libtmux/control/manager.ex","lib/libtmux/control/owned_term.ex","lib/libtmux/control/records.ex","lib/libtmux/control/request.ex","lib/libtmux/control/router.ex","lib/libtmux/control/start.ex","lib/libtmux/control/supervisor_start.ex","lib/libtmux/control/waiters.ex","lib/libtmux/deadline.ex","lib/libtmux/entities.ex","lib/libtmux/error.ex","lib/libtmux/filter.ex","lib/libtmux/filter/evaluator.ex","lib/libtmux/filter/wire.ex","lib/libtmux/format.ex","lib/libtmux/operation.ex","lib/libtmux/operation/lifecycle.ex","lib/libtmux/process_identity.ex","lib/libtmux/protocol.ex","lib/libtmux/ref.ex","lib/libtmux/schema.ex","lib/libtmux/selection.ex","lib/libtmux/server.ex","lib/libtmux/snapshot.ex","lib/libtmux/transport/native.ex","lib/libtmux/transport/native/driver.ex","lib/libtmux/transport/native/protocol.ex","lib/libtmux/transport/oneshot.ex","lib/libtmux/transport/reply.ex","lib/libtmux/wire.ex","mix.exs","mix.lock","mix_tasks/compile.libtmux_io.ex","packages/mcp/LICENSE","packages/mcp/README.md","packages/mcp/assets/apple-touch-icon-dark.png","packages/mcp/assets/apple-touch-icon-light.png","packages/mcp/assets/favicon.ico","packages/mcp/assets/logo-32.png","packages/mcp/assets/logo-512.png","packages/mcp/assets/logo.svg","packages/mcp/assets/opengraph-dark.png","packages/mcp/assets/opengraph-light.png","packages/mcp/assets/source.json","packages/mcp/assets/twitter-dark.png","packages/mcp/assets/twitter-light.png","packages/mcp/mix.exs","packages/workspace/LICENSE","packages/workspace/README.md","packages/workspace/assets/apple-touch-icon-dark.png","packages/workspace/assets/apple-touch-icon-light.png","packages/workspace/assets/favicon.ico","packages/workspace/assets/logo-32.png","packages/workspace/assets/logo-512.png","packages/workspace/assets/logo.svg","packages/workspace/assets/opengraph-dark.png","packages/workspace/assets/opengraph-light.png","packages/workspace/assets/source.json","packages/workspace/assets/twitter-dark.png","packages/workspace/assets/twitter-light.png","packages/workspace/mix.exs","priv/tmux/support.json","scripts/check_consumer_types.exs","scripts/check_docs_links.py","scripts/check_example_docs.py","scripts/check_examples.exs","scripts/check_hex_install.exs","scripts/check_package.exs","scripts/check_public_contracts.exs","scripts/check_public_types.exs","scripts/check_release.exs","scripts/check_runtime.exs","scripts/generate_schema.exs","test/capture_test.exs","test/codec_test.exs","test/command_codec_integration_test.exs","test/command_test.exs","test/control_admission_test.exs","test/control_await_death_integration_test.exs","test/control_births_test.exs","test/control_bootstrap_test.exs","test/control_codec_integration_test.exs","test/control_cold_startup_integration_test.exs","test/control_connection_supervisor_test.exs","test/control_death_integration_test.exs","test/control_finalization_expiry_integration_test.exs","test/control_finalization_integration_test.exs","test/control_guardian_integration_test.exs","test/control_guardian_test.exs","test/control_inbox_test.exs","test/control_lifetime_test.exs","test/control_manager_integration_test.exs","test/control_manager_test.exs","test/control_partial_write_integration_test.exs","test/control_preready_integration_test.exs","test/control_public_start_test.exs","test/control_publisher_integration_test.exs","test/control_receive_integration_test.exs","test/control_records_test.exs","test/control_request_test.exs","test/control_router_integration_test.exs","test/control_router_test.exs","test/control_short_write_integration_test.exs","test/control_startup_test.exs","test/control_supervisor_start_test.exs","test/control_target_integration_test.exs","test/control_test.exs","test/control_waiters_test.exs","test/deadline_test.exs","test/filter_wire_test.exs","test/fixtures/compiler/dependent_codec.ex","test/fixtures/compiler/invalid_operation.ex","test/fixtures/compiler/invalid_parser.ex","test/fixtures/compiler/invalid_reference.ex","test/fixtures/compiler/valid.ex","test/native_duplex_test.exs","test/native_ownership_test.exs","test/native_protocol_test.exs","test/oneshot_test.exs","test/operation_lifecycle_test.exs","test/operation_test.exs","test/owned_tmux_test.exs","test/protocol_test.exs","test/public_types_test.exs","test/quickstart_example_integration_test.exs","test/quickstart_example_test.exs","test/ref_test.exs","test/reply_test.exs","test/selection_filter_test.exs","test/snapshot_test.exs","test/support/cold_startup_reply.exs","test/support/control_exit.py","test/support/io_bound.exs","test/support/io_contract.py","test/support/io_faults.py","test/support/io_vm_death.py","test/support/libtmux_io_vm.erl","test/support/native_driver.ex","test/support/native_peer.ex","test/support/owned_tmux.ex","test/support/owned_tmux.py","test/support/query_graph.ex","test/support/short_write.h","test/test_helper.exs"]} +{"port":"elixir","repo":"libtmux/libtmux-elixir","revision":"86ad4ca80f157adb0c11f6bf7c371b04ca5aa688","paths":[".formatter.exs",".github/CONTRIBUTING.md",".github/SCRIPTS.md",".github/WRITING.md",".github/workflows/docs-preview-cleanup.yml",".github/workflows/docs.yml",".github/workflows/release.yml",".github/workflows/scaffold.yml",".gitignore",".tool-versions","AGENTS.md","CHANGELOG.md","CLAUDE.md","LICENSE","README.md","c_src/README.md","c_src/owned_io.c","docs/advanced-execution.md","docs/api-examples.md","docs/assets/apple-touch-icon-dark.png","docs/assets/apple-touch-icon-light.png","docs/assets/favicon.ico","docs/assets/logo-32.png","docs/assets/logo-512.png","docs/assets/logo.svg","docs/assets/opengraph-dark.png","docs/assets/opengraph-light.png","docs/assets/source.json","docs/assets/twitter-dark.png","docs/assets/twitter-light.png","docs/branding.md","docs/design.md","docs/encoding.md","docs/filtering.md","docs/first-task.md","docs/implementation.md","docs/managed-control.md","docs/mental-model.md","docs/observations.md","docs/one-shot-actions.md","docs/owned-server.md","docs/ownership.md","docs/recovery.md","docs/schema.md","docs/standalone-demo.md","docs/supervised-control.md","examples/capture_and_filter.exs","examples/capture_and_read.exs","examples/choose_server.exs","examples/encoding_values.exs","examples/filtering.exs","examples/managed_control.exs","examples/one_shot_actions.exs","examples/private_server.exs","examples/query_values.exs","examples/quickstart.exs","examples/readme.exs","examples/recover_command.exs","examples/supervised_control.exs","lib/libtmux/action.ex","lib/libtmux/action/completion_error.ex","lib/libtmux/capture.ex","lib/libtmux/capture/row.ex","lib/libtmux/codec.ex","lib/libtmux/command.ex","lib/libtmux/control.ex","lib/libtmux/control/admission.ex","lib/libtmux/control/births.ex","lib/libtmux/control/bootstrap.ex","lib/libtmux/control/connection_supervisor.ex","lib/libtmux/control/epoch_host.ex","lib/libtmux/control/epoch_supervisor.ex","lib/libtmux/control/exchange.ex","lib/libtmux/control/execution_error.ex","lib/libtmux/control/guardian.ex","lib/libtmux/control/inbox.ex","lib/libtmux/control/lifetime.ex","lib/libtmux/control/manager.ex","lib/libtmux/control/owned_term.ex","lib/libtmux/control/records.ex","lib/libtmux/control/request.ex","lib/libtmux/control/router.ex","lib/libtmux/control/scope.ex","lib/libtmux/control/scope_failure.ex","lib/libtmux/control/start.ex","lib/libtmux/control/supervisor_start.ex","lib/libtmux/control/waiters.ex","lib/libtmux/deadline.ex","lib/libtmux/entities.ex","lib/libtmux/error.ex","lib/libtmux/filter.ex","lib/libtmux/filter/evaluator.ex","lib/libtmux/filter/wire.ex","lib/libtmux/format.ex","lib/libtmux/operation.ex","lib/libtmux/operation/lifecycle.ex","lib/libtmux/process_identity.ex","lib/libtmux/protocol.ex","lib/libtmux/ref.ex","lib/libtmux/schema.ex","lib/libtmux/selection.ex","lib/libtmux/server.ex","lib/libtmux/server/daemon.ex","lib/libtmux/snapshot.ex","lib/libtmux/transport/native.ex","lib/libtmux/transport/native/driver.ex","lib/libtmux/transport/native/protocol.ex","lib/libtmux/transport/oneshot.ex","lib/libtmux/transport/reply.ex","lib/libtmux/wire.ex","mix.exs","mix.lock","mix_tasks/compile.libtmux_io.ex","priv/tmux/support.json","scripts/check_consumer_types.exs","scripts/check_docs_links/README.md","scripts/check_docs_links/check_docs_links.exs","scripts/check_docs_links/tests/check_docs_links_test.exs","scripts/check_example_docs/README.md","scripts/check_example_docs/check_example_docs.exs","scripts/check_example_docs/tests/check_example_docs_test.exs","scripts/check_examples.exs","scripts/check_hex_install.exs","scripts/check_package.exs","scripts/check_public_contracts.exs","scripts/check_public_types.exs","scripts/check_release/README.md","scripts/check_release/check_release.exs","scripts/check_release/tests/check_release_test.exs","scripts/check_runtime/README.md","scripts/check_runtime/check_runtime.exs","scripts/check_runtime/tests/check_runtime_test.exs","scripts/ci_plan/README.md","scripts/ci_plan/ci_plan.exs","scripts/ci_plan/tests/ci_docs_test.exs","scripts/ci_plan/tests/ci_plan_test.exs","scripts/ci_plan/tests/ci_workflow_test.exs","scripts/docs_preview_cleanup/README.md","scripts/docs_preview_cleanup/docs_preview_cleanup.exs","scripts/docs_preview_cleanup/tests/docs_preview_cleanup_test.exs","scripts/generate_schema.exs","scripts/wait_for_hexdocs/README.md","scripts/wait_for_hexdocs/tests/wait_for_hexdocs_test.exs","scripts/wait_for_hexdocs/wait_for_hexdocs.exs","test/action_test.exs","test/api_examples_integration_test.exs","test/capture_row_test.exs","test/capture_test.exs","test/codec_test.exs","test/command_codec_integration_test.exs","test/command_test.exs","test/control_admission_test.exs","test/control_await_death_integration_test.exs","test/control_births_test.exs","test/control_bootstrap_test.exs","test/control_codec_integration_test.exs","test/control_cold_startup_integration_test.exs","test/control_connection_supervisor_test.exs","test/control_death_integration_test.exs","test/control_exchange_test.exs","test/control_execute_integration_test.exs","test/control_finalization_expiry_integration_test.exs","test/control_finalization_integration_test.exs","test/control_guardian_integration_test.exs","test/control_guardian_test.exs","test/control_inbox_test.exs","test/control_lifetime_test.exs","test/control_manager_integration_test.exs","test/control_manager_test.exs","test/control_ownership_traces_test.exs","test/control_partial_write_integration_test.exs","test/control_preready_integration_test.exs","test/control_public_start_test.exs","test/control_publisher_integration_test.exs","test/control_receive_integration_test.exs","test/control_records_test.exs","test/control_request_test.exs","test/control_router_integration_test.exs","test/control_router_test.exs","test/control_scope_integration_test.exs","test/control_short_write_integration_test.exs","test/control_startup_test.exs","test/control_supervisor_start_test.exs","test/control_target_integration_test.exs","test/control_test.exs","test/control_waiters_test.exs","test/deadline_test.exs","test/domain_actions_integration_test.exs","test/domain_actions_test.exs","test/filter_wire_test.exs","test/fixtures/compiler/dependent_action.ex","test/fixtures/compiler/dependent_codec.ex","test/fixtures/compiler/invalid_operation.ex","test/fixtures/compiler/invalid_parser.ex","test/fixtures/compiler/invalid_reference.ex","test/fixtures/compiler/valid.ex","test/kill_integration_test.exs","test/native_contract_test.exs","test/native_duplex_test.exs","test/native_ownership_test.exs","test/native_protocol_test.exs","test/oneshot_test.exs","test/operation_lifecycle_test.exs","test/operation_test.exs","test/owned_tmux_test.exs","test/protocol_test.exs","test/public_types_test.exs","test/quickstart_example_integration_test.exs","test/quickstart_example_test.exs","test/recovery_example_integration_test.exs","test/ref_test.exs","test/reply_test.exs","test/sandbox_guard_test.exs","test/selection_filter_test.exs","test/server_lifecycle_integration_test.exs","test/server_lifecycle_test.exs","test/server_socket_integration_test.exs","test/server_socket_test.exs","test/snapshot_test.exs","test/support/child.ex","test/support/cold_startup_reply.exs","test/support/fifo.ex","test/support/helper_peer.ex","test/support/io_vm.ex","test/support/native_driver.ex","test/support/native_peer.ex","test/support/owned_tmux.ex","test/support/processes.ex","test/support/query_graph.ex","test/support/recorder.ex","test/support/recovery_cases.exs","test/support/sandbox_guard.ex","test/support/short_write.h","test/support/split_argv.c","test/support/split_argv_lifetime.exs","test/support/supervision_cases.exs","test/support/tmux_path.ex","test/test_helper.exs"]} diff --git a/site/src/data/core-recordings/elixir.json b/site/src/data/core-recordings/elixir.json index acfebfd21..688fa7cff 100644 --- a/site/src/data/core-recordings/elixir.json +++ b/site/src/data/core-recordings/elixir.json @@ -4,8 +4,8 @@ "repo": "libtmux/libtmux-elixir", "revision": "a740a1308e51e5e975d4239e0e017efacf4cb169", "sandbox": { - "tmux": "tmux 3.8a", - "elixir": "1.20.4", + "tmux": "tmux 3.8", + "elixir": "1.20.5", "otp": "29", "shell": "/bin/sh", "rewritten": { @@ -18,14 +18,12 @@ "typed-graph": { "program": { "file": "quickstart.exs", - "sha256": "16d09ee54ef6e4073740b50fe6496b668e615fda51e2f97acfcb25b7fb54f86c" + "sha256": "a6c015c4d70737d9c739fde16b3f217d010553713372637d7b52049ae13db804" }, + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", "stepMap": "hand-written", "printed": [ - "session demo", - " window 0:editor: %0 %1", - " window 1:logs: %2", - "%1 is in window editor of session demo" + "demo: 2 windows, 3 panes" ], "tmuxBefore": { "sessions": [], @@ -34,20 +32,20 @@ }, "steps": [ { - "id": "daemon", - "label": "System.cmd", - "anchor": "{_, 0} = System.cmd(", - "type": "exit status", + "id": "create", + "label": "Server.new_session!", + "anchor": "Server.new_session!(", + "type": "map", "returned": { - "status": 0 + "id": "$0" }, "commands": [ { "role": "command", - "tmux": "new-session -d -s demo", + "tmux": "new-session -d -P -F #{session_id} -s demo -- /tmp/install/ex-1.20.5-erl-17.1.2/WG-c-6zwFGRn8rQm74yG4w/_build/prod/lib/libtmux/priv/native/aarch64-unknown-linux-gnu/libtmux_io --exec-one /bin/cat", "mutates": true, "exit": 0, - "stdout": "", + "stdout": "$0", "stderr": "" } ], @@ -64,49 +62,7 @@ "session": "$0", "id": "@0", "index": 0, - "name": "sh", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "server", - "label": "Server.new", - "anchor": "server = Server.new(", - "type": "Server", - "returned": { - "socket": "/tmp/tmp/libtmux-0123456789abcdef/tmux.sock", - "executable": "/usr/bin/tmux" - }, - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "sh", + "name": "libtmux_io", "active": true, "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" } @@ -115,7 +71,7 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -126,7 +82,7 @@ } }, { - "id": "snapshot-layout", + "id": "layout", "label": "Server.snapshot!", "anchor": "Server.snapshot!(server)", "occurrence": 1, @@ -166,7 +122,7 @@ "tmux": "list-panes -a -F '#{pane_id}\t#{window_id}\t#{pane_index}\t#{pane_active}\t#{pane_dead}\t#{pane_width}\t#{pane_height}\t#{pane_pid}\t#{pane_dead_status}'", "mutates": false, "exit": 0, - "stdout": "%0\t@0\t0\t1\t0\t80\t24\t3471676\t", + "stdout": "%0\t@0\t0\t1\t0\t80\t24\t533549\t", "stderr": "" }, { @@ -192,7 +148,7 @@ "tmux": "list-panes -a -F 'r1:4\tv1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\1…", "mutates": false, "exit": 0, - "stdout": "r1:4\tv1:%0\tv1:sh\tv1:/tmp/marked\tv1:host", + "stdout": "r1:4\tv1:%0\tv1:cat\tv1:/tmp/marked\tv1:host", "stderr": "", "shortened": true }, @@ -201,7 +157,7 @@ "tmux": "list-windows -a -F 'r1:3\tv1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\…", "mutates": false, "exit": 0, - "stdout": "r1:3\tv1:@0\tv1:sh\tv1:{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}", + "stdout": "r1:3\tv1:@0\tv1:libtmux_io\tv1:{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}", "stderr": "", "shortened": true }, @@ -226,7 +182,7 @@ "tmux": "list-panes -a -F '#{pane_id}\t#{window_id}\t#{pane_index}\t#{pane_active}\t#{pane_dead}\t#{pane_width}\t#{pane_height}\t#{pane_pid}\t#{pane_dead_status}'", "mutates": false, "exit": 0, - "stdout": "%0\t@0\t0\t1\t0\t80\t24\t3471676\t", + "stdout": "%0\t@0\t0\t1\t0\t80\t24\t533549\t", "stderr": "" }, { @@ -260,7 +216,7 @@ "session": "$0", "id": "@0", "index": 0, - "name": "sh", + "name": "libtmux_io", "active": true, "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" } @@ -269,7 +225,7 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -302,7 +258,7 @@ "session": "$0", "id": "@0", "index": 0, - "name": "sh", + "name": "libtmux_io", "active": true, "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" } @@ -311,7 +267,7 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -322,13 +278,12 @@ } }, { - "id": "active-window", - "label": "Session.active_window", - "anchor": "Session.active_window(", - "type": "Window", + "id": "pane", + "label": "Selection.one!", + "anchor": "Snapshot.panes() |> Selection.one!()", + "type": "Pane", "returned": { - "id": "@0", - "name": "sh" + "id": "%0" }, "commands": [], "transient": [], @@ -344,7 +299,7 @@ "session": "$0", "id": "@0", "index": 0, - "name": "sh", + "name": "libtmux_io", "active": true, "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" } @@ -353,7 +308,7 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -364,13 +319,12 @@ } }, { - "id": "ref-session", + "id": "session-ref", "label": "Ref.from_observation", "anchor": "Ref.from_observation(session)", "type": "Ref", "returned": { - "id": "$0", - "entity": "session" + "id": "$0" }, "commands": [], "transient": [], @@ -386,7 +340,7 @@ "session": "$0", "id": "@0", "index": 0, - "name": "sh", + "name": "libtmux_io", "active": true, "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" } @@ -395,7 +349,7 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -406,108 +360,10 @@ } }, { - "id": "ref-editor", + "id": "pane-ref", "label": "Ref.from_observation", - "anchor": "Ref.from_observation(editor)", + "anchor": "Ref.from_observation(pane)", "type": "Ref", - "returned": { - "id": "@0", - "entity": "window" - }, - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "sh", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "rename", - "label": "Window.rename!", - "anchor": "Window.rename!(", - "type": ":ok", - "returned": "ok", - "commands": [ - { - "role": "probe", - "tmux": "display-message -p #{pid}", - "mutates": false, - "exit": 0, - "stdout": "", - "stderr": "" - }, - { - "role": "command", - "tmux": "rename-window -t @0 -- editor", - "mutates": true, - "exit": 0, - "stdout": "", - "stderr": "" - } - ], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "active-pane", - "label": "Selection.one!", - "anchor": "Selection.one!(window_id: editor.id", - "type": "Pane", "returned": { "id": "%0" }, @@ -525,49 +381,7 @@ "session": "$0", "id": "@0", "index": 0, - "name": "editor", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "ref-left", - "label": "Ref.from_observation", - "anchor": "Ref.from_observation(left)", - "type": "Ref", - "returned": { - "id": "%0", - "entity": "pane" - }, - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", + "name": "libtmux_io", "active": true, "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"}}" } @@ -576,7 +390,7 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -605,7 +419,7 @@ }, { "role": "command", - "tmux": "split-window -t %0 -P -F #{pane_id} -h -d --", + "tmux": "split-window -t %0 -P -F #{pane_id} -v -d -- /tmp/install/ex-1.20.5-erl-17.1.2/WG-c-6zwFGRn8rQm74yG4w/_build/prod/lib/libtmux/priv/native/aarch64-unknown-linux-gnu/libtmux_io --exec-one /bin/cat", "mutates": true, "exit": 0, "stdout": "%1", @@ -625,30 +439,30 @@ "session": "$0", "id": "@0", "index": 0, - "name": "editor", + "name": "libtmux_io", "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" + "layout": "{\"V\":2,\"L\":{\"t\":\"v\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":80,\"h\":12,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":80,\"h\":11,\"x\":0,\"y\":13,\"i\":1,\"I\":\"%1\"}]}}" } ], "panes": [ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, - "width": 40, - "height": 24, + "width": 80, + "height": 12, "active": true }, { "window": "@0", "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, + "command": "cat", + "left": 0, + "top": 13, + "width": 80, + "height": 11, "active": false } ] @@ -673,7 +487,7 @@ }, { "role": "command", - "tmux": "new-window -d -P -F #{window_id} -t $0: -n logs --", + "tmux": "new-window -d -P -F #{window_id} -t $0: -n logs -- /tmp/install/ex-1.20.5-erl-17.1.2/WG-c-6zwFGRn8rQm74yG4w/_build/prod/lib/libtmux/priv/native/aarch64-unknown-linux-gnu/libtmux_io --exec-one /bin/cat", "mutates": true, "exit": 0, "stdout": "@1", @@ -693,9 +507,9 @@ "session": "$0", "id": "@0", "index": 0, - "name": "editor", + "name": "libtmux_io", "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" + "layout": "{\"V\":2,\"L\":{\"t\":\"v\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":80,\"h\":12,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":80,\"h\":11,\"x\":0,\"y\":13,\"i\":1,\"I\":\"%1\"}]}}" }, { "session": "$0", @@ -710,97 +524,27 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, - "width": 40, - "height": 24, + "width": 80, + "height": 12, "active": true }, { "window": "@0", "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": false - }, - { - "window": "@1", - "id": "%2", - "command": "sh", + "command": "cat", "left": 0, - "top": 0, + "top": 13, "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "ref-right", - "label": "Ref.new", - "anchor": "Ref.new(:pane", - "type": "Ref", - "returned": { - "id": "%1", - "entity": "pane" - }, - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": true - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, + "height": 11, "active": false }, { "window": "@1", "id": "%2", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -811,11 +555,16 @@ } }, { - "id": "send-text", - "label": "Pane.send_text!", - "anchor": "Pane.send_text!(", - "type": ":ok", - "returned": "ok", + "id": "snapshot", + "label": "Server.snapshot!", + "anchor": "Server.snapshot!(server)", + "occurrence": 2, + "type": "Snapshot", + "returned": { + "windows": 2, + "sessions": 1, + "panes": 3 + }, "commands": [ { "role": "probe", @@ -827,179 +576,103 @@ }, { "role": "command", - "tmux": "send-keys -H -t %1 -- 70 72 69 6E 74 66 20 27 68 65 6C 6C 6F 20 66 72 6F 6D 20 25 73 5C 6E 27 20 74 6D 75 78", - "mutates": true, + "tmux": "list-sessions -F '#{session_id}\t#{session_attached}'", + "mutates": false, "exit": 0, - "stdout": "", + "stdout": "$0\t0", "stderr": "" - } - ], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": true - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": false - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "send-keys", - "label": "Pane.send_keys!", - "anchor": "Pane.send_keys!(", - "type": ":ok", - "returned": "ok", - "commands": [ + }, { - "role": "probe", - "tmux": "display-message -p #{pid}", + "role": "command", + "tmux": "list-windows -a -F '#{session_id}\t#{window_index}\t#{window_id}\t#{window_active}\t#{window_width}\t#{window_height}\t#{window_zoomed_flag}'", "mutates": false, "exit": 0, - "stdout": "", + "stdout": "$0\t0\t@0\t1\t80\t24\t0\n$0\t1\t@1\t0\t80\t24\t0", "stderr": "" }, { "role": "command", - "tmux": "send-keys -t %1 -- Enter", - "mutates": true, + "tmux": "list-panes -a -F '#{pane_id}\t#{window_id}\t#{pane_index}\t#{pane_active}\t#{pane_dead}\t#{pane_width}\t#{pane_height}\t#{pane_pid}\t#{pane_dead_status}'", + "mutates": false, "exit": 0, - "stdout": "", + "stdout": "%0\t@0\t0\t1\t0\t80\t12\t533549\t\n%1\t@0\t1\t0\t0\t80\t11\t533912\t\n%2\t@1\t0\t1\t0\t80\t24\t533956\t", "stderr": "" - } - ], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": true - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": false - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "capture-1", - "label": "Pane.capture!", - "anchor": "Pane.capture!(", - "iteration": 1, - "type": "binary", - "returned": "$ printf 'hello from %s\\n' tmux\nhello from tmux\n$\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", - "commands": [ + }, { - "role": "probe", - "tmux": "display-message -p #{pid}", + "role": "command", + "tmux": "list-clients -F 'v1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\177|:cl…", "mutates": false, "exit": 0, "stdout": "", + "stderr": "", + "shortened": true + }, + { + "role": "command", + "tmux": "list-sessions -F 'r1:2\tv1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\1…", + "mutates": false, + "exit": 0, + "stdout": "r1:2\tv1:\\0440\tv1:demo", + "stderr": "", + "shortened": true + }, + { + "role": "command", + "tmux": "list-panes -a -F 'r1:4\tv1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\1…", + "mutates": false, + "exit": 0, + "stdout": "r1:4\tv1:%0\tv1:cat\tv1:/tmp/marked\tv1:host\nr1:4\tv1:%1\tv1:cat\tv1:/tmp/marked\tv1:host\nr1:4\tv1:%2\tv1:cat\tv1:/tmp/marked\tv1:host", + "stderr": "", + "shortened": true + }, + { + "role": "command", + "tmux": "list-windows -a -F 'r1:3\tv1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\…", + "mutates": false, + "exit": 0, + "stdout": "r1:3\tv1:@0\tv1:libtmux_io\tv1:{\"V\":2,\"L\":{\"t\":\"v\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":80,\"h\":12,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":80,\"h\":11,\"x\":0,\"y\":13,\"i\":1,\"I\":\"%1\"}]}}\nr1:3\tv1:@1\tv1:logs\tv1:{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}", + "stderr": "", + "shortened": true + }, + { + "role": "command", + "tmux": "list-sessions -F '#{session_id}\t#{session_attached}'", + "mutates": false, + "exit": 0, + "stdout": "$0\t0", + "stderr": "" + }, + { + "role": "command", + "tmux": "list-windows -a -F '#{session_id}\t#{window_index}\t#{window_id}\t#{window_active}\t#{window_width}\t#{window_height}\t#{window_zoomed_flag}'", + "mutates": false, + "exit": 0, + "stdout": "$0\t0\t@0\t1\t80\t24\t0\n$0\t1\t@1\t0\t80\t24\t0", + "stderr": "" + }, + { + "role": "command", + "tmux": "list-panes -a -F '#{pane_id}\t#{window_id}\t#{pane_index}\t#{pane_active}\t#{pane_dead}\t#{pane_width}\t#{pane_height}\t#{pane_pid}\t#{pane_dead_status}'", + "mutates": false, + "exit": 0, + "stdout": "%0\t@0\t0\t1\t0\t80\t12\t533549\t\n%1\t@0\t1\t0\t0\t80\t11\t533912\t\n%2\t@1\t0\t1\t0\t80\t24\t533956\t", "stderr": "" }, { "role": "command", - "tmux": "capture-pane -p -t %1 -S 0 -E -", + "tmux": "list-clients -F 'v1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\177|:cl…", + "mutates": false, + "exit": 0, + "stdout": "", + "stderr": "", + "shortened": true + }, + { + "role": "probe", + "tmux": "display-message -p #{pid}", "mutates": false, "exit": 0, - "stdout": "$ printf 'hello from %s\\n' tmux\nhello from tmux\n$\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", + "stdout": "", "stderr": "" } ], @@ -1016,9 +689,9 @@ "session": "$0", "id": "@0", "index": 0, - "name": "editor", + "name": "libtmux_io", "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" + "layout": "{\"V\":2,\"L\":{\"t\":\"v\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":80,\"h\":12,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":80,\"h\":11,\"x\":0,\"y\":13,\"i\":1,\"I\":\"%1\"}]}}" }, { "session": "$0", @@ -1033,27 +706,27 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, - "width": 40, - "height": 24, + "width": 80, + "height": 12, "active": true }, { "window": "@0", "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, + "command": "cat", + "left": 0, + "top": 13, + "width": 80, + "height": 11, "active": false }, { "window": "@1", "id": "%2", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -1064,17 +737,11 @@ } }, { - "id": "command-select-pane", - "label": "Command.new", - "anchor": "select_pane = Command.new(", - "type": "Command", - "returned": { - "args": [ - "-t", - "%1" - ], - "name": "select-pane" - }, + "id": "windows", + "label": "Selection.size", + "anchor": "Snapshot.windows() |> Selection.size()", + "type": "integer", + "returned": 2, "commands": [], "transient": [], "tmux": { @@ -1089,9 +756,9 @@ "session": "$0", "id": "@0", "index": 0, - "name": "editor", + "name": "libtmux_io", "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" + "layout": "{\"V\":2,\"L\":{\"t\":\"v\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":80,\"h\":12,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":80,\"h\":11,\"x\":0,\"y\":13,\"i\":1,\"I\":\"%1\"}]}}" }, { "session": "$0", @@ -1106,27 +773,27 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, - "width": 40, - "height": 24, + "width": 80, + "height": 12, "active": true }, { "window": "@0", "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, + "command": "cat", + "left": 0, + "top": 13, + "width": 80, + "height": 11, "active": false }, { "window": "@1", "id": "%2", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -1137,17 +804,11 @@ } }, { - "id": "command-select-window", - "label": "Command.new", - "anchor": "select_window = Command.new(", - "type": "Command", - "returned": { - "args": [ - "-t", - "@1" - ], - "name": "select-window" - }, + "id": "panes", + "label": "Selection.size", + "anchor": "Snapshot.panes() |> Selection.size()", + "type": "integer", + "returned": 3, "commands": [], "transient": [], "tmux": { @@ -1162,9 +823,9 @@ "session": "$0", "id": "@0", "index": 0, - "name": "editor", + "name": "libtmux_io", "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}" + "layout": "{\"V\":2,\"L\":{\"t\":\"v\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":80,\"h\":12,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":80,\"h\":11,\"x\":0,\"y\":13,\"i\":1,\"I\":\"%1\"}]}}" }, { "session": "$0", @@ -1179,107 +840,27 @@ { "window": "@0", "id": "%0", - "command": "sh", + "command": "cat", "left": 0, "top": 0, - "width": 40, - "height": 24, + "width": 80, + "height": 12, "active": true }, { "window": "@0", "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": false - }, - { - "window": "@1", - "id": "%2", - "command": "sh", + "command": "cat", "left": 0, - "top": 0, + "top": 13, "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "select-pane", - "label": "Server.run", - "anchor": "Server.run(server, select_pane)", - "type": "Result", - "returned": { - "exit_status": 0, - "stdout": "", - "stderr": "" - }, - "commands": [ - { - "role": "command", - "tmux": "select-pane -t %1", - "mutates": true, - "exit": 0, - "stdout": "", - "stderr": "" - } - ], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, + "height": 11, "active": false }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, { "window": "@1", "id": "%2", - "command": "sh", + "command": "cat", "left": 0, "top": 0, "width": 80, @@ -1290,774 +871,12 @@ } }, { - "id": "select-window", - "label": "Server.run", - "anchor": "Server.run(server, select_window)", - "type": "Result", - "returned": { - "exit_status": 0, - "stdout": "", - "stderr": "" - }, - "commands": [ - { - "role": "command", - "tmux": "select-window -t @1", - "mutates": true, - "exit": 0, - "stdout": "", - "stderr": "" - } - ], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "snapshot", - "label": "Server.snapshot!", - "anchor": "Server.snapshot!(server)", - "occurrence": 2, - "type": "Snapshot", - "returned": { - "windows": 2, - "sessions": 1, - "panes": 3 - }, - "commands": [ - { - "role": "probe", - "tmux": "display-message -p #{pid}", - "mutates": false, - "exit": 0, - "stdout": "", - "stderr": "" - }, - { - "role": "command", - "tmux": "list-sessions -F '#{session_id}\t#{session_attached}'", - "mutates": false, - "exit": 0, - "stdout": "$0\t0", - "stderr": "" - }, - { - "role": "command", - "tmux": "list-windows -a -F '#{session_id}\t#{window_index}\t#{window_id}\t#{window_active}\t#{window_width}\t#{window_height}\t#{window_zoomed_flag}'", - "mutates": false, - "exit": 0, - "stdout": "$0\t0\t@0\t0\t80\t24\t0\n$0\t1\t@1\t1\t80\t24\t0", - "stderr": "" - }, - { - "role": "command", - "tmux": "list-panes -a -F '#{pane_id}\t#{window_id}\t#{pane_index}\t#{pane_active}\t#{pane_dead}\t#{pane_width}\t#{pane_height}\t#{pane_pid}\t#{pane_dead_status}'", - "mutates": false, - "exit": 0, - "stdout": "%0\t@0\t0\t0\t0\t40\t24\t3471676\t\n%1\t@0\t1\t1\t0\t39\t24\t3472292\t\n%2\t@1\t0\t1\t0\t80\t24\t3472410\t", - "stderr": "" - }, - { - "role": "command", - "tmux": "list-clients -F 'v1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\177|:cl…", - "mutates": false, - "exit": 0, - "stdout": "", - "stderr": "", - "shortened": true - }, - { - "role": "command", - "tmux": "list-sessions -F 'r1:2\tv1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\1…", - "mutates": false, - "exit": 0, - "stdout": "r1:2\tv1:\\0440\tv1:demo", - "stderr": "", - "shortened": true - }, - { - "role": "command", - "tmux": "list-panes -a -F 'r1:4\tv1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\1…", - "mutates": false, - "exit": 0, - "stdout": "r1:4\tv1:%0\tv1:sh\tv1:/tmp/marked\tv1:host\nr1:4\tv1:%1\tv1:sh\tv1:/tmp/marked\tv1:host\nr1:4\tv1:%2\tv1:sh\tv1:/tmp/marked\tv1:host", - "stderr": "", - "shortened": true - }, - { - "role": "command", - "tmux": "list-windows -a -F 'r1:3\tv1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\…", - "mutates": false, - "exit": 0, - "stdout": "r1:3\tv1:@0\tv1:editor\tv1:{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}\nr1:3\tv1:@1\tv1:logs\tv1:{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}", - "stderr": "", - "shortened": true - }, - { - "role": "command", - "tmux": "list-sessions -F '#{session_id}\t#{session_attached}'", - "mutates": false, - "exit": 0, - "stdout": "$0\t0", - "stderr": "" - }, - { - "role": "command", - "tmux": "list-windows -a -F '#{session_id}\t#{window_index}\t#{window_id}\t#{window_active}\t#{window_width}\t#{window_height}\t#{window_zoomed_flag}'", - "mutates": false, - "exit": 0, - "stdout": "$0\t0\t@0\t0\t80\t24\t0\n$0\t1\t@1\t1\t80\t24\t0", - "stderr": "" - }, - { - "role": "command", - "tmux": "list-panes -a -F '#{pane_id}\t#{window_id}\t#{pane_index}\t#{pane_active}\t#{pane_dead}\t#{pane_width}\t#{pane_height}\t#{pane_pid}\t#{pane_dead_status}'", - "mutates": false, - "exit": 0, - "stdout": "%0\t@0\t0\t0\t0\t40\t24\t3471676\t\n%1\t@0\t1\t1\t0\t39\t24\t3472292\t\n%2\t@1\t0\t1\t0\t80\t24\t3472410\t", - "stderr": "" - }, - { - "role": "command", - "tmux": "list-clients -F 'v1:#{s|\\\\|\\\\134|;s|\\$|\\\\044|;s|\u0001|\\\\001|;s|\u0002|\\\\002|;s|\u0003|\\\\003|;s|\u0004|\\\\004|;s|\u0005|\\\\005|;s|\u0006|\\\\006|;s|\u0007|\\\\007|;s|\b|\\\\010|;s|\t|\\\\011|;s|\n|\\\\012|;s|\u000b|\\\\013|;s|\f|\\\\014|;s|\r|\\\\015|;s|\u000e|\\\\016|;s|\u000f|\\\\017|;s|\u0010|\\\\020|;s|\u0011|\\\\021|;s|\u0012|\\\\022|;s|\u0013|\\\\023|;s|\u0014|\\\\024|;s|\u0015|\\\\025|;s|\u0016|\\\\026|;s|\u0017|\\\\027|;s|\u0018|\\\\030|;s|\u0019|\\\\031|;s|\u001a|\\\\032|;s|\u001b|\\\\033|;s|\u001c|\\\\034|;s|\u001d|\\\\035|;s|\u001e|\\\\036|;s|\u001f|\\\\037|;s||\\\\177|:cl…", - "mutates": false, - "exit": 0, - "stdout": "", - "stderr": "", - "shortened": true - }, - { - "role": "probe", - "tmux": "display-message -p #{pid}", - "mutates": false, - "exit": 0, - "stdout": "", - "stderr": "" - } - ], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "sessions", - "label": "Snapshot.sessions", - "anchor": "sessions = Snapshot.sessions(snapshot)", - "type": "Selection", - "returned": [ - { - "id": "$0", - "name": "demo" - } - ], - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "links-1", - "label": "Snapshot.related", - "anchor": "Snapshot.related(snapshot, :session, each.id", - "iteration": 1, - "type": "[WindowLink]", - "returned": [ - { - "index": 0, - "window": "@0" - }, - { - "index": 1, - "window": "@1" - } - ], - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "panes-1", - "label": "Window.panes", - "anchor": "Window.panes(snapshot, window)", - "iteration": 1, - "type": "Selection", - "returned": [ - "%0", - "%1" - ], - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "panes-2", - "label": "Window.panes", - "anchor": "Window.panes(snapshot, window)", - "iteration": 2, - "type": "Selection", - "returned": [ - "%2" - ], - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "pane", - "label": "Selection.one!", - "anchor": "Selection.one!(id: right_id)", - "type": "Pane", - "returned": { - "id": "%1" - }, - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "pane-window", - "label": "Snapshot.related", - "anchor": "Snapshot.related(snapshot, :pane", - "type": "Window", - "returned": { - "id": "@0", - "name": "editor" - }, - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "window-session", - "label": "Snapshot.related", - "anchor": "Snapshot.related(snapshot, :window, window.id", - "type": "[Session]", - "returned": { - "id": "$0", - "name": "demo" - }, - "commands": [], - "transient": [], - "tmux": { - "sessions": [ - { - "id": "$0", - "name": "demo" - } - ], - "windows": [ - { - "session": "$0", - "id": "@0", - "index": 0, - "name": "editor", - "active": false, - "layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"%1\"}]}}" - }, - { - "session": "$0", - "id": "@1", - "index": 1, - "name": "logs", - "active": true, - "layout": "{\"V\":2,\"L\":{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%2\"}}" - } - ], - "panes": [ - { - "window": "@0", - "id": "%0", - "command": "sh", - "left": 0, - "top": 0, - "width": 40, - "height": 24, - "active": false - }, - { - "window": "@0", - "id": "%1", - "command": "sh", - "left": 41, - "top": 0, - "width": 39, - "height": 24, - "active": true - }, - { - "window": "@1", - "id": "%2", - "command": "sh", - "left": 0, - "top": 0, - "width": 80, - "height": 24, - "active": true - } - ] - } - }, - { - "id": "kill-server", - "label": "System.cmd", - "anchor": "\"kill-server\"", - "type": "exit status", - "returned": { - "status": 0 - }, + "id": "retire", + "label": "Server.with_owned", + "anchor": "Server.with_owned(", + "marker": "end)", + "type": "socket removed", + "returned": true, "commands": [ { "role": "command", @@ -2069,6 +888,8 @@ } ], "transient": [], + "stopsServer": true, + "scopeExit": true, "tmux": { "sessions": [], "windows": [], diff --git a/site/src/data/home-examples.json b/site/src/data/home-examples.json index 63822cdf1..6eb90681e 100644 --- a/site/src/data/home-examples.json +++ b/site/src/data/home-examples.json @@ -572,12 +572,12 @@ "elixir": { "lang": "elixir", "sourceRepository": "libtmux/libtmux-elixir", - "sourceRevision": "a740a1308e51e5e975d4239e0e017efacf4cb169", - "sourceTree": "623133e2d512443e196749424980c166964815f8", + "sourceRevision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sourceTree": "1aec29dd3488235ec74fd14d4df0785afe21e222", "program": "quickstart.exs", "excerpt": { "startLine": 1, - "endLine": 75, + "endLine": 24, "dedent": 0, "importsEndLine": 0 }, @@ -585,20 +585,21 @@ { "name": "quickstart.exs", "lang": "elixir", - "code": "Mix.install([{:libtmux, \"0.1.1\"}])\n\nalias LibTmux.{Command, Pane, Ref, Selection, Server, Session, Snapshot, Window}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\nid = Base.encode16(:crypto.strong_rand_bytes(8), case: :lower)\ndir = Path.join(System.tmp_dir!(), \"libtmux-\" <> id)\nsocket = Path.join(dir, \"tmux.sock\")\nFile.mkdir!(dir)\nFile.chmod!(dir, 0o700)\n\ntry do\n # libtmux works on a running server, so tmux itself starts the private one.\n create = [\"new-session\", \"-d\", \"-s\", \"demo\"]\n {_, 0} = System.cmd(tmux, [\"-S\", socket, \"-f\", \"/dev/null\" | create])\n server = Server.new(executable: tmux, socket: socket)\n\n # Lay out the session: name its window, split it, add a second window.\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n editor = Session.active_window(snapshot, session)\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, editor_ref} = Ref.from_observation(editor)\n Window.rename!(server, editor_ref, \"editor\")\n left =\n snapshot\n |> Snapshot.panes()\n |> Selection.one!(window_id: editor.id, active: true)\n {:ok, left_ref} = Ref.from_observation(left)\n %{id: right_id} = Pane.split!(server, left_ref, axis: :horizontal)\n %{id: logs_id} = Session.new_window!(server, session_ref, \"logs\")\n {:ok, right} = Ref.new(:pane, right_id, session.server_instance)\n\n # Type a command into the new pane and wait for what it prints.\n Pane.send_text!(server, right, \"printf 'hello from %s\\\\n' tmux\")\n Pane.send_keys!(server, right, [\"Enter\"])\n\n shown =\n Enum.find_value(1..250, fn _ ->\n screen = Pane.capture!(server, right)\n screen =~ \"hello from tmux\" || (Process.sleep(20) && nil)\n end)\n\n shown || raise \"the pane did not print hello from tmux\"\n\n # Move the focus an attached client sees: the pane, then the window.\n select_pane = Command.new(\"select-pane\", [\"-t\", right_id])\n select_window = Command.new(\"select-window\", [\"-t\", logs_id])\n {:ok, _} = Server.run(server, select_pane)\n {:ok, _} = Server.run(server, select_window)\n\n # Walk the objects: down from the server, then up from one pane.\n snapshot = Server.snapshot!(server)\n sessions = Snapshot.sessions(snapshot)\n\n for each <- sessions do\n IO.puts(\"session #{each.name}\")\n links = Snapshot.related(snapshot, :session, each.id, :window_links)\n\n for link <- Enum.sort_by(links, & &1.index) do\n {:ok, window} = Snapshot.fetch(snapshot, :window, link.window_id)\n panes = Window.panes(snapshot, window)\n ids = Enum.map_join(panes, \" \", & &1.id)\n IO.puts(\" window #{link.index}:#{window.name}: #{ids}\")\n end\n end\n\n pane = snapshot |> Snapshot.panes() |> Selection.one!(id: right_id)\n window = Snapshot.related(snapshot, :pane, pane.id, :window)\n [owner] = Snapshot.related(snapshot, :window, window.id, :sessions)\n IO.puts(\"#{pane.id} is in window #{window.name} of session #{owner.name}\")\nafter\n System.cmd(tmux, [\"-S\", socket, \"kill-server\"], stderr_to_stdout: true)\n File.rm_rf(dir)\nend\n" + "code": "Mix.install([{:libtmux, \"~> 0.1.2\"}])\n\nalias LibTmux.{Pane, Ref, Selection, Server, Session, Snapshot}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\ncat = [command: {:argv, [\"/bin/cat\"]}]\n\nServer.with_owned([executable: tmux], fn server ->\n Server.new_session!(server, \"demo\", cat)\n\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n pane = snapshot |> Snapshot.panes() |> Selection.one!()\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, pane_ref} = Ref.from_observation(pane)\n\n Pane.split!(server, pane_ref, cat)\n Session.new_window!(server, session_ref, \"logs\", cat)\n\n snapshot = Server.snapshot!(server)\n windows = snapshot |> Snapshot.windows() |> Selection.size()\n panes = snapshot |> Snapshot.panes() |> Selection.size()\n IO.puts(\"#{session.name}: #{windows} windows, #{panes} panes\")\nend)\n" } ], "prerequisites": "POSIX shell, tmux 3.3 or newer, Elixir 1.20.4 or newer, Erlang/OTP 29.1.2 or a newer 29.x release, access to hex.pm, and a C11 compiler on Linux.", "commands": [ - "unset TMUX TMUX_PANE\nexport ENV=/dev/null BASH_ENV=/dev/null SHELL=/bin/sh\nelixir quickstart.exs" + "elixir quickstart.exs" ], - "expectedOutput": "session demo\n window 0:editor: %0 %1\n window 1:logs: %2\n%1 is in window editor of session demo\n", + "expectedOutput": "demo: 2 windows, 3 panes\n", "withoutErrorHandling": "An unmatched result or a raised error ends the script with its message and stack trace, so there is no separate error handling to add. Every version checks required results.", "variants": { - "concise": "Mix.install([{:libtmux, \"0.1.1\"}])\n\nalias LibTmux.{Command, Pane, Ref, Selection, Server, Session, Snapshot, Window}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\nid = Base.encode16(:crypto.strong_rand_bytes(8), case: :lower)\ndir = Path.join(System.tmp_dir!(), \"libtmux-\" <> id)\nsocket = Path.join(dir, \"tmux.sock\")\nFile.mkdir!(dir)\nFile.chmod!(dir, 0o700)\n\n# libtmux works on a running server, so tmux itself starts the private one.\ncreate = [\"new-session\", \"-d\", \"-s\", \"demo\"]\n{_, 0} = System.cmd(tmux, [\"-S\", socket, \"-f\", \"/dev/null\" | create])\nserver = Server.new(executable: tmux, socket: socket)\n\n# Lay out the session: name its window, split it, add a second window.\nsnapshot = Server.snapshot!(server)\nsession = snapshot |> Snapshot.sessions() |> Selection.one!()\neditor = Session.active_window(snapshot, session)\n{:ok, session_ref} = Ref.from_observation(session)\n{:ok, editor_ref} = Ref.from_observation(editor)\nWindow.rename!(server, editor_ref, \"editor\")\nleft =\n snapshot\n |> Snapshot.panes()\n |> Selection.one!(window_id: editor.id, active: true)\n{:ok, left_ref} = Ref.from_observation(left)\n%{id: right_id} = Pane.split!(server, left_ref, axis: :horizontal)\n%{id: logs_id} = Session.new_window!(server, session_ref, \"logs\")\n{:ok, right} = Ref.new(:pane, right_id, session.server_instance)\n\n# Type a command into the new pane and wait for what it prints.\nPane.send_text!(server, right, \"printf 'hello from %s\\\\n' tmux\")\nPane.send_keys!(server, right, [\"Enter\"])\n\nshown =\n Enum.find_value(1..250, fn _ ->\n screen = Pane.capture!(server, right)\n screen =~ \"hello from tmux\" || (Process.sleep(20) && nil)\n end)\n\nshown || raise \"the pane did not print hello from tmux\"\n\n# Move the focus an attached client sees: the pane, then the window.\nselect_pane = Command.new(\"select-pane\", [\"-t\", right_id])\nselect_window = Command.new(\"select-window\", [\"-t\", logs_id])\n{:ok, _} = Server.run(server, select_pane)\n{:ok, _} = Server.run(server, select_window)\n\n# Walk the objects: down from the server, then up from one pane.\nsnapshot = Server.snapshot!(server)\nsessions = Snapshot.sessions(snapshot)\n\nfor each <- sessions do\n IO.puts(\"session #{each.name}\")\n links = Snapshot.related(snapshot, :session, each.id, :window_links)\n\n for link <- Enum.sort_by(links, & &1.index) do\n {:ok, window} = Snapshot.fetch(snapshot, :window, link.window_id)\n panes = Window.panes(snapshot, window)\n ids = Enum.map_join(panes, \" \", & &1.id)\n IO.puts(\" window #{link.index}:#{window.name}: #{ids}\")\n end\nend\n\npane = snapshot |> Snapshot.panes() |> Selection.one!(id: right_id)\nwindow = Snapshot.related(snapshot, :pane, pane.id, :window)\n[owner] = Snapshot.related(snapshot, :window, window.id, :sessions)\nIO.puts(\"#{pane.id} is in window #{window.name} of session #{owner.name}\")\n", - "errors": "Mix.install([{:libtmux, \"0.1.1\"}])\n\nalias LibTmux.{Command, Pane, Ref, Selection, Server, Session, Snapshot, Window}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\nid = Base.encode16(:crypto.strong_rand_bytes(8), case: :lower)\ndir = Path.join(System.tmp_dir!(), \"libtmux-\" <> id)\nsocket = Path.join(dir, \"tmux.sock\")\nFile.mkdir!(dir)\nFile.chmod!(dir, 0o700)\n\n# libtmux works on a running server, so tmux itself starts the private one.\ncreate = [\"new-session\", \"-d\", \"-s\", \"demo\"]\n{_, 0} = System.cmd(tmux, [\"-S\", socket, \"-f\", \"/dev/null\" | create])\nserver = Server.new(executable: tmux, socket: socket)\n\n# Lay out the session: name its window, split it, add a second window.\nsnapshot = Server.snapshot!(server)\nsession = snapshot |> Snapshot.sessions() |> Selection.one!()\neditor = Session.active_window(snapshot, session)\n{:ok, session_ref} = Ref.from_observation(session)\n{:ok, editor_ref} = Ref.from_observation(editor)\nWindow.rename!(server, editor_ref, \"editor\")\nleft =\n snapshot\n |> Snapshot.panes()\n |> Selection.one!(window_id: editor.id, active: true)\n{:ok, left_ref} = Ref.from_observation(left)\n%{id: right_id} = Pane.split!(server, left_ref, axis: :horizontal)\n%{id: logs_id} = Session.new_window!(server, session_ref, \"logs\")\n{:ok, right} = Ref.new(:pane, right_id, session.server_instance)\n\n# Type a command into the new pane and wait for what it prints.\nPane.send_text!(server, right, \"printf 'hello from %s\\\\n' tmux\")\nPane.send_keys!(server, right, [\"Enter\"])\n\nshown =\n Enum.find_value(1..250, fn _ ->\n screen = Pane.capture!(server, right)\n screen =~ \"hello from tmux\" || (Process.sleep(20) && nil)\n end)\n\nshown || raise \"the pane did not print hello from tmux\"\n\n# Move the focus an attached client sees: the pane, then the window.\nselect_pane = Command.new(\"select-pane\", [\"-t\", right_id])\nselect_window = Command.new(\"select-window\", [\"-t\", logs_id])\n{:ok, _} = Server.run(server, select_pane)\n{:ok, _} = Server.run(server, select_window)\n\n# Walk the objects: down from the server, then up from one pane.\nsnapshot = Server.snapshot!(server)\nsessions = Snapshot.sessions(snapshot)\n\nfor each <- sessions do\n IO.puts(\"session #{each.name}\")\n links = Snapshot.related(snapshot, :session, each.id, :window_links)\n\n for link <- Enum.sort_by(links, & &1.index) do\n {:ok, window} = Snapshot.fetch(snapshot, :window, link.window_id)\n panes = Window.panes(snapshot, window)\n ids = Enum.map_join(panes, \" \", & &1.id)\n IO.puts(\" window #{link.index}:#{window.name}: #{ids}\")\n end\nend\n\npane = snapshot |> Snapshot.panes() |> Selection.one!(id: right_id)\nwindow = Snapshot.related(snapshot, :pane, pane.id, :window)\n[owner] = Snapshot.related(snapshot, :window, window.id, :sessions)\nIO.puts(\"#{pane.id} is in window #{window.name} of session #{owner.name}\")\n", - "cleanup": "Mix.install([{:libtmux, \"0.1.1\"}])\n\nalias LibTmux.{Command, Pane, Ref, Selection, Server, Session, Snapshot, Window}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\nid = Base.encode16(:crypto.strong_rand_bytes(8), case: :lower)\ndir = Path.join(System.tmp_dir!(), \"libtmux-\" <> id)\nsocket = Path.join(dir, \"tmux.sock\")\nFile.mkdir!(dir)\nFile.chmod!(dir, 0o700)\n\ntry do\n # libtmux works on a running server, so tmux itself starts the private one.\n create = [\"new-session\", \"-d\", \"-s\", \"demo\"]\n {_, 0} = System.cmd(tmux, [\"-S\", socket, \"-f\", \"/dev/null\" | create])\n server = Server.new(executable: tmux, socket: socket)\n\n # Lay out the session: name its window, split it, add a second window.\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n editor = Session.active_window(snapshot, session)\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, editor_ref} = Ref.from_observation(editor)\n Window.rename!(server, editor_ref, \"editor\")\n left =\n snapshot\n |> Snapshot.panes()\n |> Selection.one!(window_id: editor.id, active: true)\n {:ok, left_ref} = Ref.from_observation(left)\n %{id: right_id} = Pane.split!(server, left_ref, axis: :horizontal)\n %{id: logs_id} = Session.new_window!(server, session_ref, \"logs\")\n {:ok, right} = Ref.new(:pane, right_id, session.server_instance)\n\n # Type a command into the new pane and wait for what it prints.\n Pane.send_text!(server, right, \"printf 'hello from %s\\\\n' tmux\")\n Pane.send_keys!(server, right, [\"Enter\"])\n\n shown =\n Enum.find_value(1..250, fn _ ->\n screen = Pane.capture!(server, right)\n screen =~ \"hello from tmux\" || (Process.sleep(20) && nil)\n end)\n\n shown || raise \"the pane did not print hello from tmux\"\n\n # Move the focus an attached client sees: the pane, then the window.\n select_pane = Command.new(\"select-pane\", [\"-t\", right_id])\n select_window = Command.new(\"select-window\", [\"-t\", logs_id])\n {:ok, _} = Server.run(server, select_pane)\n {:ok, _} = Server.run(server, select_window)\n\n # Walk the objects: down from the server, then up from one pane.\n snapshot = Server.snapshot!(server)\n sessions = Snapshot.sessions(snapshot)\n\n for each <- sessions do\n IO.puts(\"session #{each.name}\")\n links = Snapshot.related(snapshot, :session, each.id, :window_links)\n\n for link <- Enum.sort_by(links, & &1.index) do\n {:ok, window} = Snapshot.fetch(snapshot, :window, link.window_id)\n panes = Window.panes(snapshot, window)\n ids = Enum.map_join(panes, \" \", & &1.id)\n IO.puts(\" window #{link.index}:#{window.name}: #{ids}\")\n end\n end\n\n pane = snapshot |> Snapshot.panes() |> Selection.one!(id: right_id)\n window = Snapshot.related(snapshot, :pane, pane.id, :window)\n [owner] = Snapshot.related(snapshot, :window, window.id, :sessions)\n IO.puts(\"#{pane.id} is in window #{window.name} of session #{owner.name}\")\nafter\n System.cmd(tmux, [\"-S\", socket, \"kill-server\"], stderr_to_stdout: true)\n File.rm_rf(dir)\nend\n" - } + "concise": "Mix.install([{:libtmux, \"~> 0.1.2\"}])\n\nalias LibTmux.{Pane, Ref, Selection, Server, Session, Snapshot}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\ncat = [command: {:argv, [\"/bin/cat\"]}]\n\nServer.with_owned([executable: tmux], fn server ->\n Server.new_session!(server, \"demo\", cat)\n\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n pane = snapshot |> Snapshot.panes() |> Selection.one!()\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, pane_ref} = Ref.from_observation(pane)\n\n Pane.split!(server, pane_ref, cat)\n Session.new_window!(server, session_ref, \"logs\", cat)\n\n snapshot = Server.snapshot!(server)\n windows = snapshot |> Snapshot.windows() |> Selection.size()\n panes = snapshot |> Snapshot.panes() |> Selection.size()\n IO.puts(\"#{session.name}: #{windows} windows, #{panes} panes\")\nend)\n", + "errors": "Mix.install([{:libtmux, \"~> 0.1.2\"}])\n\nalias LibTmux.{Pane, Ref, Selection, Server, Session, Snapshot}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\ncat = [command: {:argv, [\"/bin/cat\"]}]\n\nServer.with_owned([executable: tmux], fn server ->\n Server.new_session!(server, \"demo\", cat)\n\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n pane = snapshot |> Snapshot.panes() |> Selection.one!()\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, pane_ref} = Ref.from_observation(pane)\n\n Pane.split!(server, pane_ref, cat)\n Session.new_window!(server, session_ref, \"logs\", cat)\n\n snapshot = Server.snapshot!(server)\n windows = snapshot |> Snapshot.windows() |> Selection.size()\n panes = snapshot |> Snapshot.panes() |> Selection.size()\n IO.puts(\"#{session.name}: #{windows} windows, #{panes} panes\")\nend)\n", + "cleanup": "Mix.install([{:libtmux, \"~> 0.1.2\"}])\n\nalias LibTmux.{Pane, Ref, Selection, Server, Session, Snapshot}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\ncat = [command: {:argv, [\"/bin/cat\"]}]\n\nServer.with_owned([executable: tmux], fn server ->\n Server.new_session!(server, \"demo\", cat)\n\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n pane = snapshot |> Snapshot.panes() |> Selection.one!()\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, pane_ref} = Ref.from_observation(pane)\n\n Pane.split!(server, pane_ref, cat)\n Session.new_window!(server, session_ref, \"logs\", cat)\n\n snapshot = Server.snapshot!(server)\n windows = snapshot |> Snapshot.windows() |> Selection.size()\n panes = snapshot |> Snapshot.panes() |> Selection.size()\n IO.puts(\"#{session.name}: #{windows} windows, #{panes} panes\")\nend)\n" + }, + "automaticCleanup": "Server.with_owned retires its private tmux server when the function returns or raises." }, "ocaml": { "lang": "ocaml", diff --git a/site/src/data/port-guides/elixir.json b/site/src/data/port-guides/elixir.json index 260fcdc58..3621e43ba 100644 --- a/site/src/data/port-guides/elixir.json +++ b/site/src/data/port-guides/elixir.json @@ -1,40 +1,48 @@ { "source": { "repository": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688" }, "guides": [ { "path": "README.md", - "content": "\n
\n \n \n \"libtmux\n \n
\n\n\n
\n\n# libtmux for Elixir\n\n
\n\nAn Elixir library for controlling tmux. The core provides exact target\nreferences, shared deadlines, command encoding, bounded protocol parsing,\nLinux one-shot execution, immutable graph capture, Enumerable selections and\nportable filters.\nThe domain client API remains under development.\n\n[Contributing](.github/CONTRIBUTING.md) ·\n[First task](docs/first-task.md) ·\n[Design](docs/design.md) · [Encoding](docs/encoding.md) ·\n[Mental model](docs/mental-model.md) ·\n[Observations](docs/observations.md) ·\n[Filtering](docs/filtering.md) ·\n[Ownership](docs/ownership.md) ·\n[Writing](.github/WRITING.md) · [Artwork](docs/branding.md)\n\n## Status and requirements\n\n| Component | Current scope |\n| --- | --- |\n| Mix application | `:libtmux`, version `0.0.1-alpha.1` |\n| Development toolchain | Elixir `1.20.x` (at least `1.20.4`) on Erlang/OTP `29.x` |\n| Planned tmux floor | `3.3`; fixture checks precede client compatibility qualification |\n| Runtime dependencies | No third-party packages; own native I/O helper |\n| Platforms | No runtime support matrix has been qualified |\n\n[`.tool-versions`](.tool-versions) selects the development toolchain ranges\nfor mise and CI. Linux builds require a C11 compiler for the helper. See\n[setup](.github/CONTRIBUTING.md#setup) for installation\nand upgrades. tmux is not required for the pure checks. Capture, command\nexecution and the complete example require an external tmux executable.\nThe supported client API and compatibility matrix remain under qualification.\n\n## Installation\n\nAdd the alpha release to your Mix dependencies:\n\n```elixir\n{:libtmux, \"== 0.0.1-alpha.1\"}\n```\n\nFetch dependencies:\n\n```console\n$ mix deps.get\n```\n\n## Capture, select and execute\n\nFrom a source checkout, run the complete public API example from the packed\ncore on a new isolated tmux server. This requires Linux, a C11 compiler,\nPython 3 and tmux 3.3 or newer:\n\n```console\n$ MIX_ENV=test mix run scripts/check_package.exs --examples\n```\n\nThe example captures one graph, selects its active pane, and reads that exact\npane through one-shot and control commands. It checks the acknowledged\nresult, retires its connection, and verifies owned server cleanup. The check\nuses a temporary socket and empty configuration. See the [complete program\nand failure behavior](docs/first-task.md).\n\n## Check the implementation\n\nFrom the checkout, with the development toolchain on `PATH`, check formatting:\n\n```console\n$ mix format --check-formatted\n```\n\nRun the pure unit suite:\n\n```console\n$ mix test\n```\n\nCompile with warnings treated as errors:\n\n```console\n$ mix compile --warnings-as-errors\n```\n\nWith Hex installed, build a local package archive:\n\n```console\n$ mix hex.build\n```\n\nCheck public core imports from a packed archive outside the checkout:\n\n```console\n$ mix run scripts/check_package.exs\n```\n\nThe unit and packed-core checks validate the current foundations. Real\nintegration checks cover owned startup/teardown and hostile command/format\nbytes through real tmux. They do not qualify the future client API or a\ncomplete compatibility matrix.\nSee [Contributing](.github/CONTRIBUTING.md) for setup, timing budgets, and\nthe checks required as implementation arrives.\n\n## Planned package boundaries\n\nThe core provides immutable observations and explicit tmux operations,\nusing Elixir and OTP without third-party runtime dependencies. Workspace\nloading and an MCP server have separate Mix projects under `packages/`.\nTheir runtime implementations remain planned. MCP also consumes workspace\nbehavior rather than maintaining a second loader or planner.\n\nThe [design note](docs/design.md) records these boundaries and the contracts\nthat implementation must prove. It is not an API reference.\n\n## Contributing and references\n\nFollow the [contribution guide](.github/CONTRIBUTING.md) and\n[writing guide](.github/WRITING.md). Agent instructions start in\n[AGENTS.md](AGENTS.md).\n\nRelated projects: [libtmux for Python](https://github.com/tmux-python/libtmux),\n[libtmux ports](https://github.com/libtmux), and\n[tmux](https://github.com/tmux/tmux).\n\nLicensed under the [MIT License](LICENSE).\n" + "content": "\n
\n \n \n \"libtmux\n \n
\n\n\n
\n\n

libtmux for Elixir

\n\n

\n Hex.pm ·\n API reference ·\n HexDocs ·\n Documentation\n

\n\n

\n \"Core\n \"libtmux\"\n \"libtmux.org\"\n \"license\"\n

\n\n
\n\nDrive tmux from Elixir: [capture][snapshot] sessions, windows and panes as an\nimmutable snapshot, [filter][where] it with plain data, then rename, split and\ntype through domain actions.\n\n**Contents** — [Installation](#installation) ·\n[Try the examples](#try-the-examples) ·\n[Start a server](#start-a-private-server) ·\n[Choose a server](#choose-the-server) ·\n[Find things](#find-sessions-windows-and-panes) ·\n[Rename](#rename-a-window) ·\n[Control](#split-a-pane-send-input-and-read-the-screen) ·\n[Errors](#errors-and-recovery) ·\n[Guides](#guides) · [Support](#support-and-status) ·\n[Leaves out](#what-it-leaves-out)\n\n## Installation\n\nAdd the package to your Mix dependencies:\n\n```elixir\n{:libtmux, \"~> 0.1\"}\n```\n\nFetch dependencies:\n\n```console\n$ mix deps.get\n```\n\nIt needs:\n\n- Elixir 1.20 or newer, on OTP 29 or newer\n- tmux 3.3 or newer\n- Linux and a C compiler, which builds a small helper\n- no third-party runtime packages and no NIF\n\nThe exact floors and tested releases are in\n[Packages and support](docs/implementation.md#packages-and-support).\n\n## Try the examples\n\nThe snippets below form one [executable program](examples/readme.exs). It\nstarts a private tmux server and stops it afterward. From this checkout, with\ntmux on `PATH`:\n\n```console\n$ mix run examples/readme.exs\n```\n\n- Your own tmux sessions are untouched: the server has its own directory and\n never sees `TMUX`.\n- Every example under `examples/` does the same, with no shell step.\n\nNo checkout? The [standalone demo](docs/standalone-demo.md) installs the\npackage from Hex.\n\n## Start a private server\n\n### [`Server.with_owned/2`][with-owned]: a server for one function\n\nIt starts a tmux server in a private directory, calls your function with the\n[`Server`][server-type], and stops the server afterward, even when the function\nraises. [`Server.new_session!/3`][new-session] and\n[`Session.new_window!/4`][new-window] create what you work on, and\n[`Window.kill!/3`][kill-window] removes it.\n\n\n\n```elixir\nalias LibTmux.{Ref, Selection, Server, Session, Snapshot, Window}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\n\nServer.with_owned([executable: tmux], fn server ->\n cat = [command: {:argv, [\"/bin/cat\"]}]\n %{id: session_id} = Server.new_session!(server, \"work\", cat)\n\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!(id: session_id)\n {:ok, session_ref} = Ref.from_observation(session)\n\n %{id: logs_id} = Session.new_window!(server, session_ref, \"logs\", cat)\n\n snapshot = Server.snapshot!(server)\n logs = snapshot |> Snapshot.windows() |> Selection.one!(id: logs_id)\n {:ok, logs_ref} = Ref.from_observation(logs)\n windows = snapshot |> Snapshot.windows() |> Selection.size()\n\n :ok = Window.kill!(server, logs_ref)\n\n remaining = Server.snapshot!(server) |> Snapshot.windows() |> Enum.map(& &1.id)\n\n IO.puts(\n JSON.encode!(%{\n session: session_id,\n created_window: logs_id,\n windows_before_kill: windows,\n remaining_windows: remaining\n })\n )\nend)\n```\n\n\n\nIt prints:\n\n```text\n{\"session\":\"$0\",\"created_window\":\"@1\",\"windows_before_kill\":2,\"remaining_windows\":[\"@0\"]}\n```\n\n- [`Server.start/1`][start] and [`Server.stop/2`][stop] are the same call in\n two parts. The process that starts a server owns it, and the server stops\n when that process exits.\n- `kill` also exists for [`Session`][kill-session], [`Pane`][kill-pane] and\n [`Server`][kill-server]. A control connection refuses it.\n\nMore: [Own a private server](docs/owned-server.md).\n\n## Choose the server\n\n### [`Server.new/1`][server-new]: describe a server that already runs\n\nIt builds a descriptor with no I/O. Pass `:socket` for a path or\n`:socket_name` for a name; with neither, it reads `LIBTMUX_SOCKET_PATH`, then\n`LIBTMUX_SOCKET`, and otherwise leaves the choice to tmux.\n\n\n\n```elixir\nalias LibTmux.Server\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\n\nby_path = Server.new(executable: tmux, socket: \"/run/user/1000/work.sock\")\nby_name = Server.new(executable: tmux, socket_name: \"work\")\nfrom_variable = Server.new(executable: tmux, env: %{\"LIBTMUX_SOCKET\" => \"work\"})\nfrom_path_variable = Server.new(executable: tmux, env: %{\"LIBTMUX_SOCKET_PATH\" => \"/tmp/w.sock\"})\ndefault = Server.new(executable: tmux, env: %{})\n\n%Server{socket: \"/run/user/1000/work.sock\", socket_name: nil} = by_path\n%Server{socket: nil, socket_name: \"work\"} = by_name\n%Server{socket: nil, socket_name: \"work\"} = from_variable\n%Server{socket: \"/tmp/w.sock\", socket_name: nil} = from_path_variable\n%Server{socket: nil, socket_name: nil} = default\n\nIO.puts(\n JSON.encode!(%{\n by_path: by_path.socket,\n by_name: by_name.socket_name,\n from_variable: from_variable.socket_name,\n from_path_variable: from_path_variable.socket,\n default: \"tmux chooses\"\n })\n)\n```\n\n\n\n- With neither option nor variable, tmux uses the server `TMUX` names inside\n tmux and its default socket outside it.\n- A Server with a chosen socket removes `TMUX` from the environment it gives\n tmux.\n\nMore: [Capture an existing server](docs/first-task.md).\n\n## Find sessions, windows and panes\n\n### [`Server.snapshot!/2`][snapshot]: what tmux has now\n\nThe snippets from here on run inside the function that\n[`Server.with_owned/2`](#start-a-private-server) calls, so `server` is its\nprivate server. One call captures every session, window and pane as an immutable graph.\n[`Snapshot.sessions/1`][snapshot-sessions],\n[`Snapshot.windows/1`][snapshot-windows] and\n[`Snapshot.panes/1`][snapshot-panes] pick a type, and\n[`Selection.where/2`][where] filters it. None of them calls tmux again.\n\n\n\n```elixir\nalias LibTmux.{Selection, Snapshot}\n\nsnapshot = Server.snapshot!(server)\n\nactive_ids =\n snapshot\n |> Snapshot.panes()\n |> Selection.where(active: true)\n |> Enum.map(& &1.id)\n\n```\n\n\n\n`active_ids` is `[\"%0\"]`: the demo server starts with one pane. Capture again\nwhen you need fresh state.\n\nMore: [Captured state](docs/observations.md).\n\n### [`Selection.where/2`][where]: filter by data\n\nCriteria are keywords or maps, and can test related panes.\n[`Filter.from_json/3`][filter-json] reads the same criteria from JSON, so a\nfilter can come from a file or a request. [`Selection.filter/2`][filter] takes\nan Elixir function instead.\n\n\n\n```elixir\nalias LibTmux.{Filter, Pane, Selection, Snapshot}\n\nwindows =\n snapshot\n |> Snapshot.windows()\n |> Selection.where(panes: [some: [active: true, current_command: \"cat\"]])\n |> Enum.map(& &1.id)\n\njson = \"\"\"\n{\"version\":1,\"entity\":\"pane\",\n \"where\":{\"active\":true,\"currentCommand\":{\"in\":[\"cat\",\"nvim\"]}}}\n\"\"\"\n\n{:ok, filter} = Filter.from_json(Pane, json)\n\npane_ids =\n snapshot\n |> Snapshot.panes()\n |> Selection.where(filter)\n |> Enum.map(& &1.id)\n\n```\n\n\n\n`windows` is `[\"@0\"]` and `pane_ids` is `[\"%0\"]`. One pane must meet both\nconditions inside `some`.\n\nMore: [Filtering](docs/filtering.md).\n\n## Rename a window\n\n### [`Window.rename!/4`][rename]: change a window's name\n\nContinue with the same [`snapshot`][snapshot-type] and\n[`server`][server-type]. [`Selection.one!/2`][one] needs exactly one match,\n[`Session.active_window/2`][active-window] reads the captured link, and\n[`Ref.from_observation/1`][ref] turns an observation into an action target.\n\n\n\n```elixir\nalias LibTmux.{Ref, Selection, Session, Snapshot, Window}\n\nsession = snapshot |> Snapshot.sessions() |> Selection.one!(id: session_id)\nwindow = Session.active_window(snapshot, session)\n{:ok, session_ref} = Ref.from_observation(session)\n{:ok, window_ref} = Ref.from_observation(window)\n\nWindow.rename!(server, window_ref, \"editor\", session: session_ref)\n```\n\n\n\nIt returns `:ok` once tmux acknowledges the command. `session:` names the\nsession whose link to the window to use. The old snapshot keeps the old name.\n\nMore: [One-shot actions](docs/one-shot-actions.md).\n\n## Split a pane, send input and read the screen\n\n### [`Control.with_connection/2`][scope]: one connection for many commands\n\nIt attaches a control client to an existing session, runs your callback, and\ncloses the client. [`Pane.split!/3`][split] returns the new pane's ID and a\nbound reference. [`Pane.send_text!/4`][text] sends literal text and\n[`Pane.send_keys!/4`][keys] sends named keys. After the scope closes,\n[`Pane.capture!/3`][capture] reads the new pane's screen through the `server`.\n\n\n\n```elixir\nalias LibTmux.{Control, Pane, Ref, Selection, Snapshot}\n\npane = snapshot |> Snapshot.panes() |> Selection.one!(window_id: window.id, active: true)\n{:ok, pane_ref} = Ref.from_observation(pane)\n\n{:ok, {created_id, created}} =\n Control.with_connection(\n [server: server, session: {:existing, session.id}, lane: :host_qualified],\n fn control ->\n %{id: id, ref: created} =\n Pane.split!(control, pane_ref, axis: :horizontal, command: {:argv, [\"/bin/cat\"]})\n\n Pane.send_text!(control, created, \"hello\")\n Pane.send_keys!(control, created, [\"Enter\"])\n {id, created}\n end\n )\n\nscreen = Pane.capture!(server, created, max_bytes: 4096)\n```\n\n\n\nThe program prints:\n\n```text\n{\"window\":\"editor\",\"active_panes\":[\"%0\"],\"created_pane\":\"%1\",\"connection_retired\":true}\n```\n\n- `{:argv, [\"/bin/cat\"]}` runs a program directly; `{:shell, \"command\"}` goes\n through a shell.\n- An acknowledgement does not mean the program has read its input, so\n `screen` may not show `hello` yet.\n- `Pane.capture!/3` runs one command through the `server`; a control\n connection refuses it.\n- `lane: :host_qualified` says you control this server's hooks and aliases.\n A server from `Server.start/1` does. Read the managed-control guide before\n using another host.\n\nMore: [Managed control](docs/managed-control.md).\n\n## Errors and recovery\n\n### [`Action.CompletionError`][completion-error]: what went wrong\n\nActions return `{:ok, result}` only when the command completes; the bang forms\nraise instead. A command that times out may still have taken effect, so\ninspect it before you retry.\n\nMore: [Recovery](docs/recovery.md), [Mental model](docs/mental-model.md).\n\n## Guides\n\n- [Filtering](docs/filtering.md): predicates, relations and finding one match.\n- [One-shot actions](docs/one-shot-actions.md): rename, split, input and\n screen capture.\n- [Managed control](docs/managed-control.md): one connection, many commands.\n- [Mental model](docs/mental-model.md): snapshots, references and results.\n- [API reference](https://libtmux.org/en/elixir/latest/reference/): functions\n and types.\n\n## Support and status\n\n- **Alpha.** Releases are numbered `0.1.N`. Any release may change or remove\n exported functions; the [changelog](CHANGELOG.md) marks each break. Pin an\n exact version to avoid one.\n- **Linux.** The helper that owns tmux processes needs Linux.\n- **tmux.** 3.3 or newer.\n\n## What it leaves out\n\n- **A query planner.** Selections run locally over a snapshot; `Query`,\n `Batch` and `Plan` are planned.\n- **Change notifications.** `Observation` and `Tracker` are planned.\n\n## AI policy\n\nUse these packages with AI tools as you like. When contributing, check what you\nsubmit and wait for a maintainer's invitation before preparing a pull request.\nSee the [AI policy](https://libtmux.org/en/meta/ai-policy/), also kept as\n[AI_POLICY.md](https://github.com/libtmux/.github/blob/HEAD/AI_POLICY.md).\n\n## Contributing\n\nSee [Contributing](.github/CONTRIBUTING.md) for development setup and checks,\nand [Writing](.github/WRITING.md) for documentation conventions.\n\nRelated projects: [libtmux for Python](https://github.com/tmux-python/libtmux),\n[libtmux ports](https://github.com/libtmux), and [tmux](https://github.com/tmux/tmux).\n[Artwork](docs/branding.md). Licensed under the [MIT License](LICENSE).\n\n[with-owned]: https://libtmux.org/en/elixir/latest/reference/libtmux-server-with_owned-2/\n[start]: https://libtmux.org/en/elixir/latest/reference/libtmux-server-start-1/\n[stop]: https://libtmux.org/en/elixir/latest/reference/libtmux-server-stop-2/\n[kill-server]: https://libtmux.org/en/elixir/latest/reference/libtmux-server-kill-2/\n[kill-session]: https://libtmux.org/en/elixir/latest/reference/libtmux-session-kill-3/\n[kill-window]: https://libtmux.org/en/elixir/latest/reference/libtmux-window-kill-bang-3/\n[kill-pane]: https://libtmux.org/en/elixir/latest/reference/libtmux-pane-kill-3/\n[new-session]: https://libtmux.org/en/elixir/latest/reference/libtmux-server-new_session-bang-3/\n[new-window]: https://libtmux.org/en/elixir/latest/reference/libtmux-session-new_window-bang-4/\n[snapshot]: https://libtmux.org/en/elixir/latest/reference/libtmux-server-snapshot-bang-2/\n[snapshot-type]: https://libtmux.org/en/elixir/latest/reference/libtmux-snapshot/\n[snapshot-sessions]: https://libtmux.org/en/elixir/latest/reference/libtmux-snapshot-sessions-1/\n[snapshot-windows]: https://libtmux.org/en/elixir/latest/reference/libtmux-snapshot-windows-1/\n[snapshot-panes]: https://libtmux.org/en/elixir/latest/reference/libtmux-snapshot-panes-1/\n[server-type]: https://libtmux.org/en/elixir/latest/reference/libtmux-server/\n[server-new]: https://libtmux.org/en/elixir/latest/reference/libtmux-server-new-1/\n[where]: https://libtmux.org/en/elixir/latest/reference/libtmux-selection-where-2/\n[filter]: https://libtmux.org/en/elixir/latest/reference/libtmux-selection-filter-2/\n[filter-json]: https://libtmux.org/en/elixir/latest/reference/libtmux-filter-from_json-3/\n[one]: https://libtmux.org/en/elixir/latest/reference/libtmux-selection-one-bang-2/\n[active-window]: https://libtmux.org/en/elixir/latest/reference/libtmux-session-active_window-2/\n[ref]: https://libtmux.org/en/elixir/latest/reference/libtmux-ref-from_observation-1/\n[rename]: https://libtmux.org/en/elixir/latest/reference/libtmux-window-rename-bang-4/\n[scope]: https://libtmux.org/en/elixir/latest/reference/libtmux-control-with_connection-2/\n[split]: https://libtmux.org/en/elixir/latest/reference/libtmux-pane-split-bang-3/\n[text]: https://libtmux.org/en/elixir/latest/reference/libtmux-pane-send_text-bang-4/\n[keys]: https://libtmux.org/en/elixir/latest/reference/libtmux-pane-send_keys-bang-4/\n[capture]: https://libtmux.org/en/elixir/latest/reference/libtmux-pane-capture-bang-3/\n[completion-error]: https://libtmux.org/en/elixir/latest/reference/libtmux-action-completionerror/\n" }, { "path": "docs/filtering.md", - "content": "# Filter captured values\n\nObtain one [snapshot](observations.md), then select its observed panes:\n\n```elixir\nalias LibTmux.{Selection, Snapshot}\n\neditors =\n snapshot\n |> Snapshot.panes()\n |> Selection.where(active: true, current_command: [in: [\"nvim\", \"vim\"]])\n\nEnum.map(editors, & &1.id)\n```\n\nSelections retain their immutable graph and order. Enumerable delegates to\nthe materialized list, including suspension and early halt. `size/1` uses\nthe cached count; ordinary `Enum.member?/2` compares elements. Use\n`Selection.member_id?/2` for native ID membership. Enumeration performs no I/O.\n\n`Selection.filter/2` accepts only unary functions and uses Enum truthiness.\nPredicate exceptions propagate. `where/2` accepts validated data: keywords\nare shorthand for maps, with duplicate keys rejected at every nesting level.\nBoth validate before scanning, including when no items remain.\n\n`one/2` returns `{:ok, item}` or a structured `:no_match` / `:multiple_matches`\nerror. `one_or_nil/2` permits zero matches. Their bang variants raise the\nsame error; both stop at the second match. `exists?/2` stops at its first\nmatch. `count/2` counts matching items; `size/1` returns the cached total.\n\n## Predicate grammar\n\nA bare scalar means equality. Explicit `%{equals: value}` is equivalent.\nThe [generated schema](schema.md) lists each field's type and operators.\nNumbers compare numerically, strings compare case-sensitively without\nnormalization, and nullable numeric ordering against known nil is false.\n`not` negates equality; `not_in` negates membership, including known nil.\nPortable regex is not supported. Native predicates may use `Regex` directly.\n\nFields in one object conjoin. Boolean `and` and `or` accept lists of\ncriteria; `not` accepts one criteria object. Empty `and` is true and empty\n`or` is false. Normalization never combines separate relation quantifiers:\n\n```elixir\nSelection.where(Snapshot.sessions(snapshot), %{\n panes: %{some: %{active: true, current_command: \"nvim\"}}\n})\n```\n\nThat predicate requires one pane to satisfy both conditions. Two separate\n`some` clauses can match different panes. `every` and `none` are true for\na known-empty relation; `some` is false. `count` counts that relation's\nidentities: physical windows/panes deduplicate, window links retain memberships.\n\nTo-one `is: criteria` is false for known absence and `is_not` negates it.\n`is: nil` means absent; `is_not: nil` means present. Session `active_window`\nis derived from a complete link domain and loaded active flags. Zero active\nlinks means known absence; multiple active links raise `:ambiguous_relation`.\nAn unresolved active target remains unloaded. Coverage checks run before\nevaluation, including fields behind a Boolean branch that cannot match.\n\n## External filters\n\n`Filter.new/3` returns a validated portable value, and `new!/3` raises its\nstructured error. Applying that value retains its constructor validation;\nexplicit new limits validate the normalized tree without generating extra\ncriteria objects. Prepared predicates may contain\nsets and closures; portable filters contain data only.\n\n`Filter.from_json/3` uses built-in JSON and rejects duplicate keys before\nmap conversion, trailing data and unknown names. `from_wire/3` accepts an\nalready decoded map; that map cannot reveal discarded duplicate keys.\nNeither decoder creates atoms from external keys. Encode through\n`Filter.to_wire/1`, then `JSON.encode!/1`.\n\n```json\n{\"version\":1,\"entity\":\"pane\",\"where\":{\"active\":true,\"currentCommand\":{\"in\":[\"nvim\",\"vim\"]}}}\n```\n\nDefault ceilings are 65,536 bytes, depth 16, 1024 value nodes, 256 array\nelements and 8192 bytes per string. Wire depth starts at root zero and\ncounts every member/element; the ceiling is inclusive. Positive integer\noptions `max_bytes`, `max_depth`, `max_nodes`, `max_list` and\n`max_string_bytes` can narrow or widen the constructor budget. JSON object\nmembers have a fixed ceiling of 256. Native input depth counts criteria\nobjects and also bounds the normalized tree. A normalized conjunction does\nnot add relation/Boolean nesting; disjunctions, negations and relation\nchildren do. Wire budgets additionally cover the full versioned envelope.\nErrors carry the affected path, including Boolean and membership indexes;\nearly parser-limit errors can identify the root before a path is available.\n\nSelections and filters operate on captured values. Server query planning\nand pushdown remain under implementation.\n" + "content": "# Filter captured values\n\nCapture one [snapshot](observations.md), then select from it. The examples run\non a private server from [`Server.with_owned/2`](owned-server.md). From a\ncheckout, with tmux on `PATH`:\n\n```console\n$ mix run examples/filtering.exs\n```\n\n\n\n```elixir\nactive =\n snapshot\n |> Snapshot.panes()\n |> Selection.where(active: true, current_command: [in: [\"cat\", \"nvim\", \"vim\"]])\n\nEnum.map(active, & &1.id)\n```\n\n\n\n- Selections keep their graph and order. Enumerating one does no I/O.\n- `size/1` reads a cached count.\n- `Enum.member?/2` compares elements; `Selection.member_id?/2` compares\n native IDs.\n\n## Select\n\n- `where/2` takes validated data. Keywords are shorthand for maps, and\n duplicate keys are rejected at every level.\n- `filter/2` takes a unary function and uses `Enum` truthiness. Predicate\n exceptions propagate.\n- Both validate before scanning, even when no items remain.\n- `one/2` returns `{:ok, item}` or a structured `:no_match` or\n `:multiple_matches` error. `one!/2` raises the same error.\n- `one_or_nil/2` also allows zero matches. Both stop at the second match.\n- `exists?/2` stops at the first match. `count/2` counts matches; `size/1`\n returns the total.\n\n## Predicate grammar\n\n- A bare scalar means equality; `%{equals: value}` is the same. The\n [generated schema](schema.md) lists each field's type and operators.\n- Numbers compare numerically and strings compare case-sensitively, with no\n normalization. Ordering a nullable number against a known `nil` is false.\n- `not` negates equality. `not_in` negates membership, including known `nil`.\n- Portable regex is not supported. Native predicates may use `Regex`.\n- Fields in one object conjoin. `and` and `or` take lists of criteria and\n `not` takes one criteria object. An empty `and` is true; an empty `or` is\n false.\n- Separate relation quantifiers are never combined:\n\n\n\n```elixir\nwith_cat =\n Selection.where(Snapshot.sessions(snapshot), %{\n panes: %{some: %{active: true, current_command: \"cat\"}}\n })\n\n```\n\n\n\nThat predicate needs one pane to satisfy both conditions. Two separate `some`\nclauses can match different panes.\n\n- `every` and `none` are true for a known-empty relation; `some` is false.\n- `count` counts the relation's identities. Physical windows and panes\n deduplicate; window links keep their memberships.\n- To-one `is: criteria` is false for known absence, and `is_not` negates it.\n `is: nil` means absent; `is_not: nil` means present.\n- A session's `active_window` comes from a complete link domain and loaded\n active flags. Zero active links is known absence; several raise\n `:ambiguous_relation`. An unresolved active target stays unloaded.\n- Coverage checks run before evaluation, including fields behind a Boolean\n branch that cannot match.\n\n## External filters\n\n- `Filter.new/3` returns a validated portable value; `new!/3` raises its\n structured error. Applying the value keeps its constructor validation.\n- Prepared predicates may hold sets and closures. Portable filters hold only\n data. `LibTmux.Filter.to_predicate/2` reuses a filter as a predicate.\n- `Filter.from_json/3` uses built-in JSON. It rejects duplicate keys,\n trailing data and unknown names.\n- `from_wire/3` takes an already decoded map, which cannot show discarded\n duplicate keys.\n- Neither decoder creates atoms from external keys.\n- Encode with `Filter.to_wire/1`, then `JSON.encode!/1`.\n\n\n\n```elixir\nalias LibTmux.{Filter, Pane}\n\n{:ok, filter} = Filter.new(Pane, active: true, current_command: [in: [\"nvim\", \"vim\"]])\njson = filter |> Filter.to_wire() |> JSON.encode!()\n{:ok, ^filter} = Filter.from_json(Pane, json)\n```\n\n\n\nThe document is:\n\n```json\n{\"version\":1,\"entity\":\"pane\",\"where\":{\"active\":true,\"currentCommand\":{\"in\":[\"nvim\",\"vim\"]}}}\n```\n\n## Limits\n\nDefaults: 65,536 bytes, depth 16, 1024 value nodes, 256 array elements and\n8192 bytes per string. Positive integer options `max_bytes`, `max_depth`,\n`max_nodes`, `max_list` and `max_string_bytes` narrow or widen them.\n\n- A JSON object has at most 256 members.\n- Wire depth starts at root zero and counts every member and element. The\n ceiling is inclusive.\n- Native input depth counts criteria objects and bounds the normalized tree.\n A normalized conjunction adds no relation or Boolean nesting; disjunctions,\n negations and relation children do.\n- Wire budgets also cover the versioned envelope.\n- Errors carry the affected path, including Boolean and membership indexes.\n An early parser-limit error can name only the root.\n\nFilters run locally on a captured snapshot. Server-side query planning is not\nimplemented.\n" + }, + { + "path": "docs/supervised-control.md", + "content": "# Keep a control connection in an application\n\n- Use an application owner when several callers need the current connection\n handle. The owner stores the handle and serializes explicit replacement.\n- Commands still run in the requesting process, so managed execution and\n recovery belong to that caller.\n- For a short task, prefer\n [`Control.with_connection/2`](LibTmux.Control.html#with_connection/2).\n\nThe program is `examples/supervised_control.exs`. It runs on a private server\nfrom [`Server.with_owned/2`](owned-server.md). The displayed parts omit server\nsetup and application shutdown. From a checkout, with tmux on `PATH`:\n\n```console\n$ mix run examples/supervised_control.exs\n```\n\n## Store the handle\n\n`ApplicationConnection` is application code, not a library module. Its\nseparate connection supervisor must already be running when the owner\ninitializes. Calling the supervisor that is still starting the owner would\ndeadlock.\n\n\n\n```elixir\ndefmodule ApplicationConnection do\n use GenServer, restart: :temporary\n alias LibTmux.{Control, Error}\n\n def start_link({supervisor, options}),\n do: GenServer.start_link(__MODULE__, {supervisor, options})\n\n def connection(owner), do: GenServer.call(owner, :connection)\n def replace(owner), do: GenServer.call(owner, :replace)\n def reconnect(owner), do: GenServer.call(owner, :reconnect)\n\n def execute(owner, request) do\n with {:ok, control} <- connection(owner),\n do: Control.execute(control, request, timeout: 900)\n end\n\n @impl true\n def init({supervisor, options}) do\n case Supervisor.start_child(supervisor, Control.child_spec(options)) do\n {:ok, _root, control} -> {:ok, %{supervisor: supervisor, control: control}}\n {:error, reason} -> {:stop, reason}\n end\n end\n\n @impl true\n def handle_call(:connection, _from, %{control: nil} = state),\n do: {:reply, {:error, :connection_unavailable}, state}\n\n def handle_call(:connection, _from, state), do: {:reply, {:ok, state.control}, state}\n\n def handle_call(:replace, _from, state) do\n with :ok <- Supervisor.terminate_child(state.supervisor, Control),\n {:ok, _root, control} <- Supervisor.restart_child(state.supervisor, Control) do\n {:reply, {:ok, control}, %{state | control: control}}\n else\n {:error, _reason} = error -> {:reply, error, %{state | control: nil}}\n end\n end\n\n def handle_call(:reconnect, _from, %{control: nil} = state),\n do: {:reply, {:error, :connection_unavailable}, state}\n\n def handle_call(:reconnect, _from, state) do\n case Control.reconnect(state.control, timeout: 900) do\n {:ok, ready} ->\n {:reply, {:ok, ready}, %{state | control: ready}}\n\n {:error, %Error{kind: :cleanup_unknown} = error} ->\n # A fresh child spec would bypass the existing cleanup state.\n {:reply, {:error, error}, state}\n\n {:error, _reason} = error ->\n {:reply, error, state}\n end\n end\nend\n\n```\n\n\n\n- `replace/1` asks the supervisor for fresh startup information from its\n stored child specification. It never builds a new lifetime to bypass\n uncertain cleanup.\n- `reconnect/1` leaves an unknown connection unavailable and returns the\n original error.\n- Do not retry an uncertain mutation after replacement.\n\n## Start the application children\n\nHere `application` is a started application supervisor, `server` is the\n`LibTmux.Server` descriptor and `session_id` names an existing session. The\ncomplete file supplies them. The host must qualify its\n[control lane](managed-control.md) before you set `lane: :host_qualified`.\n\n\n\n```elixir\nalias LibTmux.Control.Request\n\n{:ok, connections} =\n Supervisor.start_child(application, %{\n id: :connections,\n start: {Supervisor, :start_link, [[], [strategy: :one_for_one]]},\n type: :supervisor\n })\n\noptions = [\n server: server,\n session: {:existing, session_id},\n lane: :host_qualified,\n timeout: 900\n]\n\n{:ok, owner} =\n Supervisor.start_child(application, {ApplicationConnection, {connections, options}})\n\n{:ok, %{outcome: :completed}} =\n ApplicationConnection.execute(owner, Request.set_user_option(\"@supervised_example\", \"once\"))\n\n```\n\n\n\n- `execute/2` gets a handle with `GenServer.call/2`, then runs\n `Control.execute/3` outside the owner.\n- Its result follows the lower-level\n [return convention](mental-model.md#return-conventions): inspect the\n canonical outcome.\n- Handle access alone cannot keep the connection alive.\n\n## Replace deliberately, then reconnect\n\n- Quiesce application callers before replacing a connection. Replacement can\n interrupt sibling work, and this owner does not track or drain in-flight\n calls.\n- For planned replacement, close first.\n- After an automatic root restart, an old handle reports context loss and the\n replacement stays inert.\n\n\n\n```elixir\nalias LibTmux.Control\nalias LibTmux.Control.Request\n\n{:ok, original} = ApplicationConnection.connection(owner)\n:ok = Control.close(original, timeout: 900)\n{:ok, inert} = ApplicationConnection.replace(owner)\n{:ok, %{phase: :retired}} = Control.status(inert)\n{:ok, ready} = ApplicationConnection.reconnect(owner)\n\n{:ok, %{outcome: :completed}} = ApplicationConnection.execute(owner, Request.field(\"pid\"))\n:ok = Control.close(ready, timeout: 900)\n```\n\n\n\nAfter an automatic root restart, call `replace/1` directly. `close/2` cannot\nrepair the lost handle.\n\n- If the old connection retired, reconnect can attach.\n- If cleanup is unknown, `reconnect/1` returns\n `{:error, %LibTmux.Error{kind: :cleanup_unknown}}` and the owner keeps the\n unavailable handle. Stop application work and keep that evidence; rebuilding\n the child specification is not recovery.\n- The tests exercise both branches with actual root death, and check that an\n earlier completed mutation is not replayed.\n\nThe owner is temporary. If it exits, the application still owns the connection\nsubtree; stop the application to shut it down.\n\n- This recipe covers one connection while the owner and its separate\n supervisor survive.\n- Owner, connection-supervisor and whole-application recovery need your own\n policy.\n- For command uncertainty inside a live owner, use the\n [execution recovery example](recovery.md).\n" + }, + { + "path": "docs/advanced-execution.md", + "content": "# Advanced: inspect both transports and own a retained operation\n\nThis example exposes retained operations and manual connection teardown. For\nroutine work, start with [capture and filter](first-task.md), then choose\n[one-shot actions](one-shot-actions.md) or [managed control](managed-control.md).\n\nIt starts a private server with [`Server.with_owned/2`](owned-server.md). From\na checkout, with tmux on `PATH`:\n\n```console\n$ mix run examples/capture_and_read.exs\n```\n\nTo run the whole packed-example check against an isolated tmux server, from a\nsource checkout:\n\n```console\n$ MIX_ENV=test mix run scripts/check_package.exs --examples\n```\n\n- It needs the toolchain from [Contributing](../.github/CONTRIBUTING.md#setup),\n plus tmux 3.3 or newer on `PATH`.\n- Set `LIBTMUX_TMUX` to an absolute executable to check a particular tmux\n build.\n- Hex must already be installed; the check downloads nothing.\n- It builds and extracts a real package, compiles its core in a fresh\n directory and runs the packaged example outside the checkout.\n- An owned fixture supplies a unique socket, an empty configuration and an\n existing session. It clears inherited `TMUX` and `TMUX_PANE`, verifies that\n its server, pane, clients and helper exited, and never uses the default\n server.\n\n## The complete program\n\n[Executable source](../examples/capture_and_read.exs) receives the absolute\ntmux executable, socket and existing session ID from the fixture. All its\nlibrary calls use the public core.\n\n\n\n```elixir\nalias LibTmux.{Codec, Command, Control, Format, Operation, Ref, Selection, Server, Snapshot}\nalias LibTmux.Control.Request\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\n\nServer.with_owned([executable: tmux], fn server ->\n {:ok, %{value: %{id: session_id}}} =\n Server.new_session(server, \"demo\", command: {:argv, [\"/bin/cat\"]})\n\n {:ok, snapshot} = Server.snapshot(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!(id: session_id)\n window = Snapshot.related(snapshot, :session, session.id, :active_window)\n\n pane =\n snapshot\n |> Snapshot.panes()\n |> Selection.where(window_id: window.id)\n |> Selection.filter(& &1.active)\n |> Selection.one!()\n\n {:ok, target} = Ref.new(:pane, pane.id, snapshot.server_instance)\n command = Command.new(\"display-message\", [\"-p\", \"-t\", pane.id, Format.field(\"pane_id\")])\n {:ok, %{stdout: stdout, cleanup: :retired}} = Server.run(server, command)\n {:ok, one_shot_id} = Codec.decode_field(stdout, :string, encoding: :escaped_v1)\n true = one_shot_id == pane.id\n\n {:ok, root, control} =\n Control.start_link(\n server: server,\n session: {:existing, session.id},\n lane: :host_qualified,\n timeout: 800\n )\n\n root_monitor = Process.monitor(root)\n\n control_id =\n try do\n {:ok, operation} = Control.submit(control, Request.field(\"pane_id\", target), timeout: 800)\n\n {:ok,\n %{\n outcome: :completed,\n certainty: :acknowledged,\n evidence: :command_reply,\n lines: [line]\n }} = Operation.await(operation, timeout: 800)\n\n {:ok, %{phase: :ready}} = Control.status(control)\n {:ok, %{result: %{outcome: :completed}}} = Operation.status(operation)\n\n {:ok, id} = Codec.decode_field(line <> \"\\n\", :string, encoding: :escaped_v1)\n true = id == pane.id\n :ok = Control.close(control, timeout: 800)\n {:ok, %{phase: :retired, terminal: %{reason: :closure_requested}}} = Control.status(control)\n {:ok, %{outcome: :completed}} = Operation.result(operation)\n :ok = Operation.forget(operation, timeout: 800)\n id\n after\n try do\n :ok = Control.close(control, timeout: 800)\n after\n :ok = Supervisor.stop(root, :normal, 800)\n\n receive do\n {:DOWN, ^root_monitor, :process, ^root, :normal} -> :ok\n after\n 800 -> raise \"connection supervisor did not exit\"\n end\n end\n end\n\n IO.puts(\n JSON.encode!(%{\n \"session\" => session.id,\n \"window\" => window.id,\n \"pane\" => pane.id,\n \"oneShot\" => one_shot_id,\n \"control\" => control_id,\n \"connectionRetired\" => true\n })\n )\nend)\n```\n\n\n\n- The result holds the observed session, window and pane IDs. Both replies\n must identify the selected pane.\n- `connectionRetired` is true only after the connection closes and its\n supervisor exits.\n- `Server.with_owned/2` stops the private server after the callback; the\n packed check then confirms that no directory, socket or process remains.\n- After closure, `LibTmux.Control.status/1` keeps the observed close reason and\n bounded captured stderr until epoch replacement or context loss. Inspect\n that report before reconnecting or shutting its owner down.\n- The example checks requested closure and the unchanged completed operation.\n An unexpected close can have a different reason or no evidence.\n- Captured stderr can contain application data.\n\n## What each step establishes\n\n- `LibTmux.Server.snapshot/2` observes a capture interval. `LibTmux.Selection`\n then runs `where`, a native predicate and checked cardinality locally, with\n no further tmux command, and relationships resolve against the same graph.\n- The one-shot read uses an exact pane ID and the escaped field codec. Its\n check/use race remains: a captured pane is not reserved.\n- The control request also carries a `LibTmux.Ref` bound to the observed server\n incarnation.\n- Control startup attaches a client and can change session state and\n attachment counts. The fixture's empty, controlled configuration is why this\n example can declare `lane: :host_qualified`. On another server, qualify its\n effective hooks, aliases and stream writers first.\n- `LibTmux.Control.submit/3` returns an admitted operation. The example checks\n that `LibTmux.Operation.await/2` reports `:completed` and `:acknowledged`. A\n reply acknowledges this tmux command; it does not prove that a program\n started by another command has exited.\n\n## Failure behavior and cleanup\n\n- The program uses assertions, so an unexpected result fails the example.\n- Capture and transport errors return `{:error, %LibTmux.Error{}}`, with\n `kind`, `phase` and `certainty` describing the failure.\n- A control field read whose target disappeared returns an acknowledged\n `:failed` operation. A present empty field stays `:completed`.\n- Raw one-shot commands keep tmux's native semantics, so the example also\n checks the returned pane ID. Neither path retries with a positional target.\n- `LibTmux.Selection.one!/2` raises `:no_match` or `:multiple_matches` instead\n of selecting arbitrarily.\n- An await timeout ends only that waiter. Failed, skipped and unknown outcomes\n are values, including from bang functions. Inspect the retained operation\n instead of replaying an uncertain command. This example accepts only an\n acknowledged completed read.\n- The `after` block closes the connection and stops its enclosing supervisor.\n The fixture harness runs owned teardown even when the example fails.\n\nSee [the mental model](mental-model.md) and [ownership](ownership.md) for the\ndifferent lifetimes and remaining limits.\n" }, { "path": "docs/first-task.md", - "content": "# Capture a pane and read it through both transports\n\nFrom a source checkout, run one complete example against an isolated tmux\nserver:\n\n```console\n$ MIX_ENV=test mix run scripts/check_package.exs --examples\n```\n\nUse the development toolchain and Linux prerequisites in\n[Contributing](../.github/CONTRIBUTING.md#setup), plus Python 3 and tmux 3.3 or\nnewer on `PATH`. Set `LIBTMUX_TMUX` to an absolute executable when checking a\nparticular tmux build. Hex must already be installed; the check downloads\nnothing.\n\nThe check builds and extracts a real package, compiles its core in a fresh\ndirectory, and executes the packaged example outside the checkout. An owned\nfixture supplies a unique socket, empty configuration and existing session.\nIt clears inherited `TMUX` and `TMUX_PANE` and verifies its server, pane,\nclients and helper exit afterward. It never uses the default server.\n\n## The complete program\n\n[Executable source](../examples/capture_and_read.exs) receives the absolute\ntmux executable, socket and existing session ID from that fixture. All its\nlibrary calls use the public core. The embedded program is checked against\nthat source file.\n\n\n\n```elixir\nalias LibTmux.{Codec, Command, Control, Format, Operation, Ref, Selection, Server, Snapshot}\nalias LibTmux.Control.Request\n\n[executable, socket, session_id] = System.argv()\n{:ok, _} = Application.ensure_all_started(:libtmux)\n\nserver =\n Server.new(\n executable: executable,\n socket: socket,\n cwd: \"/\",\n env: Map.drop(System.get_env(), [\"TMUX\", \"TMUX_PANE\"])\n )\n\n{:ok, snapshot} = Server.snapshot(server)\nsession = snapshot |> Snapshot.sessions() |> Selection.one!(id: session_id)\nwindow = Snapshot.related(snapshot, :session, session.id, :active_window)\n\npane =\n snapshot\n |> Snapshot.panes()\n |> Selection.where(window_id: window.id)\n |> Selection.filter(& &1.active)\n |> Selection.one!()\n\n{:ok, target} = Ref.new(:pane, pane.id, snapshot.server_instance)\ncommand = Command.new(\"display-message\", [\"-p\", \"-t\", pane.id, Format.field(\"pane_id\")])\n{:ok, %{stdout: stdout, cleanup: :retired}} = Server.run(server, command)\n{:ok, one_shot_id} = Codec.decode_field(stdout, :string, encoding: :escaped_v1)\ntrue = one_shot_id == pane.id\n\n{:ok, root, control} =\n Control.start_link(\n server: server,\n session: {:existing, session.id},\n lane: :host_qualified,\n timeout: 800\n )\n\nroot_monitor = Process.monitor(root)\n\ncontrol_id =\n try do\n {:ok, operation} = Control.submit(control, Request.field(\"pane_id\", target), timeout: 800)\n\n {:ok,\n %{\n outcome: :completed,\n certainty: :acknowledged,\n evidence: :command_reply,\n lines: [line]\n }} = Operation.await(operation, timeout: 800)\n\n {:ok, id} = Codec.decode_field(line <> \"\\n\", :string, encoding: :escaped_v1)\n true = id == pane.id\n id\n after\n try do\n :ok = Control.close(control, timeout: 800)\n after\n :ok = Supervisor.stop(root, :normal, 800)\n\n receive do\n {:DOWN, ^root_monitor, :process, ^root, :normal} -> :ok\n after\n 800 -> raise \"connection supervisor did not exit\"\n end\n end\n end\n\nIO.puts(\n JSON.encode!(%{\n \"session\" => session.id,\n \"window\" => window.id,\n \"pane\" => pane.id,\n \"oneShot\" => one_shot_id,\n \"control\" => control_id,\n \"connectionRetired\" => true\n })\n)\n```\n\n\n\nThe result contains the observed session, window and pane IDs. Both replies\nmust identify the selected pane, and `connectionRetired` is true only after\nconnection close and supervisor exit succeed. The harness checks that the\nborrowed server and pane survived the program, then tears down its own fixture.\n\n## What each step establishes\n\n`LibTmux.Server.snapshot/2` observes a capture interval. `LibTmux.Selection`\nthen runs `where`, a native predicate and checked cardinality locally, without\nanother tmux command. Relationships resolve against the same graph. Keep\nusing that snapshot when several decisions need the same captured values.\n\nThe one-shot read uses an exact pane ID and the escaped field codec. Its\ncheck/use race remains: a captured pane is not reserved. The control request\nalso carries a `LibTmux.Ref` bound to the observed server incarnation.\n\nControl startup explicitly attaches a client and can change session state\nand attachment counts. The fixture's empty, controlled configuration is why\nthis example can declare `lane: :host_qualified`. A caller using another\nserver must qualify its effective hooks, aliases and stream writers before\nusing that lane; the option does not perform that qualification.\n\n`LibTmux.Control.submit/3` returns an admitted operation. The example checks\nthe result of `LibTmux.Operation.await/2` for both `:completed` and\n`:acknowledged`. A reply acknowledges this tmux command; it does not prove\nthat an arbitrary program started by another command has exited.\n\n## Failure behavior and cleanup\n\nThe program uses assertions so unexpected results make the example fail.\nCapture and transport errors return `{:error, %LibTmux.Error{}}`, with `kind`,\n`phase` and `certainty` describing the failure. A control field read whose\ntarget disappeared returns an acknowledged `:failed` operation; a present\nempty field remains `:completed`. Raw one-shot commands retain tmux's native\nsemantics, so the example also checks the returned pane ID. Neither path\nretries with a positional target.\n`LibTmux.Selection.one!/2` raises `:no_match` or `:multiple_matches` rather\nthan selecting arbitrarily.\n\nAn await API timeout ends only that waiter. Canonical failed, skipped and\nunknown operation outcomes are values, including from bang methods. Inspect\nthe retained operation instead of replaying an uncertain command. This\nexample deliberately accepts only an acknowledged completed read.\n\nThe `after` block closes the connection and stops its enclosing supervisor.\nThe separate fixture harness runs owned teardown even when the example\nfails. See [the mental model](mental-model.md) and\n[ownership](ownership.md) for the different lifetimes and remaining runtime\nqualification limits.\n" + "content": "# Capture and filter a server\n\nCapture once, then query the immutable result with no more tmux commands.\nInstall the published package as shown in the\n[README](../README.md#installation), then save this program as\n`capture_and_filter.exs`. It starts a private server with\n[`Server.with_owned/2`](owned-server.md), so it runs as it is:\n\n\n\n```elixir\nalias LibTmux.{Selection, Server, Snapshot}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\n\nServer.with_owned([executable: tmux], fn server ->\n {:ok, _} = Server.new_session(server, \"demo\", command: {:argv, [\"/bin/cat\"]})\n\n {:ok, snapshot} = Server.snapshot(server)\n\n active_ids =\n snapshot\n |> Snapshot.panes()\n |> Selection.where(active: true)\n |> Enum.map(& &1.id)\n\n IO.puts(JSON.encode!(%{active_panes: active_ids}))\nend)\n```\n\n\n\nRun it with tmux 3.3 or newer on `PATH`:\n\n```console\n$ mix run capture_and_filter.exs\n```\n\nIt prints the IDs of the active panes, in numeric order, as JSON.\n\n- To capture a server that already runs, build the descriptor with\n `Server.new/1` in place of `Server.with_owned/2`, passing `socket:` or\n `socket_name:`.\n- With neither, `Server.new/1` reads `LIBTMUX_SOCKET_PATH`, then\n `LIBTMUX_SOCKET` (a socket name). With neither set, it passes tmux no socket,\n and tmux uses its default socket.\n- A pane is active within its physical window. This does not choose one\n session's active window. Linked windows do not duplicate their panes.\n- `Server.new/1` builds a descriptor with no I/O. `Server.snapshot/2` runs\n bounded one-shot reads, without attaching a control client or creating a\n missing server.\n- `Selection.where/2` and `Enum.map/2` use the captured graph.\n- Capture covers an interval, not an atomic tmux transaction. Capture again\n for fresh state.\n- The `{:ok, snapshot}` match makes a capture error visible. Production code\n can handle `{:error, %LibTmux.Error{}}`.\n- Default capture budgets: 5000ms, 512 commands, 1024 contextual topology\n rows, 64 KiB per response and 8 MiB in total. A limit failure returns an\n error, not a partial graph.\n\nNext: [filter and select](filtering.md), [one-shot actions](one-shot-actions.md)\nor [managed control](managed-control.md).\n" }, { "path": "docs/mental-model.md", - "content": "# Read values, execute explicitly\n\nCapture once when several decisions should use the same observed graph.\nKeep that snapshot while selecting and filtering. Execute a new command\nexplicitly when you need another observation or an effect.\nCapture records an interval; fields can change during it. The resulting\nvalue stays fixed while live objects continue changing.\n\n## The values you hold\n\n| Value | What it represents | I/O boundary |\n| --- | --- | --- |\n| `LibTmux.Server` | Executable, socket and environment for an existing server | Pure descriptor construction |\n| `LibTmux.Snapshot` | An indexed graph captured over one interval | `LibTmux.Server.snapshot/2` captures a new value |\n| `LibTmux.Selection` | Ordered items and their originating snapshot | Filtering and enumeration use captured values |\n| `LibTmux.Ref` | An observed exact ID and server instance | Pure identity data; it reserves nothing |\n| `LibTmux.Control` | A handle pinned to one connection epoch | Status reads are local; startup explicitly attaches a client |\n| `LibTmux.Operation` | Access to one retained operation record | Result/status reads are local; awaiting registers a separate waiter |\n\nWindows are physical objects. `LibTmux.WindowLink` supplies their membership\nin a session, index and active state. A linked window can appear more than\nonce while its panes remain the same physical panes. Choose window links\nwhen membership matters; choose panes when an action should address each\nphysical pane once. See [captured state](observations.md).\n\n## Coverage tells you which questions the graph can answer\n\nA loaded field may contain a value, an empty string or a documented `nil`.\n`:unloaded` means this snapshot does not contain the observation.\n`:unavailable` means the capability is absent. Neither means known absence.\n\nRelationship predicates need complete captured join domains. A missing pane\nrelation cannot satisfy “no pane matches.” Validation raises a structured\ncoverage error before filtering, including an empty selection. Obtain a new\nsnapshot explicitly when more coverage is needed. Existing selections retain\ntheir original graph. See [filtering](filtering.md).\n\n## Server identity and connection epochs have different lifetimes\n\nA server instance identifies one tmux process incarnation. Native object IDs\ncan be reused after that process exits. References retain the observed\ninstance so qualified control requests can reject known stale targets.\nOne-shot commands retain a check/use race; an observed ID reserves nothing.\n\nAn epoch identifies one control connection and its owned transport actors.\n`LibTmux.Control.reconnect/2` obtains the ready epoch and returns it unchanged\nwhen it is already ready. Close first to require a replacement. Replacement\nwaits for retirement and returns a new pinned handle. The server instance\ncan stay the same while the epoch changes. Old connection handles cannot\nsubmit into the replacement. Reconnect never replays work.\n\n## Waiting, command outcomes and retirement are separate\n\n| Result | What the caller can conclude |\n| --- | --- |\n| `LibTmux.Control.submit/3` returns `{:ok, operation}` | Admission succeeded; inspect or await the retained operation |\n| `LibTmux.Operation.await/2` returns an API timeout | This waiter ended; the operation may still advance |\n| A canonical outcome is `:completed` or `:failed` with `:acknowledged` certainty | tmux supplied a command reply; arbitrary programs started by that command have their own lifetimes |\n| A canonical outcome is `:skipped` with `:no_write` certainty | The operation was classified before dispatch |\n| A canonical outcome is `:unknown` | Available evidence cannot determine its effects |\n| Operation status reports `wire: :retired` | Reply attribution has retired; the retained record may still occupy capacity |\n| `LibTmux.Control.close/2` returns `:ok` | The pinned connection epoch retired; its enclosing supervisor remains running |\n\nEach await call has its own budget. Timeout or caller death ends that waiter\nwithout cancelling the operation. For wire-active work,\n`LibTmux.Operation.stop/1` requests closure of the entire pinned epoch and can\naffect siblings. An already retired operation returns `:ok` without closing\nits connection. Use `LibTmux.Control.close/2` to wait for connection retirement.\nInspect retained results instead of replaying an uncertain mutation.\n\nOnce a canonical outcome exists, it stays unchanged. Bang operation APIs\nraise API/context errors and still return canonical failed, skipped and\nunknown outcomes as values. Wire retirement, record expiry and native process\ncleanup each have their own evidence. See [ownership](ownership.md) for\ndeadlines, bounds and the remaining qualification limits.\n" + "content": "# Read values, execute explicitly\n\n- Capture once when several decisions need the same graph, and keep that\n snapshot while you select and filter.\n- Run a new command explicitly for another observation or an effect.\n- Capture covers an interval, so fields can change during it. The value you\n get stays fixed while tmux keeps changing.\n\n## The values you hold\n\n| Value | What it represents | I/O boundary |\n| --- | --- | --- |\n| `LibTmux.Server` | Executable, socket choice and environment for an existing server | Pure descriptor construction |\n| `LibTmux.Snapshot` | An indexed graph captured over one interval | `LibTmux.Server.snapshot/2` captures a new value |\n| `LibTmux.Selection` | Ordered items and their originating snapshot | Filtering and enumeration use captured values |\n| `LibTmux.Ref` | An observed exact ID and server instance | Pure identity data; it reserves nothing |\n| `LibTmux.Control` | A handle pinned to one connection epoch | Status reads are local; startup explicitly attaches a client |\n| `LibTmux.Operation` | Access to one retained operation record | Result/status reads are local; awaiting registers a separate waiter |\n\n- Windows are physical objects. `LibTmux.WindowLink` gives a window's session\n membership, index and active state.\n- A linked window can appear more than once, while its panes stay the same\n physical panes.\n- Choose window links when membership matters. Choose panes when an action\n should address each physical pane once.\n\nSee [captured state](observations.md).\n\n## Coverage tells you which questions the graph can answer\n\n- A loaded field holds a value, an empty string or a documented `nil`.\n- `:unloaded` means this snapshot lacks the observation. `:unavailable` means\n the capability is absent. Neither means known absence.\n- Relationship predicates need complete captured join domains. A missing pane\n relation cannot satisfy \"no pane matches.\"\n- Validation raises a structured coverage error before filtering, even for an\n empty selection.\n- Capture again explicitly for more coverage. Existing selections keep their\n graph.\n\nSee [filtering](filtering.md).\n\n## Server identity and connection epochs have different lifetimes\n\n- A server instance identifies one tmux process incarnation. Native object\n IDs can be reused after that process exits.\n- References keep the observed instance, so qualified control requests can\n reject known stale targets. One-shot commands keep a check/use race; an\n observed ID reserves nothing.\n- An epoch identifies one control connection and its owned transport actors.\n The server instance can stay the same while the epoch changes.\n- `LibTmux.Control.reconnect/2` returns the ready epoch, unchanged if it is\n already ready. Close first to require a replacement.\n- A replacement waits for retirement and returns a new pinned handle. Old\n handles cannot submit into it, and reconnect never replays work.\n\n## Waiting, command outcomes and retirement are separate\n\n| Result | What the caller can conclude |\n| --- | --- |\n| `LibTmux.Control.submit/3` returns `{:ok, operation}` | Admission succeeded; inspect or await the retained operation |\n| `LibTmux.Operation.await/2` returns an API timeout | This waiter ended; the operation may still advance |\n| A canonical outcome is `:completed` or `:failed` with `:acknowledged` certainty | tmux supplied a command reply; arbitrary programs started by that command have their own lifetimes |\n| A canonical outcome is `:skipped` with `:no_write` certainty | The operation was classified before dispatch |\n| A canonical outcome is `:unknown` | Available evidence cannot determine its effects |\n| Operation status reports `wire: :retired` | Reply attribution has retired; the retained record may still occupy capacity |\n| `LibTmux.Control.close/2` returns `:ok` | The pinned connection epoch retired; its enclosing supervisor remains running |\n\n- Each await call has its own budget. A timeout or the caller's death ends\n that waiter without cancelling the operation.\n- For wire-active work, `LibTmux.Operation.stop/1` asks to close the whole\n pinned epoch and can affect siblings. An already retired operation returns\n `:ok` without closing its connection.\n- `LibTmux.Control.close/2` waits for connection retirement.\n- Inspect retained results instead of replaying an uncertain mutation.\n- A canonical outcome never changes once it exists. Bang operation APIs raise\n API and context errors, and still return failed, skipped and unknown\n outcomes as values.\n- Wire retirement, record expiry and native process cleanup each have their\n own evidence. [Ownership](ownership.md) covers deadlines, bounds and\n remaining limits.\n\n## Return conventions\n\nThese APIs answer different questions. Command completion does not mean that\na program started by tmux has finished.\n\n| API | Normal return | Failure handling |\n| --- | --- | --- |\n| Domain actions such as `LibTmux.Window.rename/4` | `{:ok, result}` only for completion, retaining value and evidence | Unsuccessful outcomes use `LibTmux.Action.CompletionError`; API and admitted execution errors retain their own types |\n| Domain bangs such as `LibTmux.Window.rename!/4` | Completed value | Raise the same errors with their evidence |\n| `LibTmux.Control.execute/3` and `LibTmux.Operation.await/2` | `{:ok, canonical_result}`, including failed, skipped and unknown outcomes | Outer errors describe execution context or waiting; their bangs raise those errors and return canonical outcomes unchanged |\n| `LibTmux.Selection.one/2` and `LibTmux.Selection.one_or_nil/2` | `{:ok, item}`, or allowed `{:ok, nil}` | Cardinality errors are tuples; bangs raise them. Predicate and coverage validation can raise in either form |\n| Relationship helpers such as `LibTmux.Session.panes/2` | Ordered selection, or observation/nil for to-one relationships; no I/O | Identity, coverage and ambiguity errors raise |\n| `LibTmux.Control.with_connection/2` | `{:ok, callback_value}` after cleanup, even when that value is `{:error, reason}` | Startup errors return errors; callback raise/throw/exit propagates after cleanup. Unproved cleanup returns `LibTmux.Control.ScopeFailure` preserving the primary outcome |\n\n- The [recovery example](recovery.md) handles lower-level execution and\n cleanup separately.\n- Option validation may raise. A name without a bang does not promise that\n every malformed call returns an error tuple.\n" }, { "path": "docs/observations.md", - "content": "# Captured tmux state\n\n`LibTmux.Server.new/1` constructs a descriptor with an explicit executable\nand socket. It performs no I/O. `LibTmux.Server.snapshot/2` observes that\nexisting server and returns an immutable `LibTmux.Snapshot`. Neither call\nattaches a control client or starts a missing server. Configured tmux hooks\nremain environmental effects of commands, including list commands.\n\n## Read one captured graph\n\n`Snapshot.items/2` returns a plain list for an entity atom or module.\n`Snapshot.fetch/3` looks up an exact ID. `Snapshot.related/4` follows captured\nindexes and raises a structured coverage error when a relation is incomplete.\nThese functions perform no I/O. `Snapshot.sessions/1`, `windows/1`, `panes/1`,\n`window_links/1` and `clients/1` return materialized Enumerable selections.\nSee [filtering](filtering.md) for local predicates and portable criteria.\n\nSessions, physical windows, panes and clients have separate maps. A pane\nbelongs to one physical window. `WindowLink` records session membership,\nwindow index and active state. Its key includes session ID, index and window\nID; it does not prove a unique lifetime after unlink and relink.\n\nA window can appear at multiple indexes in the same session and in other\nsessions. Server-wide physical maps deduplicate identical rows and reject\nconflicting rows. Session pane traversal returns each physical pane once;\nwindow-link traversal preserves memberships. Session/window/pane lists sort\nby numeric native ID. Links sort by numeric session ID and index; clients\nsort bytewise by their validated observed names.\n\n`Session.attached_count` preserves tmux's raw client count. `attached` is\nderived from that count. Explicit control clients remain counted even with\n`no-output` and `ignore-size`. A control client's height is known `nil` when\ntmux reports no started tty; it is not an unavailable field.\n\n## Coverage and construction\n\n`Snapshot.new/2` validates fixture or adapter observations without I/O.\n`fields` declares loaded fields over the supplied entity IDs. `complete`\ndeclares complete server entity sets; omissions remain partial. `unavailable`\ndeclares absent capabilities separately. Declared names and values validate\nbefore indexes or relations become observable.\n\nKnown empty strings, known nullable values, `:unloaded` and `:unavailable`\nremain distinct. Required coverage checks run even for empty entity sets.\nDerived attachment coverage follows its source count. A relation to many\nobjects needs a complete join domain, so missing children never become an\nempty relation. Complete target sets reject dangling references. A partial\ntarget set can retain unresolved foreign IDs, but traversal fails explicitly.\n\nThe [generated schema](schema.md) owns field types, explicit wire names,\ntmux variables and relation cardinalities. Physical windows carry no single\nsession, session index or active membership flag.\n\n## Capture consistency and bounds\n\nCapture reads topology, then named fields, then topology again. It checks\nthe tmux PID against Linux boot identity and process start ticks before and\nafter those reads. Replacement or changing references trigger finite read\nretries. A disappearing read target can retry; invalid encoding and other\ndecoding errors remain visible. Two attempts are the default; one to three\nmay be requested. All attempts share one deadline and the original budgets.\n\nDefaults are 1024 contextual entity rows, 512 commands, 8 MiB total response\nbytes, 64 KiB per response and 5000 ms. Both stdout and stderr, including\nfailed-command output, consume the byte budget. Overload returns an error\ninstead of a truncated success. Topology checks and retries also consume\nwork. One-shot retirement has the separate allowance documented in\n[ownership](ownership.md).\n\nFree-form fields use the qualified versioned encoder. Numeric/ID topology\ncolumns validate their complete representation. Client rows combine one\nencoded identity with restricted scalar columns; tabs and newlines cannot\nescape the encoded identity. This is a fixed capture schema, not a general\nraw-format row parser.\n\nThe capture interval records observation, not a transaction. Attributes can\nchange within it; matching topology before and after does not prove nothing\nchanged in between. Holding a snapshot reserves no objects. Its server\ninstance is distinct from a future connection epoch, and one-shot checks\nretain a check/use race. Sending snapshots between BEAM processes can copy\nterms; retaining one can retain its graph.\n" + "content": "# Captured tmux state\n\n- `LibTmux.Server.new/1` builds a descriptor with an explicit executable and a\n socket choice. The choice is a path, a name, one of `LIBTMUX_SOCKET_PATH` and\n `LIBTMUX_SOCKET`, or none, which leaves it to tmux. It does no I/O.\n- `LibTmux.Server.snapshot/2` observes that existing server and returns an\n immutable `LibTmux.Snapshot`.\n- Neither call attaches a control client or starts a missing server.\n- Configured tmux hooks remain environmental effects of commands, including\n list commands.\n\n## Read one captured graph\n\n- `Snapshot.items/2` returns a plain list for an entity atom or module.\n- `Snapshot.fetch/3` looks up an exact ID.\n- `Snapshot.related/4` follows captured indexes, and raises a structured\n coverage error when a relation is incomplete.\n- `Snapshot.sessions/1`, `windows/1`, `panes/1`, `window_links/1` and\n `clients/1` return materialized selections.\n- None of these does I/O. See [filtering](filtering.md) for local predicates\n and portable criteria.\n\nFor common relationships, pass the snapshot and a session or window\nobservation to `Session.windows/2`, `Session.panes/2`, `Session.active_window/2`\nor `Window.panes/2`:\n\n- The plural helpers return selections for filtering and checked cardinality\n with `LibTmux.Selection`. `active_window/2` returns a window or `nil`.\n- They validate the observation's kind, ID and server incarnation, then use\n the supplied graph's fields and coverage. An older observation from the same\n incarnation is valid, and its other fields are ignored.\n- Each selection keeps the supplied graph. `Enum.to_list/1` gives a plain list\n without it.\n- Direct traversal validates only the requested source. One session's active\n window does not fail because another session has ambiguous active links.\n- Relationship filters validate their whole captured source domain before\n iteration, even when the selection is empty.\n\nSessions, physical windows, panes and clients have separate maps:\n\n- A pane belongs to one physical window.\n- `WindowLink` records session membership, window index and active state. Its\n key is session ID, index and window ID, which does not prove a unique\n lifetime after unlink and relink.\n- A window can appear at several indexes in one session, and in other\n sessions. Server-wide physical maps deduplicate identical rows and reject\n conflicting rows.\n- Session pane traversal returns each physical pane once. Window-link\n traversal keeps memberships.\n- Sessions, windows and panes sort by numeric native ID. A session's windows\n follow their first link's index; its panes sort by numeric pane ID. Links\n sort by numeric session ID and index. Clients sort bytewise by observed\n name.\n\nField notes:\n\n- `Session.attached_count` keeps tmux's raw client count, and `attached` is\n derived from it. Control clients stay counted even with `no-output` and\n `ignore-size`.\n- A control client's height is known `nil` when tmux reports no started tty.\n It is not an unavailable field.\n- `Pane.pid` is known `nil` when tmux reports no PID, including empty and\n retained dead panes on tmux 3.8. Other values stay as reported: older tmux\n can report zero for an empty pane, or a historical PID for a dead one.\n Neither a PID nor its absence proves a process is alive or cleaned up.\n\n## Coverage and construction\n\n- `Snapshot.new/2` validates fixture or adapter observations without I/O.\n- `fields` declares loaded fields over the supplied entity IDs. `complete`\n declares complete server entity sets; omissions stay partial. `unavailable`\n declares absent capabilities separately.\n- Declared names and values validate before indexes or relations become\n observable.\n- Known empty strings, known nullable values, `:unloaded` and `:unavailable`\n stay distinct. Required coverage checks run even for empty entity sets.\n- Derived attachment coverage follows its source count.\n- A relation to many objects needs a complete join domain, so missing\n children never become an empty relation. Complete target sets reject\n dangling references. A partial target set can keep unresolved foreign IDs,\n but traversal fails explicitly.\n\nThe [generated schema](schema.md) owns field types, wire names, tmux variables\nand relation cardinalities. Physical windows carry no single session, session\nindex or active membership flag.\n\n## Capture consistency and bounds\n\n- Capture reads topology, then named fields, then topology again. It checks\n the tmux PID against Linux boot identity and process start ticks before and\n after those reads.\n- A replaced server or changing references trigger finite read retries, as\n does a disappearing read target. Invalid encoding and other decoding errors\n stay visible.\n- Two attempts are the default; request one to three. All attempts share one\n deadline and the original budgets.\n- Defaults: 1024 contextual topology rows, 512 commands, 8 MiB total response\n bytes, 64 KiB per response and 5000 ms.\n- Stdout and stderr both consume the byte budget, including failed-command\n output. Overload returns an error, not a truncated success.\n- Topology checks and retries also consume work. An overflowing text listing\n can fall back to individual reads, as [capture rows](encoding.md#capture-rows)\n describes, and that work stays charged to the original budgets.\n- One-shot retirement has a separate allowance; see [ownership](ownership.md).\n\nEncoding:\n\n- Free-form fields use the qualified versioned encoder. Numeric and ID\n topology columns validate their whole representation.\n- Client rows combine one encoded identity with restricted scalar columns, so\n tabs and newlines cannot escape the identity.\n- This is a fixed capture schema, not a general raw-format row parser.\n\nA capture records an observation, not a transaction:\n\n- Attributes can change within the interval. Matching topology before and\n after does not prove nothing changed in between.\n- Holding a snapshot reserves no objects.\n- Its server instance differs from a future connection epoch, and one-shot\n checks keep a check/use race.\n- Sending a snapshot between BEAM processes can copy terms, and keeping one\n keeps its graph.\n" }, { "path": "docs/ownership.md", - "content": "# One-shot process ownership\n\n`LibTmux.Transport.OneShot.run/3` runs an absolute executable and argv on\nLinux without a shell. It returns bytes, process exit status and cleanup\nevidence separately. A nonzero process exit is still a completed transport\nresult; the tmux command layer must interpret that status. The domain\nclient and public persistent transport remain under implementation.\n\nThe native helper supplies receive credits that an ordinary OTP Port\nlacks. It reads each stdout/stderr pipe only against one bounded credit;\nits control pipe stays responsive while output or stdin is blocked. A\ncapture limit after delivery cannot bound an upstream mailbox while its\nowner is descheduled.\n\n## Limits and results\n\nDefault ceilings are 1 MiB stdout, 64 KiB stderr and 4096 retained chunks.\nByte limits may be 0–16 MiB per stream; chunk limits may be 1–65,536.\n`max_total_bytes` limits both streams together to 0–32 MiB; its default is\nthe sum of the stream limits. The retained prefix obeys both ceilings.\nEncoded cwd, argv and environment together fit a 32 KiB initialization\npayload. Argv and environment each have at most 256 entries, including\nargv's executable. Target environment values preserve empty strings and\nnon-NUL bytes; inherited tmux context is removed. Requested variables apply\nto child `execve`; the helper inherits the trusted host environment.\n\nThe timeout defaults to 5000 ms and is at most 600,000 ms. A caller can\npass an existing `LibTmux.Deadline` instead. Admission, startup and capture\nshare that budget. Cleanup has a separate allowance up to 750 ms. Expiry\nnever turns partial output into success.\n\nOverload stops the owned producer and returns a structured error with a\nbounded prefix. `cleanup: :retired` requires private child-retirement evidence\nand helper exit. Missing proof stays `:unknown`. An exit status or retryable\nerror never authorizes replay.\n\nThe worker acknowledges terminal child-retirement proof before the helper\nexits. The helper keeps its input open while earlier cancellation or read\ncredits drain; after acknowledgement the worker writes nothing further.\nThis preserves the helper's separate exit-status evidence. Missing\nacknowledgement uses the existing 750 ms delivery allowance.\n\nThe worker monitors its caller. Caller death initiates cleanup; worker/VM\ndeath closes the helper's parent pipe. Caller settlement and retirement\nremain separate. Closing the reply alias also removes an already-delivered\nresult, releasing captured bytes from the caller's mailbox.\n\n## Accounting and scope\n\nPer-call bounds cover output bytes, chunk metadata, encoded input and\nprivate frames. Captured chunks can coexist with an assembled result;\naccount for both copies. The helper has fixed input, queue and write\nbuffers and bounded initialization allocations. It requests 8 KiB child\npipes and a 4 KiB signal pipe. Kernel page rounding can increase the actual\ncapacities; a resize failure rejects startup. Parent pipes and Port delivery add\nbuffers outside the capture byte count. Aggregate accounting must measure\nactual pipe capacities. See [the protocol](../c_src/README.md).\n\nThis primitive has one request per worker and no shared request queue.\nApplications creating many independent callers need admission limits at\ntheir host/server boundary. A per-call ceiling is not a global memory\nceiling. Ordinary finite descendants are killed and reaped. Uninterruptible\ntasks, helper SIGKILL, hostile escape and host compromise are outside that\nguarantee; incomplete cleanup retains uncertainty and ownership.\n\nUse explicit sockets and `-N` for borrowed tmux servers. Retiring a client\nmust not stop a borrowed server. Intentional server creation and server-owned\njobs need their own ownership boundaries.\n\n## Building and distribution\n\nMix builds the shipped C source with a C11 compiler and Linux headers.\n`CC` may name one compiler executable. Generated binaries are excluded from\nHex archives and rebuilt during dependency compilation. No third-party\nruntime package or NIF is added.\n\nPacked-core checks must compile and execute outside the checkout.\nWorkspace/MCP escript extraction and helper discovery still need their\ninstalled-consumer checks; the current path expects an unpacked application\n`priv` directory. Other platforms remain unqualified.\n\n## Persistent connection components\n\nThe internal Guardian owns one native helper and monitors its Manager and\nrouter independently. Startup grants one stdout credit after router demand.\nAfter activation it keeps one native read in flight and buffers at most\n64 KiB or 128 stdout chunks while Router consumes its previous chunk. Each\nnative read and delivered chunk fits 8 KiB. Exceeding either queue ceiling\ncloses the epoch with `resource_limit`; it does not indefinitely stop reading\nfrom a still-attached client. These limits do not cap the borrowed tmux\nserver's allocations or total process memory.\n\nGuardian caps stderr at 8 KiB and 64 chunks, and acknowledges one write\nfragment at a time. A fragment fits 8 KiB; a complete rendered command fits\n64 KiB. The writer rechecks the consumed publication lease, original deadline\nand epoch. A partial line keeps its writer until the newline is acknowledged\nor the epoch closes. Completed slots retain their generation to reject replay.\n\nAfter orderly EOF or native exit, Guardian blocks further writes and drains\nalready-received stdout through the existing Router credits. An end token\nfollows pending native write acknowledgements; Router acknowledges it after\nprocessing earlier data and write messages. Only then does ordinary closure\nfinalize remaining operations. Explicit closure, owner loss or protocol failure\ncan abort that drain. Established results survive; unfinished effects remain\nuncertain. Drain and closure share the original 750 ms Guardian and 800 ms\nManager cleanup allowances. Neither clock restarts after data delivery.\nHelper terminal acknowledgement remains independent of Router progress.\n\nDeadline accounting uses one 25 ms timer, rescheduled only after consumption.\nBusy delivery closes the epoch instead of suspending the owner or retrying.\nRetirement needs native terminal proof, its acknowledgement and actual helper\nexit; missing proof or Manager loss leaves the shared lifetime unclean.\nSupervisor shutdown without those proofs also leaves it unclean.\n\nReserved closure revokes the exact lifetime generation without consuming a\ncommand or metadata slot. Guardian observes that word on its accounting\ntimer even when Manager or Router makes no progress. A concurrent\nstarting-to-ready transition cannot escape revocation; retries follow only\nthe same generation. Revocation requests closure and blocks later checks.\nIt does not prove cleanup or prevent a write that already passed its final\ncheck. Native and actor retirement remain separate required evidence.\n\nStartup uses `attach-session -E` to preserve the borrowed session environment.\nAttachment still changes client counts and session activity. After reading\nthe server PID and Linux process identity, a fresh same-connection challenge\nmust return the exact nonce/PID and receive a complete native write\nacknowledgement before activation. It shares the original startup deadline.\nThe server and inspected `/proc` must share a PID namespace.\n\nThis requires host authority for completed, clean configuration throughout\nthe epoch: no aliases overriding admitted command names, no executable\neffective hooks, and no unqualified messages or subscriptions that can write\nto the control stream. Other clients can inject multiline text through\nclient-directed messages; parser limits cannot authenticate such output.\nAbsence of a configuration-error notification cannot certify configuration.\nThe library never silently disables hooks or changes configuration.\n\nThe internal epoch router registers operation identity and FIFO position\nbefore sending fragments. A qualified reply after final-fragment dispatch\ncan establish an immutable logical result before the native acknowledgement\narrives. The writer still waits for native acknowledgement before advancing;\nwire retirement also requires it. Completed reply events survive a later\nparser error in the same chunk. Expired unsent work removes its exact queued\ntoken before capacity reuse. A retained reply observation and its logical\nresult are separate copies in the eventual connection byte accounting.\n\nThe initial lane admits encoded field reads and literal server user-option\nwrites, with bounded ASCII option names and no value expansion. It rejects\narbitrary command lines. Literal send-keys still needs domain qualification:\npane-mode key bindings can enqueue additional commands even with `-l`.\nReply numbers must increase when observed; gaps are normal because other\nclients and callbacks use the same server counter. This does not detect\nevery possible counter wrap or authenticate an unqualified stream.\n\nMetadata requests use a separate fixed ETS inbox before any wake message.\nIts context binds the real table owner, capacity, allowed request kinds and\natomics references. Publication creates the caller's reply alias and token;\nonly a small ready notification enters its mailbox. Owner completion and\ncaller receipt remain separate: a finished row stays occupied until alias\nclosure and receipt acknowledgement, or caller death. A monotone receipt\nword cannot regress when a delayed old close meets a replacement generation.\nWake hints also coalesce across slot reuse; accounting sweeps never clear a\nhint that a paused publisher still owns.\n\nInbox outcomes copy every binary leaf, including map keys. Copying charges\nbytes and nodes before allocation, caps depth at64 and nodes at8192, and\nrejects functions, ports and unqualified references. Known context references\ncome from explicitly identified, separately bounded resources. Metadata keeps\nthe default64 KiB outcome allowance; an independently configured Inbox may\nreserve1–128 KiB so a64 KiB reply plus its envelope fits. The1 KiB minimum\ncovers fixed fallback errors. Copying shares the original deadline, checked\nagain before result publication. These limits do\nnot yet establish complete connection-wide heap/work accounting.\n\nThe selected waiter design retains bounded outcome copies in receipt-controlled\nInbox rows, superseding the earlier record-reference-only proposal. This avoids\ncross-table pin/reclamation races at the cost of separately charged copies.\nThe internal waiter owner settles accepted requests from the exact immutable\nterminal record before releasing it. A prior pending read cannot justify\nforgetting a later completed record. Closed or expired waiters affect no\noperation state; pre-acceptance await failures retain unknown effect certainty.\nManager services its separate waiter Inbox before reconnect admission and\nstartup continuations, and again after actor events. Both explicit forget\nand automatic record expiry use the exact-record release barrier. A finished\nwaiter copy survives record reclamation and epoch replacement until receipt.\nLost waiter storage closes an active epoch and blocks this Manager's reuse.\nIf native retirement was already proved, that lifetime remains retired;\nthe Manager's fault does not erase cleanup knowledge or preserve lost tables\nacross its replacement.\n\nAccounting finalizes retained records for all observed dead destinations in\none lease scan, matching each epoch and PID together. It preserves acknowledged\nresults and dispatched uncertainty, and releases no live destination's record.\n\n`LibTmux.Operation` pins its original record, lease and Inboxes. Retained\nstatus and result reads are local. Each await claims a bounded independent\nslot and releases its exact alias and monitor on return; timeout does not\nstop the operation. Metadata admission errors cannot label existing effects\nas unwritten. Canonical failed, skipped and unknown outcomes remain values,\nincluding in bang functions. Forget uses the original lease epoch after\nreconnect. Stop validates the authoritative Births owner, epoch and Router\nbefore revoking its generation through reserved capacity; an already-retired\nrecord needs no surviving Births table. Stop closes the whole epoch and may\naffect siblings. It is a request, never rollback or native retirement proof.\n\nThe retained-record registry finalizes an epoch only after its exact Router\nPID has exited. It scans current admission leases, including a consumed\nlease whose Router died before storing its first record. Router stores its\nrecord and writing phase before sending, so an absent matching record proves\nno write under that ordering. Existing acknowledged results remain intact;\ndispatched work without evidence remains unknown. These outcomes retain\ntheir slots until explicit release. Clearing a released record uses its\nexact old value, preserving any replacement already published in that slot.\nLogical finalization does not prove Guardian/helper cleanup or authorize a\nnew epoch; Manager must separately establish complete resource retirement.\n\nStartup registration uses one fixed row for three epoch actor roles and its gate.\nEach actor records its own PID before side effects. Closing the gate captures\nall accepted PIDs in the same CAS; a queued late startup cannot be omitted\nbetween a separate read and close. Router and Guardian bind the supplied\nregistration to their manager, epoch and original deadline. Guardian also\nrechecks actor aliveness and its starting lifetime before opening the driver.\nAn accepted PID remains owned through actual exit: registration or a pre-open\ncheck can race later closure. Gate closure alone is not native retirement.\n\nManager keeps one asynchronous request to an ordinary Supervisor outstanding\nwhile it accounts for deadlines and metadata. A suspended Supervisor cannot\npark that accounting. Closing the reply alias does not cancel a queued\nSupervisor action; an abandoned unresolved start leaves cleanup unknown and\nblocks replacement. Captured actors remain monitored independently of the\nrequest alias. A Router born without a Guardian exits after the startup gate\ncloses. A captured pair binds even during closure, including buffered native\nretirement events.\n\nExplicit reconnect carries its original deadline through old retirement and\nnew bootstrap. Replacement requires native proof, actual Guardian and Router\nexit, the host's child-finalization acknowledgment and EpochSupervisor exit.\nManager restarts preserve the external lifetime latch and do not reconnect\nautomatically. The internal qualified cases retain outcomes across reconnect,\nforget exact completed leases, and expire retained records. Accepted metadata\nwork remains owned after caller timeout or alias closure; neither cancels it.\n\nThe internal connection Supervisor owns the view and starts EpochHost before\nManager. Its external child-spec factory pins the lifetime across root\nrestarts. Manager replacement invalidates its old tables; root replacement\nalso invalidates the view. A surviving view never recovers old operation\nevidence. Finite Supervisor shutdown can leave descendants alive; only the\nshared unknown/unretired lifetime prevents a replacement helper in that case.\nAn unsuccessful descriptor handoff after root startup kills the known root\nand reports cleanup uncertainty, even after observing root exit.\n\nThe internal startup adapter passes the remaining initialization budget to\nOTP's generic server entry with its source-qualified Supervisor init shape.\nOTP stores the adapter as its callback; the adapter delegates the original\nmodule and arguments. A private alias captures the exact Root PID before\ndelegation so cleanup drains only that Root's racing startup ACK or NACK.\nDescriptor publication rechecks the original deadline, and failed handoff\ncleanup uses only its remaining budget. OTP still waits for actual Root DOWN\nafter an initialization timeout; this primitive alone does not prove a strict\ncaller-return deadline or complete descendant retirement.\n\nBoth startup wrappers close their private reply aliases through local BIFs\nand zero-time receives. Timeout cleanup does not demand-load the shared reply\nhelper after Root exit. Isolated loader-gate checks qualify this dependency;\nthey do not bound OTP's actual-DOWN wait or explain earlier timing failures.\n\nFailed initial startup fences the fresh lifetime even before its first epoch\nreservation. If that reservation wins the CAS race, the fence closes only the\nfirst generation. Proven retirement remains intact, and later generations\ncannot be revoked by an old failure. Root cleanup uses its generation captured\nat startup entry. Manager can remain inert at generation zero with unknown\ncleanup through normal shutdown or Host loss, without creating epoch actors.\nThis fence handles observed startup failures; it does not establish recovery\nfrom untrappable caller or VM death. One lifetime belongs to one connection\nRoot; concurrent starts sharing that lifetime intentionally fail closed.\n\n`Control.start_link/1` requires an explicit Server, exact existing session ID\nand host-qualified lane. It returns `{:ok, root, control}` only after fresh\nbootstrap and a bounded ready exchange. Its 1..600000ms timeout includes\npreparation, Root startup and handoff; every successful handoff rechecks the\noriginal deadline. The provisional handle stays internal. Accepted ready\nreplies bind their exact endpoint without a later Births or latest-view lookup.\nIf startup failed before ready registration, the error retains the original\nfailure kind. Cleanup fences the lifetime, requests exact-Root termination,\nand reports actual Root exit only when observed. Native cleanup can remain\nunknown. Ordinary linked-process exits retain their OTP semantics.\n\n`Control.child_spec/1` prepares detached bounded process bytes without I/O.\nOne lifetime survives its permanent factory's invocations. Each invocation\nstarts a new startup budget, but a nonfresh lifetime returns inert instead of\nautomatically attaching. Explicit reconnect requires proven retirement;\nunknown cleanup, including generation zero, returns a structured error.\n`Supervisor.start_child/2` and `Supervisor.restart_child/2` return fresh handle\ninfo. After automatic restart, terminate and restart that exact child to obtain\nthe new info; this recovery does not clear unknown cleanup. Retain a distinct\nchild spec/lifetime per Root, and never use an old handle as a locator.\n\n`Control.submit/3` pins a ready Root view, Manager and epoch. It detaches the\nrequest's binary leaves under a separate 20,000-byte owned-term limit before\nclaiming a fixed operation slot. One deadline includes validation, admission,\nqueueing, writing and replies. After claim, pure Operation binding preserves\nthe handle even if context disappears. A final local gate check can suppress\npublication; the reserved lease stays owned. Its original deadline requests\nepoch closure; capacity still follows native/destination retirement and\nrecord retention or explicit forget rules. Router and Guardian independently\nvalidate before writing.\n\n`Control.request_close/1` requests whole-epoch closure without claiming a\nslot, including when operation and metadata capacity are full. It does not\nacknowledge native retirement or roll back siblings. Repeated requests for\nthe same closing or proven-retired generation succeed; old handles cannot\nfollow replacement Managers or epochs. Status errors report unknown\ncertainty about existing work; a rejected new, unadmitted submission reports\nno write.\n\n`Control.close/2` waits for native and epoch-actor retirement plus the Host's\nepoch-child finalization acknowledgement under its original budget. An\nadmitted metadata watcher retains its fixed Inbox cell\nthrough settlement, including after caller closure. Metadata settlement\nfailure blocks replacement. Ready watches never start a failed or closed\nepoch. Accepted retirement watches settle before reconnect in the same batch,\nindependent of slot order. Epoch reservation rechecks metadata and waiter\nstorage; lost storage cannot authorize replacement.\n\n`Control.reconnect/2` returns the acknowledged endpoint directly. A delayed\ncaller receives that epoch even if a newer one already exists; its handle\nthen reports stale. It does not reread the latest view or replay operations.\nThe Root and retained records outlive ordinary epoch closure. Public lifecycle\nerrors preserve unknown certainty about existing effects; direct retirement\nproof must still be observed within the original close budget.\n\nStrict caller-return startup bounds, connection-wide accounting and\nauthoritative subscriptions remain unqualified. These component checks do\nnot qualify those contracts.\n" + "content": "# Execution ownership\n\n`LibTmux.Transport.OneShot.run/3` runs an absolute executable and argv on\nLinux without a shell. It returns bytes, process exit status and cleanup\nevidence separately. A nonzero process exit is still a completed transport\nresult; the tmux command layer interprets that status. Public domain actions\nand persistent control use these ownership boundaries. Start with\n[one-shot actions](one-shot-actions.md) or [managed control](managed-control.md);\nthis guide explains the lower-level contracts.\n\nThe native helper supplies receive credits that an ordinary OTP Port\nlacks. It reads each stdout/stderr pipe only against one bounded credit;\nits control pipe stays responsive while output or stdin is blocked. A\ncapture limit after delivery cannot bound an upstream mailbox while its\nowner is descheduled.\n\n## Limits and results\n\nDefault ceilings are 1 MiB stdout, 64 KiB stderr and 4096 retained chunks.\nByte limits may be 0–16 MiB per stream; chunk limits may be 1–65,536.\n`max_total_bytes` limits both streams together to 0–32 MiB; its default is\nthe sum of the stream limits. The retained prefix obeys both ceilings.\nEncoded cwd, argv and environment together fit a 32 KiB initialization\npayload. Argv has at most 2,048 entries including its executable; environment\nhas at most 256 entries. Target environment values preserve empty strings and\nnon-NUL bytes; inherited tmux context is removed. Requested variables apply\nto child `execve`; the helper inherits the trusted host environment.\n\nThe timeout defaults to 5000 ms and is at most 600,000 ms. A caller can\npass an existing `LibTmux.Deadline` instead. Admission, startup and capture\nshare that budget. Cleanup has a separate allowance up to 750 ms. Expiry\nnever turns partial output into success.\n\nOverload stops the owned producer and returns a structured error with a\nbounded prefix. `cleanup: :retired` requires private child-retirement evidence\nand helper exit. Missing proof stays `:unknown`. An exit status or retryable\nerror never authorizes replay.\n\nThe worker acknowledges terminal child-retirement proof before the helper\nexits. The helper keeps its input open while earlier cancellation or read\ncredits drain; after acknowledgement the worker writes nothing further.\nThis preserves the helper's separate exit-status evidence. Missing\nacknowledgement uses the existing 750 ms delivery allowance.\n\nThe worker monitors its caller. Caller death initiates cleanup; worker/VM\ndeath closes the helper's parent pipe. Caller settlement and retirement\nremain separate. Closing the reply alias also removes an already-delivered\nresult, releasing captured bytes from the caller's mailbox.\n\n## Accounting and scope\n\nPer-call bounds cover output bytes, chunk metadata, encoded input and\nprivate frames. Captured chunks can coexist with an assembled result;\naccount for both copies. The helper has fixed input, queue and write\nbuffers and bounded initialization allocations. It requests 8 KiB child\npipes and a 4 KiB signal pipe. Kernel page rounding can increase the actual\ncapacities; a resize failure rejects startup. Parent pipes and Port delivery add\nbuffers outside the capture byte count. Aggregate accounting must measure\nactual pipe capacities. See [the protocol](../c_src/README.md).\n\nThis primitive has one request per worker and no shared request queue.\nApplications creating many independent callers need admission limits at\ntheir host/server boundary. A per-call ceiling is not a global memory\nceiling. Ordinary finite descendants are killed and reaped. Uninterruptible\ntasks, helper SIGKILL, hostile escape and host compromise are outside that\nguarantee; incomplete cleanup retains uncertainty and ownership.\n\nUse `-N` for borrowed tmux servers, and choose their socket on purpose: a\ndescriptor with no socket reaches the server `TMUX` names, or tmux's default\none outside tmux. Retiring a client\nmust not stop a borrowed server. `LibTmux.Server.start/1` is the separate\nlifecycle for a server the program creates: it holds a foreground `tmux -D`\nunder the helper's persistent mode, so the helper retires the server when its\nowner or the VM dies. Server-owned jobs still need their own ownership\nboundaries.\n\n## Building and distribution\n\nMix builds the shipped C source with a C11 compiler and Linux headers.\n`CC` may name one compiler executable. Generated binaries are excluded from\nHex archives and rebuilt during dependency compilation. No third-party\nruntime package or NIF is added.\n\nPacked-core checks must compile and execute outside the checkout.\nEscript extraction and helper discovery still need installed-consumer\nchecks; the current path expects an unpacked application `priv` directory. Other platforms remain unqualified.\n\n## Persistent connection components\n\nThe internal Guardian owns one native helper and monitors its Manager and\nrouter independently. Startup grants one stdout credit after router demand.\nAfter activation it keeps one native read in flight and buffers at most\n64 KiB or 128 stdout chunks while Router consumes its previous chunk. Each\nnative read and delivered chunk fits 8 KiB. Exceeding either queue ceiling\ncloses the epoch with `resource_limit`; it does not indefinitely stop reading\nfrom a still-attached client. These limits do not cap the borrowed tmux\nserver's allocations or total process memory.\n\nGuardian caps stderr at 8 KiB and 64 chunks, and acknowledges one write\nfragment at a time. A fragment fits 8 KiB; a complete rendered command fits\n64 KiB. The writer rechecks the consumed publication lease, original deadline\nand epoch. A partial line keeps its writer until the newline is acknowledged\nor the epoch closes. Completed slots retain their generation to reject replay.\n\nAfter orderly EOF or native exit, Guardian blocks further writes and drains\nalready-received stdout through the existing Router credits. An end token\nfollows pending native write acknowledgements; Router acknowledges it after\nprocessing earlier data and write messages. Only then does ordinary closure\nfinalize remaining operations. Explicit closure, owner loss or protocol failure\ncan abort that drain. Established results survive; unfinished effects remain\nuncertain. Drain and closure share the original 750 ms Guardian and 800 ms\nManager cleanup allowances. Neither clock restarts after data delivery.\nHelper terminal acknowledgement remains independent of Router progress.\n\nDeadline accounting uses one 25 ms timer, rescheduled only after consumption.\nBusy delivery closes the epoch instead of suspending the owner or retrying.\nRetirement needs native terminal proof, its acknowledgement and actual helper\nexit; missing proof or Manager loss leaves the shared lifetime unclean.\nSupervisor shutdown without those proofs also leaves it unclean.\n\nReserved closure revokes the exact lifetime generation without consuming a\ncommand or metadata slot. Guardian observes that word on its accounting\ntimer even when Manager or Router makes no progress. A concurrent\nstarting-to-ready transition cannot escape revocation; retries follow only\nthe same generation. Revocation requests closure and blocks later checks.\nIt does not prove cleanup or prevent a write that already passed its final\ncheck. Native and actor retirement remain separate required evidence.\n\nStartup uses `attach-session -E` to preserve the borrowed session environment.\nAttachment still changes client counts and session activity. After reading\nthe server PID and Linux process identity, a fresh same-connection challenge\nmust return the exact nonce/PID and receive a complete native write\nacknowledgement before activation. It shares the original startup deadline.\nThe server and inspected `/proc` must share a PID namespace.\n\nThis requires host authority for completed, clean configuration throughout\nthe epoch: no aliases overriding admitted command names, no executable\neffective hooks, and no unqualified messages or subscriptions that can write\nto the control stream. Other clients can inject multiline text through\nclient-directed messages; parser limits cannot authenticate such output.\nAbsence of a configuration-error notification cannot certify configuration.\nThe library never silently disables hooks or changes configuration.\n\nThe internal epoch router registers operation identity and FIFO position\nbefore sending fragments. A qualified reply after final-fragment dispatch\ncan establish an immutable logical result before the native acknowledgement\narrives. The writer still waits for native acknowledgement before advancing;\nwire retirement also requires it. Completed reply events survive a later\nparser error in the same chunk. Expired unsent work removes its exact queued\ntoken before capacity reuse. A retained reply observation and its logical\nresult are separate copies in the eventual connection byte accounting.\n\nThe lane admits encoded field reads, literal server user-option writes, split,\nrename and literal/named input. Option names are bounded ASCII and values do\nnot expand. It rejects arbitrary command lines and screen capture output.\nHost qualification includes pane-mode key bindings, which can enqueue other\ncommands in response to input.\nReply numbers must increase when observed; gaps are normal because other\nclients and callbacks use the same server counter. This does not detect\nevery possible counter wrap or authenticate an unqualified stream.\n\nMetadata requests use a separate fixed ETS inbox before any wake message.\nIts context binds the real table owner, capacity, allowed request kinds and\natomics references. Publication creates the caller's reply alias and token;\nonly a small ready notification enters its mailbox. Owner completion and\ncaller receipt remain separate: a finished row stays occupied until alias\nclosure and receipt acknowledgement, or caller death. A monotone receipt\nword cannot regress when a delayed old close meets a replacement generation.\nWake hints also coalesce across slot reuse; accounting sweeps never clear a\nhint that a paused publisher still owns.\n\nInbox outcomes copy every binary leaf, including map keys. Copying charges\nbytes and nodes before allocation, caps depth at 64 and nodes at 8192, and\nrejects functions, ports and unqualified references. Known context references\ncome from explicitly identified, separately bounded resources. Metadata keeps\nthe default 64 KiB outcome allowance; an independently configured Inbox may\nreserve 1–128 KiB so a 64 KiB reply plus its envelope fits. The 1 KiB minimum\ncovers fixed fallback errors. Copying shares the original deadline, checked\nagain before result publication. These limits do\nnot yet establish complete connection-wide heap/work accounting.\n\nThe selected waiter design retains bounded outcome copies in receipt-controlled\nInbox rows, superseding the earlier record-reference-only proposal. This avoids\ncross-table pin/reclamation races at the cost of separately charged copies.\nThe internal waiter owner settles accepted requests from the exact immutable\nterminal record before releasing it. A prior pending read cannot justify\nforgetting a later completed record. Closed or expired waiters affect no\noperation state; pre-acceptance await failures retain unknown effect certainty.\nManager services its separate waiter Inbox before reconnect admission and\nstartup continuations, and again after actor events. Both explicit forget\nand automatic record expiry use the exact-record release barrier. A finished\nwaiter copy survives record reclamation and epoch replacement until receipt.\nLost waiter storage closes an active epoch and blocks this Manager's reuse.\nIf native retirement was already proved, that lifetime remains retired;\nthe Manager's fault does not erase cleanup knowledge or preserve lost tables\nacross its replacement.\n\n### Managed execution\n\n`Control.execute/3` uses the same operation slots and a collection request in\nthe existing waiter Inbox. It waits for wire retirement, detaches the result\nfor every accepted collector, releases the exact operation lease, then makes\ncollector copies readable. Ordinary `Operation.await/2` may still return an\nacknowledged result before wire retirement. It does not reclaim the record.\n\nExpired or closed collectors settle independently. Failure to prepare the\nremaining bounded result copies preserves the record. Expiry after release\ncan still prevent delivery: `Control.ExecutionError` then reports lost\ncontext. No timeout establishes no effects or authorizes replay. Already\ncompleted waiter copies stay in their fixed Inbox slots until receipt or\ncaller death. An acknowledged completed row may be reused by a publisher\nthrough an exact-generation compare-and-swap, without waiting for a sweep;\nunfinished work cannot be recycled this way.\n\nA managed lease names its original publisher at admission. The Manager keeps\nat most one monitor per managed lease and reclaims a dead publisher's record\nonly after wire retirement, including death before collection registration.\nExisting actor events and publisher DOWN signals service this work; no\nper-command cleanup process is created. Existing unpublished-lease accounting\nstill fences a publication that never arrives before its deadline.\n\nAfter an execution error, a live caller can inspect its retained Operation\nuntil forget, expiry or Manager loss. Death of that original caller also\npermits reclamation, even if it passed the handle elsewhere. Use\n`Control.submit/3` for retention independent of the submitting process.\n\nAccounting finalizes retained records for all observed dead destinations in\none lease scan, matching each epoch and PID together. It preserves acknowledged\nresults and dispatched uncertainty, and releases no live destination's record.\n\n`LibTmux.Operation` pins its original record, lease and Inboxes. Retained\nstatus and result reads are local. Each await claims a bounded independent\nslot and releases its exact alias and monitor on return; timeout does not\nstop the operation. Metadata admission errors cannot label existing effects\nas unwritten. Canonical failed, skipped and unknown outcomes remain values,\nincluding in bang functions. Forget uses the original lease epoch after\nreconnect. Stop validates the authoritative Births owner, epoch and Router\nbefore revoking its generation through reserved capacity; an already-retired\nrecord needs no surviving Births table. Stop closes the whole epoch and may\naffect siblings. It is a request, never rollback or native retirement proof.\n\nThe retained-record registry finalizes an epoch only after its exact Router\nPID has exited. It scans current admission leases, including a consumed\nlease whose Router died before storing its first record. Router stores its\nrecord and writing phase before sending, so an absent matching record proves\nno write under that ordering. Existing acknowledged results remain intact;\ndispatched work without evidence remains unknown. These outcomes retain\ntheir slots until explicit release. Clearing a released record uses its\nexact old value, preserving any replacement already published in that slot.\nLogical finalization does not prove Guardian/helper cleanup or authorize a\nnew epoch; Manager must separately establish complete resource retirement.\n\nStartup registration uses one fixed row for three epoch actor roles and its gate.\nEach actor records its own PID before side effects. Closing the gate captures\nall accepted PIDs in the same CAS; a queued late startup cannot be omitted\nbetween a separate read and close. Router and Guardian bind the supplied\nregistration to their manager, epoch and original deadline. Guardian also\nrechecks actor aliveness and its starting lifetime before opening the driver.\nAn accepted PID remains owned through actual exit: registration or a pre-open\ncheck can race later closure. Gate closure alone is not native retirement.\n\nManager keeps one asynchronous request to an ordinary Supervisor outstanding\nwhile it accounts for deadlines and metadata. A suspended Supervisor cannot\npark that accounting. Closing the reply alias does not cancel a queued\nSupervisor action; an abandoned unresolved start leaves cleanup unknown and\nblocks replacement. Captured actors remain monitored independently of the\nrequest alias. A Router born without a Guardian exits after the startup gate\ncloses. A captured pair binds even during closure, including buffered native\nretirement events.\n\nExplicit reconnect carries its original deadline through old retirement and\nnew bootstrap. Replacement requires native proof, actual Guardian and Router\nexit, the host's child-finalization acknowledgment and EpochSupervisor exit.\nManager restarts preserve the external lifetime latch and do not reconnect\nautomatically. The internal qualified cases retain outcomes across reconnect,\nforget exact completed leases, and expire retained records. Accepted metadata\nwork remains owned after caller timeout or alias closure; neither cancels it.\n\nThe internal connection Supervisor owns the view and starts EpochHost before\nManager. Its external child-spec factory pins the lifetime across root\nrestarts. Manager replacement invalidates its old tables; root replacement\nalso invalidates the view. A surviving view never recovers old operation\nevidence. Finite Supervisor shutdown can leave descendants alive; only the\nshared unknown/unretired lifetime prevents a replacement helper in that case.\nAn unsuccessful descriptor handoff after root startup kills the known root\nand reports cleanup uncertainty, even after observing root exit.\n\nThe internal startup adapter passes the remaining initialization budget to\nOTP's generic server entry with its source-qualified Supervisor init shape.\nOTP stores the adapter as its callback; the adapter delegates the original\nmodule and arguments. A private alias captures the exact Root PID before\ndelegation so cleanup drains only that Root's racing startup ACK or NACK.\nDescriptor publication rechecks the original deadline, and failed handoff\ncleanup uses only its remaining budget. OTP still waits for actual Root DOWN\nafter an initialization timeout; this primitive alone does not prove a strict\ncaller-return deadline or complete descendant retirement.\n\nThe adapter is maintained against\n[OTP 29.1.2 supervisor startup](https://github.com/erlang/otp/blob/d199a49a01a2079afb6f2c5c9ae047cd4555e68d/lib/stdlib/src/supervisor.erl#L547-L548)\nand [proc_lib timeout cleanup](https://github.com/erlang/otp/blob/d199a49a01a2079afb6f2c5c9ae047cd4555e68d/lib/stdlib/src/proc_lib.erl#L438-L453).\nThe public Supervisor API has no initialization timeout option. The adapter\nrejects runtime OTP majors other than 29, or a library build made with an\nElixir compiled for another OTP major, as `unsupported_runtime` with no-write\ncertainty before Root startup. Build identity is captured at compilation so\nthis check cannot demand-load version parsing during a cold startup.\nThis is a major-version guard, not patch qualification: the support manifest\nand reference/tracking runtime checks enforce the declared patch minima and\nverify the running Elixir's compiled OTP identity. Passing the guard alone\ndoes not qualify every OTP 29 patch.\n\nWhen updating OTP support, review the pinned Supervisor initialization shape,\nparent handling and `proc_lib` timeout/ACK cleanup. Run the direct adapter,\nconnection-Supervisor, cold-loader and native startup/ownership checks on the\nreference and resolved tracking toolchains before changing the guard. Record\ntheir actual versions; identical resolutions qualify one toolchain pair.\n\nPublic `Supervisor.start_link` has no initialization timeout. A temporary\n`proc_lib` bridge changes the Root's recorded parent; transferring a link does\nnot adopt a new parent. An external watchdog that kills a still-linked Root\ncan kill a non-trapping caller. Replacing the adapter requires a qualified\nhandoff design as well as a timer. The current isolated dependency remains\nprivate OTP coupling despite these compatibility checks.\n\nThe initialization timer belongs to the caller. If that caller dies while\nthe Supervisor callback is blocked, the Root can outlive its original\ndeadline: the Supervisor traps the parent's exit until initialization returns.\nThe adapter does not promise cleanup after untrappable startup-caller death.\n\nBoth startup wrappers close their private reply aliases through local BIFs\nand zero-time receives. Timeout cleanup does not demand-load the shared reply\nhelper after Root exit. Isolated loader-gate checks qualify this dependency;\nthey do not bound OTP's actual-DOWN wait or explain earlier timing failures.\n\nFailed initial startup fences the fresh lifetime even before its first epoch\nreservation. If that reservation wins the CAS race, the fence closes only the\nfirst generation. Proven retirement remains intact, and later generations\ncannot be revoked by an old failure. Root cleanup uses its generation captured\nat startup entry. Manager can remain inert at generation zero with unknown\ncleanup through normal shutdown or Host loss, without creating epoch actors.\nThis fence handles observed startup failures; it does not establish recovery\nfrom untrappable caller or VM death. One lifetime belongs to one connection\nRoot; concurrent starts sharing that lifetime intentionally fail closed.\n\n`Control.start_link/1` requires an explicit Server, exact existing session ID\nand host-qualified lane. It returns `{:ok, root, control}` only after fresh\nbootstrap and a bounded ready exchange. Its 1..600000ms timeout includes\npreparation, Root startup and handoff; every successful handoff rechecks the\noriginal deadline. The provisional handle stays internal. Accepted ready\nreplies bind their exact endpoint without a later Births or latest-view lookup.\nIf startup failed before ready registration, the error retains the original\nfailure kind. Cleanup fences the lifetime, requests exact-Root termination,\nand reports actual Root exit only when observed. Native cleanup can remain\nunknown. Ordinary linked-process exits retain their OTP semantics.\n\n`Control.child_spec/1` prepares detached bounded process bytes without I/O.\nOne lifetime survives its permanent factory's invocations. Each invocation\nstarts a new startup budget, but a nonfresh lifetime returns inert instead of\nautomatically attaching. Explicit reconnect requires proven retirement;\nunknown cleanup, including generation zero, returns a structured error.\n`Supervisor.start_child/2` and `Supervisor.restart_child/2` return fresh handle\ninfo. After automatic restart, terminate and restart that exact child to obtain\nthe new info; this recovery does not clear unknown cleanup. Retain a distinct\nchild spec/lifetime per Root, and never use an old handle as a locator.\n\n`Control.submit/3` pins a ready Root view, Manager and epoch. It detaches the\nrequest's binary leaves under a separate 20,000-byte owned-term limit before\nclaiming a fixed operation slot. One deadline includes validation, admission,\nqueueing, writing and replies. After claim, pure Operation binding preserves\nthe handle even if context disappears. A final local gate check can suppress\npublication; the reserved lease stays owned. Its original deadline requests\nepoch closure; capacity still follows native/destination retirement and\nrecord retention or explicit forget rules. Router and Guardian independently\nvalidate before writing.\n\n`Control.request_close/1` requests whole-epoch closure without claiming a\nslot, including when operation and metadata capacity are full. It does not\nacknowledge native retirement or roll back siblings. Repeated requests for\nthe same closing or proven-retired generation succeed; old handles cannot\nfollow replacement Managers or epochs. Status errors report unknown\ncertainty about existing work; a rejected new, unadmitted submission reports\nno write.\n\n`Control.close/2` waits for native and epoch-actor retirement plus the Host's\nepoch-child finalization acknowledgement under its original budget. An\nadmitted metadata watcher retains its fixed Inbox cell\nthrough settlement, including after caller closure. Metadata settlement\nfailure blocks replacement. Ready watches never start a failed or closed\nepoch. Accepted retirement watches settle before reconnect in the same batch,\nindependent of slot order. Epoch reservation rechecks metadata and waiter\nstorage; lost storage cannot authorize replacement.\n\n`Control.reconnect/2` returns the acknowledged endpoint directly. A delayed\ncaller receives that epoch even if a newer one already exists; its handle\nthen reports stale. It does not reread the latest view or replay operations.\nThe Root and retained records outlive ordinary epoch closure. Public lifecycle\nerrors preserve unknown certainty about existing effects; direct retirement\nproof must still be observed within the original close budget.\n\nStrict caller-return startup bounds, connection-wide accounting and\nauthoritative subscriptions remain unqualified. These component checks do\nnot qualify those contracts.\n" }, { "path": "docs/encoding.md", - "content": "# Command and field encoding\n\n`LibTmux.Command` is a value. Constructing it or rendering its bytes performs\nno I/O. The one-shot and control transports remain under implementation.\n\n## Separate parsers\n\n`Command.argv/2` returns process arguments and protects terminal semicolons\nfrom tmux's argument-vector parser. It does not invoke a shell.\n`Command.render/2` produces one tmux command line with every argument byte\noctal-escaped inside double quotes. The result contains no raw newline or\ncarriage return. It excludes the framing newline a future writer must add.\nBoth renderers validate the encoded byte budget before dispatch.\n\nCommand quoting does not protect a value that a command interprets as a\ntmux format. `LibTmux.Format.literal/1` constructs a literal format operand\nwithout evaluating embedded `#{...}`, shell jobs or shorthand variables.\nIt accepts non-NUL bytes. The command still needs its own appropriate\nformat flags; arbitrary commands have different expansion behavior.\n\n## One field per response\n\n`Format.field/1` encodes a named field with a `v1:` marker. It replaces\nbackslashes first, then dollars and ASCII control bytes, using fixed tmux\nsubstitutions. `LibTmux.Codec.decode_field/3` with `encoding: :escaped_v1`\nrequires that marker, removes one framing newline and decodes escapes once.\nThe conservative format performs several substitutions; it makes no\nzero-copy or optimized multi-field claim.\n\nThis encoding avoids an ambiguity in tmux 3.4: its command print path\nescapes some bytes while preserving literal backslashes. Removing arbitrary\nbackslashes from that output would corrupt legitimate values. A versioned\nfield encoding protects those values before printing. A separator byte\nalone cannot do that, because titles and paths may contain it.\n\nThe default raw decoder removes only the final framing newline. Its source\nmust independently guarantee unmodified bytes. It must not be applied to\nan unqualified tmux print path. Text decoding requires UTF-8; `:bytes`\nretains arbitrary bytes. Integer parsing consumes the whole value and can\nenforce a range; Boolean parsing accepts only `0` or `1`.\n\n## Bounded framing\n\n`LibTmux.Protocol` is a pure control-mode parser with separate chunk, line,\nframe, line-count and emitted-event ceilings. It retains reply guard IDs;\nnotification-looking lines inside a reply remain output. A rejected suffix\npreserves completed prefix events in the structured error. Retire a lane\nafter a parse error.\n\nLexical parsing cannot authenticate output that forges a matching guard.\nCommands, aliases, hooks and subscriptions require separate admission\nrules before sharing a persistent lane. Parser ceilings also do not bound\nupstream Port delivery or a connection owner's mailbox. Those transport\ncontracts require independent qualification.\n" + "content": "# Command and field encoding\n\n`LibTmux.Command` is a value. Constructing it or rendering its bytes performs\nno I/O. Both one-shot execution and the qualified persistent control lane\nuse these encoders.\n\n## Separate parsers\n\n`Command.argv/2` returns process arguments and protects terminal semicolons\nfrom tmux's argument-vector parser. It does not invoke a shell.\n`Command.render/2` produces one tmux command line with every argument byte\noctal-escaped inside double quotes. The result contains no raw newline or\ncarriage return. It excludes the framing newline the control writer adds.\nBoth renderers validate the encoded byte budget before dispatch.\n\nCommand quoting does not protect a value that a command interprets as a\ntmux format. `LibTmux.Format.literal/1` constructs a literal format operand\nwithout evaluating embedded `#{...}`, shell jobs or shorthand variables.\nIt accepts non-NUL bytes. The command still needs its own appropriate\nformat flags; arbitrary commands have different expansion behavior.\n\n## One field per response\n\n`Format.field/1` encodes a named field with a `v1:` marker. It replaces\nbackslashes first, then dollars and ASCII control bytes, using fixed tmux\nsubstitutions. `LibTmux.Codec.decode_field/3` with `encoding: :escaped_v1`\nrequires that marker, removes one framing newline and decodes escapes once.\nThe conservative field format performs several substitutions.\n\nThis encoding avoids an ambiguity in tmux 3.4: its command print path\nescapes some bytes while preserving literal backslashes. Removing arbitrary\nbackslashes from that output would corrupt legitimate values. A versioned\nfield encoding protects those values before printing. A separator byte\nalone cannot do that, because titles and paths may contain it.\n\nThe default raw decoder removes only the final framing newline. Its source\nmust independently guarantee unmodified bytes. It must not be applied to\nan unqualified tmux print path. Text decoding requires UTF-8; `:bytes`\nretains arbitrary bytes. Integer parsing consumes the whole value and can\nenforce a range; Boolean parsing accepts only `0` or `1`.\n\n## Capture rows\n\nSnapshot capture reads free-form fields with one listing each for sessions,\nwindows and panes. Each row starts with `r1:N`, followed by N tab-separated\n`v1:` fields and one final newline. The first field identifies the entity.\nEach field uses the conservative encoder above: tabs and newlines inside\nvalues become escapes, so they cannot become row delimiters. The decoder\nchecks the version, field count and schema. Invalid UTF-8 remains an error\nfor text fields. Missing identities or conflicting linked rows trigger the\nexisting finite reconciliation retry.\n\nThe default response ceiling remains 64 KiB, including markers and separators.\nIf a combined listing exceeds it and the client has retired, capture reuses\nindividual reads for that entity kind. Each individual row contains its text\nfields without the extra ID column. A row that still exceeds the ceiling\nfails; no partial graph is returned. Timeout, decoding, stderr-limit and\nuncertain-cleanup failures do not trigger this fallback.\n\nA successful attempt uses 13 commands when all three text listings fit.\nFallback adds one command per physical entity of the overflowing kind.\nEvery command launches one owned helper and one tmux client. Linked text rows\ncan repeat in a listing; identical values are deduplicated after decoding.\nBoth topology scans count contextual rows against `max_entities`. Text\nresponses are bounded by the command and byte budgets.\n\nAll reads, including an overflowing listing, consume the same command, byte\nand deadline budgets. Compared with earlier alpha captures, callers using\ntightly sized budgets may need more allowance for ID framing, duplicated\nlinked text or fallback work. The individually accepted row size is unchanged.\nReuse a snapshot for several local queries and capture again when fresh state\nis needed. This encoding does not qualify arbitrary pane output or hook output\nfor a shared control lane.\n\n## Bounded framing\n\n`LibTmux.Protocol` is a pure control-mode parser with separate chunk, line,\nframe, line-count and emitted-event ceilings. It retains reply guard IDs;\nnotification-looking lines inside a reply remain output. A rejected suffix\npreserves completed prefix events in the structured error. Retire a lane\nafter a parse error.\n\nLexical parsing cannot authenticate output that forges a matching guard.\nCommands, aliases, hooks and subscriptions require separate admission\nrules before sharing a persistent lane. Parser ceilings also do not bound\nupstream Port delivery or a connection owner's mailbox. Those transport\ncontracts require independent qualification.\n" }, { "path": "docs/schema.md", - "content": "# Observation and filter schema\n\nGenerated from `LibTmux.Schema`; regenerate with `mix run scripts/generate_schema.exs`.\nAll current fields use the tmux 3.3 capture baseline. Coverage must still be loaded.\nOnly `nullable_integer` admits `nil`; other unavailable or unloaded fields raise.\nLink IDs are `{session_id, index, window_id}` locally and three-element arrays on the wire.\nSee [filtering](filtering.md) for Boolean, relation and error semantics.\n\n## `session`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `attached` | `attached` | `:boolean` | Derived | `equals`, `not`, `in`, `not_in` |\n| `attached_count` | `attachedCount` | `:integer` | `session_attached` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `id` | `id` | `{:id, :session}` | `session_id` | `equals`, `not`, `in`, `not_in` |\n| `name` | `name` | `:string` | `session_name` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `active_window` | `activeWindow` | `one` | `window` | `is`, `is_not` |\n| `clients` | `clients` | `many` | `client` | `some`, `every`, `none`, `count` |\n| `panes` | `panes` | `many` | `pane` | `some`, `every`, `none`, `count` |\n| `window_links` | `windowLinks` | `many` | `window_link` | `some`, `every`, `none`, `count` |\n| `windows` | `windows` | `many` | `window` | `some`, `every`, `none`, `count` |\n\n## `window`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `height` | `height` | `:integer` | `window_height` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `id` | `id` | `{:id, :window}` | `window_id` | `equals`, `not`, `in`, `not_in` |\n| `layout` | `layout` | `:string` | `window_layout` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `name` | `name` | `:string` | `window_name` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `width` | `width` | `:integer` | `window_width` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `zoomed` | `zoomed` | `:boolean` | `window_zoomed_flag` | `equals`, `not`, `in`, `not_in` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `panes` | `panes` | `many` | `pane` | `some`, `every`, `none`, `count` |\n| `sessions` | `sessions` | `many` | `session` | `some`, `every`, `none`, `count` |\n| `window_links` | `windowLinks` | `many` | `window_link` | `some`, `every`, `none`, `count` |\n\n## `window_link`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `active` | `active` | `:boolean` | `window_active` | `equals`, `not`, `in`, `not_in` |\n| `id` | `id` | `{:id, :window_link}` | Derived | `equals`, `not`, `in`, `not_in` |\n| `index` | `index` | `:integer` | `window_index` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `session_id` | `sessionId` | `{:id, :session}` | `session_id` | `equals`, `not`, `in`, `not_in` |\n| `window_id` | `windowId` | `{:id, :window}` | `window_id` | `equals`, `not`, `in`, `not_in` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `session` | `session` | `one` | `session` | `is`, `is_not` |\n| `window` | `window` | `one` | `window` | `is`, `is_not` |\n\n## `pane`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `active` | `active` | `:boolean` | `pane_active` | `equals`, `not`, `in`, `not_in` |\n| `current_command` | `currentCommand` | `:string` | `pane_current_command` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `current_path` | `currentPath` | `:string` | `pane_current_path` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `dead` | `dead` | `:boolean` | `pane_dead` | `equals`, `not`, `in`, `not_in` |\n| `exit_status` | `exitStatus` | `:nullable_integer` | `pane_dead_status` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `height` | `height` | `:integer` | `pane_height` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `id` | `id` | `{:id, :pane}` | `pane_id` | `equals`, `not`, `in`, `not_in` |\n| `index` | `index` | `:integer` | `pane_index` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `pid` | `pid` | `:integer` | `pane_pid` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `title` | `title` | `:string` | `pane_title` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `width` | `width` | `:integer` | `pane_width` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `window_id` | `windowId` | `{:id, :window}` | `window_id` | `equals`, `not`, `in`, `not_in` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `window` | `window` | `one` | `window` | `is`, `is_not` |\n\n## `client`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `control_mode` | `controlMode` | `:boolean` | `client_control_mode` | `equals`, `not`, `in`, `not_in` |\n| `height` | `height` | `:nullable_integer` | `client_height` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `id` | `id` | `{:id, :client}` | `client_name` | `equals`, `not`, `in`, `not_in` |\n| `pid` | `pid` | `:integer` | `client_pid` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `session_id` | `sessionId` | `{:id, :session}` | `session_id` | `equals`, `not`, `in`, `not_in` |\n| `width` | `width` | `:integer` | `client_width` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `session` | `session` | `one` | `session` | `is`, `is_not` |\n" + "content": "# Observation and filter schema\n\nGenerated from `LibTmux.Schema`; regenerate with `mix run scripts/generate_schema.exs`.\nAll current fields use the tmux 3.3 capture baseline. Coverage must still be loaded.\nOnly `nullable_integer` admits `nil`; other unavailable or unloaded fields raise.\nLink IDs are `{session_id, index, window_id}` locally and three-element arrays on the wire.\nSee [filtering](filtering.md) for Boolean, relation and error semantics.\n\n## `session`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `attached` | `attached` | `:boolean` | Derived | `equals`, `not`, `in`, `not_in` |\n| `attached_count` | `attachedCount` | `:integer` | `session_attached` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `id` | `id` | `{:id, :session}` | `session_id` | `equals`, `not`, `in`, `not_in` |\n| `name` | `name` | `:string` | `session_name` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `active_window` | `activeWindow` | `one` | `window` | `is`, `is_not` |\n| `clients` | `clients` | `many` | `client` | `some`, `every`, `none`, `count` |\n| `panes` | `panes` | `many` | `pane` | `some`, `every`, `none`, `count` |\n| `window_links` | `windowLinks` | `many` | `window_link` | `some`, `every`, `none`, `count` |\n| `windows` | `windows` | `many` | `window` | `some`, `every`, `none`, `count` |\n\n## `window`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `height` | `height` | `:integer` | `window_height` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `id` | `id` | `{:id, :window}` | `window_id` | `equals`, `not`, `in`, `not_in` |\n| `layout` | `layout` | `:string` | `window_layout` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `name` | `name` | `:string` | `window_name` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `width` | `width` | `:integer` | `window_width` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `zoomed` | `zoomed` | `:boolean` | `window_zoomed_flag` | `equals`, `not`, `in`, `not_in` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `panes` | `panes` | `many` | `pane` | `some`, `every`, `none`, `count` |\n| `sessions` | `sessions` | `many` | `session` | `some`, `every`, `none`, `count` |\n| `window_links` | `windowLinks` | `many` | `window_link` | `some`, `every`, `none`, `count` |\n\n## `window_link`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `active` | `active` | `:boolean` | `window_active` | `equals`, `not`, `in`, `not_in` |\n| `id` | `id` | `{:id, :window_link}` | Derived | `equals`, `not`, `in`, `not_in` |\n| `index` | `index` | `:integer` | `window_index` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `session_id` | `sessionId` | `{:id, :session}` | `session_id` | `equals`, `not`, `in`, `not_in` |\n| `window_id` | `windowId` | `{:id, :window}` | `window_id` | `equals`, `not`, `in`, `not_in` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `session` | `session` | `one` | `session` | `is`, `is_not` |\n| `window` | `window` | `one` | `window` | `is`, `is_not` |\n\n## `pane`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `active` | `active` | `:boolean` | `pane_active` | `equals`, `not`, `in`, `not_in` |\n| `current_command` | `currentCommand` | `:string` | `pane_current_command` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `current_path` | `currentPath` | `:string` | `pane_current_path` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `dead` | `dead` | `:boolean` | `pane_dead` | `equals`, `not`, `in`, `not_in` |\n| `exit_status` | `exitStatus` | `:nullable_integer` | `pane_dead_status` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `height` | `height` | `:integer` | `pane_height` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `id` | `id` | `{:id, :pane}` | `pane_id` | `equals`, `not`, `in`, `not_in` |\n| `index` | `index` | `:integer` | `pane_index` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `pid` | `pid` | `:nullable_integer` | `pane_pid` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `title` | `title` | `:string` | `pane_title` | `equals`, `not`, `in`, `not_in`, `contains`, `starts_with`, `ends_with` |\n| `width` | `width` | `:integer` | `pane_width` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `window_id` | `windowId` | `{:id, :window}` | `window_id` | `equals`, `not`, `in`, `not_in` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `window` | `window` | `one` | `window` | `is`, `is_not` |\n\n## `client`\n\n| Elixir field | Wire field | Value category | tmux format | Operators |\n| --- | --- | --- | --- | --- |\n| `control_mode` | `controlMode` | `:boolean` | `client_control_mode` | `equals`, `not`, `in`, `not_in` |\n| `height` | `height` | `:nullable_integer` | `client_height` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `id` | `id` | `{:id, :client}` | `client_name` | `equals`, `not`, `in`, `not_in` |\n| `pid` | `pid` | `:integer` | `client_pid` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n| `session_id` | `sessionId` | `{:id, :session}` | `session_id` | `equals`, `not`, `in`, `not_in` |\n| `width` | `width` | `:integer` | `client_width` | `equals`, `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte` |\n\n| Relation | Wire relation | Cardinality | Target | Operators |\n| --- | --- | --- | --- | --- |\n| `session` | `session` | `one` | `session` | `is`, `is_not` |\n" } ] } diff --git a/site/src/lib/api-models.ts b/site/src/lib/api-models.ts index 2091040f6..7c49b58e1 100644 --- a/site/src/lib/api-models.ts +++ b/site/src/lib/api-models.ts @@ -332,10 +332,20 @@ export function createApiIndex(model: ApiModelBase & { port?: string; language?: const language = model.port ?? model.language const docRoot = model.symbols[0] && /^(.*\/)reference\//.exec(hrefFor(model.symbols[0]))?.[1] const guideLinks = language && PORT_BY_SLUG[language] && docRoot ? apiDocLinksFor(language, docRoot) : new Map() + // ExDoc writes its extra pages beside module pages. On the shared site + // the compiled reference entries live one directory deeper. + const hexDocs = language === 'elixir' && PORT_BY_SLUG.elixir?.ecosystemHost?.url + const hexVersion = model.sources?.find((source) => source.product === 'core')?.version const index = new SymbolIndex(model.symbols, hrefFor, language, (href) => { const cut = href.indexOf('#') - const target = guideLinks.get(cut < 0 ? href : href.slice(0, cut)) - return target ? target + (cut < 0 ? '' : href.slice(cut)) : href + const page = cut < 0 ? href : href.slice(0, cut) + const fragment = cut < 0 ? '' : href.slice(cut) + const target = guideLinks.get(page) ?? (hexDocs && guideLinks.get(page.replace(/\.html$/, '.md'))) + if (target) return target + fragment + if (hexDocs && /^[a-z][a-z0-9_-]*\.html$/.test(page)) { + return new URL((hexVersion ? `${hexVersion}/` : '') + page + fragment, hexDocs).href + } + return href }) for (const { data, baseUrl, langs, project } of INVENTORIES) { if (!language || !langs.includes(language)) continue diff --git a/site/src/lib/port-documentation.ts b/site/src/lib/port-documentation.ts index 0b76e0442..d0694ce0d 100644 --- a/site/src/lib/port-documentation.ts +++ b/site/src/lib/port-documentation.ts @@ -368,6 +368,7 @@ const PORT_DOCUMENTATION: Readonly> = { redirects: [{ sourcePath: 'docs/guides.md', path: 'guides/overview', target: 'guides' }, { path: 'guides/workspace-json', target: '' }, { path: 'workspace', target: '' }], }, elixir: { + apiDocRoot: 'docs', domains: [ { id: 'core', label: 'Core library', kind: 'core', navGroup: 'Library', route: 'core', package: 'core', @@ -383,6 +384,14 @@ const PORT_DOCUMENTATION: Readonly> = { description: 'Select observed values with portable keyword and operator filters.', aliases: [], sidebar: { group: 'Guides', order: 3 }, }), + guide('docs/supervised-control.md', 'guides/supervised-control', 'core', { + description: 'Keep a connection handle in an application and reconnect after known retirement.', + aliases: [], sidebar: { group: 'Guides', order: 4 }, + }), + guide('docs/advanced-execution.md', 'guides/advanced-execution', 'core', { + description: 'Inspect captured state, own a retained control operation and check cleanup.', + aliases: [], sidebar: { group: 'Guides', order: 5 }, + }), guide('docs/first-task.md', 'examples/capture-and-read', 'core', { title: 'Capture a pane and read it', description: 'Capture a graph, select a pane and read it through one-shot and control commands.', aliases: [], sidebar: { group: 'Examples', order: 3 }, diff --git a/site/test/api-prose.test.ts b/site/test/api-prose.test.ts index 8a9ff4487..1d464b276 100644 --- a/site/test/api-prose.test.ts +++ b/site/test/api-prose.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { readFileSync } from 'node:fs' import { fromMarkdown } from 'mdast-util-from-markdown' -import { API_MODELS } from '../src/lib/api-models' +import { API_MODELS, createApiIndex } from '../src/lib/api-models' import { symbolMarkdown } from '../src/lib/symbol-markdown' import { SymbolIndex, tokenizeDoc } from '@libtmux/api-model/reference' import { parseApiProse } from '@libtmux/api-model/reference' @@ -13,6 +13,23 @@ import config from '../ec.config.mjs' import { codeLang } from '../src/lib/highlight' describe('shared API prose blocks', () => { + it('routes ExDoc guides from nested symbol pages and keeps section fragments', () => { + const model = API_MODELS.elixir! + const version = '0.1.3' + const index = createApiIndex( + { ...model, sources: model.sources!.map((source) => ({ ...source, version })) }, + (symbol) => `/elixir/latest/reference/${symbol.slug}/`, + ) + const links = index.docSpans('[Supervisor](supervised-control.html#store-the-handle) [Transport](advanced-execution.html) [Filter](filtering.html) [Recovery](recovery.html)') + .filter((span) => span.kind === 'link').map((span) => span.href) + expect(links).toEqual([ + '/elixir/latest/guides/supervised-control/#store-the-handle', + '/elixir/latest/guides/advanced-execution/', + '/elixir/latest/guides/filtering/', + 'https://libtmux.hexdocs.pm/0.1.3/recovery.html', + ]) + }) + it('preserves fenced source instead of treating prompts, comments and bullets as prose', () => { expect(parseApiProse('Before.\n\n```python\n>>> values = [\n... 1,\n... ]\n[1]\n\n# literal\n- literal\n```\n\nAfter.')).toEqual([ { kind: 'p', text: 'Before.' }, diff --git a/site/test/core-scope-exit.test.ts b/site/test/core-scope-exit.test.ts index 02d663231..21e8cf98b 100644 --- a/site/test/core-scope-exit.test.ts +++ b/site/test/core-scope-exit.test.ts @@ -34,7 +34,7 @@ describe('the scope-exit steps of the Core home recordings', () => { it('are the ones the recordings name, and a port that adds one extends this list', () => { expect(ports.flatMap((port) => Object.entries(recording(port).capabilities).flatMap(([id, capability]) => capability.steps.filter((step) => step.scopeExit).map((step) => `${port}/${id}/${step.id}`)))) .toEqual([ - 'csharp/typed-graph/kill', 'erlang/typed-graph/retire', 'go/typed-graph/kill', 'go/run-applications/kill', 'go/watch/kill', 'haskell/typed-graph/retire-server', + 'csharp/typed-graph/kill', 'elixir/typed-graph/retire', 'erlang/typed-graph/retire', 'go/typed-graph/kill', 'go/run-applications/kill', 'go/watch/kill', 'haskell/typed-graph/retire-server', 'lisp/typed-graph/stop-daemon', 'ocaml/typed-graph/close', 'ocaml/typed-graph/retire', 'raku/typed-graph/close', 'swift/typed-graph/kill', ]) }) From c4a7b0e4a690b79ece0c0e37ec86daf93dd8e460 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 2 Dec 2026 18:07:40 -0600 Subject: [PATCH 2/8] docs(elixir) Index lifecycle guide mentions why: Source staging adds and moves Elixir references in lifecycle guides. The publication check compares the tracked index against the staged routes and the ownership suite checks unresolved names. what: - Link the named Elixir standard-library calls to verified anchors. - Keep the planned names, example module and capture row prefix plain. - Regenerate the index from the pinned sources and retain the unresolved-name checks. --- packages/api-model/src/builtins.ts | 3 +- packages/api-model/src/prose.ts | 6 + packages/api-model/test/mentions.test.ts | 14 + site/src/data/mentions.json | 453 +++++++++++++++++++++-- 4 files changed, 434 insertions(+), 42 deletions(-) diff --git a/packages/api-model/src/builtins.ts b/packages/api-model/src/builtins.ts index 61fcf2236..aaaac872a 100644 --- a/packages/api-model/src/builtins.ts +++ b/packages/api-model/src/builtins.ts @@ -138,7 +138,8 @@ export function elixirStdlibHref(path: string, name?: string, arity?: number, ki * removed name stays unlinked instead of pointing at a page without it. */ const ELIXIR_STDLIB_FUNCTIONS: readonly (readonly [module: string, name: string, arity: number])[] = [ - ['Enum', 'member?', 2], ['JSON', 'encode!', 1], ['Supervisor', 'start_child', 2], ['Supervisor', 'restart_child', 2], + ['Enum', 'map', 2], ['Enum', 'member?', 2], ['Enum', 'to_list', 1], ['GenServer', 'call', 2], + ['JSON', 'encode!', 1], ['Supervisor', 'start_child', 2], ['Supervisor', 'restart_child', 2], ] /** The typespec grammar names these without a module. */ diff --git a/packages/api-model/src/prose.ts b/packages/api-model/src/prose.ts index 9522ee8ce..e22a8f395 100644 --- a/packages/api-model/src/prose.ts +++ b/packages/api-model/src/prose.ts @@ -263,6 +263,12 @@ export function notApiReason(text: string, port?: string): string | undefined { const t = text.trim() if (port === 'haskell' && /^(?:next-X\.Y|X\.Y(?:[a-z]|-rcN?)?)$/.test(t)) return 'tmux release pattern' if (port === 'haskell' && t === 'With') return 'deadline variant suffix' + if (port === 'elixir') { + // The overview names these planned features before they have reference pages. + if (['Query', 'Batch', 'Plan', 'Observation', 'Tracker'].includes(t)) return 'planned Elixir feature' + if (t === 'ApplicationConnection') return 'example module' + if (t === 'r1:N') return 'capture row prefix' + } for (const { why, test } of NOT_API) { if (port === 'lisp' && why === 'configuration key' && /^libtmux(?:\.[\w-]+)*:[\w-]+$/.test(t)) continue if (test.test(t)) return why diff --git a/packages/api-model/test/mentions.test.ts b/packages/api-model/test/mentions.test.ts index 733d1da09..5b34dbd26 100644 --- a/packages/api-model/test/mentions.test.ts +++ b/packages/api-model/test/mentions.test.ts @@ -138,6 +138,20 @@ describe('distribution files, wire format names and query paths', () => { }) }) +describe('Elixir lifecycle prose', () => { + it('leaves the known non-API spans plain without hiding unknown names', () => { + for (const text of ['Query', 'Batch', 'Plan', 'Observation', 'Tracker']) { + expect(notApiReason(text, 'elixir'), text).toBe('planned Elixir feature') + expect(notApiReason(text, 'ruby'), text).toBeUndefined() + } + expect(notApiReason('ApplicationConnection', 'elixir')).toBe('example module') + expect(notApiReason('r1:N', 'elixir')).toBe('capture row prefix') + for (const text of ['LibTmux.Query', 'MissingApi', 'Enum.not_defined/1']) { + expect(notApiReason(text, 'elixir'), text).toBeUndefined() + } + }) +}) + describe('a Raku core type', () => { const raku = { port: 'raku', version: '0', symbols: [{ id: 'LibTmux::Server', name: 'Server', kind: 'class', signatures: [], docs: [] }] } const models = { raku } as unknown as Record diff --git a/site/src/data/mentions.json b/site/src/data/mentions.json index 9f6685775..a8570ae29 100644 --- a/site/src/data/mentions.json +++ b/site/src/data/mentions.json @@ -2681,6 +2681,13 @@ "title": "Window configuration", "section": "ports" }, + { + "port": "elixir", + "symbol": "LibTmux.Action.CompletionError", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, { "port": "elixir", "symbol": "LibTmux.Client.control_mode", @@ -2727,7 +2734,7 @@ "port": "elixir", "symbol": "LibTmux.Control.child_spec/1", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", "section": "topics" }, { @@ -2741,7 +2748,35 @@ "port": "elixir", "symbol": "LibTmux.Control.close/2", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", + "section": "topics" + }, + { + "port": "elixir", + "symbol": "LibTmux.Control.execute/3", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Control.execute/3", + "page": "/elixir/latest/guides/supervised-control/", + "title": "Keep a control connection in an application", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Control.execute/3", + "page": "/elixir/latest/topics/ownership/", + "title": "Execution ownership", + "section": "topics" + }, + { + "port": "elixir", + "symbol": "LibTmux.Control.ExecutionError", + "page": "/elixir/latest/topics/ownership/", + "title": "Execution ownership", "section": "topics" }, { @@ -2755,23 +2790,37 @@ "port": "elixir", "symbol": "LibTmux.Control.reconnect/2", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", "section": "topics" }, { "port": "elixir", "symbol": "LibTmux.Control.request_close/1", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", "section": "topics" }, + { + "port": "elixir", + "symbol": "LibTmux.Control.ScopeFailure", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, { "port": "elixir", "symbol": "LibTmux.Control.start_link/1", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", "section": "topics" }, + { + "port": "elixir", + "symbol": "LibTmux.Control.status/1", + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Control.submit/3", @@ -2782,44 +2831,58 @@ { "port": "elixir", "symbol": "LibTmux.Control.submit/3", - "page": "/elixir/latest/examples/capture-and-read/", - "title": "Capture a pane and read it", - "section": "examples" + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" }, { "port": "elixir", "symbol": "LibTmux.Control.submit/3", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", "section": "topics" }, + { + "port": "elixir", + "symbol": "LibTmux.Control.with_connection/2", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Control.with_connection/2", + "page": "/elixir/latest/guides/supervised-control/", + "title": "Keep a control connection in an application", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Deadline", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", "section": "topics" }, { "port": "elixir", "symbol": "LibTmux.Error.certainty/0", - "page": "/elixir/latest/examples/capture-and-read/", - "title": "Capture a pane and read it", - "section": "examples" + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" }, { "port": "elixir", "symbol": "LibTmux.Error.kind", - "page": "/elixir/latest/examples/capture-and-read/", - "title": "Capture a pane and read it", - "section": "examples" + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" }, { "port": "elixir", "symbol": "LibTmux.Error.phase", - "page": "/elixir/latest/examples/capture-and-read/", - "title": "Capture a pane and read it", - "section": "examples" + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" }, { "port": "elixir", @@ -2828,6 +2891,13 @@ "title": "Filter captured values", "section": "guides" }, + { + "port": "elixir", + "symbol": "LibTmux.Filter.from_json/3", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Filter.new/3", @@ -2835,6 +2905,13 @@ "title": "Filter captured values", "section": "guides" }, + { + "port": "elixir", + "symbol": "LibTmux.Filter.to_predicate/2", + "page": "/elixir/latest/guides/filtering/", + "title": "Filter captured values", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Filter.to_wire/1", @@ -2867,7 +2944,7 @@ "port": "elixir", "symbol": "LibTmux.Operation", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", "section": "topics" }, { @@ -2880,9 +2957,16 @@ { "port": "elixir", "symbol": "LibTmux.Operation.await/2", - "page": "/elixir/latest/examples/capture-and-read/", - "title": "Capture a pane and read it", - "section": "examples" + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Operation.await/2", + "page": "/elixir/latest/topics/ownership/", + "title": "Execution ownership", + "section": "topics" }, { "port": "elixir", @@ -2891,6 +2975,13 @@ "title": "Read values, execute explicitly", "section": "concepts" }, + { + "port": "elixir", + "symbol": "LibTmux.Pane.capture!/3", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Pane.current_command", @@ -2919,6 +3010,41 @@ "title": "Observation and filter schema", "section": "topics" }, + { + "port": "elixir", + "symbol": "LibTmux.Pane.kill/3", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Pane.pid", + "page": "/elixir/latest/concepts/observations/", + "title": "Captured tmux state", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Pane.send_keys!/4", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Pane.send_text!/4", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Pane.split!/3", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Pane.title", @@ -2943,9 +3069,16 @@ { "port": "elixir", "symbol": "LibTmux.Ref", - "page": "/elixir/latest/examples/capture-and-read/", - "title": "Capture a pane and read it", - "section": "examples" + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Ref.from_observation/1", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" }, { "port": "elixir", @@ -2978,9 +3111,16 @@ { "port": "elixir", "symbol": "LibTmux.Selection", - "page": "/elixir/latest/examples/capture-and-read/", - "title": "Capture a pane and read it", - "section": "examples" + "page": "/elixir/latest/concepts/observations/", + "title": "Captured tmux state", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Selection", + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" }, { "port": "elixir", @@ -2999,8 +3139,8 @@ { "port": "elixir", "symbol": "LibTmux.Selection.filter/2", - "page": "/elixir/latest/guides/filtering/", - "title": "Filter captured values", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", "section": "guides" }, { @@ -3010,12 +3150,19 @@ "title": "Filter captured values", "section": "guides" }, + { + "port": "elixir", + "symbol": "LibTmux.Selection.one_or_nil/2", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, { "port": "elixir", "symbol": "LibTmux.Selection.one!/2", - "page": "/elixir/latest/examples/capture-and-read/", - "title": "Capture a pane and read it", - "section": "examples" + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" }, { "port": "elixir", @@ -3024,6 +3171,20 @@ "title": "Attaching to tmux", "section": "guides" }, + { + "port": "elixir", + "symbol": "LibTmux.Selection.one!/2", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Selection.one/2", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, { "port": "elixir", "symbol": "LibTmux.Selection.one/2", @@ -3038,6 +3199,20 @@ "title": "Capture a pane and read it", "section": "examples" }, + { + "port": "elixir", + "symbol": "LibTmux.Selection.where/2", + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Selection.where/2", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Server", @@ -3048,8 +3223,29 @@ { "port": "elixir", "symbol": "LibTmux.Server", - "page": "/elixir/latest/guides/attaching-to-tmux/", - "title": "Attaching to tmux", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server", + "page": "/elixir/latest/guides/supervised-control/", + "title": "Keep a control connection in an application", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.kill/2", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.new_session!/3", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", "section": "guides" }, { @@ -3062,13 +3258,13 @@ { "port": "elixir", "symbol": "LibTmux.Server.new/1", - "page": "/elixir/latest/guides/attaching-to-tmux/", - "title": "Attaching to tmux", - "section": "guides" + "page": "/elixir/latest/examples/capture-and-read/", + "title": "Capture a pane and read it", + "section": "examples" }, { "port": "elixir", - "symbol": "LibTmux.Server.run/3", + "symbol": "LibTmux.Server.new/1", "page": "/elixir/latest/guides/attaching-to-tmux/", "title": "Attaching to tmux", "section": "guides" @@ -3101,6 +3297,90 @@ "title": "Capture a pane and read it", "section": "examples" }, + { + "port": "elixir", + "symbol": "LibTmux.Server.snapshot/2", + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.start/1", + "page": "/elixir/latest/guides/attaching-to-tmux/", + "title": "Attaching to tmux", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.start/1", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.start/1", + "page": "/elixir/latest/topics/ownership/", + "title": "Execution ownership", + "section": "topics" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.stop/2", + "page": "/elixir/latest/guides/attaching-to-tmux/", + "title": "Attaching to tmux", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.stop/2", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.with_owned/2", + "page": "/elixir/latest/examples/capture-and-read/", + "title": "Capture a pane and read it", + "section": "examples" + }, + { + "port": "elixir", + "symbol": "LibTmux.Server.with_owned/2", + "page": "/elixir/latest/guides/advanced-execution/", + "title": "Advanced: inspect both transports and own a retained operation", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Session.active_window/2", + "page": "/elixir/latest/concepts/observations/", + "title": "Captured tmux state", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Session.active_window/2", + "page": "/elixir/latest/guides/filtering/", + "title": "Filter captured values", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Session.active_window/2", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Session.active_window/2", + "page": "/elixir/latest/topics/schema/", + "title": "Observation and filter schema", + "section": "topics" + }, { "port": "elixir", "symbol": "LibTmux.Session.attached", @@ -3129,6 +3409,41 @@ "title": "Observation and filter schema", "section": "topics" }, + { + "port": "elixir", + "symbol": "LibTmux.Session.kill/3", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Session.new_window!/4", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Session.panes/2", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Session.panes/2", + "page": "/elixir/latest/concepts/observations/", + "title": "Captured tmux state", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Session.windows/2", + "page": "/elixir/latest/concepts/observations/", + "title": "Captured tmux state", + "section": "concepts" + }, { "port": "elixir", "symbol": "LibTmux.Snapshot", @@ -3143,6 +3458,13 @@ "title": "Captured tmux state", "section": "concepts" }, + { + "port": "elixir", + "symbol": "LibTmux.Snapshot", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Snapshot.fetch/3", @@ -3164,6 +3486,13 @@ "title": "Captured tmux state", "section": "concepts" }, + { + "port": "elixir", + "symbol": "LibTmux.Snapshot.panes/1", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Snapshot.related/4", @@ -3185,13 +3514,34 @@ "title": "Attaching to tmux", "section": "guides" }, + { + "port": "elixir", + "symbol": "LibTmux.Snapshot.sessions/1", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "elixir", + "symbol": "LibTmux.Snapshot.windows/1", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Transport.OneShot.run/3", "page": "/elixir/latest/topics/ownership/", - "title": "One-shot process ownership", + "title": "Execution ownership", "section": "topics" }, + { + "port": "elixir", + "symbol": "LibTmux.Window.kill!/3", + "page": "/elixir/latest/guides/overview/", + "title": "Getting started", + "section": "guides" + }, { "port": "elixir", "symbol": "LibTmux.Window.layout", @@ -3199,6 +3549,27 @@ "title": "Observation and filter schema", "section": "topics" }, + { + "port": "elixir", + "symbol": "LibTmux.Window.panes/2", + "page": "/elixir/latest/concepts/observations/", + "title": "Captured tmux state", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Window.rename!/4", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, + { + "port": "elixir", + "symbol": "LibTmux.Window.rename/4", + "page": "/elixir/latest/concepts/mental-model/", + "title": "Read values, execute explicitly", + "section": "concepts" + }, { "port": "elixir", "symbol": "LibTmux.Window.zoomed", From 929333f507ae1bc7d7e133b004cdc09a084d3a1e Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 2 Dec 2026 18:20:48 -0600 Subject: [PATCH 3/8] docs(elixir) Pin command usage to v0.1.3 why: The guide and model use the v0.1.3 source. The command usage rows still cited line numbers from the earlier revision. what: - Regenerate Elixir's usage data from the model's pinned commit. - Resolve the reviewed command evidence against the shipped source. --- site/src/data/tmux-usage/elixir.json | 222 +++++++++++++-------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/site/src/data/tmux-usage/elixir.json b/site/src/data/tmux-usage/elixir.json index ccf29d8d1..ff79fe657 100644 --- a/site/src/data/tmux-usage/elixir.json +++ b/site/src/data/tmux-usage/elixir.json @@ -94,16 +94,16 @@ ], "port": "elixir", "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", "schemaVersion": 1, "symbols": { "LibTmux.Capture.fetch/2": [ { "command": "display-message", "evidence": [ - "lib/libtmux/capture.ex:293", - "lib/libtmux/capture.ex:95", - "lib/libtmux/capture.ex:89" + "lib/libtmux/capture.ex:369", + "lib/libtmux/capture.ex:103", + "lib/libtmux/capture.ex:97" ], "reviewed": true, "scope": null @@ -111,9 +111,9 @@ { "command": "list-clients", "evidence": [ - "lib/libtmux/capture.ex:178", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89" + "lib/libtmux/capture.ex:186", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97" ], "reviewed": true, "scope": null @@ -121,9 +121,9 @@ { "command": "list-panes", "evidence": [ - "lib/libtmux/capture.ex:177", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89" + "lib/libtmux/capture.ex:185", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97" ], "reviewed": true, "scope": "server" @@ -131,9 +131,9 @@ { "command": "list-sessions", "evidence": [ - "lib/libtmux/capture.ex:158", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89" + "lib/libtmux/capture.ex:166", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97" ], "reviewed": true, "scope": null @@ -141,9 +141,9 @@ { "command": "list-windows", "evidence": [ - "lib/libtmux/capture.ex:164", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89" + "lib/libtmux/capture.ex:172", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97" ], "reviewed": true, "scope": "server" @@ -153,15 +153,15 @@ { "command": "attach-session", "evidence": [ - "lib/libtmux/control/bootstrap.ex:17", - "lib/libtmux/control/start.ex:62", + "lib/libtmux/control/bootstrap.ex:14", + "lib/libtmux/control/start.ex:64", "lib/libtmux/control/guardian.ex:95", - "lib/libtmux/control/manager.ex:244", - "lib/libtmux/control/manager.ex:613", - "lib/libtmux/control/manager.ex:614", - "lib/libtmux/control/manager.ex:573", - "lib/libtmux/control.ex:290", - "lib/libtmux/control.ex:299" + "lib/libtmux/control/manager.ex:254", + "lib/libtmux/control/manager.ex:639", + "lib/libtmux/control/manager.ex:640", + "lib/libtmux/control/manager.ex:595", + "lib/libtmux/control.ex:485", + "lib/libtmux/control.ex:498" ], "reviewed": true, "scope": null, @@ -170,15 +170,15 @@ { "command": "display-message", "evidence": [ - "lib/libtmux/control/bootstrap.ex:24", - "lib/libtmux/control/start.ex:62", + "lib/libtmux/control/bootstrap.ex:21", + "lib/libtmux/control/start.ex:64", "lib/libtmux/control/guardian.ex:95", - "lib/libtmux/control/manager.ex:244", - "lib/libtmux/control/manager.ex:613", - "lib/libtmux/control/manager.ex:614", - "lib/libtmux/control/manager.ex:573", - "lib/libtmux/control.ex:290", - "lib/libtmux/control.ex:299" + "lib/libtmux/control/manager.ex:254", + "lib/libtmux/control/manager.ex:639", + "lib/libtmux/control/manager.ex:640", + "lib/libtmux/control/manager.ex:595", + "lib/libtmux/control.ex:485", + "lib/libtmux/control.ex:498" ], "reviewed": true, "scope": null, @@ -189,14 +189,14 @@ { "command": "attach-session", "evidence": [ - "lib/libtmux/control/bootstrap.ex:17", - "lib/libtmux/control/start.ex:62", + "lib/libtmux/control/bootstrap.ex:14", + "lib/libtmux/control/start.ex:64", "lib/libtmux/control/guardian.ex:95", - "lib/libtmux/control/manager.ex:244", - "lib/libtmux/control/manager.ex:613", - "lib/libtmux/control/manager.ex:614", - "lib/libtmux/control/manager.ex:573", - "lib/libtmux/control.ex:290" + "lib/libtmux/control/manager.ex:254", + "lib/libtmux/control/manager.ex:639", + "lib/libtmux/control/manager.ex:640", + "lib/libtmux/control/manager.ex:595", + "lib/libtmux/control.ex:485" ], "reviewed": true, "scope": null, @@ -205,14 +205,14 @@ { "command": "display-message", "evidence": [ - "lib/libtmux/control/bootstrap.ex:24", - "lib/libtmux/control/start.ex:62", + "lib/libtmux/control/bootstrap.ex:21", + "lib/libtmux/control/start.ex:64", "lib/libtmux/control/guardian.ex:95", - "lib/libtmux/control/manager.ex:244", - "lib/libtmux/control/manager.ex:613", - "lib/libtmux/control/manager.ex:614", - "lib/libtmux/control/manager.ex:573", - "lib/libtmux/control.ex:290" + "lib/libtmux/control/manager.ex:254", + "lib/libtmux/control/manager.ex:639", + "lib/libtmux/control/manager.ex:640", + "lib/libtmux/control/manager.ex:595", + "lib/libtmux/control.ex:485" ], "reviewed": true, "scope": null, @@ -223,10 +223,10 @@ { "command": "attach-session", "evidence": [ - "lib/libtmux/control/bootstrap.ex:17", - "lib/libtmux/control/start.ex:62", + "lib/libtmux/control/bootstrap.ex:14", + "lib/libtmux/control/start.ex:64", "lib/libtmux/control/start.ex:23", - "lib/libtmux/control.ex:74" + "lib/libtmux/control.ex:107" ], "reviewed": true, "scope": null @@ -234,10 +234,10 @@ { "command": "display-message", "evidence": [ - "lib/libtmux/control/bootstrap.ex:24", - "lib/libtmux/control/start.ex:62", + "lib/libtmux/control/bootstrap.ex:21", + "lib/libtmux/control/start.ex:64", "lib/libtmux/control/start.ex:23", - "lib/libtmux/control.ex:74" + "lib/libtmux/control.ex:107" ], "reviewed": true, "scope": null @@ -247,10 +247,10 @@ { "command": "display-message", "evidence": [ - "lib/libtmux/control/request.ex:51", - "lib/libtmux/control/request.ex:36", - "lib/libtmux/control.ex:152", - "lib/libtmux/control.ex:173" + "lib/libtmux/control/request.ex:71", + "lib/libtmux/control/request.ex:49", + "lib/libtmux/control.ex:305", + "lib/libtmux/control.ex:331" ], "reviewed": true, "scope": null, @@ -259,10 +259,10 @@ { "command": "set-option", "evidence": [ - "lib/libtmux/control/request.ex:61", - "lib/libtmux/control/request.ex:36", - "lib/libtmux/control.ex:152", - "lib/libtmux/control.ex:173" + "lib/libtmux/control/request.ex:81", + "lib/libtmux/control/request.ex:49", + "lib/libtmux/control.ex:305", + "lib/libtmux/control.ex:331" ], "reviewed": true, "scope": null, @@ -273,9 +273,9 @@ { "command": "display-message", "evidence": [ - "lib/libtmux/control/request.ex:51", - "lib/libtmux/control/request.ex:36", - "lib/libtmux/control.ex:152" + "lib/libtmux/control/request.ex:71", + "lib/libtmux/control/request.ex:49", + "lib/libtmux/control.ex:305" ], "reviewed": true, "scope": null, @@ -284,9 +284,9 @@ { "command": "set-option", "evidence": [ - "lib/libtmux/control/request.ex:61", - "lib/libtmux/control/request.ex:36", - "lib/libtmux/control.ex:152" + "lib/libtmux/control/request.ex:81", + "lib/libtmux/control/request.ex:49", + "lib/libtmux/control.ex:305" ], "reviewed": true, "scope": null, @@ -297,11 +297,11 @@ { "command": "display-message", "evidence": [ - "lib/libtmux/capture.ex:293", - "lib/libtmux/capture.ex:95", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78", - "lib/libtmux/server.ex:83" + "lib/libtmux/capture.ex:369", + "lib/libtmux/capture.ex:103", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559", + "lib/libtmux/server.ex:568" ], "reviewed": true, "scope": null @@ -309,11 +309,11 @@ { "command": "list-clients", "evidence": [ - "lib/libtmux/capture.ex:178", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78", - "lib/libtmux/server.ex:83" + "lib/libtmux/capture.ex:186", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559", + "lib/libtmux/server.ex:568" ], "reviewed": true, "scope": null @@ -321,11 +321,11 @@ { "command": "list-panes", "evidence": [ - "lib/libtmux/capture.ex:177", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78", - "lib/libtmux/server.ex:83" + "lib/libtmux/capture.ex:185", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559", + "lib/libtmux/server.ex:568" ], "reviewed": true, "scope": "server" @@ -333,11 +333,11 @@ { "command": "list-sessions", "evidence": [ - "lib/libtmux/capture.ex:158", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78", - "lib/libtmux/server.ex:83" + "lib/libtmux/capture.ex:166", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559", + "lib/libtmux/server.ex:568" ], "reviewed": true, "scope": null @@ -345,11 +345,11 @@ { "command": "list-windows", "evidence": [ - "lib/libtmux/capture.ex:164", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78", - "lib/libtmux/server.ex:83" + "lib/libtmux/capture.ex:172", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559", + "lib/libtmux/server.ex:568" ], "reviewed": true, "scope": "server" @@ -359,10 +359,10 @@ { "command": "display-message", "evidence": [ - "lib/libtmux/capture.ex:293", - "lib/libtmux/capture.ex:95", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78" + "lib/libtmux/capture.ex:369", + "lib/libtmux/capture.ex:103", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559" ], "reviewed": true, "scope": null @@ -370,10 +370,10 @@ { "command": "list-clients", "evidence": [ - "lib/libtmux/capture.ex:178", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78" + "lib/libtmux/capture.ex:186", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559" ], "reviewed": true, "scope": null @@ -381,10 +381,10 @@ { "command": "list-panes", "evidence": [ - "lib/libtmux/capture.ex:177", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78" + "lib/libtmux/capture.ex:185", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559" ], "reviewed": true, "scope": "server" @@ -392,10 +392,10 @@ { "command": "list-sessions", "evidence": [ - "lib/libtmux/capture.ex:158", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78" + "lib/libtmux/capture.ex:166", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559" ], "reviewed": true, "scope": null @@ -403,10 +403,10 @@ { "command": "list-windows", "evidence": [ - "lib/libtmux/capture.ex:164", - "lib/libtmux/capture.ex:96", - "lib/libtmux/capture.ex:89", - "lib/libtmux/server.ex:78" + "lib/libtmux/capture.ex:172", + "lib/libtmux/capture.ex:104", + "lib/libtmux/capture.ex:97", + "lib/libtmux/server.ex:559" ], "reviewed": true, "scope": "server" From d5554fe9392df5f1f4b728fc28cdc1f9e891b257 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 2 Dec 2026 18:20:48 -0600 Subject: [PATCH 4/8] docs(elixir) Record checked release destinations why: Version checks for the old alpha do not qualify the released package or the external links from its staged guides. what: - Read version 0.1.3 from the pinned Elixir manifest. - Record live checks for the package, its documentation and the standard-library anchors cited in the guides. - Match the authored HexDocs label to the libtmux page heading. --- site/src/data/api-destination-evidence.json | 7 ++- site/src/data/api-link-review.json | 5 ++ site/src/data/destination-evidence.json | 65 ++------------------- site/src/data/manifest-packages.json | 6 +- 4 files changed, 20 insertions(+), 63 deletions(-) diff --git a/site/src/data/api-destination-evidence.json b/site/src/data/api-destination-evidence.json index ed7bd35dd..dfc10eeaa 100644 --- a/site/src/data/api-destination-evidence.json +++ b/site/src/data/api-destination-evidence.json @@ -1,6 +1,6 @@ { "schema": 2, - "checkedAt": "2026-11-19", + "checkedAt": "2026-12-03", "inventories": [ {"name":"python","source":"https://docs.python.org/3/objects.inv","kind":"objects.inv","entries":16493,"digest":"9b186d22c55bd3056145d7009198a34a0274d7e4","ok":true,"missing":0,"checkedAt":"2026-10-25"}, {"name":"julia","source":"https://docs.julialang.org/en/v1/objects.inv","kind":"objects.inv","entries":2545,"digest":"94ff52276c38e7feea3d68234092a72496935b01","ok":true,"missing":0,"checkedAt":"2026-10-25"}, @@ -413,6 +413,7 @@ {"url":"https://elixir.hexdocs.pm/DateTime.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"DateTime — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["DateTime"]},"ok":true,"terminal":[{"key":"elixir:DateTime","symbol":"DateTime","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:DateTime"],"sources":["builtin"]}, {"url":"https://elixir.hexdocs.pm/DynamicSupervisor.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"DynamicSupervisor — Elixir v1.20.4","identity":{"via":"exdoc","declared":"behaviour","kind":"module","path":["DynamicSupervisor"]},"ok":true,"terminal":[{"key":"elixir:DynamicSupervisor","symbol":"DynamicSupervisor","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:DynamicSupervisor"],"sources":["builtin"]}, {"url":"https://elixir.hexdocs.pm/Enum.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Enum — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["Enum"]},"ok":true,"terminal":[{"key":"elixir:Enum","symbol":"Enum","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Enum"],"sources":["builtin"]}, + {"url":"https://elixir.hexdocs.pm/Enum.html#map/2","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Enum — Elixir v1.20.5","identity":{"via":"exdoc","declared":"function","kind":"member","path":["Enum","map"],"arity":2},"fragment":"found","ok":true,"terminal":[{"key":"elixir:Enum.map/2","symbol":"map","at":"identity"}],"checkedAt":"2026-12-03","names":["elixir:Enum.map/2"],"sources":["builtin","prose"]}, {"url":"https://elixir.hexdocs.pm/Enum.html#member?/2","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Enum — Elixir v1.20.4","identity":{"via":"exdoc","declared":"function","kind":"member","path":["Enum","member?"],"arity":2},"fragment":"found","ok":true,"terminal":[{"key":"elixir:Enum.member?/2","symbol":"member?","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Enum.member?/2"],"sources":["builtin","prose"]}, {"url":"https://elixir.hexdocs.pm/Enum.html#to_list/1","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Enum — Elixir v1.20.4","identity":{"via":"exdoc","declared":"function","kind":"member","path":["Enum","to_list"],"arity":1},"fragment":"found","ok":true,"terminal":[{"key":"elixir:Enum.to_list/1","symbol":"to_list","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Enum.to_list/1"],"sources":["doc"]}, {"url":"https://elixir.hexdocs.pm/Enumerable.html#t:t/0","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Enumerable — Elixir v1.20.4","identity":{"via":"exdoc","declared":"type","kind":"type","path":["Enumerable","t"],"arity":0},"fragment":"found","ok":true,"terminal":[{"key":"elixir:Enumerable.t","symbol":"t","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Enumerable.t"],"sources":["builtin"]}, @@ -422,6 +423,7 @@ {"url":"https://elixir.hexdocs.pm/Float.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Float — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["Float"]},"ok":true,"terminal":[{"key":"elixir:Float","symbol":"Float","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Float"],"sources":["builtin"]}, {"url":"https://elixir.hexdocs.pm/Function.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Function — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["Function"]},"ok":true,"terminal":[{"key":"elixir:Function","symbol":"Function","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Function"],"sources":["builtin"]}, {"url":"https://elixir.hexdocs.pm/GenServer.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"GenServer — Elixir v1.20.4","identity":{"via":"exdoc","declared":"behaviour","kind":"module","path":["GenServer"]},"ok":true,"terminal":[{"key":"elixir:GenServer","symbol":"GenServer","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:GenServer"],"sources":["builtin"]}, + {"url":"https://elixir.hexdocs.pm/GenServer.html#call/2","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"GenServer — Elixir v1.20.5","identity":{"via":"exdoc","declared":"function","kind":"member","path":["GenServer","call"],"arity":2},"fragment":"found","ok":true,"terminal":[{"key":"elixir:GenServer.call/2","symbol":"call","at":"identity"}],"checkedAt":"2026-12-03","names":["elixir:GenServer.call/2"],"sources":["builtin","prose"]}, {"url":"https://elixir.hexdocs.pm/Inspect.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Inspect — Elixir v1.20.4","identity":{"via":"exdoc","declared":"protocol","kind":"module","path":["Inspect"]},"ok":true,"terminal":[{"key":"elixir:Inspect","symbol":"Inspect","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Inspect"],"sources":["builtin"]}, {"url":"https://elixir.hexdocs.pm/Integer.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Integer — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["Integer"]},"ok":true,"terminal":[{"key":"elixir:Integer","symbol":"Integer","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Integer"],"sources":["builtin"]}, {"url":"https://elixir.hexdocs.pm/IO.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"IO — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["IO"]},"ok":true,"terminal":[{"key":"elixir:IO","symbol":"IO","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:IO"],"sources":["builtin"]}, @@ -464,6 +466,8 @@ {"url":"https://elixir.hexdocs.pm/Supervisor.html#t:child_spec/0","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Supervisor — Elixir v1.20.4","identity":{"via":"exdoc","declared":"type","kind":"type","path":["Supervisor","child_spec"],"arity":0},"fragment":"found","ok":true,"terminal":[{"key":"elixir:Supervisor.child_spec","symbol":"child_spec","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Supervisor.child_spec"],"sources":["builtin","type"]}, {"url":"https://elixir.hexdocs.pm/Supervisor.html#terminate_child/2","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Supervisor — Elixir v1.20.4","identity":{"via":"exdoc","declared":"function","kind":"member","path":["Supervisor","terminate_child"],"arity":2},"fragment":"found","ok":true,"terminal":[{"key":"elixir:Supervisor.terminate_child/2","symbol":"terminate_child","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Supervisor.terminate_child/2"],"sources":["doc"]}, {"url":"https://elixir.hexdocs.pm/System.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"System — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["System"]},"ok":true,"terminal":[{"key":"elixir:System","symbol":"System","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:System"],"sources":["builtin"]}, + {"url":"https://elixir.hexdocs.pm/System.html#find_executable/1","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"System — Elixir v1.20.5","identity":{"via":"exdoc","declared":"function","kind":"member","path":["System","find_executable"],"arity":1},"fragment":"found","ok":true,"terminal":[{"key":"elixir:System.find_executable/1","symbol":"find_executable","at":"identity"}],"checkedAt":"2026-12-03","names":["elixir:System.find_executable/1"],"sources":["doc"]}, + {"url":"https://elixir.hexdocs.pm/System.html#tmp_dir!/0","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"System — Elixir v1.20.5","identity":{"via":"exdoc","declared":"function","kind":"member","path":["System","tmp_dir!"],"arity":0},"fragment":"found","ok":true,"terminal":[{"key":"elixir:System.tmp_dir!/0","symbol":"tmp_dir!","at":"identity"}],"checkedAt":"2026-12-03","names":["elixir:System.tmp_dir!/0"],"sources":["doc"]}, {"url":"https://elixir.hexdocs.pm/Task.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Task — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["Task"]},"ok":true,"terminal":[{"key":"elixir:Task","symbol":"Task","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Task"],"sources":["builtin"]}, {"url":"https://elixir.hexdocs.pm/Time.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Time — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["Time"]},"ok":true,"terminal":[{"key":"elixir:Time","symbol":"Time","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Time"],"sources":["builtin"]}, {"url":"https://elixir.hexdocs.pm/Tuple.html","host":"elixir.hexdocs.pm","status":200,"via":"html","title":"Tuple — Elixir v1.20.4","identity":{"via":"exdoc","declared":"module","kind":"module","path":["Tuple"]},"ok":true,"terminal":[{"key":"elixir:Tuple","symbol":"Tuple","at":"identity"}],"checkedAt":"2026-10-25","names":["elixir:Tuple"],"sources":["builtin"]}, @@ -715,6 +719,7 @@ {"url":"https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-member?view=powershell-7.4","host":"learn.microsoft.com","status":200,"via":"html","title":"Get-Member (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn","identity":{"via":"learn","declared":"cmdlet","kind":"member","path":["microsoft","powershell","utility","Get-Member"]},"ok":true,"terminal":[{"key":"powershell:Get-Member","symbol":"Get-Member","at":"identity"}],"checkedAt":"2026-10-25","names":["powershell:Get-Member"],"sources":["builtin","prose"]}, {"url":"https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.4","host":"learn.microsoft.com","status":200,"via":"html","title":"Invoke-WebRequest (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn","identity":{"via":"learn","declared":"cmdlet","kind":"member","path":["microsoft","powershell","utility","Invoke-WebRequest"]},"ok":true,"terminal":[{"key":"powershell:Invoke-WebRequest","symbol":"Invoke-WebRequest","at":"identity"}],"checkedAt":"2026-10-25","names":["powershell:Invoke-WebRequest"],"sources":["builtin","prose"]}, {"url":"https://learn.microsoft.com/powershell/module/threadjob/start-threadjob?view=powershell-7.4","host":"learn.microsoft.com","status":200,"via":"html","title":"Start-ThreadJob (ThreadJob) - PowerShell | Microsoft Learn","identity":{"via":"learn","declared":"cmdlet","kind":"member","path":["threadjob","Start-ThreadJob"]},"ok":true,"terminal":[{"key":"powershell:Start-ThreadJob","symbol":"Start-ThreadJob","at":"identity"}],"checkedAt":"2026-10-25","names":["powershell:Start-ThreadJob"],"sources":["builtin","prose"]}, + {"url":"https://libtmux.hexdocs.pm/","host":"libtmux.hexdocs.pm","status":200,"via":"package","title":"libtmux","heading":"libtmux","ok":true,"terminal":[{"key":"authored:HexDocs","symbol":"HexDocs","at":"review"}],"checkedAt":"2026-12-03","names":["site/src/content/docs/_staged/elixir/guides/overview/index.md","site/src/data/port-guides/elixir.json"],"sources":["authored"]}, {"url":"https://luals.github.io/wiki/annotations/#alias","host":"luals.github.io","status":200,"via":"html","title":"Lua Language Server | Wiki","heading":"@alias","ok":true,"fragment":"found","terminal":[{"key":"authored:Lua type aliases","symbol":"Lua type aliases","at":"review"}],"checkedAt":"2026-10-25","names":["glossary lua typealias"],"sources":["authored"]}, {"url":"https://luals.github.io/wiki/annotations/#class","host":"luals.github.io","status":200,"via":"html","title":"Lua Language Server | Wiki","heading":"@class","ok":true,"fragment":"found","terminal":[{"key":"authored:Lua class annotations","symbol":"Lua class annotations","at":"review"},{"key":"authored:Lua class inheritance","symbol":"Lua class inheritance","at":"review"}],"checkedAt":"2026-10-25","names":["glossary lua class","glossary lua inherited"],"sources":["authored"]}, {"url":"https://luals.github.io/wiki/annotations/#documenting-types","host":"luals.github.io","status":200,"via":"html","title":"Lua Language Server | Wiki","ok":true,"fragment":"found","terminal":[{"symbol":"any","at":"section","reason":"the wiki lists the recognized types in one section"}],"checkedAt":"2026-10-25","names":["lua:any"],"sources":["builtin","prose"]}, diff --git a/site/src/data/api-link-review.json b/site/src/data/api-link-review.json index 2abed158d..f93069a3f 100644 --- a/site/src/data/api-link-review.json +++ b/site/src/data/api-link-review.json @@ -960,6 +960,11 @@ "url": "https://learn.microsoft.com/en-us/powershell/scripting/developer/module/writing-a-windows-powershell-module", "heading": "Writing a Windows PowerShell Module" }, + { + "label": "HexDocs", + "url": "https://libtmux.hexdocs.pm/", + "heading": "libtmux" + }, { "label": "Lua type aliases", "url": "https://luals.github.io/wiki/annotations/#alias", diff --git a/site/src/data/destination-evidence.json b/site/src/data/destination-evidence.json index 9732afce6..5780e5f41 100644 --- a/site/src/data/destination-evidence.json +++ b/site/src/data/destination-evidence.json @@ -4949,38 +4949,11 @@ "status": 200, "requested": "https://hex.pm/packages/libtmux", "identity": "libtmux", - "version": "0.1.1", + "version": "0.1.3", "repository": "libtmux/libtmux-elixir", "versionChecks": [ { - "version": "0.0.1-alpha.1", - "source": "libtmux/libtmux-elixir:mix.exs", - "ports": [ - "elixir" - ], - "check": "confirmed" - } - ], - "checkedAt": "2026-11-03", - "entries": [ - "elixir:libtmux" - ] - }, - { - "url": "https://hex.pm/packages/libtmux", - "kinds": [ - "package" - ], - "host": "hex", - "ok": true, - "status": 200, - "requested": "https://hex.pm/packages/libtmux", - "identity": "libtmux", - "version": "0.1.1", - "repository": "libtmux/libtmux-elixir", - "versionChecks": [ - { - "version": "0.0.1-alpha.1", + "version": "0.1.3", "source": "libtmux/libtmux-elixir:mix.exs", "ports": [ "elixir" @@ -4988,7 +4961,7 @@ "check": "confirmed" } ], - "checkedAt": "2026-11-08", + "checkedAt": "2026-12-03", "entries": [ "elixir:libtmux" ] @@ -5690,36 +5663,10 @@ "status": 200, "requested": "https://libtmux.hexdocs.pm/", "identity": "libtmux", - "version": "0.1.1", - "versionChecks": [ - { - "version": "0.0.1-alpha.1", - "source": "libtmux/libtmux-elixir:mix.exs", - "ports": [ - "elixir" - ], - "check": "confirmed" - } - ], - "checkedAt": "2026-11-03", - "entries": [ - "elixir:libtmux" - ] - }, - { - "url": "https://libtmux.hexdocs.pm/", - "kinds": [ - "api" - ], - "host": "hexdocs", - "ok": true, - "status": 200, - "requested": "https://libtmux.hexdocs.pm/", - "identity": "libtmux", - "version": "0.1.1", + "version": "0.1.3", "versionChecks": [ { - "version": "0.0.1-alpha.1", + "version": "0.1.3", "source": "libtmux/libtmux-elixir:mix.exs", "ports": [ "elixir" @@ -5727,7 +5674,7 @@ "check": "confirmed" } ], - "checkedAt": "2026-11-08", + "checkedAt": "2026-12-03", "entries": [ "elixir:libtmux" ] diff --git a/site/src/data/manifest-packages.json b/site/src/data/manifest-packages.json index e1002a028..164d18ade 100644 --- a/site/src/data/manifest-packages.json +++ b/site/src/data/manifest-packages.json @@ -156,14 +156,14 @@ }, "elixir": { "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476", + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", "distributions": [ { "name": "libtmux", - "version": "0.0.1-alpha.1", + "version": "0.1.3", "manifest": "mix.exs", "repo": "libtmux/libtmux-elixir", - "revision": "6e6e88e886bdd9267fcd8be66f561dc5d5462476" + "revision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688" } ], "units": [] From 9b49231be391cad11bcf5e40d721b81c94eb0f71 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 2 Dec 2026 22:41:32 -0600 Subject: [PATCH 5/8] fix(site[elixir]) Verify rendered guide links why: The API reference links unstaged ExDoc guides from the released HexDocs tree. The destination audit needs to verify the same links. what: - Share guide resolution between the API renderer and collector. - Verify the guide links against their released HexDocs headings. --- scripts/lib/api-destinations.mjs | 6 ++-- site/src/data/api-destination-evidence.json | 6 ++++ site/src/data/api-link-review.json | 40 +++++++++++++++++++++ site/src/lib/api-models.ts | 20 ++--------- site/src/lib/port-documentation.ts | 19 ++++++++++ 5 files changed, 72 insertions(+), 19 deletions(-) diff --git a/scripts/lib/api-destinations.mjs b/scripts/lib/api-destinations.mjs index a7bc08055..b05786036 100644 --- a/scripts/lib/api-destinations.mjs +++ b/scripts/lib/api-destinations.mjs @@ -24,7 +24,7 @@ import { BUILTINS } from '../../packages/api-model/src/builtins.ts' import { Resolver, SymbolIndex, conceptNotes, decideMention, proseTexts, looksLikeApiMention, notASymbol, sourceUrl } from '../../packages/api-model/src/index.ts' import { fromMarkdown } from 'mdast-util-from-markdown' import { parseApiProse } from '../../packages/api-model/src/reference.ts' -import { SOURCE_GUIDE_PORTS } from '../../site/src/lib/port-documentation.ts' +import { apiDocLinkRewriter, SOURCE_GUIDE_PORTS } from '../../site/src/lib/port-documentation.ts' import { stagedPortGuides } from '../stage-port-docs.mjs' import { powerShellCommonParameterHref, powerShellCommonParameterLabel } from '../../site/src/lib/powershell-common-parameters.ts' import { KNOWN_PORTS, resolvePortBody, resolvePortData } from '../../site/src/lib/workspace-shared-slots.ts' @@ -231,7 +231,9 @@ export function apiIndexes({ root = ROOT } = {}) { const indexes = {} for (const [port, model] of Object.entries(models)) { - const index = new SymbolIndex(model.symbols, (symbol) => `/${symbol.slug ?? symbol.id}/`, port) + const sourceVersion = model.sources?.find((source) => source.product === 'core')?.version + const index = new SymbolIndex(model.symbols, (symbol) => `/${symbol.slug ?? symbol.id}/`, port, + apiDocLinkRewriter(port, `/${port}/`, sourceVersion)) for (const inventory of inventories) { if (inventory.langs.includes(port)) index.addInventory(inventory.baseUrl, inventory.entries, inventory.langs, inventory.project) } diff --git a/site/src/data/api-destination-evidence.json b/site/src/data/api-destination-evidence.json index dfc10eeaa..2576b7d40 100644 --- a/site/src/data/api-destination-evidence.json +++ b/site/src/data/api-destination-evidence.json @@ -720,6 +720,12 @@ {"url":"https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.4","host":"learn.microsoft.com","status":200,"via":"html","title":"Invoke-WebRequest (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn","identity":{"via":"learn","declared":"cmdlet","kind":"member","path":["microsoft","powershell","utility","Invoke-WebRequest"]},"ok":true,"terminal":[{"key":"powershell:Invoke-WebRequest","symbol":"Invoke-WebRequest","at":"identity"}],"checkedAt":"2026-10-25","names":["powershell:Invoke-WebRequest"],"sources":["builtin","prose"]}, {"url":"https://learn.microsoft.com/powershell/module/threadjob/start-threadjob?view=powershell-7.4","host":"learn.microsoft.com","status":200,"via":"html","title":"Start-ThreadJob (ThreadJob) - PowerShell | Microsoft Learn","identity":{"via":"learn","declared":"cmdlet","kind":"member","path":["threadjob","Start-ThreadJob"]},"ok":true,"terminal":[{"key":"powershell:Start-ThreadJob","symbol":"Start-ThreadJob","at":"identity"}],"checkedAt":"2026-10-25","names":["powershell:Start-ThreadJob"],"sources":["builtin","prose"]}, {"url":"https://libtmux.hexdocs.pm/","host":"libtmux.hexdocs.pm","status":200,"via":"package","title":"libtmux","heading":"libtmux","ok":true,"terminal":[{"key":"authored:HexDocs","symbol":"HexDocs","at":"review"}],"checkedAt":"2026-12-03","names":["site/src/content/docs/_staged/elixir/guides/overview/index.md","site/src/data/port-guides/elixir.json"],"sources":["authored"]}, + {"url":"https://libtmux.hexdocs.pm/0.1.3/api-examples.html#encoding-and-protocol","host":"libtmux.hexdocs.pm","status":200,"via":"html","title":"Public value and encoding examples — libtmux v0.1.3","identity":{"via":"page","declared":"page","kind":"other","path":[]},"heading":"Encoding and protocol","fragment":"found","ok":true,"terminal":[{"key":"doc-link:worked example","symbol":"worked example","at":"review"}],"checkedAt":"2026-12-03","names":["elixir:worked example"],"sources":["doc-link"]}, + {"url":"https://libtmux.hexdocs.pm/0.1.3/api-examples.html#local-graph-and-filtering","host":"libtmux.hexdocs.pm","status":200,"via":"html","title":"Public value and encoding examples — libtmux v0.1.3","identity":{"via":"page","declared":"page","kind":"other","path":[]},"heading":"Local graph and filtering","fragment":"found","ok":true,"terminal":[{"key":"doc-link:worked example","symbol":"worked example","at":"review"}],"checkedAt":"2026-12-03","names":["elixir:worked example"],"sources":["doc-link"]}, + {"url":"https://libtmux.hexdocs.pm/0.1.3/managed-control.html","host":"libtmux.hexdocs.pm","status":200,"via":"html","title":"Run repeated work with managed control — libtmux v0.1.3","identity":{"via":"page","declared":"page","kind":"other","path":[]},"heading":"Run repeated work with managed control","ok":true,"terminal":[{"key":"doc-link:managed control guide","symbol":"managed control guide","at":"review"},{"key":"doc-link:worked example","symbol":"worked example","at":"review"}],"checkedAt":"2026-12-03","names":["elixir:managed control guide","elixir:worked example"],"sources":["doc-link"]}, + {"url":"https://libtmux.hexdocs.pm/0.1.3/one-shot-actions.html","host":"libtmux.hexdocs.pm","status":200,"via":"html","title":"Create, split, rename, send input and capture — libtmux v0.1.3","identity":{"via":"page","declared":"page","kind":"other","path":[]},"heading":"Create, split, rename, send input and capture","ok":true,"terminal":[{"key":"doc-link:action guide","symbol":"action guide","at":"review"}],"checkedAt":"2026-12-03","names":["elixir:action guide"],"sources":["doc-link"]}, + {"url":"https://libtmux.hexdocs.pm/0.1.3/one-shot-actions.html#command-forms","host":"libtmux.hexdocs.pm","status":200,"via":"html","title":"Create, split, rename, send input and capture — libtmux v0.1.3","identity":{"via":"page","declared":"page","kind":"other","path":[]},"heading":"Command forms","fragment":"found","ok":true,"terminal":[{"key":"doc-link:command forms","symbol":"command forms","at":"review"}],"checkedAt":"2026-12-03","names":["elixir:command forms"],"sources":["doc-link"]}, + {"url":"https://libtmux.hexdocs.pm/0.1.3/recovery.html","host":"libtmux.hexdocs.pm","status":200,"via":"html","title":"Inspect a command that needs recovery — libtmux v0.1.3","identity":{"via":"page","declared":"page","kind":"other","path":[]},"heading":"Inspect a command that needs recovery","ok":true,"terminal":[{"key":"doc-link:recovery example","symbol":"recovery example","at":"review"},{"key":"doc-link:recovery guide","symbol":"recovery guide","at":"review"}],"checkedAt":"2026-12-03","names":["elixir:recovery example","elixir:recovery guide"],"sources":["doc-link"]}, {"url":"https://luals.github.io/wiki/annotations/#alias","host":"luals.github.io","status":200,"via":"html","title":"Lua Language Server | Wiki","heading":"@alias","ok":true,"fragment":"found","terminal":[{"key":"authored:Lua type aliases","symbol":"Lua type aliases","at":"review"}],"checkedAt":"2026-10-25","names":["glossary lua typealias"],"sources":["authored"]}, {"url":"https://luals.github.io/wiki/annotations/#class","host":"luals.github.io","status":200,"via":"html","title":"Lua Language Server | Wiki","heading":"@class","ok":true,"fragment":"found","terminal":[{"key":"authored:Lua class annotations","symbol":"Lua class annotations","at":"review"},{"key":"authored:Lua class inheritance","symbol":"Lua class inheritance","at":"review"}],"checkedAt":"2026-10-25","names":["glossary lua class","glossary lua inherited"],"sources":["authored"]}, {"url":"https://luals.github.io/wiki/annotations/#documenting-types","host":"luals.github.io","status":200,"via":"html","title":"Lua Language Server | Wiki","ok":true,"fragment":"found","terminal":[{"symbol":"any","at":"section","reason":"the wiki lists the recognized types in one section"}],"checkedAt":"2026-10-25","names":["lua:any"],"sources":["builtin","prose"]}, diff --git a/site/src/data/api-link-review.json b/site/src/data/api-link-review.json index f93069a3f..242848305 100644 --- a/site/src/data/api-link-review.json +++ b/site/src/data/api-link-review.json @@ -965,6 +965,46 @@ "url": "https://libtmux.hexdocs.pm/", "heading": "libtmux" }, + { + "label": "worked example", + "url": "https://libtmux.hexdocs.pm/0.1.3/api-examples.html#encoding-and-protocol", + "heading": "Encoding and protocol" + }, + { + "label": "worked example", + "url": "https://libtmux.hexdocs.pm/0.1.3/api-examples.html#local-graph-and-filtering", + "heading": "Local graph and filtering" + }, + { + "label": "managed control guide", + "url": "https://libtmux.hexdocs.pm/0.1.3/managed-control.html", + "heading": "Run repeated work with managed control" + }, + { + "label": "worked example", + "url": "https://libtmux.hexdocs.pm/0.1.3/managed-control.html", + "heading": "Run repeated work with managed control" + }, + { + "label": "action guide", + "url": "https://libtmux.hexdocs.pm/0.1.3/one-shot-actions.html", + "heading": "Create, split, rename, send input and capture" + }, + { + "label": "command forms", + "url": "https://libtmux.hexdocs.pm/0.1.3/one-shot-actions.html#command-forms", + "heading": "Command forms" + }, + { + "label": "recovery example", + "url": "https://libtmux.hexdocs.pm/0.1.3/recovery.html", + "heading": "Inspect a command that needs recovery" + }, + { + "label": "recovery guide", + "url": "https://libtmux.hexdocs.pm/0.1.3/recovery.html", + "heading": "Inspect a command that needs recovery" + }, { "label": "Lua type aliases", "url": "https://luals.github.io/wiki/annotations/#alias", diff --git a/site/src/lib/api-models.ts b/site/src/lib/api-models.ts index 7c49b58e1..fb4125e07 100644 --- a/site/src/lib/api-models.ts +++ b/site/src/lib/api-models.ts @@ -14,7 +14,7 @@ import { PORT_BY_SLUG, referenceUrl, type DocProduct, type RegistryData } from ' import { buildTarget, defaultVersionFor, registryVersion } from './versions' import { mcpToolSymbols } from './mcp-catalog' import { nativeKind } from './api-labels' -import { apiDocLinksFor } from './port-documentation' +import { apiDocLinkRewriter } from './port-documentation' import powershellNav from '../data/api/powershell.nav.json' import juliaNav from '../data/api/julia.nav.json' import elixirNav from '../data/api/elixir.nav.json' @@ -331,22 +331,8 @@ export function parentApiInventory(port: string): InventoryEntry[] { export function createApiIndex(model: ApiModelBase & { port?: string; language?: string }, hrefFor: (s: ApiSymbol) => string): SymbolIndex { const language = model.port ?? model.language const docRoot = model.symbols[0] && /^(.*\/)reference\//.exec(hrefFor(model.symbols[0]))?.[1] - const guideLinks = language && PORT_BY_SLUG[language] && docRoot ? apiDocLinksFor(language, docRoot) : new Map() - // ExDoc writes its extra pages beside module pages. On the shared site - // the compiled reference entries live one directory deeper. - const hexDocs = language === 'elixir' && PORT_BY_SLUG.elixir?.ecosystemHost?.url - const hexVersion = model.sources?.find((source) => source.product === 'core')?.version - const index = new SymbolIndex(model.symbols, hrefFor, language, (href) => { - const cut = href.indexOf('#') - const page = cut < 0 ? href : href.slice(0, cut) - const fragment = cut < 0 ? '' : href.slice(cut) - const target = guideLinks.get(page) ?? (hexDocs && guideLinks.get(page.replace(/\.html$/, '.md'))) - if (target) return target + fragment - if (hexDocs && /^[a-z][a-z0-9_-]*\.html$/.test(page)) { - return new URL((hexVersion ? `${hexVersion}/` : '') + page + fragment, hexDocs).href - } - return href - }) + const sourceVersion = model.sources?.find((source) => source.product === 'core')?.version + const index = new SymbolIndex(model.symbols, hrefFor, language, apiDocLinkRewriter(language, docRoot, sourceVersion)) for (const { data, baseUrl, langs, project } of INVENTORIES) { if (!language || !langs.includes(language)) continue index.addInventory(baseUrl, entriesOf(data), langs, project) diff --git a/site/src/lib/port-documentation.ts b/site/src/lib/port-documentation.ts index d0694ce0d..a10846fb3 100644 --- a/site/src/lib/port-documentation.ts +++ b/site/src/lib/port-documentation.ts @@ -564,6 +564,25 @@ export function apiDocLinksFor(portSlug: string, baseHref: string): ReadonlyMap< .map((entry) => [entry.sourcePath.slice(prefix.length), `${baseHref}${entry.route}/`])) } +/** Resolve source guide links for both rendered references and the destination audit. */ +export function apiDocLinkRewriter(portSlug: string | undefined, baseHref?: string, sourceVersion?: string): (href: string) => string { + if (!portSlug || !PORT_BY_SLUG[portSlug]) return (href) => href + const guideLinks = baseHref ? apiDocLinksFor(portSlug, baseHref) : new Map() + // ExDoc places its extras alongside modules. Unstaged extras stay on the pinned HexDocs release. + const hexDocs = portSlug === 'elixir' ? PORT_BY_SLUG.elixir?.ecosystemHost?.url : undefined + return (href) => { + const cut = href.indexOf('#') + const page = cut < 0 ? href : href.slice(0, cut) + const fragment = cut < 0 ? '' : href.slice(cut) + const target = guideLinks.get(page) ?? (hexDocs ? guideLinks.get(page.replace(/\.html$/, '.md')) : undefined) + if (target) return target + fragment + if (hexDocs && /^[a-z][a-z0-9_-]*\.html$/.test(page)) { + return new URL((sourceVersion ? `${sourceVersion}/` : '') + page + fragment, hexDocs).href + } + return href + } +} + /** * The section overviews staging writes for a port's source guides, unless the * port authors one itself: guides for every staged port, and examples, topics From 58a08e1b2dd45c251df293d33dedce0442f23998 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 2 Dec 2026 22:41:32 -0600 Subject: [PATCH 6/8] docs(elixir) Verify the released lifecycle programs why: The proof records still described the older attachment and homepage programs. what: - Pin the attachment guide to the v0.1.3 package and source. - Present the release quickstart as one owned-server program. - Record the exact files and recipes exercised on Linux. --- .../ports/elixir/guides/attaching-to-tmux.md | 7 ++-- site/src/data/home-examples.json | 5 +-- site/test/fixtures/attach-examples.json | 4 +- site/test/fixtures/home-examples.json | 38 +++++++++---------- 4 files changed, 24 insertions(+), 30 deletions(-) diff --git a/site/src/content/docs/ports/elixir/guides/attaching-to-tmux.md b/site/src/content/docs/ports/elixir/guides/attaching-to-tmux.md index 1c84f310b..2eb5197d3 100644 --- a/site/src/content/docs/ports/elixir/guides/attaching-to-tmux.md +++ b/site/src/content/docs/ports/elixir/guides/attaching-to-tmux.md @@ -26,11 +26,10 @@ to it and finds `work`. Without a socket path, `Server.start/1` starts a private server. The program creates `work`, reads it through a second descriptor, then stops the owned server with `Server.stop/2`. -The first line installs libtmux 0.1.2 or a later 0.1 patch. Version 0.1.2 -introduced private server startup and cleanup. +The first line installs libtmux 0.1.3 from Hex. ```elixir title="connect.exs" role="program" -Mix.install([{:libtmux, "~> 0.1.2"}]) +Mix.install([{:libtmux, "0.1.3"}]) alias LibTmux.{Selection, Server, Snapshot} @@ -95,5 +94,5 @@ between those operations. Handle the creation error as well as the lookup. [Capture a pane and read it](../../examples/capture-and-read/) is a complete program that runs against an isolated server. -The [library source revision](https://github.com/libtmux/libtmux-elixir/tree/v0.1.2) +The [library source revision](https://github.com/libtmux/libtmux-elixir/tree/86ad4ca80f157adb0c11f6bf7c371b04ca5aa688) records the implementation used by this example. diff --git a/site/src/data/home-examples.json b/site/src/data/home-examples.json index 6eb90681e..acf0e5fc2 100644 --- a/site/src/data/home-examples.json +++ b/site/src/data/home-examples.json @@ -593,13 +593,12 @@ "elixir quickstart.exs" ], "expectedOutput": "demo: 2 windows, 3 panes\n", - "withoutErrorHandling": "An unmatched result or a raised error ends the script with its message and stack trace, so there is no separate error handling to add. Every version checks required results.", + "singleView": "Server.with_owned retires its private tmux server when the function returns or raises.", "variants": { "concise": "Mix.install([{:libtmux, \"~> 0.1.2\"}])\n\nalias LibTmux.{Pane, Ref, Selection, Server, Session, Snapshot}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\ncat = [command: {:argv, [\"/bin/cat\"]}]\n\nServer.with_owned([executable: tmux], fn server ->\n Server.new_session!(server, \"demo\", cat)\n\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n pane = snapshot |> Snapshot.panes() |> Selection.one!()\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, pane_ref} = Ref.from_observation(pane)\n\n Pane.split!(server, pane_ref, cat)\n Session.new_window!(server, session_ref, \"logs\", cat)\n\n snapshot = Server.snapshot!(server)\n windows = snapshot |> Snapshot.windows() |> Selection.size()\n panes = snapshot |> Snapshot.panes() |> Selection.size()\n IO.puts(\"#{session.name}: #{windows} windows, #{panes} panes\")\nend)\n", "errors": "Mix.install([{:libtmux, \"~> 0.1.2\"}])\n\nalias LibTmux.{Pane, Ref, Selection, Server, Session, Snapshot}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\ncat = [command: {:argv, [\"/bin/cat\"]}]\n\nServer.with_owned([executable: tmux], fn server ->\n Server.new_session!(server, \"demo\", cat)\n\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n pane = snapshot |> Snapshot.panes() |> Selection.one!()\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, pane_ref} = Ref.from_observation(pane)\n\n Pane.split!(server, pane_ref, cat)\n Session.new_window!(server, session_ref, \"logs\", cat)\n\n snapshot = Server.snapshot!(server)\n windows = snapshot |> Snapshot.windows() |> Selection.size()\n panes = snapshot |> Snapshot.panes() |> Selection.size()\n IO.puts(\"#{session.name}: #{windows} windows, #{panes} panes\")\nend)\n", "cleanup": "Mix.install([{:libtmux, \"~> 0.1.2\"}])\n\nalias LibTmux.{Pane, Ref, Selection, Server, Session, Snapshot}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\ncat = [command: {:argv, [\"/bin/cat\"]}]\n\nServer.with_owned([executable: tmux], fn server ->\n Server.new_session!(server, \"demo\", cat)\n\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n pane = snapshot |> Snapshot.panes() |> Selection.one!()\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, pane_ref} = Ref.from_observation(pane)\n\n Pane.split!(server, pane_ref, cat)\n Session.new_window!(server, session_ref, \"logs\", cat)\n\n snapshot = Server.snapshot!(server)\n windows = snapshot |> Snapshot.windows() |> Selection.size()\n panes = snapshot |> Snapshot.panes() |> Selection.size()\n IO.puts(\"#{session.name}: #{windows} windows, #{panes} panes\")\nend)\n" - }, - "automaticCleanup": "Server.with_owned retires its private tmux server when the function returns or raises." + } }, "ocaml": { "lang": "ocaml", diff --git a/site/test/fixtures/attach-examples.json b/site/test/fixtures/attach-examples.json index 7cc55341f..f28755532 100644 --- a/site/test/fixtures/attach-examples.json +++ b/site/test/fixtures/attach-examples.json @@ -455,7 +455,7 @@ { "port": "elixir", "language": "elixir", - "sourceRevision": "cac4252bfc52069980d47db2b7803dc9b33f36f1", + "sourceRevision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", "sourceRepository": "libtmux/libtmux-elixir", "toolchain": [ "Elixir 1.20.4", @@ -473,7 +473,7 @@ "files": [ { "name": "connect.exs", - "sha256": "dde8e2bb0b70be37f0b3d423e7d6be322d6d8561709633fb99b16b47696fc8e6" + "sha256": "bd795bb2ea619edf356135a8dafd65382f81344f8def3937eee08f763e43e144" } ] }, diff --git a/site/test/fixtures/home-examples.json b/site/test/fixtures/home-examples.json index edef412e4..359f4f395 100644 --- a/site/test/fixtures/home-examples.json +++ b/site/test/fixtures/home-examples.json @@ -1407,30 +1407,26 @@ "port": "elixir", "page": "home", "sourceRepository": "libtmux/libtmux-elixir", - "sourceRevision": "a740a1308e51e5e975d4239e0e017efacf4cb169", - "sourceTree": "623133e2d512443e196749424980c166964815f8", + "sourceRevision": "86ad4ca80f157adb0c11f6bf7c371b04ca5aa688", + "sourceTree": "1aec29dd3488235ec74fd14d4df0785afe21e222", "files": [ { "name": "quickstart.exs", - "sha256": "16d09ee54ef6e4073740b50fe6496b668e615fda51e2f97acfcb25b7fb54f86c", - "clipboardSha256": "315b120fc40982d69ab2945b84a0b2c6df5faf8d63d75bf940739cd6e23b68af" + "sha256": "a6c015c4d70737d9c739fde16b3f217d010553713372637d7b52049ae13db804", + "clipboardSha256": "43266aaec3525a530c935c9599648360afecf9ca7cdff2db5562edac2f4a38ec" } ], "shellRecipe": [ - "unset TMUX TMUX_PANE\nexport ENV=/dev/null BASH_ENV=/dev/null SHELL=/bin/sh\nelixir quickstart.exs" + "elixir quickstart.exs" ], "expectedOutputs": [ [ - "session demo", - " window 0:editor: %0 %1", - " window 1:logs: %2", - "%1 is in window editor of session demo" + "demo: 2 windows, 3 panes" ] ], - "excerptSha256": "315b120fc40982d69ab2945b84a0b2c6df5faf8d63d75bf940739cd6e23b68af", + "excerptSha256": "43266aaec3525a530c935c9599648360afecf9ca7cdff2db5562edac2f4a38ec", "tmuxVersions": [ - "3.3a", - "3.7c", + "3.3", "3.8" ], "variants": { @@ -1438,31 +1434,31 @@ "files": [ { "name": "quickstart.exs", - "sha256": "21245dfcb27eb921ccfba934e76aca56dac56a0adf1328e392444164abb8aade", - "clipboardSha256": "2251ccd20f5d8c2eca341b71f114a937a2f979f44a185513ed14db8ec087ff99" + "sha256": "a6c015c4d70737d9c739fde16b3f217d010553713372637d7b52049ae13db804", + "clipboardSha256": "43266aaec3525a530c935c9599648360afecf9ca7cdff2db5562edac2f4a38ec" } ], - "excerptSha256": "2251ccd20f5d8c2eca341b71f114a937a2f979f44a185513ed14db8ec087ff99" + "excerptSha256": "43266aaec3525a530c935c9599648360afecf9ca7cdff2db5562edac2f4a38ec" }, "errors": { "files": [ { "name": "quickstart.exs", - "sha256": "21245dfcb27eb921ccfba934e76aca56dac56a0adf1328e392444164abb8aade", - "clipboardSha256": "2251ccd20f5d8c2eca341b71f114a937a2f979f44a185513ed14db8ec087ff99" + "sha256": "a6c015c4d70737d9c739fde16b3f217d010553713372637d7b52049ae13db804", + "clipboardSha256": "43266aaec3525a530c935c9599648360afecf9ca7cdff2db5562edac2f4a38ec" } ], - "excerptSha256": "2251ccd20f5d8c2eca341b71f114a937a2f979f44a185513ed14db8ec087ff99" + "excerptSha256": "43266aaec3525a530c935c9599648360afecf9ca7cdff2db5562edac2f4a38ec" }, "cleanup": { "files": [ { "name": "quickstart.exs", - "sha256": "16d09ee54ef6e4073740b50fe6496b668e615fda51e2f97acfcb25b7fb54f86c", - "clipboardSha256": "315b120fc40982d69ab2945b84a0b2c6df5faf8d63d75bf940739cd6e23b68af" + "sha256": "a6c015c4d70737d9c739fde16b3f217d010553713372637d7b52049ae13db804", + "clipboardSha256": "43266aaec3525a530c935c9599648360afecf9ca7cdff2db5562edac2f4a38ec" } ], - "excerptSha256": "315b120fc40982d69ab2945b84a0b2c6df5faf8d63d75bf940739cd6e23b68af" + "excerptSha256": "43266aaec3525a530c935c9599648360afecf9ca7cdff2db5562edac2f4a38ec" } } }, From 137d4f399b20a75734afaab1fad34df86f0572ec Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 2 Dec 2026 22:41:32 -0600 Subject: [PATCH 7/8] test(elixir) Check the v0.1.3 reference why: The release model names additional action types, and every call in the release recording now resolves. what: - Check the related action type labels and their exact destinations. - Remove stale recording exemptions and review the false links the release model exposes. --- site/test/core-apis.test.ts | 3 +-- site/test/fixtures/literal-links-dropped.json | 5 +++++ site/test/related-labels.test.ts | 18 ++++++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/site/test/core-apis.test.ts b/site/test/core-apis.test.ts index 5b9b05543..733a23377 100644 --- a/site/test/core-apis.test.ts +++ b/site/test/core-apis.test.ts @@ -109,11 +109,10 @@ describe('the APIs a showcase example uses', () => { }) describe('the Core player\'s links', () => { - // Calls a recorded program makes that link nowhere here: the language's own (System.cmd, Seq.find), the + // Calls a recorded program makes that link nowhere here: the language's own (Seq.find), the // program's helper (lua's tmux), and calls newer than the API model committed in site/src/data/api. A // port's own build regenerates its model at the port's head (build-site.sh), where those calls resolve. const UNLINKED: Record = { - elixir: ['System.cmd', 'Session.active_window', 'Ref.from_observation', 'Window.rename!', 'Pane.split!', 'Session.new_window!', 'Pane.send_text!', 'Pane.send_keys!', 'Pane.capture!', 'Window.panes'], fsharp: ['Window.rename', 'Window.activePane', 'Session.newWindow', 'Pane.select', 'Window.select', 'Seq.find'], julia: ['wait_for_text'], lua: ['tmux', 'Pane:wait_for_text'], diff --git a/site/test/fixtures/literal-links-dropped.json b/site/test/fixtures/literal-links-dropped.json index ab8aef57c..1df60d371 100644 --- a/site/test/fixtures/literal-links-dropped.json +++ b/site/test/fixtures/literal-links-dropped.json @@ -22,7 +22,12 @@ {"port":"cxx","symbol":"libtmux::test::SocketMode","literal":"tmux -S path","word":"tmux","target":"libtmux::ServerImplementation::tmux"}, {"port":"cxx","symbol":"libtmux::test::SocketNamespace","literal":"tmux -L","word":"tmux","target":"libtmux::ServerImplementation::tmux"}, {"port":"cxx","symbol":"version.hpp::LIBTMUX_VERSION_MAJOR","literal":"include/libtmux/","word":"include","target":"libtmux::mcp::ToolSelection::include"}, + {"port":"elixir","symbol":"LibTmux.Action","literal":"details","word":"details","target":"LibTmux.Error.details"}, + {"port":"elixir","symbol":"LibTmux.Action","literal":"path","word":"path","target":"LibTmux.Error.path"}, + {"port":"elixir","symbol":"LibTmux.Control.status/1","literal":"phase","word":"phase","target":"LibTmux.Error.phase"}, {"port":"elixir","symbol":"LibTmux.Operation","literal":"certainty","word":"certainty","target":"LibTmux.Error.certainty"}, + {"port":"elixir","symbol":"LibTmux.Pane.split/3","literal":"cwd","word":"cwd","target":"LibTmux.Server.cwd"}, + {"port":"elixir","symbol":"LibTmux.Session.new_window/4","literal":"cwd","word":"cwd","target":"LibTmux.Server.cwd"}, {"port":"java","symbol":"io.github.libtmux.Pane.Pane.awaitText","literal":"src/main/java/Capture.java","word":"main","target":"io.github.libtmux.mcp.Main.Main.main"}, {"port":"java","symbol":"io.github.libtmux.Pane.Pane.capture","literal":"src/main/java/Capture.java","word":"main","target":"io.github.libtmux.mcp.Main.Main.main"}, {"port":"java","symbol":"io.github.libtmux.Pane.Pane.sendKeys","literal":"src/main/java/Capture.java","word":"main","target":"io.github.libtmux.mcp.Main.Main.main"}, diff --git a/site/test/related-labels.test.ts b/site/test/related-labels.test.ts index 0b5a8ad5d..069611638 100644 --- a/site/test/related-labels.test.ts +++ b/site/test/related-labels.test.ts @@ -125,12 +125,18 @@ describe('related types on the committed models', () => { it('lists the reported Elixir page by owner and links each to its own page', () => { const server = page('elixir', 'LibTmux.Server') - expect(server.before).toEqual(['t/0', 't/0', 'result/0', 't/0']) - expect(labels(server)).toEqual(['Snapshot.t/0', 'Error.t/0', 'OneShot.result/0', 't/0']) - expect(server.links.map((link) => link.identity)).toEqual(['LibTmux.Snapshot.t/0', 'LibTmux.Error.t/0', 'LibTmux.Transport.OneShot.result/0', 'LibTmux.Server.t/0']) - expect(server.links.map((link) => link.href)).toEqual(['/elixir/libtmux-snapshot-t-0/', '/elixir/libtmux-error-t-0/', '/elixir/libtmux-transport-oneshot-result-0/', '/elixir/libtmux-server-t-0/']) - expect(server.links.map((link) => link.kind)).toEqual(Array(4).fill('typealias')) - expect(server.links.map((link) => link.qualified)).toEqual([true, true, true, false]) + expect(server.before).toEqual(['t/0', 't/0', 'result/0', 't/0', 'result/1', 'error/0']) + expect(labels(server)).toEqual(['Snapshot.t/0', 'Error.t/0', 'OneShot.result/0', 't/0', 'Action.result/1', 'Action.error/0']) + expect(server.links.map((link) => link.identity)).toEqual([ + 'LibTmux.Snapshot.t/0', 'LibTmux.Error.t/0', 'LibTmux.Transport.OneShot.result/0', 'LibTmux.Server.t/0', + 'LibTmux.Action.result/1', 'LibTmux.Action.error/0', + ]) + expect(server.links.map((link) => link.href)).toEqual([ + '/elixir/libtmux-snapshot-t-0/', '/elixir/libtmux-error-t-0/', '/elixir/libtmux-transport-oneshot-result-0/', + '/elixir/libtmux-server-t-0/', '/elixir/libtmux-action-result-1/', '/elixir/libtmux-action-error-0/', + ]) + expect(server.links.map((link) => link.kind)).toEqual(Array(6).fill('typealias')) + expect(server.links.map((link) => link.qualified)).toEqual([true, true, true, false, true, true]) }) it('names the owner in an Elixir list for every type another module owns, and for no other', () => { From 24f6022b5333d4f4c397e9eb58972c09f572434b Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Thu, 3 Dec 2026 01:54:10 -0600 Subject: [PATCH 8/8] fix(site[elixir]) Render unrestricted typespec variables why: The released Elixir reference includes typespecs with `when value: var`. The marker introduces an unrestricted type variable and the rendered reference needs to retain that syntax. what: - Mark the bare guard value as syntax in the declaration. - Render the unrestricted parameter with its declaration links. - Verify the release's declaration, links and type parameter entry. --- packages/api-model/src/index.ts | 2 +- packages/api-model/src/type-params.ts | 4 +++- packages/api-model/test/type-parameters.test.ts | 2 ++ site/src/lib/elixir-code-layout.ts | 13 ++++++++++++- site/test/elixir-layout.test.ts | 14 +++++++++++++- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/packages/api-model/src/index.ts b/packages/api-model/src/index.ts index 12daf91b5..7220e2540 100644 --- a/packages/api-model/src/index.ts +++ b/packages/api-model/src/index.ts @@ -17,7 +17,7 @@ export { extractHaskellArtifact } from './languages/haskell.ts' export { extractProject } from './project.ts' export { resolvePublicIds } from './reexports.ts' export { SymbolIndex, keywordArgument, parameterId, typeParameterId, type LinkTarget, type KeywordHelp, type TypeParameterBinding } from './link.ts' -export { boundLabel, parseTypeParameter, parseTypeParameters, typeParameterList, typeParametersOf, withTypeParameterDocs } from './type-params.ts' +export { boundLabel, findTopLevel, parseTypeParameter, parseTypeParameters, typeParameterList, typeParametersOf, withTypeParameterDocs } from './type-params.ts' export { tokenizeDoc, docSummaryText, referencesIn, type DocSpan } from './doc/roles.ts' export { writeInventory, writeInventoryEntries, readInventory, inventoryType, isSymbolEntry, symbolEntries, NON_SYMBOL_ROLES, type InventoryEntry } from './inventory.ts' export { targetKey, targetEntries, compatibilityEntries, type InventoryTarget } from './targets.ts' diff --git a/packages/api-model/src/type-params.ts b/packages/api-model/src/type-params.ts index d99a2e354..f76ecdd65 100644 --- a/packages/api-model/src/type-params.ts +++ b/packages/api-model/src/type-params.ts @@ -163,7 +163,9 @@ const julia: Parser = (text) => { /** `when item: Bound` of a spec, or the bare variable of `t(item)`. */ const elixir: Parser = (text) => { const match = /^([a-z_]\w*)\s*(?::\s*([\s\S]+))?$/.exec(text.trim()) - return match ? [make({ name: match[1]!, bound: match[2] })] : [] + if (!match) return [] + const bound = match[2]?.trim() + return [make({ name: match[1]!, bound: bound === 'var' ? undefined : bound })] } const ruby: Parser = (text) => { diff --git a/packages/api-model/test/type-parameters.test.ts b/packages/api-model/test/type-parameters.test.ts index 16b1294dc..c1f06e508 100644 --- a/packages/api-model/test/type-parameters.test.ts +++ b/packages/api-model/test/type-parameters.test.ts @@ -60,6 +60,8 @@ describe('type parameter declarations, read apart', () => { ['julia', 'I<:LibTmux.EntityID', [{ name: 'I', bound: 'LibTmux.EntityID' }]], ['julia', ':session', []], ['julia', 'LibTmux.BufferID', []], + ['elixir', 'value: var', [{ name: 'value' }]], + ['elixir', 'value: var()', [{ name: 'value', bound: 'var()' }]], ['ruby', 'unchecked out T < Foo = Bar', [{ name: 'T', modifier: 'out', bound: 'Foo', default: 'Bar' }]], ['py', 'T: int = str', [{ name: 'T', bound: 'int', default: 'str' }]], ['py', '**P', [{ name: 'P', modifier: '**' }]], diff --git a/site/src/lib/elixir-code-layout.ts b/site/src/lib/elixir-code-layout.ts index 5d957adf4..b67a1a791 100644 --- a/site/src/lib/elixir-code-layout.ts +++ b/site/src/lib/elixir-code-layout.ts @@ -1,4 +1,4 @@ -import { ELIXIR_DECLARATION_COLUMNS, type ApiSymbol, type Signature } from '@libtmux/api-model' +import { ELIXIR_DECLARATION_COLUMNS, findTopLevel, type ApiSymbol, type Signature } from '@libtmux/api-model' import { CODE_COLUMNS, codeWidthFailures, type CodeLayout, type CodeSyntax } from './code-layout' /** @@ -72,6 +72,17 @@ async function layOut(symbol: ApiSymbol, signature: Signature): Promise { expect(code).toMatchObject({ value: entry.signatures[0]!.raw }) }) + it('shows an unconstrained type variable in the spec and omits a bound from its entry', async () => { + const entry = symbol('LibTmux.Control.with_connection/2') + const [signature] = entry.signatures + const layout = (await apiSignatureLayouts(entry, 'elixir')).get(signature!)! + const spans = signatureSpans(layout, index, entry, signature) + expect(spans.find((span) => span.text === 'var')).toEqual({ text: 'var', keyword: true, nonReference: true }) + expect(spans.filter((span) => span.text === 'value' && span.link?.typeParameter)).toHaveLength(4) + const [parameter] = apiEntryFields(entry, 'elixir').typeParameters + expect(parameter?.name).toBe('value') + expect(parameter?.bound).toBeUndefined() + }) + it('leave no type name in the committed model unresolved except those a language or a hidden module owns', () => { const unresolved = new Map() for (const entry of model.symbols) {