thebird 1.2.24 → 1.2.26

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
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ### Fixed
6
+ - `docs/terminal.js`: build nested WebContainer mount tree from flat path keys (fixes `EIO: invalid file name` for files in subdirectories like `lib/providers/openai.js`); bump IDB_KEY to `thebird_fs_v2` to force re-fetch of defaults.json for users with stale cache
7
+
5
8
  ### Added
6
9
  - `docs/defaults.json`: JSON blob of all thebird lib files + `server.js` + `agent.js` fetched by terminal.js on first boot
7
10
  - `docs/terminal.js`: fetches `defaults.json` instead of hardcoded DEFAULT_FILES; jsh PTY shell with resize; `server-ready` wires iframe src + `window.__debug.previewUrl`; all debug keys registered
package/CLAUDE.md CHANGED
@@ -122,8 +122,21 @@ Run examples against real Gemini API to validate message translation.
122
122
  - `wasi/cli.ts`: Deno streaming CLI — `deno run --allow-net --allow-env wasi/cli.ts [--model M] [--system S] <prompt>`
123
123
  - `deno.json`: tasks `cli` (run) and `cli:compile` (→ `dist/thebird` binary)
124
124
 
125
+ ## WebContainer Terminal in docs/
126
+
127
+ Interactive terminal in docs/index.html runs thebird + Node.js server in WebContainer API.
128
+
129
+ ### Architecture
130
+
131
+ - **defaults.json**: docs/defaults.json is a 46KB single-line JSON blob containing all container files (package.json, lib/*.js, index.js, server.js, agent.js). Fetched by terminal.js on first boot instead of hardcoding DEFAULT_FILES inline (avoids 200-line limit).
132
+ - **Flat mount object**: WebContainer accepts `{'lib/client.js': ...}` directly — no nested directory tree needed.
133
+ - **COEP window.coi fix**: Add `<script>window.coi = { coepDegrade: () => false };</script>` BEFORE coi-serviceworker.js. Prevents degradation from credentialless to require-corp, which blocks Tailwind CDN. Key is `window.coi` (not `window.__coi_serviceworker`).
134
+ - **iframe allow attribute**: Remove `allow="cross-origin-isolated"` — not a valid Feature Policy keyword. WebContainer iframes work without it.
135
+ - **agent.js routing**: Inside container, agent.js uses `@anthropic-ai/sdk` with `baseURL: "http://localhost:3000"` pointing at thebird proxy (server.js), which translates Anthropic format → Gemini.
136
+
125
137
  ## Environment Notes
126
138
 
127
139
  - Repo remote: `https://github.com/AnEntrypoint/thebird.git` (capital A)
128
140
  - Deno 2.1.3 available; `exec:bash` uses PowerShell — use `exec:cmd` with `set KEY=val && cmd` syntax for env vars
129
141
  - Windows `KEY=val cmd` inline env syntax fails in PowerShell
142
+ - CI workflow commits version bump after every push to main — always `git pull --rebase origin main` before pushing to avoid fast-forward rejection
package/README.md CHANGED
@@ -156,21 +156,6 @@ Pass options as a nested array: `["maxtoken", { "max_tokens": 16384 }]`.
156
156
 
157
157
  `streamGemini` / `generateGemini` bypass routing and call Gemini natively via `@google/genai`. Requires `GEMINI_API_KEY`.
158
158
 
159
- ### Params
160
-
161
- | Param | Type | Default | Description |
162
- |---|---|---|---|
163
- | `model` | `string \| { id }` | `'gemini-2.0-flash'` | Model id |
164
- | `messages` | `Message[]` | required | Conversation history |
165
- | `system` | `string` | — | System instruction |
166
- | `tools` | `Tools` | — | Tool definitions |
167
- | `apiKey` | `string` | `GEMINI_API_KEY` | Override API key |
168
- | `temperature` | `number` | `0.5` | Sampling temperature |
169
- | `maxOutputTokens` | `number` | `8192` | Max tokens |
170
- | `topP` | `number` | `0.95` | Top-p |
171
- | `topK` | `number` | — | Top-k |
172
- | `safetySettings` | `SafetySetting[]` | — | Safety thresholds |
173
-
174
159
  ## Message Format
175
160
 
176
161
  Messages follow the Anthropic SDK format. All image block variants are supported:
@@ -193,18 +178,22 @@ Messages follow the Anthropic SDK format. All image block variants are supported
193
178
  | `finish-step` | `finishReason` | Step completed |
194
179
  | `error` | `error` | Error during step |
195
180
 
196
- ## TypeScript
181
+ ## Browser Demo
197
182
 
198
- ```ts
199
- import { createRouter, streamRouter, generateGemini, RouterConfiguration, ProviderConfig, RouterConfig } from 'thebird';
200
- ```
183
+ Live at **[anentrypoint.github.io/thebird](https://anentrypoint.github.io/thebird/)**
201
184
 
202
- ## Utilities
185
+ - **Chat tab** — Gemini chat via direct API (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
187
+ - **Preview tab** — iframe pointed at the WebContainer's HTTP server, live-updated when the server starts
203
188
 
204
- ```js
205
- const { convertMessages, convertTools, cleanSchema } = require('thebird');
189
+ Run the agentic CLI inside the terminal tab:
190
+
191
+ ```
192
+ GEMINI_API_KEY=<key> node agent.js "your task"
206
193
  ```
207
194
 
195
+ `agent.js` uses `@anthropic-ai/sdk` pointing at `http://localhost:3000` (thebird proxy) with tools: `read_file`, `write_file`, `run_command`.
196
+
208
197
  ## License
209
198
 
210
199
  MIT
package/docs/terminal.js CHANGED
@@ -2,7 +2,7 @@ import { WebContainer } from 'https://esm.sh/@webcontainer/api';
2
2
  import { Terminal } from 'https://esm.sh/@xterm/xterm';
3
3
  import { FitAddon } from 'https://esm.sh/@xterm/addon-fit';
4
4
 
5
- const IDB_KEY = 'thebird_fs';
5
+ const IDB_KEY = 'thebird_fs_v2';
6
6
 
7
7
  async function idbLoad() {
8
8
  return new Promise((res, rej) => {
@@ -59,13 +59,17 @@ async function boot() {
59
59
  files = await r.json();
60
60
  }
61
61
 
62
- const mountTree = Object.fromEntries(
63
- Object.entries(files).map(([p, c]) => {
64
- const parts = p.split('/');
65
- if (parts.length === 1) return [p, { file: { contents: c } }];
66
- return [p, { file: { contents: c } }];
67
- })
68
- );
62
+ const mountTree = {};
63
+ for (const [path, contents] of Object.entries(files)) {
64
+ const parts = path.split('/');
65
+ const name = parts.pop();
66
+ let node = mountTree;
67
+ for (const dir of parts) {
68
+ if (!node[dir]) node[dir] = { directory: {} };
69
+ node = node[dir].directory;
70
+ }
71
+ node[name] = { file: { contents } };
72
+ }
69
73
 
70
74
  term.write('Booting WebContainer...\r\n');
71
75
  let container;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thebird",
3
- "version": "1.2.24",
3
+ "version": "1.2.26",
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",