PITWALL

WIT reference 0.1

Preview

Preview. Every interface, type and function of the tile world pitwall:tile@0.1.0: the contract between a tile and Pitwall, written in WIT (the WebAssembly Interface Type language). It is generated from the WIT files' doc comments when the site is built, so it can't disagree with them.

Reading it

  • You don't write WIT. The pitwall-extension crate turns it into Rust: elements, the Tile trait, typed events and the storage, settings, log, ui, agents, badges and asks modules, and tools (over agent-tools). Read this page to see exactly what crosses between a tile and Pitwall, such as each limit and each error.
  • The world says what a tile imports from Pitwall (ui, log, tasks, storage, settings, agents, badges, asks, agent-tools) and what it exports (guest). The SDK's export! writes the export for you.
  • Names. WIT names use kebab case; the SDK's use Rust's (request-render is ui::request_render, text-2 is Token::Text2).
  • What a tile gets besides. WASI 0.2 for what Rust's standard library needs: clocks, random numbers, and stdout and stderr, which go to the tile's Log. There are no files, sockets, environment variables or arguments.
  • Versions. A 0.x world may change between minor versions, and Pitwall keeps the last two 0.x worlds working. A tile names the world it was built for in its manifest ("world": "pitwall:tile@0.1.0"). WIT 1.0 ends the Preview.

The WIT files are in crates/pitwall-tile-host/wit/, and a copy ships with the SDK.

Package pitwall:tile@0.1.0, generated from agent-tools.wit, agents.wit, asks.wit, badges.wit, files.wit, guest.wit, log.wit, net.wit, notify.wit, programs.wit, service.wit, settings.wit, show.wit, sql.wit, status.wit, storage.wit, tasks.wit, toolbar.wit, types.wit, ui.wit, world.wit.

Pitwall's tile API, version 0.1 (docs/spec/tile-sdk/runtime.md §3).

A tile is a WebAssembly component that Pitwall runs in a sandbox and draws with its own UI code. The component describes what to show as a tree of elements ([types]); Pitwall lays it out, draws it in its own theme, and sends back what the user did as events. The component never draws pixels and never sees Pitwall's process.

Version 0.x worlds may change between minor versions; Pitwall keeps the last two 0.x worlds working (runtime.md §8.2). A component records the world it was built for in its manifest's tile entry ("world": "pitwall:tile@0.1.0").

World tile

What a tile's component imports from Pitwall and exports to it.

Most imports here work without a permission: each one reaches only the tile's own things (its tree, its log, its timers, its stored data and database, its settings, its toolbar button, its own server). Those that reach Pitwall's agents need a permission the user grants (agents.read, agents.queue), and badges and questions need the manifest to contribute them; net, notify and show need the permission of that name, and a project's files need files.read or files.write. A tile that isn't granted one gets denied from it instead of failing to load, and can ask again later (a grants-changed event says when the user changed them).

Besides these, the host provides WASI 0.2 for what Rust's standard library needs: the wall and monotonic clocks (std::time::SystemTime and Instant work), random numbers, and stdout and stderr, whose lines go to the tile's Log (stdout as info, stderr as warnings). There are no environment variables, arguments, files or sockets through WASI: keep data with [storage], and reach files through [files]. In the test harness both clocks are virtual: they move only when the test lets time pass.

tile.ui

import, interface

Ask for renders, scroll a node into view, show a toast, open a view.

import ui;

tile.log

import, interface

Lines for the tile's Log.

import log;

tile.tasks

import, interface

Timers.

import tasks;

tile.storage

import, interface

The tile's own key-value store.

import storage;

tile.settings

import, interface

The tile's settings, as the user set them in Settings.

import settings;

tile.agents

import, interface

Pitwall's agents and their Next up (agents.read, agents.queue).

import agents;

tile.badges

import, interface

Counts and notes on sidebar rows ("badges": true).

import badges;

tile.asks

import, interface

Questions in the floating control ("asks": true).

import asks;

tile.net

import, interface

HTTP requests to the hosts the user granted (net).

import net;

tile.sql

import, interface

The extension's own SQLite database.

import sql;

tile.notify

import, interface

System notifications (notify).

import notify;

tile.show

import, interface

Open a file in the editor or a page in a web tile (show).

import show;

tile.toolbar

import, interface

The extension's toolbar button.

import toolbar;

tile.service

import, interface

The extension's own server.

import service;

tile.status

import, interface

Its connection's status on its card ("status": true).

import status;

tile.agent-tools

import, interface

Agents' calls of the tile's tools: answers to show-only calls, large inputs.

import agent-tools;

tile.files

import, interface

Files in the project a view is open in (files.read, files.write), and the extension's own files folder.

import files;

tile.programs

import, interface

Approved native programs and pinned downloads.

import programs;

tile.guest

export, interface

What Pitwall calls in the tile.

export guest;

Interface agent-tools

Agents' calls of the tile's tools (agent-tools.md §11.2–11.7): the answers to show-only calls, and the read and act calls themselves. No permission: what a tile may do while it answers is decided by the tool's kind (below), and whether an agent may call read and act tools at all is the user's decision in Pitwall.

Every tile can be opened by an agent with Pitwall's own <extension-id>__open, and a manifest may declare show tools of kind show or present (tools on its tile entry). A call reaches the tile as view-opened (it opened a view) or view-content (it went to the view that is open), with the call's id, the tool and the agent in the content record. Pitwall has already checked the input against the tool's schema.

A present call is all or nothing: input with problems changes nothing, and the reply says why. Pitwall refuses, before the tile sees it, a call that would replace an item the user changed since (user-edited).

read and act calls arrive through the guest's tool export instead, as a tool-call: a read returns what the tile has (with the user's edits), an act changes something outside the tile. Pitwall asks the user before it delivers either: a read until the user allows that agent always, an act each time unless they did. While a show, present or read call runs, the tile's acting calls (net, show, notify, agents.queue-add) return denied; only an act call has the tile's full grants.

agent-tools.problem

record

A problem in the agent's input, at a place in it when there is one (lines and columns from 1).

record problem {
  line: option<u32>,
  column: option<u32>,
  message: string,
}

agent-tools.tool-ok

record

