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 175 to 318

Compare

+61 −0 in 1 place
new file, 61 lines
1+/** One pending chunk; a producer cannot advance until the consumer takes it. */
2+export class BoundedPackFIFO {
3+ constructor(cancel = async () => {}) {
4+ this.cancel = cancel;
5+ this.ended = false;
6+ this.error = undefined;
7+ this.pending = undefined;
8+ this.reader = undefined;
9+ this.writer = undefined;
10+ }
11+ async write(value) {
12+ if (this.ended) throw this.error ?? Error("Pack stream is closed");
13+ if (this.pending !== undefined || this.writer) throw Error("Concurrent pack writes");
14+ if (this.reader) {
15+ const reader = this.reader;
16+ this.reader = undefined;
17+ reader.resolve({ value, done: false });
18+ return;
19+ }
20+ this.pending = value;
21+ await new Promise((resolve, reject) => {
22+ this.writer = { resolve, reject };
23+ });
24+ }
25+ async next() {
26+ if (this.error) throw this.error;
27+ if (this.pending !== undefined) {
28+ const value = this.pending;
29+ this.pending = undefined;
30+ this.writer?.resolve();
31+ this.writer = undefined;
32+ return { value, done: false };
33+ }
34+ if (this.ended) return { done: true };
35+ if (this.reader) throw Error("Concurrent pack reads");
36+ return new Promise((resolve, reject) => {
37+ this.reader = { resolve, reject };
38+ });
39+ }
40+ end() {
41+ this.ended = true;
42+ this.reader?.resolve({ done: true });
43+ this.reader = undefined;
44+ }
45+ destroy(error) {
46+ this.error = error;
47+ this.ended = true;
48+ this.pending = undefined;
49+ this.reader?.reject(error);
50+ this.writer?.reject(error);
51+ this.reader = this.writer = undefined;
52+ }
53+ async return() {
54+ this.destroy(Error("Pack consumer cancelled"));
55+ await this.cancel();
56+ return { done: true };
57+ }
58+ [Symbol.asyncIterator]() {
59+ return this;
60+ }
61+}
MCP
compare on this site's /mcp
CLI
abso diff 175 318 server/scripts/capacity-git-bounded-fifo.mjs --json
JSON
/christopher/abso-core/compare/175..318?file=server%2Fscripts%2Fcapacity-git-bounded-fifo.mjs&format=json