Scripting with @x1/script
Partly liveTypeScript scripting with @x1/script — one scripting API for OG worlds, native runtime games and hosted web games, in a sandboxed VM on every 0x host. Creators publish packages into OG Earth today.
Publishing is open
Creators publish TypeScript packages into OG Earth: see Publishing scripts to worlds. @x1/script 0.2.0 and the 0x CLI 0.1.7 (0x script publish) are in the 0x registry. Sign in with 0x login, or use a publish token from Developer › Tokens in CI. What a package can ask for is in Capabilities.
#What it is
@x1/script lets you write game logic in TypeScript once and run it on every 0x host: OG worlds (the Minecraft-stack worlds), games on the native runtime, and hosted web games. The API, its names and its semantics follow the Luau-style scripting model (Players.PlayerAdded, task.wait, DataStore, signals with Connect). Methods that wait for the host return promises.
import { Players, Messaging, task } from "@x1/script";
Players.PlayerAdded.Connect(async (p) => {
p.SendMessage(`Welcome, ${p.DisplayName}`);
await task.wait(1);
await Messaging.PublishAsync("players.joined", { player: p.UserId });
});#Design, as it stands
- One API, every host: OG worlds (Paper), games on the 0x engine (sg-runtime), hosted web games, and the links between them.
- Roblox-style API:
Players.PlayerAdded.Connect(...),ChatandWorldevents;DataStore.GetStore(name).UpdateAsync(...);Messaging.PublishAsync/SubscribeAsyncacross experiences (with grants);Teleport.TeleportAsync(player, destination, data);task.wait/spawn/delay;RunService.Heartbeat. Anything that waits on the host returns a promise. - Compiler:
x1-script build(pinned) turns each script into one ES module with a source map, so errors point at your.tslines. - Runtime: scripts run in
x1script.wasm(QuickJS-ng compiled to WebAssembly). The same module runs on every host: wasmtime in worlds and games, the browser in web games. - Capabilities: sensitive calls need a capability the host grants (
chat,kick,world,teleport,kv,messaging,items, …). A script can check one withHost.Supports(capability). - Sandbox: each script gets its own sandbox: frozen built-ins, no
evalornew Function(string), imports from@x1/scriptonly, and per-handler time and step budgets plus a memory cap thattry/catchcan't escape. - Script bus: experiences talk to each other through the 0x script bus. Unmodified Steam games appear on it as events through the Steamworks compatibility bridge.
#Status
- Live (2026-10-17): OG Earth runs X1Script (wasmtime) as the experience
earthon the production script bus. Its first script only publishes events:players.joined,players.leftanditems.picked. - Live (2026-10-23): publishing packages into worlds, reviewed and approved per version, each in its own sandbox: see Publishing scripts to worlds.
- Live (2026-10-23):
@x1/script0.2.0 (typings, the pinned compiler andx1-script pack/submit/status/withdraw) and@x1/script-runtime0.2.0 in the 0x registry (https://0x.limo/npm/);0x script publishin the 0x CLI 0.1.7. - Live (2026-10-24): publish tokens for CI at Developer › Tokens.
- Public: the bus answers
GET https://api.0x.limo/v1/scriptbus/info({"api":0,"universe":"earth"}). - Not open yet: direct third-party access to the script bus from your own servers or clients (experience keys and bus grants). Packages reach the bus through their sandbox's
messagingandkvcapabilities.
Next: Publishing scripts to worlds · Capabilities · Sandboxes.