What a call did: a short text for the agent (at most 4 KiB, cut beyond; say what is shown, never the tile's data), optional JSON of the same, and the item id it was shown under (when the tile chose it).

record tool-ok {
  text: string,
  json: option<string>,
  item: option<string>,
}

agent-tools.tool-error

record

Why a call changed nothing: a message first, then each problem.

record tool-error {
  message: string,
  problems: list<problem>,
}

agent-tools.tool-output

variant

A call's answer.

variant tool-output {
  ok(tool-ok),
  error(tool-error),
}

agent-tools.reply

function

Answer call call (from content.call, or a tool-call's id). Only the first answer counts, and only while Pitwall still waits for it: for a show-only call, during the handle that delivered it (without one, Pitwall answers with what opened and where); for a read or act call the tile's tool export didn't answer at once, until its time limit (10 s for read, 120 s for act), after which the tile gets tool-cancelled.

reply: func(call: u64, out: tool-output);

agent-tools.user-edited

function

The user changed what call call put in the tile (they typed in an agent's draft, moved its boxes). From now on that agent's calls with the same item are refused, before the tile sees them, with "The user changed this; show it under a new item id", so an agent never overwrites the user's edits.

user-edited: func(call: u64);

agent-tools.tool-kind

enum

What a tool does, as its manifest entry declares it.

enum tool-kind {
  show,
  present,
  read,
  act,
}
CaseDescription
showOpens or focuses the tile.
presentPuts content into the tile, or changes content the same agent put there.
readReturns what the tile has now, with the user's edits.
actHas effects outside the tile (the network, files, other services).

agent-tools.tool-call

record

A call of a read or act tool, delivered to guest.tool. Pitwall has checked the input against the tool's schema, and the user has allowed it.

record tool-call {
  id: u64,
  tool: string,
  kind: tool-kind,
  caller: option<caller>,
  input: string,
  view: option<view-id>,
}
FieldTypeDescription
idu64The call's id: answer it with reply when tool returned none.
toolstringThe tool's name in the manifest.
kindtool-kind
calleroption<caller>The agent that called, as Pitwall identified it; none: the user ran it themselves (the command palette, or pitwall extension run in one of Pitwall's own terminals).
inputstringThe input, as JSON text.
viewoption<view-id>The open view of the tool's tile, if one is open (a read or act call never opens one).

agent-tools.input-part

function

Part of a large input: up to len bytes (at most 1 MiB) from byte offset of the file a present call named instead of inline text (content.large says how long it is), as UTF-8 text ending at a character boundary (so a part may be a little shorter). Only while the event that delivered the call is handled; an error says why not.

input-part: func(call: u64, offset: u64, len: u32) -> result<string, string>;

Interface agents

Pitwall's agents as a tile may see them, and their Next up (platform-services.md §14.2, the agents' questions group). The same methods and permissions as adapters' agent.list and queue.add, with the same limits, recorded in the extension's Activity.

agents.agent-state

enum

What an agent is doing now, as Pitwall reads it.

enum agent-state {
  working,
  blocked,
  idle,
  done,
  stopped,
  unknown,
}
CaseDescription
workingWorking on its turn.
blockedIt asks the user something (an approval, a question) and is held up until it is answered.
idleWaiting for its next prompt.
doneDone with its turn.
stoppedNot running: it exited or was stopped.
unknownPitwall can't tell yet.

agents.agent

record

An agent (or a terminal) Pitwall shows.

record agent {
  id: string,
  name: string,
  kind: string,
  kind-name: string,
  project: string,
  branch: option<string>,
  state: agent-state,
  waiting-on-you: bool,
  queued: u32,
}
FieldTypeDescription
idstringPitwall's id for it: what queue-add and a badge's row take.
namestringIts name, as the sidebar shows it.
kindstringIts kind's id (claude, codex, shell for a plain terminal…).
kind-namestringIts kind's name ("Claude Code").
projectstringIts project's folder.
branchoption<string>The git branch it works on, when known.
stateagent-stateWhat it is doing.
waiting-on-youboolIt waits on the user: the sidebar's and the Dock's "needs you" (blocked).
queuedu32Items waiting in its Next up (the "N queued" chip on its tile).

agents.list

function

Every agent Pitwall shows, in the sidebar's order. Needs the agents.read permission (host-error.denied without it). The tile gets agents-changed when this changes.

list: func() -> result<list<agent>, host-error>;

agents.queue-add

function

Put text in agent agent's Next up, marked "From <extension name>", waiting for the user's Send (Auto-send sends it only when the user lets the extension send without asking). Needs the agents.queue permission. At most 4 000 characters (host-error.too-large over that), not empty (invalid); at most 3 of the extension's items wait in one agent's Next up and one is queued per agent every 10 seconds (busy); invalid for an agent that isn't there. Use for event-driven nudges: identify the changed item and how to read it, so the agent need not poll for events. Success means queued, not delivered or acted on. Automatic sending also needs the agent's Auto-send setting and waits for a settled Idle/Done session; it does not interrupt Working agents or restart Stopped agents. This call does not grant a background lifetime or an inbound event listener.

queue-add: func(agent: string, text: string) -> result<_, host-error>;

agents.env-var

record

A variable for agents (set-env): its name, one the agents.env permission lists, and its value as a template.

record env-var {
  name: string,
  value: string,
}
FieldTypeDescription
namestring
valuestringPlain text, a plain setting ({setting:KEY}, never a secret), and the agent's own identity: {agent_name}, {agent_id} (Pitwall's id for its session, kept across restarts), {project} (its project's folder name). Filled in for each agent; one line, at most 1 000 characters.

agents.set-env

function

Set these variables on the agents Pitwall starts from now on in the projects the extension is on for (the ticks on its card): the whole set each time, at most 16; an empty list sets none. Needs the agents.env permission (host-error.denied without it); a name it doesn't list, a secret setting, another placeholder or a brace is invalid, with the reason in its Log. Pitwall keeps the set across restarts and shows it on the extension's card; running agents started under another set are "running agents that use an old setup".

set-env: func(vars: list<env-var>) -> result<_, host-error>;

Interface asks

Questions in Pitwall's floating control (platform-services.md §14.2), shown as an inbox's are: a card with who asks, the question, the suggestions, a field, Send, Decline and "Open <tile>". Only when the manifest says "asks": true in contributes. The answer comes back as the ask-answered event.

asks.suggestion

record

An answer the user can pick with one click.

record suggestion {
  label: string,
  description: option<string>,
}
FieldTypeDescription
labelstringIts words (at most 80 characters).
descriptionoption<string>A line under it (at most 200 characters).

asks.ask

record

A question the tile asks the user.

record ask {
  id: string,
  from: option<string>,
  title: string,
  question: string,
  suggestions: list<suggestion>,
  multiple: bool,
  blocking: bool,
}
FieldTypeDescription
idstringThe tile's own id for it, stable while it is open (1 to 128 characters): ask-answered names it.
fromoption<string>Who asks: an agent by Pitwall's id (needs agents.read), shown by its name; none: the extension asks.
titlestringWhat it is about, after who asks (at most 200 characters).
questionstringThe question (at most 2 000 characters).
suggestionslist<suggestion>Answers to pick (at most 8).
multipleboolSeveral suggestions may be picked.
blockingboolIt holds an agent or a job up: shown first, marked "Waiting on you".

asks.set

function

The whole set of open questions, each time (an empty list clears them). At most 50 (host-error.too-large over that); the control shows them after agents' own prompts. denied when the manifest doesn't contribute asks; invalid for an ask with no id, two with the same id, or no question. Longer text is cut. Pitwall keeps the set while the tile is hidden or let go to save memory, so the questions stay in the control; an answer to a tile that was let go starts it again first.

set: func(open: list<ask>) -> result<_, host-error>;

asks.reply

function

After ask-answered: none when the answer was taken (send a set without the question), or why it wasn't, which the card shows under its buttons ("Not sent: …"), letting the user answer again.

reply: func(id: string, refused: option<string>);

Interface badges

Counts and short notes on sidebar rows (platform-services.md §14.2), beside Pitwall's own waiting badges, as adapters' badges do. Only when the manifest says "badges": true in contributes; gone when the extension is turned off or its last tile closes.

badges.row

variant

Which sidebar row a badge is on.

variant row {
  agent(string),
  project(string),
}
CasePayloadDescription
agentstringAn agent, by Pitwall's id (agents.list). Needs agents.read.
projectstringA project, by its folder. Needs projects.read.

badges.badge

record

A count and/or a few words on a row.

record badge {
  row: row,
  count: option<u32>,
  note: option<string>,
  tone: tone,
  tooltip: option<string>,
  open: option<string>,
}
FieldTypeDescription
rowrowThe row.
countoption<u32>A number (at most 9999).
noteoption<string>A few words (at most 16 characters; longer is cut). A badge needs a count or a note.
tonetoneIts colour by meaning: info is neutral.
tooltipoption<string>Shown on hover after the extension's name (at most 120 characters).
openoption<string>One of the extension's tiles (an id from contributes.tiles) that a click on the badge opens.

badges.set

function

The whole set of badges, each time (an empty list clears them). At most 500 (host-error.too-large over that); at most four sets a second are shown (the newest waits for its turn). denied when the manifest doesn't contribute badges. A badge on a row the tile may not name (a missing permission) is dropped and noted in its Log.

set: func(badges: list<badge>) -> result<_, host-error>;

Interface files

Files in the project a view is open in, and in the extension's own files folder (platform-services.md §14.3, permissions.md §5.1).

The project. Every view is open somewhere in Pitwall's layout: in a project's space, next to an agent working in a project, or opened from a project's menu in the sidebar. That project is the view's (project), and the only project folder its tile may reach: a tile never names a folder of its own choosing, and never reaches a project none of its views is in. A view moved to another project's space, or out of every project, sends project-changed with its id.

Permissions. Reading a project (read, stat, list, watch) needs files.read; changing it (write, create, make-folder, rename, delete) needs files.write, off until the user turns it on. The extension's own files folder (root.data, <data>/extension-data/<id>/files/) needs neither: it is its own, like its key-value store, and holds at most 100 MiB.

What is never reached. Paths are relative to the root, with / between parts. Absolute paths and .. are refused (not-allowed); links are followed and refused when they lead out of the root. A .git folder is neither listed, read nor changed, and Pitwall's own files in a project (.pitwall.json, .pitwall/) are never changed. list and watch leave out what the project's .gitignore files (and .git/info/exclude) ignore; read and stat still reach those files by name.

Limits. A file read or written is at most 8 MiB; list gives at most 10 000 entries; a tile has at most 8 watches at once. Changing calls (and refusals) are listed in the extension's Activity.

files.project-info

record

A project, as Pitwall shows it.

record project-info {
  name: string,
  folder: string,
}
FieldTypeDescription
namestringIts name, as the sidebar shows it (checkout-web).
folderstringIts folder, absolute, as this computer writes it.

files.root

variant

Where a call's path starts.

variant root {
  project(string),
  data,
}
CasePayloadDescription
projectstringThe folder of the project the view with this id is open in (project). no-project when the view isn't open, or isn't in a project.
dataThe extension's own files folder: no permission needed, kept across updates, at most 100 MiB.

files.entry-kind

enum

What an entry is.

enum entry-kind {
  file,
  folder,
}

files.entry

record

A file or folder.

record entry {
  path: string,
  kind: entry-kind,
  size: u64,
  modified: u64,
}
FieldTypeDescription
pathstringIts path from the root, with / between parts (docs/arch.md).
kindentry-kindA file or a folder (a link is what it leads to).
sizeu64Its size in bytes (0 for a folder).
modifiedu64When it last changed, in milliseconds since 1970 (UTC).

files.file-error

variant

Why a call didn't do what was asked.

variant file-error {
  denied,
  no-project,
  not-found,
  exists,
  not-allowed(string),
  too-large,
  busy,
  invalid(string),
  failed(string),
}
CasePayloadDescription
deniedThe tile isn't granted files.read (to read) or files.write (to change), or an agent's call runs without the tile's acting permissions (writing needs an act call).
no-projectThe view isn't open, or isn't in a project.
not-foundNothing is at that path.
existsSomething is already at that path (create, make-folder, rename's target).
not-allowedstringThe path is outside the root (an absolute path, .., a link that leads out), inside .git, or one of Pitwall's own files; the text says which.
too-largeOver a limit: a file over 8 MiB, more than 10 000 entries, the files folder over 100 MiB.
busyToo many calls this second, or 8 watches already.
invalidstringA path that isn't valid (empty where a file is needed, a NUL); the text says why.
failedstringThe disk said no (a permission of the system, a full disk); the text says what happened.

files.watch-id

type

A watch's number, unique while the tile runs.

type watch-id = u32;

files.files-changed

record

What files-changed carries.

record files-changed {
  watch: watch-id,
  paths: list<string>,
}
FieldTypeDescription
watchwatch-idThe watch.
pathslist<string>The paths that changed (were written, made, renamed or removed), from the watch's root, each once, sorted. Changes close together arrive as one event, about a quarter of a second after the last.

files.project

function

The project view view is open in, if any. Needs files.read (or projects.read); without either, none.

project: func(view: string) -> option<project-info>;

files.read

function

A file's bytes (at most 8 MiB).

read: func(root: root, path: string) -> result<list<u8>, file-error>;

files.stat

function

A file or folder: what it is, its size and last change. "" is the root itself.

stat: func(root: root, path: string) -> result<entry, file-error>;

files.list

function

What folder folder holds ("": the root): its files and folders, sorted by path; with deep, everything under it too. Ignored entries and .git are left out. At most 10 000 entries, else too-large: list a smaller folder.

list: func(root: root, folder: string, deep: bool) -> result<list<entry>, file-error>;

files.watch

function

Follow changes under folder folder ("": the root), everything under it: each change arrives as a files-changed event with the number returned here. Ignored paths and .git are left out. At most 8 watches at once (busy). A watch ends with unwatch, when its view closes or leaves the project, or when the tile stops.

watch: func(root: root, folder: string) -> result<watch-id, file-error>;

files.unwatch

function

Stop watch id; a number that isn't watching is ignored.

unwatch: func(id: watch-id);

files.write

function

Write contents to file path, replacing what is there; its folders are made when missing. The file is written whole or not at all (a reader never sees half of it). Needs files.write for a project.

write: func(root: root, path: string, contents: list<u8>) -> result<_, file-error>;

files.create

function

Make a new file path with contents; exists when something is there already. Its folders are made when missing.

create: func(root: root, path: string, contents: list<u8>) -> result<_, file-error>;

files.make-folder

function

Make folder path (and the folders above it); exists when something is there already.

make-folder: func(root: root, path: string) -> result<_, file-error>;

files.rename

function

Move or rename from to to, in the same root; exists when something is at to.

rename: func(root: root, %from: string, to: string) -> result<_, file-error>;

files.delete

function

Move file or folder path of a project to the system's Trash, where the user can put it back. In the files folder it is deleted.

delete: func(root: root, path: string) -> result<_, file-error>;

Interface guest

What Pitwall calls in a tile (runtime.md §3.2).

Pitwall calls these one at a time, from one thread per running tile, never the UI's: a tile is never called again while one of its calls runs, and a slow call slows only that tile. Every call has a deadline; a call that runs past it is stopped, the tile shows "stopped" with the reason, and the user can restart it.

guest.init

function

Start: called once, before anything else, with the theme, the granted permissions and the state saved last time. An error stops the tile and its text is shown to the user. Deadline: 2 s.

init: func(cx: init-context) -> result<_, string>;

guest.render

function

The whole tree of view view. Called after init, after every handled event that returned true, after ui.request-render, and when a view is opened or shown again; several changes in one frame make one render. Deadline: 250 ms; keep it under 8 ms so the tile keeps up with the display.

render: func(view: view-id) -> frame;

guest.handle

function

Handle one event. Return true when what the tile shows changed, so Pitwall renders its open views again. Deadline: 1 s; calls over 50 ms are noted in the tile's Log.

handle: func(event: event) -> bool;

guest.save-state

function

State to keep while the tile is dropped (to save memory after it was hidden for a while) or reloaded during development; given back in init-context.state. At most 1 MiB; deadline 50 ms. Data the user must not lose belongs in storage, which is kept on disk at once.

save-state: func() -> list<u8>;

guest.rows

function

Rows start to start + count (fewer at the end) of the virtual list, table or tree at key-path in view view (keys from the root down, joined by /, as ui.scroll-to), as the rows come into sight (runtime.md §2.7). Pitwall asks again when the list's revision moves. At most 256 rows a call, each at most 64 nodes. Deadline: 250 ms, as render.

rows: func(view: view-id, key-path: string, start: u32, count: u32) -> list<row>;

guest.tool

function

A read or act call of one of the tile's declared tools (agent-tools.md §11.2). Return the answer, or none and call agent-tools.reply later (an act that waits on the network), within the call's time limit: 10 s for read, 120 s for act. Deadline of this call itself: 1 s, as handle. Calls arrive one at a time, in order, like events.

tool: func(call: tool-call) -> option<tool-output>;

Interface log

Lines for the tile's Log, which the user and pitwall extension dev can read (runtime.md §3.8). No permission. Each line is at most 4 KiB (longer lines are cut); lines over the host-call limit (200 calls a second) are dropped, and the Log says how many. println! and eprintln! reach the same Log through WASI's stdout and stderr.

log.debug

function

Detail for whoever is debugging the tile.

debug: func(message: string);

log.info

function

Something worth knowing happened.

info: func(message: string);

log.warn

function

Something went wrong, and the tile carried on.

warn: func(message: string);

log.error

function

Something failed.

error: func(message: string);

Interface net

HTTP requests to the hosts the user granted (platform-services.md §14.2, permissions.md §5.1). Needs the net permission: the manifest lists its hosts ("net": {"reason": …, "hosts": ["api.github.com", "*.example.com"]}), the user sees them as written and may refuse. Without the grant every request is refused with denied.

Pitwall makes the request, not the tile: no sockets, no DNS, no TLS of its own. The URL is parsed by Pitwall and its host compared with the list (after IDNA, before any name lookup); https:// to a listed host, plain http:// only to this computer (localhost, 127.0.0.1, [::1]) and only when listed. A host without a port in the list is reached on the scheme's own port only. Redirects are followed by Pitwall (at most 5), only to listed hosts. No cookies, no proxy, no credentials are added.

A request runs while the tile goes on: fetch returns at once with the request's number, and the answer arrives as a fetched event. At most 8 requests at once, a body of at most 8 MiB, an answer of at most 32 MiB, 30 s unless the request asks for less (at most 120 s).

A tile that talks to its extension's own server (a service in the manifest) may reach that server's address without net: see [service].

net.header

record

A header, as sent or received.

record header {
  name: string,
  value: string,
}
FieldTypeDescription
namestring
valuestringAn entire value secret(key) or bearer(key) references a declared secret setting. The host fills it in only after checking the current explicit net host grant, including every redirect. Other values stay literal; responses always contain literal text.

net.request

record

A request.

record request {
  method: string,
  url: string,
  headers: list<header>,
  body: option<list<u8>>,
  timeout-ms: option<u32>,
}
FieldTypeDescription
methodstringGET, POST, PUT, PATCH, DELETE or HEAD.
urlstringThe whole address, https://… (or http://localhost…).
headerslist<header>Headers to send. Host, Content-Length, Connection, Cookie and Proxy-* are Pitwall's and refused.
bodyoption<list<u8>>The body, at most 8 MiB.
timeout-msoption<u32>Give up after this many milliseconds (default and most: 30 000; at most 120 000 when asked for).

net.response

record

An answer: any HTTP status, 404 and 500 included.

record response {
  status: u16,
  headers: list<header>,
  body: list<u8>,
  url: string,
}
FieldTypeDescription
statusu16The status code.
headerslist<header>The answer's headers (Set-Cookie left out).
bodylist<u8>The body, at most 32 MiB.
urlstringThe address that answered, after redirects.

net.fetch-error

variant

Why a request got no answer.

variant fetch-error {
  denied(string),
  too-large,
  invalid(string),
  timed-out,
  failed(string),
}
CasePayloadDescription
deniedstringThe tile isn't granted net, or the host isn't one it may reach (the text names the host).
too-largeOver a limit: 8 requests at once, a body over 8 MiB, an answer over 32 MiB.
invalidstringThe request isn't valid (a bad URL, method or header); the text says why.
timed-outNo answer in time.
failedstringIt couldn't be sent or the connection failed (offline, a name that doesn't resolve, a TLS error); the text says what happened.

net.request-id

type

A request's number, unique while the tile runs.

type request-id = u32;

net.fetched

record

What fetched carries: the request's number and its answer.

record fetched {
  id: request-id,
  outcome: result<response, fetch-error>,
}
FieldTypeDescription
idrequest-idThe number fetch returned.
outcomeresult<response, fetch-error>The answer, or why there is none.

net.fetch

function

Send request; its answer arrives as a fetched event with the number returned here. Refused at once (denied, invalid, too-large) when it can't be sent.

fetch: func(request: request) -> result<request-id, fetch-error>;

net.cancel

function

Stop waiting for request id: no fetched arrives for it. A number that isn't waiting is ignored.

cancel: func(id: request-id);

Interface notify

System notifications (platform-services.md §14.2). Needs the notify permission; without it, denied. For news inside Pitwall, a toast (ui.toast) needs nothing.

Labelled with the extension's name. Shown by the system while Pitwall isn't in front, and as a toast in Pitwall either way; clicking either opens the tile that sent it. At most 3 a minute (busy over that); the same title and text again within 10 minutes is shown once.

notify.send

function

Notify the user: a title (at most 80 characters) and a line of text (at most 200; longer is cut).

send: func(title: string, body: string) -> result<_, host-error>;

Interface programs

Native programs, outside the tile sandbox. Needs programs, its declared patterns, and the user's approval of every exact command.

programs.unpack

enum

enum unpack {
  none,
  zip,
  tar-gz,
  gzip,
}

programs.run

function

Run once, at most four at once and ten minutes; output is cut to one MiB per stream. Returns a task even while approval is pending.

run: func(cmd: command, timeout-ms: u32) -> result<u32, host-error>;

programs.start

function

Keep a named process group running, with 1/5/30 s restart delays. A loopback listen address is reachable only while it runs.

start: func(name: string, cmd: command, listen: option<string>) -> result<_, host-error>;

programs.stop

function

stop: func(name: string);

programs.status

function

status: func(name: string) -> info;

programs.download

function

HTTPS, a declared download pattern, SHA-256, then a new destination under the extension's data folder. Never the user's other files.

download: func(url: string, sha256: string, to: string, unpack: unpack) -> result<u32, host-error>;

Interface service

The extension's own server, when its manifest declares a service (services.md §13.2): a program on this computer that Pitwall installs with one of the extension's actions, starts while the extension is on and restarts when it stops. No permission: only its own server.

The tile may reach the server's address (its ready.listen, as the user's settings make it) with net.fetch, over http, without the net permission; nothing else on this computer. Hiding or closing the tile doesn't stop the server; turning the extension off stops both.

service.state

enum

How the server stands.

enum state {
  none,
  off,
  needs-install,
  starting,
  up,
  stopped,
  failed,
}
CaseDescription
noneThe extension declares no service.
offNot started yet: the user hasn't confirmed its commands.
needs-installIts program isn't installed (or too old): the card offers its install action.
startingStarted, not answering yet.
upRunning and answering.
stoppedStopped by the user.
failedIt stopped by itself and isn't coming back on its own.

service.service-info

record

The server's state now.

record service-info {
  state: state,
  address: option<string>,
  version: option<string>,
  why: option<string>,
}
FieldTypeDescription
statestate
addressoption<string>Where it listens, http://127.0.0.1:8790 (no trailing /), when it declares ready.listen.
versionoption<string>The version its version check found.
whyoption<string>Why it is off, failed or needs installing, in plain words.

service.info

function

The server's state now (a service-changed event follows each change).

info: func() -> service-info;

service.restart

function

Ask Pitwall to start the server again, as the card's Restart does.

restart: func();

service.open-card

function

Show the extension's card in Settings, where the user installs, confirms and starts the server.

open-card: func();

Interface settings

The tile's settings (platform-services.md §14.2). No permission: only the extension's own settings. The manifest declares them (settings: key, type, label, default); Pitwall draws the form in Settings, keeps the values and sends settings-changed when the user changes them.

settings.setting-value

variant

A setting's value.

variant setting-value {
  text(string),
  number(f64),
  flag(bool),
}
CasePayloadDescription
textstringA text, url or choice setting (a choice gives its value, not its label).
numberf64A number setting.
flagboolA bool setting (a switch).

settings.get

function

The value of setting key: what the user set, else the manifest's default; none when it has neither, or when key isn't one of the manifest's settings. A secret setting is never returned here: use secret.

get: func(key: string) -> option<setting-value>;

settings.secret

function

The value of secret setting key, from the system's secure store: none when the user hasn't set it. host-error.invalid when key isn't one of the manifest's secret settings. denied for keys the user has saved or removed through a host-owned secure field (the reference-only boundary persists across restarts and updates). Legacy keys keep this API until the adapter migration. Keep it in memory only: never store it, log it or show it.

secret: func(key: string) -> result<option<string>, host-error>;

settings.open

function

Open the extension's page in the Extensions tile, at its Setup view when the manifest names one (contributes.setup), where the user sets these (for a "Set up" button when something it needs isn't set).

open: func();

settings.secret-set

function

Whether this declared secret is set; never returns its value.

secret-set: func(key: string) -> bool;

settings.set

function

Save an ordinary setting, validated against its schema. Secrets and keys referenced by net/program permission patterns are denied: only the host-owned fields may change those. Empty text restores a default.

set: func(key: string, value: setting-value) -> result<_, host-error>;

Interface show

Show the user a file or a web page in Pitwall (platform-services.md §14.2). Needs the show permission, off until the user turns it on; without it, denied. These only show: the tile gets nothing back, and Pitwall never comes forward or takes the keyboard from a terminal. browser uses the separate show.browser permission and may activate the external browser.

show.file

function

Open the file at path (absolute, on this computer) in Pitwall's editor, at line (1 is the first) when given; the editor opens in the front window when it isn't open. invalid for a path that isn't absolute. Opening the editor is all it does: the tile can't read the file through it.

file: func(path: string, line: option<u32>) -> result<_, host-error>;

show.web

function

Open url (https://, or http:// to this computer) in a new web tile next to the tile's own. invalid for another kind of address.

web: func(url: string) -> result<_, host-error>;

show.view

function

Show the file at path (absolute, on this computer) in Pitwall's file viewer, scrolled to line (1 is the first) when given, as an agent's show_files shows files: with its folder's tree (its git repository's, when it is in one) and git status, in a window of the viewer's own that opens behind the front window and doesn't take the keyboard. One viewer per tile: a later call adds a tab to it. invalid for a path that isn't absolute. As file, it only shows.

view: func(path: string, line: option<u32>) -> result<_, host-error>;

show.browser

function

Open an HTTPS (or loopback HTTP) URL in the user's external browser. Unlike web, this creates no tile or stored location. Pitwall doesn't record the URL in its Log, Activity or Debug output. Requires show.browser (off until allowed), independently of show. The browser has its own history/privacy behavior. Useful for one-time sign-in links.

browser: func(url: string) -> result<_, host-error>;

Interface sql

The extension's own SQLite database, run by Pitwall (platform-services.md §14.2). No permission: only this extension's data, in <data>/extension-data/<id>/, outside its folder, so updates and going back keep it. Every tile of the extension shares it.

At most 100 MiB unless the manifest asks for more with the sql permission ({"reason": …, "mib": 500}, at most 2 GiB, shown on the permission screen); over it, writes fail with too-large. A statement runs within the deadline of the call it is made in (handle 1 s, init 2 s): a longer one is stopped and fails with busy.

A transaction lasts at most one call into the tile: begin, then statements, then commit or rollback, all while handling one event; one still open when the call returns is rolled back, with a line in the Log. Answers hold at most 10 000 rows and 8 MiB.

sql.value

variant

A value in a row or a parameter, as SQLite keeps it.

variant value {
  null,
  integer(s64),
  real(f64),
  text(string),
  blob(list<u8>),
}

sql.rows

record

A query's answer.

record rows {
  columns: list<string>,
  rows: list<list<value>>,
}
FieldTypeDescription
columnslist<string>The columns' names, in order.
rowslist<list<value>>Each row's values, in the columns' order.

sql.execute

function

Run one statement with params bound to its ? (or ?1, ?2…) placeholders; the number of rows it changed. Errors: invalid with SQLite's words for a statement that is wrong or breaks a constraint, too-large over the quota, busy over the deadline.

execute: func(statement: string, params: list<value>) -> result<u64, host-error>;

sql.query

function

Run one statement and return its rows.

query: func(statement: string, params: list<value>) -> result<rows, host-error>;

sql.migrate

function

Bring the database's schema up to date: steps are the migrations in order (each one or more statements; step 1 first). The database keeps how many it ran (SQLite's user_version); the ones after that run now, each in its own transaction. Returns the version now. A step that fails is rolled back and stops the rest (invalid, with its number). Fewer steps than the database has run is invalid: a tile can't go back a schema.

