{
  "schema": "tailapps/v0",
  "catalogue_version": 1,
  "about": "An TailApps app is one JSON document. The runtime renders its cards natively (SwiftUI) and runs its sources and actions. Call validate_app before create_app; every error has a path, a code, a message and usually 'allowed'.",

  "rules": [
    "A part is an object with exactly one kind key, whose value is the main value: { \"stat\": \"$mrr | currency\", \"label\": \"MRR\" }.",
    "A string that starts with $ is a binding: \"$deploys.0.status | upper\". Inside other text, {$…} interpolates: \"Updated {$meta.deploys.updated | ago}\". Write {{ for a literal {, and $$ at the start for a literal $.",
    "State holds raw values. Format at display time with pipes (| currency, | ago, …). Never store formatted strings.",
    "Every cli/script/fetch/capability use must be covered by a string in \"permissions\". If one is missing, validate_app names the exact string to add.",
    "cli takes a bare binary name and an args array, one element per argument. There is no shell: no pipes, globs, && or $VARS. For pipelines, write a script in \"scripts\".",
    "Check a CLI's or API's real output before binding to its fields; don't guess field names.",
    "HTTP without a key (website and uptime checks, public JSON APIs): a fetch source, not curl in a script. For a website check use \"raw\": true: it writes { status, ms } (status 0 when unreachable) and needs only net:<host>, no script approval. Derive up/slow/down with a binding on status and ms; failed checks retry with backoff by themselves.",
    "Secrets never go in the app. fetch uses \"auth\": \"<connection>\" (and still needs net:<host>, so the user sees where the key goes); the Connection's kind decides the header (bearer, basic, api_key, headers). Scripts get env values like \"connection:stripe\".",
    "No raw styling: use tone, size and emphasis tokens. The only colour is style.accent.",
    "Folder, file and connection settings are always picked by the user; reference them as $settings.<key>.",
    "Unknown keys are errors."
  ],

  "top_level": {
    "schema": { "required": true, "description": "Always \"tailapps/v0\"" },
    "app": { "required": true, "description": "Id: kebab-case, 3–40 chars, unique per install", "example": "laravel-cloud" },
    "name": { "required": true, "description": "Display name, at most 40 chars" },
    "description": { "required": false, "description": "One line, shown on the approval sheet (at most 200 chars)" },
    "icon": { "required": false, "description": "SF Symbols name, drawn in white on the app's accent (style.accent). For a custom image, pass icon_image to create_app/update_app: { \"png_base64\": \"…\" } or { \"url\": \"https://…\" } (≤ 1 MB, re-encoded at 256 px); it's not part of the app JSON", "example": "cloud" },
    "version": { "required": false, "description": "Author's version number (whole number)" },
    "requires": { "required": false, "description": "External CLIs the app needs", "example": [{ "cli": "cloud", "install": "composer global require laravel/cloud-cli", "check": ["cloud", "--version"] }] },
    "permissions": { "required": true, "description": "Permission strings (see 'permissions'); may be empty", "example": ["cli:cloud deploy", "notify"] },
    "settings": { "required": false, "description": "Values the user provides at setup (see 'settings')" },
    "state": { "required": false, "description": "Declared state keys (see 'state')" },
    "sources": { "required": false, "description": "Key = the state key it fills (see 'sources')" },
    "scripts": { "required": false, "description": "File name → shell script text, for short scripts; longer ones go in create_app/update_app's files map as \"scripts/<name>.sh\" (one or the other per name). Either way \"script\": \"<name>\" runs scripts/<name> as /bin/sh <file> <args…>, and the user approves the exact text: an edited file doesn't run until reviewed. Scripts and CLIs get PATH, HOME, LANG and TAILAPPS_PID (TailApps' own process id) plus declared env. Apps that list or stop processes must leave out $TAILAPPS_PID: a run whose args contain it is refused", "example": { "ports.sh": "/usr/sbin/lsof -nP -iTCP -sTCP:LISTEN" } },
    "cards": { "required": true, "description": "At least one card: { \"id\": \"main\", \"layout\": <part> }" },
    "actions": { "required": false, "description": "Name → action (see 'actions')" },
    "alarms": { "required": false, "description": "Run an action at a time from state: name → { at: time or list binding, time: each item's ($item), before: seconds early, action } ($args.time, $args.item). iPhone: while open", "example": { "heads_up": { "at": "$today", "time": "$item.start", "before": 120, "action": "warn" } } },
    "views": { "required": false, "description": "Where the app shows (see 'views'). Default: a menubar view of the first card" },
    "shortcuts": { "required": false, "description": "Keyboard shortcuts (see 'shortcuts')" },
    "style": { "required": false, "description": "{ \"accent\": \"#2f6fed\", \"density\": \"compact\" | \"comfortable\" }" },
    "sync": { "required": false, "description": "\"allowed\" (default) or \"never\". Whether the user may turn on Sync to My Devices for this app (SPEC §38). \"never\" hides the switch and rules out 'send' steps: use it for apps holding sensitive data, like clipboard history" },
    "on_sync": { "required": false, "description": "SPEC §66: an action to run after synced state (state keys with \"sync\": true) arrives from another device, e.g. to schedule this device's own notifications for a timer started elsewhere. $args.keys (the keys that changed), $args.previous (each one's value before, e.g. to cancel the notification of a timer removed elsewhere), $args.from (the device's name), $args.replay (true while a copy just added catches up). In this run, send steps send nothing and writes to synced keys stay on this device", "example": "reschedule" },
    "copy_of": { "required": false, "description": "Set by TailApps on a named copy: the id it was copied from; not for authors" },
    "oauth": { "required": false, "description": "Sign in with a provider instead of an API key (SPEC §63). { \"<provider>\": { name, authorize, token, client_id, scope?, hosts, redirect?, params? } }, at most 3. OAuth authorization code with PKCE: no client secret ever (providers that need one, like GitHub OAuth apps, Notion or Slack, aren't supported yet). client_id is the provider's public client id, or \"$settings.<key>\" of a text setting. hosts are the only hosts the token goes to; each, and the token URL's host, needs net:<host>. scope is the provider's own scope string (Linear: \"read,write\"). redirect: \"relay\" (default: register https://tailapps.com/oauth/callback with the provider) or \"app\" (tailapps://oauth/callback). Until the person signs in on the card, the card shows Sign in with <name> and nothing runs; it works on the Mac and the iPhone, and each device signs in itself. Use it with a fetch: \"auth\": \"oauth:<provider>\"", "example": {"linear": {"name": "Linear", "authorize": "https://linear.app/oauth/authorize", "token": "https://api.linear.app/oauth/token", "client_id": "$settings.client_id", "scope": "read", "hosts": ["api.linear.app"]}} }
  },

  "bindings": {
    "roots": {
      "$<state key>": "A declared state key, or a source's key",
      "$settings.<key>": "A setting value",
      "$item, $index": "The current element and its position, inside list 'item', table 'columns' and checklist templates",
      "$args.<name>": "An action's arg (declared in its 'args'); on_change actions get $args.value and $args.previous; gallery on_select actions get $args.item",
      "$<as name>": "The result of an earlier step in the same action",
      "$meta.<source>.updated|error|status": "Unix time of the last good run, the last error message, or 'idle' | 'running' | 'ok' | 'error'",
      "$running.<action>": "true while that action runs (use for 'disabled')",
      "$job.<action>": "a job action's { status, progress, done, total, started, ended, error }",
      "$now": "Current unix time in seconds. A card that shows it redraws each minute (each second with time:…:'seconds', duration or ago)",
      "$ui.<name>": "show_ui only: values from fields and checklists"
    },
    "paths": "Dotted; numeric segments index arrays: $deploys.0.status. A missing path is null.",
    "pipes": "$value | name or $value | name:arg1:arg2. Args: numbers, 'single-quoted text', true, false, null, or {key:'value', other:2} (keys unquoted or single-quoted). add, times, pick, currency, time, offset, hour and default also take a $binding with no formatters: time:$item.tz.",
    "templates": "Values interpolate as plain text (null → empty). Use a formatter for display: {$x | number}.",
    "truthiness": "For when, if and disabled: null, false, 0, \"\" and empty lists are false."
  },

  "formatters": {
    "number": { "description": "Locale number with grouping", "args": ["decimals (optional)"], "example": "$visits | number", "output": "18,234" },
    "compact": { "description": "Short number", "args": [], "example": "$visits | compact", "output": "18.2k" },
    "currency": { "description": "Money in major units (dollars, not cents); 0 decimals unless 'full'", "args": ["ISO code or $binding (default 'USD')", "'full' for 2 decimals"], "example": "$mrr | currency:'EUR'", "output": "€4,820" },
    "percent": { "description": "0.062 → 6.2%", "args": ["decimals (default 1)"], "example": "$churn | percent", "output": "6.2%" },
    "delta": { "description": "Signed change with an arrow", "args": ["decimals (default 1)"], "example": "$change | delta", "output": "▲ 6.2%" },
    "duration": { "description": "Seconds → largest two units; 'signed' puts + before a positive one; 'clock' gives 4:30 or 01:30:00", "args": ["'signed' | 'clock' (optional)"], "example": "$uptime | duration", "output": "1m 12s" },
    "ago": { "description": "Unix seconds (or ms), or ISO 8601 text → relative time", "args": [], "example": "$item.created_at | ago", "output": "4 min. ago" },
    "until": { "description": "Time left until a time; live in a status label (0 → empty). In cards use timer", "args": ["'clock' (default, 4:05) | 'short' (12m)"], "example": "$ends_at | until", "output": "12:05" },
    "date": { "description": "Timestamp → locale date; 'day' is weekday, month and day (Tue, Nov 24). A zone second gives the day it is there", "args": ["'short' | 'medium' (default) | 'long' | 'day'", "zone: IANA name, 'local' or $binding (default: this device)"], "example": "$now | date:'day':$item.tz", "output": "Tue, Nov 24" },
    "bytes": { "description": "Byte count → size", "args": [], "example": "$size | bytes", "output": "1.5 MB" },
    "truncate": { "description": "Shorten with …", "args": ["max characters (default 40)"], "example": "$item.commit_message | truncate:40", "output": "Fix the deploy…" },
    "upper": { "description": "Uppercase", "args": [], "example": "$status | upper", "output": "LIVE" },
    "lower": { "description": "Lowercase", "args": [], "example": "$status | lower", "output": "live" },
    "map": { "description": "Value → mapped value. Keys match text, numbers (200), true, false or null; 'else' is the fallback; no match and no else keeps the value", "args": ["{key:'value', …, else:'…'}"], "example": "$item.status | map:{finished:'Live', failed:'Failed', else:'Deploying'}", "output": "Live" },
    "tone": { "description": "Value → a tone. No arg: sign of a number (+ good, − bad, 0 neutral). Thresholds, checked in order: {good:'<300', warn:'<800', else:'bad'} (operators < <= > >= = !=; join with ' or ': '<7 or >=23'). Or a map to tones: {finished:'good', failed:'bad', else:'accent'}", "args": ["optional object"], "example": "$site.ms | tone:{good:'<300', warn:'<800', else:'bad'}", "output": "good" },
    "default": { "description": "null, \"\" or [] → the given text", "args": ["text (default '—')"], "example": "$lastText | default:'Nothing yet'", "output": "Nothing yet" },
    "hue": { "description": "Value → a categorical colour name. No arg: a stable hue from the text, the same on every device. Or a map: {design:'pink', eng:'blue', else:'gray'}", "args": ["optional object"], "example": "$item.team | hue", "output": "teal" },
    "count": { "description": "Length of a list or text (null → 0)", "args": [], "example": "{$ports | count} listening", "output": "3 listening" },
    "add": { "description": "Number + a number or binding, e.g. a time shifted by a slider", "args": ["number or $binding"], "example": "$now | add:$shift", "output": "1763687580" },
    "time": { "description": "A time → time of day in a zone (device's 12/24 h style). Cards using it with $now tick by themselves", "args": ["zone: IANA name, 'local' or $binding (default: this device)", "'seconds' (optional)"], "example": "$now | time:$item.tz", "output": "16:13" },
    "offset": { "description": "A time → how far a zone is ahead of this device then (or of a second zone), DST included", "args": ["zone (required)", "from zone (optional)"], "example": "$now | offset:$item.tz", "output": "-9h" },
    "hour": { "description": "A time → the hour of day in a zone as a number (16.25 = 16:15), for tone thresholds", "args": ["zone (default: this device)"], "example": "$now | hour:$item.tz", "output": "16.25" },
    "zone": { "description": "A time → a zone's own name then: its short name in the card's locale (PST, BST, GMT+9; DST included), its city from the IANA name, or its long name. zone:'local':'city' is where this device is", "args": ["zone: IANA name, 'local' or $binding (default: this device)", "'short' (default) | 'city' | 'name'"], "example": "$now | zone:$item.tz", "output": "GMT+9" },
    "flag": { "description": "Two-letter country code → flag emoji (an icon takes it)", "args": [], "example": "$item.country_code | flag", "output": "🇵🇱" },
    "url": { "description": "Text made safe inside a URL (percent-encoded), for a fetch URL built from input", "args": [], "example": "https://api.example.com/search?q={$args.value | url}", "output": "…?q=San%20Jos%C3%A9" },
    "where": { "description": "The items of a list that pass: 'done' keeps items whose done is true; {done:false} keeps items whose fields equal these (true/false compare truthiness, so a missing done is false); 'id':$params.id keeps items whose field equals a value or binding (a detail card finding its item). Chain count to count them, pick:0 for the first", "args": ["field name, or {field:value, …}, or a field name and a value or binding"], "example": "{$todos | where:{done:false} | count} left", "output": "3 left" },
    "share": { "description": "The part of a list that passes (as where), 0…1: for a progress bar. An empty list is 0", "args": ["field name, or {field:value, …}, or a field name and a value or binding"], "example": "$todos | share:'done'", "output": "0.6" },
    "times": { "description": "Number × a number or binding, e.g. an exchange rate × the amount; null when the argument isn't a number", "args": ["number or $binding"], "example": "$rates.rates | pick:$to | times:$amount", "output": "92.43" },
    "pick": { "description": "An object's field (or a list's element) named by the argument; missing → null", "args": ["key text, list position or $binding"], "example": "$rates.rates | pick:$to", "output": "0.924" },
    "encode": { "description": "Text → Base64, URL-safe Base64, hex, or escaped for a Wi-Fi / vCard QR code (for URLs use url)", "args": ["'base64' | 'base64url' | 'hex' | 'wifi' | 'vcard'"], "example": "$input | encode:'base64'", "output": "aGk=" },
    "decode": { "description": "Base64 (either kind), hex or percent-encoded text (+ stays +) → text; null when it isn't valid, so add default", "args": ["'base64' | 'hex' | 'url'"], "example": "$input | decode:'base64' | default:'Not Base64'", "output": "hi" },
    "hash": { "description": "Digest of the text as lowercase hex (sha1 and md5 only for checksums)", "args": ["'sha256' (default) | 'sha1' | 'md5' | 'sha512'"], "example": "$input | hash:'sha256'", "output": "8f43…" },
    "seconds": { "description": "Typed length → seconds: '4:30', '25' (minutes), '1h 30m', 'tea 10 min'; 'rest' gives the other words ('tea')", "args": ["'rest' (optional)"], "example": "$entry | seconds", "output": "270" },
    "sum": { "description": "Total of a list's numbers, or of one field of each item; non-numbers skipped, empty → 0", "args": ["field (optional)"], "example": "$expenses | sum:'amount' | currency", "output": "$1,240" },
    "avg": { "description": "Mean of a list's numbers (or a field); none → null", "args": ["field (optional)"], "example": "$runs | avg:'ms' | round", "output": "182" },
    "min": { "description": "Smallest number in a list (or a field); none → null", "args": ["field (optional)"], "example": "$prices | min:'eur' | currency:'EUR'", "output": "€12" },
    "max": { "description": "Largest number in a list (or a field); none → null", "args": ["field (optional)"], "example": "$runs | max:'ms' | number", "output": "3,120" },
    "sort": { "description": "Sorted list: numbers by value, text A–Z ignoring case, null last. '-' largest first; 'field' / '-field' sorts items by a field", "args": ["'field', '-field' or '-' (optional)"], "example": "$runs | sort:'-ms' | limit:5", "output": "the 5 slowest runs" },
    "limit": { "description": "First n items (negative: last n), or first n characters", "args": ["whole number, not 0"], "example": "$log | limit:-3", "output": "the last 3 entries" },
    "pluck": { "description": "List of objects → list of one field", "args": ["field"], "example": "$people | pluck:'name' | join", "output": "Anna, Ben, Cara" },
    "unique": { "description": "List without repeats (the first of each kept)", "args": [], "example": "$expenses | pluck:'category' | unique | join", "output": "Food, Travel" },
    "join": { "description": "List → text with a separator (default ', '); null items skipped", "args": ["separator (optional)"], "example": "$tags | join:' · '", "output": "work · home" },
    "split": { "description": "Text → list of trimmed, non-empty pieces (default: split on line breaks)", "args": ["separator (optional)"], "example": "$line | split:','", "output": "[\"a\", \"b\"]" },
    "round": { "description": "Number rounded to n decimals (default 0); stays a number, so tone still works", "args": ["decimals (optional)"], "example": "$temp | round:1", "output": "21.4" }
  },

  "tokens": {
    "tone": ["good", "warn", "bad", "accent", "neutral"],
    "hue": ["red", "orange", "yellow", "green", "mint", "teal", "cyan", "blue", "indigo", "purple", "pink", "brown", "gray"],
    "size": ["xs", "s", "m", "l", "xl"],
    "emphasis": ["subtle", "normal", "strong"],
    "gap": ["xs", "s", "m", "l"],
    "align": ["start", "center", "end", "stretch"],
    "justify": ["start", "center", "end", "between"],
    "width": ["narrow", "default", "wide"],
    "density": ["compact", "comfortable"],
    "note": "tone, size and emphasis may also be bindings: \"tone\": \"$change | tone\". Widths: narrow = popovers (≈340 pt), default = floating panels (≥420 pt), wide = panels ≥720 pt."
  },

  "layout": {
    "containers": {
      "row": { "description": "Children side by side", "props": ["gap", "align", "justify", "wrap", "overlap", "limit"], "example": { "row": [{ "text": "Left" }, { "spacer": true }, { "badge": "Right" }], "align": "center" } },
      "column": { "description": "Children stacked", "props": ["gap", "align", "justify", "style", "hue"], "example": { "column": [{ "text": "One" }, { "text": "Two" }], "gap": "m" } },
      "grid": { "description": "Children in equal columns; span: N on a child takes N cells. Buttons fill their cell, so a grid of buttons is a keypad", "props": ["gap", "align", "justify", "columns"], "example": { "grid": [{ "stat": "$a", "label": "A" }, { "stat": "$b", "label": "B" }], "columns": { "default": 3, "narrow": 1 } } }
    },
    "props": {
      "gap": "Space between children: xs, s, m, l",
      "align": "Cross-axis alignment: start, center, end, stretch",
      "justify": "Main-axis distribution: start, center, end, between",
      "wrap": "Row only: wrap children onto new lines (bool)", "overlap": "Row only: children overlap slightly, for a stack of avatars (bool)", "limit": "Row with overlap only: show this many, then +N",
      "columns": "Grid only: a number (1–6), \"auto:s\" (min column width token), or { \"default\": 3, \"narrow\": 1, \"wide\": 4 }",
      "style": "Column only: inset = one rounded group, hairlines between parts; a list inside adds its rows to the group. tile = a rounded tile filled with hue (default: the accent), its parts drawn light on it: coloured cards in a list (timers, rooms, projects)",
      "hue": "Column with style tile only: the tile's fill, a hue token or binding like \"$item.hue\""
    },
    "child_props": {
      "when": "Binding; the part is hidden when falsy",
      "grow": "true: takes spare space in a row",
      "span": "Grid child: number of columns to span",
      "platforms": "[\"macos\"] or [\"ios\"]: the part shows only there (default: everywhere). For one or two parts; when a card fills up with them, give the phone its own card with views.phone",
      "context_menu": "Actions on a right-click (Mac) or long press (iPhone): [{ \"label\": \"Copy link\", \"icon\": \"link\", \"on\": \"copy\", \"args\": { … }, \"style\": \"destructive\" }], 1–12 items. In a list's item template it's per row, with $item",
      "drag": "Mac: drag the part out of the card into Finder or any app, as a copy: a file the app may read (\"$item.path\": its captures, files dropped or picked for it, or in a folder the user chose), several ({ \"files\": \"$tray\" }, up to 100) or { \"text\": \"$item.text\" }",
      "on_dragged": "with drag: action run once a receiver takes the copy (not for a drag let go over nothing), with $args.item (the row's item, else what was dragged), e.g. to clear a tray"
    },
    "max_depth": "At most 4 nested containers (row, column, grid and list item templates each count as one)."
  },

  "components": {
    "text": { "description": "Text", "main": "text or binding", "props": { "size": "token, or xxl: display digits (48 pt on Mac) on one line that shrink to fit, or fill: one line as big as the space allows (grows with a pop-out window)", "tone": "token", "emphasis": "token", "lines": "max lines (1–20)", "mono": "bool", "markdown": "bool: inline Markdown (bold, italic, code, strike, links that need open:url) and inline icons {icon:name} or {icon:name:hue}" }, "example": { "text": "Updated {$meta.deploys.updated | ago}", "size": "s", "emphasis": "subtle" } },
    "stat": { "description": "A big number with a label", "main": "value binding", "props": { "label": "text", "size": "token (default l), or xxl: display digits that shrink to fit, or fill: as big as the space allows", "tone": "token", "hue": "hue token (a categorical colour, for what isn't good or bad)" }, "example": { "stat": "$mrr | currency", "label": "MRR", "size": "xl" } },
    "badge": { "description": "A small coloured label", "main": "text or binding", "props": { "tone": "token", "hue": "hue token (a categorical colour, for what isn't good or bad)", "busy": "bool or binding: a small turning ring before the text while something is working, e.g. \"$running.deploy\" or \"$job.state | map:{running:true, else:false}\"" }, "example": { "badge": "$status | map:{ok:'Up', else:'Down'}", "tone": "$status | tone:{ok:'good', else:'bad'}" } },
    "image": { "description": "One image: a local file (screenshots, saved files), one of the app's own files (\"assets/logo.png\", sent in create_app files), or an https URL on a host declared as net:<host> (at most 5 MB, no cookies or keys, not in show_ui). GIF, animated PNG and animated WebP play while on screen (not under Reduce Motion or Low Power Mode)", "main": "local file path, assets/<name>, or https URL (binding)", "props": { "height": "size token", "fit": "fit | fill", "width": "size token: a fixed width (default: as wide as the picture at this height)", "shape": "rounded | circle (a round crop, height across)", "alt": "text screen readers say; without it the image is decoration", "on_select": "action name; it gets $args.image (the path or URL shown)", "preview": "bool: a click shows it larger (not with on_select)" }, "example": { "image": "assets/logo.gif", "height": "m", "alt": "Logo", "preview": true } },
    "gallery": { "description": "Thumbnails of images (local paths, assets/<name> or https URLs, as on image), in a grid that wraps", "main": "list binding: image paths, or objects with an image path (see image)", "props": { "limit": "max items", "height": "size token", "on_select": "action name; it gets $args.item (the whole item)", "thumb": "each item's image path when items are objects, e.g. \"$item.thumb\" (default: the item itself). Lets a shot keep its link: push { thumb, url } and copy $args.item.url on select", "preview": "bool: a click shows that image larger (not with on_select)", "selected": "rings the picked picture, as on cell: { \"value\": \"$item.id\", \"is\": \"$bg\" } (with on_select setting $bg)" }, "example": { "gallery": "$shots", "limit": 3, "thumb": "$item.thumb", "on_select": "copy_shot" } },
    "avatar": {"description": "A round picture of someone: their image, else initials on a hue from their name", "main": "local image path or https URL (binding; see image), or null for initials only", "props": {"name": "text: the initials, and what screen readers say. Required without an image", "size": "token", "hue": "hue token (default: a stable hue from name)", "status": "tone token: a small dot"}, "example": {"avatar": null, "name": "$item.name", "status": "$item.online | map:{true:'good', else:'neutral'}"}},
    "message": {"description": "One message in a conversation: a bubble aligned by from. Use as a list's item with scroll: end. Plain text, or inline Markdown and icons with markdown: true; web addresses become links in an app that holds open:url. Bound text's links must show their own address. With style: note it is a note instead: full width on a soft fill, with an optional title, for notes, journals and comments", "main": "text or binding", "props": {"from": "me | them | system (default them; may be a binding)", "name": "text, shown over messages that aren't yours", "avatar": "image path or https URL (see image), or null for initials from name", "media": "a picture in the bubble (see image: local path, assets/<name> or https URL; GIFs play), or null. A click shows it larger. With media, message may be \"\" or null for no caption", "time": "text or binding, e.g. \"$item.at | ago\"", "status": "text, e.g. sent", "tone": "tone token, tints the bubble", "markdown": "bool: inline Markdown and {icon:name:hue}, as on text; lines starting #, - , 1. , - [ ] or > draw as headings, bullets, numbered items, tick-box lines and quotes", "style": "bubble (default) | note", "title": "note only: a bold line over the text", "lines": "show at most this many lines (1–40), e.g. 3 for a note's preview", "hue": "note only: hue token that tints the note (tone works too)", "on": "note only: action a click on the note runs, e.g. open it to edit", "args": "note only, with on: the action's args"}, "example": {"message": "$item.text", "from": "$item.mine | map:{true:'me', else:'them'}", "name": "$item.sender", "avatar": null, "time": "$item.at | ago"}},
    "icon": {"description": "An SF Symbols name or one emoji. An unknown name shows a plain circle", "main": "name or emoji (binding)", "props": {"size": "token", "tone": "token", "hue": "hue token"}, "example": {"icon": "checkmark.seal", "tone": "good"}},
    "progress": {"description": "How far through something, as a bar, ring or row of ticks, in equal pieces with split; or parts of a whole (a breakdown) on a bar or a ring", "main": "0…1 number (binding), null for indeterminate, or a list of { value, hue, label } for a breakdown", "props": {"label": "text", "tone": "token", "style": "bar | ring | segmented (a breakdown: bar, segmented or ring, a donut)", "size": "token (ring diameter, segmented height, bar thickness)", "scale": "2–5 hues coloured by position, e.g. [\"red\", \"yellow\", \"green\"]; wins over tone", "max": "breakdown only: the whole (default: the sum)", "from": "a time: progress is then an end time, and it fills by itself from from to it, live", "percent": "bool: write the share out (42%): beside the bar, inside the ring, after each legend label of a breakdown", "split": "2–50 or a binding (\"$todos | count\"): a bar or ring in that many equal pieces, e.g. 3 of 5 steps"}, "example": {"progress": "$item.done", "label": "Uploading", "style": "bar"}},
    "gauge": {"description": "How full or how hot: a half ring, or a dial of ticks; or where a value sits in a range, as a dot on a line", "main": "number (binding)", "props": {"min": "number or binding (default 0)", "max": "number or binding (default 1)", "label": "text", "tone": "token, often a binding with thresholds", "size": "token", "style": "arc | ticks | line (a flat track with a dot at the value and no number: where something is in a range, like the time of day)", "scale": "2–5 hues coloured by position, e.g. [\"blue\", \"green\", \"yellow\"]; wins over tone", "unit": "text drawn small after the number (default % for the 0–1 range)", "band": "line only: [from, to] (numbers or bindings), a stretch of the track drawn stronger, e.g. working hours [9, 18] on min 0 max 24; from above to wraps round the end"}, "example": {"gauge": "$item.cpu", "label": "CPU", "tone": "$item.cpu | tone:{good:'<0.7', else:'bad'}"}},
    "timer": {"description": "A live clock: time since something (counting up) or until it (counting down), redrawn every second while it shows. It never writes state or re-runs sources", "main": "a time: unix seconds or milliseconds, or ISO text (binding). Null shows a dash", "props": {"mode": "since (default, counts up) | until (counts down, stops at 0)", "format": "clock (default: 4:05, 01:12:05) | short (12m, 1h 12m)", "on_end": "action run once when an until countdown reaches 0, whether or not the card shows (Mac; not inside a list template). For an alarm that rings with the app closed, schedule a notify with at", "tone": "token or binding", "size": "token, or xxl: display digits that shrink to fit, or fill: as big as the space allows"}, "example": {"timer": "$item.started_at", "format": "short"}},
    "heatmap": {"description": "A grid of days, one column per week, darker for higher values: habits, commits, sales by day. The newest week is on the right", "main": "list binding of { date, value } (date unix or ISO; value a number, or true/false; no value counts 1). Several items on one day add up", "props": {"days": "how many days back (7–371, default 91)", "max": "number or binding: the value that draws darkest (default: the highest shown)", "hue": "hue token (default: the app accent)", "start": "monday | sunday (default: the device's week start)", "on_select": "action run when a day is clicked: gets $args.date (unix seconds, the day's start) and $args.value"}, "example": {"heatmap": "$daily", "days": 91, "hue": "green"}},
    "calendar": {"description": "Events on a month grid, as an agenda (the next days, a row per event; fits a menu-bar card), on a day or week of hours with events as blocks placed by time, or as a year of 12 small months with each day shaded by how many events it has. The user moves with ‹ › and Today, and switches between 'views', which change only what shows, never state. The app sends the events (a calendar source's list as it is)", "main": "list binding of events { start, end?, title?, hue?, all_day?, location?, note? } (times unix or ISO; note may be notes or description; a date with no time, or a { date, label?, hue? } entry, is all day; an all-day end is the day after the last day)", "props": {"view": "month (default) | agenda | day | week | year, or a binding to one", "views": "list of two or more views the user can switch between, e.g. [\"agenda\", \"week\", \"month\"]: a segmented control; the user's pick is remembered per app", "date": "binding: the day in focus (default: today); ‹ › move by a month, by 'days' in agenda, a day, a week, or a year", "days": "agenda: how many days to show (1–60, default 7)", "hours": "day and week: { \"from\": 8, \"to\": 20 } (default), whole hours; events outside show pinned to the top or bottom edge", "work_week": "week: true shows only the days that aren't the weekend (Monday to Friday in most places)", "limit": "agenda: most events shown (1–200, default 20)", "marks": "month: dot (default) | fill", "hue": "hue token for events without their own hue (default: the app's accent)", "on_select": "agenda, day and week: action run for an event; it gets $args.item (the event as the app sent it)", "quick": "true (default) opens a small popover with the event's time, location and note, and an on_select button; false runs on_select straight away", "select_label": "text of the popover's on_select button (default \"Open\")", "on_day": "month and year: action run when a day is clicked (in year a month's name opens that month when views has month, and so does a day when there's no on_day); day and week: when an empty hour is clicked. Gets $args.date (unix seconds: the day's or the hour's start) and $args.items (that day's events)"}, "example": {"calendar": "$meetings", "views": ["agenda", "week", "month"], "hours": {"from": 9, "to": 18}, "on_select": "join", "select_label": "Join"}},
    "steps": {"description": "Steps in order with a state each: CI jobs, a deal or hiring stage, onboarding. Vertical by default; horizontal turns vertical when it doesn't fit", "main": "list binding: one item per step", "props": {"label": "template using $item: each step's name (default: $item.label, $item.name or $item.title; or the item when it's text)", "state": "template using $item that gives done | active | failed | skipped | pending (default: $item.state; anything else shows as pending). Map other words with the map formatter, e.g. \"$item.conclusion | map:{success:'done', failure:'failed', else:'pending'}\"", "note": "template using $item: a smaller line under the step, e.g. a duration (default: $item.note)", "direction": "vertical (default) | horizontal", "on_select": "action name; it gets $args.item (the whole step)"}, "example": {"steps": "$jobs", "label": "$item.name", "state": "$item.result | map:{passed:'done', failed:'failed', running:'active', else:'pending'}", "direction": "horizontal"}},
    "map": {"description": "A map with markers and an optional route line (Apple Maps). No permission: it only draws the places it's given and never reads where the device is", "main": "list binding of markers { lat, lng, label?, icon?, hue? } (icon: an SF Symbols name; hue: a hue token)", "props": {"height": "size token (default l)", "center": "{ lat, lng } (numbers or bindings), or a binding to such a place, to centre on (default: fit every marker and the route, following new positions until the user moves the map)", "radius": "km from center to the map's edge (0.05–10000, default 2.5)", "route": "list binding of { lat, lng }: drawn as a line in order, e.g. a delivery's path", "on_select": "action name; it gets $args.item (the clicked marker)"}, "example": {"map": "$drivers", "height": "l", "route": "$path"}},
    "code": {"description": "A block of fixed-width text: selectable, not wrapped", "main": "text or binding", "props": {"lang": "hint only, not highlighted", "diff": "bool: colours + and - lines", "lines": "max lines before it scrolls", "copy": "bool, default true: a copy button. It copies the whole text, and reads Copy all N lines when lines are hidden"}, "example": {"code": "$item.log", "lines": 8}},
    "qr": {"description": "A QR code, made on this device", "main": "text or binding", "props": {"size": "size token", "label": "text"}, "example": {"qr": "$item.link", "label": "Scan to open"}},
    "section": {"description": "A titled block of parts, optionally collapsible. Counts toward the 4-deep nesting limit", "main": "title text", "props": {"children": "array of parts (required)", "collapsible": "bool", "collapsed": "bool or binding: starts closed; the user's choice is remembered per app", "trailing": "one part on the title row, like a badge or button"}, "example": {"section": "Details", "collapsible": true, "children": [{"text": "$item.note"}], "trailing": {"badge": "$item.count"}}},
    "menu": {"description": "A button that opens a native menu of actions", "main": "label", "props": {"items": "[{ \"label\": \"Copy\", \"on\": \"copy\", \"args\": {…}, \"style\": \"destructive\", \"confirm\": \"Sure?\" }], or a list binding with item", "item": "with a list binding: the same object, using $item", "icon": "SF Symbols name", "disabled": "binding", "icon_only": "bool: show only the icon; the label is what VoiceOver reads and the tooltip says (e.g. a ⋯ menu)", "on": "action a click on the label runs: a split button, the arrow beside it opens the menu", "args": "with on: the action's args", "layout": "stacked: the icon above the label, filling its grid cell (needs icon)"}, "example": {"menu": "More", "icon": "ellipsis", "icon_only": true, "items": [{"label": "Copy", "on": "copy_shot"}]}},
    "list": { "description": "Repeats a part template for each element", "main": "list binding", "props": { "item": "part template using $item and $index (required)", "limit": "max items", "empty": "text when the list is empty", "scroll": "end: start at the last row, and stay there as rows arrive if already at the bottom; limit then keeps the last rows. For lists kept oldest first", "height": "fill: take the window's height in a pop-out; elsewhere the usual cap applies", "group": "template for a section key, using $item: a header row appears whenever it changes", "style": "timeline: each row gets a dot and a line down to the next, for schedules and activity feeds", "swipe": "row actions: { \"leading\": [{ \"label\": \"Done\", \"icon\": \"checkmark\", \"hue\": \"green\", \"on\": \"complete\" }], \"trailing\": [{ \"label\": \"Delete\", \"icon\": \"trash\", \"style\": \"destructive\", \"on\": \"remove\" }] }, up to 3 a side. Each action gets $args.item and $args.index (its place in the whole list) without declaring them, plus its own args; use match on an id to change or remove it. A sideways swipe on iPhone; on the Mac (and for VoiceOver) the same actions are in the row's right-click menu", "refresh": "a source name: on iPhone, pulling the card down refreshes it (the Mac has ⋯ › Refresh)" }, "example": { "list": "$deploys", "limit": 5, "empty": "No deploys", "item": { "row": [{ "text": "$item.name", "grow": true }, { "badge": "$item.status" }] } } },
    "table": { "description": "Rows and text columns (no buttons; use a list of rows for per-row buttons)", "main": "list binding", "props": { "columns": "[{ \"label\": \"Port\", \"value\": \"$item.port\", \"mono\": true }] (required)", "limit": "max rows", "empty": "text when the list is empty" }, "example": { "table": "$ports", "columns": [{ "label": "Port", "value": "$item.port", "mono": true }, { "label": "Process", "value": "$item.command" }] } },
    "player": { "description": "Plays a video or audio file with the system's controls (nothing plays until the user presses play). A file that's gone (temporary files last a day) shows \"This clip is gone\". On the Mac, \"camera\" shows the camera live instead (nothing recorded; needs the camera permission): a card that's just a round one pops out as a round camera bubble that screen recordings keep in", "main": "a file path a step gave, usually \"$clip.path\" from camera.take, or a received file; or \"camera\" / \"camera:<name>\" for this Mac's camera, live", "props": { "height": "size token (default l)", "shape": "rounded (default) or circle; live camera only" }, "example": { "player": "$path", "height": "l" } },
    "chart": { "description": "A small chart", "main": "list of numbers or [{label, value}]", "props": { "kind": "bar | line | spark (no axes, small, fits in a row beside a stat)", "height": "size token", "tone": "token", "hue": "hue token (a categorical colour, for what isn't good or bad)" }, "example": { "chart": "$daily", "kind": "bar" } },
    "button": { "description": "Runs an action (apps) or answers (show_ui). As wide as its label; it fills a grid cell, or the row with grow: true", "main": "label", "props": { "on": "action name (apps)", "args": "object of values for the action's args", "style": "primary (accent fill: the main action) | secondary (neutral grey) | destructive (red) | plain (text); none = tinted", "size": "s | m | l (l: big touch key, e.g. a keypad)", "confirm": "confirmation text", "disabled": "binding", "submit": "answer id (show_ui only)", "keys": "in-app shortcut like \"mod+r\"", "show_keys": "bool: draw keys as keycaps beside the label (default true in a card footer)", "icon": "SF Symbols name shown before the label", "icon_only": "bool: show only the icon; the label is what VoiceOver reads and the tooltip says (needs icon)", "layout": "stacked: the icon above the label, filling its grid cell (a 2 × 2 grid of big choices; needs icon)", "popover": "an array of parts (fields, galleries, buttons…): a click opens them in a small panel by the button (a half-height sheet on iPhone), in the card's own scope so bind works; instead of on. Not in show_ui" }, "example": { "button": "Kill", "on": "kill", "args": { "port": "$item.port" }, "style": "destructive" } },
    "field": {"description": "A native input (§42) bound to state or $ui, or showing a value with on_change", "main": "label", "props": {"type": "text | search | textarea | number | stepper | toggle | slider | select | segmented | date | time | color. Stores: text, number, true/false, the option's value, unix seconds (date), \"HH:MM\" (time), a hue name (color)", "bind": "state key like \"$query\" or \"$ui.name\" (this or value)", "value": "apps: a binding the field shows but doesn't write, e.g. \"$sound.volume\"; needs on_change", "on_change": "action run when the user changes it, with $args.value and $args.previous (undeclared). Slider: on release, or while dragging with live; text: 0.5 s after typing stops. Not in show_ui", "disabled": "binding", "options": "select and segmented: strings, or { label, value, icon? } (icon: segmented), or a binding", "min": "slider (required), stepper, date (unix seconds or a binding)", "max": "same as min", "step": "slider, stepper (default 1)", "time": "date: bool, also pick a time", "style": "toggle: switch (default) | checkbox (the Mac's own; a square tick box on iPhone) | check (a round tick box everywhere); date: compact (default) | graphical", "live": "slider: run on_change while dragging", "format": "slider, stepper: one formatter for the shown value, e.g. \"percent\"", "unit": "slider, stepper: text after the number, e.g. \"°C\"", "placeholder": "text", "on_submit": "text, search, textarea: action with no args run by Return (⌘Return in a textarea). Skipped while it's running"}, "example": {"field": "Volume", "type": "slider", "value": "$sound.volume", "min": 0, "max": 100, "unit": "%", "on_change": "set_volume"}},
    "checklist": { "description": "Tickable rows; bind receives the ticked values", "main": "list binding", "props": { "label": "template per row", "bind": "where ticked values go (required)", "value": "template for each stored value", "note": "template, e.g. a warning", "default_checked": "binding or bool per row" }, "example": { "checklist": "$pending", "label": "$item.name", "value": "$item.name", "bind": "$ui.selected" } },
    "link": { "description": "Opens a web or mail link (https://, http://, mailto:; needs open:url)", "main": "label", "props": { "url": "URL binding (required)" }, "example": { "link": "Open dashboard", "url": "https://cloud.laravel.com" } },
    "divider": { "description": "A horizontal rule", "main": "true", "props": {}, "example": { "divider": true } },
    "spacer": { "description": "Flexible space in a row", "main": "true", "props": {}, "example": { "spacer": true } },
    "cell": {"description": "A ready-made row (icon, title, subtitle, status dot, count, chevron); use it instead of hand-built rows. With check and on_check it is a to-do row", "main": "title text", "props": {"subtitle": "text under the title, muted", "leading": "an SF Symbols name (accent colour), or one part like { \"icon\": \"wifi\", \"hue\": \"green\" } or { \"avatar\": … }", "trailing": "text, or one part at the end: a badge, a button, a row of buttons, a menu, a toggle field (its label is hidden: the title says it)", "status": "tone token: a small dot (good, warn, bad, accent, neutral)", "count": "number or binding: a small count capsule, hidden at 0", "accessory": "chevron | check | none (default)", "selected": "bool or binding: drawn picked, in the accent fill; or { \"value\": \"$item.id\", \"is\": \"$picked\" }: picked when the two are equal (set $picked in the cell's on action)", "on": "action a click on the row runs", "args": "with on: the action's args", "confirm": "with on: confirmation text", "check": "bool or binding: a tick box at the start of the row, e.g. \"$item.done\". Ticked, the title is struck through and muted", "on_check": "action a tick runs, with $args.value (the new true or false, undeclared) and the cell's args, e.g. an update step that sets done", "check_hue": "hue token for the tick box (default: the app accent)", "check_style": "round (default) | square"}, "example": {"cell": "$item.name", "subtitle": "Port {$item.port}", "leading": "globe", "status": "good", "accessory": "chevron", "on": "kill", "args": {"port": "$item.port"}}},
    "tabs": { "description": "Tabs inside a card: a segmented control over the parts of the picked tab. The pick is remembered per app. For a card with two or three views of the same data (Open / Mine, Today / Done)", "main": "array of 2–6 tabs: { \"label\": \"Today\", \"icon\": \"sun.max\", \"count\": \"$todos | count\", \"when\": binding, \"children\": [parts] }; count shows beside the label (hidden at 0); a tab hidden by when can't be picked. Children count one level of nesting, as a section's do", "props": { "style": "segmented (default) | underline: the labels in a row, the picked one underlined in the accent" }, "example": { "tabs": [{ "label": "Deploys", "icon": "shippingbox", "children": [{ "list": "$deploys", "item": { "cell": "$item.name" } }] }, { "label": "Jobs", "count": "$jobs | count", "children": [{ "list": "$jobs", "item": { "cell": "$item.name" } }] }] } },
    "drop": {"description": "Files in (§51): drop files on it, or click (tap on iPhone) to choose. Its action gets $args.files: [{ path, name, base, ext, kind, type, size, modified }]. No permission: the drop is the approval. Draws its own drag-over, working, done and error states", "main": "label, e.g. \"Drop images to convert\"", "props": {"on": "action run with $args.files (required)", "args": "the action's own declared args, as on a button", "accept": "list of kinds (image, video, audio, pdf, text, json, csv, archive), extensions like \".heic\", or type identifiers like \"public.json\"; default any file", "multiple": "bool: take several files at once (default one)", "max": "with multiple: most files at once (default 20, at most 100)", "max_mb": "skip files bigger than this many MB", "hint": "muted line under the label, e.g. \"PNG, JPG or HEIC\" (default: what accept takes)", "icon": "SF Symbols name (default from accept)", "size": "s (one slim row) | m (default) | l (a big target)", "disabled": "binding"}, "example": {"drop": "Drop images to convert", "accept": ["image"], "multiple": true, "hint": "PNG, JPG, HEIC or TIFF", "on": "convert"}},
    "canvas": {"description": "The person draws (§47.2, §60.11, §60.13e), the app never does: a signature, a sketch, or marking up a screenshot (arrows, boxes, hiding a part with a solid block). Draws in place on the Mac with a tool row (undo, redo, clear); on iPhone a tap opens it full screen. Each change is saved a moment after the last stroke: the bound state key gets { path (the PNG, with the picture under it), items, width, height, count, empty, at }, then on_change runs. $sketch.path is empty until something is drawn", "main": "the canvas's id (kebab-case), e.g. \"markup\": names its files and canvas.clear", "props": {"bind": "object state key for what's drawn (required), e.g. \"$sketch\" declared { \"type\": \"object\", \"default\": {} }", "height": "m (default) | l | fill (a pop-out's height)", "background": "blank (default, white) | grid | lines | dots | an assets/ picture | a binding to a picture to mark up, like \"$shot\". Another picture starts a new drawing: run canvas.clear in the step that changes it", "tools": "list from pen, marker, eraser, arrow, line, rect, ellipse, redact (a solid block that hides what's under it in the saved PNG); default [\"pen\", \"eraser\"]", "tones": "ink colours from red, orange, yellow, green, blue, purple, pink, black, white; default red, yellow, green, blue, black, white", "on_change": "action run after each saved change, with $args.value (the state value)", "readonly": "bool: shows the drawing without tools"}, "example": {"canvas": "markup", "bind": "$marked", "background": "$shot", "tools": ["pen", "arrow", "rect", "redact", "eraser"], "height": "l", "on_change": "render"}}
  },

  "cards": {
    "description": "{ \"id\": \"main\", \"layout\": <part>, \"footer\": <part>?, \"params\": {…}?, \"toolbar\": [...]? }. Views show cards by id. The optional footer sits under the layout after a hairline; buttons there show their keycaps. \"params\": { \"id\": \"text\" } (arg types) makes it a detail card: it only opens from an open_card step, which gives them, and reads them as $params.id; views and tabs can't show it. \"toolbar\": 1 to 3 icon buttons at the card's top right (the iPhone's navigation bar), each { \"label\", \"icon\" (SF Symbols), \"on\", \"args\"?, \"style\": \"destructive\"? }; the label is the tooltip and what VoiceOver reads (SPEC §65.7).",
    "example": { "id": "main", "layout": { "column": [{ "stat": "$mrr | currency", "label": "MRR" }, { "button": "Refresh", "on": "refresh", "style": "plain" }], "gap": "m" } },
    "example_detail": { "id": "detail", "params": { "id": "text" }, "toolbar": [{ "label": "Delete", "icon": "trash", "on": "remove", "args": { "id": "$params.id" }, "style": "destructive" }], "layout": { "text": "$params.id", "size": "l" } }
  },

  "state": {
    "types": ["text", "number", "bool", "list", "object", "any"],
    "keys": { "type": "required", "default": "value of that type", "sync": "bool: true keeps this key the same on the app's copies on the user's other devices (SPEC §66)" },
    "notes": "State persists across restarts. \"sync\": true on a key keeps it the same on every copy of the app on the user's devices that has Sync to My Devices on: a change on one device reaches the others, and the newest change wins (a list or object syncs as one value). Not for a source's key (sources run on each device), not with top-level \"sync\": \"never\", at most 20 keys. Store times as absolute (an end time, not seconds left), so a timer lines up everywhere. Top-level on_sync runs an action after synced values arrive (to schedule this device's own notifications). Sync only what makes sense on every device: not a search box or a picked row. A source's key needn't be declared (it becomes 'any'). Names can't be settings, meta, running, now, item, index, args or ui (nor params in an app with a detail card).",
    "example": { "deploys": { "type": "list", "default": [] }, "lastText": { "type": "text", "default": "" } }
  },

  "sources": {
    "description": "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).",
    "platforms": { "fetch": ["macos", "ios"], "cli": ["macos"], "script": ["macos"], "inbox": ["macos", "ios"], "system": ["macos", "ios"], "devices": ["macos", "ios"], "clipboard": ["macos"], "calendar": ["macos", "ios"], "reminders": ["macos", "ios"], "activity": ["macos"] },
    "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\" }"
    },
    "errors": "On failure the last good value stays (except raw fetch), $meta.<key>.error holds the message, and retries back off.",
    "examples": {
      "events": { "inbox": "agent", "mode": "push", "max": 50, "select": "hook_event_name", "on_receive": "on_event" },
      "deploys": { "cli": "cloud", "args": ["deployment:list", "--json"], "cwd": "$settings.project", "every": 30, "select": "data" },
      "site": { "fetch": "https://tailstats.com", "raw": true, "every": 30, "on_change": { "action": "check", "watch": "$site.status | tone:{bad:'=0', good:'<400', else:'bad'}" } },
      "mrr": { "script": "mrr.sh", "env": { "STRIPE_KEY": "connection:stripe" }, "every": 900 },
      "clip": { "clipboard": ["text", "image"] },
      "today": { "calendar": { "days": 1 } }
    }
  },

  "system": {
    "audio": { "description": "Sound: volume, mute, the speakers and microphone in use, and every device", "permission": "audio.read", "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", "example": { "system": "audio" } },
    "network": { "description": "Online or not, and over Wi-Fi, cable or a phone", "permission": "network.read", "value": "{ online, interface: wifi | ethernet | cellular | other | null, expensive, constrained }", "example": { "system": "network" } },
    "power": { "description": "Battery, charging, time left, Low Power Mode, heat", "permission": "power.read", "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) }", "example": { "system": "power", "select": "battery" } },
    "wifi": { "description": "Wi-Fi on or off, the network's name and signal", "permission": "wifi.read", "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 }", "example": { "system": "wifi", "on_change": "arrived" } },
    "bluetooth": { "description": "Paired devices: connected or not, kind, battery", "permission": "bluetooth.read", "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", "example": { "system": "bluetooth", "every": 60 } },
    "usage": { "description": "How busy this Mac is: processor, graphics, memory and disk", "permission": "usage.read", "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", "example": { "system": "usage", "every": 5 } },
    "displays": { "description": "The Mac's displays, main first", "permission": "displays.read", "value": "[{ id (\"display:<n>\", a screen.record.start target), name, main, width, height (points) }]. Refreshes when a display is plugged in or changes", "example": { "system": "displays" } },
    "windows": { "description": "Normal on-screen windows of other apps, front to back (not TailApps')", "permission": "windows.read", "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", "example": { "system": "windows", "every": 5 } },
    "device": { "description": "What this device is, on the Mac and iPhone; no permission", "permission": null, "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", "example": { "system": "device" } },
    "notes": { "description": "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" }
  },

  "scripts": {
    "description": "Shell scripts, run as /bin/sh <file> <args…> with only PATH, HOME, LANG and the declared env. The user can read each one on the approval sheet. Print JSON to stdout for sources; exit non-zero with a message on stderr to fail.",
    "built_in_tools": ["curl", "jq", "lsof", "awk", "sed", "screencapture", "sips", "caffeinate", "mdfind", "pbcopy", "osascript"],
    "limits": "Max 32 KB per script",
    "sandbox": "Scripts and CLIs run sandboxed: they can't read ~/.ssh, ~/.aws, browser data or TailApps' files, and write only to $TMPDIR, caches and files.write folders. Network: cli steps, or any net: permission or uses: sign-in. A blocked path or host fails the step with 'TailApps blocked …' and the fix"
  },

  "actions": {
    "keys": {
      "steps": "Run in order; the first failure stops the action (required)",
      "args": "Typed inputs: { \"port\": \"int:1-65535\" }",
      "confirm": "Confirmation text; may use $args. Or { \"text\": \"Unlock the door?\", \"auth\": \"biometric\" }: Face ID, Touch ID or the passcode instead of a Yes/Cancel question, every run, whoever starts it (no permission; Mac and iPhone)",
      "timeout": "Seconds for the whole action (default 120)",
      "runs_on": "Optional list of platforms (macos, ios) that narrows where the action runs; it can never add one its steps don't run on. Usually left out: validate_app works it out from the steps",
      "job": "true: a long run the card follows as $job.<action> (status idle|running|done|failed|cancelled, progress 0–1 from each, done, total, started, ended, error); job.cancel stops it; with notify declared, one notification when it ends",
      "expose": "true: Shortcuts, Siri and Spotlight can run it as Run <action> in <card> (Mac and iPhone). Not with args, confirm or a tap-only step (ask, files.pick, photos.pick, camera.take, scan.code, location.get, share, clipboard.read, screen.record.start); on the iPhone not with mic.record.start or shortcuts.run either"
    },
    "arg_types": ["text", "int", "int:<min>-<max>", "number", "bool", "enum:<a>|<b>|<c>"],
    "notes": "Steps may add \"as\": \"name\" to keep a result for later steps ($name). One run of an action at a time. While it runs, $running.<action> is true. A drop part's action also gets $args.files (undeclared; never from run_action): the files the user dropped or picked.",
    "example": { "kill": { "args": { "port": "int:1-65535" }, "confirm": "Kill whatever is on port {$args.port}?", "steps": [{ "script": "kill-port.sh", "args": ["$args.port"] }, { "refresh": "ports" }] } }
  },

  "platforms": {
    "values": ["macos", "ios"],
    "description": "Each step and source kind lists the platforms it runs on in this build. An action runs where all its steps do (both if branches count). validate_app returns runs_on per action and takes targets, e.g. [\"macos\", \"ios\"], to warn about actions that can't run on one. A Mac-only app is fine: on an iPhone its buttons show disabled with \"Needs a Mac\"."
  },

  "steps": {
    "set": { "platforms": ["macos", "ios"], "description": "Write state keys", "value": "{ key: value, … }", "result": null, "permission": null, "example": { "set": { "lastText": "$text" } } },
    "push": { "platforms": ["macos", "ios"], "description": "Add to a list: the front by default (newest first), or the end with \"at\": \"end\" (oldest first); 'max' keeps the newest N either way", "value": "{ listKey: value }", "result": null, "permission": null, "example": { "push": { "shots": "$path" }, "max": 24 } },
    "increment": { "platforms": ["macos", "ios"], "description": "Add to number state keys (negative counts down; a key that isn't a number yet starts at 0). 'min' and 'max' keep the result in range. A minus before a binding takes its number away: { \"set\": { \"left\": \"$ends_at\" } } then { \"increment\": { \"left\": \"-$now\" } } is the time left, with no script. For counters, scores and timers; send the new value with a send step to keep copies on other devices in step", "value": "{ numberKey: amount, … }: a number, a binding, or \"-$binding\" to subtract", "result": null, "permission": null, "example": { "increment": { "count": -1 }, "min": 0 }, "example_subtract": [{ "set": { "left": "$ends_at" } }, { "increment": { "left": "-$now" }, "min": 0 }] },
    "remove": { "platforms": ["macos", "ios"], "description": "Take items out of a list: every item equal to 'match' (or whose fields equal its fields), or the one 'at' a position (-1 = last)", "value": "{ listKey: { match: value or { field: value } } or { at: position } }", "result": null, "permission": null, "example": { "remove": { "cities": { "match": { "tz": "$args.tz" } } } } },
    "update": { "platforms": ["macos", "ios"], "description": "Change items in a list: set these fields on every item equal to 'match' (or whose fields equal its fields), or the one 'at' a position (-1 = last). For ticking a to-do, renaming or editing a note", "value": "{ listKey: { match: value or { field: value } (or at: position), set: { field: value } } }", "result": null, "permission": null, "example": { "update": { "shots": { "match": { "id": "$args.text" }, "set": { "done": true } } } } },
    "move": { "platforms": ["macos", "ios"], "description": "Reorder a list: take the first item equal to 'match' (or whose fields equal its fields), or the one 'at' a position, and move it 'by' places (-1 = up one) or 'to' a position (0 = first, -1 = last). It stays inside the list; nothing to move leaves it as it is", "value": "{ listKey: { match: value or { field: value } (or at: position), by: places (or to: position) } }", "result": null, "permission": null, "example": { "move": { "cities": { "match": { "tz": "$args.tz" }, "by": -1 } } } },
    "refresh": { "platforms": ["macos", "ios"], "description": "Run a source now", "value": "source name", "result": null, "permission": null, "example": { "refresh": "deploys" } },
    "cli": { "platforms": ["macos"], "description": "Run a CLI; keys args, cwd, env, parse, select, timeout", "value": "binary name", "result": "parsed output", "permission": "cli:<binary> <first args…>", "example": { "cli": "cloud", "args": ["deploy", "--json"], "cwd": "$settings.project", "timeout": 600 } },
    "script": { "platforms": ["macos"], "description": "Run a script from 'scripts'; same keys as cli", "value": "script name", "result": "parsed output", "permission": "script:<name>", "example": { "script": "kill-port.sh", "args": ["$args.port"] } },
    "fetch": { "platforms": ["macos", "ios"], "description": "HTTP request; keys method, headers, body, auth, raw, parse, select, timeout", "value": "URL", "result": "parsed body (or the raw object)", "permission": "net:<host> (also with auth)", "example": { "fetch": "https://api.example.com/items", "as": "items" }, "example_outgoing_webhook": { "fetch": "https://hooks.slack.com/services/T000/B000/XXXX", "method": "POST", "body": { "text": "Deploy finished: {$deploys.0.status}" }, "note": "An outgoing webhook (Slack, Discord, …) is a POST fetch; declare net:<host>. If the URL itself is the secret, use a curl script with env connection:<name> instead" } },
    "screen.capture": { "platforms": ["macos"], "description": "Screenshot; region is the interactive picker", "value": "{ \"mode\": \"region\" | \"window\" | \"screen\" }", "result": "image (temp file path)", "permission": "screen.capture", "example": { "screen.capture": { "mode": "region" }, "as": "img" } },
    "vision.ocr": { "platforms": ["macos", "ios"], "description": "Read text from an image, on this device", "value": "image binding (a file the app may read: a capture, a photo it took or picked, a dropped or received file)", "result": "text", "permission": "vision.ocr", "example": { "vision.ocr": "$img", "as": "text" } },
    "vision.codes": { "platforms": ["macos", "ios"], "description": "Find QR codes and barcodes in an image, on this device", "value": "image binding, like vision.ocr", "result": "[{ type: qr | ean13 | ean8 | upce | code128 | code39 | code93 | itf14 | itf | pdf417 | aztec | datamatrix | codabar | gs1databar | other, value }], top to bottom; [] when there are none", "permission": "vision.ocr", "example": { "vision.codes": "$img", "as": "codes" } },
    "scan.code": { "platforms": ["macos", "ios"], "description": "Scan a QR code or barcode with the camera, live, from a tap", "notes": "iPhone: a camera sheet; Mac: a camera window. The first code of one of the types comes back; Cancel stops the action. Only from the person's own tap, never a source, timer, inbox or agent. For a code in a photo or file use vision.codes", "value": "{} or { \"types\": [\"qr\", \"ean13\"] } (qr, ean13, ean8, upce, code128, code39, code93, itf14, itf, pdf417, aztec, datamatrix, codabar, gs1databar; default every type)", "result": "{ type, value }", "permission": "camera", "example": { "scan.code": { "types": ["qr"] }, "as": "code" } },
    "location.get": { "platforms": ["macos", "ios"], "description": "Where this device is, once, from a tap", "notes": "Asks for location access the first time (while using only; never in the background). accuracy city rounds to about a kilometre and drops altitude. Only from the person's own tap, never a source, timer, inbox or agent. Show it on a map part, or send it to another device", "value": "{} or { \"accuracy\": \"best\" | \"city\" }", "result": "{ lat, lng, accuracy (metres), altitude (metres or null), at (unix seconds) }", "permission": "location", "example": { "location.get": { "accuracy": "best" }, "as": "here" } },
    "mic.record.start": { "platforms": ["macos", "ios"], "description": "Start recording the microphone (one recording per app at a time). A red indicator shows on the card and in the Mac's menu bar until mic.record.stop. It stops by itself after max_seconds (default 300, at most 3600); mic.record.stop still returns what was recorded. On iPhone it only starts from a tap on a button, never from a source. For hold-to-talk, give a global shortcut on_release (see 'shortcuts')", "value": "{} or { \"max_seconds\": 120 }", "result": null, "permission": "mic.record", "example": { "mic.record.start": { "max_seconds": 120 } } },
    "mic.record.stop": { "platforms": ["macos", "ios"], "description": "Stop this app's recording and save it as an .m4a in its temporary folder (kept 24 hours: copy it with files.save to keep it). Fails if nothing is recording", "value": "{}", "result": "{ path, seconds, at (start time, unix seconds) }", "permission": "mic.record", "example": { "mic.record.stop": {}, "as": "rec" } },
    "screen.record.start": { "platforms": ["macos"], "description": "Start recording the screen to an MP4 (one screen recording on the Mac at a time), from the user's own click only (not a source, timer, inbox, another app or run_action), except that with the screen.record.remote permission too, a send that just came from one of the user's other signed-in devices may start it (in an inbox's on_receive) with target display or a displays/windows id. target: pick (default: Apple's picker, the user picks a display or window) | display (the main one) | area (the user drags a rectangle; Esc cancels) | an id from the displays or windows source. sound: true (the default microphone, needs mic.record) | false (default) | a microphone id from the audio source; system_audio: bool (what the Mac plays); cursor: bool (default true); quality: medium (default: up to 1080p, 30 fps) | high (native size, 60 fps); max_seconds: default 300, at most 3600. TailApps' own windows are left out. The red item in the menu bar shows it and can stop it; that stop keeps the file for the next screen.record.stop. Cancelling the picker or area stops the action quietly", "value": "{} or { \"target\": \"pick\", \"sound\": true, \"system_audio\": true }", "result": null, "permission": "screen.record (sound also mic.record)", "example": { "screen.record.start": { "target": "pick", "sound": true } } },
    "screen.record.stop": { "platforms": ["macos"], "description": "Stop this app's screen recording and return it: an MP4 in its temporary folder (kept 24 hours: upload it with files.save or share it). Any run may stop. With nothing recording, it returns the newest recording stopped another way (the menu bar, max_seconds, the app turned off, TailApps quitting) with stopped_by: menu | limit | off | quit, once; with none, it fails", "value": "{}", "result": "{ path, name, ext, kind, size, …, seconds, at (start time, unix seconds), width, height, stopped_by? }", "permission": "screen.record", "example": { "screen.record.stop": {}, "as": "rec" } },
    "image.compose": { "platforms": ["macos", "ios"], "description": "Put a picture (a path like screen.capture's \"$img\", or a file object like camera.take's \"$photo\") on a background (a hue, a gradient of 2–4 hues, or a picture such as one of the app's assets/, blurred 0–1) with padding, rounded corners and a shadow, at an aspect ratio. Makes a new file in the temporary folder (kept 24 hours); the original isn't touched. For nicer screenshots, social cards, a photo with a frame", "value": "{ \"image\": path, \"background\": { \"hue\" } | { \"gradient\": [hues], \"angle\": degrees (default 135) } | { \"image\": path, \"blur\": 0–1 }, \"padding\": none|s|m|l|xl (default m), \"corners\": none|s|m|l (default m), \"shadow\": bool, \"aspect\": auto|1:1|4:3|16:9|9:16, \"format\": png|jpg, \"max_px\": 512–8192 }", "result": "{ path, name, ext, kind, type, size, modified }", "permission": null, "example": { "image.compose": { "image": "$img", "background": { "gradient": ["purple", "orange"] }, "padding": "l", "shadow": true }, "as": "nice" } },
    "speech.transcribe": { "platforms": ["macos", "ios"], "description": "Turn speech in an audio file into text, on this device (nothing is sent anywhere; needs macOS 26 or iOS 26; the first use of a language downloads its model). Step key language: a code like \"en-GB\" or \"pl\" (default: the device's language)", "value": "audio file path: usually \"$rec.path\" from mic.record.stop (on the Mac also a file in a folder the user chose, or one received)", "result": "{ text, segments: [{ start, end, text }] } (seconds)", "permission": "speech.transcribe", "example": { "speech.transcribe": "$rec.path", "language": "en-GB", "as": "heard" } },
    "clipboard.write": { "platforms": ["macos", "ios"], "description": "Copy text or an image", "value": "{ \"text\": … } or { \"image\": … }", "result": null, "permission": "clipboard.write", "example": { "clipboard.write": { "text": "$lastText" } } },
    "clipboard.read": { "platforms": ["macos", "ios"], "description": "Read the clipboard now, from the user's own click, tap or shortcut only. iOS may ask to allow the paste. image is a PNG in the app's temporary folder (a day) that vision.ocr, clipboard.write, files.save, send and share can use (text wins when both are there: ask for [\"image\"] to OCR a picture); copied files (Mac) become readable like dropped ones. A password manager's copy gives kind hidden. To follow every copy on the Mac, use a clipboard source", "value": "{} or a list from [\"text\", \"image\", \"files\"] (files: Mac only)", "result": "{ change, kind (files | text | image | empty | hidden), text, image, files ([{ path, name, … }]), from, at, truncated (text over 100,000 characters) }", "permission": "clipboard.read", "example": { "clipboard.read": ["text", "image"], "as": "copied" } },
    "files.save": { "platforms": ["macos", "ios"], "description": "Save data into a folder or storage setting; name is a plain file name (no /, .., ~ or leading .); never overwrites (name 2.png, …). On iPhone only to a storage setting set to a bucket (its allow must include s3; a folder setting keeps the app off the phone). Step key expires: seconds a bucket's presigned link lasts (default and max 604800)", "value": "{ \"data\": …, \"to\": \"$settings.<folder or storage>\", \"name\": … }", "result": "saved path (folder setting), or { kind: folder | s3, path, key, url } (storage setting)", "permission": "files.write:<setting>", "example": { "files.save": { "data": "$img", "to": "$settings.folder", "name": "shot-{$now}.png" }, "as": "path" } },
    "files.pick": {"platforms": ["macos", "ios"], "description": "The system's file picker, from the user's own click only (not a source, timer or run_action); cancel stops the action quietly. No permission: the pick is the approval. On iPhone the files are copies in the app's temporary folder", "value": "{} or { \"accept\": [\"pdf\"], \"multiple\": true, \"max\": 20, \"max_mb\": 50, \"prompt\": \"Merge\" } (accept as on a drop part)", "result": "one { path, name, base, ext, kind, type, size, modified }, or a list of them with multiple", "example": {"files.pick": {"accept": ["pdf"], "multiple": true, "prompt": "Merge"}, "as": "picked"}},
    "files.list": {"platforms": ["macos"], "description": "The files directly in a chosen folder (no subfolders or hidden files), A–Z, at most 1000; shaped like dropped files", "value": "\"$settings.<folder setting>\"", "result": "[{ path, name, base, ext, kind, type, size, modified }]", "permission": "files.read:<setting> (files.write:<setting> covers it)", "example": {"files.list": "$settings.folder", "as": "files"}},
    "files.info": {"platforms": ["macos", "ios"], "description": "One file's details: a capture, a dropped, picked or received file, or one in a chosen folder", "value": "a path", "result": "{ path, name, base, ext, kind, type, size, modified }", "permission": null, "example": {"files.info": "$args.text", "as": "info"}},
    "files.rename": {"platforms": ["macos"], "description": "Rename a file in a chosen folder; it keeps its extension, and a clash gets \" 2\"", "value": "{ \"file\": path, \"name\": text }", "result": "the file's new { path, name, … }", "permission": "files.write:<the folder's setting>", "example": {"files.rename": {"file": "$args.text", "name": "Invoice {$now}"}, "as": "renamed"}},
    "files.move": {"platforms": ["macos"], "description": "Move a file between chosen folders, keeping its name (a clash gets \" 2\"); files.write for both", "value": "{ \"file\": path, \"to\": \"$settings.<folder setting>\" }", "result": "the file's new { path, name, … }", "permission": "files.write:<setting>", "example": {"files.move": {"file": "$args.text", "to": "$settings.folder"}, "as": "moved"}},
    "photos.pick": { "platforms": ["ios"], "description": "Choose photos from the iPhone's library in the system's own photo picker (no library permission: TailApps sees only what the user picks), from the user's own tap only (not a source, timer, inbox, another app or run_action); cancel stops the action quietly. Each photo is a JPEG in the app's temporary folder, resized to max_px on its long side (default 4096, 512 to 8192), upright, with no location or other metadata. iPhone only; on a Mac the button shows Needs iPhone (use files.pick with accept image there). Send it to the Mac with send's file (keep max_px at 4096 or less there: a bigger JPEG can pass send's 10 MB), or upload it with files.save", "value": "{} or { \"multiple\": true, \"max\": 10, \"max_px\": 4096 }", "result": "{ path, name, base, ext, kind, type, size, modified } (like camera.take), or a list of them with multiple", "example": { "photos.pick": {}, "as": "photo" } },
    "camera.take": { "platforms": ["macos", "ios"], "description": "Take a photo, or with mode video record a short clip, in the camera sheet (Apple's on iPhone, TailApps' own camera window on a Mac), from the user's own tap only (not a source, timer, inbox, another app or run_action); cancel stops the action quietly. A photo is a JPEG resized to max_px on its long side (default 2048, 512 to 4096), upright. A video is an MP4 (H.264 + AAC) at quality low | medium (default) | high (480p, 720p, 1080p), at most max_seconds long (1 to 600, default 60); sound false drops its sound. Both land in the app's temporary folder (kept 24 hours) with no location or other metadata. A video also needs the mic.record permission. Upload it with files.save to a storage setting, share it, or send it (≤ 10 MB)", "value": "{} or { \"camera\": \"back\" | \"front\", \"max_px\": 2048 } or { \"mode\": \"video\", \"max_seconds\": 60, \"quality\": \"medium\", \"sound\": true }", "result": "{ path, name, base, ext, kind, type, size, modified } (like files.pick); a video adds seconds, width, height", "permission": "camera (a video also mic.record)", "example": { "camera.take": {}, "as": "photo" }, "example_video": { "camera.take": { "mode": "video", "max_seconds": 30 }, "as": "clip" } },
    "share": { "platforms": ["macos", "ios"], "description": "Open the system share sheet (AirDrop, Messages, Mail, Save Video…) from the user's own tap only. file: a path a step may read (a camera.take or mic.record.stop result, a clipboard.read image, a picked or received file); url: an https link; text: a line to go with them. The user picks where it goes", "value": "{ \"file\": \"$clip.path\" } or { \"url\": \"$saved.url\", \"text\": \"…\" }", "result": "{ done } (false when the sheet was closed without sharing)", "permission": "share", "example": { "share": { "file": "$img" } } },
    "notify": { "platforms": ["macos", "ios"], "description": "Show a notification; with 'at', at that time even if TailApps isn't running (an alarm). 'id' names it; { \"cancel\": id } takes it back", "value": "text, or { \"title\": …, \"body\": …, \"at\": time (optional), \"id\": text (with at) }, or { \"cancel\": id }", "result": null, "permission": "notify", "example": { "notify": { "title": "Laravel Cloud", "body": "Deploy finished" } }, "example_at": [{ "notify": { "title": "$args.name", "body": "Time's up", "at": "$now | add:$args.left", "id": "$args.id" } }, { "notify": { "cancel": "$args.id" } }] },
    "open": { "platforms": ["macos", "ios"], "description": "Open a web or mail link in the default app (https://, http://, mailto: only)", "value": "URL binding", "result": null, "permission": "open:url", "example": { "open": "https://cloud.laravel.com" } },
    "send": { "platforms": ["macos", "ios"], "description": "Send a value to this app on the user's other devices. Each copy gets it in its inbox source of that name, with $args.event (the value), $args.from and $args.from_id (the sender's name and id) in on_receive. Step key file: a path to send too (screen.capture's 'as', a camera.take or photos.pick photo or a files.pick file on the iPhone, a file in a folder the user chose, or a received one; ≤ 10 MB; Mac and iPhone): on_receive then also gets $args.file, \"received/<name>\", for image, gallery and steps (50 newest kept). Step key to: a device id, usually \"$args.from_id\" to reply to the sender only, or a list of ids (\"$picked\" from a devices source checklist; empty fails); omit for every device. Step key alert: one line (bindings allowed, cut at 120 characters) a receiving iPhone shows as a notification (even with TailApps closed) and lists in its Inbox; without it the value arrives quietly (fine for a synced count). Alert text isn't end-to-end encrypted: keep secrets out of it. Only works once the user turns on Sync to My Devices for the app (no tool can); never reaches other people. Step key app (§46): another app's id, or \"$args.from_app\" to reply: to that app's inbox, which must list this app in from_apps. This device only (no sign-in) unless to is \"devices\" or ids (then sync too). No file", "value": "{ inboxName: value }: one of the app's own inbox sources (with app: that app's)", "result": "{ delivered: number of other devices reached (0 is fine) }; with sync off, a run from a source, timer or on_receive gets { delivered: 0, skipped: 'sync_off' } and carries on, while a click or run_action fails", "permission": "send:<inbox>", "example": { "send": { "messages": { "text": "$args.text" } }, "file": "$img", "alert": "New message" } },
    "audio.volume.set": { "platforms": ["macos"], "description": "Set the output volume: 0–100 or { \"by\": -10 }", "notes": "Mute stays as it is (unmute with audio.mute false). The card's ⋯ menu offers Undo for volume, mute, devices and Wi-Fi power", "value": "a level 0–100 (number or binding), or { \"by\": 10 } (negative turns it down)", "result": "{ before, after }", "permission": "audio.control", "example": { "audio.volume.set": 30 } },
    "audio.mute": { "platforms": ["macos"], "description": "Mute or unmute the sound output", "value": "true (mute), false (unmute) or \"toggle\" (or a binding)", "result": "{ before, after }", "permission": "audio.control", "example": { "audio.mute": "toggle" } },
    "audio.input.mute": { "platforms": ["macos"], "description": "Mute or unmute the microphone in use", "notes": "For every app, where the device allows it", "value": "true (mute), false or \"toggle\"", "result": "{ before, after }", "permission": "audio.control", "example": { "audio.input.mute": true } },
    "audio.output.set": { "platforms": ["macos"], "description": "Switch the sound output to a device, by name or id", "notes": "Names and ids come from a { \"system\": \"audio\" } source's outputs; alert sounds follow. When none matches it fails with the names it knows", "value": "device name or id (text or binding)", "result": "{ before: { id, name }, after: { id, name } }", "permission": "audio.control", "example": { "audio.output.set": "AirPods Pro", "as": "switched" } },
    "audio.input.set": { "platforms": ["macos"], "description": "Switch the microphone to a device, by name or id", "notes": "Names and ids come from the audio source's inputs", "value": "device name or id", "result": "{ before, after }", "permission": "audio.control", "example": { "audio.input.set": "MacBook Pro Microphone" } },
    "wifi.power": { "platforms": ["macos"], "description": "Turn Wi-Fi on or off", "value": "true, false or \"toggle\"", "result": "{ before, after }", "permission": "wifi.control", "example": { "wifi.power": "toggle" } },
    "wifi.join": { "platforms": ["macos"], "description": "Join a Wi-Fi network this Mac knows", "notes": "macOS keeps the password of networks it has joined. Join a new secured network once in System Settings first: TailApps never holds Wi-Fi passwords", "value": "network name (text or binding)", "result": "{ before, after } (network names; before is null without Location)", "permission": "wifi.control", "example": { "wifi.join": "Office" } },
    "bluetooth.connect": { "platforms": ["macos"], "description": "Connect a paired Bluetooth device", "notes": "By name or address from a { \"system\": \"bluetooth\" } source. No pairing or scanning: pair it in System Settings first", "value": "device name or address (text or binding)", "result": "{ before, after }: each { device, connected }", "permission": "bluetooth.control", "example": { "bluetooth.connect": "AirPods Pro" } },
    "bluetooth.disconnect": { "platforms": ["macos"], "description": "Disconnect a paired Bluetooth device", "value": "device name or address", "result": "{ before, after }", "permission": "bluetooth.control", "example": { "bluetooth.disconnect": "AirPods Pro" } },
    "awake.start": { "platforms": ["macos", "ios"], "description": "Keep this device awake until awake.stop", "notes": "Mac: an IOPMAssertion (display: true keeps the screen on too, else only the Mac). iPhone: the screen stays on while TailApps is in front. Ends by itself after minutes (1–1440), when the app is turned off or removed, or TailApps quits. Starting again replaces the last one. Keep your own state (set awake: true) to show it on the card", "value": "{} or { \"display\": true, \"minutes\": 60 }", "result": null, "permission": "power.control", "example": { "awake.start": { "display": true, "minutes": 60 } } },
    "awake.stop": { "platforms": ["macos", "ios"], "description": "Let the device sleep again (ends this app's awake.start)", "value": "{}", "result": null, "permission": "power.control", "example": { "awake.stop": {} } },
    "display.sleep": { "platforms": ["macos"], "description": "Turn the display off now", "notes": "The Mac stays awake", "value": "{}", "result": null, "permission": "power.control", "example": { "display.sleep": {} } },
    "wallpaper.set": { "platforms": ["macos"], "description": "Set the desktop picture, on every screen or one", "notes": "The picture is one the app may read: a capture, a dropped or picked file, a received one, or one in a folder the user chose (bind it). TailApps keeps its own copy, so a capture can be the wallpaper. macOS sets it for each screen's current Space. Screen names come from the error when one doesn't match. The card's ⋯ menu offers Undo", "value": "a path (\"$args.item.path\"), a picked file (\"$picked\"), or { \"image\": …, \"screen\": \"all\" | \"main\" | \"<screen name>\" | a displays source id (bind its id, not its name), \"fit\": \"fill\" | \"fit\" | \"stretch\" | \"center\" } (defaults all, fill)", "result": "{ before, after }: each a list of { screen, picture (file name), fit }", "permission": "wallpaper.control", "example": { "wallpaper.set": { "image": "$img", "screen": "all", "fit": "fill" } } },
    "haptic": { "platforms": ["macos", "ios"], "description": "A tap the person feels: success, warning, error, light, medium, heavy or selection. iPhone: only while TailApps is open (from a tap, a timer, or an inbox while open); Mac: a haptic trackpad in use, best effort", "value": "kind or binding", "result": null, "permission": null, "example": { "haptic": "success" } },
    "sound": { "platforms": ["macos", "ios"], "description": "Play a system sound: done, alert, error, tap or pop (the iPhone's silent switch mutes it). At most one a second per app", "value": "name or binding", "result": null, "permission": null, "example": { "sound": "done" } },
    "speak": { "platforms": ["macos", "ios"], "description": "Read text out loud on this device (first 500 characters; a new line replaces one still being read). At most one a second per app. On the iPhone only while TailApps is open: use notify for a locked phone", "value": "text, or { \"text\": …, \"voice\": \"en-GB\" (language), \"rate\": 0.5–2 (1 = normal) }", "result": null, "permission": "speak", "example": { "speak": "Build finished" } },
    "toast": { "platforms": ["macos", "ios"], "description": "A short note at the bottom of the card for 3 s (6 s with Undo): \"Copied\", \"Deleted\". Undo is a button on it that runs an action. Only for the person's own tap or click; a run nobody is watching (a source, timer, inbox, another device or an agent) skips it and goes on", "value": "text, or { \"text\": \"Deleted\", \"undo\": \"<action>\", \"args\": { … } } (text at most 120 characters)", "result": null, "permission": null, "example": { "toast": "Copied {$args.text}" }, "example_undo": { "toast": { "text": "Deleted {$args.item.title}", "undo": "restore", "args": { "item": "$args.item" } } } },
    "ask": { "platforms": ["macos", "ios"], "description": "Ask the person one question in the system's own dialog and keep the answer: type text or a number, or pick from choices. Cancel stops the action quietly (not an error). Only from the person's own tap, click or shortcut: someone has to be there to answer", "value": "{ \"title\": \"Rename\", \"message\": text, \"input\": \"text\" | \"number\", \"default\": text } or { \"title\": \"Move to\", \"choices\": [\"Inbox\", \"Done\"] (2–20, or a list binding) }", "result": "the text typed, the number, or the choice picked", "permission": null, "example": { "ask": { "title": "Rename", "input": "text", "default": "$args.text" }, "as": "name" } },
    "open_card": { "platforms": ["macos", "ios"], "description": "Show another card of this app over the current one, with a Back button: a detail screen. The card declares \"params\" and reads them as $params.<name>; args gives every one. Wherever the app's card shows (menu, pop-out, Dashboard, iPhone) it shows the opened card until Back, close_card or a tab switch; at most 5 deep. Only for the person's own tap or click; any other run skips it", "value": "card id, with \"args\": { \"<param>\": value }", "result": null, "permission": null, "example": { "open_card": "detail", "args": { "id": "$args.text" } } },
    "close_card": { "platforms": ["macos", "ios"], "description": "Go back from a card open_card showed (as Back does), e.g. after Save or Delete on a detail card. Nothing when the view's own card shows. Only for the person's own tap or click", "value": "true", "result": null, "permission": null, "example": { "close_card": true } },
    "pop_out": { "platforms": ["macos"], "description": "Open this app's pop-out window (its views.floating card, e.g. a round camera bubble), close it, or toggle it. Only for the person's own tap, click or switch; any other run skips it", "value": "true | false | \"toggle\", or a binding (e.g. a switch's value)", "result": null, "permission": null, "example": { "pop_out": "toggle" } },
    "canvas.clear": {"platforms": ["macos", "ios"], "description": "Clear a canvas: its saved drawing is deleted and its state key empties. Run it in the step that gives the canvas a new picture", "value": "the canvas's id, written out", "result": null, "permission": null, "example": {"canvas.clear": "markup"}},
    "if": { "platforms": ["macos", "ios"], "description": "Branch on a binding's truthiness", "value": "binding", "result": null, "permission": null, "example": { "if": "$health | map:{bad:true, else:false}", "then": [{ "notify": "Site is down" }], "else": [] } },
    "each": { "platforms": ["macos", "ios"], "description": "Run do once per item of a list, with $item and $index. A failed item goes in failed and the rest go on; a refused permission or the timeout stops it. max: default 200, at most 1000. No ask, pickers, camera, share or second each inside", "value": "list binding, with \"do\": [steps]", "result": "{ done, failed: [{ index, error }], skipped }", "permission": null, "example": { "each": "$shots", "do": [{ "files.move": { "file": "$item", "to": "$settings.folder" } }], "max": 50, "as": "moved" } },
    "job.cancel": { "platforms": ["macos", "ios"], "description": "Stop one of this app's running jobs (an action with \"job\": true); nothing when it isn't running", "value": "a job action's name", "result": null, "permission": null, "example": { "job.cancel": "convert" } },
    "reminders.add": { "platforms": ["macos", "ios"], "description": "Add a reminder; works inside each", "value": "{ \"title\": text (required), \"notes\": text, \"due\": unix seconds, ISO 8601 text, a binding or null, \"list\": a list's name (default the user's default list) }", "result": "the new reminder's id", "permission": "reminders.write", "example": { "reminders.add": { "title": "$args.text", "list": "Groceries" }, "as": "added" } },
    "reminders.done": { "platforms": ["macos", "ios"], "description": "Tick one reminder off (\"done\": false opens it again)", "value": "{ \"id\": a reminder's id, \"done\": true (default) }", "result": null, "permission": "reminders.write", "example": { "reminders.done": { "id": "$args.item.id" } } },
    "ai.generate": { "platforms": ["macos", "ios"], "description": "Ask this device's own AI model (Apple Intelligence; nothing leaves the device). Prompt up to 8 KB, one run per app at a time. Fails with ai_unavailable where Apple Intelligence is off or missing", "value": "a prompt (text), or { \"prompt\": …, \"shape\": arg type names, an object of them or a list of one }", "result": "text, or JSON in the shape", "permission": "ai.generate", "example": { "ai.generate": { "prompt": "Summarise: {$args.text}", "shape": { "summary": "text", "todos": ["text"] } }, "as": "out" } },
    "translate": { "platforms": ["macos", "ios"], "description": "Translate text on this device. The language pair must be downloaded (Settings), else it fails with translate_unavailable", "value": "text; \"to\": a language code (required), \"from\": a code or \"auto\" (default)", "result": "the translated text", "permission": "translate", "example": { "translate": "$args.text", "to": "fr", "as": "fr" } },
    "shortcuts.run": { "platforms": ["macos", "ios"], "description": "Run the person's own Shortcut by its name (literal, one permission per Shortcut). Mac: the shortcuts command, its text output comes back; keys input (text in), timeout (default 120, max 600). iPhone: opens it in Shortcuts from a tap only, nothing comes back", "value": "the Shortcut's name", "result": "Mac: its text output, or null; iPhone: null", "permission": "shortcuts.run:<name>", "example": { "shortcuts.run": "Arrive home", "input": "$args.text", "as": "out" } }
  },

  "settings": {
    "description": "Values the user gives at setup, read as $settings.<key>. The setup sheet appears when a required setting is empty.",
    "common_keys": { "type": "required", "label": "text", "required": "bool", "default": "value", "sync": "bool", "platforms": "[\"macos\"]: only asked on these (others skip it, so a Mac-only folder or storage setting doesn't keep the app off the iPhone)" },
    "types": {
      "text": { "description": "Text field", "keys": [] },
      "number": { "description": "Number field", "keys": ["min", "max"] },
      "toggle": { "description": "Switch", "keys": [] },
      "url": { "description": "URL field", "keys": [] },
      "duration": { "description": "Number + unit, stored as seconds", "keys": ["min"] },
      "select": { "description": "Popup", "keys": ["options (list of strings)", "options_from (a source name: its list of strings, or of { value, label } objects; the sheet runs it to load the choices)"] },
      "calendar.calendars": { "description": "Ticks for the user's calendars (needs calendar.read); a list of names for a calendar source's calendars, none: all", "keys": [] },
      "reminders.lists": { "description": "Picks one Reminders list (needs reminders.read or .write): a name for list, none: all", "keys": [] },
      "folder": { "description": "Folder picker (user picks; agents can't prefill)", "keys": ["must_contain", "create", "default (e.g. \"~/Pictures/Quick Shot\")"] },
      "storage": { "description": "Where files go: the user picks a folder on this Mac or an S3-compatible bucket (AWS S3, Cloudflare R2, B2, MinIO…); agents can't prefill. files.save to it returns { kind: folder | s3, path, key, url }: for a bucket, url is public_base + key, or a presigned link (expires on the step, default and max 7 days)", "keys": ["allow ([\"folder\", \"s3\"], default both)", "public_base (https URL links start with)", "create", "default (a folder suggestion)"], "example": { "dest": { "type": "storage", "label": "Save shots to", "required": true } } },
      "file": { "description": "File picker (user picks); the value is the file's path", "keys": ["accept (UTType identifiers like \"public.json\")"] },
      "connection": { "description": "The user picks a saved Connection or adds one (name + secret, Keychain only). Use it in env as \"connection:$settings.<key>\"; $settings.<key> itself is only the name. basic stores user:password", "keys": ["kind: bearer | api_key | basic | headers", "test (an action without args: the setup sheet's Test button runs it, e.g. a fetch or script that checks the key)"], "example": { "api": { "type": "connection", "label": "Stripe key", "kind": "api_key", "required": true, "test": "check_key" } } },
      "list": { "description": "Repeatable group of simple fields", "keys": ["item (fields)", "min", "max"] }
    },
    "example": { "project": { "type": "folder", "label": "Project folder", "must_contain": ".cloud", "required": true } }
  },

  "views": {
    "menubar": { "description": "How the app shows in TailApps' menu, where every app is stacked at narrow width: its card, or a row (see in_menu). With a label, the user can also keep the status in the menu bar (at most 5 apps do) and in the Dock's status area, where a busy (accent), warn or bad tone opens it into a coloured pill", "keys": { "icon": "SF Symbols name", "label": "the app's status: short text binding (truncated at 24 chars); | until and $now (a clock) tick live", "label_tone": "tone token or binding: tints a dot before the label", "label_fill": "hue or tone token, or binding: draws the status as a pill in that colour (none: the plain dot and text), e.g. \"$hue\"", "label_text": "auto (default: white or black, whichever reads on the fill) | white | black | hue: the pill's text colour", "label_icon": "SF Symbols name or binding: the status's own icon, so it can follow the state (e.g. pencil while writing, hammer while running). Default: icon", "card": "card id (default: first card)", "in_menu": "card (default): the whole card shows in TailApps' menu | row: one line with icon, name and status that expands to the card on click. Use row for apps you glance at (a status) and card for apps you use (buttons, lists)" } },
    "floating": { "description": "Optional: how the app looks when popped out into its own window (any app can pop out from its ⋯ menu; this picks the card, width and whether it starts on top). The user's Keep on Top choice wins over pin", "keys": { "card": "card id", "pin": "bool: always on top", "width": "narrow | default | wide", "chrome": "default | none: no header or frame, just the card (a card starting with a tile becomes the window); the user can switch the header back from a right-click", "tabs": "app tabs instead of card (SPEC §65.7): 2 to 5 { \"card\", \"label\" (at most 24), \"icon\" (SF Symbols) }, a segmented control under the header; the menu and Dashboard show the first. The pick is remembered" } },
    "phone": { "description": "Optional: the card the iPhone shows. Add it only when the phone should do something different, not just smaller (the renderer adapts to width). Without it the phone shows the menubar card, else the floating card, else the first card", "keys": { "card": "card id", "tabs": "app tabs instead of card (SPEC §65.7): 2 to 5 { \"card\", \"label\" (at most 24), \"icon\" (SF Symbols) }, along the bottom like the system's tab bar; the Home tile shows the first. The pick is remembered" } },
    "example": { "menubar": { "icon": "cloud", "label": "$deploys.0.status | upper", "card": "main" }, "floating": { "card": "main", "pin": true } }
  },

  "shortcuts": {
    "keys_format": "Modifiers mod (⌘), ctrl, opt, shift joined with +, then one key: \"mod+opt+d\", \"ctrl+shift+2\". Global shortcuts need a modifier.",
    "scopes": ["global", "app"],
    "notes": "Global keys are suggestions; the user confirms them at setup. An action's global shortcut may add on_release: another action (no args) that runs when the keys are let go, for hold-to-talk: start recording on press, stop and transcribe on release.",
    "example": { "open": { "keys": "mod+opt+q", "scope": "global" }, "actions": { "grab": { "keys": "ctrl+shift+2", "scope": "global" }, "listen": { "keys": "ctrl+opt+d", "on_release": "transcribe" } } }
  },

  "permissions": {
    "cli:<binary> [<arg>…]": { "shown_as": "Run `cloud deploy`", "covers": "That binary with those leading args; cli:<binary> alone covers every command", "example": "cli:cloud deploy" },
    "script:<name>": { "shown_as": "Run its script `kill-port.sh` (View)", "example": "script:kill-port.sh" },
    "net:<host>": { "shown_as": "Connect to api.stripe.com", "covers": "fetch to exactly that host. Devices on the user's network work too: an IPv4 address (net:192.168.1.50, fetch \"http://192.168.1.50/led\") or a .local name (net:esp32.local). Use fetch, not curl in a script, so it runs on an iPhone on the same Wi-Fi as well (iOS asks once for Local Network access)", "example": "net:tailstats.com" },
    "screen.capture": { "shown_as": "Take screenshots" },
    "vision.ocr": { "shown_as": "Read text from images, on this Mac (on iPhone: on this iPhone)", "covers": "vision.ocr and vision.codes" },
    "clipboard.write": { "shown_as": "Copy to your clipboard" },
    "clipboard.read": { "shown_as": "Read what you copy (on iPhone: what you copied, when you tap a button on it)", "covers": "clipboard.read steps and, on the Mac, clipboard sources" },
    "files.write:<setting>": { "shown_as": "Save into a folder you choose", "example": "files.write:folder" },
    "files.read:<setting>": { "shown_as": "Read a folder you choose", "example": "files.read:inbox" },
    "notify": { "shown_as": "Show notifications" },
    "open:url": { "shown_as": "Open links (open steps and link parts)" },
    "inbox:<name>": { "shown_as": "Receive events sent to its inbox <name> (from your hooks, webhooks or other devices)" },
    "send:<inbox>": { "shown_as": "Send to its copies on your other devices (when you turn on Sync to My Devices)", "covers": "send steps to that inbox", "example": "send:messages" },
    "send:<app>/<inbox>": { "shown_as": "Send to the app <app> (its inbox <inbox>)", "covers": "send steps with that app to that inbox; send:*/<inbox> for \"app\": \"$args.from_app\"", "example": "send:focus-light/focus" },
    "mic.record": { "shown_as": "Record from your microphone", "covers": "mic.record.start and mic.record.stop; macOS or iOS also asks for Microphone access once" },
    "speech.transcribe": { "shown_as": "Turn speech into text, on this Mac (or iPhone)" },
    "location": { "shown_as": "See where this Mac is, when you click a button on this app (on iPhone: where this iPhone is, when you tap a button on this card)", "covers": "location.get; macOS or iOS also asks for Location access once, while using only" },
    "camera": { "shown_as": "Take photos and short videos, or scan codes, when you tap a button on it", "covers": "camera.take, scan.code, a live camera player (Mac); macOS or iOS also asks for Camera access once (a video also needs mic.record)" },
    "share": { "shown_as": "Open the share sheet with things from this app, when you tap a button on it", "covers": "share" },
    "audio.read": { "shown_as": "See the volume and which speakers and microphone are in use", "covers": "{ \"system\": \"audio\" } sources" },
    "audio.control": { "shown_as": "Change the volume, mute, and switch speakers or microphone", "covers": "audio.volume.set, audio.mute, audio.input.mute, audio.output.set, audio.input.set" },
    "wifi.read": { "shown_as": "See your Wi-Fi network's name. A network name can show where you are", "covers": "{ \"system\": \"wifi\" } sources; macOS also asks for Location once, only for the network's name" },
    "wifi.control": { "shown_as": "Turn Wi-Fi on or off and join Wi-Fi networks", "covers": "wifi.power, wifi.join" },
    "bluetooth.read": { "shown_as": "See your Bluetooth devices, whether they're connected, and their battery", "covers": "{ \"system\": \"bluetooth\" } sources; macOS also asks for Bluetooth once" },
    "bluetooth.control": { "shown_as": "Connect or disconnect your paired Bluetooth devices", "covers": "bluetooth.connect, bluetooth.disconnect" },
    "network.read": { "shown_as": "See if this Mac is online, and on Wi-Fi or cable", "covers": "{ \"system\": \"network\" } sources" },
    "power.read": { "shown_as": "See battery and charging status", "covers": "{ \"system\": \"power\" } sources" },
    "power.control": { "shown_as": "Turn the display off, or keep your Mac awake (on iPhone: keep the screen on while TailApps is open)", "covers": "display.sleep, awake.start, awake.stop" },
    "usage.read": { "shown_as": "See how busy this Mac is: processor, graphics, memory and disk use", "covers": "{ \"system\": \"usage\" } sources" },
    "screen.record": { "shown_as": "Record your screen (and, when it asks, your microphone and what your Mac plays)", "covers": "screen.record.start and screen.record.stop; macOS also asks for Screen Recording (except with target pick) and, with sound, Microphone" },
    "screen.record.remote": { "shown_as": "Let your other signed-in devices ask it to record your screen (the whole screen or a window). macOS still shows that it is recording", "covers": "screen.record.start from an inbox's on_receive for a send that just came from one of the user's other signed-in devices (not a replayed send, on_sync, a push URL or another app), with target display or an id from the displays or windows source, never pick or area. Needs screen.record too. Mac only" },
    "displays.read": { "shown_as": "See your displays' names and sizes", "covers": "{ \"system\": \"displays\" } sources" },
    "windows.read": { "shown_as": "See which windows are open, and their titles", "covers": "{ \"system\": \"windows\" } sources; titles need macOS Screen Recording" },
    "wallpaper.control": { "shown_as": "Change your desktop picture", "covers": "wallpaper.set" },
    "speak": { "shown_as": "Read text out loud", "covers": "speak" },
    "calendar.read": { "shown_as": "See your calendar events", "covers": "calendar sources" },
    "reminders.read": { "shown_as": "See your reminders", "covers": "reminders sources" },
    "reminders.write": { "shown_as": "Add and complete reminders", "covers": "reminders.add, reminders.done" },
    "ai.generate": { "shown_as": "Use the AI model built into this Mac (nothing leaves it)", "covers": "ai.generate" },
    "translate": { "shown_as": "Translate text on this Mac", "covers": "translate" },
    "activity": { "shown_as": "See when your microphone or camera is in use, and when you're away from this Mac", "covers": "activity sources' mic, camera, locked, idle" },
    "activity.apps": { "shown_as": "See which apps are open and which one is in front", "covers": "activity sources' front_app, running" },
    "shortcuts.run:<name>": { "shown_as": "Run your shortcut “Arrive home”", "covers": "shortcuts.run steps for that one Shortcut (on iPhone: opens it in Shortcuts)", "example": "shortcuts.run:Arrive home" },
    "uses:<sign-in>": { "shown_as": "Use your GitHub CLI sign-in (gh)", "covers": "Scripts and cli steps run sandboxed, away from your keys. uses:gh lets them read ~/.config/gh, uses:git-ssh ~/.ssh; both give them the network. Values: gh, git-ssh", "example": "uses:gh" }
  },

  "show_ui": {
    "description": "A one-off question UI. The call blocks until the user submits, cancels or times out.",
    "request": { "title": "required, ≤ 80 chars", "card": "a part (not { id, layout })", "state": "values the card reads as $<key>", "timeout": "seconds (default 600, max 3600)" },
    "rules": "Needs at least one button with \"submit\". No actions, sources, permissions, settings, links or Connections. Fields and checklists bind to $ui.<name>.",
    "response": { "status": "submitted | cancelled | timeout", "button": "the submit id", "values": "the $ui object" },
    "example": { "title": "Deploy to production?", "card": { "column": [{ "text": "3 commits since the last deploy" }, { "row": [{ "button": "Cancel", "submit": "cancel", "style": "secondary" }, { "button": "Deploy", "submit": "deploy", "style": "primary" }], "justify": "end" }] } },
    "example_checklist": {"title": "Which migrations should I run?", "state": {"pending": [{"name": "2026_10_30_120000_add_sso_tenants_table", "drops": false}, {"name": "2026_10_30_130000_drop_legacy_session_token", "drops": true}]}, "card": {"column": [{"text": "{$pending | count} pending on staging", "emphasis": "subtle"}, {"checklist": "$pending", "label": "$item.name", "value": "$item.name", "default_checked": "$item.drops | map:{true:false, else:true}", "note": "$item.drops | map:{true:'drops column', else:''}", "bind": "$ui.selected"}, {"row": [{"button": "Cancel", "submit": "cancel", "style": "secondary"}, {"button": "Run selected", "submit": "run", "style": "primary"}], "justify": "end"}]}},
    "example_checklist_response": { "status": "submitted", "button": "run", "values": { "selected": ["2026_10_30_120000_add_sso_tenants_table"] } }
  },

  "limits": { "app_json_bytes": 262144, "script_bytes": 32768, "min_every_seconds": 5, "max_timeout_seconds": 600, "max_container_depth": 4 }
}
