brsh 2.7.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/Readme.md +33 -16
- package/bin/brsh-shell.js +15 -1
- package/dist/shell.es.js +243 -109
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +7 -7
- package/dist/shell.min.js.map +1 -1
- package/dist/terminal.cjs.js +101 -0
- package/dist/terminal.cjs.js.map +1 -0
- package/dist/terminal.es.js +290 -8107
- package/dist/terminal.es.js.map +1 -1
- package/dist/terminal.min.js +4 -32
- package/dist/terminal.min.js.map +1 -1
- package/dist/wbt.es.js +1619 -6133
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +6 -20
- package/dist/wbt.min.js.map +1 -1
- package/index.js +29 -0
- package/lib/BaseFileSystem.js +40 -0
- package/lib/BinaryContainer.js +1 -1
- package/lib/FileSystem.js +1 -38
- package/lib/NodeFileSystem.js +4 -2
- package/lib/Terminal.js +45 -10
- package/lib/WasmCommand.js +168 -18
- package/lib/local/curl.js +60 -2
- package/lib/wbt/index.js +297 -64
- package/lib/wbt/packages/wllama.js +1061 -0
- package/lib/wbt/registry.js +31 -19
- package/package.json +3 -2
- package/test/curl.test.js +166 -0
- package/test/terminal.test.js +113 -0
- package/test/wasm-cli.test.js +127 -0
- package/test/wbt.test.js +342 -232
- package/vite.config.terminal.js +16 -12
- package/vitest.config.js +6 -0
- package/lib/wbt/daemon.js +0 -264
- package/lib/wbt/packages/pglite.js +0 -590
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## [2.8.1](https://github.com/eliotstocker/Brsh-JS/compare/v2.8.0...v2.8.1) (2026-11-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **wbt:** eagerly pull and persist .wasm binaries on install, upgrade jq-web@0.6.2, and fix browser bundling ([#29](https://github.com/eliotstocker/Brsh-JS/issues/29)) ([e713798](https://github.com/eliotstocker/Brsh-JS/commit/e713798656926a8b2afce9571a853ffc928099c1))
|
|
7
|
+
|
|
8
|
+
# [2.8.0](https://github.com/eliotstocker/Brsh-JS/compare/v2.7.0...v2.8.0) (2026-11-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **ci:** add pretest build and ensure dist/terminal.cjs.js exists for tests ([cb88ea4](https://github.com/eliotstocker/Brsh-JS/commit/cb88ea45f338db25efc0d7c65953f101d990be07))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **terminal:** externalize Shell dependency to reduce bundle size ([d2f8dd9](https://github.com/eliotstocker/Brsh-JS/commit/d2f8dd93155d55f1c843192a0d195032c7db95e3))
|
|
19
|
+
* **wbt:** add wllama v3 WebAssembly and WebGPU LLM inference adapter ([#26](https://github.com/eliotstocker/Brsh-JS/issues/26)) ([b7f647d](https://github.com/eliotstocker/Brsh-JS/commit/b7f647d703b4b0f67232f2a234737889e04c0689))
|
|
20
|
+
|
|
1
21
|
# [2.7.0](https://github.com/eliotstocker/Brsh-JS/compare/v2.6.0...v2.7.0) (2026-11-07)
|
|
2
22
|
|
|
3
23
|
|
package/Readme.md
CHANGED
|
@@ -26,11 +26,14 @@ You may also use it as a node module. Install via npm:
|
|
|
26
26
|
npm i brsh
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Import
|
|
29
|
+
Import both Shell and Terminal in your code:
|
|
30
30
|
```js
|
|
31
31
|
// ESM
|
|
32
|
+
import Shell from 'brsh';
|
|
32
33
|
import Terminal from 'brsh/terminal';
|
|
34
|
+
|
|
33
35
|
// CJS
|
|
36
|
+
const Shell = require('brsh');
|
|
34
37
|
const Terminal = require('brsh/terminal');
|
|
35
38
|
```
|
|
36
39
|
|
|
@@ -56,6 +59,8 @@ All [Shell options](#shell-options) are also accepted and forwarded directly to
|
|
|
56
59
|
| option | required | default | description |
|
|
57
60
|
| ------ | -------- | ------- | ----------- |
|
|
58
61
|
| el | Yes | | A HTMLElement to fill with the terminal emulator |
|
|
62
|
+
| cli | No | | An existing `Shell` instance to attach the terminal emulator to |
|
|
63
|
+
| Shell | No | | A custom `Shell` class constructor to use when creating the underlying shell |
|
|
59
64
|
| font | No | `Roboto Mono` | Name of a Google Webfont to use for the console font; a monospace font is recommended |
|
|
60
65
|
| cursor | No | `none` | One of: `none`, `block`, `blink`. If `block` or `blink`, a cursor block character is shown at the end of the current line |
|
|
61
66
|
| outputAnimation | No | `none` | One of: `none`, `type`. If `type`, each character is appended in order for a retro typing effect |
|
|
@@ -210,7 +215,7 @@ Scripts run in a sub-shell and do not share context with the parent. To persist
|
|
|
210
215
|
|
|
211
216
|
## Web Binary Tool (`wbt`) — Optional WASM Binary Manager
|
|
212
217
|
|
|
213
|
-
`wbt` is an optional, APT-style binary manager for `brsh` that lets users install and run WebAssembly binaries (such as `
|
|
218
|
+
`wbt` is an optional, APT-style binary manager for `brsh` that lets users install and run WebAssembly binaries (such as `wllama`, `sqlite3`, `assemblyscript` / `asc`, `jq`, `python3`, `duckdb`, `graphviz`, `ffmpeg`, `wabt`, `quickjs`, `lua`, or custom `.wasm`/`.wat` URLs). It is **not** included in the default shell bundle unless you explicitly register it.
|
|
214
219
|
|
|
215
220
|
### Enabling `wbt`
|
|
216
221
|
|
|
@@ -232,6 +237,24 @@ const shell = new Shell({ filesystem: {} });
|
|
|
232
237
|
shell.context.setCommand(Wbt);
|
|
233
238
|
```
|
|
234
239
|
|
|
240
|
+
### Loading WASM CLI Tools without `wbt` (Base Shell)
|
|
241
|
+
|
|
242
|
+
You can also register WASM CLI binaries directly into any `Shell` instance without `wbt`:
|
|
243
|
+
|
|
244
|
+
```js
|
|
245
|
+
import Shell from 'brsh';
|
|
246
|
+
|
|
247
|
+
// 1. From a WASM URL or bytes
|
|
248
|
+
const MyTool = Shell.createWasmCommand({
|
|
249
|
+
name: 'mytool',
|
|
250
|
+
wasmUrl: 'https://example.com/mytool.wasm'
|
|
251
|
+
});
|
|
252
|
+
shell.context.setCommand(MyTool);
|
|
253
|
+
|
|
254
|
+
// 2. Or place any raw .wasm / .wat binary into /bin in your virtual filesystem:
|
|
255
|
+
shell.onCommand('tool.wasm --help');
|
|
256
|
+
```
|
|
257
|
+
|
|
235
258
|
### Usage in the shell
|
|
236
259
|
|
|
237
260
|
```sh
|
|
@@ -240,22 +263,16 @@ wbt list
|
|
|
240
263
|
wbt list --installed
|
|
241
264
|
|
|
242
265
|
# Search and inspect packages
|
|
243
|
-
wbt search
|
|
244
|
-
wbt show
|
|
266
|
+
wbt search sql
|
|
267
|
+
wbt show sqlite3
|
|
245
268
|
|
|
246
269
|
# Install curated WASM packages into /bin
|
|
247
|
-
wbt install
|
|
248
|
-
|
|
249
|
-
# Run
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
# Start a PGlite background daemon on localhost:5432 and query it via HTTP (curl / fetch) or psql
|
|
254
|
-
pg_ctl start -D /home/pgdata -p 5432
|
|
255
|
-
wbt services
|
|
256
|
-
curl -s -X POST -d "SELECT * FROM users;" http://localhost:5432/query
|
|
257
|
-
psql -p 5432 -c "SELECT * FROM users;"
|
|
258
|
-
pg_ctl stop -p 5432
|
|
270
|
+
wbt install wllama sqlite3 assemblyscript jq python3 duckdb graphviz ffmpeg
|
|
271
|
+
|
|
272
|
+
# Run Wllama v3 (llama.cpp WASM + WebGPU) for one-shot completions or interactive chat REPL!
|
|
273
|
+
wllama -m /home/model.gguf -p "Explain WebGPU in one sentence."
|
|
274
|
+
wllama pull https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories15M.gguf -o /home/model.gguf
|
|
275
|
+
wllama -m /home/model.gguf # launches interactive multi-turn chat REPL
|
|
259
276
|
|
|
260
277
|
# Run SQLite3 (persists database files directly in the brsh filesystem)
|
|
261
278
|
sqlite3 /home/app.db "CREATE TABLE notes (id INT, body TEXT); INSERT INTO notes VALUES (1, 'Hello WASM');"
|
package/bin/brsh-shell.js
CHANGED
|
@@ -113,14 +113,28 @@ function reportSize() {
|
|
|
113
113
|
|
|
114
114
|
process.stdout.on('resize', () => { if (inInteractiveApp) reportSize(); });
|
|
115
115
|
|
|
116
|
+
let inProgressLine = false;
|
|
116
117
|
shell.on('stdOut', line => {
|
|
117
118
|
if (inInteractiveApp) {
|
|
118
119
|
process.stdout.write(line);
|
|
120
|
+
} else if (typeof line === 'string' && line.startsWith('\r')) {
|
|
121
|
+
inProgressLine = true;
|
|
122
|
+
process.stdout.write('\r\x1b[K' + line.slice(1));
|
|
119
123
|
} else {
|
|
124
|
+
if (inProgressLine) {
|
|
125
|
+
process.stdout.write('\n');
|
|
126
|
+
inProgressLine = false;
|
|
127
|
+
}
|
|
120
128
|
process.stdout.write(line + '\n');
|
|
121
129
|
}
|
|
122
130
|
});
|
|
123
|
-
shell.on('stdErr', line =>
|
|
131
|
+
shell.on('stdErr', line => {
|
|
132
|
+
if (inProgressLine) {
|
|
133
|
+
process.stdout.write('\n');
|
|
134
|
+
inProgressLine = false;
|
|
135
|
+
}
|
|
136
|
+
process.stderr.write(line + '\n');
|
|
137
|
+
});
|
|
124
138
|
|
|
125
139
|
shell.on('exit', code => {
|
|
126
140
|
destroyed = true;
|