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 203 to 204

Compare

+40 −1 in 2 places
Lines 1–6 at 204 (were 1–6 at 203)
11// A first opinion on a held push (#19), shared by the open server and the platform: for each collision, which of abso's
22// settle choices fits, from Workers AI, with checks in code before and after.
3−// Off unless AUTOSETTLE is "on" and the Worker has an AI binding. The model
3+// Off unless AUTOSETTLE is "on" (advice) or "act" (the client settles) and the Worker has an AI binding. The model
44// picks one of four words; it never writes code.
55
66/** abso's settle choices, plus a hand edit by an agent. */
Lines 357–398 at 204 (were 357–359 at 203)
357357 }),
358358 );
359359}
361+/** The switch as a Worker's env carries it: AUTOSETTLE "on" advises, "act" also has the client settle; else off. */
362+export interface AutosettleEnv {
363+ readonly AUTOSETTLE?: string;
364+ readonly AUTOSETTLE_MODEL?: string;
365+ readonly AUTOSETTLE_AT?: string | number;
366+ readonly AI?: Ai;
367+}
369+/**
370+ * The one hook for a server (#19): a publish answer with the first opinion added when the push was held and the
371+ * switch is on, or the answer as it was. Under "act" it also says `settle: true`, and the client settles the
372+ * collisions advised to a side and pushes again; under "on" the client only shows the advice.
373+ */
374+export async function withAdvice(
375+ env: AutosettleEnv,
376+ op: string | undefined,
377+ agent: string | undefined,
378+ request: unknown,
379+ answer: unknown,
380+): Promise<unknown> {
381+ const mode = env.AUTOSETTLE;
382+ if (op !== "publish" || (mode !== "on" && mode !== "act") || !env.AI || !agent) return answer;
383+ const held = answer as { ok?: boolean; collisions?: readonly HeldCollision[] } | null;
384+ if (held?.ok !== false || !held.collisions || held.collisions.length === 0) return answer;
385+ const message = String((request as { message?: unknown } | null | undefined)?.message ?? "");
386+ const at = Number(env.AUTOSETTLE_AT);
387+ const advice = await adviseHeld(
388+ env.AI,
389+ held.collisions,
390+ { agent, message },
391+ {
392+ ...(env.AUTOSETTLE_MODEL ? { model: env.AUTOSETTLE_MODEL } : {}),
393+ ...(at > 0 ? { at } : {}),
394+ },
395+ );
396+ if (!advice.some((x) => x !== null)) return answer;
397+ return { ...held, advice, ...(mode === "act" ? { settle: true } : {}) };
398+}
MCP
compare on this site's /mcp
CLI
abso diff 203 204 worker/project/autosettle.ts --json
JSON
/christopher/abso-core/compare/203..204?file=worker%2Fproject%2Fautosettle.ts&format=json