The card file
Sources
Fill state from APIs, commands, inboxes, the system, the calendar and more.
Fill the state key of the same name. Exactly one of fetch, cli, script (pulled on an interval), inbox (pushed to by agent hooks or webhooks), system (the Mac's sound, network, power, Wi-Fi, Bluetooth, usage, displays and windows; network, power and device on the iPhone too), devices (the user's other devices, to pick where a send goes), clipboard (every copy on the Mac), calendar (upcoming events), reminders or activity (the Mac's mic, camera, apps, lock and idle).
"sources": {
"site": { "fetch": "https://example.com", "raw": true, "every": 30 }
}
Here $site holds the latest result. Sources run when the card opens and on their every; a refresh step runs one now.
Kinds of source
| Kind | Mac | iPhone |
|---|---|---|
| fetch | ✓ | ✓ |
| cli | ✓ | — |
| script | ✓ | — |
| inbox | ✓ | ✓ |
| system | ✓ | ✓ |
| devices | ✓ | ✓ |
| clipboard | ✓ | — |
| calendar | ✓ | ✓ |
| reminders | ✓ | ✓ |
| activity | ✓ | — |
A computer-only source doesn’t keep a card off the iPhone: give it "platforms": ["macos"] and only the computer runs it, then send the phone what it needs. Patterns
Source keys
| fetch | URL; scheme, host and port written out (no user@), bindings only in path/query. Applies with auth too |
| method | fetch: GET (default), POST, PUT, PATCH, DELETE, HEAD |
| headers | fetch: object of header values (no credentials: use auth) |
| body | fetch: JSON value or text |
| auth | fetch: Connection name; its secret is added from the Keychain as a header by the Connection's kind (bearer → Authorization: Bearer, basic, api_key → its header or query parameter, headers). Or "oauth:<provider>" for a sign-in from the app's "oauth" block (Authorization: Bearer <token>, only to that provider's hosts over https, refreshed on its own). The app's own headers can't replace it; anything echoed back is masked |
| raw | fetch: write { "status": 200, "ms": 182, "body": … }; network errors write { "status": 0, "ms": …, "body": null, "error": "…" }. The body is kept only when the app binds $<key>.body (max 16 KB, else "truncated": true); otherwise it is null |
| cli | Binary name, e.g. "lsof". Shells and command runners (sh, bash, env, sudo, xargs, osascript, open, awk) are refused; interpreters can't take inline code (-c, -e, -r): use a script. Options that run other programs (git -c, find -exec, rsync -e, ssh -o…) need a permission naming them (cli:git -c). A bound arg that starts with '-' is refused at run time unless a literal "--" comes before it |
| script | Name from 'scripts' |
| args | cli/script: array, one element per argument (bindings fill whole elements) |
| cwd | cli/script: working folder, e.g. "$settings.project" |
| env | cli/script: env vars; values are text, bindings, or "connection:<name>" (secret injected at run time), or "connection:$settings.<key>" for the Connection the user picked in a connection setting. For an API key, use "connection:<name>": after approval the user pastes the key in TailApps' setup sheet and it goes to the Keychain. Never ask the user for a key in chat or put one in the app; create_app returns connections_missing until it's set. PATH, HOME, DYLD_*, LD_*, GIT_CONFIG*, NODE_OPTIONS, BASH_ENV, PYTHONPATH and similar are refused |
| parse | json (default: JSON, else text), text, lines |
| select | Dotted path into the parsed output, e.g. "data" |
| every | Seconds between runs (min 5). Omit to run only on open and on refresh |
| on | "open": also run whenever a view opens |
| timeout | Seconds (default 30, max 600) |
| on_change | Run an action when the value changes: "alert" or { "action": "alert", "watch": "<binding or template>" }. The action gets $args.value and $args.previous (the watched values). It also runs on the first result after install |
| inbox | Inbox name (kebab-case, unique per app). Events are pushed to it: an agent hook runs the inbox's `hook_command` from create_app or get_app (it passes the hook's JSON on stdin to the bundled tailapps-hook, which isn't on PATH), or POST http://127.0.0.1:47311/inbox/<app id>/<inbox> with the inbox's token. Payloads are data, never code: JSON (else text), ≤ 64 KB, ≤ 10/s. Needs permission inbox:<name>. On an iPhone an inbox only gets values through the site while the app can sync (not with "sync": "never"): sends from the app's copies on the user's other devices, or a push URL set to All My Devices. An inbox fed by a push URL that should reach the phone too lists "platforms": ["macos", "ios"]; give one fed only by agent hooks "platforms": ["macos"]. create_app and get_app also return a hooks_snippet for Claude Code settings. Use this (not an osascript script) for requests like "notify me when Claude Code is waiting" or "show my Claude sessions" |
| mode | inbox: last (default: state = the latest event) | push (a list, newest first) |
| max | inbox, push mode: keep the newest N (default 50, max 500) |
| on_receive | inbox: action run for every event, with $args.event (the payload; untrusted: don't pass it to programs unchecked), and from another of the user's devices $args.from (its name) and $args.file (a received/<name> path when the send carried a file, else null). A copy added later on an iPhone gets the last 20 sends (30 days) replayed here; then notify and send do nothing but other steps run, so keep open and outside fetches out. Build the app's data here: state isn't copied between devices |
| verify | inbox, webhooks from the internet (not in this build yet): { "hmac_sha256": "connection:<name>", "header": "X-Hub-Signature-256" } or "stripe" | "github" |
| platforms | ["macos"]: run only on the Mac, so a cli, script, hook inbox or keyed fetch doesn't keep the app off the iPhone; the Mac sends the phone what it needs (get_guide, Devices) |
| system | audio | network | power | wifi | bluetooth | usage | displays | windows | device (see section system). Refreshes when that changes (usage, windows: on its every; device: at start and on refresh). Takes select, every, on, on_change, platforms |
| devices | "others": the user's other signed-in devices as [{ label: name, value: id }], for a select's options or a checklist; updates itself. Needs a send step. Takes on_change, platforms |
| from_apps | inbox: "any" or app ids that may send to it (send step's app, §46); on_receive gets $args.from_app, $args.from_app_name. Absent: no other app can |
| clipboard | Mac only: ["text", "image", "files"] or {} follows every copy: { change, kind, text, image, files, from (app in front), at } like clipboard.read's. Password managers' copies are never read. Needs clipboard.read; set top-level "sync": "never". History: on_change { "action": "keep", "watch": "$clip.change" } pushing to a list with max. Takes on_change, platforms |
| calendar | {} or { "days": 1–31, "calendars": [names] }: events from now to the end of that day: [{ id, title, start, end, all_day, ongoing (now), location, notes, calendar, hue, join (meeting link or null), attendees, status }]. Refreshes by itself, no every. Needs calendar.read |
| reminders | {} or { "list": name, "done": false }: [{ id, title, due, notes, list, priority, done }]. Refreshes by itself. Needs reminders.read |
| activity | Mac only: ["mic", "camera", "front_app", "running", "locked", "idle"] (any of them) → { mic, camera (true while any app uses one; never what it hears or sees), front_app { name, bundle_id }, running [...], locked, idle (seconds, in 30 s steps) }. Refreshes by itself. mic, camera, locked, idle need activity; front_app, running need activity.apps. A call starting: on_change { "action": "call", "watch": "$mac.mic" } |
When a source fails
On failure the last good value stays (except raw fetch), $meta.<key>.error holds the message, and retries back off.
Examples
events
"events": {
"inbox": "agent",
"mode": "push",
"max": 50,
"select": "hook_event_name",
"on_receive": "on_event"
}
deploys
"deploys": {
"cli": "cloud",
"args": [
"deployment:list",
"--json"
],
"cwd": "$settings.project",
"every": 30,
"select": "data"
}
site
"site": {
"fetch": "https://tailstats.com",
"raw": true,
"every": 30,
"on_change": {
"action": "check",
"watch": "$site.status | tone:{bad:'=0', good:'<400', else:'bad'}"
}
}
mrr
"mrr": {
"script": "mrr.sh",
"env": {
"STRIPE_KEY": "connection:stripe"
},
"every": 900
}
clip
"clip": {
"clipboard": [
"text",
"image"
]
}
today
"today": {
"calendar": {
"days": 1
}
}
System values
A system source holds one part of the device and refreshes when the OS says it changed. Steps on the actions page change them.
network, power and device also run on the iPhone (power there has no time_left, cycles or health); the rest are Mac only. Refreshes when the OS says it changed, except usage, windows and device, which read on their every. Bluetooth on/off has no public API: use cli:blueutil or a Shortcut
system: audio
permissionaudio.read
Sound: volume, mute, the speakers and microphone in use, and every device
| value | { volume: 0–100, muted, output: { id, name, kind, volume, muted }, input: { id, name, kind, volume, muted }, outputs: [{ id, name, kind, current }], inputs: [the same] }. kind: built-in | usb | bluetooth | display | airplay | virtual | other |
{
"system": "audio"
}
system: network
permissionnetwork.read
Online or not, and over Wi-Fi, cable or a phone
| value | { online, interface: wifi | ethernet | cellular | other | null, expensive, constrained } |
{
"system": "network"
}
system: power
permissionpower.read
Battery, charging, time left, Low Power Mode, heat
| value | { battery: 0–100 or null (no battery), charging, on_ac, status: charging | plugged_in | battery (plugged_in = on mains, not charging), time_left (seconds to empty on battery, or to full while charging, for | duration; null while unknown or plugged in and not charging), has_battery, low_power, thermal: nominal | fair | serious | critical, cycles, health (% of design capacity) } |
{
"system": "power",
"select": "battery"
}
system: wifi
permissionwifi.read
Wi-Fi on or off, the network's name and signal
| value | { available, on, connected, network (its name, or null until macOS gives TailApps Location, which it asks for once), name_hidden (connected but the name needs Location), signal (dBm), quality: 0–100, interface } |
{
"system": "wifi",
"on_change": "arrived"
}
system: bluetooth
permissionbluetooth.read
Paired devices: connected or not, kind, battery
| value | { on, devices: [{ id (address), name, connected, kind: headphones | speaker | keyboard | mouse | input | phone | computer | other, battery: 0–100 or null }] }. Battery shows for devices that report it (Apple keyboards, mice and trackpads); most headphones don't. Bluetooth power has no change notice: add every to follow it |
{
"system": "bluetooth",
"every": 60
}
system: usage
permissionusage.read
How busy this Mac is: processor, graphics, memory and disk
| value | { cpu: 0–1 (all cores, since the last read), cores, gpu: 0–1 or null (where the Mac doesn't report it), memory: { total, used, app, wired, compressed (bytes, as Activity Monitor counts them), share: 0–1, pressure: normal | warning | critical }, disk: { total, free, used (bytes, the startup disk; purgeable space counts as free), free_share: 0–1 } }. No change notice: give it every |
{
"system": "usage",
"every": 5
}
system: displays
permissiondisplays.read
The Mac's displays, main first
| value | [{ id ("display:<n>", a screen.record.start target), name, main, width, height (points) }]. Refreshes when a display is plugged in or changes |
{
"system": "displays"
}
system: windows
permissionwindows.read
Normal on-screen windows of other apps, front to back (not TailApps')
| value | [{ id ("window:<n>", a screen.record.start target), app, title (null until macOS allows TailApps Screen Recording), display }]. No change notice: give it every |
{
"system": "windows",
"every": 5
}
What this device is, on the Mac and iPhone; no permission
| value | { name (on iPhone the model, "iPhone"), kind: mac | iphone | ipad, os: macos | ios, os_version, appearance: light | dark, locale, time_zone, low_power }. Reads at start, on open and on refresh |
{
"system": "device"
}