npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

flux-vm-js

v1.0.0

Published

FLUX.js — JavaScript Bytecode VM. Self-contained FLUX runtime for Node.js and browsers.

Downloads

47

Readme

FLUX.js — JavaScript Bytecode VM

npm CI License

FLUX — Fluid Language Universal eXecution Self-contained FLUX runtime for Node.js and browsers. ~400ns/iter via V8 JIT.


Quick Start

npm install flux-js
const { FluxVM, assemble } = require('flux-js');

const bc = assemble('MOVI R0, 42\nHALT');
const vm = new FluxVM(bc);
vm.execute();
console.log(vm.reg(0)); // 42

What It Does

FLUX.js brings the FLUX bytecode virtual machine to JavaScript runtimes — Node.js and browsers. It implements the same register-based ISA, opcode set, and A2A agent messaging protocol as the Python and Rust implementations, but leverages V8 JIT compilation to achieve ~400 nanoseconds per iteration on modern hardware.

The VM provides a deterministic, sandboxed execution environment for agent logic. Programs are assembled from text into compact bytecode, then executed with cycle budgets to prevent runaway computation. The included Interpreter class maps natural-language patterns ("factorial of 7", "sum 1 to 100") to bytecode, making it easy to build agent systems where computation is both human-readable and machine-verifiable. A built-in Swarm class enables multi-agent coordination with majority-vote consensus.


Architecture

FLUX.js is the JavaScript implementation of the FLUX bytecode runtime in the SuperInstance ecosystem. It shares the same ISA, A2A protocol, and vocabulary system as the Python and Rust implementations, making bytecode portable across all three runtimes.

Features

  • VM — 16 registers, all opcodes, cycle-limited execution
  • Assembler — text → bytecode with labels and comments
  • Disassembler — bytecode → human-readable listing
  • Vocabulary — 10 natural-language patterns
  • A2A Agents — multi-agent coordination with messaging
  • Swarm — vote and consensus across agents
  • ~400 ns/iter on V8 JIT

API / Usage

Assembly Syntax

MOVI R0, 42        # Load immediate
MOV R0, R1         # Copy register
IADD R0, R1, R2    # R0 = R1 + R2
ISUB R0, R1, R2    # R0 = R1 - R2
IMUL R0, R1, R2    # R0 = R1 * R2
IDIV R0, R1, R2    # R0 = R1 / R2
INC R0              # R0++
DEC R0              # R0--
CMP R0, R1          # Compare → flags
JNZ R0, offset      # Jump if not zero
JZ R0, offset       # Jump if zero
JMP offset          # Unconditional jump
PUSH R0 / POP R0    # Stack operations
HALT                # Stop

Natural Language

const { Interpreter } = require('flux-js');
const interp = new Interpreter();

interp.run('factorial of 7');     // { value: 5040, cycles: 24 }
interp.run('sum 1 to 100');       // { value: 5050, cycles: 303 }
interp.run('power of 2 to 10');   // { value: 1024, cycles: 34 }

A2A Swarm

const { A2AAgent, Swarm, assemble } = require('flux-js');

const bc = assemble('MOVI R0, 42\nHALT');
const swarm = new Swarm();
for (let i = 0; i < 5; i++) swarm.add(new A2AAgent(`a${i}`, bc));
swarm.tick();
console.log(swarm.consensus()); // 42

Exports

const { FluxVM, assemble, disassemble, Interpreter, A2AAgent, Swarm } = require('flux-js');

| Export | Description | |--------|-------------| | FluxVM | Bytecode virtual machine | | assemble(text) | Text assembly → Uint8Array | | disassemble(bc) | Bytecode → string[] | | Interpreter | Natural language → execution | | A2AAgent | Single agent with inbox | | Swarm | Multi-agent coordinator |

Built-in Vocabulary

| Pattern | Description | |---------|-------------| | compute X + Y | Addition | | compute X - Y | Subtraction | | compute X * Y | Multiplication | | double X | Double | | square X | Square | | factorial of N | N! | | fibonacci of N | F(N) | | sum A to B | Sum range | | power of BASE to EXP | Exponentiation | | hello | Returns 42 |


Testing

npm install
npm test

Contributing

Contributions are welcome! See the SuperInstance Contributing Guide.

  1. Fork the repo
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure npm test passes
  5. Submit a PR

📦 Related Packages

| Package | Language | Registry | Install | |---------|----------|----------|---------| | flux-vm | Python | PyPI | pip install flux-vm | | fluxvm | Rust | crates.io | cargo add fluxvm | | flux-js | JavaScript | npm | npm install flux-js |

Additional implementations: C · Zig · Go · Java · WASM · CUDA


Ecosystem

This repo is part of the SuperInstance flagship ecosystem — agent-first computation, constraint theory, and self-improving runtimes.

FLUX Runtime Family

| Repo | Language | Description | |------|----------|-------------| | flux-runtime | Python | Full FLUX runtime: markdown→bytecode, 2037 tests, zero deps | | flux-core | Rust | Register-based bytecode VM, deterministic agent computation | | flux-js | JavaScript | FLUX VM for Node.js and browsers, ~400ns/iter | | flux-compiler | Rust/Python | Formal-methods compiler for safety-critical codegen | | flux-vm | Rust | Stack-based constraint-checking VM, 50 opcodes, Turing-incomplete |

PLATO Engine Family

| Repo | Language | Description | |------|----------|-------------| | plato-server | Python | Knowledge tiles, fleet sync via Matrix, HTTP API | | plato-engine-block | Rust | Original room runtime: no_std + alloc, builder pattern | | plato-engine-block-c | C99 | Embedded reference: zero heap alloc, bare-metal portable | | plato-engine-block-elixir | Elixir | BEAM supervision trees, fault tolerance, hot reload | | plato-runtime-kernel | Rust | Spatial model: tensor grid, batons, assertion traps |

Constraint / Theory Family

| Repo | Language | Description | |------|----------|-------------| | categorical-agents | Rust | Category theory for agent composition (functors, naturality) | | cuda-constraint-engine | CUDA/C | GPU constraint checking at 1B+ constraints/sec | | grand-pattern-rs | Rust | Fibonacci dual-direction cellular graph architecture | | lau-hodge-theory | Rust | Hodge decomposition, Betti numbers, spectral sequences | | ternary-science | Rust | Experimental evidence for ternary intelligence, 5 conservation laws |

Agent / Infrastructure Family

| Repo | Language | Description | |------|----------|-------------| | construct-core | Rust | Layered trait system: bare-metal → alloc → async agent runtime | | crab | Bash | Agent shell for repo entry/leave (MUD-room metaphor) | | exocortex | Rust | Persistent cognitive substrate, S3-compatible memory | | git-agent | Python | The repo IS the agent — autonomous lifecycle via Git | | capitaine-1 | TypeScript | Git-native repo-agent, Cloudflare Workers heartbeat | | codespace-edge-rd | Research | Codespace→Edge agent lifecycle and yoke transfer protocols | | git-agent-codespace | DevContainer | One-click Codespace template for Git-Agent runtimes |

Registries

| Registry | Package | Install | |----------|---------|---------| | PyPI | flux-vm | pip install flux-vm | | crates.io | fluxvm | cargo add fluxvm | | npm | flux-js | npm install flux-js |

Philosophy & Architecture


License

MIT


Same bytecode, different shells. 🦀