thebird 1.2.47 → 1.2.49

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/README.md CHANGED
@@ -182,20 +182,12 @@ Messages follow the Anthropic SDK format. All image block variants are supported
182
182
 
183
183
  Live at **[anentrypoint.github.io/thebird](https://anentrypoint.github.io/thebird/)**
184
184
 
185
- - **Chat tab** — Agentic chat powered by thebird `streamGemini` running in-browser (bundled in `docs/vendor/thebird-browser.js`). Tools: `read_file`, `write_file`, `list_files` (IDB-backed, no container required), `run_command` (WebContainer shell), `read_terminal` (xterm buffer snapshot), `send_to_terminal` (jsh stdin). No proxy server required. Gemini API key stored in localStorage.
186
- - **Terminal tab** — WebContainer (in-browser Node.js) booting thebird's full stack: `npm install`, `node server.js` (Anthropic→Gemini proxy on port 3000), then a `jsh` shell. Run Agent button validates the agent loop from the terminal.
187
- - **Preview tab** — iframe pointed at the WebContainer's HTTP server, live-updated when the server starts
185
+ - **Chat tab** — Agentic chat powered by thebird `streamGemini` running in-browser (bundled in `docs/vendor/thebird-browser.js`). Tools: `read_file`, `write_file`, `list_files` (IDB-backed), `run_command`, `read_terminal`, `send_to_terminal`. No proxy server required. Gemini API key stored in localStorage.
186
+ - **Terminal tab** — Browser-native POSIX shell (xstate v5 state machine, V8 eval) backed by IndexedDB filesystem. Built-in commands: `ls`, `cat`, `cd`, `pwd`, `mkdir`, `rm`, `cp`, `mv`, `echo`, `env`, `export`, `node`, `npm install`. Node REPL mode with persistent scope, `require()` from IDB node_modules, `http.createServer` polyfill. No WebContainer or server required.
187
+ - **Preview tab** — iframe served by a service worker reading files from IDB at `/preview/*`. Hot-reloads 5s after any file write.
188
188
 
189
189
  All JS and CSS dependencies are vendored locally in `docs/vendor/` — no CDN required at runtime.
190
190
 
191
- Run the agentic CLI inside the terminal tab:
192
-
193
- ```
194
- GEMINI_API_KEY=<key> node agent.js "your task"
195
- ```
196
-
197
- `agent.js` uses `@anthropic-ai/sdk` pointing at `http://localhost:3000` (thebird proxy) with tools: `read_file`, `write_file`, `run_command`.
198
-
199
191
  ## License
200
192
 
201
193
  MIT
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.49",
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",