Skip to content

How scripts run there

  • The same prelude. Every run gets a fresh node:vm context with the shared prelude.js, in a worker thread. The worker has a memory limit (128 MB), and it is terminated when a phase runs past its deadline, so an endless loop never stalls the server.
  • The same contract. Timeouts, limits, the network allowlist, normalization and redaction all work as in the app. The shared conformance suite (conformance/) runs on both, so they stay the same.
  • Isolation, not a sandbox. Scripts see only the prelude’s globals, not require, process or the file system. But node:vm is not a security boundary against hostile code. Run scripts you wrote or trust, as in the app.
  • Secrets are encrypted per item with AES-256-GCM, bound to the item’s ID. They appear in no response, log or database column in plain text.

Each item runs at its interval plus up to 10 % of jitter (at most five minutes), and failing items back off (2×, 4×, … up to six hours). Runs record the trigger server; runs started with the API record manual.

Runs go through the same rules as in the app: type switches, mute, dedupe with dedupeKey and cooldown, at most 10 per item per hour (“+N more”), and optional failure alerts after three failures in a row. Delivered notifications go to:

  • Push, to every paired device that registered for it, when APNs is set up.
  • The log, as {"msg":"notification","notification":{…}}.
  • The webhook, if set.

The apps merge the server’s notifications into their notification history, marked as from the server. They count for deduplication too, if the item moves back to a device.

With RUNDOWN_WEBHOOK_URL set, every delivered notification is sent as:

POST { "event": "notification",
"notification": { "id", "itemID", "itemName", "type", "title", "subtitle", "body",
"url", "level", "dedupeKey", "createdAt" } }

With RUNDOWN_WEBHOOK_SECRET, the header X-Rundown-Signature: sha256=<hex> is the HMAC-SHA256 of the raw body. Check it before trusting the request:

const expected = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
Terminal window
cd server
npm test # the server tests, plus the conformance cases and every example's fixtures

The code is TypeScript that Node runs directly (type stripping), so it uses only erasable syntax: no enums, and no parameter properties.