@blazediff/agent 0.11.2 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -14,11 +14,11 @@ var crypto$1 = require('crypto');
14
14
  var langgraph = require('@langchain/langgraph');
15
15
  var sharp = require('sharp');
16
16
  var pc = require('picocolors');
17
- var langgraphCheckpoint = require('@langchain/langgraph-checkpoint');
18
- var interpretNative = require('@blazediff/interpret-native');
19
- var net = require('net');
20
17
  var util = require('util');
18
+ var net = require('net');
21
19
  var treeKill = require('tree-kill');
20
+ var langgraphCheckpoint = require('@langchain/langgraph-checkpoint');
21
+ var interpretNative = require('@blazediff/interpret-native');
22
22
  var promises$1 = require('readline/promises');
23
23
  var http = require('http');
24
24
 
@@ -51,7 +51,7 @@ var treeKill__default = /*#__PURE__*/_interopDefault(treeKill);
51
51
 
52
52
  // package.json
53
53
  var package_default = {
54
- version: "0.11.2"};
54
+ version: "0.12.0"};
55
55
  var FROZEN_NOW = Date.UTC(2025, 0, 1, 0, 0, 0);
56
56
  var STABILITY_CSS = `
57
57
  *,*::before,*::after{
@@ -311,6 +311,7 @@ var DEFAULT_THRESHOLD = 0.1;
311
311
  var DEFAULT_PORT = 3e3;
312
312
  var DEFAULT_REVIEW_PORT = 4321;
313
313
  var DEFAULT_READY_TIMEOUT_MS = 6e4;
314
+ var DEFAULT_LOCAL_MODEL = "moondream-2-2b-onnx";
314
315
  var MIN_AUTO_CONCURRENCY = 2;
315
316
  var MAX_AUTO_CONCURRENCY = 8;
316
317
  function cpuCores() {
@@ -1179,7 +1180,7 @@ async function prepareTiles(opts) {
1179
1180
  };
1180
1181
  }
1181
1182
 
1182
- // src/judge/coding-agent-host.ts
1183
+ // src/judge/agent.ts
1183
1184
  async function tryPrepareTiles(input, entryDir) {
1184
1185
  if (!input.regions || input.regions.length === 0) {
1185
1186
  return null;
@@ -1200,8 +1201,8 @@ async function tryPrepareTiles(input, entryDir) {
1200
1201
  return null;
1201
1202
  }
1202
1203
  }
1203
- var codingAgentHostJudge = {
1204
- name: "host",
1204
+ var agentJudge = {
1205
+ name: "agent",
1205
1206
  async judge(input, cwd) {
1206
1207
  input.onJudgingStart?.();
1207
1208
  const p = paths(cwd);
@@ -1326,7 +1327,7 @@ function createLoadProgress(label, opts) {
1326
1327
  clearInterval(heartbeat);
1327
1328
  heartbeat = void 0;
1328
1329
  };
1329
- const start = () => {
1330
+ const start2 = () => {
1330
1331
  if (started) return;
1331
1332
  started = true;
1332
1333
  load.startedAt = Date.now();
@@ -1356,7 +1357,7 @@ function createLoadProgress(label, opts) {
1356
1357
  };
1357
1358
  const finish = (status) => {
1358
1359
  if (finished) return;
1359
- start();
1360
+ start2();
1360
1361
  finished = true;
1361
1362
  stopHeartbeat();
1362
1363
  if (interactive) {
@@ -1372,9 +1373,9 @@ function createLoadProgress(label, opts) {
1372
1373
  );
1373
1374
  };
1374
1375
  return {
1375
- start,
1376
+ start: start2,
1376
1377
  onProgress(event) {
1377
- start();
1378
+ start2();
1378
1379
  if (!event.file) return;
1379
1380
  if (event.status === "done") {
1380
1381
  const file = files.get(event.file);
@@ -1687,71 +1688,6 @@ function describeRegionChange(changeType, baseRead, actualRead) {
1687
1688
  return `${kind} with no readable text change${updated}`;
1688
1689
  }
1689
1690
 
1690
- // src/judge/vision.ts
1691
- var MODEL_ID2 = "Xenova/moondream2";
1692
- var PATCH_SIZE = 14;
1693
- var MAX_NEW_TOKENS2 = 64;
1694
- var ANSWER_MARKER = "Answer:";
1695
- async function defaultFactory2() {
1696
- const { mod, tokenizer, processor, model } = await loadTransformersModel(
1697
- "vision",
1698
- async (mod2, progress_callback) => {
1699
- const [tokenizer2, processor2, model2] = await Promise.all([
1700
- mod2.AutoTokenizer.from_pretrained(MODEL_ID2, { progress_callback }),
1701
- mod2.AutoProcessor.from_pretrained(MODEL_ID2, { progress_callback }),
1702
- mod2.Moondream1ForConditionalGeneration.from_pretrained(MODEL_ID2, {
1703
- dtype: {
1704
- embed_tokens: "fp32",
1705
- vision_encoder: "q8",
1706
- decoder_model_merged: "q4"
1707
- },
1708
- device: "cpu",
1709
- progress_callback
1710
- })
1711
- ]);
1712
- return { mod: mod2, tokenizer: tokenizer2, processor: processor2, model: model2 };
1713
- }
1714
- );
1715
- return {
1716
- async describe(imagePath, question) {
1717
- const image = await mod.RawImage.read(imagePath);
1718
- const vision = await processor(image);
1719
- const [, , height, width] = vision.pixel_values.dims;
1720
- const numImageTokens = Math.floor(height / PATCH_SIZE) * Math.floor(width / PATCH_SIZE);
1721
- const prompt = `${"<image>".repeat(numImageTokens)}
1722
-
1723
- Question: ${question}
1724
-
1725
- ${ANSWER_MARKER}`;
1726
- const textInputs = tokenizer(prompt);
1727
- const output = await model.generate({
1728
- ...textInputs,
1729
- ...vision,
1730
- do_sample: false,
1731
- max_new_tokens: MAX_NEW_TOKENS2,
1732
- // Moondream loops the same sentence on composite tiles without these.
1733
- repetition_penalty: 1.3,
1734
- no_repeat_ngram_size: 3
1735
- });
1736
- const decoded = tokenizer.batch_decode(output, {
1737
- skip_special_tokens: true
1738
- });
1739
- const raw = Array.isArray(decoded) ? String(decoded[0] ?? "") : String(decoded);
1740
- const idx = raw.lastIndexOf(ANSWER_MARKER);
1741
- return (idx >= 0 ? raw.slice(idx + ANSWER_MARKER.length) : raw).trim();
1742
- }
1743
- };
1744
- }
1745
- function createVisionRunnerHolder(factory = defaultFactory2) {
1746
- let runnerPromise;
1747
- return {
1748
- get() {
1749
- if (!runnerPromise) runnerPromise = factory();
1750
- return runnerPromise;
1751
- }
1752
- };
1753
- }
1754
-
1755
1691
  // src/judge/local.ts
1756
1692
  var READ_PROMPT = [
1757
1693
  "Read the text in this image. Reply with only the exact words and numbers you",
@@ -1846,8 +1782,8 @@ function classifyFailure(err) {
1846
1782
  return "read";
1847
1783
  return "internal";
1848
1784
  }
1849
- function createLocalJudge(deps = {}) {
1850
- const vision = deps.vision ?? createVisionRunnerHolder();
1785
+ function createLocalJudge(deps) {
1786
+ const vision = deps.vision;
1851
1787
  const classifier = deps.classifier ?? createClassifierRunnerHolder();
1852
1788
  const visionSemaphore = createSemaphore(1);
1853
1789
  const classifierSemaphore = createSemaphore(1);
@@ -1873,70 +1809,543 @@ function createLocalJudge(deps = {}) {
1873
1809
  );
1874
1810
  return phrases.length === 1 ? phrases[0] : phrases.map((p, i) => `region ${i + 1}: ${p}`).join("; ");
1875
1811
  } catch {
1876
- return null;
1812
+ return null;
1813
+ }
1814
+ }
1815
+ async function describeScreenshot(input) {
1816
+ const v = await vision.get();
1817
+ return (await v.describe(input.actualPath, DESCRIBE_PROMPT)).trim();
1818
+ }
1819
+ return {
1820
+ name: deps.name ?? "local",
1821
+ // Stream both models' weights up front (concurrently) so the multi-second
1822
+ // load is a single visible phase before judging, not a silent stall on the
1823
+ // first test. Both are cached promises, so the judge reuses them after.
1824
+ async warmup() {
1825
+ await Promise.all([vision.get(), classifier.get()]);
1826
+ },
1827
+ async judge(input, cwd) {
1828
+ const entryDir = path26__default.default.join(paths(cwd).judgments, input.entry.id);
1829
+ await promises.mkdir(entryDir, { recursive: true });
1830
+ try {
1831
+ const description = await visionSemaphore.run(async () => {
1832
+ input.onJudgingStart?.();
1833
+ const fromRegions = await describeChange(input, entryDir);
1834
+ const text = fromRegions ?? await describeScreenshot(input);
1835
+ return text.trim();
1836
+ });
1837
+ const summary = summarizeInterpret(input);
1838
+ const prompt = buildClassifyPrompt(summary, description);
1839
+ const answer = await classifierSemaphore.run(async () => {
1840
+ const c = await classifier.get();
1841
+ return (await c.complete(prompt)).trim();
1842
+ });
1843
+ const label = parseLabel(answer);
1844
+ if (!label) {
1845
+ return {
1846
+ kind: "judged",
1847
+ verdict: input.heuristicVerdict,
1848
+ rationale: `${description}
1849
+ ${answer}`.trim()
1850
+ };
1851
+ }
1852
+ const reason = reasonOf(answer, label);
1853
+ const verdict = {
1854
+ label,
1855
+ headline: reason || input.heuristicVerdict.headline,
1856
+ // The headline already carries the classifier's reasoning; keep only
1857
+ // the deterministic region read here so the report doesn't repeat the
1858
+ // reasoning or echo the raw `VERDICT:` line back to the reader.
1859
+ rationale: [description].filter(Boolean),
1860
+ action: ACTION_BY_LABEL[label]
1861
+ };
1862
+ return { kind: "judged", verdict, rationale: answer, confidence: 0.6 };
1863
+ } catch (err) {
1864
+ const error = toError(err);
1865
+ return {
1866
+ kind: "failed",
1867
+ reason: classifyFailure(error),
1868
+ error,
1869
+ fallback: input.heuristicVerdict
1870
+ };
1871
+ }
1872
+ }
1873
+ };
1874
+ }
1875
+
1876
+ // src/judge/vision.ts
1877
+ function createVisionRunnerHolder(factory) {
1878
+ let runnerPromise;
1879
+ return {
1880
+ get() {
1881
+ if (!runnerPromise) runnerPromise = factory();
1882
+ return runnerPromise;
1883
+ }
1884
+ };
1885
+ }
1886
+
1887
+ // src/judge/local-moondream-2-2b-onnx.ts
1888
+ var MODEL_ID2 = "Xenova/moondream2";
1889
+ var PATCH_SIZE = 14;
1890
+ var MAX_NEW_TOKENS2 = 64;
1891
+ var ANSWER_MARKER = "Answer:";
1892
+ async function createOnnxVisionRunner() {
1893
+ const { mod, tokenizer, processor, model } = await loadTransformersModel(
1894
+ "vision",
1895
+ async (mod2, progress_callback) => {
1896
+ const [tokenizer2, processor2, model2] = await Promise.all([
1897
+ mod2.AutoTokenizer.from_pretrained(MODEL_ID2, { progress_callback }),
1898
+ mod2.AutoProcessor.from_pretrained(MODEL_ID2, { progress_callback }),
1899
+ mod2.Moondream1ForConditionalGeneration.from_pretrained(MODEL_ID2, {
1900
+ dtype: {
1901
+ embed_tokens: "fp32",
1902
+ vision_encoder: "q8",
1903
+ decoder_model_merged: "q4"
1904
+ },
1905
+ device: "cpu",
1906
+ progress_callback
1907
+ })
1908
+ ]);
1909
+ return { mod: mod2, tokenizer: tokenizer2, processor: processor2, model: model2 };
1910
+ }
1911
+ );
1912
+ return {
1913
+ async describe(imagePath, question) {
1914
+ const image = await mod.RawImage.read(imagePath);
1915
+ const vision = await processor(image);
1916
+ const [, , height, width] = vision.pixel_values.dims;
1917
+ const numImageTokens = Math.floor(height / PATCH_SIZE) * Math.floor(width / PATCH_SIZE);
1918
+ const prompt = `${"<image>".repeat(numImageTokens)}
1919
+
1920
+ Question: ${question}
1921
+
1922
+ ${ANSWER_MARKER}`;
1923
+ const textInputs = tokenizer(prompt);
1924
+ const output = await model.generate({
1925
+ ...textInputs,
1926
+ ...vision,
1927
+ do_sample: false,
1928
+ max_new_tokens: MAX_NEW_TOKENS2,
1929
+ // Moondream loops the same sentence on composite tiles without these.
1930
+ repetition_penalty: 1.3,
1931
+ no_repeat_ngram_size: 3
1932
+ });
1933
+ const decoded = tokenizer.batch_decode(output, {
1934
+ skip_special_tokens: true
1935
+ });
1936
+ const raw = Array.isArray(decoded) ? String(decoded[0] ?? "") : String(decoded);
1937
+ const idx = raw.lastIndexOf(ANSWER_MARKER);
1938
+ return (idx >= 0 ? raw.slice(idx + ANSWER_MARKER.length) : raw).trim();
1939
+ }
1940
+ };
1941
+ }
1942
+ function createOnnxLocalJudge() {
1943
+ return createLocalJudge({
1944
+ vision: createVisionRunnerHolder(createOnnxVisionRunner),
1945
+ name: "local:moondream-2-2b-onnx"
1946
+ });
1947
+ }
1948
+ var onnxLocalJudge = createOnnxLocalJudge();
1949
+ var execFileP = util.promisify(child_process.execFile);
1950
+ async function isPortOpen(port, host = "127.0.0.1") {
1951
+ return new Promise((resolve) => {
1952
+ const socket = net.createConnection({ port, host });
1953
+ socket.setTimeout(500);
1954
+ socket.once("connect", () => {
1955
+ socket.destroy();
1956
+ resolve(true);
1957
+ });
1958
+ socket.once("error", () => resolve(false));
1959
+ socket.once("timeout", () => {
1960
+ socket.destroy();
1961
+ resolve(false);
1962
+ });
1963
+ });
1964
+ }
1965
+ async function waitForPort(port, timeoutMs = 6e4) {
1966
+ const deadline = Date.now() + timeoutMs;
1967
+ while (Date.now() < deadline) {
1968
+ if (await isPortOpen(port)) return;
1969
+ await new Promise((r) => setTimeout(r, 250));
1970
+ }
1971
+ throw new Error(`dev server did not open port ${port} within ${timeoutMs}ms`);
1972
+ }
1973
+ async function findPidByPort(port) {
1974
+ const platform = process.platform;
1975
+ try {
1976
+ if (platform === "darwin" || platform === "linux") {
1977
+ const { stdout } = await execFileP("lsof", [
1978
+ "-ti",
1979
+ `tcp:${port}`,
1980
+ "-sTCP:LISTEN"
1981
+ ]);
1982
+ const pid = Number(stdout.trim().split("\n")[0]);
1983
+ return Number.isFinite(pid) && pid > 0 ? pid : null;
1984
+ }
1985
+ if (platform === "win32") {
1986
+ const { stdout } = await execFileP("netstat", ["-ano"]);
1987
+ const line = stdout.split(/\r?\n/).find((l) => l.includes(`:${port} `) && l.includes("LISTENING"));
1988
+ if (!line) return null;
1989
+ const parts = line.trim().split(/\s+/);
1990
+ const pid = Number(parts[parts.length - 1]);
1991
+ return Number.isFinite(pid) && pid > 0 ? pid : null;
1992
+ }
1993
+ } catch {
1994
+ return null;
1995
+ }
1996
+ return null;
1997
+ }
1998
+ async function startServer(opts) {
1999
+ const cwd = opts.cwd ?? process.cwd();
2000
+ const logPath = opts.logPath ?? paths(cwd).serverLog;
2001
+ const pidPath = opts.pidPath ?? paths(cwd).serverPid;
2002
+ await promises.mkdir(path26__default.default.dirname(logPath), { recursive: true });
2003
+ if (await isPortOpen(opts.port)) {
2004
+ const discoveredPid = await findPidByPort(opts.port);
2005
+ if (discoveredPid) {
2006
+ await promises.writeFile(pidPath, String(discoveredPid), "utf8").catch(() => {
2007
+ });
2008
+ }
2009
+ return {
2010
+ pid: discoveredPid ?? 0,
2011
+ port: opts.port,
2012
+ url: `http://127.0.0.1:${opts.port}`,
2013
+ attached: true
2014
+ };
2015
+ }
2016
+ const child = child_process.spawn(opts.command, {
2017
+ cwd,
2018
+ stdio: ["ignore", "pipe", "pipe"],
2019
+ detached: true,
2020
+ shell: true,
2021
+ env: { ...process.env, FORCE_COLOR: "0", CI: "1" }
2022
+ });
2023
+ const logStream = await import('fs').then(
2024
+ (m) => m.createWriteStream(logPath, { flags: "a" })
2025
+ );
2026
+ child.stdout?.pipe(logStream);
2027
+ child.stderr?.pipe(logStream);
2028
+ if (!child.pid) throw new Error("failed to spawn dev server");
2029
+ await promises.writeFile(pidPath, String(child.pid), "utf8");
2030
+ installSignalHandlers(child);
2031
+ try {
2032
+ await waitForPort(opts.port, opts.readyTimeoutMs ?? 6e4);
2033
+ } catch (err) {
2034
+ await stopProcess(child.pid);
2035
+ throw err;
2036
+ }
2037
+ return {
2038
+ pid: child.pid,
2039
+ port: opts.port,
2040
+ url: `http://127.0.0.1:${opts.port}`
2041
+ };
2042
+ }
2043
+ async function stopServer(cwd = process.cwd(), portFallback) {
2044
+ const pidPath = paths(cwd).serverPid;
2045
+ let pid = null;
2046
+ let via = "none";
2047
+ if (fs.existsSync(pidPath)) {
2048
+ const raw = (await promises.readFile(pidPath, "utf8")).trim();
2049
+ const parsed = Number(raw);
2050
+ if (Number.isFinite(parsed) && parsed > 0 && processExists(parsed)) {
2051
+ pid = parsed;
2052
+ via = "pidfile";
2053
+ }
2054
+ }
2055
+ if (!pid && portFallback) {
2056
+ pid = await findPidByPort(portFallback);
2057
+ if (pid) via = "port";
2058
+ }
2059
+ if (!pid) {
2060
+ await promises.writeFile(pidPath, "", "utf8").catch(() => {
2061
+ });
2062
+ return { killed: false, pid: null, via: "none" };
2063
+ }
2064
+ await stopProcess(pid);
2065
+ await promises.writeFile(pidPath, "", "utf8").catch(() => {
2066
+ });
2067
+ return { killed: true, pid, via };
2068
+ }
2069
+ function processExists(pid) {
2070
+ try {
2071
+ process.kill(pid, 0);
2072
+ return true;
2073
+ } catch {
2074
+ return false;
2075
+ }
2076
+ }
2077
+ async function stopProcess(pid) {
2078
+ if (!pid) return;
2079
+ await new Promise((resolve) => {
2080
+ treeKill__default.default(pid, "SIGTERM", (err) => {
2081
+ if (err) {
2082
+ treeKill__default.default(pid, "SIGKILL", () => resolve());
2083
+ return;
2084
+ }
2085
+ resolve();
2086
+ });
2087
+ });
2088
+ }
2089
+ var signalsInstalled = false;
2090
+ function installSignalHandlers(child) {
2091
+ if (signalsInstalled) return;
2092
+ signalsInstalled = true;
2093
+ const cleanup = () => {
2094
+ if (child.pid) {
2095
+ try {
2096
+ process.kill(-child.pid, "SIGTERM");
2097
+ } catch {
2098
+ }
2099
+ treeKill__default.default(child.pid, "SIGKILL", () => {
2100
+ });
2101
+ }
2102
+ };
2103
+ process.on("SIGINT", () => {
2104
+ cleanup();
2105
+ process.exit(130);
2106
+ });
2107
+ process.on("SIGTERM", () => {
2108
+ cleanup();
2109
+ process.exit(143);
2110
+ });
2111
+ process.on("exit", cleanup);
2112
+ }
2113
+
2114
+ // src/judge/station.ts
2115
+ var execFileP2 = util.promisify(child_process.execFile);
2116
+ var PORT = 2020;
2117
+ var BASE_URL = `http://127.0.0.1:${PORT}`;
2118
+ var COMMAND = "moondream-station";
2119
+ var MODEL = "moondream-3-preview-mlx-quantized";
2120
+ var MIN_INFERENCE_TIMEOUT_S = 900;
2121
+ var READY_TIMEOUT_MS = 12e4;
2122
+ var SETTINGS_TIMEOUT_MS = 3e4;
2123
+ var MODEL_TIMEOUT_MS = 9e5;
2124
+ var POLL_INTERVAL_MS = 500;
2125
+ var OUTPUT_TAIL_LINES = 15;
2126
+ var WARMUP_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXBIWXMAAAPoAAAD6AG1e1JrAAAADElEQVR42mP4//8/AAX+Av4zEpUUAAAAAElFTkSuQmCC";
2127
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2128
+ var note = (message) => {
2129
+ process.stderr.write(`${dim("[blazediff]")} ${message}
2130
+ `);
2131
+ };
2132
+ async function readStats() {
2133
+ try {
2134
+ const response = await fetch(`${BASE_URL}/v1/stats`, {
2135
+ signal: AbortSignal.timeout(2e3)
2136
+ });
2137
+ return response.ok ? await response.json() : null;
2138
+ } catch {
2139
+ return null;
2140
+ }
2141
+ }
2142
+ async function waitForStats(predicate, timeoutMs, what, tail) {
2143
+ const deadline = Date.now() + timeoutMs;
2144
+ while (Date.now() < deadline) {
2145
+ const stats = await readStats();
2146
+ if (stats && predicate(stats)) return stats;
2147
+ await sleep(POLL_INTERVAL_MS);
2148
+ }
2149
+ const context = tail.length > 0 ? `
2150
+ ${tail.join("\n")}` : "";
2151
+ throw new Error(`moondream station: timed out waiting for ${what}${context}`);
2152
+ }
2153
+ async function commandExists(command) {
2154
+ try {
2155
+ await execFileP2(process.platform === "win32" ? "where" : "which", [
2156
+ command
2157
+ ]);
2158
+ return true;
2159
+ } catch {
2160
+ return false;
2161
+ }
2162
+ }
2163
+ function ensureApplePlatform() {
2164
+ if (process.platform === "darwin" && process.arch === "arm64") return;
2165
+ throw new Error(
2166
+ "the moondream judge needs Apple Silicon (moondream station's Metal build). Use --judge local for the in-process ONNX judge."
2167
+ );
2168
+ }
2169
+ async function ensureInstalled() {
2170
+ if (await commandExists(COMMAND)) return;
2171
+ if (!await commandExists("uv")) {
2172
+ throw new Error(
2173
+ `moondream station is not installed. Install uv (https://docs.astral.sh/uv) and retry, or install it yourself: pipx install ${COMMAND}`
2174
+ );
2175
+ }
2176
+ note(`installing ${bold(COMMAND)} ${dim("(one time)")}`);
2177
+ await execFileP2("uv", ["tool", "install", COMMAND]);
2178
+ }
2179
+ function launch() {
2180
+ const tail = [];
2181
+ const child = child_process.spawn(COMMAND, {
2182
+ stdio: ["pipe", "pipe", "pipe"],
2183
+ detached: true,
2184
+ env: { ...process.env, NO_COLOR: "1" }
2185
+ });
2186
+ const remember = (chunk) => {
2187
+ for (const line of chunk.toString().split("\n")) {
2188
+ const text = line.trim();
2189
+ if (!text) continue;
2190
+ tail.push(text);
2191
+ if (tail.length > OUTPUT_TAIL_LINES) tail.shift();
2192
+ }
2193
+ };
2194
+ child.stdout?.on("data", remember);
2195
+ child.stderr?.on("data", remember);
2196
+ child.once("error", (error) => tail.push(error.message));
2197
+ child.stdin?.write("\n");
2198
+ return { child, tail };
2199
+ }
2200
+ var send = (child, command) => {
2201
+ child.stdin?.write(`${command}
2202
+ `);
2203
+ };
2204
+ async function ensureTimeout(child, tail) {
2205
+ const stats = await readStats();
2206
+ if ((stats?.default_timeout ?? 0) >= MIN_INFERENCE_TIMEOUT_S) return;
2207
+ send(child, `settings set inference_timeout ${MIN_INFERENCE_TIMEOUT_S}`);
2208
+ await waitForStats(
2209
+ (s) => (s.default_timeout ?? 0) >= MIN_INFERENCE_TIMEOUT_S,
2210
+ SETTINGS_TIMEOUT_MS,
2211
+ "the inference timeout to apply",
2212
+ tail
2213
+ );
2214
+ }
2215
+ async function ensureModel(child, active, tail) {
2216
+ if (active === MODEL) return;
2217
+ note(
2218
+ `switching moondream station to ${bold(MODEL)} ${dim("(first run downloads weights)")}`
2219
+ );
2220
+ send(child, `models switch ${MODEL}`);
2221
+ send(child, "y");
2222
+ await waitForStats(
2223
+ (s) => s.model === MODEL && s.status === "running",
2224
+ MODEL_TIMEOUT_MS,
2225
+ `moondream station to load ${MODEL}`,
2226
+ tail
2227
+ );
2228
+ }
2229
+ async function warmModel(endpoint) {
2230
+ const response = await fetch(`${endpoint}/query`, {
2231
+ method: "POST",
2232
+ headers: { "Content-Type": "application/json" },
2233
+ body: JSON.stringify({
2234
+ image_url: WARMUP_IMAGE,
2235
+ question: "Read the text in this image.",
2236
+ stream: false
2237
+ }),
2238
+ signal: AbortSignal.timeout(MODEL_TIMEOUT_MS)
2239
+ });
2240
+ const payload = await response.json();
2241
+ if (payload.error) throw new Error(`moondream station: ${payload.error}`);
2242
+ }
2243
+ function killOnExit(child) {
2244
+ const kill = () => {
2245
+ if (!child.pid) return;
2246
+ try {
2247
+ process.kill(-child.pid, "SIGKILL");
2248
+ } catch {
1877
2249
  }
2250
+ };
2251
+ process.once("exit", kill);
2252
+ process.once("SIGINT", () => {
2253
+ kill();
2254
+ process.exit(130);
2255
+ });
2256
+ process.once("SIGTERM", () => {
2257
+ kill();
2258
+ process.exit(143);
2259
+ });
2260
+ }
2261
+ async function start() {
2262
+ const endpoint = `${BASE_URL}/v1`;
2263
+ const running = await readStats();
2264
+ if (running) {
2265
+ await warmModel(endpoint);
2266
+ return {
2267
+ endpoint,
2268
+ model: running.model ?? "unknown",
2269
+ attached: true,
2270
+ stop: async () => {
2271
+ }
2272
+ };
1878
2273
  }
1879
- async function describeScreenshot(input) {
1880
- const v = await vision.get();
1881
- return (await v.describe(input.actualPath, DESCRIBE_PROMPT)).trim();
2274
+ ensureApplePlatform();
2275
+ await ensureInstalled();
2276
+ const { child, tail } = launch();
2277
+ try {
2278
+ const stats = await waitForStats(
2279
+ () => true,
2280
+ READY_TIMEOUT_MS,
2281
+ "moondream station to start",
2282
+ tail
2283
+ );
2284
+ await ensureTimeout(child, tail);
2285
+ await ensureModel(child, stats.model, tail);
2286
+ await warmModel(endpoint);
2287
+ killOnExit(child);
2288
+ note(`moondream station ready ${pc__default.default.green("\u2713")} ${dim(endpoint)}`);
2289
+ return {
2290
+ endpoint,
2291
+ model: MODEL,
2292
+ attached: false,
2293
+ stop: async () => {
2294
+ if (child.pid) await stopProcess(child.pid);
2295
+ }
2296
+ };
2297
+ } catch (error) {
2298
+ if (child.pid) await stopProcess(child.pid);
2299
+ throw error;
1882
2300
  }
2301
+ }
2302
+ var station;
2303
+ function startStation() {
2304
+ station ?? (station = start());
2305
+ return station;
2306
+ }
2307
+
2308
+ // src/judge/local-moondream-3-9b-mlx.ts
2309
+ var REQUEST_TIMEOUT_MS = 12e4;
2310
+ async function toDataUrl(imagePath) {
2311
+ const bytes = await promises.readFile(imagePath);
2312
+ return `data:image/png;base64,${bytes.toString("base64")}`;
2313
+ }
2314
+ function createStationVisionRunner(endpoint) {
2315
+ const queryUrl = `${endpoint.replace(/\/+$/, "")}/query`;
1883
2316
  return {
1884
- name: "local",
1885
- // Stream both models' weights up front (concurrently) so the multi-second
1886
- // load is a single visible phase before judging, not a silent stall on the
1887
- // first test. Both are cached promises, so the judge reuses them after.
1888
- async warmup() {
1889
- await Promise.all([vision.get(), classifier.get()]);
1890
- },
1891
- async judge(input, cwd) {
1892
- const entryDir = path26__default.default.join(paths(cwd).judgments, input.entry.id);
1893
- await promises.mkdir(entryDir, { recursive: true });
1894
- try {
1895
- const description = await visionSemaphore.run(async () => {
1896
- input.onJudgingStart?.();
1897
- const fromRegions = await describeChange(input, entryDir);
1898
- const text = fromRegions ?? await describeScreenshot(input);
1899
- return text.trim();
1900
- });
1901
- const summary = summarizeInterpret(input);
1902
- const prompt = buildClassifyPrompt(summary, description);
1903
- const answer = await classifierSemaphore.run(async () => {
1904
- const c = await classifier.get();
1905
- return (await c.complete(prompt)).trim();
1906
- });
1907
- const label = parseLabel(answer);
1908
- if (!label) {
1909
- return {
1910
- kind: "judged",
1911
- verdict: input.heuristicVerdict,
1912
- rationale: `${description}
1913
- ${answer}`.trim()
1914
- };
1915
- }
1916
- const reason = reasonOf(answer, label);
1917
- const verdict = {
1918
- label,
1919
- headline: reason || input.heuristicVerdict.headline,
1920
- // The headline already carries the classifier's reasoning; keep only
1921
- // the deterministic region read here so the report doesn't repeat the
1922
- // reasoning or echo the raw `VERDICT:` line back to the reader.
1923
- rationale: [description].filter(Boolean),
1924
- action: ACTION_BY_LABEL[label]
1925
- };
1926
- return { kind: "judged", verdict, rationale: answer, confidence: 0.6 };
1927
- } catch (err) {
1928
- const error = toError(err);
1929
- return {
1930
- kind: "failed",
1931
- reason: classifyFailure(error),
1932
- error,
1933
- fallback: input.heuristicVerdict
1934
- };
2317
+ async describe(imagePath, question) {
2318
+ const response = await fetch(queryUrl, {
2319
+ method: "POST",
2320
+ headers: { "Content-Type": "application/json" },
2321
+ body: JSON.stringify({
2322
+ image_url: await toDataUrl(imagePath),
2323
+ question,
2324
+ stream: false
2325
+ }),
2326
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
2327
+ });
2328
+ if (!response.ok) {
2329
+ throw new Error(
2330
+ `moondream station returned ${response.status} for ${queryUrl}`
2331
+ );
2332
+ }
2333
+ const payload = await response.json();
2334
+ if (payload.error) {
2335
+ throw new Error(`moondream station: ${payload.error}`);
1935
2336
  }
2337
+ return (payload.answer ?? "").trim();
1936
2338
  }
1937
2339
  };
1938
2340
  }
1939
- var localJudge = createLocalJudge();
2341
+ function createMlxLocalJudge() {
2342
+ const vision = createVisionRunnerHolder(async () => {
2343
+ const station2 = await startStation();
2344
+ return createStationVisionRunner(station2.endpoint);
2345
+ });
2346
+ return createLocalJudge({ vision, name: "local:moondream-3-9b-mlx" });
2347
+ }
2348
+ var mlxLocalJudge = createMlxLocalJudge();
1940
2349
 
1941
2350
  // src/judge/none.ts
1942
2351
  var noneJudge = {
@@ -2158,7 +2567,7 @@ async function applyJudgments(opts = {}) {
2158
2567
  });
2159
2568
  return { report, applied, missing, invalid };
2160
2569
  }
2161
- var HOST_INSTRUCTIONS = [
2570
+ var AGENT_INSTRUCTIONS = [
2162
2571
  "The visual-regression heuristic could not classify this diff confidently.",
2163
2572
  "Read `locator.png` AND `regions.png` in parallel - issue both Read calls in a single tool batch. locator.png is a small thumbnail of the diff with every change region outlined in red; regions.png is a vertical stack of [baseline | actual] pairs, one row per change region at native resolution. Row order matches the `regions[]` array (top = largest by pixelCount).",
2164
2573
  "Decide from the tile pairs. Only open the full diff / baseline / actual PNGs if the composite is itself ambiguous (e.g., a change clearly continues outside the cropped region).",
@@ -2206,7 +2615,7 @@ function buildRequest(result, entry, cwd, tiles) {
2206
2615
  },
2207
2616
  signature: signatureOf(result),
2208
2617
  message: result.message,
2209
- instructions: isAmbiguous ? HOST_INSTRUCTIONS : void 0,
2618
+ instructions: isAmbiguous ? AGENT_INSTRUCTIONS : void 0,
2210
2619
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
2211
2620
  };
2212
2621
  }
@@ -2297,14 +2706,14 @@ async function writeJudgments(opts) {
2297
2706
  }
2298
2707
 
2299
2708
  // src/judge/index.ts
2300
- function resolveJudge(backend) {
2709
+ function resolveJudge(backend, model = DEFAULT_LOCAL_MODEL) {
2301
2710
  switch (backend) {
2302
2711
  case "none":
2303
2712
  return noneJudge;
2304
- case "host":
2305
- return codingAgentHostJudge;
2713
+ case "agent":
2714
+ return agentJudge;
2306
2715
  case "local":
2307
- return localJudge;
2716
+ return model === "moondream-3-9b-mlx" ? mlxLocalJudge : onnxLocalJudge;
2308
2717
  }
2309
2718
  }
2310
2719
  function escapeXml(value) {
@@ -3122,7 +3531,7 @@ async function judgeNode(state) {
3122
3531
  emitEvent({ type: "result", result: initial });
3123
3532
  return { results: [initial] };
3124
3533
  }
3125
- const judge = resolveJudge(options.judge);
3534
+ const judge = resolveJudge(options.judge, options.model);
3126
3535
  const output = await judge.judge(
3127
3536
  {
3128
3537
  entry,
@@ -3237,7 +3646,8 @@ async function dispatchNode(state) {
3237
3646
  (item) => item.output.captureOutputPath
3238
3647
  ).length;
3239
3648
  emitEvent({ type: "capture-complete", captured, total });
3240
- if (state.options) await resolveJudge(state.options.judge).warmup?.();
3649
+ if (state.options)
3650
+ await resolveJudge(state.options.judge, state.options.model).warmup?.();
3241
3651
  return {};
3242
3652
  }
3243
3653
  function buildGraph(captureSemaphore, diffSemaphore, checkpointer, abortController) {
@@ -3354,6 +3764,7 @@ async function runGraph(opts) {
3354
3764
  concurrency,
3355
3765
  emitDiffPng: opts.emitDiffPng ?? true,
3356
3766
  judge: opts.judge ?? "none",
3767
+ model: opts.model ?? DEFAULT_LOCAL_MODEL,
3357
3768
  baselinesDir
3358
3769
  }
3359
3770
  };
@@ -3385,170 +3796,6 @@ async function resumeGraph(opts) {
3385
3796
  junitPath: opts.junitPath
3386
3797
  });
3387
3798
  }
3388
- var execFileP = util.promisify(child_process.execFile);
3389
- async function isPortOpen(port, host = "127.0.0.1") {
3390
- return new Promise((resolve) => {
3391
- const socket = net.createConnection({ port, host });
3392
- socket.setTimeout(500);
3393
- socket.once("connect", () => {
3394
- socket.destroy();
3395
- resolve(true);
3396
- });
3397
- socket.once("error", () => resolve(false));
3398
- socket.once("timeout", () => {
3399
- socket.destroy();
3400
- resolve(false);
3401
- });
3402
- });
3403
- }
3404
- async function waitForPort(port, timeoutMs = 6e4) {
3405
- const deadline = Date.now() + timeoutMs;
3406
- while (Date.now() < deadline) {
3407
- if (await isPortOpen(port)) return;
3408
- await new Promise((r) => setTimeout(r, 250));
3409
- }
3410
- throw new Error(`dev server did not open port ${port} within ${timeoutMs}ms`);
3411
- }
3412
- async function findPidByPort(port) {
3413
- const platform = process.platform;
3414
- try {
3415
- if (platform === "darwin" || platform === "linux") {
3416
- const { stdout } = await execFileP("lsof", [
3417
- "-ti",
3418
- `tcp:${port}`,
3419
- "-sTCP:LISTEN"
3420
- ]);
3421
- const pid = Number(stdout.trim().split("\n")[0]);
3422
- return Number.isFinite(pid) && pid > 0 ? pid : null;
3423
- }
3424
- if (platform === "win32") {
3425
- const { stdout } = await execFileP("netstat", ["-ano"]);
3426
- const line = stdout.split(/\r?\n/).find((l) => l.includes(`:${port} `) && l.includes("LISTENING"));
3427
- if (!line) return null;
3428
- const parts = line.trim().split(/\s+/);
3429
- const pid = Number(parts[parts.length - 1]);
3430
- return Number.isFinite(pid) && pid > 0 ? pid : null;
3431
- }
3432
- } catch {
3433
- return null;
3434
- }
3435
- return null;
3436
- }
3437
- async function startServer(opts) {
3438
- const cwd = opts.cwd ?? process.cwd();
3439
- const logPath = opts.logPath ?? paths(cwd).serverLog;
3440
- const pidPath = opts.pidPath ?? paths(cwd).serverPid;
3441
- await promises.mkdir(path26__default.default.dirname(logPath), { recursive: true });
3442
- if (await isPortOpen(opts.port)) {
3443
- const discoveredPid = await findPidByPort(opts.port);
3444
- if (discoveredPid) {
3445
- await promises.writeFile(pidPath, String(discoveredPid), "utf8").catch(() => {
3446
- });
3447
- }
3448
- return {
3449
- pid: discoveredPid ?? 0,
3450
- port: opts.port,
3451
- url: `http://127.0.0.1:${opts.port}`,
3452
- attached: true
3453
- };
3454
- }
3455
- const child = child_process.spawn(opts.command, {
3456
- cwd,
3457
- stdio: ["ignore", "pipe", "pipe"],
3458
- detached: true,
3459
- shell: true,
3460
- env: { ...process.env, FORCE_COLOR: "0", CI: "1" }
3461
- });
3462
- const logStream = await import('fs').then(
3463
- (m) => m.createWriteStream(logPath, { flags: "a" })
3464
- );
3465
- child.stdout?.pipe(logStream);
3466
- child.stderr?.pipe(logStream);
3467
- if (!child.pid) throw new Error("failed to spawn dev server");
3468
- await promises.writeFile(pidPath, String(child.pid), "utf8");
3469
- installSignalHandlers(child);
3470
- try {
3471
- await waitForPort(opts.port, opts.readyTimeoutMs ?? 6e4);
3472
- } catch (err) {
3473
- await stopProcess(child.pid);
3474
- throw err;
3475
- }
3476
- return {
3477
- pid: child.pid,
3478
- port: opts.port,
3479
- url: `http://127.0.0.1:${opts.port}`
3480
- };
3481
- }
3482
- async function stopServer(cwd = process.cwd(), portFallback) {
3483
- const pidPath = paths(cwd).serverPid;
3484
- let pid = null;
3485
- let via = "none";
3486
- if (fs.existsSync(pidPath)) {
3487
- const raw = (await promises.readFile(pidPath, "utf8")).trim();
3488
- const parsed = Number(raw);
3489
- if (Number.isFinite(parsed) && parsed > 0 && processExists(parsed)) {
3490
- pid = parsed;
3491
- via = "pidfile";
3492
- }
3493
- }
3494
- if (!pid && portFallback) {
3495
- pid = await findPidByPort(portFallback);
3496
- if (pid) via = "port";
3497
- }
3498
- if (!pid) {
3499
- await promises.writeFile(pidPath, "", "utf8").catch(() => {
3500
- });
3501
- return { killed: false, pid: null, via: "none" };
3502
- }
3503
- await stopProcess(pid);
3504
- await promises.writeFile(pidPath, "", "utf8").catch(() => {
3505
- });
3506
- return { killed: true, pid, via };
3507
- }
3508
- function processExists(pid) {
3509
- try {
3510
- process.kill(pid, 0);
3511
- return true;
3512
- } catch {
3513
- return false;
3514
- }
3515
- }
3516
- async function stopProcess(pid) {
3517
- if (!pid) return;
3518
- await new Promise((resolve) => {
3519
- treeKill__default.default(pid, "SIGTERM", (err) => {
3520
- if (err) {
3521
- treeKill__default.default(pid, "SIGKILL", () => resolve());
3522
- return;
3523
- }
3524
- resolve();
3525
- });
3526
- });
3527
- }
3528
- var signalsInstalled = false;
3529
- function installSignalHandlers(child) {
3530
- if (signalsInstalled) return;
3531
- signalsInstalled = true;
3532
- const cleanup = () => {
3533
- if (child.pid) {
3534
- try {
3535
- process.kill(-child.pid, "SIGTERM");
3536
- } catch {
3537
- }
3538
- treeKill__default.default(child.pid, "SIGKILL", () => {
3539
- });
3540
- }
3541
- };
3542
- process.on("SIGINT", () => {
3543
- cleanup();
3544
- process.exit(130);
3545
- });
3546
- process.on("SIGTERM", () => {
3547
- cleanup();
3548
- process.exit(143);
3549
- });
3550
- process.on("exit", cleanup);
3551
- }
3552
3799
 
3553
3800
  // src/cli/check-output.ts
3554
3801
  function slimResult(r) {
@@ -3574,14 +3821,35 @@ function slimReport(report, reportPath) {
3574
3821
  results: report.results.filter((r) => r.status !== "pass").map(slimResult)
3575
3822
  };
3576
3823
  }
3824
+ var JUDGE_ALIASES = {
3825
+ host: "agent",
3826
+ moondream: "local"
3827
+ };
3577
3828
  function parseJudge(input) {
3578
- const aliased = input === "moondream" ? "local" : input;
3579
- if (aliased === "host" || aliased === "none" || aliased === "local")
3829
+ const aliased = JUDGE_ALIASES[input] ?? input;
3830
+ if (aliased === "agent" || aliased === "none" || aliased === "local")
3580
3831
  return aliased;
3581
3832
  throw new Error(
3582
- `unknown --judge backend: ${input} (expected: host | none | local)`
3833
+ `unknown --judge backend: ${input} (expected: agent | none | local)`
3583
3834
  );
3584
3835
  }
3836
+ var LOCAL_MODELS = [
3837
+ "moondream-2-2b-onnx",
3838
+ "moondream-3-9b-mlx"
3839
+ ];
3840
+ function parseLocalModel(judge, input) {
3841
+ if (input === void 0) return DEFAULT_LOCAL_MODEL;
3842
+ if (judge !== "local") {
3843
+ throw new Error(`--model applies to --judge local, not --judge ${judge}`);
3844
+ }
3845
+ const model = LOCAL_MODELS.find((candidate) => candidate === input);
3846
+ if (!model) {
3847
+ throw new Error(
3848
+ `unknown --model: ${input} (expected: ${LOCAL_MODELS.join(" | ")})`
3849
+ );
3850
+ }
3851
+ return model;
3852
+ }
3585
3853
 
3586
3854
  // src/cli/render/check.ts
3587
3855
  function summaryLine(report) {
@@ -3897,7 +4165,10 @@ function registerCheck(program, out) {
3897
4165
  "max entries captured in parallel (default: auto based on CPU cores, capped at 8)"
3898
4166
  ).option("--no-diff-png", "skip writing diff PNGs").option("--junit <path>", "write JUnit XML to this path (default: skipped)").option(
3899
4167
  "--judge <backend>",
3900
- "judge backend for ambiguous diffs (host | none | local). default: config.judge, else none"
4168
+ "judge backend for ambiguous diffs (agent | none | local). default: config.judge, else none"
4169
+ ).option(
4170
+ "--model <name>",
4171
+ "vision model for --judge local (moondream-2-2b-onnx | moondream-3-9b-mlx). default: moondream-2-2b-onnx"
3901
4172
  ).option(
3902
4173
  "--apply-judgments",
3903
4174
  "resume the suspended graph using .blazediff/judgments/<id>/verdict.json files"
@@ -3923,6 +4194,8 @@ function registerCheck(program, out) {
3923
4194
  return;
3924
4195
  }
3925
4196
  const config = await loadConfig();
4197
+ const judge = parseJudge(opts.judge ?? config?.judge ?? "none");
4198
+ const model = parseLocalModel(judge, opts.model);
3926
4199
  const baseUrl = resolveBaseUrl(config, opts.baseUrl);
3927
4200
  const server = opts.baseUrl ? null : await ensureDevServer(config, out);
3928
4201
  try {
@@ -3932,7 +4205,8 @@ function registerCheck(program, out) {
3932
4205
  concurrency: opts.concurrency ? parsePositiveInteger(opts.concurrency, "--concurrency") : void 0,
3933
4206
  emitDiffPng: opts.diffPng,
3934
4207
  junitPath: opts.junit,
3935
- judge: parseJudge(opts.judge ?? config?.judge ?? "none"),
4208
+ judge,
4209
+ model,
3936
4210
  onEvent: makeProgressReporter(out)
3937
4211
  });
3938
4212
  out.emit(
@@ -4279,9 +4553,9 @@ function extractActionBody(source) {
4279
4553
  "async function login(page) {"
4280
4554
  ];
4281
4555
  for (const marker of markers) {
4282
- const start = source.indexOf(marker);
4283
- if (start === -1) continue;
4284
- const open = start + marker.length;
4556
+ const start2 = source.indexOf(marker);
4557
+ if (start2 === -1) continue;
4558
+ const open = start2 + marker.length;
4285
4559
  let depth = 1;
4286
4560
  let i = open;
4287
4561
  while (i < source.length && depth > 0) {
@@ -4856,7 +5130,7 @@ var STACKS = {
4856
5130
  id: "claude",
4857
5131
  label: "Claude Code",
4858
5132
  kind: "skill-install",
4859
- judge: "host",
5133
+ judge: "agent",
4860
5134
  detect: (cwd) => someExists([
4861
5135
  path26.join(cwd, ".claude"),
4862
5136
  path26.join(cwd, "CLAUDE.md"),
@@ -4870,7 +5144,7 @@ var STACKS = {
4870
5144
  id: "codex",
4871
5145
  label: "Codex",
4872
5146
  kind: "skill-install",
4873
- judge: "host",
5147
+ judge: "agent",
4874
5148
  detect: (cwd) => someExists([
4875
5149
  path26.join(cwd, "AGENTS.md"),
4876
5150
  path26.join(cwd, ".codex"),
@@ -4884,7 +5158,7 @@ var STACKS = {
4884
5158
  id: "cursor",
4885
5159
  label: "Cursor",
4886
5160
  kind: "skill-install",
4887
- judge: "host",
5161
+ judge: "agent",
4888
5162
  detect: (cwd) => someExists([path26.join(cwd, ".cursor"), path26.join(cwd, ".cursorrules")]),
4889
5163
  target: (cwd, skill) => path26.join(cwd, ".cursor", "rules", `${skill}.mdc`),
4890
5164
  format: "cursor-rule",
@@ -5176,13 +5450,13 @@ function registerOnboard(program, out) {
5176
5450
  for (const t of targets) {
5177
5451
  installed.push(...await installStack(t, cwd, { force: opts.force }));
5178
5452
  }
5179
- let judge = config?.judge ?? "host";
5453
+ let judge = config?.judge ?? "agent";
5180
5454
  if (targets.length === 0) {
5181
5455
  lines.push(
5182
5456
  "playbook: no coding-agent stack detected (pass --stack <claude|codex|cursor|all|local> to install)"
5183
5457
  );
5184
5458
  } else {
5185
- judge = targets.includes("local") ? "local" : "host";
5459
+ judge = targets.includes("local") ? "local" : "agent";
5186
5460
  await persistJudge(judge, cwd);
5187
5461
  lines.push("playbook:");
5188
5462
  lines.push(...humanizeInstall(installed));
@@ -5384,7 +5658,7 @@ async function rejectEntry(id, cwd = process.cwd()) {
5384
5658
  }
5385
5659
 
5386
5660
  // src/review/server.ts
5387
- var execFileP2 = util.promisify(child_process.execFile);
5661
+ var execFileP3 = util.promisify(child_process.execFile);
5388
5662
  var CLIENT_DIR = path26__default.default.join(__dirname, "review", "client");
5389
5663
  var CONTENT_TYPES = {
5390
5664
  ".html": "text/html; charset=utf-8",
@@ -5421,7 +5695,7 @@ function streamFile(res, file) {
5421
5695
  }
5422
5696
  async function gitText(cwd, args) {
5423
5697
  try {
5424
- const { stdout } = await execFileP2("git", args, { cwd });
5698
+ const { stdout } = await execFileP3("git", args, { cwd });
5425
5699
  return stdout.trim();
5426
5700
  } catch {
5427
5701
  return "";