Embeds as a library
A pure JavaScript package for Node ≥ 24 or Bun ≥ 1.4, with no WASM module, native addon, or isolate to wire up. Call Runtime.make, pass plain host functions, and run.
A small, fast virtual machine for a subset of JavaScript.
What it is and what it is not
A small bytecode virtual machine for running little scripts and agent code mode inside your Node or Bun app.
psychoscript/effect adaptertimeoutMs and AbortSignalsetTimeout, setInterval, setImmediate or queueMicrotask. Scripts run to the end of their body and exit, interrupting pending un-awaited workfetch, fs, process or DOM. Pass external capabilities in as host functionsexport: import and require only bind host globals (passing guest callbacks to host functions is planned)eval, Proxy, Reflect, #private members, ArrayBuffer or TypeScript syntaxEnterprise scripting solutions
NormalScript® is a small, fast virtual machine for a subset of JavaScript. It embeds in your Node or Bun application: give it a few host functions and it runs little scripts and agent code mode, pausing to bytes and resuming later. Nothing unusual happens here.
Review capabilities View compliance matrix View on GitHub
Trusted by more than 400 normal organizations · Node ≥ 24 or Bun ≥ 1.4 · MIT licensed
0
WASM modules, native addons, or workers to wire up
1
Call to run a script: runtime.execute(code)
19,408
test262 files passing; 2,845 skipped as known gaps, 0 failing
Bytes
What a paused run is saved as, and resumed from
Core capabilities
For teams that run little scripts, plugins, lightweight workflows, or agent code mode inside a Node or Bun application, without operating a second runtime.
A pure JavaScript package for Node ≥ 24 or Bun ≥ 1.4, with no WASM module, native addon, or isolate to wire up. Call Runtime.make, pass plain host functions, and run.
Scripts compile to bytecode and run on a compact virtual machine inside your process. There is no worker to spawn and nothing to boot, so a run starts when you call it and stops on timeoutMs or an AbortSignal.
An agent, user, or plugin writes one script that chains many host calls, with loops, branches, and Promise.all in between. Errors return a kind, a message, and optional suggestions.
Host.fn turns an ordinary function into a global. Host.namespace resolves large catalogs lazily. Host.durableFn keeps long work running across a suspend. StreamingResponse streams a response body.
Suspend a waiting run with program.suspend(), save its state with toBytes(), and continue it with fromBytes() and runtime.resume(). Same build, same globals, same result.
Scripts are written in a modern, strict-mode subset of JavaScript: async functions, generators, classes, and top-level await and return. The host API is Promise-based, with the same names over Effect at /effect.
Reference integration
Runtime.make takes a globals function and optional limits. Plain objects of host functions act as namespaces. Arguments reach the host as copies, and results are copied back. There is no further setup.
Exhibit A · A code-mode script chaining host calls
import { Host, Runtime } from "normalscript"
const ledger = [
{ id: "INV-1", total: 1200, paid: true },
{ id: "INV-2", total: 450, paid: false },
{ id: "INV-3", total: 80, paid: false },
]
const outbox = []
const runtime = Runtime.make({
limits: { timeoutMs: 1_000 },
globals: () => ({
invoices: {
list: Host.fn(() => ledger),
remind: Host.fn(([id]) => outbox.push(id), {
type: "async",
}),
},
}),
})
// Code mode: one script, several host calls.
const result = await runtime.execute(`
const due = invoices.list().filter((i) => !i.paid)
await Promise.all(due.map((i) => invoices.remind(i.id)))
const owed = due.reduce((sum, i) => sum + i.total, 0)
return { reminded: due.length, owed }
`)
console.log(result.value)
// { reminded: 2, owed: 530 }
Exhibit B · Suspend, save, and resume
import {
Host,
Runtime,
fromBytes,
toBytes,
} from "normalscript"
const slow = ([n]) =>
new Promise((done) => setTimeout(() => done(n * 10), 50))
const runtime = Runtime.make({
globals: () => ({
fetchMetric: Host.fn(slow, {
type: "async",
idempotent: true,
}),
}),
})
const program = runtime.program(`
let total = 0
for (const n of [1, 2, 3]) total += await fetchMetric(n)
return total
`)
const running = program.run()
// Pause the run mid-call and save its state as bytes.
const outcome = await program.suspend()
await running
const bytes = toBytes(outcome.state)
// Later, in any process with the same build and globals.
const result = await runtime.resume(fromBytes(bytes)).run()
console.log(result.value)
// 60
Operational specifications
How a run starts, stops, pauses, and resumes. All behavior below is standard.
Scope and compliance matrix
NormalScript® is a small embeddable virtual machine for a subset of JavaScript, not a full runtime such as Node, Bun, or a browser. Whatever a script needs from outside, the host passes in. The omissions below keep it small.
Evaluation and procurement
NormalScript® is distributed under the MIT License. To begin an evaluation, request a demo or download the white paper. Both are standard next steps.
Form NS-7 · Declaration of Normal Viewing
I, the undersigned, declare that I viewed the NormalScript® website and that nothing unusual happened.
I did not take the tab. I did not see a sun, a face, a valley, a terminal, a planet, a snake, or my manager. Any colours I recall were within brand guidelines.
I understand that this declaration may be audited.
SignatureDate
Retain for your records. Do not fold.