thebird 1.2.79 → 1.2.81
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/.github/workflows/publish.yml +9 -1
- package/CHANGELOG.md +217 -0
- package/CLAUDE.md +16 -0
- package/docs/agent-chat.js +7 -4
- package/docs/app.js +14 -11
- package/docs/defaults.json +1 -1
- package/docs/index.html +23 -6
- package/docs/kilo-fs-mirror.js +15 -0
- package/docs/kilo-http-stream.js +47 -0
- package/docs/node-builtins.js +24 -0
- package/docs/preview/index.html +32 -0
- package/docs/preview-sw-client.js +37 -6
- package/docs/preview-sw.js +55 -51
- package/docs/shell-awk.js +113 -0
- package/docs/shell-builtins-extra.js +121 -0
- package/docs/shell-builtins-text.js +109 -0
- package/docs/shell-builtins-util.js +112 -0
- package/docs/shell-builtins.js +183 -0
- package/docs/shell-bun.js +45 -0
- package/docs/shell-control.js +132 -0
- package/docs/shell-deno.js +54 -0
- package/docs/shell-exec.js +85 -0
- package/docs/shell-expand.js +164 -0
- package/docs/shell-fd.js +86 -0
- package/docs/shell-jobs.js +86 -0
- package/docs/shell-node-advanced.js +86 -0
- package/docs/shell-node-brotli.js +22 -0
- package/docs/shell-node-busnet.js +90 -0
- package/docs/shell-node-cipher.js +61 -0
- package/docs/shell-node-cluster.js +33 -0
- package/docs/shell-node-coreutils.js +36 -0
- package/docs/shell-node-crypto.js +137 -0
- package/docs/shell-node-dns.js +41 -0
- package/docs/shell-node-extras.js +148 -0
- package/docs/shell-node-firefox.js +95 -0
- package/docs/shell-node-git.js +60 -0
- package/docs/shell-node-inspector.js +39 -0
- package/docs/shell-node-io.js +131 -0
- package/docs/shell-node-ipc.js +15 -0
- package/docs/shell-node-keyobject.js +60 -0
- package/docs/shell-node-modules.js +157 -0
- package/docs/shell-node-native.js +31 -0
- package/docs/shell-node-net.js +71 -0
- package/docs/shell-node-observe.js +80 -0
- package/docs/shell-node-opfs.js +54 -0
- package/docs/shell-node-procfs.js +42 -0
- package/docs/shell-node-profiler.js +50 -0
- package/docs/shell-node-registry.js +24 -0
- package/docs/shell-node-resolve.js +147 -0
- package/docs/shell-node-runtime.js +83 -0
- package/docs/shell-node-srcmap.js +52 -0
- package/docs/shell-node-stdlib.js +103 -0
- package/docs/shell-node-streams.js +66 -0
- package/docs/shell-node-tar.js +47 -0
- package/docs/shell-node-testrunner.js +35 -0
- package/docs/shell-node-util-extras.js +66 -0
- package/docs/shell-node.js +175 -169
- package/docs/shell-npm.js +173 -0
- package/docs/shell-parser.js +122 -0
- package/docs/shell-pm-layout.js +62 -0
- package/docs/shell-pm.js +39 -0
- package/docs/shell-posix.js +70 -0
- package/docs/shell-procsub.js +65 -0
- package/docs/shell-readline.js +59 -4
- package/docs/shell-runtime.js +37 -0
- package/docs/shell-sed.js +83 -0
- package/docs/shell-signals.js +54 -0
- package/docs/shell-sw-jobs.js +76 -0
- package/docs/shell-ts.js +30 -0
- package/docs/shell.js +161 -152
- package/docs/terminal.js +9 -11
- package/docs/todo.html +211 -0
- package/package.json +1 -1
- package/server.js +43 -4
- package/start-kilo.js +45 -0
- package/test.js +199 -0
- package/.codeinsight +0 -73
- package/docs/acp-stream.js +0 -102
- package/docs/coi-serviceworker.js +0 -2
package/docs/acp-stream.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { ClientSideConnection } from './vendor/acp-sdk.js';
|
|
2
|
-
|
|
3
|
-
function wsStream(url) {
|
|
4
|
-
const ws = new WebSocket(url);
|
|
5
|
-
const incoming = [];
|
|
6
|
-
let notify = null;
|
|
7
|
-
Object.assign(window.__debug = window.__debug || {}, {
|
|
8
|
-
acp: Object.assign(window.__debug?.acp || {}, { wsUrl: url, wsState: 'connecting' })
|
|
9
|
-
});
|
|
10
|
-
ws.addEventListener('message', e => {
|
|
11
|
-
const msg = JSON.parse(e.data);
|
|
12
|
-
if (notify) { const fn = notify; notify = null; fn(msg); }
|
|
13
|
-
else incoming.push(msg);
|
|
14
|
-
});
|
|
15
|
-
const readable = new ReadableStream({
|
|
16
|
-
start(ctrl) {
|
|
17
|
-
ws.addEventListener('close', () => {
|
|
18
|
-
window.__debug.acp.wsState = 'closed';
|
|
19
|
-
ctrl.close();
|
|
20
|
-
});
|
|
21
|
-
ws.addEventListener('error', e => {
|
|
22
|
-
window.__debug.acp.wsState = 'error';
|
|
23
|
-
window.__debug.acp.wsError = e.message || String(e);
|
|
24
|
-
ctrl.error(e);
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
pull() {
|
|
28
|
-
return new Promise(res => {
|
|
29
|
-
if (incoming.length) { res(incoming.shift()); return; }
|
|
30
|
-
notify = msg => res(msg);
|
|
31
|
-
}).then(msg => {});
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const writable = new WritableStream({
|
|
35
|
-
write(msg) { ws.send(JSON.stringify(msg)); }
|
|
36
|
-
});
|
|
37
|
-
return new Promise((res, rej) => {
|
|
38
|
-
ws.addEventListener('open', () => {
|
|
39
|
-
window.__debug.acp.wsState = 'open';
|
|
40
|
-
res({ readable, writable });
|
|
41
|
-
});
|
|
42
|
-
ws.addEventListener('error', (e) => {
|
|
43
|
-
window.__debug.acp.wsState = 'error';
|
|
44
|
-
const errMsg = e?.message || 'WebSocket connection failed';
|
|
45
|
-
window.__debug.acp.wsError = errMsg;
|
|
46
|
-
console.log('[ACP] Connection error:', errMsg);
|
|
47
|
-
rej(new Error(errMsg));
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export async function* streamACP({ url, model, messages, system, tools, maxOutputTokens, onStepFinish }) {
|
|
53
|
-
yield { type: 'start-step' };
|
|
54
|
-
const stream = await wsStream(url);
|
|
55
|
-
let sessionUpdates = [];
|
|
56
|
-
let notifyUpdate = null;
|
|
57
|
-
const client = new ClientSideConnection(agent => ({
|
|
58
|
-
sessionUpdate(params) {
|
|
59
|
-
if (notifyUpdate) { const fn = notifyUpdate; notifyUpdate = null; fn(params); }
|
|
60
|
-
else sessionUpdates.push(params);
|
|
61
|
-
},
|
|
62
|
-
requestPermission() { return Promise.resolve({ outcome: 'allow_once' }); },
|
|
63
|
-
readTextFile({ path }) {
|
|
64
|
-
const t = tools?.read_file;
|
|
65
|
-
return t?.execute?.({ path }).then(c => ({ content: c })) || Promise.resolve({ content: '' });
|
|
66
|
-
},
|
|
67
|
-
writeTextFile({ path, content }) {
|
|
68
|
-
const t = tools?.write_file;
|
|
69
|
-
return t?.execute?.({ path, content }).then(() => ({})) || Promise.resolve({});
|
|
70
|
-
},
|
|
71
|
-
}), stream);
|
|
72
|
-
|
|
73
|
-
await client.initialize({ protocolVersion: '0.1', capabilities: {}, clientInfo: { name: 'thebird', version: '1.0' } });
|
|
74
|
-
const { sessionId } = await client.newSession({ cwd: '/' });
|
|
75
|
-
|
|
76
|
-
const userText = messages.filter(m => m.role === 'user').map(m =>
|
|
77
|
-
typeof m.content === 'string' ? m.content : m.content.filter(b => b.type === 'text').map(b => b.text).join('')
|
|
78
|
-
).join('\n');
|
|
79
|
-
|
|
80
|
-
const promptPromise = client.prompt({ sessionId, message: { role: 'user', content: [{ type: 'text', text: userText }] } });
|
|
81
|
-
|
|
82
|
-
const getUpdate = () => new Promise(res => {
|
|
83
|
-
if (sessionUpdates.length) { res(sessionUpdates.shift()); return; }
|
|
84
|
-
notifyUpdate = res;
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
let done = false;
|
|
88
|
-
promptPromise.then(() => { done = true; if (notifyUpdate) { const fn = notifyUpdate; notifyUpdate = null; fn(null); } });
|
|
89
|
-
|
|
90
|
-
while (!done) {
|
|
91
|
-
const update = await getUpdate();
|
|
92
|
-
if (!update) break;
|
|
93
|
-
for (const item of (update.updates || [])) {
|
|
94
|
-
if (item.type === 'message_chunk' && item.chunk?.type === 'text') {
|
|
95
|
-
yield { type: 'text-delta', textDelta: item.chunk.text };
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
yield { type: 'finish-step', finishReason: 'stop' };
|
|
101
|
-
if (onStepFinish) await onStepFinish();
|
|
102
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! coi-serviceworker v0.1.7 - Guido Zuidhof and contributors, licensed under MIT */
|
|
2
|
-
let coepCredentialless=!1;"undefined"==typeof window?(self.addEventListener("install",(()=>self.skipWaiting())),self.addEventListener("activate",(e=>e.waitUntil(self.clients.claim()))),self.addEventListener("message",(e=>{e.data&&("deregister"===e.data.type?self.registration.unregister().then((()=>self.clients.matchAll())).then((e=>{e.forEach((e=>e.navigate(e.url)))})):"coepCredentialless"===e.data.type&&(coepCredentialless=e.data.value))})),self.addEventListener("fetch",(function(e){const o=e.request;if("only-if-cached"===o.cache&&"same-origin"!==o.mode)return;const s=coepCredentialless&&"no-cors"===o.mode?new Request(o,{credentials:"omit"}):o;e.respondWith(fetch(s).then((e=>{if(0===e.status)return e;const o=new Headers(e.headers);return o.set("Cross-Origin-Embedder-Policy",coepCredentialless?"credentialless":"require-corp"),coepCredentialless||o.set("Cross-Origin-Resource-Policy","cross-origin"),o.set("Cross-Origin-Opener-Policy","same-origin"),new Response(e.body,{status:e.status,statusText:e.statusText,headers:o})})).catch((e=>console.error(e))))}))):(()=>{const e=window.sessionStorage.getItem("coiReloadedBySelf");window.sessionStorage.removeItem("coiReloadedBySelf");const o="coepdegrade"==e,s={shouldRegister:()=>!e,shouldDeregister:()=>!1,coepCredentialless:()=>!0,coepDegrade:()=>!0,doReload:()=>window.location.reload(),quiet:!1,...window.coi},r=navigator,t=r.serviceWorker&&r.serviceWorker.controller;t&&!window.crossOriginIsolated&&window.sessionStorage.setItem("coiCoepHasFailed","true");const i=window.sessionStorage.getItem("coiCoepHasFailed");if(t){const e=s.coepDegrade()&&!(o||window.crossOriginIsolated);r.serviceWorker.controller.postMessage({type:"coepCredentialless",value:!(e||i&&s.coepDegrade())&&s.coepCredentialless()}),e&&(!s.quiet&&console.log("Reloading page to degrade COEP."),window.sessionStorage.setItem("coiReloadedBySelf","coepdegrade"),s.doReload("coepdegrade")),s.shouldDeregister()&&r.serviceWorker.controller.postMessage({type:"deregister"})}!1===window.crossOriginIsolated&&s.shouldRegister()&&(window.isSecureContext?r.serviceWorker?r.serviceWorker.register(window.document.currentScript.src).then((e=>{!s.quiet&&console.log("COOP/COEP Service Worker registered",e.scope),e.addEventListener("updatefound",(()=>{!s.quiet&&console.log("Reloading page to make use of updated COOP/COEP Service Worker."),window.sessionStorage.setItem("coiReloadedBySelf","updatefound"),s.doReload()})),e.active&&!r.serviceWorker.controller&&(!s.quiet&&console.log("Reloading page to make use of COOP/COEP Service Worker."),window.sessionStorage.setItem("coiReloadedBySelf","notcontrolling"),s.doReload())}),(e=>{!s.quiet&&console.error("COOP/COEP Service Worker failed to register:",e)})):!s.quiet&&console.error("COOP/COEP Service Worker not registered, perhaps due to private mode."):!s.quiet&&console.log("COOP/COEP Service Worker not registered, a secure context is required."))})();
|