thebird 1.2.53 → 1.2.54

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.
Files changed (2) hide show
  1. package/docs/shell.js +12 -9
  2. package/package.json +1 -1
package/docs/shell.js CHANGED
@@ -15,16 +15,17 @@ function resolvePath(cwd, p) {
15
15
 
16
16
  function makeBuiltins(ctx) {
17
17
  const snap = () => window.__debug.idbSnapshot || {};
18
+ const toKey = p => p.replace(/^\//, '');
18
19
  const w = s => ctx.term.write(s);
19
20
  const wl = s => w(s + '\r\n');
20
21
  return {
21
22
  ls: ([p]) => {
22
- const prefix = resolvePath(ctx.cwd, p || '') + '/';
23
- const keys = prefix === '//' ? Object.keys(snap()) : Object.keys(snap()).filter(k => k.startsWith(prefix === '//' ? '/' : prefix));
23
+ const prefix = toKey(resolvePath(ctx.cwd, p || '')) + '/';
24
+ const keys = prefix === '/' ? Object.keys(snap()) : Object.keys(snap()).filter(k => k.startsWith(prefix));
24
25
  wl(keys.join('\r\n') || '(empty)');
25
26
  },
26
27
  cat: ([f]) => {
27
- const c = snap()[resolvePath(ctx.cwd, f)];
28
+ const c = snap()[toKey(resolvePath(ctx.cwd, f))];
28
29
  if (c == null) throw new Error('no such file: ' + f);
29
30
  wl(c);
30
31
  },
@@ -32,19 +33,19 @@ function makeBuiltins(ctx) {
32
33
  pwd: () => wl(ctx.cwd),
33
34
  cd: ([p]) => { ctx.cwd = resolvePath(ctx.cwd, p || '~'); },
34
35
  mkdir: ([p]) => {
35
- window.__debug.idbSnapshot[resolvePath(ctx.cwd, p) + '/.keep'] = '';
36
+ window.__debug.idbSnapshot[toKey(resolvePath(ctx.cwd, p)) + '/.keep'] = '';
36
37
  window.__debug.idbPersist?.();
37
38
  },
38
39
  rm: ([f]) => {
39
- delete window.__debug.idbSnapshot[resolvePath(ctx.cwd, f)];
40
+ delete window.__debug.idbSnapshot[toKey(resolvePath(ctx.cwd, f))];
40
41
  window.__debug.idbPersist?.();
41
42
  },
42
43
  cp: ([s, d]) => {
43
- window.__debug.idbSnapshot[resolvePath(ctx.cwd, d)] = snap()[resolvePath(ctx.cwd, s)];
44
+ window.__debug.idbSnapshot[toKey(resolvePath(ctx.cwd, d))] = snap()[toKey(resolvePath(ctx.cwd, s))];
44
45
  window.__debug.idbPersist?.();
45
46
  },
46
47
  mv: ([s, d]) => {
47
- const src = resolvePath(ctx.cwd, s), dst = resolvePath(ctx.cwd, d);
48
+ const src = toKey(resolvePath(ctx.cwd, s)), dst = toKey(resolvePath(ctx.cwd, d));
48
49
  window.__debug.idbSnapshot[dst] = snap()[src];
49
50
  delete window.__debug.idbSnapshot[src];
50
51
  window.__debug.idbPersist?.();
@@ -60,7 +61,7 @@ function makeBuiltins(ctx) {
60
61
  node: async ([file], actor) => {
61
62
  if (!file) { actor.send({ type: 'ENTER_REPL' }); wl('[node repl — type exit to return]'); return; }
62
63
  const path = resolvePath(ctx.cwd, file);
63
- const code = snap()[path];
64
+ const code = snap()[toKey(path)];
64
65
  if (code == null) throw new Error('no such file: ' + path);
65
66
  actor.send({ type: 'NODE_START' });
66
67
  await ctx.nodeEval(code, path);
@@ -193,6 +194,8 @@ export function createShell({ term, onPreviewWrite }) {
193
194
 
194
195
  term.onData(onData);
195
196
  onPreviewWrite && (window.__debug.shell.onPreviewWrite = onPreviewWrite);
197
+ const runPublic = line => run(line, onData);
198
+ window.__debug.shell.run = runPublic;
196
199
  prompt();
197
- return { run: line => run(line, onData) };
200
+ return { run: runPublic };
198
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thebird",
3
- "version": "1.2.53",
3
+ "version": "1.2.54",
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",