migrate: func(steps: list<string>) -> result<u32, host-error>;

sql.begin

function

Start a transaction (invalid when one is open).

begin: func() -> result<_, host-error>;

sql.commit

function

Keep what the open transaction did.

commit: func() -> result<_, host-error>;

sql.rollback

function

Undo what the open transaction did.

rollback: func() -> result<_, host-error>;

sql.usage

function

The bytes the database takes now.

usage: func() -> u64;

sql.quota

function

The most it may take, in bytes.

quota: func() -> u64;

Interface status

The extension's connection to its service, as the user sees it (platform-services.md, "Status"): the pill on its card in Settings, the Connected step of its checklist, and the update's check that it connects again, the same as an adapter's status. Only when the manifest says "status": true in contributes.

status.state

enum

How the connection is.

enum state {
  connecting,
  ready,
  signed-out,
  error,
}
CaseDescription
connectingStarting to connect, or connecting again.
readyConnected and working.
signed-outA credential is missing, wrong, expired or lacks access.
errorIt can't connect, or the service failed.

status.set

function

The connection now, with a sentence for the user (at most 500 characters; for ready, usually empty). Until the first call it is connecting. Ignored without the contribution (noted in the Log).

set: func(state: state, message: string);

Interface storage

The tile's own key-value store (platform-services.md §14.2). No permission: it holds only this extension's data, and no other extension can read it.

Kept on disk outside the extension's folder, so it survives updates and going back to an earlier version; written after each call into the tile that changed it. At most 10 MiB in all (keys and values); keys are 1 to 256 bytes of UTF-8, without control characters.

storage.get

function

The value of key, or none when it has none.

get: func(key: string) -> result<option<list<u8>>, host-error>;

storage.get-many

function

The values of keys, in the same order (none for a key with no value), in one host call: a tile loads hundreds of keys at start with list and this. At most 1024 keys a call (host-error.too-large over that); host-error.invalid for a key that isn't valid.

get-many: func(keys: list<string>) -> result<list<option<list<u8>>>, host-error>;

storage.set

function

Set key to value. host-error.too-large when it would take the store over 10 MiB; host-error.invalid for a key that isn't valid.

set: func(key: string, value: list<u8>) -> result<_, host-error>;

storage.delete

function

Remove key. A key with no value is no error.

delete: func(key: string) -> result<_, host-error>;

storage.list

function

The keys that start with prefix (all keys for ""), in byte order.

list: func(prefix: string) -> result<list<string>, host-error>;

storage.usage

function

The bytes the store takes now (keys and values), out of its 10 MiB.

usage: func() -> u64;

Interface tasks

Timers (platform-services.md §14.2). No permission. Timers pause while the tile is hidden and go on when it is shown again; a repeating timer that was due while hidden fires once, not once per missed period.

tasks.timer

function

Fire a timer event after ms milliseconds, once or, with repeat, every ms milliseconds until cancelled. At least 100 ms (shorter is raised to 100). At most 32 timers at once: one more gives host-error.busy.

timer: func(ms: u32, repeat: bool) -> result<timer-id, host-error>;

tasks.cancel

function

Stop a timer. An id that isn't running (fired once, or cancelled already) is ignored.

cancel: func(id: timer-id);

Interface toolbar

The extension's button in Pitwall's top bar (ui.md §3.9), when its manifest declares one (contributes.toolbar). Pitwall draws it: an icon, a tooltip and maybe a badge. No permission; an extension without a toolbar item gets nothing from these (they are ignored).

A click with the popover action opens a small view of the tile under the button: it arrives as view-opened with the view id toolbar:popover and closes with view-closed. With tile or popover, the tile also gets toolbar-clicked.

toolbar.badge

variant

A badge on the button.

variant badge {
  none,
  dot,
  count(u32),
}
CasePayloadDescription
noneNo badge.
dotA dot.
countu32A number (shown up to 99, then "99+").

toolbar.badge-tone

enum

A badge's colour.

enum badge-tone {
  normal,
  attention,
}
CaseDescription
normalThe accent colour.
attentionAmber, like "needs you".

toolbar.set-badge

function

The button's badge, in every window (for a per-project item: in spaces that aren't a project's). At most 4 changes a second: more are merged into the newest. The badge shows while the component runs; a manifest with "badge": true keeps it running while no tile shows.

set-badge: func(badge: badge, tone: badge-tone);

toolbar.set-project-badge

function

A project's badge, for an item with "scope": "project" (shown while that project's space is the window's). project is the id toolbar-clicked gives.

set-project-badge: func(project: string, badge: badge, tone: badge-tone);

toolbar.set-tooltip

function

Change the tooltip (for example "3 unread"). At most 80 characters.

set-tooltip: func(text: string);

toolbar.set-shown

function

Show or hide the button. The user's choice is stronger: a button the user hid stays hidden. At most one change in 5 seconds; each start begins from the manifest's visibleByDefault.

set-shown: func(shown: bool);

toolbar.close-popover

function

Close the popover, if it is open (after a pick or a send).

close-popover: func();

Interface types

The UI description a tile sends, the events it gets back, and the types the other interfaces share (docs/spec/tile-sdk/ui.md §3.3–3.5).

A view is drawn from a frame: a flat list of nodes, each naming its parent by index, so a tree is one list with no recursion. Pitwall compares each frame with the one before by key path and keeps what the user sees (scroll position, focus, hover, text being typed) for nodes whose key path stays the same.

Colours, sizes of text, fonts and corner radii are Pitwall's own tokens, named by meaning, so a tile looks native in light and dark themes and follows the user's appearance settings. There are no raw colours in 0.1.

types.view-id

type

One open view of the tile: a place in Pitwall's layout showing one of the manifest's tiles (contributes.tiles). Chosen by Pitwall and stable while the view is open; a tile opened once has the tile's id as its view id (for example "main"), and a tile opened several times (by the user, or by agents with different content) gets one view id per place. Pitwall renders each open view separately; the guest learns of each from view-opened.

type view-id = string;

types.content

record

