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 191 to 192

Compare

+24 −2 in 3 places
Lines 1–7 at 192 (were 1–6 at 191)
11// Ask the local auto-settle Worker (workers-ai/, run with wrangler dev) how a hold should be settled (#19).
22
33import type { Hold, Pick } from "./jev.ts";
4+import { refused, ruled } from "./rules.ts";
45
56export const WORKER = process.env.AUTOSETTLE_WORKER ?? "http://127.0.0.1:8845";
67
Lines 15–48 at 192 (were 14–27 at 191)
1415 /** The model's own time, as the Worker measured it. */
1516 readonly modelMs: number;
1617 readonly inputTokens: number;
18+ /** rule: code decided without the model. turned down: the model's pick would break the file, so an agent settles. */
19+ readonly by: "rule" | "model" | "turned down";
20+ /** The model's own pick, when it was turned down. */
21+ readonly modelPick?: Pick;
1722}
1823
19−export async function askWorkersAi(h: Hold, opts: { model?: string; url?: string } = {}): Promise<ModelVerdict> {
24+/** Code's rules first, then the model, then code's check on what the model picked. */
25+export async function askWorkersAi(
26+ h: Hold,
27+ opts: { model?: string; url?: string; samples?: number } = {},
28+): Promise<ModelVerdict> {
29+ const rule = ruled(h);
30+ if (rule) return { ...rule, confidence: 1, model: "rule", ms: 0, modelMs: 0, inputTokens: 0, by: "rule" };
31+ const v = await askModel(h, opts);
32+ const no = refused(h, v.pick);
33+ return no ? { ...v, pick: "agent", reason: no, by: "turned down", modelPick: v.pick } : v;
34+}
36+async function askModel(h: Hold, opts: { model?: string; url?: string; samples?: number }): Promise<ModelVerdict> {
2037 const started = performance.now();
2138 const res = await fetch(opts.url ?? WORKER, {
2239 method: "POST",
2340 headers: { "content-type": "application/json" },
24− body: JSON.stringify({ hold: h, ...(opts.model ? { model: opts.model } : {}) }),
41+ body: JSON.stringify({
42+ hold: h,
43+ ...(opts.model ? { model: opts.model } : {}),
44+ samples: opts.samples ?? Number(process.env.AUTOSETTLE_SAMPLES ?? 1),
45+ }),
2546 });
2647 const out = (await res.json()) as {
2748 pick?: Pick;
Lines 62–67 at 192 (were 41–45 at 191)
4162 ms: performance.now() - started,
4263 modelMs: out.ms,
4364 inputTokens: out.usage?.prompt_tokens ?? 0,
65+ by: "model",
4466 };
4567}
MCP
compare on this site's /mcp
CLI
abso diff 191 192 scripts/autosettle/workers-ai.ts --json
JSON
/christopher/abso-core/compare/191..192?file=scripts%2Fautosettle%2Fworkers-ai.ts&format=json