core
invoke(cmd, args) — the generic bridge everything else is built on.
Roves' general-purpose native bridge. Every other module (process, cache) is a thin,
typed wrapper around a call to invoke() here.
import { invoke } from "@drincs/roves-api/core";
await invoke("exit");invoke<T>(cmd: string, args?: Record<string, unknown>): Promise<T> calls a native
command and returns its JSON-decoded result. In the
Roves player it's a same-origin fetch() to
the player's host API (always a POST, since commands may change state); in the previous
Servo-based Shell it's a fetch("roves:<cmd>?<args>") against the roves: protocol. The
package detects which one is available.
The command set is deliberately small and general-purpose: system information and window/process lifecycle. Larger, self-contained SDKs (Steam) get their own module instead of being routed through here — see steam.
Most of your game's code should reach for process/steam/cache/saves directly rather
than calling invoke() by hand — it's exported mainly so those modules (and any future ones)
have a single, consistent implementation to build on.
isAvailable()
import { isAvailable } from "@drincs/roves-api/core";
if (isAvailable()) {
// running inside Roves
}isAvailable(): boolean — synchronous, no await needed. true when this page is actually
running inside Roves, false in a regular browser (or any other embedder). There's no
build-time signal for this — instead, Roves defines a window.__ROVES__ marker before the
page's own scripts run (mirroring how Tauri exposes window.__TAURI_INTERNALS__), and
isAvailable() just reads that marker directly — no fetch() round trip. The Roves player
defines it as a frozen object that also tells roves-api where its host API is; the
previous Shell defined it as true. A plain browser never gets this marker, which is
exactly what this reports as "unavailable".
isMcpEnabled()
import { isMcpEnabled } from "@drincs/roves-api/core";
if (import.meta.env.DEV || isMcpEnabled()) {
enableAgentTestingHooks();
}isMcpEnabled(): boolean (since 0.10.0) — synchronous, and already final in your game's
entry script. true only in the top-level game document of a Roves player whose
local MCP
bridge is running, which means an MCP client (an AI agent, an IDE) can inspect
and drive the game (the MCP development packages on Windows, macOS and Linux). false in a
regular browser, in standard and Steam packages, in older
Shells, when the bridge failed to start, and in child frames.
Use it to switch on development-only test hooks for agents, such as a playtesting bridge
(Pixi'VN's window.pixiVN, for example). It is a capability hint, not a security boundary:
any page can define the same global itself, so never gate secrets or privileges on it.
Check this before calling into saves
(or any other Roves-only module) if your code might also run outside Roves — e.g. a browser
preview during development.
systemInfo()
import { systemInfo } from "@drincs/roves-api/core";
const info = await systemInfo();
console.log(`${info.os_type} ${info.os_version} (${info.architecture})`);systemInfo(): Promise<SystemInfo> returns host OS and engine diagnostics — useful for bug
reports and graphics-compatibility triage:
interface SystemInfo {
os_type: string; // e.g. "windows", "macos", or a Linux distro id like "ubuntu"
os_version: string | null; // null on Windows in the Roves player
bitness: "64-bit" | "32-bit";
architecture: string; // e.g. "x86_64", "aarch64"
engine_version: string; // e.g. "roves-cef-player cef-<CEF version>" in the Roves player
}Field names deliberately mirror @tauri-apps/plugin-os's (type()/version()/arch()) and
the os_info crate's (os_type/version/bitness/architecture) own conventions.
engine_version names the runtime that's running — the equivalent of a "webview version"
elsewhere, which is what matters when triaging a graphics/rendering report. In the Roves
player it includes the CEF (Chromium) version; in the previous Shell it named the Servo-based
build.