{"draft":null,"from":200,"to":201,"files":[{"path":"scripts/autosettle/jev.ts","added":4,"removed":69,"diff":"--- a/scripts/autosettle/jev.ts\n+++ b/scripts/autosettle/jev.ts\n@@ -7,7 +7,11 @@\n // is never printed or written anywhere.\n \n import { execFileSync } from \"node:child_process\";\n+import { confidenceOf, SIGNS, systemOneBody } from \"../../server/src/autosettle.ts\";\n \n+// The questions are the open server's own (server/src/autosettle.ts), so Jev and Clef are asked alike.\n+export { systemOneBody };\n+\n export const ENDPOINT = \"https://api.typesafe.ai/v1/systemone\";\n \n /** abso's settle choices, plus a hand edit by an agent. */\n@@ -67,79 +71,10 @@\n \t}\n }\n \n-const text = (lines: readonly string[]): string => (lines.length === 0 ? \"(no lines)\" : lines.join(\"\\n\"));\n-\n-function stateOf(h: Hold): Record<string, unknown> {\n-\treturn {\n-\t\tfile: h.file,\n-\t\tlines_above: text(h.before),\n-\t\tbefore_either_change: text(h.base),\n-\t\tyours: text(h.yours),\n-\t\ttheirs: text(h.theirs),\n-\t\tlines_below: text(h.after),\n-\t\tyour_push: { agent: h.yourAgent ?? \"you\", message: h.yourMessage ?? \"(no message)\" },\n-\t\ttheir_push: { agent: h.theirAgent ?? \"the other agent\", message: h.theirMessage ?? \"(no message)\" },\n-\t\t...(h.issue ? { issue: h.issue } : {}),\n-\t};\n-}\n-\n-const INSTRUCTIONS =\n-\t\"Two agents changed the same lines of `file`. Both started from `before_either_change`. \" +\n-\t\"`yours` is what the held agent wrote, for the reason in `your_push`; `theirs` was pushed first, for the reason in `their_push`. \" +\n-\t\"The region sits between `lines_above` and `lines_below`. \" +\n-\t\"Which result is correct code that does what both pushes meant?\";\n-\n-const CRITERIA: Record<Pick, string> = {\n-\tyours: \"Keep `yours` only: `yours` already does what `theirs` meant, or `theirs` is wrong or out of date.\",\n-\ttheirs: \"Keep `theirs` only: `theirs` already does what `yours` meant, or `yours` is wrong or out of date.\",\n-\tboth: \"Keep both unchanged, `yours` then `theirs`: they add separate things that work side by side, and nothing is duplicated or contradicts.\",\n-\tagent:\n-\t\t\"Neither side alone and not both unchanged: the sides change the same thing in different ways (such as two different values for one setting), or keeping both would duplicate or contradict, so a correct result needs a hand edit.\",\n-};\n-\n-function choice(order: readonly Pick[]) {\n-\treturn {\n-\t\ttype: \"choice\",\n-\t\tinstructions: INSTRUCTIONS,\n-\t\tcriteria: Object.fromEntries(order.map((p) => [p, CRITERIA[p]])),\n-\t};\n-}\n-\n-const SIGNS: Record<string, string> = {\n-\tsame_setting_different_values:\n-\t\t\"Do `yours` and `theirs` set the same setting, constant or value to two different values?\",\n-\ttheirs_covers_yours: \"Does `theirs` already do everything `yours` was changed to do?\",\n-\tyours_covers_theirs: \"Does `yours` already do everything `theirs` was changed to do?\",\n-\tboth_unchanged_compiles:\n-\t\t\"If `yours` were placed directly above `theirs`, unchanged, would the file still be correct code with nothing defined twice?\",\n-};\n-\n-function confidenceOf(p: Record<Pick, number>): number {\n-\tconst max = Math.max(...PICKS.map((k) => p[k]));\n-\tconst even = 1 / PICKS.length;\n-\treturn Math.max(0, (max - even) / (1 - even));\n-}\n-\n function top(p: Record<Pick, number>): Pick {\n \treturn PICKS.reduce((a, b) => (p[b] > p[a] ? b : a));\n }\n \n-/**\n- * One System One request (TypeSafe's API, which Cloudflare's Clef also takes): the choice in two option orders\n- * (Jev's docs warn order can sway a Choice) and the side questions.\n- */\n-export function systemOneBody(h: Hold, model: string) {\n-\treturn {\n-\t\tmodel,\n-\t\tstate: stateOf(h),\n-\t\tquestions: {\n-\t\t\tsettle: choice(PICKS),\n-\t\t\tsettle_reversed: choice([...PICKS].reverse()),\n-\t\t\t...Object.fromEntries(Object.entries(SIGNS).map(([id, q]) => [id, { type: \"noul\", instructions: q }])),\n-\t\t},\n-\t};\n-}\n-\n export interface SystemOneAnswer {\n \tmodel: string;\n \tanswers: Record<string, { type: string; probabilities?: Record<string, number>; noul?: number; choice?: string }>;"}],"unmatched":[]}