thebird 1.2.47 → 1.2.48

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 CHANGED
@@ -4,6 +4,7 @@
4
4
  - `docs/shell.js`: `createShell({ term, onPreviewWrite })` — POSIX shell + Node REPL using browser V8 eval + xstate v5 state machine. Dispatch table of built-ins: ls, cat, echo, pwd, cd, mkdir, rm, cp, mv, env, export, clear, help, node, npm install, exit. Pipe support via ` | ` split. `window.__debug.shell` exposes state, cwd, env, history, httpHandlers, nodeMode. `http.createServer` polyfill registers handlers in httpHandlers map.
5
5
  - `docs/shell-node.js`: `createNodeEnv({ ctx, term })` — persistent V8 eval scope with process, console, require (IDB node_modules), Buffer shim, http.createServer polyfill, fetch, timers.
6
6
  - `docs/vendor/xstate.js`: replaced broken stub with self-contained 46KB jsdelivr bundle (xstate@5.30.0) exporting createMachine, createActor — no external imports.
7
+ - `docs/terminal.js`: rewritten — removes all Wasmer/WinterJS; boots xterm, loads IDB, registers preview SW, creates shell via shell.js with 5s debounced hot-reload on idbWrite. window.__debug.term and window.__debug.shell live.
7
8
 
8
9
  ### Fixed
9
10
  - Gemini tool result wrapping: string results wrapped as `{ output: result }` to satisfy Gemini Struct requirement for `function_response.response`
package/docs/terminal.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Terminal, FitAddon } from './vendor/xterm-bundle.js';
2
- import { init, runWasix } from './vendor/wasmer-sdk.js';
2
+ import { createShell } from './shell.js';
3
+ import { registerPreviewSW } from './preview-sw-client.js';
3
4
 
4
5
  const IDB_KEY = 'thebird_fs_v2';
5
6
 
@@ -30,8 +31,13 @@ async function idbSave(data) {
30
31
  });
31
32
  }
32
33
 
33
- function absUrl(path) {
34
- return new URL(path, location.href).toString();
34
+ let reloadTimer = null;
35
+ function scheduleReload() {
36
+ clearTimeout(reloadTimer);
37
+ reloadTimer = setTimeout(() => {
38
+ const frame = document.getElementById('preview-frame');
39
+ if (frame) frame.src = frame.src;
40
+ }, 5000);
35
41
  }
36
42
 
37
43
  async function boot() {
@@ -59,46 +65,16 @@ async function boot() {
59
65
  window.__debug.idbPersist = () => idbSave(JSON.stringify(window.__debug.idbSnapshot));
60
66
  window.__debug.term = term;
61
67
 
62
- term.write('Initialising Wasmer...\r\n');
63
-
64
68
  try {
65
- const [wasmResp] = await Promise.all([
66
- fetch('./vendor/winterjs.wasm'),
67
- init({
68
- module: fetch('./vendor/wasmer_js_bg.wasm'),
69
- workerUrl: absUrl('./vendor/wasmer-worker.js'),
70
- sdkUrl: absUrl('./vendor/wasmer-sdk.js'),
71
- }),
72
- ]);
73
-
74
- const winterModule = await WebAssembly.compileStreaming(wasmResp);
75
-
76
- term.write('Starting WinterJS...\r\n');
77
-
78
- const instance = await runWasix(winterModule, {
79
- program: 'winterjs',
80
- args: ['--repl'],
81
- env: { TERM: 'xterm-256color' },
82
- stdin: new ReadableStream({
83
- start(ctrl) { window.__debug.stdinCtrl = ctrl; }
84
- }),
85
- });
86
-
87
- instance.stdout.pipeTo(new WritableStream({ write: d => term.write(d) }));
88
- instance.stderr.pipeTo(new WritableStream({ write: d => term.write(d) }));
89
-
90
- term.onData(data => window.__debug.stdinCtrl?.enqueue(new TextEncoder().encode(data)));
91
- term.onResize(({ cols, rows }) => instance.setTtySize?.({ cols, rows }));
92
-
93
- window.__debug.wasmerInstance = instance;
94
- window.__debug.validation = null;
95
-
96
- instance.wait().then(exit => term.write(`\r\n[process exited: ${exit.code}]\r\n`));
97
-
69
+ await registerPreviewSW();
98
70
  } catch (e) {
99
- term.write(`\x1b[31mError: ${e.message}\x1b[0m\r\n`);
100
- console.error('[terminal] wasmer error:', e);
71
+ term.write('\x1b[33mSW: ' + e.message + '\x1b[0m\r\n');
101
72
  }
73
+
74
+ createShell({ term, onPreviewWrite: scheduleReload });
102
75
  }
103
76
 
104
- boot().catch(e => console.error('[terminal] boot error:', e));
77
+ boot().catch(e => {
78
+ console.error('[terminal] boot error:', e);
79
+ throw e;
80
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thebird",
3
- "version": "1.2.47",
3
+ "version": "1.2.48",
4
4
  "description": "Anthropic SDK to Gemini streaming bridge — drop-in proxy that translates Anthropic message format and tool calls to Google Gemini",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",