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 293 to 294

Compare

+38 −7 in 8 places
Lines 189–196 at 294 (were 189–194 at 293)
189189 DatabaseSync: new (path: string) => Db;
190190 handle: (request: Request, env: unknown, ctx: unknown, issues: unknown) => Promise<Response>;
191191 ProjectObject: new (ctx: unknown, env: unknown) => object;
192+ IssueProject: new (ctx: unknown, env: unknown) => object;
193+ issuesFetch: (request: Request, env: unknown, ctx: unknown, route: unknown) => Promise<Response>;
192194};
193195let server: Promise<Server> | undefined;
194196
Lines 242–254 at 294 (were 240–246 at 293)
240242 `local projects couldn't load the server's code: ${e instanceof Error ? e.message : String(e)}`,
241243 );
242244 }
243− return { DatabaseSync: sqlite.DatabaseSync, handle: loaded.handle, ProjectObject: loaded.ProjectObject };
245+ return {
246+ DatabaseSync: sqlite.DatabaseSync,
247+ handle: loaded.handle,
248+ ProjectObject: loaded.ProjectObject,
249+ IssueProject: loaded.IssueProject,
250+ issuesFetch: loaded.issuesFetch,
251+ };
244252 })();
245253 return server;
246254}
Lines 264–273 at 294 (were 256–261 at 293)
256264 object: object | undefined;
257265 /** PRAGMA data_version when this process last used the project: it changes when another process writes. */
258266 seen: number | undefined;
267+ /** The project's issues, asks and news: issues.sqlite beside it, opened when a call first reaches them. */
268+ issues?: { db: Db; storage: ReturnType<typeof storageOver> };
269+ /** The issues object for the call under way: made again for each call, as another process may have written. */
270+ issueObject?: object;
259271}
260272
261273/** Every store file this process has open: closed when its command ends (closeLocalStores). */
Lines 283–290 at 294 (were 271–277 at 293)
271283 opened.clear();
272284}
273285
274−const PROJECT_PATH = /^\/p\/([^/]+)\//;
286+/** A project's calls, and its issues, asks and news, which the open server keeps at /issues/p/<project>/. */
287+const PROJECT_PATH = /^(?:\/issues)?\/p\/([^/]+)\//;
275288const NAME = /^[A-Za-z0-9._-]{1,100}$/;
276289const json = (status: number, body: unknown) => Response.json(body, { status });
277290
Lines 325–349 at 294 (were 312–319 at 293)
312325 return p.object;
313326 },
314327 },
315− // Issues, asks and news aren't in local projects yet: a start note's issue hooks find nothing to call.
316− ISSUES_DO: { idFromName: (n: string) => n, get: () => ({}) },
328+ ISSUES_DO: {
329+ idFromName: (n: string) => n,
330+ get: (n: string) => {
331+ const p = open.get(n);
332+ if (!p || n !== name) throw new LocalError(`no local project ${n}`);
333+ if (p.issues === undefined || !opened.has(p.issues.db)) {
334+ const db = new opening!.DatabaseSync(join(dir, name, "issues.sqlite"));
335+ opened.add(db);
336+ db.exec("PRAGMA journal_mode = WAL; PRAGMA busy_timeout = 120000; PRAGMA synchronous = NORMAL");
337+ p.issues = { db, storage: storageOver(db) };
338+ }
339+ // Its writes need no lock of their own: every call holds the project file's (see below).
340+ p.issueObject ??= new opening!.IssueProject(
341+ { id: { toString: () => n, name: n }, storage: p.issues.storage },
342+ env(name),
343+ );
344+ return p.issueObject;
345+ },
346+ },
317347 });
318348 return async (input, init = {}) => {
319349 const s = await loadServer();
Lines 359–368 at 294 (were 329–335 at 293)
329359 headers.set("authorization", `Bearer ${LOCAL_TOKEN}`);
330360 const request = new Request(url, { ...init, headers });
331361 const waits: Promise<unknown>[] = [];
362+ // Every call, issues ones too, holds the project file's lock, so local writers of the project and of its
363+ // issues take one lock in one order.
332364 p.db.exec("BEGIN IMMEDIATE");
365+ p.issueObject = undefined;
333366 try {
334367 const version = (p.db.prepare("PRAGMA data_version").get() as { data_version: number }).data_version;
335368 if (p.seen !== undefined && version !== p.seen) p.object = undefined;
Lines 370–376 at 294 (were 337–343 at 293)
337370 request,
338371 env(name),
339372 { waitUntil: (w: Promise<unknown>) => waits.push(w) },
340− issuesNone,
373+ s.issuesFetch,
341374 );
342375 await Promise.allSettled(waits);
343376 // The answer is read whole before the write is kept, so a body that fails to arrive keeps nothing either.
Lines 391–393 at 294 (were 358–362 at 293)
358391 }
359392 };
360393}
361−
362−const issuesNone = async () => json(404, { error: "issues, asks and news aren't in local projects yet" });
MCP
compare on this site's /mcp
CLI
abso diff 293 294 client/src/local-store.ts --json
JSON
/christopher/abso-core/compare/293..294?file=client%2Fsrc%2Flocal-store.ts&format=json