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 197 to 198

Compare

+26 −15 in 2 places
Lines 124–166 at 198 (were 124–155 at 197)
124124 return PICKS.reduce((a, b) => (p[b] > p[a] ? b : a));
125125}
126126
127−/** Ask Jev once, with the choice in two option orders (Jev's docs warn order can sway a Choice) and the side questions. */
128−export async function ask(h: Hold, opts: { model?: string; key?: string } = {}): Promise<Verdict> {
129− const forward = PICKS;
130− const backward = [...PICKS].reverse();
131− const body = {
132− model: opts.model ?? "jev-latest",
127+/**
128+ * One System One request (TypeSafe's API, which Cloudflare's Clef also takes): the choice in two option orders
129+ * (Jev's docs warn order can sway a Choice) and the side questions.
130+ */
131+export function systemOneBody(h: Hold, model: string) {
132+ return {
133+ model,
133134 state: stateOf(h),
134135 questions: {
135− settle: choice(forward),
136− settle_reversed: choice(backward),
136+ settle: choice(PICKS),
137+ settle_reversed: choice([...PICKS].reverse()),
137138 ...Object.fromEntries(Object.entries(SIGNS).map(([id, q]) => [id, { type: "noul", instructions: q }])),
138139 },
139140 };
141+}
143+export interface SystemOneAnswer {
144+ model: string;
145+ answers: Record<string, { type: string; probabilities?: Record<string, number>; noul?: number; choice?: string }>;
146+ usage?: { input_tokens?: number };
147+}
149+/** Ask Jev once. */
150+export async function ask(h: Hold, opts: { model?: string; key?: string } = {}): Promise<Verdict> {
140151 const started = performance.now();
141152 const res = await fetch(ENDPOINT, {
142153 method: "POST",
143154 headers: { authorization: `Bearer ${opts.key ?? apiKey()}`, "content-type": "application/json" },
144− body: JSON.stringify(body),
155+ body: JSON.stringify(systemOneBody(h, opts.model ?? "jev-latest")),
145156 });
146157 const ms = performance.now() - started;
147158 if (!res.ok) throw new Error(`Jev answered ${res.status}: ${(await res.text()).slice(0, 500)}`);
148− const out = (await res.json()) as {
149− model: string;
150− answers: Record<string, { type: string; probabilities?: Record<string, number>; noul?: number; choice?: string }>;
151− usage: { input_tokens: number };
152− };
159+ return verdictOf((await res.json()) as SystemOneAnswer, ms);
160+}
162+/** A System One answer to systemOneBody's questions, as a Verdict. */
163+export function verdictOf(out: SystemOneAnswer, ms: number): Verdict {
153164 const orders = ["settle", "settle_reversed"].map((id) => {
154165 const probabilities = Object.fromEntries(PICKS.map((k) => [k, out.answers[id]!.probabilities![k] ?? 0])) as Record<
155166 Pick,
Lines 179–185 at 198 (were 168–174 at 197)
168179 signs: Object.fromEntries(Object.keys(SIGNS).map((id) => [id, out.answers[id]?.noul ?? Number.NaN])),
169180 model: out.model,
170181 ms,
171− inputTokens: out.usage.input_tokens,
182+ inputTokens: out.usage?.input_tokens ?? 0,
172183 };
173184}
174185
MCP
compare on this site's /mcp
CLI
abso diff 197 198 scripts/autosettle/jev.ts --json
JSON
/christopher/abso-core/compare/197..198?file=scripts%2Fautosettle%2Fjev.ts&format=json