WIT reference 0.1
PreviewPreview. 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
- World
tile - Interface
agent-tools - Interface
agents - Interface
asks - Interface
badges - Interface
files - Interface
guest - Interface
log - Interface
net - Interface
notify - Interface
programs - Interface
service - Interface
settings - Interface
show - Interface
sql - Interface
status - Interface
storage - Interface
tasks - Interface
toolbar - Interface
types - Interface
ui
Reading it
- You don't write WIT. The
pitwall-extensioncrate turns it into Rust: elements, theTiletrait, typed events and thestorage,settings,log,ui,agents,badgesandasksmodules, andtools(overagent-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'sexport!writes the export for you. - Names. WIT names use kebab case; the SDK's use Rust's (
request-renderisui::request_render,text-2isToken::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,
}
| Case | Description |
|---|---|
show | Opens or focuses the tile. |
present | Puts content into the tile, or changes content the same agent put there. |
read | Returns what the tile has now, with the user's edits. |
act | Has 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>,
}
| Field | Type | Description |
|---|---|---|
id | u64 | The call's id: answer it with reply when tool returned none. |
tool | string | The tool's name in the manifest. |
kind | tool-kind | |
caller | option<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). |
input | string | The input, as JSON text. |
view | option<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,
}
| Case | Description |
|---|---|
working | Working on its turn. |
blocked | It asks the user something (an approval, a question) and is held up until it is answered. |
idle | Waiting for its next prompt. |
done | Done with its turn. |
stopped | Not running: it exited or was stopped. |
unknown | Pitwall 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,
}
| Field | Type | Description |
|---|---|---|
id | string | Pitwall's id for it: what queue-add and a badge's row take. |
name | string | Its name, as the sidebar shows it. |
kind | string | Its kind's id (claude, codex, shell for a plain terminal…). |
kind-name | string | Its kind's name ("Claude Code"). |
project | string | Its project's folder. |
branch | option<string> | The git branch it works on, when known. |
state | agent-state | What it is doing. |
waiting-on-you | bool | It waits on the user: the sidebar's and the Dock's "needs you" (blocked). |
queued | u32 | Items 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,
}
| Field | Type | Description |
|---|---|---|
name | string | |
value | string | Plain 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>,
}
| Field | Type | Description |
|---|---|---|
label | string | Its words (at most 80 characters). |
description | option<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,
}
| Field | Type | Description |
|---|---|---|
id | string | The tile's own id for it, stable while it is open (1 to 128 characters): ask-answered names it. |
from | option<string> | Who asks: an agent by Pitwall's id (needs agents.read), shown by its name; none: the extension asks. |
title | string | What it is about, after who asks (at most 200 characters). |
question | string | The question (at most 2 000 characters). |
suggestions | list<suggestion> | Answers to pick (at most 8). |
multiple | bool | Several suggestions may be picked. |
blocking | bool | It 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),
}
| Case | Payload | Description |
|---|---|---|
agent | string | An agent, by Pitwall's id (agents.list). Needs agents.read. |
project | string | A 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>,
}
| Field | Type | Description |
|---|---|---|
row | row | The row. |
count | option<u32> | A number (at most 9999). |
note | option<string> | A few words (at most 16 characters; longer is cut). A badge needs a count or a note. |
tone | tone | Its colour by meaning: info is neutral. |
tooltip | option<string> | Shown on hover after the extension's name (at most 120 characters). |
open | option<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,
}
| Field | Type | Description |
|---|---|---|
name | string | Its name, as the sidebar shows it (checkout-web). |
folder | string | Its folder, absolute, as this computer writes it. |
files.root
variant
Where a call's path starts.
variant root {
project(string),
data,
}
| Case | Payload | Description |
|---|---|---|
project | string | The 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. |
data | The 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,
}
| Field | Type | Description |
|---|---|---|
path | string | Its path from the root, with / between parts (docs/arch.md). |
kind | entry-kind | A file or a folder (a link is what it leads to). |
size | u64 | Its size in bytes (0 for a folder). |
modified | u64 | When 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),
}
| Case | Payload | Description |
|---|---|---|
denied | The 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-project | The view isn't open, or isn't in a project. | |
not-found | Nothing is at that path. | |
exists | Something is already at that path (create, make-folder, rename's target). | |
not-allowed | string | The 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-large | Over a limit: a file over 8 MiB, more than 10 000 entries, the files folder over 100 MiB. | |
busy | Too many calls this second, or 8 watches already. | |
invalid | string | A path that isn't valid (empty where a file is needed, a NUL); the text says why. |
failed | string | The 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>,
}
| Field | Type | Description |
|---|---|---|
watch | watch-id | The watch. |
paths | list<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,
}
| Field | Type | Description |
|---|---|---|
name | string | |
value | string | An 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>,
}
| Field | Type | Description |
|---|---|---|
method | string | GET, POST, PUT, PATCH, DELETE or HEAD. |
url | string | The whole address, https://… (or http://localhost…). |
headers | list<header> | Headers to send. Host, Content-Length, Connection, Cookie and Proxy-* are Pitwall's and refused. |
body | option<list<u8>> | The body, at most 8 MiB. |
timeout-ms | option<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,
}
| Field | Type | Description |
|---|---|---|
status | u16 | The status code. |
headers | list<header> | The answer's headers (Set-Cookie left out). |
body | list<u8> | The body, at most 32 MiB. |
url | string | The 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),
}
| Case | Payload | Description |
|---|---|---|
denied | string | The tile isn't granted net, or the host isn't one it may reach (the text names the host). |
too-large | Over a limit: 8 requests at once, a body over 8 MiB, an answer over 32 MiB. | |
invalid | string | The request isn't valid (a bad URL, method or header); the text says why. |
timed-out | No answer in time. | |
failed | string | It 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>,
}
| Field | Type | Description |
|---|---|---|
id | request-id | The number fetch returned. |
outcome | result<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,
}
| Case | Description |
|---|---|
none | The extension declares no service. |
off | Not started yet: the user hasn't confirmed its commands. |
needs-install | Its program isn't installed (or too old): the card offers its install action. |
starting | Started, not answering yet. |
up | Running and answering. |
stopped | Stopped by the user. |
failed | It 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>,
}
| Field | Type | Description |
|---|---|---|
state | state | |
address | option<string> | Where it listens, http://127.0.0.1:8790 (no trailing /), when it declares ready.listen. |
version | option<string> | The version its version check found. |
why | option<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),
}
| Case | Payload | Description |
|---|---|---|
text | string | A text, url or choice setting (a choice gives its value, not its label). |
number | f64 | A number setting. |
flag | bool | A 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>>,
}
| Field | Type | Description |
|---|---|---|
columns | list<string> | The columns' names, in order. |
rows | list<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,
}
| Case | Description |
|---|---|
connecting | Starting to connect, or connecting again. |
ready | Connected and working. |
signed-out | A credential is missing, wrong, expired or lacks access. |
error | It 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),
}
| Case | Payload | Description |
|---|---|---|
none | No badge. | |
dot | A dot. | |
count | u32 | A number (shown up to 99, then "99+"). |
toolbar.badge-tone
enum
A badge's colour.
enum badge-tone {
normal,
attention,
}
| Case | Description |
|---|---|
normal | The accent colour. |
attention | Amber, 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>,
}
| Field | Type | Description |
|---|---|---|
id | option<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. |
json | option<string> | The payload, as JSON text matching the tile's input schema. |
bytes | option<list<u8>> | Binary payload (an image, a file's bytes), when the schema says so. At most 8 MiB. |
call | option<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. |
tool | option<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". |
caller | option<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. |
append | bool | The 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. |
large | option<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>,
}
| Field | Type | Description |
|---|---|---|
agent-id | string | The agent's id in Pitwall (stable while the agent exists). |
agent-name | string | The agent's name, as the user sees it (api, web). |
project | option<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>,
}
| Field | Type | Description |
|---|---|---|
view | view-id | The new view's id. |
tile | string | Which of the manifest's tiles it shows. |
content | option<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,
}
| Field | Type | Description |
|---|---|---|
view | view-id | The view. |
content | content | Its 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),
}
| Case | Payload | Description |
|---|---|---|
denied | The tile isn't granted the permission this needs. | |
busy | Too many calls or things at once (over 200 host calls a second, or 32 timers); try again later. | |
too-large | Over a size limit or a quota; the limits are in each function's documentation. | |
invalid | string | An argument isn't valid; the text says which and why. |
failed | string | The 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,
}
| Case | Description |
|---|---|
bg | The window's background, behind tiles. |
surface | A tile's own background. |
surface-2 | A raised area inside a tile: a header, a selected row. |
surface-3 | A further raised area: a hovered selected row, a field. |
raised | Floating surfaces: menus, popovers. |
line | Hairlines and borders. |
line-strong | Stronger borders: a focused field, a divider that must be seen. |
text | Main text. |
text-2 | Secondary text: details, labels. |
text-3 | Muted text: hints, timestamps. |
text-4 | Faint text: placeholders, disabled. |
focus | The focus ring. |
good | Success: passed, running well. |
good-soft | A soft background for good things. |
warn | Needs attention. |
warn-soft | A soft background for warnings. |
bad | Failed, destructive. |
bad-soft | A soft background for failures. |
done | Finished. |
done-soft | A soft background for finished things. |
diff-add-bg | The background of an added line in a diff. |
diff-del-bg | The background of a removed line in a diff. |
types.length
variant
A length.
variant length {
px(f32),
rem(f32),
fraction(f32),
auto,
}
| Case | Payload | Description |
|---|---|---|
px | f32 | Logical pixels (they scale with the display). |
rem | f32 | Multiples of Pitwall's base text size, so the length follows the user's font size. |
fraction | f32 | A fraction of the parent's size, from 0.0 to 1.0. |
auto | Whatever 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,
}
| Field | Type | Description |
|---|---|---|
top | length | The top side. |
right | length | The right side. |
bottom | length | The bottom side. |
left | length | The left side. |
types.text-size
enum
Pitwall's text sizes.
enum text-size {
xs,
sm,
md,
lg,
xl,
}
| Case | Description |
|---|---|
xs | The smallest: badges, counts. |
sm | Small: details, labels. |
md | The body size. |
lg | Headings inside a tile. |
xl | Large headings. |
types.font
enum
Pitwall's fonts.
enum font {
ui,
mono,
}
| Case | Description |
|---|---|
ui | The interface font. |
mono | The monospace font, for code and numbers that line up. |
types.weight
enum
Text weight.
enum weight {
normal,
medium,
semibold,
bold,
}
| Case | Description |
|---|---|
normal | Regular text. |
medium | Slightly heavier: labels. |
semibold | Headings. |
bold | Strong emphasis. |
types.radius
enum
Pitwall's corner radii.
enum radius {
square,
sm,
md,
lg,
full,
}
| Case | Description |
|---|---|
square | Square corners. |
sm | Small (4 px). |
md | The usual radius (6 px). |
lg | Large (10 px). |
full | Fully 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,
}
| Case | Description |
|---|---|
start | At the start. |
center | Centred. |
end | At the end. |
stretch | Stretched to fill. |
baseline | Along 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,
}
| Case | Description |
|---|---|
start | Packed at the start. |
center | Packed in the centre. |
end | Packed at the end. |
space-between | The first at the start, the last at the end, equal space between. |
space-around | Equal space around each. |
types.overflow
enum
What happens to content larger than its box.
enum overflow {
visible,
hidden,
scroll,
}
| Case | Description |
|---|---|
visible | It shows outside the box. |
hidden | It is cut off at the box's edge. |
scroll | The 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,
}
| Case | Description |
|---|---|
default | The usual arrow. |
pointer | A hand: something clickable. |
text | A 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),
}
| Case | Payload | Description |
|---|---|---|
flex-row | Lay children out in a row. | |
flex-col | Lay children out in a column (the default for a box). | |
wrap | Wrap children onto more lines when they don't fit. | |
grow | f32 | Take this share of the free space along the parent's direction. |
shrink | f32 | Give up this share of the space when there isn't enough. |
gap | length | Space between children. |
padding | edges | Space inside the node's border. |
margin | edges | Space outside the node's border. |
width | length | Width. |
height | length | Height. |
min-width | length | Smallest width. |
max-width | length | Largest width. |
min-height | length | Smallest height. |
max-height | length | Largest height. |
align-items | align | How children line up across the main direction. |
justify | justify | How children are spread along the main direction. |
self-align | align | How this node lines up in its parent, over the parent's align-items. |
overflow-x | overflow | Horizontal overflow. |
overflow-y | overflow | Vertical overflow. |
border | edges | Border widths (in px or rem; fractions and auto count as none). |
border-color | token | Border colour. |
radius | radius | Corner radius. |
background | token | Background colour. |
color | token | Text and icon colour, inherited by children. |
opacity | f32 | Opacity, from 0.0 (invisible) to 1.0. |
text-size | text-size | Text size, inherited by children. |
font | font | Font, inherited by children. |
weight | weight | Text weight, inherited by children. |
italic | Italic text. | |
underline | Underlined text. | |
truncate | One line, cut with an ellipsis when too long. | |
line-clamp | u8 | At most this many lines, the last one cut with an ellipsis. |
selectable | The user can select and copy this text. | |
hover-background | token | Background while the pointer is over the node. |
cursor | cursor | The pointer's shape over the node. |
group | string | Names 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-hover | string | Hidden 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). |
drag | drag-source | The 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-target | drop-target | Drags 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,
}
| Case | Description |
|---|---|
primary | The main action of a tile or a form; one per area. |
ghost | An ordinary action: a hairline button (at small size: Pitwall's small row and toolbar button). |
danger | A destructive action. |
link | A 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,
}
| Case | Description |
|---|---|
regular | The usual height (30 px). |
small | Smaller (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,
}
| Field | Type | Description |
|---|---|---|
label | string | The text on it. |
kind | button-kind | Its look. |
size | button-size | Its size. |
icon | option<icon> | An icon before the label. |
disabled | bool | Drawn 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),
}
| Case | Payload | Description |
|---|---|---|
named | string | One 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,
}
| Case | Description |
|---|---|
vertical | Up and down. |
horizontal | Left and right. |
both | Both. |
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,
}
| Field | Type | Description |
|---|---|---|
axis | axis | Which 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,
}
| Field | Type | Description |
|---|---|---|
start | u32 | Where it starts. |
end | u32 | Where 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,
}
| Field | Type | Description |
|---|---|---|
value | option<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. |
revision | u64 | The revision of value: the revision of the last input-changed the tile has seen (0 at first), plus one. Ignored when value is none. |
selection | option<text-range> | Where to put the cursor or selection when value is applied (none: at the end). |
placeholder | option<string> | Shown in faint text while it is empty. |
multiline | bool | Several lines. |
rows | option<u16> | For a multi-line field, its height in lines when its node has no height style (none: 3). It scrolls past that. |
disabled | bool | Drawn 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
- 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>,
}
| Field | Type | Description |
|---|---|---|
count | u32 | How many rows (at most 1 000 000). |
row-height | f32 | Each row's height, in logical pixels (12–200); every row has it. |
revision | u64 | Moves 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. |
selected | list<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>,
}
| Field | Type | Description |
|---|---|---|
key | string | The row's item, stable while the item is the same (an id, not its index): selection and events name it. At most 128 bytes. |
nodes | list<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. |
depth | u16 | A tree's row: how deep it is (0 at the top); 0 elsewhere. |
expanded | option<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,
}
| Field | Type | Description |
|---|---|---|
key | string | Its key, unique in the table; events name it. |
title | string | Its title in the header. |
width | option<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. |
align | align | Its cells' alignment across: start, center or end. |
sortable | bool | Its 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,
}
| Field | Type | Description |
|---|---|---|
columns | list<column> | |
sort | option<sort-state> | The column sorted by and how, drawn with an arrow in its header. |
rows | virtual-list | The 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>,
}
| Field | Type | Description |
|---|---|---|
key | string | Its key, sent in select. |
label | string | |
icon | option<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>,
}
| Field | Type | Description |
|---|---|---|
items | list<tab> | |
selected | option<string> | The selected tab's key. |
types.select-option
record
One choice of a select.
record select-option {
key: string,
label: string,
}
| Field | Type | Description |
|---|---|---|
key | string | Its key, sent in select. |
label | string |
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,
}
| Field | Type | Description |
|---|---|---|
options | list<select-option> | |
selected | option<string> | The chosen option's key. |
placeholder | option<string> | Shown while nothing is chosen. |
disabled | bool |
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,
}
| Field | Type | Description |
|---|---|---|
key | string | Its key, sent in select. |
label | string | |
icon | option<icon> | |
hint | option<string> | A shortcut shown at its right, as text ("⌘D"). Only shown: bind the key in the frame's keymap. |
disabled | bool | Drawn dimmed and can't be chosen. |
danger | bool | A destructive choice, drawn in red. |
types.menu-entry
variant
A line of a menu.
variant menu-entry {
item(menu-item),
separator,
}
| Case | Payload | Description |
|---|---|---|
item | menu-item | |
separator | A 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,
}
| Case | Description |
|---|---|
contain | Whole, as large as fits. |
cover | Filling the box, cut at the edges. |
fill | Stretched to the box. |
types.image-source
variant
Where an image's bytes come from.
variant image-source {
asset(string),
data(string),
}
| Case | Payload | Description |
|---|---|---|
asset | string | A file in the extension's folder, by its path there ("assets/logo.png"): PNG, JPEG, GIF, WebP or SVG, at most 16 MiB. |
data | string | Bytes 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),
}
| Case | Payload | Description |
|---|---|---|
box | A box: a flex container with no look of its own beyond its styles. The usual root. | |
text | string | Text. 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. |
button | button | A button. |
icon | icon | An icon. |
scroll | scroll | A scrolling container. |
input | input | A text field. |
canvas | canvas | A drawing: shapes, lines and text the tile places itself, with clickable regions over them. Give it a size (width and height, or grow). |
code-view | code-view | Pitwall's read-only code view, with the text the tile gives: highlighting, line numbers, selection and copy, Find. |
diff-view | diff-view | Pitwall's diff view of two versions of a text, as Review draws it. |
virtual-list | virtual-list | A long list, its rows fetched as they come into sight. |
table | table | A table: columns over a virtual list of rows. |
tree | tree | A tree: a virtual list of the open nodes. |
tabs | tabs | A row of tabs. |
select | select | A dropdown. |
menu-button | menu-button | A button that opens a menu. |
context-menu | list<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. |
markdown | markdown | Markdown, drawn and inert. |
image | image | An image. |
checkbox | check | A checkbox with its label. |
switch | check | A switch (an on/off toggle) with its label. |
radio-group | choice-group | A group of radio buttons: one of several choices. |
segmented | choice-group | A segmented control: one of a few choices, side by side. |
slider | slider | A slider: a number in a range, dragged or moved with the keys. |
number-field | number-field | A number field with − and + steps. |
search-field | search-field | A search field: a text field with a magnifier and a clear button. |
form-row | form-row | A form row: a label over (or beside) the control under it, with help text, a validation message and a required mark. |
progress | progress | A progress bar, with a known share done or still going. |
spinner | A spinning ring: something is loading. | |
skeleton | skeleton | A grey placeholder where content is loading. |
empty-state | empty-state | An empty state: an icon, a title, a line of text and an action. |
banner | banner | An inline banner: information, success, a warning or an error. |
badge | badge | A small count or status label. |
chip | chip | A chip (a tag): a label that can be picked or removed. |
kbd | string | A key or shortcut, drawn as Pitwall draws its own (cmd-k: ⌘K). |
split | split | Two panes with a bar between them the user drags. |
disclosure | disclosure | A section with a header that opens and closes it. |
card | card | A card: a bordered box, with a title. |
divider | orientation | A thin line between things. |
breadcrumbs | list<crumb> | Breadcrumbs: where the user is, each level clickable. |
toolbar | A toolbar row: Pitwall's bar look for the buttons and fields in it. | |
popover | popover | A popover anchored to its parent node, drawn by Pitwall. |
confirm-sheet | confirm-sheet | A sheet over the tile asking the user to confirm. |
key-values | list<key-value> | A list of labels and their values. |
avatar | avatar | An avatar: a person's initials in a circle. |
relative-time | relative-time | A time drawn as "5 min ago", kept up to date by Pitwall. |
copyable | copyable | Text with a button that copies it. |
link | link | A link: opens a web page, or tells the tile. |
sparkline | sparkline | A small line chart without axes, inline with text. |
bar-chart | bar-chart | A bar chart. |
line-chart | line-chart | A line chart with axes. |
status-timeline | status-timeline | A row of coloured segments, one per run (CI runs, deploys). |
secret-field | secret-field | A secret kept by the host, never delivered as input text. |
setting-field | setting-field | Host-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,
}
| Case | Description |
|---|---|
click | A click (or Space or Enter while the node has focus). Buttons and any other node. |
change | A text field's value changed. |
select | A text field's cursor or selection moved without its value changing. |
submit | Enter (⌘Enter when multi-line) in a text field. |
scroll | A scroll container was scrolled (for loading more at the end). |
hover | The pointer entered or left the node. |
pointer | Pointer presses, releases and moves over the node, with their position (for drawing and dragging inside a node). |
wheel | The 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-click | A click on a line number of a code or diff view. |
toggle | A tree's branch opened or closed; a Markdown task's checkbox clicked. |
link | A link in Markdown clicked. |
sort | A table's header clicked to sort. |
column-resized | A table's column resized by the user. |
value | A control's value changed: a checkbox, switch, radio group, segmented control, slider, number field, disclosure, split, breadcrumb or status timeline (value-changed). |
dismiss | The 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,
}
| Field | Type | Description |
|---|---|---|
on | listen | Which event. |
handler | handler | The 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>,
}
| Field | Type | Description |
|---|---|---|
parent | option<u32> | The parent's index in frame.nodes: always lower than this node's own. none only for the first node, the root. |
key | string | Stable 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. |
element | element | What it is. |
style | list<style> | How it looks and lays out. |
on | list<listener> | The events it wants. |
focusable | bool | It can take keyboard focus (Tab moves among focusable nodes in tree order). Buttons and text fields are focusable whatever this says. |
tooltip | option<string> | Text shown when the pointer rests on it. |
label | option<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,
}
| Field | Type | Description |
|---|---|---|
keys | string | The keys, as Pitwall writes them: j, enter, cmd-s, shift-tab, /. cmd is ⌘ on macOS and Ctrl elsewhere. |
handler | handler | The 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>,
}
| Field | Type | Description |
|---|---|---|
nodes | list<node> | The nodes, root first, each after its parent. |
focus | option<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. |
keymap | list<binding> | The keys the tile handles while it has focus. |
types.modifiers
flags
Keys held during a click.
flags modifiers {
shift,
ctrl,
alt,
platform,
}
| Flag | Description |
|---|---|
shift | Shift. |
ctrl | Control. |
alt | Option 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,
}
| Case | Description |
|---|---|
left | The main button. |
right | The secondary button. |
middle | The 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,
}
| Field | Type | Description |
|---|---|---|
x | f32 | From the left edge. |
y | f32 | From the top edge. |
types.click
record
A click.
record click {
handler: handler,
button: mouse-button,
modifiers: modifiers,
count: u32,
at: point,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of the node's click listener. |
button | mouse-button | Which button. |
modifiers | modifiers | Keys held. |
count | u32 | 1 for a single click, 2 for a double click, and so on. |
at | point | Where 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),
}
| Case | Payload | Description |
|---|---|---|
down | mouse-button | A button went down. |
up | mouse-button | A button came up. |
move | The pointer moved (coalesced: the newest position). | |
wheel | delta | The 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. |
pinch | f32 | A 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,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of the node's pointer listener. |
kind | pointer-kind | What happened. |
at | point | Where, from the node's top-left corner. |
modifiers | modifiers | Keys held. |
types.input-change
record
A text field's new value.
record input-change {
handler: handler,
value: string,
revision: u64,
selection: text-range,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of the field's change listener. |
value | string | What the field holds now. |
revision | u64 | The edit's revision. To replace the text later, send input.revision above it (runtime.md §2.4). |
selection | text-range | The 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,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of the field's select listener. |
selection | text-range | The cursor or selection now, in the value of the field's latest input-changed (or the value the tile last set). |
revision | u64 | The revision of the value it applies to. |
types.key-event
record
A key binding fired.
record key-event {
handler: handler,
keys: string,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The binding's handler. |
keys | string | The 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,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of its scroll listener. |
x | f32 | Pixels scrolled from the left. |
y | f32 | Pixels scrolled from the top. |
content-width | f32 | The content's width, in pixels. |
content-height | f32 | The content's height, in pixels. |
types.hover
record
The pointer entered or left a node.
record hover {
handler: handler,
inside: bool,
at: point,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of the node's hover listener. |
inside | bool | True when it entered, false when it left. |
at | point | Where, from the node's top-left corner. |
types.size
record
A size in logical pixels.
record size {
width: f32,
height: f32,
}
| Field | Type | Description |
|---|---|---|
width | f32 | Width. |
height | f32 | Height. |
types.view-size
record
A view's new size.
record view-size {
view: view-id,
size: size,
}
| Field | Type | Description |
|---|---|---|
view | view-id | The view. |
size | size | Its 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>,
}
| Field | Type | Description |
|---|---|---|
view | view-id | The view. |
key-path | option<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,
}
| Case | Description |
|---|---|
light | The light theme. |
dark | The dark theme. |
types.density
enum
How much space Pitwall puts around things (Settings → Appearance).
enum density {
comfortable,
compact,
dense,
}
| Case | Description |
|---|---|
comfortable | The most space. |
compact | The default. |
dense | The 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,
}
| Field | Type | Description |
|---|---|---|
mode | theme-mode | Light or dark. |
density | density | How much space to leave. |
reduce-motion | bool | The user asked for less motion: don't animate. |
types.tone
enum
A toast's tone.
enum tone {
info,
good,
warn,
bad,
}
| Case | Description |
|---|---|
info | Neutral news. |
good | Something worked. |
warn | Something needs attention. |
bad | Something 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,
}
| Field | Type | Description |
|---|---|---|
handler | handler | |
key | string | The item's key: the row's, tab's, option's or menu item's. |
index | u32 | The row's index (lists, tables, trees), or the item's place among its siblings (tabs, options, menu items; separators not counted). |
modifiers | modifiers | Keys held (⌘/Ctrl or Shift, to add to a selection). |
activate | bool | The 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,
}
| Field | Type | Description |
|---|---|---|
handler | handler | |
key | string | A tree: the row's key. Markdown: empty. |
index | u32 | A tree: the row's index. Markdown: the task's line in the text (0-based). |
on | bool | Open (or ticked) now. |
types.link-click
record
A link in Markdown clicked (link).
record link-click {
handler: handler,
url: string,
modifiers: modifiers,
}
| Field | Type | Description |
|---|---|---|
handler | handler | |
url | string | The link's target as written. |
modifiers | modifiers |
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,
}
| Field | Type | Description |
|---|---|---|
program | string | |
args | list<string> | |
env | list<program-env-var> | |
cwd | option<string> | |
private-output | bool | Return 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),
}
| Case | Payload | Description |
|---|---|---|
click | click | A node with a click listener was clicked. |
input-changed | input-change | A 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-selected | input-selection | A text field with a select listener moved its cursor or selection without changing its value (coalesced: the newest). |
submit | handler | Enter in a text field with a submit listener; carries its handler. |
key | key-event | A key binding of the frame's keymap fired. |
scroll | scroll-position | A scroll container with a scroll listener moved (coalesced: the newest position). |
hover | hover | The pointer entered or left a node with a hover listener. |
pointer | pointer-event | A press, release or move over a node with a pointer listener. |
resize | view-size | A view's size changed (coalesced: the newest size). |
visibility | bool | The 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. |
focus | bool | The tile got (true) or lost (false) keyboard focus. |
focus-changed | node-focus | The 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). |
theme | theme-info | The user changed their appearance settings. |
timer | timer-id | A timer fired. |
settings-changed | option<string> | A setting changed: its key, or none for a bulk refresh. Read its value again with settings.get. |
grants-changed | list<string> | The user granted or took back permissions; the list is what is granted now. |
view-opened | view-opened | A view was opened; its first render follows. Every view gets this, the ones open at start too (right after init). |
view-content | view-content | An open view was given new content (a later call with the same content id); return true to render it again. |
view-closed | view-id | A view was closed; it is no longer rendered. |
dropped | drop-event | A drag was dropped on a node with a drop-target. |
line-clicked | line-click | A line number of a code or diff view with a line-click listener was clicked. |
code-selected | code-selection | The selection in a code or diff view with a select listener changed (coalesced: the newest, at most one every 100 ms). |
agents-changed | Pitwall'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-answered | ask-answer | The user answered one of the tile's questions (asks.set), in the floating control. Reply with asks.reply. |
select | selection | A row, tab, option or menu item was chosen. |
toggle | toggled | A tree's branch opened or closed; a Markdown task ticked. |
link | link-click | A link in Markdown was clicked. |
sort | sort-change | A table's header was clicked to sort. |
column-resized | column-width | A table's column was resized. |
fetched | fetched | The answer to a net.fetch request (or why there is none). |
toolbar-clicked | option<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-changed | service-info | The extension's own server changed state (service.info). |
value-changed | value-change | A control with a value listener was changed by the user. |
dismissed | handler | A node with a dismiss listener was closed or removed by the user; carries its handler. |
undo-present | u64 | The 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-cancelled | u64 | A 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-changed | files-changed | Files changed under a folder the tile watches (files.watch). |
project-changed | view-id | The 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-changed | secret-change | A secret was saved or removed by the user. |
program-changed | program-changed | A supervised program changed state. |
program-finished | program-finished | A one-shot run ended, with redacted bounded output. |
download-finished | program-downloaded | A 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>>,
}
| Field | Type | Description |
|---|---|---|
extension | string | The extension's id. |
version | string | The extension's version, from its manifest. |
theme | theme-info | The user's appearance settings. |
granted | list<string> | The permissions the user granted, by name. |
state | option<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,
}
| Field | Type | Description |
|---|---|---|
x | f32 | Rightwards. |
y | f32 | Downwards. |
types.drag-source
record
What a node can be dragged as, inside its view.
record drag-source {
kind: string,
data: string,
label: string,
}
| Field | Type | Description |
|---|---|---|
kind | string | A kind of the tile's own ("card", "column"): drop targets name the kinds they accept. |
data | string | What the drop target gets back (an item's id, JSON). At most 64 KiB. |
label | string | Shown 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,
}
| Field | Type | Description |
|---|---|---|
accepts | list<string> | The kinds of drag it takes (drag-source.kind). |
handler | handler | The 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,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The target's handler. |
kind | string | The dragged node's kind. |
data | string | The dragged node's data. |
at | point | Where 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),
}
| Case | Payload | Description |
|---|---|---|
token | token | A theme colour. |
rgba | u32 | A 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,
}
| Field | Type | Description |
|---|---|---|
x | f32 | Its left edge. |
y | f32 | Its top edge. |
width | f32 | Its width. |
height | f32 | Its height. |
types.stroke
record
How a line is drawn.
record stroke {
color: paint,
width: f32,
dash: list<f32>,
}
| Field | Type | Description |
|---|---|---|
color | paint | Its colour. |
width | f32 | Its width, in logical pixels (scaled with the canvas's transform). |
dash | list<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,
}
| Field | Type | Description |
|---|---|---|
rect | rect | Where. |
fill | option<paint> | Its fill, if any. |
stroke | option<stroke> | Its outline, if any. |
radius | f32 | Its corner radius, in logical pixels. |
types.quad-to
record
A quadratic curve's step.
record quad-to {
control: point,
to: point,
}
| Field | Type | Description |
|---|---|---|
control | point | The control point. |
to | point | Where it ends. |
types.cubic-to
record
A cubic curve's step.
record cubic-to {
control1: point,
control2: point,
to: point,
}
| Field | Type | Description |
|---|---|---|
control1 | point | The first control point. |
control2 | point | The second control point. |
to | point | Where 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,
}
| Case | Payload | Description |
|---|---|---|
move-to | point | Start a new piece here. |
line-to | point | A straight line to here. |
quad-to | quad-to | A quadratic curve. |
cubic-to | cubic-to | A cubic curve. |
close | A 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>,
}
| Field | Type | Description |
|---|---|---|
steps | list<path-step> | Its steps, starting with move-to. |
fill | option<paint> | Its fill, if any. |
stroke | option<stroke> | Its line, if any. |
types.text-align
enum
Where text lies across its point.
enum text-align {
start,
center,
end,
}
| Case | Description |
|---|---|
start | It starts at the point. |
center | It is centred on the point. |
end | It ends at the point. |
types.text-baseline
enum
Where text lies up and down from its point.
enum text-baseline {
top,
middle,
bottom,
}
| Case | Description |
|---|---|
top | Its line's top is at the point. |
middle | Its line's middle is at the point. |
bottom | Its 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>,
}
| Field | Type | Description |
|---|---|---|
text | string | The text (one line: line breaks are drawn as spaces). |
at | point | Where, as align and baseline say. |
size | f32 | Its size in logical pixels (scaled with the canvas's transform). Pitwall's body text is 13; its other sizes 11, 12, 16 and 20. |
color | paint | Its colour. |
font | font | Its font. |
weight | weight | Its weight. |
align | text-align | Across the point. |
baseline | text-baseline | Up and down from the point. |
max-width | option<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,
}
| Case | Payload | Description |
|---|---|---|
rect | draw-rect | A rectangle. |
path | draw-path | A path. |
text | draw-text | Text. |
clip-push | rect | Draw only inside this rectangle until the matching clip-pop. |
clip-pop | End 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,
}
| Field | Type | Description |
|---|---|---|
scale | f32 | The zoom (1.0: as given). |
dx | f32 | Moved right by this. |
dy | f32 | Moved 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>,
}
| Field | Type | Description |
|---|---|---|
key | string | Stable among the canvas's regions, at most 128 bytes. |
rect | rect | Where, in the canvas's coordinates. |
label | string | Its accessible name, and its tooltip unless it has one. |
tooltip | option<string> | Text shown when the pointer rests on it. |
click | option<handler> | Sent as a click event (its at from the canvas node's corner). |
hover | option<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>,
}
| Field | Type | Description |
|---|---|---|
ops | list<draw-op> | What it draws, in order. |
transform | transform | How its coordinates map to the node (zoom and pan). |
regions | list<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,
}
| Field | Type | Description |
|---|---|---|
start | u32 | The first line. |
end | u32 | The 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,
}
| Case | Description |
|---|---|
added | Added lines (a green bar). |
changed | Changed lines (a blue bar). |
deleted | Lines were deleted before start (a red mark between lines). |
error | An error on these lines (a red bar, the lines tinted, its message at the end of the first line). |
warning | A 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>,
}
| Field | Type | Description |
|---|---|---|
lines | line-range | Which lines. |
kind | line-mark-kind | What it says. |
message | option<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>,
}
| Field | Type | Description |
|---|---|---|
text | string | The text. |
language | option<string> | Its language, for highlighting: a name (rust, typescript, python, markdown, …) or a file name (main.rs); none or an unknown one: plain text. |
marks | list<line-mark> | Marks in the margin. |
reveal | option<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,
}
| Case | Description |
|---|---|
old | The original (left, or the removed lines). |
new | The 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,
}
| Case | Description |
|---|---|
side-by-side | Old on the left, new on the right. |
inline | One column, removed lines above added ones. |
types.diff-texts
record
Both versions of a text.
record diff-texts {
old: string,
new: string,
}
| Field | Type | Description |
|---|---|---|
old | string | The original. |
new | string | The changed version. |
types.diff-source
variant
What a diff view compares.
variant diff-source {
texts(diff-texts),
unified(string),
}
| Case | Payload | Description |
|---|---|---|
texts | diff-texts | Two whole texts (each at most 1 MiB): unchanged runs fold. |
unified | string | A 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>,
}
| Field | Type | Description |
|---|---|---|
source | diff-source | What it compares. |
language | option<string> | The language, as code-view.language takes it. |
layout | diff-layout | Side by side or inline. |
reveal | option<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,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of the view's line-click listener. |
side | diff-side | Which version's line (new in a code view). |
line | u32 | The line, 0-based. |
types.text-pos
record
A place in a code or diff view's text.
record text-pos {
line: u32,
column: u32,
}
| Field | Type | Description |
|---|---|---|
line | u32 | The line, 0-based. |
column | u32 | The 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,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of the view's select listener. |
side | diff-side | Which version it is in (new in a code view). |
start | text-pos | Where it starts (the earlier end). |
end | text-pos | Where it ends; equal to start for a bare cursor. |
text | string | The 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,
}
| Field | Type | Description |
|---|---|---|
id | string | The question's id. |
picks | list<u32> | The suggestions picked, by their place in its list (from 0). |
text | option<string> | What the user typed, when anything. |
declined | bool | The 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,
}
| Case | Payload | Description |
|---|---|---|
on | bool | A checkbox or switch is on (true) or off; a disclosure is open. |
number | f64 | A slider's, number field's or split's number (a split's: the first pane's share, 0.0–1.0). |
choice | string | The key of the radio button, segment, breadcrumb or timeline segment chosen. |
empty | A number field was emptied. |
types.value-change
record
A control's value changed (value).
record value-change {
handler: handler,
value: control-value,
}
| Field | Type | Description |
|---|---|---|
handler | handler | The handler of the node's value listener. |
value | control-value | What 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,
}
| Field | Type | Description |
|---|---|---|
label | string | Its label, drawn after the box (or before the switch); empty for none (then give the node a label, its accessible name). |
checked | bool | On. |
mixed | bool | A checkbox that stands for a group of which only some are on: drawn with a dash. A click sends on(true). |
disabled | bool | Drawn 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,
}
| Field | Type | Description |
|---|---|---|
key | string | Its key, sent in value-changed (choice). Unique in the group, at most 128 bytes. |
label | string | What it says. |
disabled | bool | Drawn 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,
}
| Field | Type | Description |
|---|---|---|
items | list<choice-item> | The choices, in order. |
selected | option<string> | The chosen one's key; none: none yet. |
horizontal | bool | A radio group laid out in a row (a segmented control always is). |
disabled | bool | The 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,
}
| Field | Type | Description |
|---|---|---|
value | f64 | Its value, kept between min and max. |
min | f64 | The lowest value. |
max | f64 | The highest value (above min). |
step | f64 | The steps it snaps to (0: none; the keys then move a hundredth). |
show-value | bool | Draw the value at its right. |
disabled | bool | Dimmed 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,
}
| Field | Type | Description |
|---|---|---|
value | option<f64> | What it shows; none: empty. |
min | option<f64> | The lowest value it takes. |
max | option<f64> | The highest value it takes. |
step | f64 | What − and + add (above 0; 1 is usual). |
decimals | u8 | Digits after the point, 0–6. |
placeholder | option<string> | Shown in faint text while it is empty. |
readonly | bool | Shown, selectable, but not changed (no steps). |
disabled | bool | Dimmed 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,
}
| Field | Type | Description |
|---|---|---|
value | option<string> | Text to put in it, as input.value (none keeps what it holds). |
revision | u64 | The revision of value, as input.revision. |
placeholder | option<string> | Shown in faint text while it is empty (default: "Search"). |
disabled | bool | Dimmed 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,
}
| Field | Type | Description |
|---|---|---|
label | string | The label. |
help | option<string> | Help under the control, in muted text. |
error | option<string> | A validation message, in red, in place of the help; the control is marked invalid. |
required | bool | A required field: a mark after the label. |
inline | bool | The 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>,
}
| Field | Type | Description |
|---|---|---|
value | option<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). |
tone | option<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,
}
| Case | Payload | Description |
|---|---|---|
lines | u8 | This many lines of text (1–20), the last one shorter. |
block | A box (give it a size). | |
circle | A 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>,
}
| Field | Type | Description |
|---|---|---|
icon | option<icon> | An icon over the title. |
title | string | What is empty ("No runs yet"). |
text | option<string> | What to do about it. |
action | option<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,
}
| Field | Type | Description |
|---|---|---|
tone | tone | Information (info), success (good), a warning (warn) or an error (bad). |
title | option<string> | A bold first line. |
text | string | The message. |
action | option<string> | An action button's label (needs a click listener). |
dismissible | bool | It 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>,
}
| Field | Type | Description |
|---|---|---|
text | string | What it says ("3", "beta"); at most 32 bytes. |
tone | option<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,
}
| Field | Type | Description |
|---|---|---|
label | string | What it says. |
icon | option<icon> | An icon before the label. |
tone | option<tone> | Its colour by meaning (none: neutral). |
selected | bool | Drawn picked. |
removable | bool | It has a ×. |
disabled | bool | Dimmed; takes no clicks. |
types.orientation
enum
Which way something runs.
enum orientation {
horizontal,
vertical,
}
| Case | Description |
|---|---|
horizontal | Left to right. |
vertical | Top 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,
}
| Field | Type | Description |
|---|---|---|
orientation | orientation | Side by side (horizontal) or one above the other. |
initial | f32 | The first pane's share at first, 0.05–0.95. |
min-first | f32 | The first pane's smallest size, in logical pixels. |
min-second | f32 | The 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,
}
| Field | Type | Description |
|---|---|---|
title | string | The header. |
detail | option<string> | Muted text at the header's right (a count, a summary). |
open | bool | Open. |
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>,
}
| Field | Type | Description |
|---|---|---|
title | option<string> | A title at its top. |
detail | option<string> | Muted text at the title's right. |
types.crumb
record
One level of breadcrumbs.
record crumb {
key: string,
label: string,
}
| Field | Type | Description |
|---|---|---|
key | string | Its key, sent in value-changed (choice). |
label | string | What it says. |
types.placement
enum
Where a popover opens from its anchor.
enum placement {
below,
above,
start,
end,
}
| Case | Description |
|---|---|
below | Under it (the default place). |
above | Over it. |
start | At its left. |
end | At 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>,
}
| Field | Type | Description |
|---|---|---|
placement | placement | Where it opens. |
width | option<f32> | Its width in logical pixels (none: its content's, 160–480). |
at | option<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,
}
| Field | Type | Description |
|---|---|---|
title | string | The question ("Delete 3 notes?"). |
text | option<string> | More about it. |
confirm | string | The confirm button's label ("Delete"). |
cancel | option<string> | The cancel button's label (none: "Cancel"). |
danger | bool | A 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,
}
| Field | Type | Description |
|---|---|---|
key | string | The label ("Branch"). |
value | string | The value ("main"). |
mono | bool | The value in the monospace font (ids, hashes, paths). |
copyable | bool | The value has a copy button. |
types.avatar-size
enum
An avatar's size.
enum avatar-size {
small,
medium,
large,
}
| Case | Description |
|---|---|
small | 20 px. |
medium | 28 px. |
large | 40 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,
}
| Field | Type | Description |
|---|---|---|
name | string | The person's or thing's name ("Ada Lovelace": AL). |
size | avatar-size | Its 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,
}
| Field | Type | Description |
|---|---|---|
at | s64 | The 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,
}
| Field | Type | Description |
|---|---|---|
text | string | The text shown and copied (at most 64 KiB). |
mono | bool | In the monospace font. |
types.link
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>,
}
| Field | Type | Description |
|---|---|---|
label | string | What it says. |
url | option<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>,
}
| Field | Type | Description |
|---|---|---|
name | string | Its name, in the legend and tooltips. |
values | list<f64> | Its values, one per label (a NaN or infinite value is a gap). |
color | option<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,
}
| Field | Type | Description |
|---|---|---|
values | list<f64> | The values, oldest first (at most 1 000). |
color | option<token> | Its colour (none: the text colour). |
filled | bool | The 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>,
}
| Field | Type | Description |
|---|---|---|
labels | list<string> | The labels along the bottom (at most 200). |
series | list<chart-series> | The series (at most 8), each with one value per label. |
stacked | bool | Stack the series in one bar per label. |
unit | option<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>,
}
| Field | Type | Description |
|---|---|---|
labels | list<string> | The labels along the bottom (at most 1 000; Pitwall draws as many as fit). |
series | list<chart-series> | The series (at most 8), each with one value per label. |
unit | option<string> | The values' unit, in the axis and tooltips. |
min | option<f64> | The axis's lowest value (none: from the data, or 0). |
max | option<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,
}
| Field | Type | Description |
|---|---|---|
key | string | Its key, sent in value-changed (choice) when it is clicked. |
label | string | Its tooltip and accessible name ("#412 passed in 3 min"). |
tone | option<tone> | Its colour by meaning (none: neutral, as for a run not started). |
weight | f32 | Its 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>,
}
| Field | Type | Description |
|---|---|---|
segments | list<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>;