Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 163 to 318

Compare

+58 −0 in 1 place
new file, 58 lines
1+import type { HttpClient } from "isomorphic-git";
2+
3+/** Stream Git HTTP request chunks without a second complete upload buffer. */
4+export function gitHttp(fetcher: typeof fetch = fetch): HttpClient {
5+ return {
6+ async request({ url, method = "GET", headers = {}, body, signal, fetchOptions = {} }) {
7+ const input = body as AsyncIterable<Uint8Array> | Iterable<Uint8Array> | undefined;
8+ const iterator = input
9+ ? Symbol.asyncIterator in input
10+ ? input[Symbol.asyncIterator]()
11+ : input[Symbol.iterator]()
12+ : undefined;
13+ const stream = iterator
14+ ? new ReadableStream<Uint8Array>(
15+ {
16+ async pull(controller) {
17+ try {
18+ const next = await iterator.next();
19+ if (next.done) controller.close();
20+ else controller.enqueue(next.value);
21+ } catch (error) {
22+ controller.error(error);
23+ }
24+ },
25+ async cancel() {
26+ await iterator.return?.();
27+ },
28+ },
29+ { highWaterMark: 0 },
30+ )
31+ : undefined;
32+ let response: Response;
33+ try {
34+ const options: RequestInit & { duplex?: string } = {
35+ ...fetchOptions,
36+ method,
37+ headers,
38+ body: stream,
39+ signal: signal ?? fetchOptions.signal,
40+ ...(stream ? { duplex: "half" } : {}),
41+ };
42+ response = await fetcher(url, options);
43+ } catch (error) {
44+ await iterator?.return?.();
45+ throw error;
46+ }
47+ const responseBody = response.body;
48+ return {
49+ url: response.url,
50+ method,
51+ statusCode: response.status,
52+ statusMessage: response.statusText,
53+ headers: Object.fromEntries(response.headers.entries()),
54+ body: responseBody ? responseBody[Symbol.asyncIterator]() : (async function* () {})(),
55+ };
56+ },
57+ };
58+}
MCP
compare on this site's /mcp
CLI
abso diff 163 318 server/src/git-http.ts --json
JSON
/christopher/abso-core/compare/163..318?file=server%2Fsrc%2Fgit-http.ts&format=json