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

+27 −4 in 6 places
Lines 9–26 at 318 (were 9–19 at 175)
99
1010type Entry =
1111 | { kind: "dir"; children: Set<string>; mtimeMs: number }
12− | { kind: "file"; data: Uint8Array; exec: boolean; mtimeMs: number }
12+ | { kind: "file"; data: Uint8Array; byteLength?: number; exec: boolean; mtimeMs: number }
1313 | { kind: "link"; target: string; mtimeMs: number };
1414
1515const enc = new TextEncoder();
1616
17+/** Optional scratch storage for file contents; directory metadata remains in memory. */
18+export interface FileContents {
19+ write(path: string, bytes: Uint8Array): void;
20+ read(path: string): Uint8Array;
21+ remove(path: string): void;
22+}
1724/** Plain fields, not getters: isomorphic-git writes to them when it normalizes stats. */
1825class MemoryStats {
1926 size: number;
Lines 32–42 at 318 (were 25–31 at 175)
2532 constructor(entry: Entry) {
2633 this.kind = entry.kind;
2734 this.size =
28− entry.kind === "file" ? entry.data.byteLength : entry.kind === "link" ? enc.encode(entry.target).byteLength : 0;
35+ entry.kind === "file"
36+ ? (entry.byteLength ?? entry.data.byteLength)
37+ : entry.kind === "link"
38+ ? enc.encode(entry.target).byteLength
39+ : 0;
2940 this.mtimeMs = entry.mtimeMs;
3041 this.ctimeMs = entry.mtimeMs;
3142 this.mode = entry.kind === "dir" ? 0o040000 : entry.kind === "link" ? 0o120000 : entry.exec ? 0o100755 : 0o100644;
Lines 56–65 at 318 (were 45–50 at 175)
4556}
4657
4758export class MemoryFS {
59+ private readonly contents?: FileContents;
60+ constructor(contents?: FileContents) {
61+ this.contents = contents;
62+ }
4863 encoder = new TextEncoder();
4964 decoder = new TextDecoder();
5065 entries = new Map<string, Entry>([["/", { kind: "dir", children: new Set(), mtimeMs: Date.now() }]]);
Lines 172–183 at 318 (were 157–166 at 175)
157172 const bytes =
158173 typeof data === "string" ? this.encoder.encode(data) : data instanceof Uint8Array ? data : new Uint8Array(data);
159174 const mode = typeof options === "object" && options !== null ? options.mode : undefined;
175+ this.contents?.write(target, bytes);
160176
161177 this.entries.set(target, {
162178 kind: "file",
163− data: bytes,
179+ data: this.contents ? new Uint8Array(0) : bytes,
180+ ...(this.contents ? { byteLength: bytes.byteLength } : {}),
164181 exec: mode !== undefined && (mode & 0o111) !== 0,
165182 mtimeMs: Date.now(),
166183 });
Lines 191–202 at 318 (were 174–180 at 175)
174191 throw fsError("EISDIR", path);
175192 }
176193
177− const data = entry.kind === "link" ? this.encoder.encode(entry.target) : entry.data;
194+ const data =
195+ entry.kind === "link"
196+ ? this.encoder.encode(entry.target)
197+ : this.contents
198+ ? this.contents.read(this.normalize(path))
199+ : entry.data;
178200 const encoding = typeof options === "string" ? options : options?.encoding;
179201 return encoding ? this.decoder.decode(data) : data;
180202 }
Lines 212–218 at 318 (were 190–195 at 175)
190212 throw fsError("EISDIR", path);
191213 }
192214
215+ if (entry.kind === "file") this.contents?.remove(target);
193216 this.entries.delete(target);
194217 this.requireDir(this.parent(target)).children.delete(this.basename(target));
195218 }
MCP
compare on this site's /mcp
CLI
abso diff 175 318 server/src/memory-fs.ts --json
JSON
/christopher/abso-core/compare/175..318?file=server%2Fsrc%2Fmemory-fs.ts&format=json