Content given to a view when it opens or later, by the user or an agent (as Pitwall's own viewers take a file or a page). The tile's manifest declares what it accepts ("input": a JSON schema in its folder); Pitwall checks the payload against it before delivering.

record content {
  id: option<string>,
  json: option<string>,
  bytes: option<list<u8>>,
  call: option<u64>,
  tool: option<string>,
  caller: option<caller>,
  append: bool,
  large: option<u64>,
}
FieldTypeDescription
idoption<string>The caller's id for this content. A later call with the same id updates the view showing it in place instead of opening another.
jsonoption<string>The payload, as JSON text matching the tile's input schema.
bytesoption<list<u8>>Binary payload (an image, a file's bytes), when the schema says so. At most 8 MiB.
calloption<u64>The agent's call that brought this content (agent-tools.md §11.3): its id, also the origin id of what it put in the tile. Answer it with agent-tools.reply to return problems in the input; without a reply, Pitwall tells the agent what opened and where once handle returns. none: the user opened the view.
tooloption<string>The tool called: a show tool the manifest declares (tools), or none for the open Pitwall gives every tile (<extension-id>__open), whose content is the tile's "input".
calleroption<caller>The agent that called, as Pitwall identified it (never what the agent says about itself). none: the user opened the view. Items are per agent: key what an agent shows by its agent id and id, so two agents never replace each other's.
appendboolThe call adds to the item instead of replacing it ("mode": "append" in a present call, with the same id): json is the part to add.
largeoption<u64>The call named a file instead of inline text ("from_file"): its size in bytes, read in parts with agent-tools.input-part while the event is handled.

types.caller

record

An agent calling a tile's tool, as Pitwall identified it from the calling process.

record caller {
  agent-id: string,
  agent-name: string,
  project: option<string>,
}
FieldTypeDescription
agent-idstringThe agent's id in Pitwall (stable while the agent exists).
agent-namestringThe agent's name, as the user sees it (api, web).
projectoption<string>The agent's project folder, when it has one.

types.view-opened

record

A view was opened.

record view-opened {
  view: view-id,
  tile: string,
  content: option<content>,
}
FieldTypeDescription
viewview-idThe new view's id.
tilestringWhich of the manifest's tiles it shows.
contentoption<content>What it was opened with, if anything.

types.view-content

record

An open view was given new content.

record view-content {
  view: view-id,
  content: content,
}
FieldTypeDescription
viewview-idThe view.
contentcontentIts content now.

types.handler

type

A function of the tile, by number. The tile chooses the numbers when it renders, keeps the function they stand for, and gets the number back in the event when the user acts. A number from an older frame may still arrive once after a render; a tile ignores numbers it no longer knows.

type handler = u32;

types.timer-id

type

A timer, by the number tasks.timer gave.

type timer-id = u32;

types.host-error

variant

Why a host call didn't do what was asked.

variant host-error {
  denied,
  busy,
  too-large,
  invalid(string),
  failed(string),
}
CasePayloadDescription
deniedThe tile isn't granted the permission this needs.
busyToo many calls or things at once (over 200 host calls a second, or 32 timers); try again later.
too-largeOver a size limit or a quota; the limits are in each function's documentation.
invalidstringAn argument isn't valid; the text says which and why.
failedstringThe host couldn't do it (for example a disk error); the text says what happened.

types.token

enum

A colour of Pitwall's theme, by meaning. Each has a light and a dark value; the user's theme decides which is drawn.

enum token {
  bg,
  surface,
  surface-2,
  surface-3,
  raised,
  line,
  line-strong,
  text,
  text-2,
  text-3,
  text-4,
  focus,
  good,
  good-soft,
  warn,
  warn-soft,
  bad,
  bad-soft,
  done,
  done-soft,
  diff-add-bg,
  diff-del-bg,
}
CaseDescription
bgThe window's background, behind tiles.
surfaceA tile's own background.
surface-2A raised area inside a tile: a header, a selected row.
surface-3A further raised area: a hovered selected row, a field.
raisedFloating surfaces: menus, popovers.
lineHairlines and borders.
line-strongStronger borders: a focused field, a divider that must be seen.
textMain text.
text-2Secondary text: details, labels.
text-3Muted text: hints, timestamps.
text-4Faint text: placeholders, disabled.
focusThe focus ring.
goodSuccess: passed, running well.
good-softA soft background for good things.
warnNeeds attention.
warn-softA soft background for warnings.
badFailed, destructive.
bad-softA soft background for failures.
doneFinished.
done-softA soft background for finished things.
diff-add-bgThe background of an added line in a diff.
diff-del-bgThe background of a removed line in a diff.

types.length

variant

A length.

variant length {
  px(f32),
  rem(f32),
  fraction(f32),
  auto,
}
CasePayloadDescription
pxf32Logical pixels (they scale with the display).
remf32Multiples of Pitwall's base text size, so the length follows the user's font size.
fractionf32A fraction of the parent's size, from 0.0 to 1.0.
autoWhatever the content needs.

types.edges

record

A length for each side, for padding, margin and borders.

record edges {
  top: length,
  right: length,
  bottom: length,
  left: length,
}
FieldTypeDescription
toplengthThe top side.
rightlengthThe right side.
bottomlengthThe bottom side.
leftlengthThe left side.

types.text-size

enum

Pitwall's text sizes.

enum text-size {
  xs,
  sm,
  md,
  lg,
  xl,
}
CaseDescription
xsThe smallest: badges, counts.
smSmall: details, labels.
mdThe body size.
lgHeadings inside a tile.
xlLarge headings.

types.font

enum

Pitwall's fonts.

enum font {
  ui,
  mono,
}
CaseDescription
uiThe interface font.
monoThe monospace font, for code and numbers that line up.

types.weight

enum

Text weight.

enum weight {
  normal,
  medium,
  semibold,
  bold,
}
CaseDescription
normalRegular text.
mediumSlightly heavier: labels.
semiboldHeadings.
boldStrong emphasis.

types.radius

enum

Pitwall's corner radii.

enum radius {
  square,
  sm,
  md,
  lg,
  full,
}
CaseDescription
squareSquare corners.
smSmall (4 px).
mdThe usual radius (6 px).
lgLarge (10 px).
fullFully round: pills and circles.

types.align

enum

How children line up across a flex box's main direction.

enum align {
  start,
  center,
  end,
  stretch,
  baseline,
}
CaseDescription
startAt the start.
centerCentred.
endAt the end.
stretchStretched to fill.
baselineAlong their text's baseline.

types.justify

enum

How children are spread along a flex box's main direction.

enum justify {
  start,
  center,
  end,
  space-between,
  space-around,
}
CaseDescription
startPacked at the start.
centerPacked in the centre.
endPacked at the end.
space-betweenThe first at the start, the last at the end, equal space between.
space-aroundEqual space around each.

types.overflow

enum

What happens to content larger than its box.

enum overflow {
  visible,
  hidden,
  scroll,
}
CaseDescription
visibleIt shows outside the box.
hiddenIt is cut off at the box's edge.
scrollThe box scrolls (prefer the scroll element, which keeps its position across frames).

types.cursor

enum

The pointer's shape over a node.

enum cursor {
  default,
  pointer,
  text,
}
CaseDescription
defaultThe usual arrow.
pointerA hand: something clickable.
textA text cursor: selectable text.

types.style

variant

One style of a node. A node has a list of these; a later entry wins over an earlier one of the same kind. Layout is flexbox, as in CSS.

variant style {
  flex-row,
  flex-col,
  wrap,
  grow(f32),
  shrink(f32),
  gap(length),
  padding(edges),
  margin(edges),
  width(length),
  height(length),
  min-width(length),
  max-width(length),
  min-height(length),
  max-height(length),
  align-items(align),
  justify(justify),
  self-align(align),
  overflow-x(overflow),
  overflow-y(overflow),
  border(edges),
  border-color(token),
  radius(radius),
  background(token),
  color(token),
  opacity(f32),
  text-size(text-size),
  font(font),
  weight(weight),
  italic,
  underline,
  truncate,
  line-clamp(u8),
  selectable,
  hover-background(token),
  cursor(cursor),
  group(string),
  visible-on-group-hover(string),
  drag(drag-source),
  drop-target(drop-target),
}
CasePayloadDescription
flex-rowLay children out in a row.
flex-colLay children out in a column (the default for a box).
wrapWrap children onto more lines when they don't fit.
growf32Take this share of the free space along the parent's direction.
shrinkf32Give up this share of the space when there isn't enough.
gaplengthSpace between children.
paddingedgesSpace inside the node's border.
marginedgesSpace outside the node's border.
widthlengthWidth.
heightlengthHeight.
min-widthlengthSmallest width.
max-widthlengthLargest width.
min-heightlengthSmallest height.
max-heightlengthLargest height.
align-itemsalignHow children line up across the main direction.
justifyjustifyHow children are spread along the main direction.
self-alignalignHow this node lines up in its parent, over the parent's align-items.
overflow-xoverflowHorizontal overflow.
overflow-yoverflowVertical overflow.
borderedgesBorder widths (in px or rem; fractions and auto count as none).
border-colortokenBorder colour.
radiusradiusCorner radius.
backgroundtokenBackground colour.
colortokenText and icon colour, inherited by children.
opacityf32Opacity, from 0.0 (invisible) to 1.0.
text-sizetext-sizeText size, inherited by children.
fontfontFont, inherited by children.
weightweightText weight, inherited by children.
italicItalic text.
underlineUnderlined text.
truncateOne line, cut with an ellipsis when too long.
line-clampu8At most this many lines, the last one cut with an ellipsis.
selectableThe user can select and copy this text.
hover-backgroundtokenBackground while the pointer is over the node.
cursorcursorThe pointer's shape over the node.
groupstringNames this node a hover group, for visible-on-group-hover in the nodes under it (a list row and its actions). Names are the tile's own; the same name on several rows is fine: each node looks at its nearest ancestor of that name.
visible-on-group-hoverstringHidden until the pointer is over the nearest ancestor group of this name (a Delete on a list row that shows on hover). Pitwall draws it on hover with no call into the tile; while hidden it takes no clicks. Keyboard users reach it as usual (show it while the row has focus if it matters).
dragdrag-sourceThe user can drag this node to a node of the same view with a drop-target that accepts its kind. Pitwall draws the drag: a chip with the source's label under the pointer.
drop-targetdrop-targetDrags of the kinds it accepts can be dropped here; Pitwall marks it while one is over it and sends dropped with its handler.

types.button-kind

enum

A button's look, as Pitwall's own buttons.

enum button-kind {
  primary,
  ghost,
  danger,
  link,
}
CaseDescription
primaryThe main action of a tile or a form; one per area.
ghostAn ordinary action: a hairline button (at small size: Pitwall's small row and toolbar button).
dangerA destructive action.
linkA button that looks like a link.

types.button-size

enum

A button's size, apart from its look: any kind comes in both.

enum button-size {
  regular,
  small,
}
CaseDescription
regularThe usual height (30 px).
smallSmaller (26 px), for rows, toolbars and a tile's bars.

types.button

record

A button. Its click arrives as a click event for the node's click listener.

record button {
  label: string,
  kind: button-kind,
  size: button-size,
  icon: option<icon>,
  disabled: bool,
}
FieldTypeDescription
labelstringThe text on it.
kindbutton-kindIts look.
sizebutton-sizeIts size.
iconoption<icon>An icon before the label.
disabledboolDrawn dimmed, and clicks aren't sent.

types.icon

variant

An icon. Drawn in the node's text colour (color style), at the node's text size unless it has a width and height.

variant icon {
  named(string),
}
CasePayloadDescription
namedstringOne of Pitwall's icons by name: sidebar, search, gear, plus, x, send, stop, restart, refresh, trash, branch, folder, chevron, grid, wall, maximize, restore, window, more, review, terminal, file, expand, copy, chevron-down, check, headset, user, laptop, server, eye, external, image, browser, back, phone, inspect, page-right, page-left, page-below, pin, grip, minus, chevron-up, lock, alert, extension, inbox, bell, chat, list (the SDK's Icon enum). An unknown name draws nothing; the test harness notes it.

types.axis

enum

The directions a scroll element scrolls in.

enum axis {
  vertical,
  horizontal,
  both,
}
CaseDescription
verticalUp and down.
horizontalLeft and right.
bothBoth.

types.scroll

record

A scrolling container: its children scroll inside it. Pitwall keeps its position by key path across frames and draws its scrollbars.

record scroll {
  axis: axis,
}
FieldTypeDescription
axisaxisWhich ways it scrolls.

types.text-range

record

A range of a text field's value, in UTF-8 byte offsets (start ≤ end; equal for a bare cursor).

record text-range {
  start: u32,
  end: u32,
}
FieldTypeDescription
startu32Where it starts.
endu32Where it ends (exclusive).

types.input

record

A text field: one line, or several (multiline). Its font is the node's font style (mono for code), its text size the node's text-size.

Pitwall owns the value. Typing, selection, undo and IME are handled by Pitwall, so they never wait for the tile, and the text is kept by key path across frames. The tile hears about edits afterwards (input-changed, input-selected) and doesn't send the text back in each frame: value is none in a frame unless the tile wants to replace the text. So a large text (up to 1 MiB) crosses the boundary only when it changes, not in every frame.

Enter submits a one-line field. In a multi-line field Enter adds a line and ⌘Enter (Ctrl+Enter off macOS) submits, as in Pitwall's own text fields; while such a field has focus, ⌘Enter is the field's and doesn't maximise the tile (ui.md §3.5).

record input {
  value: option<string>,
  revision: u64,
  selection: option<text-range>,
  placeholder: option<string>,
  multiline: bool,
  rows: option<u16>,
  disabled: bool,
}
FieldTypeDescription
valueoption<string>Text to put in the field, replacing what it holds; none keeps what it holds (the usual case). Applied only when revision is newer than the revision of the user's latest edit, so a frame built before an edit arrived never undoes it. The first frame that has the field gives its starting text here.
revisionu64The revision of value: the revision of the last input-changed the tile has seen (0 at first), plus one. Ignored when value is none.
selectionoption<text-range>Where to put the cursor or selection when value is applied (none: at the end).
placeholderoption<string>Shown in faint text while it is empty.
multilineboolSeveral lines.
rowsoption<u16>For a multi-line field, its height in lines when its node has no height style (none: 3). It scrolls past that.
disabledboolDrawn dimmed and can't be edited.

types.virtual-list

record

A list too long to send whole: the frame names how many rows there are and how tall each is, and Pitwall asks the tile for the rows it is about to show with guest.rows, a page at a time, as the user scrolls (runtime.md §2.7). Drawn with Pitwall's own list: only the rows in sight are laid out, so 100 000 rows scroll as smoothly as

  1. A click selects a row, a double click or Enter activates it,

and Up, Down, Home, End, Page Up and Page Down move the selection while the list has focus (each sends select).

record virtual-list {
  count: u32,
  row-height: f32,
  revision: u64,
  selected: list<string>,
}
FieldTypeDescription
countu32How many rows (at most 1 000 000).
row-heightf32Each row's height, in logical pixels (12–200); every row has it.
revisionu64Moves when rows Pitwall already has may be out of date: it asks for the rows in sight again, and keeps showing the old ones until they arrive, so nothing flickers.
selectedlist<string>The selected rows' keys (row.key), drawn selected.

types.row

record

A row of a virtual list, table or tree, as guest.rows returns it.

record row {
  key: string,
  nodes: list<node>,
  depth: u16,
  expanded: option<bool>,
}
FieldTypeDescription
keystringThe row's item, stable while the item is the same (an id, not its index): selection and events name it. At most 128 bytes.
nodeslist<node>What the row shows: a small tree as in a frame (node 0 is the row's root, filling the row). Boxes, text, icons, buttons, images, context menus, badges, avatars and relative times only (no fields, scrolls or nested lists); at most 64 nodes. In a table, the root's children are the cells, one per column in order.
depthu16A tree's row: how deep it is (0 at the top); 0 elsewhere.
expandedoption<bool>A tree's row: none for a leaf, some(true) for an open branch, some(false) for a closed one. none elsewhere.

types.sort-direction

enum

Which way a table column is sorted.

enum sort-direction {
  ascending,
  descending,
}

types.column

record

A table's column.

record column {
  key: string,
  title: string,
  width: option<f32>,
  align: align,
  sortable: bool,
}
FieldTypeDescription
keystringIts key, unique in the table; events name it.
titlestringIts title in the header.
widthoption<f32>Its width in logical pixels (none: it shares the room left with the other columns without one). The user can drag a column's edge; Pitwall then keeps their width until this value changes, and sends column-resized.
alignalignIts cells' alignment across: start, center or end.
sortableboolIts header can be clicked to sort (sends sort).

types.sort-state

record

A table's sort: by which column, which way.

record sort-state {
  column: string,
  direction: sort-direction,
}

types.table

record

A table: a header of columns over a virtual list of rows, whose roots' children are the cells. Columns can be resized and sorted; rows are selected as in a virtual list.

record table {
  columns: list<column>,
  sort: option<sort-state>,
  rows: virtual-list,
}
FieldTypeDescription
columnslist<column>
sortoption<sort-state>The column sorted by and how, drawn with an arrow in its header.
rowsvirtual-listThe rows: count, height, revision, selection.

types.tree

record

A tree: a virtual list of the open nodes, flattened in order, each row with its depth and whether it is a branch (row.depth, row.expanded). Pitwall draws the indent and the disclosure chevron; a click on the chevron, Left or Right, or a double click on a branch sends toggle; the tile opens or closes it and renders again with the new count.

record tree {
  rows: virtual-list,
}

types.tab

record

One tab of a tab strip.

record tab {
  key: string,
  label: string,
  icon: option<icon>,
}
FieldTypeDescription
keystringIts key, sent in select.
labelstring
iconoption<icon>

types.tabs

record

A row of tabs, drawn as Pitwall's own; the tile shows the selected one's content below it. Choosing a tab sends select.

record tabs {
  items: list<tab>,
  selected: option<string>,
}
FieldTypeDescription
itemslist<tab>
selectedoption<string>The selected tab's key.

types.select-option

record

One choice of a select.

record select-option {
  key: string,
  label: string,
}
FieldTypeDescription
keystringIts key, sent in select.
labelstring

types.select

record

A dropdown, drawn as Pitwall's own: a button showing the choice, opening a list of the options. Choosing one sends select.

record select {
  options: list<select-option>,
  selected: option<string>,
  placeholder: option<string>,
  disabled: bool,
}
FieldTypeDescription
optionslist<select-option>
selectedoption<string>The chosen option's key.
placeholderoption<string>Shown while nothing is chosen.
disabledbool

types.menu-item

record

A choice in a menu.

record menu-item {
  key: string,
  label: string,
  icon: option<icon>,
  hint: option<string>,
  disabled: bool,
  danger: bool,
}
FieldTypeDescription
keystringIts key, sent in select.
labelstring
iconoption<icon>
hintoption<string>A shortcut shown at its right, as text ("⌘D"). Only shown: bind the key in the frame's keymap.
disabledboolDrawn dimmed and can't be chosen.
dangerboolA destructive choice, drawn in red.

types.menu-entry

variant

A line of a menu.

variant menu-entry {
  item(menu-item),
  separator,
}
CasePayloadDescription
itemmenu-item
separatorA thin line between groups of items.

types.menu-button

record

A button that opens a menu under it, drawn by Pitwall with its own menus' look. Choosing an item sends select. An empty label with an icon makes a small square icon button (give the node a label).

record menu-button {
  label: string,
  icon: option<icon>,
  entries: list<menu-entry>,
  disabled: bool,
}

types.markdown

record

Markdown, drawn as Pitwall's own Preview draws it (headings, lists, task lists, tables, code with highlighting, quotes), and inert: no HTML runs, no image or link is fetched. A link click is link (with no link listener, web and mail links open in the browser and others do nothing); a task's checkbox click is toggle with its line (with no toggle listener, checkboxes can't be clicked). At most 1 MiB.

record markdown {
  text: string,
}

types.image-fit

enum

How an image fills its box.

enum image-fit {
  contain,
  cover,
  fill,
}
CaseDescription
containWhole, as large as fits.
coverFilling the box, cut at the edges.
fillStretched to the box.

types.image-source

variant

Where an image's bytes come from.

variant image-source {
  asset(string),
  data(string),
}
CasePayloadDescription
assetstringA file in the extension's folder, by its path there ("assets/logo.png"): PNG, JPEG, GIF, WebP or SVG, at most 16 MiB.
datastringBytes the tile handed over with ui.put-image under this name.

types.image

record

An image, sized by the node's styles (without a width, as wide as its box). Images never come from the network. The node's label is read as its description.

record image {
  source: image-source,
  fit: image-fit,
}

types.setting-field

record

A setting edited and saved by Pitwall. The component names only its schema key, never its displayed value or the user's typed text.

record setting-field {
  key: string,
  placeholder: option<string>,
}

types.secret-field

record

What a node is. A host-owned field: its value never crosses into the component.

record secret-field {
  key: string,
  placeholder: option<string>,
}

types.element

variant

variant element {
  box,
  text(string),
  button(button),
  icon(icon),
  scroll(scroll),
  input(input),
  canvas(canvas),
  code-view(code-view),
  diff-view(diff-view),
  virtual-list(virtual-list),
  table(table),
  tree(tree),
  tabs(tabs),
  select(select),
  menu-button(menu-button),
  context-menu(list<menu-entry>),
  markdown(markdown),
  image(image),
  checkbox(check),
  switch(check),
  radio-group(choice-group),
  segmented(choice-group),
  slider(slider),
  number-field(number-field),
  search-field(search-field),
  form-row(form-row),
  progress(progress),
  spinner,
  skeleton(skeleton),
  empty-state(empty-state),
  banner(banner),
  badge(badge),
  chip(chip),
  kbd(string),
  split(split),
  disclosure(disclosure),
  card(card),
  divider(orientation),
  breadcrumbs(list<crumb>),
  toolbar,
  popover(popover),
  confirm-sheet(confirm-sheet),
  key-values(list<key-value>),
  avatar(avatar),
  relative-time(relative-time),
  copyable(copyable),
  link(link),
  sparkline(sparkline),
  bar-chart(bar-chart),
  line-chart(line-chart),
  status-timeline(status-timeline),
  secret-field(secret-field),
  setting-field(setting-field),
}
CasePayloadDescription
boxA box: a flex container with no look of its own beyond its styles. The usual root.
textstringText. A text node whose children are text nodes draws them as inline runs of one paragraph (each run with its own styles), so "Built in " + bold "3 s" wrap as one line of text.
buttonbuttonA button.
iconiconAn icon.
scrollscrollA scrolling container.
inputinputA text field.
canvascanvasA drawing: shapes, lines and text the tile places itself, with clickable regions over them. Give it a size (width and height, or grow).
code-viewcode-viewPitwall's read-only code view, with the text the tile gives: highlighting, line numbers, selection and copy, Find.
diff-viewdiff-viewPitwall's diff view of two versions of a text, as Review draws it.
virtual-listvirtual-listA long list, its rows fetched as they come into sight.
tabletableA table: columns over a virtual list of rows.
treetreeA tree: a virtual list of the open nodes.
tabstabsA row of tabs.
selectselectA dropdown.
menu-buttonmenu-buttonA button that opens a menu.
context-menulist<menu-entry>The menu a right-click opens on this node's parent, drawn by Pitwall. Not drawn in place; a parent has at most one. Choosing an item sends select with this node's select handler.
markdownmarkdownMarkdown, drawn and inert.
imageimageAn image.
checkboxcheckA checkbox with its label.
switchcheckA switch (an on/off toggle) with its label.
radio-groupchoice-groupA group of radio buttons: one of several choices.
segmentedchoice-groupA segmented control: one of a few choices, side by side.
slidersliderA slider: a number in a range, dragged or moved with the keys.
number-fieldnumber-fieldA number field with − and + steps.
search-fieldsearch-fieldA search field: a text field with a magnifier and a clear button.
form-rowform-rowA form row: a label over (or beside) the control under it, with help text, a validation message and a required mark.
progressprogressA progress bar, with a known share done or still going.
spinnerA spinning ring: something is loading.
skeletonskeletonA grey placeholder where content is loading.
empty-stateempty-stateAn empty state: an icon, a title, a line of text and an action.
bannerbannerAn inline banner: information, success, a warning or an error.
badgebadgeA small count or status label.
chipchipA chip (a tag): a label that can be picked or removed.
kbdstringA key or shortcut, drawn as Pitwall draws its own (cmd-k: ⌘K).
splitsplitTwo panes with a bar between them the user drags.
disclosuredisclosureA section with a header that opens and closes it.
cardcardA card: a bordered box, with a title.
dividerorientationA thin line between things.
breadcrumbslist<crumb>Breadcrumbs: where the user is, each level clickable.
toolbarA toolbar row: Pitwall's bar look for the buttons and fields in it.
popoverpopoverA popover anchored to its parent node, drawn by Pitwall.
confirm-sheetconfirm-sheetA sheet over the tile asking the user to confirm.
key-valueslist<key-value>A list of labels and their values.
avataravatarAn avatar: a person's initials in a circle.
relative-timerelative-timeA time drawn as "5 min ago", kept up to date by Pitwall.
copyablecopyableText with a button that copies it.
linklinkA link: opens a web page, or tells the tile.
sparklinesparklineA small line chart without axes, inline with text.
bar-chartbar-chartA bar chart.
line-chartline-chartA line chart with axes.
status-timelinestatus-timelineA row of coloured segments, one per run (CI runs, deploys).
secret-fieldsecret-fieldA secret kept by the host, never delivered as input text.
setting-fieldsetting-fieldHost-owned setting editor (including keys which grant access).

types.listen

enum

The events a node can ask for, each with the handler it should carry.

enum listen {
  click,
  change,
  select,
  submit,
  scroll,
  hover,
  pointer,
  wheel,
  line-click,
  toggle,
  link,
  sort,
  column-resized,
  value,
  dismiss,
}
CaseDescription
clickA click (or Space or Enter while the node has focus). Buttons and any other node.
changeA text field's value changed.
selectA text field's cursor or selection moved without its value changing.
submitEnter (⌘Enter when multi-line) in a text field.
scrollA scroll container was scrolled (for loading more at the end).
hoverThe pointer entered or left the node.
pointerPointer presses, releases and moves over the node, with their position (for drawing and dragging inside a node).
wheelThe wheel or trackpad scrolled, or a pinch, over the node: sent as pointer events with the wheel and pinch kinds, carrying the wheel listener's handler. A node listening for it takes the wheel, so a scroll container around it doesn't scroll.
line-clickA click on a line number of a code or diff view.
toggleA tree's branch opened or closed; a Markdown task's checkbox clicked.
linkA link in Markdown clicked.
sortA table's header clicked to sort.
column-resizedA table's column resized by the user.
valueA control's value changed: a checkbox, switch, radio group, segmented control, slider, number field, disclosure, split, breadcrumb or status timeline (value-changed).
dismissThe user closed or removed it: a banner, a chip, a popover, a confirm sheet's Cancel (dismissed).

types.listener

record

An event a node asks for, and the handler it should carry.

record listener {
  on: listen,
  handler: handler,
}
FieldTypeDescription
onlistenWhich event.
handlerhandlerThe handler it carries.

types.node

record

One node of a frame.

record node {
  parent: option<u32>,
  key: string,
  element: element,
  style: list<style>,
  on: list<listener>,
  focusable: bool,
  tooltip: option<string>,
  label: option<string>,
}
FieldTypeDescription
parentoption<u32>The parent's index in frame.nodes: always lower than this node's own. none only for the first node, the root.
keystringStable among its siblings: Pitwall matches nodes across frames by key path (the keys from the root down), so a node keeps its scroll position, focus and typed text while its key path stays the same. Unique among siblings; at most 128 bytes.
elementelementWhat it is.
stylelist<style>How it looks and lays out.
onlist<listener>The events it wants.
focusableboolIt can take keyboard focus (Tab moves among focusable nodes in tree order). Buttons and text fields are focusable whatever this says.
tooltipoption<string>Text shown when the pointer rests on it.
labeloption<string>Its accessible name, read by screen readers. Required for a button with only an icon.

types.binding

record

A key binding the tile handles while it has focus.

Pitwall's own keys are reserved: a frame that binds one has that binding dropped, with a line in the tile's Log. They are escape, tab, shift-tab, ctrl-enter; cmd- with any of enter, 0–9, =, +, -, ,, a, b, c, e, h, i, j, k, l, m, n, p, q, r, t, v, w, x, z, alone or with shift (Pitwall's shortcuts are Ctrl+Shift off macOS); and cmd-shift-f, cmd-alt-h, cmd-ctrl-f, cmd-shift-alt- e, n, r, t. Modifiers may come in any order.

While a text field of the tile has focus, a binding without cmd, ctrl or alt doesn't fire: the key types into the field.

record binding {
  keys: string,
  handler: handler,
}
FieldTypeDescription
keysstringThe keys, as Pitwall writes them: j, enter, cmd-s, shift-tab, /. cmd is ⌘ on macOS and Ctrl elsewhere.
handlerhandlerThe handler a key event carries when they are pressed.

types.frame

record

What a view shows: its whole tree, sent after every change. At most 20 000 nodes and about 2 MiB of data; a larger frame stops the tile.

record frame {
  nodes: list<node>,
  focus: option<string>,
  keymap: list<binding>,
}
FieldTypeDescription
nodeslist<node>The nodes, root first, each after its parent.
focusoption<string>The key path (keys from the root down, joined by /, without the root's) of the node the tile wants focused. Honoured only while the tile already has focus, so a tile can't take the keyboard from a terminal.
keymaplist<binding>The keys the tile handles while it has focus.

types.modifiers

flags

Keys held during a click.

flags modifiers {
  shift,
  ctrl,
  alt,
  platform,
}
FlagDescription
shiftShift.
ctrlControl.
altOption on macOS, Alt elsewhere.
platform⌘ on macOS, the Windows key or Super elsewhere.

types.mouse-button

enum

Which mouse button.

enum mouse-button {
  left,
  right,
  middle,
}
CaseDescription
leftThe main button.
rightThe secondary button.
middleThe middle button or wheel.

types.point

record

A point in a node, in logical pixels from the node's top-left corner.

record point {
  x: f32,
  y: f32,
}
FieldTypeDescription
xf32From the left edge.
yf32From the top edge.

types.click

record

A click.

record click {
  handler: handler,
  button: mouse-button,
  modifiers: modifiers,
  count: u32,
  at: point,
}
FieldTypeDescription
handlerhandlerThe handler of the node's click listener.
buttonmouse-buttonWhich button.
modifiersmodifiersKeys held.
countu321 for a single click, 2 for a double click, and so on.
atpointWhere in the node (for a click from the keyboard: its centre).

types.pointer-kind

variant

What the pointer did. Later versions add cases at the end (a wheel, a pinch) without breaking tiles built for this one; a tile ignores cases it doesn't know.

variant pointer-kind {
  down(mouse-button),
  up(mouse-button),
  move,
  wheel(delta),
  pinch(f32),
}
CasePayloadDescription
downmouse-buttonA button went down.
upmouse-buttonA button came up.
moveThe pointer moved (coalesced: the newest position).
wheeldeltaThe wheel or a trackpad scrolled by this many pixels (positive y: the content moves up, as scrolling down; positive x: scrolling right). For a node with a wheel listener.
pinchf32A trackpad pinch: zoom by this fraction (0.1: 10 % larger; -0.1: smaller), around at. For a node with a wheel listener.

types.pointer-event

record

A pointer event over a node with a pointer listener. While a button is held after a down on the node, its moves and the up go to the same node even outside it (positions may then be negative or past its size).

record pointer-event {
  handler: handler,
  kind: pointer-kind,
  at: point,
  modifiers: modifiers,
}
FieldTypeDescription
handlerhandlerThe handler of the node's pointer listener.
kindpointer-kindWhat happened.
atpointWhere, from the node's top-left corner.
modifiersmodifiersKeys held.

types.input-change

record

A text field's new value.

record input-change {
  handler: handler,
  value: string,
  revision: u64,
  selection: text-range,
}
FieldTypeDescription
handlerhandlerThe handler of the field's change listener.
valuestringWhat the field holds now.
revisionu64The edit's revision. To replace the text later, send input.revision above it (runtime.md §2.4).
selectiontext-rangeThe cursor or selection after the edit.

types.input-selection

record

A text field's cursor or selection moved, its value unchanged.

record input-selection {
  handler: handler,
  selection: text-range,
  revision: u64,
}
FieldTypeDescription
handlerhandlerThe handler of the field's select listener.
selectiontext-rangeThe cursor or selection now, in the value of the field's latest input-changed (or the value the tile last set).
revisionu64The revision of the value it applies to.

types.key-event

record

A key binding fired.

record key-event {
  handler: handler,
  keys: string,
}
FieldTypeDescription
handlerhandlerThe binding's handler.
keysstringThe binding's keys, as written in the keymap.

types.scroll-position

record

Where a scroll container is scrolled to.

record scroll-position {
  handler: handler,
  x: f32,
  y: f32,
  content-width: f32,
  content-height: f32,
}
FieldTypeDescription
handlerhandlerThe handler of its scroll listener.
xf32Pixels scrolled from the left.
yf32Pixels scrolled from the top.
content-widthf32The content's width, in pixels.
content-heightf32The content's height, in pixels.

types.hover

record

The pointer entered or left a node.

record hover {
  handler: handler,
  inside: bool,
  at: point,
}
FieldTypeDescription
handlerhandlerThe handler of the node's hover listener.
insideboolTrue when it entered, false when it left.
atpointWhere, from the node's top-left corner.

types.size

record

A size in logical pixels.

record size {
  width: f32,
  height: f32,
}
FieldTypeDescription
widthf32Width.
heightf32Height.

types.view-size

record

A view's new size.

record view-size {
  view: view-id,
  size: size,
}
FieldTypeDescription
viewview-idThe view.
sizesizeIts size now.

types.node-focus

record

Which node of a view has keyboard focus now.

record node-focus {
  view: view-id,
  key-path: option<string>,
}
FieldTypeDescription
viewview-idThe view.
key-pathoption<string>The focused node's key path (keys from the root down, joined by /, without the root's, as frame.focus), or none when no node of the view has focus (the tile itself may still have it).

types.theme-mode

enum

Light or dark.

enum theme-mode {
  light,
  dark,
}
CaseDescription
lightThe light theme.
darkThe dark theme.

types.density

enum

How much space Pitwall puts around things (Settings → Appearance).

enum density {
  comfortable,
  compact,
  dense,
}
CaseDescription
comfortableThe most space.
compactThe default.
denseThe least space.

types.theme-info

record

The user's appearance settings that matter to a tile.

record theme-info {
  mode: theme-mode,
  density: density,
  reduce-motion: bool,
}
FieldTypeDescription
modetheme-modeLight or dark.
densitydensityHow much space to leave.
reduce-motionboolThe user asked for less motion: don't animate.

types.tone

enum

A toast's tone.

enum tone {
  info,
  good,
  warn,
  bad,
}
CaseDescription
infoNeutral news.
goodSomething worked.
warnSomething needs attention.
badSomething failed.

types.selection

record

A row, tab, option or menu item chosen (select): in a virtual list, table or tree, a row clicked or moved to with the keys; in tabs, a select or a menu, the item chosen.

record selection {
  handler: handler,
  key: string,
  index: u32,
  modifiers: modifiers,
  activate: bool,
}
FieldTypeDescription
handlerhandler
keystringThe item's key: the row's, tab's, option's or menu item's.
indexu32The row's index (lists, tables, trees), or the item's place among its siblings (tabs, options, menu items; separators not counted).
modifiersmodifiersKeys held (⌘/Ctrl or Shift, to add to a selection).
activateboolThe row was activated: a double click, or Enter.

types.toggled

record

A tree's branch opened or closed, or a Markdown task ticked (toggle).

record toggled {
  handler: handler,
  key: string,
  index: u32,
  on: bool,
}
FieldTypeDescription
handlerhandler
keystringA tree: the row's key. Markdown: empty.
indexu32A tree: the row's index. Markdown: the task's line in the text (0-based).
onboolOpen (or ticked) now.

record

A link in Markdown clicked (link).

record link-click {
  handler: handler,
  url: string,
  modifiers: modifiers,
}
FieldTypeDescription
handlerhandler
urlstringThe link's target as written.
modifiersmodifiers

types.sort-change

record

A table's header clicked to sort (sort): the column, and the direction asked for (the other way when it was sorted by it).

record sort-change {
  handler: handler,
  column: string,
  direction: sort-direction,
}

types.column-width

record

A table's column resized by the user (column-resized), when the drag ends.

record column-width {
  handler: handler,
  column: string,
  width: f32,
}

types.secret-change

record

Something that happened, sent to guest.handle. A secret was saved or removed, without its value.

record secret-change {
  key: string,
  set: bool,
}

types.program-env-value

variant

References passed to a native program. Secret text never enters Wasm.

variant program-env-value {
  text(string),
  secret(string),
}

types.program-env-var

record

record program-env-var {
  name: string,
  value: program-env-value,
}

types.program-command

record

record program-command {
  program: string,
  args: list<string>,
  env: list<program-env-var>,
  cwd: option<string>,
  private-output: bool,
}
FieldTypeDescription
programstring
argslist<string>
envlist<program-env-var>
cwdoption<string>
private-outputboolReturn output once, without retaining it in Log or Debug.

types.program-state

enum

enum program-state {
  asking,
  starting,
  running,
  exited,
  failed,
  stopped,
  denied,
}

types.program-status

record

record program-status {
  state: program-state,
  pid: option<u32>,
  exit: option<s32>,
  why: option<string>,
}

types.program-changed

record

record program-changed {
  name: string,
  status: program-status,
}

types.program-finished

record

record program-finished {
  task: u32,
  exit: option<s32>,
  stdout: string,
  stderr: string,
  private-output: bool,
}

types.program-downloaded

record

record program-downloaded {
  task: u32,
  outcome: result<string, string>,
}

types.event

variant

variant event {
  click(click),
  input-changed(input-change),
  input-selected(input-selection),
  submit(handler),
  key(key-event),
  scroll(scroll-position),
  hover(hover),
  pointer(pointer-event),
  resize(view-size),
  visibility(bool),
  focus(bool),
  focus-changed(node-focus),
  theme(theme-info),
  timer(timer-id),
  settings-changed(option<string>),
  grants-changed(list<string>),
  view-opened(view-opened),
  view-content(view-content),
  view-closed(view-id),
  dropped(drop-event),
  line-clicked(line-click),
  code-selected(code-selection),
  agents-changed,
  ask-answered(ask-answer),
  select(selection),
  toggle(toggled),
  link(link-click),
  sort(sort-change),
  column-resized(column-width),
  fetched(fetched),
  toolbar-clicked(option<string>),
  service-changed(service-info),
  value-changed(value-change),
  dismissed(handler),
  undo-present(u64),
  tool-cancelled(u64),
  files-changed(files-changed),
  project-changed(view-id),
  secret-changed(secret-change),
  program-changed(program-changed),
  program-finished(program-finished),
  download-finished(program-downloaded),
}
CasePayloadDescription
clickclickA node with a click listener was clicked.
input-changedinput-changeA text field's value changed. Changes are coalesced: several between two calls arrive as one with the newest value, and Pitwall sends at most one per field every 50 ms while the user types, plus one when the field loses focus or submits, so a large text isn't sent on every keystroke.
input-selectedinput-selectionA text field with a select listener moved its cursor or selection without changing its value (coalesced: the newest).
submithandlerEnter in a text field with a submit listener; carries its handler.
keykey-eventA key binding of the frame's keymap fired.
scrollscroll-positionA scroll container with a scroll listener moved (coalesced: the newest position).
hoverhoverThe pointer entered or left a node with a hover listener.
pointerpointer-eventA press, release or move over a node with a pointer listener.
resizeview-sizeA view's size changed (coalesced: the newest size).
visibilityboolThe tile was shown (true) or hidden (false). While hidden, timers pause and nothing is rendered. visibility(false) is handled like any event: host calls made while handling it complete (storage writes reach the disk), and suspension starts when handle returns; a timer started then waits until the tile is shown.
focusboolThe tile got (true) or lost (false) keyboard focus.
focus-changednode-focusThe focus moved from one node of a view to another (a text field, a focusable node), or off the view's nodes: sent after the move, once per change. Leaving a text field this way is its blur (save what was typed). When the tile loses focus, this comes first with none, then focus(false).
themetheme-infoThe user changed their appearance settings.
timertimer-idA timer fired.
settings-changedoption<string>A setting changed: its key, or none for a bulk refresh. Read its value again with settings.get.
grants-changedlist<string>The user granted or took back permissions; the list is what is granted now.
view-openedview-openedA view was opened; its first render follows. Every view gets this, the ones open at start too (right after init).
view-contentview-contentAn open view was given new content (a later call with the same content id); return true to render it again.
view-closedview-idA view was closed; it is no longer rendered.
droppeddrop-eventA drag was dropped on a node with a drop-target.
line-clickedline-clickA line number of a code or diff view with a line-click listener was clicked.
code-selectedcode-selectionThe selection in a code or diff view with a select listener changed (coalesced: the newest, at most one every 100 ms).
agents-changedPitwall's agents changed (one came or went; a name, a state or a Next up changed): read them again with agents.list. Only with agents.read; changes close together arrive as one.
ask-answeredask-answerThe user answered one of the tile's questions (asks.set), in the floating control. Reply with asks.reply.
selectselectionA row, tab, option or menu item was chosen.
toggletoggledA tree's branch opened or closed; a Markdown task ticked.
linklink-clickA link in Markdown was clicked.
sortsort-changeA table's header was clicked to sort.
column-resizedcolumn-widthA table's column was resized.
fetchedfetchedThe answer to a net.fetch request (or why there is none).
toolbar-clickedoption<string>The extension's toolbar button was clicked (its action is tile or popover): the id of the project whose space the window shows, if any (for a per-project item).
service-changedservice-infoThe extension's own server changed state (service.info).
value-changedvalue-changeA control with a value listener was changed by the user.
dismissedhandlerA node with a dismiss listener was closed or removed by the user; carries its handler.
undo-presentu64The user pressed Undo on what agent call u64 (a present call's content.call) put in the tile: restore what was there before it, or remove the item if the call created it.
tool-cancelledu64A read or act call the tile didn't answer in time was given up (the agent was told): stop working on it; a reply to it is dropped.
files-changedfiles-changedFiles changed under a folder the tile watches (files.watch).
project-changedview-idThe view with this id is now in another project, or in none (it was moved to another space): read files.project again. Its watches on the old project ended.
secret-changedsecret-changeA secret was saved or removed by the user.
program-changedprogram-changedA supervised program changed state.
program-finishedprogram-finishedA one-shot run ended, with redacted bounded output.
download-finishedprogram-downloadedA pinned download finished or was refused.

types.init-context

record

What the tile gets when it starts.

record init-context {
  extension: string,
  version: string,
  theme: theme-info,
  granted: list<string>,
  state: option<list<u8>>,
}
FieldTypeDescription
extensionstringThe extension's id.
versionstringThe extension's version, from its manifest.
themetheme-infoThe user's appearance settings.
grantedlist<string>The permissions the user granted, by name.
stateoption<list<u8>>What guest.save-state returned before the tile was last dropped (to save memory while hidden, or for a reload during development); none on a fresh start.

types.delta

record

An amount moved, in logical pixels.

record delta {
  x: f32,
  y: f32,
}
FieldTypeDescription
xf32Rightwards.
yf32Downwards.

types.drag-source

record

What a node can be dragged as, inside its view.

record drag-source {
  kind: string,
  data: string,
  label: string,
}
FieldTypeDescription
kindstringA kind of the tile's own ("card", "column"): drop targets name the kinds they accept.
datastringWhat the drop target gets back (an item's id, JSON). At most 64 KiB.
labelstringShown in the chip under the pointer while dragging.

types.drop-target

record

A place drags can be dropped on.

record drop-target {
  accepts: list<string>,
  handler: handler,
}
FieldTypeDescription
acceptslist<string>The kinds of drag it takes (drag-source.kind).
handlerhandlerThe handler dropped carries.

types.drop-event

record

A drag dropped on a drop target.

record drop-event {
  handler: handler,
  kind: string,
  data: string,
  at: point,
}
FieldTypeDescription
handlerhandlerThe target's handler.
kindstringThe dragged node's kind.
datastringThe dragged node's data.
atpointWhere it was dropped, from the target's top-left corner.

types.paint

variant

A colour in a canvas: one of the theme's tokens (best: the drawing follows light and dark and the user's theme), or a fixed colour.

variant paint {
  token(token),
  rgba(u32),
}
CasePayloadDescription
tokentokenA theme colour.
rgbau32A fixed colour, 0xRRGGBBAA. The same in both themes.

types.rect

record

A rectangle, in logical pixels.

record rect {
  x: f32,
  y: f32,
  width: f32,
  height: f32,
}
FieldTypeDescription
xf32Its left edge.
yf32Its top edge.
widthf32Its width.
heightf32Its height.

types.stroke

record

How a line is drawn.

record stroke {
  color: paint,
  width: f32,
  dash: list<f32>,
}
FieldTypeDescription
colorpaintIts colour.
widthf32Its width, in logical pixels (scaled with the canvas's transform).
dashlist<f32>A dash pattern: lengths drawn and left out, in turn ([4, 3]); empty for a solid line. At most 16 lengths.

types.draw-rect

record

A rectangle drawn in a canvas.

record draw-rect {
  rect: rect,
  fill: option<paint>,
  stroke: option<stroke>,
  radius: f32,
}
FieldTypeDescription
rectrectWhere.
filloption<paint>Its fill, if any.
strokeoption<stroke>Its outline, if any.
radiusf32Its corner radius, in logical pixels.

types.quad-to

record

A quadratic curve's step.

record quad-to {
  control: point,
  to: point,
}
FieldTypeDescription
controlpointThe control point.
topointWhere it ends.

types.cubic-to

record

A cubic curve's step.

record cubic-to {
  control1: point,
  control2: point,
  to: point,
}
FieldTypeDescription
control1pointThe first control point.
control2pointThe second control point.
topointWhere it ends.

types.path-step

variant

One step of a path.

variant path-step {
  move-to(point),
  line-to(point),
  quad-to(quad-to),
  cubic-to(cubic-to),
  close,
}
CasePayloadDescription
move-topointStart a new piece here.
line-topointA straight line to here.
quad-toquad-toA quadratic curve.
cubic-tocubic-toA cubic curve.
closeA line back to the piece's start.

types.draw-path

record

A path drawn in a canvas: lines and curves, filled or stroked.

record draw-path {
  steps: list<path-step>,
  fill: option<paint>,
  stroke: option<stroke>,
}
FieldTypeDescription
stepslist<path-step>Its steps, starting with move-to.
filloption<paint>Its fill, if any.
strokeoption<stroke>Its line, if any.

types.text-align

enum

Where text lies across its point.

enum text-align {
  start,
  center,
  end,
}
CaseDescription
startIt starts at the point.
centerIt is centred on the point.
endIt ends at the point.

types.text-baseline

enum

Where text lies up and down from its point.

enum text-baseline {
  top,
  middle,
  bottom,
}
CaseDescription
topIts line's top is at the point.
middleIts line's middle is at the point.
bottomIts line's bottom is at the point.

types.draw-text

record

One line of text drawn in a canvas, shaped by Pitwall in its fonts.

record draw-text {
  text: string,
  at: point,
  size: f32,
  color: paint,
  font: font,
  weight: weight,
  align: text-align,
  baseline: text-baseline,
  max-width: option<f32>,
}
FieldTypeDescription
textstringThe text (one line: line breaks are drawn as spaces).
atpointWhere, as align and baseline say.
sizef32Its size in logical pixels (scaled with the canvas's transform). Pitwall's body text is 13; its other sizes 11, 12, 16 and 20.
colorpaintIts colour.
fontfontIts font.
weightweightIts weight.
aligntext-alignAcross the point.
baselinetext-baselineUp and down from the point.
max-widthoption<f32>The widest it may be, in the canvas's coordinates: longer text is cut with an ellipsis.

types.draw-op

variant

One thing a canvas draws, in order (later on top).

variant draw-op {
  rect(draw-rect),
  path(draw-path),
  text(draw-text),
  clip-push(rect),
  clip-pop,
}
CasePayloadDescription
rectdraw-rectA rectangle.
pathdraw-pathA path.
textdraw-textText.
clip-pushrectDraw only inside this rectangle until the matching clip-pop.
clip-popEnd the newest clip-push.

types.transform

record

How a canvas's coordinates map to its node: a point (x, y) is drawn at (x × scale + dx, y × scale + dy) from the node's top-left corner. Ops and regions are given in the canvas's coordinates; events come in the node's.

record transform {
  scale: f32,
  dx: f32,
  dy: f32,
}
FieldTypeDescription
scalef32The zoom (1.0: as given).
dxf32Moved right by this.
dyf32Moved down by this.

types.hit-region

record

A clickable area of a canvas, over what it draws: a box of a diagram. Screen readers read its label (accessible structure inside a canvas).

record hit-region {
  key: string,
  rect: rect,
  label: string,
  tooltip: option<string>,
  click: option<handler>,
  hover: option<handler>,
}
FieldTypeDescription
keystringStable among the canvas's regions, at most 128 bytes.
rectrectWhere, in the canvas's coordinates.
labelstringIts accessible name, and its tooltip unless it has one.
tooltipoption<string>Text shown when the pointer rests on it.
clickoption<handler>Sent as a click event (its at from the canvas node's corner).
hoveroption<handler>Sent as a hover event when the pointer enters or leaves it.

types.canvas

record

A drawing. At most 20 000 ops and 5 000 regions.

record canvas {
  ops: list<draw-op>,
  transform: transform,
  regions: list<hit-region>,
}
FieldTypeDescription
opslist<draw-op>What it draws, in order.
transformtransformHow its coordinates map to the node (zoom and pan).
regionslist<hit-region>Its clickable areas; where they overlap, the last one listed wins.

types.line-range

record

A range of lines, 0-based (start ≤ end, end exclusive).

record line-range {
  start: u32,
  end: u32,
}
FieldTypeDescription
startu32The first line.
endu32The line after the last.

types.line-mark-kind

enum

What a line mark says, drawn in the margin as Pitwall's editor marks changes since the last commit.

enum line-mark-kind {
  added,
  changed,
  deleted,
  error,
  warning,
}
CaseDescription
addedAdded lines (a green bar).
changedChanged lines (a blue bar).
deletedLines were deleted before start (a red mark between lines).
errorAn error on these lines (a red bar, the lines tinted, its message at the end of the first line).
warningA warning on these lines (a yellow bar, the lines tinted, its message at the end of the first line).

types.line-mark

record

A mark in a code view's margin.

record line-mark {
  lines: line-range,
  kind: line-mark-kind,
  message: option<string>,
}
FieldTypeDescription
linesline-rangeWhich lines.
kindline-mark-kindWhat it says.
messageoption<string>For an error or a warning: what is wrong, drawn after the first line's text (at most 500 bytes; longer is cut). Ignored for the other kinds.

types.code-view

record

Pitwall's read-only code view, showing the tile's text. The text is sent in each frame (at most 1 MiB); a frame with the same text and language keeps the user's scroll position and selection.

record code-view {
  text: string,
  language: option<string>,
  marks: list<line-mark>,
  reveal: option<u32>,
}
FieldTypeDescription
textstringThe text.
languageoption<string>Its language, for highlighting: a name (rust, typescript, python, markdown, …) or a file name (main.rs); none or an unknown one: plain text.
markslist<line-mark>Marks in the margin.
revealoption<u32>Scroll this line (0-based) into the middle and put the cursor on it, when it differs from the last frame's.

types.diff-side

enum

Which version of a diff.

enum diff-side {
  old,
  new,
}
CaseDescription
oldThe original (left, or the removed lines).
newThe changed version (right, or the added lines). A code view's lines are this side.

types.diff-layout

enum

How a diff is laid out.

enum diff-layout {
  side-by-side,
  inline,
}
CaseDescription
side-by-sideOld on the left, new on the right.
inlineOne column, removed lines above added ones.

types.diff-texts

record

Both versions of a text.

record diff-texts {
  old: string,
  new: string,
}
FieldTypeDescription
oldstringThe original.
newstringThe changed version.

types.diff-source

variant

What a diff view compares.

variant diff-source {
  texts(diff-texts),
  unified(string),
}
CasePayloadDescription
textsdiff-textsTwo whole texts (each at most 1 MiB): unchanged runs fold.
unifiedstringA unified diff of one file (git diff output: @@ hunks, +, - and context lines; header lines are skipped), at most 1 MiB. Lines keep their numbers from the hunk headers; what the diff doesn't show is folded.

types.diff-view

record

Pitwall's diff view, as Review draws a file's changes: line and character changes, folded unchanged runs.

record diff-view {
  source: diff-source,
  language: option<string>,
  layout: diff-layout,
  reveal: option<u32>,
}
FieldTypeDescription
sourcediff-sourceWhat it compares.
languageoption<string>The language, as code-view.language takes it.
layoutdiff-layoutSide by side or inline.
revealoption<u32>Scroll this line of the new version (0-based) into the middle, when it differs from the last frame's.

types.line-click

record

A line number of a code or diff view was clicked.

record line-click {
  handler: handler,
  side: diff-side,
  line: u32,
}
FieldTypeDescription
handlerhandlerThe handler of the view's line-click listener.
sidediff-sideWhich version's line (new in a code view).
lineu32The line, 0-based.

types.text-pos

record

A place in a code or diff view's text.

record text-pos {
  line: u32,
  column: u32,
}
FieldTypeDescription
lineu32The line, 0-based.
columnu32The column, in UTF-8 bytes from the line's start.

types.code-selection

record

The selection in a code or diff view.

record code-selection {
  handler: handler,
  side: diff-side,
  start: text-pos,
  end: text-pos,
  text: string,
}
FieldTypeDescription
handlerhandlerThe handler of the view's select listener.
sidediff-sideWhich version it is in (new in a code view).
starttext-posWhere it starts (the earlier end).
endtext-posWhere it ends; equal to start for a bare cursor.
textstringThe selected text, cut at 64 KiB.

types.ask-answer

record

An answer to one of the tile's questions (asks.set).

record ask-answer {
  id: string,
  picks: list<u32>,
  text: option<string>,
  declined: bool,
}
FieldTypeDescription
idstringThe question's id.
pickslist<u32>The suggestions picked, by their place in its list (from 0).
textoption<string>What the user typed, when anything.
declinedboolThe user declined to answer.

types.control-value

variant

A control's new value, as value-changed carries it.

variant control-value {
  on(bool),
  number(f64),
  choice(string),
  empty,
}
CasePayloadDescription
onboolA checkbox or switch is on (true) or off; a disclosure is open.
numberf64A slider's, number field's or split's number (a split's: the first pane's share, 0.0–1.0).
choicestringThe key of the radio button, segment, breadcrumb or timeline segment chosen.
emptyA number field was emptied.

types.value-change

record

A control's value changed (value).

record value-change {
  handler: handler,
  value: control-value,
}
FieldTypeDescription
handlerhandlerThe handler of the node's value listener.
valuecontrol-valueWhat it is now.

types.check

record

A checkbox or a switch. A click on it or its label, or Space while it has focus, sends value-changed with on and the other state; without a value listener it can't be changed.

record check {
  label: string,
  checked: bool,
  mixed: bool,
  disabled: bool,
}
FieldTypeDescription
labelstringIts label, drawn after the box (or before the switch); empty for none (then give the node a label, its accessible name).
checkedboolOn.
mixedboolA checkbox that stands for a group of which only some are on: drawn with a dash. A click sends on(true).
disabledboolDrawn dimmed; takes no clicks and no focus.

types.choice-item

record

One choice of a radio group or a segmented control.

record choice-item {
  key: string,
  label: string,
  disabled: bool,
}
FieldTypeDescription
keystringIts key, sent in value-changed (choice). Unique in the group, at most 128 bytes.
labelstringWhat it says.
disabledboolDrawn dimmed and can't be chosen.

types.choice-group

record

One of several choices: a radio group (a column, or a row when horizontal) or a segmented control. One focus stop: the arrow keys move to the next choice and choose it, Home and End to the first and last. At most 64 choices.

record choice-group {
  items: list<choice-item>,
  selected: option<string>,
  horizontal: bool,
  disabled: bool,
}
FieldTypeDescription
itemslist<choice-item>The choices, in order.
selectedoption<string>The chosen one's key; none: none yet.
horizontalboolA radio group laid out in a row (a segmented control always is).
disabledboolThe whole group is dimmed and can't be changed.

types.slider

record

A slider. Dragging moves it at once; value-changed follows as it moves (at most one every 50 ms) and when it is let go. Left and Down step down, Right and Up step up, Page Up and Page Down by a tenth, Home and End to the ends.

record slider {
  value: f64,
  min: f64,
  max: f64,
  step: f64,
  show-value: bool,
  disabled: bool,
}
FieldTypeDescription
valuef64Its value, kept between min and max.
minf64The lowest value.
maxf64The highest value (above min).
stepf64The steps it snaps to (0: none; the keys then move a hundredth).
show-valueboolDraw the value at its right.
disabledboolDimmed and can't be changed.

types.number-field

record

A number field. Typing a number and pressing Enter (or leaving the field) sends value-changed with it, kept within min and max and rounded to decimals; text that isn't a number is put back. − and + (and Up and Down while it has focus) step by step.

record number-field {
  value: option<f64>,
  min: option<f64>,
  max: option<f64>,
  step: f64,
  decimals: u8,
  placeholder: option<string>,
  readonly: bool,
  disabled: bool,
}
FieldTypeDescription
valueoption<f64>What it shows; none: empty.
minoption<f64>The lowest value it takes.
maxoption<f64>The highest value it takes.
stepf64What − and + add (above 0; 1 is usual).
decimalsu8Digits after the point, 0–6.
placeholderoption<string>Shown in faint text while it is empty.
readonlyboolShown, selectable, but not changed (no steps).
disabledboolDimmed and can't be changed or focused.

types.search-field

record

A search field: one line of text with a magnifier before it and a clear button while it holds text. It is a text field (input): Pitwall owns what is typed, change and submit listeners hear it as they do from input, and the clear button sends input-changed with an empty value.

record search-field {
  value: option<string>,
  revision: u64,
  placeholder: option<string>,
  disabled: bool,
}
FieldTypeDescription
valueoption<string>Text to put in it, as input.value (none keeps what it holds).
revisionu64The revision of value, as input.revision.
placeholderoption<string>Shown in faint text while it is empty (default: "Search").
disabledboolDimmed and can't be edited.

types.form-row

record

A form row: its label over its children (the control), or beside them, with help text under them, and a validation message in place of the help while there is one. The label is the control's accessible name when the control has none.

record form-row {
  label: string,
  help: option<string>,
  error: option<string>,
  required: bool,
  inline: bool,
}
FieldTypeDescription
labelstringThe label.
helpoption<string>Help under the control, in muted text.
erroroption<string>A validation message, in red, in place of the help; the control is marked invalid.
requiredboolA required field: a mark after the label.
inlineboolThe label beside the control (a fixed column) instead of over it.

types.progress

record

A progress bar.

record progress {
  value: option<f32>,
  tone: option<tone>,
}
FieldTypeDescription
valueoption<f32>The share done, 0.0–1.0; none while it can't be known (a bar that moves, or a still one with Reduce motion).
toneoption<tone>Its colour by meaning (none: the text colour).

types.skeleton

variant

A grey placeholder where content is loading, sized by the node's styles (a block without a size is a line tall and fills the row). It shimmers unless Reduce motion is on.

variant skeleton {
  lines(u8),
  block,
  circle,
}
CasePayloadDescription
linesu8This many lines of text (1–20), the last one shorter.
blockA box (give it a size).
circleA circle (an avatar), as tall as its width.

types.empty-state

record

An empty state, centred in its box: an icon, a title, a line of text and an action button, as Pitwall's own lists say they're empty. The action's click is the node's click listener.

record empty-state {
  icon: option<icon>,
  title: string,
  text: option<string>,
  action: option<string>,
}
FieldTypeDescription
iconoption<icon>An icon over the title.
titlestringWhat is empty ("No runs yet").
textoption<string>What to do about it.
actionoption<string>The action button's label (needs a click listener).

types.banner

record

An inline banner in the tile's flow (not a toast). Its action's click is the node's click listener; its close button (when dismissible) sends dismissed.

record banner {
  tone: tone,
  title: option<string>,
  text: string,
  action: option<string>,
  dismissible: bool,
}
FieldTypeDescription
tonetoneInformation (info), success (good), a warning (warn) or an error (bad).
titleoption<string>A bold first line.
textstringThe message.
actionoption<string>An action button's label (needs a click listener).
dismissibleboolIt has a close button (needs a dismiss listener).

types.badge

record

A small count or status label, as Pitwall's own.

record badge {
  text: string,
  tone: option<tone>,
}
FieldTypeDescription
textstringWhat it says ("3", "beta"); at most 32 bytes.
toneoption<tone>Its colour by meaning (none: neutral).

types.chip

record

A chip (a tag). With a click listener it can be picked (drawn selected); removable gives it a × that sends dismissed (as do Backspace and Delete while it has focus).

record chip {
  label: string,
  icon: option<icon>,
  tone: option<tone>,
  selected: bool,
  removable: bool,
  disabled: bool,
}
FieldTypeDescription
labelstringWhat it says.
iconoption<icon>An icon before the label.
toneoption<tone>Its colour by meaning (none: neutral).
selectedboolDrawn picked.
removableboolIt has a ×.
disabledboolDimmed; takes no clicks.

types.orientation

enum

Which way something runs.

enum orientation {
  horizontal,
  vertical,
}
CaseDescription
horizontalLeft to right.
verticalTop to bottom.

types.split

record

Two panes (the node's first two children) with a bar between them that the user drags. Pitwall keeps the user's size for the view by the node's key path, across restarts, and sends it as value-changed (number: the first pane's share) when a drag ends.

record split {
  orientation: orientation,
  initial: f32,
  min-first: f32,
  min-second: f32,
}
FieldTypeDescription
orientationorientationSide by side (horizontal) or one above the other.
initialf32The first pane's share at first, 0.05–0.95.
min-firstf32The first pane's smallest size, in logical pixels.
min-secondf32The second pane's smallest size, in logical pixels.

types.disclosure

record

A section with a header that opens and closes it: the header is a button (Enter or Space while it has focus) that sends value-changed with on and the other state; the node's children are drawn under it while open.

record disclosure {
  title: string,
  detail: option<string>,
  open: bool,
}
FieldTypeDescription
titlestringThe header.
detailoption<string>Muted text at the header's right (a count, a summary).
openboolOpen.

types.card

record

A card: a bordered box on the raised surface with its children in it, under a title when it has one. With a click listener the whole card is clickable and focusable.

record card {
  title: option<string>,
  detail: option<string>,
}
FieldTypeDescription
titleoption<string>A title at its top.
detailoption<string>Muted text at the title's right.

types.crumb

record

One level of breadcrumbs.

record crumb {
  key: string,
  label: string,
}
FieldTypeDescription
keystringIts key, sent in value-changed (choice).
labelstringWhat it says.

types.placement

enum

Where a popover opens from its anchor.

enum placement {
  below,
  above,
  start,
  end,
}
CaseDescription
belowUnder it (the default place).
aboveOver it.
startAt its left.
endAt its right.

types.popover

record

A popover: the node's children in a floating panel anchored to the node's parent, drawn by Pitwall inside the tile and kept in the window. It is open while it is in the frame. Esc and a click outside it send dismissed (the tile then leaves it out). At most one a frame.

record popover {
  placement: placement,
  width: option<f32>,
  at: option<point>,
}
FieldTypeDescription
placementplacementWhere it opens.
widthoption<f32>Its width in logical pixels (none: its content's, 160–480).
atoption<point>Anchor it to this point of its parent instead of the parent's edge, in logical pixels from the parent's top-left corner (as a click's at): under a box of a canvas, say. placement then says which side of the point it opens on. none: the parent's edge, as before.

types.confirm-sheet

record

A sheet over the tile asking the user to confirm, in place of the system dialogs a tile can't open. Shown while it is in the frame; the rest of the tile is dimmed and takes no input. Its confirm button is the node's click listener (Enter); Cancel, Esc and a click on the dimmed tile send dismissed. At most one a frame.

record confirm-sheet {
  title: string,
  text: option<string>,
  confirm: string,
  cancel: option<string>,
  danger: bool,
}
FieldTypeDescription
titlestringThe question ("Delete 3 notes?").
textoption<string>More about it.
confirmstringThe confirm button's label ("Delete").
canceloption<string>The cancel button's label (none: "Cancel").
dangerboolA destructive action: the confirm button is red.

types.key-value

record

One line of a key-value list.

record key-value {
  key: string,
  value: string,
  mono: bool,
  copyable: bool,
}
FieldTypeDescription
keystringThe label ("Branch").
valuestringThe value ("main").
monoboolThe value in the monospace font (ids, hashes, paths).
copyableboolThe value has a copy button.

types.avatar-size

enum

An avatar's size.

enum avatar-size {
  small,
  medium,
  large,
}
CaseDescription
small20 px.
medium28 px.
large40 px.

types.avatar

record

An avatar: the initials of name in a circle, coloured from the theme by the name, so a person has the same colour everywhere. Its accessible name and tooltip are name unless the node has its own.

record avatar {
  name: string,
  size: avatar-size,
}
FieldTypeDescription
namestringThe person's or thing's name ("Ada Lovelace": AL).
sizeavatar-sizeIts size.

types.relative-time

record

A time, drawn relative to now ("just now", "5 min ago", "3 h ago", "yesterday", then the date) and kept up to date by Pitwall, so the tile needs no timer. Its tooltip is the date and time in full.

record relative-time {
  at: s64,
}
FieldTypeDescription
ats64The time, in milliseconds since 1970-01-01 UTC.

types.copyable

record

Text with a copy button. Pitwall writes the text to the clipboard only when the user clicks the button (or presses Enter while it has focus), and says "Copied"; a click listener hears it too.

record copyable {
  text: string,
  mono: bool,
}
FieldTypeDescription
textstringThe text shown and copied (at most 64 KiB).
monoboolIn the monospace font.

record

A link. With url (https, or http on this computer) and the show permission, a click opens the page in a Pitwall web tile, as web.open does; otherwise it is the node's click listener (a link to somewhere in the tile).

record link {
  label: string,
  url: option<string>,
}
FieldTypeDescription
labelstringWhat it says.
urloption<string>The page it opens.

types.chart-series

record

A series of a chart.

record chart-series {
  name: string,
  values: list<f64>,
  color: option<token>,
}
FieldTypeDescription
namestringIts name, in the legend and tooltips.
valueslist<f64>Its values, one per label (a NaN or infinite value is a gap).
coloroption<token>Its colour (none: the next of Pitwall's chart colours).

types.sparkline

record

A sparkline: a small line without axes, sized by the node's styles (default 80 × 20).

record sparkline {
  values: list<f64>,
  color: option<token>,
  filled: bool,
}
FieldTypeDescription
valueslist<f64>The values, oldest first (at most 1 000).
coloroption<token>Its colour (none: the text colour).
filledboolThe area under the line is filled, faintly.

types.bar-chart

record

A bar chart: one group of bars per label, one bar per series in it (or one stacked bar), with a value axis, and a tooltip per bar.

record bar-chart {
  labels: list<string>,
  series: list<chart-series>,
  stacked: bool,
  unit: option<string>,
}
FieldTypeDescription
labelslist<string>The labels along the bottom (at most 200).
serieslist<chart-series>The series (at most 8), each with one value per label.
stackedboolStack the series in one bar per label.
unitoption<string>The values' unit, in the axis and tooltips ("ms", "%").

types.line-chart

record

A line chart: one line per series over the labels, with axes and a tooltip on hover that lists each series' value at the label under the pointer.

record line-chart {
  labels: list<string>,
  series: list<chart-series>,
  unit: option<string>,
  min: option<f64>,
  max: option<f64>,
}
FieldTypeDescription
labelslist<string>The labels along the bottom (at most 1 000; Pitwall draws as many as fit).
serieslist<chart-series>The series (at most 8), each with one value per label.
unitoption<string>The values' unit, in the axis and tooltips.
minoption<f64>The axis's lowest value (none: from the data, or 0).
maxoption<f64>The axis's highest value (none: from the data).

types.timeline-segment

record

One segment of a status timeline.

record timeline-segment {
  key: string,
  label: string,
  tone: option<tone>,
  weight: f32,
}
FieldTypeDescription
keystringIts key, sent in value-changed (choice) when it is clicked.
labelstringIts tooltip and accessible name ("#412 passed in 3 min").
toneoption<tone>Its colour by meaning (none: neutral, as for a run not started).
weightf32Its width relative to the others (a run's duration; 1.0 for all alike).

types.status-timeline

record

A status timeline: a row of coloured segments, oldest first, each with a tooltip, as a CI tile shows its last runs. At most 500.

record status-timeline {
  segments: list<timeline-segment>,
}
FieldTypeDescription
segmentslist<timeline-segment>The segments.

Interface ui

Requests about the tile's own views (runtime.md §3.8). No permission: these act only inside the tile's own area of the window.

ui.request-render

function

Render view again once the current call returns (when it is hidden: once it is shown). For changes that didn't come from an event, since handle returning true already renders.

request-render: func(view: view-id);

ui.scroll-to

function

Scroll the scroll containers around the node at key-path (keys from the root down, joined by /, without the root's, as frame.focus) so the node is in sight, after the next render of view. A path with no node is ignored.

scroll-to: func(view: view-id, key-path: string);

ui.toast

function

Show a short message in a toast, labelled with the tile's name. At most 200 characters (longer text is cut); at most 3 toasts a minute, more are dropped and noted in the Log.

toast: func(text: string, tone: tone);

ui.open-view

function

Open one of the extension's tiles (an id from its manifest's contributes.tiles) where Pitwall opens tiles, or focus its view when one is already open; a view-opened event follows. An unknown id is ignored and noted in the Log.

open-view: func(tile: string);

ui.put-image

function

Hand Pitwall an image's bytes (PNG, JPEG, GIF, WebP or SVG; at most 8 MiB) under name, for image nodes with source data(name). Kept until replaced or dropped; at most 64 MiB for all a tile's images. invalid when the bytes aren't one of those formats; too-large over a limit.

put-image: func(name: string, bytes: list<u8>) -> result<_, host-error>;

ui.drop-image

function

Forget the image put under name.

drop-image: func(name: string);

ui.measure-text

function

How wide each of texts is on one line in Pitwall's font (Inter for ui, JetBrains Mono for mono) at size logical pixels (4–200) and weight, in logical pixels: to size boxes on a canvas around their labels. Kerned as Pitwall draws it; a character Pitwall's font lacks counts as an average letter. One width per text, in order; at most 1 000 texts and 64 KiB in all a call (more: an empty list, noted in the Log). The same numbers in the test harness.

measure-text: func(texts: list<string>, font: font, size: f32, weight: weight) -> list<f32>;