{"draft":null,"from":190,"to":191,"files":[{"path":"scripts/autosettle/settle-one.ts","added":16,"removed":5,"diff":"--- a/scripts/autosettle/settle-one.ts\n+++ b/scripts/autosettle/settle-one.ts\n@@ -1,13 +1,14 @@\n-// Ask Jev how to settle each marker block in one file (#19), the way abso pull\n-// leaves a held push's file. Prints Jev's pick and its probabilities; changes nothing.\n+// Ask a model how to settle each marker block in one file (#19), the way abso\n+// pull leaves a held push's file. Prints its pick; changes nothing.\n //\n-//   node scripts/autosettle/settle-one.ts <file> [--message \"<your held push's message>\"] [--issue \"...\"] [--name <path in the project>] [--json]\n+//   node scripts/autosettle/settle-one.ts <file> [--via workers-ai|jev] [--model <id>] [--message \"<your held push's message>\"] [--issue \"...\"] [--name <path in the project>] [--json]\n //\n-// Needs JEV_API_KEY in the environment.\n+// --via workers-ai (the default) needs workers-ai/ running under wrangler dev; --via jev needs JEV_API_KEY.\n \n import { readFileSync } from \"node:fs\";\n import { findBlocks } from \"../../client/src/settle.ts\";\n import { ask, dollars, type Hold, PICKS } from \"./jev.ts\";\n+import { askWorkersAi } from \"./workers-ai.ts\";\n \n const CONTEXT = 15;\n const CLOSE = /^>>>>>>> theirs: (.*?), version (\\d+) \"(.*)\"$/;\n@@ -57,8 +58,18 @@\n \t\tprocess.exit(1);\n \t}\n \tconst results = [];\n+\tconst model = flag(args, \"--model\") ? { model: flag(args, \"--model\")! } : {};\n \tfor (const [i, h] of holds.entries()) {\n-\t\tconst v = await ask(h);\n+\t\tif (flag(args, \"--via\") !== \"jev\") {\n+\t\t\tconst w = await askWorkersAi(h, model);\n+\t\t\tresults.push({ block: i + 1, ...w });\n+\t\t\tif (!args.includes(\"--json\"))\n+\t\t\t\tconsole.log(\n+\t\t\t\t\t`Block ${i + 1} of ${holds.length} in ${h.file}: ${w.pick}, confidence ${w.confidence.toFixed(2)}\\n  ${w.reason}\\n  ${w.model}, ${w.ms.toFixed(0)} ms (model ${w.modelMs} ms), ${w.inputTokens} input tokens`,\n+\t\t\t\t);\n+\t\t\tcontinue;\n+\t\t}\n+\t\tconst v = await ask(h, model);\n \t\tresults.push({ block: i + 1, ...v });\n \t\tif (args.includes(\"--json\")) continue;\n \t\tconst pct = (x: number) => `${(x * 100).toFixed(0)}%`;"}],"unmatched":[]}