Skip to content

Call Tilecast services from an external package

External packages are untrusted third-party code installed at runtime. Their server logic runs as WebAssembly on Tilecast Server, and it reaches Tilecast through versioned service grants — never through SQL, the filesystem, or OS calls.

The public SDKs and Hello Services sample are available under Apache-2.0. Your independent extension does not have to use AGPL just because it uses these SDKs. The licensing policy explains where AGPL still applies. Package installation, provenance, and Marketplace requirements are unchanged.

Use Package API v3 or v4 and list each service in capabilities.services with its {id, version}. The install review shows every grant and the operations it unlocks before anything installs. Unknown services fail the review.

Services cover organization facts, installation facts, screen and target directories, content, managed presentations, takeovers, the basic user directory, audit events, package storage, Player display control, and external Player plugin state. Each grant names its exact supported version. For the full inventory, see the package service capabilities engineering reference.

Guests call tilecast.call_v1 with an operation token such as screens.read@1/list and a JSON input. An executed call answers an envelope: {ok: true, data} or {ok: false, error} with a typed failure. A missing grant, a forbidden context, or an unknown operation fails closed at the transport.

The reference guest SDK (packages/package-guest-sdk) owns the unsafe boundary, envelope parsing, and typed shapes. The Hello Services sample (packages/package-samples/hello-services) shows a scheduled job that reads screens and writes one audit event.

Background jobs run with no user actor. They read the installation-wide view that the service grant approves, and never borrow the access of the person who installed the package. Studio interface calls run as the signed-in account with that operation’s dashboard role policy.

content.read@2 and activity.read@1 are the current read services for content and Activity, with cursor pagination. content.read@1 keeps working exactly as before, but it is a different grant: moving a package to content.read@2 shows up as a permission change in the update review. See the plugin read services reference.

Set capabilities.storage to true for the kv_get and kv_set imports. Add the storage.kv@1 service grant when you also need to delete a key or write only if the current value is what you expect (compareAndSet). Both use the same package namespace: a value you write with kv_set reads back through storage.kv@1, and the reverse. Keys hold up to 128 bytes, values up to 64 KiB, and the whole package up to 1 MiB. The Rust guest SDK’s storage module wraps the service with the right buffer sizes:

use tilecast_package_guest::storage;
let cursor = storage::get("cursor")?;
if storage::compare_and_set("cursor", cursor.as_deref(), b"next-page")? {
// This run moved the cursor; another run did not get there first.
}

Bundled plugins call the same service and get the same answers. The installed parity reference lists which services packages and bundled plugins share, and why the rest differ.

List each HTTPS host in capabilities.network.hosts. The http_fetch import makes one GET to a listed host on the default port. Tilecast refuses any other URL before it looks the name up. The request then goes through the same outbound engine that bundled plugins use: it refuses private, loopback, and other non-public addresses, follows no redirects, and stops after 1 MiB or 10 seconds. A response outside the 2xx range is an error.

Use Package API v4 when your integration needs frequent server-side updates. Declare one job in capabilities.realtime.jobs with an id and intervalSeconds between 5 and 60. Its ID must differ from your ordinary jobs. Keep ordinary jobs on their existing minute-based schedule.

Studio identifies this as High-frequency background activity during install review and shows the seconds cadence under Background jobs. The realtime runner gives the whole job four seconds, including host calls, and gives each fetch at most three seconds. Make repeated execution safe: a server crash can cause another attempt after its lease expires.

An update, rollback, or removal stops the previous activation’s code. Package storage survives updates and rollbacks; removing and reinstalling a package starts with empty storage. See the package execution contract for the exact bounds.

You can qualify a draft package’s OCI layout through Tilecast’s real Wasm host and database services. Keep the scenario in your package repository and use the external fixture test described in the package service contract. The test exercises runtime state, targeting, realtime scheduling, and lifecycle changes using local test records. It uses a temporary compatibility variant to run an unreleased draft; passing this test does not establish release compatibility or native Player qualification.

Install review shows each executable contribution’s allowed Player surfaces and priority tier, read from its verified artifact. The custom installer checks that execution permissions match the manifest reviewed from GitHub. Configuration updates require access to both the previous and new targets, so a scoped administrator cannot remove a surface from screens outside their scope.

API 4 guests receive their call input at a non-null memory address. Use the addresses supplied to the exports and reserve the framing windows described in the engineering contract. The Rust guest SDK provides typed state and target helpers, bounded fetch and KV imports, and helpers for reading and writing the Studio call frame.

An external Plugin API v2 contribution uses a fixed runtime/index.js bundle. Tilecast assembles and verifies a sandboxed frame around that bundle. It executes only on Players that report the generic plugin.external-runtime@1 capability. Tilecast Edge reports it. Tilecast Player for Windows and Android have the code but do not report it yet, so they receive no executable surface until their own qualification passes. Other Players keep their existing manifest.

Request plugin-runtime.state@1 to save operator configuration and publish expiring state for your own contribution. Request targets.resolve@2 for screen, group, location, or explicit-all selection and a scoped target picker. Keep private integration bookkeeping in package storage; publish only the fields the Player needs. The state service checks the configuration revision so an old poll cannot overwrite newly saved settings.

The Player frame receives a corrected clock, motion and presentation hints, and its surface grants. It gets no Player credentials, network, parent DOM, or native bridge. Follow the external Player plugin contract for the descriptor, state operations, frame handshake, and compatibility requirements.

The WPE contributor test apps/edge/renderer-wpe/ci/run-e2e.sh external-plugin runs the shipped Runtime in a real WPE engine and exercises a verified surface alongside native video playback, once on an ordinary playlist and once on a synchronized group. It checks preview pixels, sandbox isolation, state refresh, corrupt frame rejection, and removal without another presentation activation or a video restart. A separate engine test checks document navigation with a negative control. These tests do not qualify the WebKit process sandbox, physical display hardware, or the Windows and Android Players; Edge gets a manual canary on a real screen after each coordinated release.

The players.display-control@1 service exposes one method per Player Capability operation, for example display.power. A call carries the target screenId and the operation input. The server verifies the target screen reports the matching capability before queueing anything through the ordinary Player command path. Guests never name a command type.

Player capabilities are versioned and independent of operating system. No package ships per-platform Player code. For the registry and the reporting contract, see the Player capabilities engineering reference.