Skip to content

armgit / janas

Public Imported from GitHub
0

37 tok/s from Qwen3-Next-80B (48 GB) on a 32 GB laptop, 24 without drafts vs 2.8 for llama.cpp; reading 62 vs 16 tok/s. Faster than llama.cpp on all 13 models compared in Q4_K_M. LLMs bigger than your RAM, pure C, CPU or GPU.

Release 2026-10-22 (2): the module for Node.js in the Linux package - janas.node and its types for TypeScript, janas.d.ts, in node/ of janas-linux-x86_64.tar.gz from the next binary release on: a Node.js program opens a model with the package alone; the release workflow checks that the module, as packed, loads, where its runner has Node.js

camauric18afd8f54b2
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index b8def8b..341c241 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -68,7 +68,7 @@ jobs:
set -euo pipefail
B=bin/x86_64-linux
P="$PACKAGE/janas"
- mkdir -p "$P/services" "$P/lib" "$P/include/janas" "$P/docs"
+ mkdir -p "$P/services" "$P/lib" "$P/include/janas" "$P/docs" "$P/node"
for f in janas-chat janas-server janas-get janas-bench janas-mcp \
gguf2jns jns_planes hf2jns_mtp jns_check vkcheck; do
install -m 755 "$B/$f" "$P/"
@@ -83,6 +83,9 @@ jobs:
sed -E 's#\(([a-z]+)/README\.md\)#(janas-\1.md)#g' \
src/services/README.md > "$P/services/README.md"
install -m 755 "$B/libjanas_llm.so" "$B/libjanas_mcp.so" "$P/lib/"
+ # the library as a module for Node.js, with its types for TypeScript
+ install -m 755 "$B/janas.node" "$P/node/"
+ install -m 644 "$B/janas.d.ts" "$P/node/"
install -m 644 include/janas/* "$P/include/janas/"
install -m 644 docs/*.md "$P/docs/"
install -m 644 dist/README.md "$P/README.md"
@@ -91,6 +94,13 @@ jobs:
if find "$P" -type f \( -name '*.sh' -o -name '*.py' \) | grep -q .; then
echo "a script in the package"; exit 1
fi
+ # the module, as packed, loads where the runner has Node.js
+ if command -v node >/dev/null; then
+ node -e 'const j = require(process.argv[1]);
+ if (j.abiVersion() !== 1) process.exit(1);
+ console.log("janas.node " + j.version + " loads in Node " + process.version)' \
+ "$(realpath "$P/node/janas.node")"
+ fi
# the newest C library the programs ask for
find "$P" -type f -perm -u+x ! -name '*.so' -print0 |
xargs -0 -n 1 objdump -T | grep -o 'GLIBC_[0-9.]*' |
diff --git a/ChangeLog.md b/ChangeLog.md
index d41ca7d..1117f6f 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -2,6 +2,10 @@
> Curated, user-facing summary of completed work, newest first.
+## [2026-10-22] - The module for Node.js in the Linux package
+
+- **The Linux package carries `janas.node`** and its types for TypeScript, `janas.d.ts`, in `node/`: a Node.js program opens a model with the package alone, without building Janas. The release workflow checks that the module, as packed, loads, where its runner has Node.js. The Windows package has no module yet.
+
## [2026-10-21] - Janas-LLM in Node.js
- **`janas.node`, the library as a module for Node.js** (Linux), made by `./build.sh` beside the programs, with its types for TypeScript (`janas.d.ts`): `open()` a model, `model.chat()`, then `chat.send(text)` or `chat.load(messages)` and the reply read with `for await`, piece by piece (the answer, the reasoning, how much of a long prompt is read), or whole with `reply.text()`, its counters with `reply.stats()`. Leaving the loop, `reply.stop()` or an `AbortSignal` stops it. Each model runs on a thread of its own, so JavaScript's thread never waits for it; a model's replies come one at a time, in the order asked; an idle model does not keep Node running, and one left open is closed when Node leaves. Written in C against Node-API (version 8), whose functions it declares itself: building it needs nothing of Node's (checked against Node's headers where they are installed). Tried with Node 20: `tests/test_node` without a model, in the suite, and `tests/node_check` on Qwen3-0.6B, where the replies through Node are the library's own in C, byte for byte; both also under AddressSanitizer and ThreadSanitizer. `docs/library.md`, "From Node.js".
diff --git a/dist/README.md b/dist/README.md
index 9f6d0dd..0af48b5 100644
--- a/dist/README.md
+++ b/dist/README.md
@@ -53,6 +53,7 @@ Janas-LLM, the inference engine of Janas, runs large language models on ordinary
| `vkcheck` | whether this computer's GPU can run Janas's GPU backend, and why not: what the backend needs with the driver's answer, then three short tests on the GPU |
| `services/` | Janas's services, which bring data of the world to a model: flights, weather, maps, prices, earthquakes, Wikipedia, GitHub, git, this computer. `janas-chat` starts them by itself; any other MCP client can use them. See `services/README.md` |
| `lib/`, `include/` | `libjanas_llm` and `libjanas_mcp` with their C headers and FreeBASIC bindings, for programs of your own; the programs above do not need them |
+| `node/` | `janas.node`, the library as a module for Node.js, and `janas.d.ts`, its types for TypeScript: a model opened inside a program of yours, its replies read as they are written (`docs/library.md`, "From Node.js"; tried with Node.js 20) |
## Needs
diff --git a/docs/library.md b/docs/library.md
index 0d64618..3f35d7e 100644
--- a/docs/library.md
+++ b/docs/library.md
@@ -65,7 +65,7 @@ Two things to know. FreeBASIC does not tell names apart by their case, so the co
## From Node.js
-`janas.node` is the library as a module for Node.js, made by `./build.sh` on Linux beside the programs (`bin/x86_64-linux/janas.node`), with its types for TypeScript beside it (`janas.d.ts`). It is written in C against Node-API, version 8, whose functions it declares itself: building it needs nothing of Node's. It was tried with Node 20. Each model runs on a thread of its own, so JavaScript's thread never waits for it, and a reply is read as it is written:
+`janas.node` is the library as a module for Node.js, made by `./build.sh` on Linux beside the programs (`bin/x86_64-linux/janas.node`), with its types for TypeScript beside it (`janas.d.ts`); the Linux package carries the two in `node/`. It is written in C against Node-API, version 8, whose functions it declares itself: building it needs nothing of Node's. It was tried with Node 20. Each model runs on a thread of its own, so JavaScript's thread never waits for it, and a reply is read as it is written:
```ts
import { createRequire } from "node:module";