lmcode-js

lmcode-js is a dependency-free Node.js ESM SDK (@lmctl-ai/lmcode-js) for loading, verifying, and executing lmcode DSLB v6 bytecode in JavaScript hosts. It provides lossless BigInt and raw Buffer string modes, the 226-signature lmcode_std_v3 catalog, registerRest stdio HTTP/CLI controller, and InvocationResults.

Quick reference

git clone https://github.com/lmctl-ai/lmcode-js.git
cd lmcode-js
npm test
npm run conformance
ItemSignature / ValueRole
createRegistry()RegistryCreate a registry preloaded with all 226 canonical lmcode_std_v3 signatures
new Registry()RegistryCreate an empty registry without the standard catalog
Program.load(bc, schema, reg)ProgramVerify DSLB v6 header, SHA-256 schema hash, imports, and control-flow stack depths
program.run(context)voidExecute the bytecode body against a Context instance
program.call(nameOrIndex, ctx, args)anyInvoke an R49 rule entry by name or index
registerRest(reg, options)RestControllerRe-bind the 20 REST/CLI std signatures to a configured stdio HTTP/1.1 and CLI controller
InvocationResults.fromCommand(files)InvocationResultsRead LMCODE_INVOCATION_FILE, manage per-part ResultSinks, and format LMCODE_RETURN frames
import { readFileSync } from 'node:fs';
import { Context, Program, createRegistry } from '@lmctl-ai/lmcode-js';
import { registerRest } from '@lmctl-ai/lmcode-js/rest';

const registry = createRegistry();
const rest = registerRest(registry, { maxBodyBytes: 1 << 20 });
const bytecode = readFileSync(process.argv[2]);
const schema = readFileSync(process.argv[3]);
const program = Program.load(bytecode, schema, registry);
await rest.run(program, new Context());

Documentation pages

Source repository and releases