@plune-ai/cli 0.39.15 → 0.39.16

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/README.md CHANGED
@@ -158,11 +158,11 @@ Global flags: `-c, --config <path>` · `-v, --verbose` · `--no-color`.
158
158
  | Code | When |
159
159
  | --- | --- |
160
160
  | `0` | Every row passed. Also a `--dry-run`, a run where `--only` matched no eval, and a run whose rows that did not pass are all `blocked` or `skipped` (never judged). |
161
- | `1` | At least one row **failed** an assertion, whether or not other rows errored. Also an error the CLI did not expect (it says «This one is on us»), and an option `run` does not have or an option given without its value. |
162
- | `2` | The run **could not start or could not finish**: a configuration or usage error (no `plune.yaml`, YAML that does not parse, a config that does not validate, a missing provider key, an unknown prompt variable, `--runs` out of range, a bad `--tool-description`, flags that do not go together, a file or folder that cannot be read or written), **or** a run where rows **errored** (a provider outage) and none failed. |
161
+ | `1` | At least one row **failed** an assertion, whether or not other rows errored. Also an error the CLI did not expect (it says «This one is on us»). |
162
+ | `2` | The run **could not start or could not finish**: a configuration or usage error (no `plune.yaml`, YAML that does not parse, a config that does not validate, a missing provider key, an unknown prompt variable, `--runs` out of range, a bad `--tool-description`, flags that do not go together, an option `run` does not have, an option given without its value, a word after `run` that is no subcommand, a `--format` that is not one of the four, a file or folder that cannot be read or written), **or** a run where rows **errored** (a provider outage) and none failed. |
163
163
  | `5` | `--cache-strict` found rows with no cache entry. It wins over `1` and `2`: the run is incomplete. |
164
164
 
165
- `--bail` and `--format` do not change the code. `plune run` returns no other code. Of the other commands, `plune pull` exits `3` when it refuses to overwrite uncommitted changes and `plune push` exits `4` when it had refusals; the rest say their codes in the table above and in the [CLI guide](docs/guide/cli.md).
165
+ `--bail` does not change the code, and neither does the `--format` chosen among the four; a `--format` that is not one of them is the usage error above, `2`. `plune run` returns no other code. Of the other commands, `plune pull` exits `3` when it refuses to overwrite uncommitted changes and `plune push` exits `4` when it had refusals; the rest say their codes in the table above and in the [CLI guide](docs/guide/cli.md).
166
166
 
167
167
  ### Completion cache
168
168
 
package/dist/cli.cjs CHANGED
@@ -466,7 +466,8 @@ var init_schema = __esm({
466
466
  });
467
467
  jevJudgeSchema = import_zod.z.strictObject({
468
468
  type: import_zod.z.literal("jev"),
469
- model: import_zod.z.string().min(1),
469
+ // A full version, never an alias: `jev-latest` would change the judge under a run without a word.
470
+ model: import_zod.z.string().regex(/^jev-\d+\.\d+\.\d+$/, "must be a full Jev version such as jev-1.14.0; an alias such as jev-latest is not taken"),
470
471
  timeout: providerTimeoutSchema.optional()
471
472
  });
472
473
  partialProviderSchema = providerConfigSchema.partial();
@@ -1112,6 +1113,9 @@ var init_prices = __esm({
1112
1113
  "use strict";
1113
1114
  init_cjs_shims();
1114
1115
  PRICE_TABLE = {
1116
+ // TypeSafe Jev, the experimental judge of `llm-judge`: input tokens only, its output is not billed.
1117
+ // Source: docs.typesafe.ai, read on 2026-11-24 (USD 0.042 per million input tokens).
1118
+ "jev-1.14.0": { input_per_1k_usd: 42e-6, output_per_1k_usd: 0 },
1115
1119
  // Anthropic, current models. Source: platform.claude.com/docs/en/about-claude/pricing — base
1116
1120
  // input and output tokens per million, read on 2026-09-29, kept here per thousand.
1117
1121
  "claude-fable-5-1": { input_per_1k_usd: 0.01, output_per_1k_usd: 0.05 },
@@ -2293,7 +2297,7 @@ var init_llm_judge = __esm({
2293
2297
  const criteria = interpolate(ctx.params.criteria, ctx);
2294
2298
  const threshold = ctx.params.pass_threshold ?? DEFAULT_PASS_THRESHOLD;
2295
2299
  if (ctx.judge.decide !== void 0) {
2296
- const p = await ctx.judge.decide({
2300
+ const { probability: p } = await ctx.judge.decide({
2297
2301
  criteria,
2298
2302
  output: ctx.output,
2299
2303
  ...ctx.input !== void 0 ? { input: ctx.input } : {}
@@ -3797,14 +3801,16 @@ async function assess(p, output, input, transcript) {
3797
3801
  const judge2 = () => {
3798
3802
  if (jev !== void 0) {
3799
3803
  if (p.jevJudge === void 0) throw new Error("this run cannot build the jev judge of an llm-judge check");
3800
- const inner2 = p.jevJudge(jev, (usd) => {
3801
- judgeCost += usd;
3804
+ const inner2 = p.jevJudge(jev, (c) => {
3805
+ judgeCost += c.cost_usd;
3806
+ if (c.priced === false) judgeUnpriced = true;
3802
3807
  });
3803
3808
  return {
3804
3809
  ask: (q) => inner2.ask(q),
3805
- decide: (q) => {
3806
- judgedBy = `jev/${jev.model}`;
3807
- return inner2.decide(q);
3810
+ decide: async (q) => {
3811
+ const answer = await inner2.decide(q);
3812
+ judgedBy = `jev/${answer.model}`;
3813
+ return answer;
3808
3814
  }
3809
3815
  };
3810
3816
  }
@@ -3871,7 +3877,15 @@ async function runRow(p) {
3871
3877
  if (p.dryRun) {
3872
3878
  const est = estimateUsage(prompt5, maxTokens);
3873
3879
  const cost2 = p.provider.estimateCost(est);
3874
- return dryRunRow(p.row.vars, { ...est, ...costFields(cost2) });
3880
+ let judged2 = 0;
3881
+ let unpriced = cost2.priced === false;
3882
+ for (const a of p.assertions) {
3883
+ if (a.type !== "llm-judge" || a.provider?.type !== "jev" || p.jevCost === void 0) continue;
3884
+ const c = p.jevCost(a.provider.model, Math.ceil((prompt5.length + maxTokens * 4 + a.criteria.length) / 3));
3885
+ judged2 += c.cost_usd;
3886
+ if (c.priced === false) unpriced = true;
3887
+ }
3888
+ return dryRunRow(p.row.vars, { ...est, cost_usd: cost2.cost_usd + judged2, ...unpriced ? { priced: false } : cost2.priced === void 0 ? {} : { priced: cost2.priced } });
3875
3889
  }
3876
3890
  const key = cacheKey(
3877
3891
  {
@@ -4169,6 +4183,7 @@ async function runOrchestration(config, options, deps) {
4169
4183
  provider,
4170
4184
  resolveJudge,
4171
4185
  ...deps.jevJudge !== void 0 ? { jevJudge: deps.jevJudge } : {},
4186
+ ...deps.jevCost !== void 0 ? { jevCost: deps.jevCost } : {},
4172
4187
  embedder: deps.embedder,
4173
4188
  cache: deps.cache,
4174
4189
  now: deps.now,
@@ -4373,6 +4388,26 @@ ${q.output}
4373
4388
  Criterion:
4374
4389
  ${q.criteria}`;
4375
4390
  }
4391
+ function jevBaseUrl(env) {
4392
+ const own3 = env[JEV_BASE_URL_ENV];
4393
+ const [name, value2] = own3 !== void 0 && own3 !== "" ? [JEV_BASE_URL_ENV, own3] : ["TYPESAFE_BASE_URL", env["TYPESAFE_BASE_URL"]];
4394
+ if (value2 === void 0 || value2 === "") return JEV_BASE_URL;
4395
+ let url;
4396
+ try {
4397
+ url = new URL(value2);
4398
+ } catch {
4399
+ url = void 0;
4400
+ }
4401
+ const ok2 = url !== void 0 && url.protocol === "https:" && (url.hostname === "typesafe.ai" || url.hostname.endsWith(".typesafe.ai"));
4402
+ if (!ok2)
4403
+ throw new Error(
4404
+ `${name} is ${value2}: the jev judge asks only an https address under typesafe.ai, so that another model is not judged and reported as Jev. ` + (name === JEV_BASE_URL_ENV ? `Unset it or set it to ${JEV_BASE_URL}` : `Set ${JEV_BASE_URL_ENV}=${JEV_BASE_URL} for plune and keep TYPESAFE_BASE_URL for your other tools`)
4405
+ );
4406
+ return value2.replace(/\/+$/, "");
4407
+ }
4408
+ function jevCost(model, inputTokens, pricing) {
4409
+ return resolveCostEntry({ input_tokens: inputTokens, output_tokens: 0 }, model, void 0, pricing);
4410
+ }
4376
4411
  function probability(json2) {
4377
4412
  const answer = json2?.answers?.q;
4378
4413
  const p = answer?.type === "noul" ? answer.noul : void 0;
@@ -4384,6 +4419,7 @@ function makeJevJudge(cfg, deps) {
4384
4419
  return {
4385
4420
  ask: () => Promise.reject(new Error("a jev judge answers a yes-or-no question only: it cannot judge this kind of check")),
4386
4421
  async decide(q) {
4422
+ const base = jevBaseUrl(deps.env);
4387
4423
  const key = deps.env[JEV_KEY_ENV];
4388
4424
  if (key === void 0 || key === "")
4389
4425
  throw new AuthError(`${JEV_KEY_ENV} is not set: the jev judge of an llm-judge check needs it`, JEV_KEY_ENV);
@@ -4400,7 +4436,7 @@ function makeJevJudge(cfg, deps) {
4400
4436
  });
4401
4437
  const send3 = async () => {
4402
4438
  try {
4403
- return await deps.fetchFn(`${JEV_BASE_URL}/v1/systemone`, {
4439
+ return await deps.fetchFn(`${base}/v1/systemone`, {
4404
4440
  method: "POST",
4405
4441
  headers: { "content-type": "application/json", authorization: `Bearer ${key}` },
4406
4442
  body,
@@ -4419,9 +4455,11 @@ function makeJevJudge(cfg, deps) {
4419
4455
  const json2 = await res.json();
4420
4456
  const p = probability(json2);
4421
4457
  const tokens2 = json2.usage?.input_tokens;
4422
- const billed = typeof tokens2 === "number" && tokens2 >= 0 ? tokens2 : Math.ceil(state2.length / 3);
4423
- deps.onCost(billed / 1e6 * JEV_USD_PER_1M_INPUT_TOKENS);
4424
- return p;
4458
+ const billed = typeof tokens2 === "number" && tokens2 >= 0 ? tokens2 : jevTokenEstimate(state2.length);
4459
+ const answered = json2.model;
4460
+ const model = typeof answered === "string" && answered !== "" ? answered : cfg.model;
4461
+ deps.onCost(jevCost(model, billed, deps.pricing));
4462
+ return { probability: p, model };
4425
4463
  }
4426
4464
  };
4427
4465
  }
@@ -4433,20 +4471,22 @@ function warnJevExperimental(write = (l) => process.stderr.write(l)) {
4433
4471
  `
4434
4472
  );
4435
4473
  }
4436
- var JEV_BASE_URL, JEV_KEY_ENV, JEV_MAX_STATE_CHARS, JEV_USD_PER_1M_INPUT_TOKENS, DEFAULT_TIMEOUT_MS, INSTRUCTIONS, YES, NO, warned;
4474
+ var JEV_BASE_URL, JEV_KEY_ENV, JEV_MAX_STATE_CHARS, JEV_BASE_URL_ENV, DEFAULT_TIMEOUT_MS, INSTRUCTIONS, YES, NO, jevTokenEstimate, warned;
4437
4475
  var init_jev = __esm({
4438
4476
  "src/judge/jev.ts"() {
4439
4477
  "use strict";
4440
4478
  init_cjs_shims();
4441
4479
  init_errors2();
4480
+ init_cost();
4442
4481
  JEV_BASE_URL = "https://api.typesafe.ai";
4443
4482
  JEV_KEY_ENV = "TYPESAFE_API_KEY";
4444
4483
  JEV_MAX_STATE_CHARS = 16e3;
4445
- JEV_USD_PER_1M_INPUT_TOKENS = 0.042;
4484
+ JEV_BASE_URL_ENV = "PLUNE_JEV_BASE_URL";
4446
4485
  DEFAULT_TIMEOUT_MS = 3e4;
4447
4486
  INSTRUCTIONS = "Does the answer meet the criterion?";
4448
4487
  YES = "the answer meets the criterion";
4449
4488
  NO = "the answer does not meet the criterion";
4489
+ jevTokenEstimate = (chars) => Math.ceil(chars / 3);
4450
4490
  warned = false;
4451
4491
  }
4452
4492
  });
@@ -5552,6 +5592,7 @@ __export(run_exports, {
5552
5592
  MAX_DESCRIPTION_BYTES: () => MAX_DESCRIPTION_BYTES,
5553
5593
  handleRun: () => handleRun,
5554
5594
  isMockMode: () => isMockMode,
5595
+ jevAddressCheck: () => jevAddressCheck,
5555
5596
  makeMcpConnect: () => makeMcpConnect,
5556
5597
  parseToolDescriptions: () => parseToolDescriptions
5557
5598
  });
@@ -5648,8 +5689,14 @@ function buildRealDeps(config, baseDir, dryRun2) {
5648
5689
  ...isMockMode(process.env) ? {} : {
5649
5690
  jevJudge: (cfg, onCost) => {
5650
5691
  warnJevExperimental();
5651
- return makeJevJudge(cfg, { env: process.env, fetchFn: fetch, onCost });
5652
- }
5692
+ return makeJevJudge(cfg, {
5693
+ env: process.env,
5694
+ fetchFn: fetch,
5695
+ onCost,
5696
+ ...config.pricing !== void 0 ? { pricing: config.pricing } : {}
5697
+ });
5698
+ },
5699
+ jevCost: (model, inputTokens) => jevCost(model, inputTokens, config.pricing)
5653
5700
  }
5654
5701
  };
5655
5702
  }
@@ -5658,11 +5705,21 @@ function persist(result2, baseDir) {
5658
5705
  fs5.mkdirSync(dir, { recursive: true });
5659
5706
  fs5.writeFileSync(path6.join(dir, "last-run.json"), JSON.stringify(result2, null, 2));
5660
5707
  }
5708
+ function jevAddressCheck(config, env) {
5709
+ const checks = [...config.defaults?.assertions ?? [], ...config.evals.flatMap((ev) => ev.assertions)];
5710
+ if (!checks.some((a) => a.type === "llm-judge" && a.provider?.type === "jev")) return;
5711
+ try {
5712
+ jevBaseUrl(env);
5713
+ } catch (err) {
5714
+ throw new RunConfigError(err.message);
5715
+ }
5716
+ }
5661
5717
  async function handleRun(options, depsFactory) {
5662
5718
  const config = await loadConfig(
5663
5719
  options.configPath !== void 0 ? { configPath: options.configPath } : {}
5664
5720
  );
5665
5721
  const baseDir = options.configPath !== void 0 ? path6.dirname(path6.resolve(options.configPath)) : process.cwd();
5722
+ jevAddressCheck(config, process.env);
5666
5723
  for (const warning of [...mcpSecretWarnings(config), ...selfJudgeWarnings(config)])
5667
5724
  process.stderr.write(`warning: ${warning}
5668
5725
  `);
@@ -36965,12 +37022,14 @@ var rawArgsOf = (program) => program.rawArgs ?? [];
36965
37022
  // src/cli.ts
36966
37023
  var __dirname = (0, import_node_path15.dirname)((0, import_node_url.fileURLToPath)(importMetaUrl));
36967
37024
  var pkg = JSON.parse((0, import_node_fs23.readFileSync)((0, import_node_path15.join)(__dirname, "..", "package.json"), "utf-8"));
36968
- function toFormat(s) {
36969
- return s === "json" || s === "markdown" ? s : "console";
36970
- }
36971
- var RUN_FORMATS = "console | json | markdown | junit";
36972
- function toRunFormat(s) {
36973
- return s === "junit" ? s : toFormat(s);
37025
+ var DIFF_FORMATS = ["console", "json", "markdown"];
37026
+ var RUN_FORMATS = [...DIFF_FORMATS, "junit"];
37027
+ function formatOrExit(value2, accepted2) {
37028
+ if (accepted2.includes(value2)) return value2;
37029
+ process.stderr.write(`Unknown --format "${value2}". Use ${accepted2.join(" | ")}.
37030
+ `);
37031
+ process.exit(2);
37032
+ return void 0;
36974
37033
  }
36975
37034
  function shouldColor(outputPath) {
36976
37035
  return outputPath === void 0 && process.stdout.isTTY === true && process.env.NO_COLOR === void 0;
@@ -37028,7 +37087,7 @@ async function readTokenFromStdin() {
37028
37087
  }
37029
37088
  function createProgram() {
37030
37089
  const program = new import_commander.Command();
37031
- program.name("plune").description("Plune \u2014 AI-powered assertion testing CLI").version(pkg.version);
37090
+ program.name("plune").description("Plune \u2014 AI-powered assertion testing CLI").version(pkg.version).exitOverride((err) => process.exit(err.exitCode === 0 ? 0 : 2));
37032
37091
  program.option("-c, --config <path>", "Path to plune.yaml config file (applies to all commands)").option("-v, --verbose", "Verbose output, including stack traces on unexpected errors", false).option("--no-color", "Disable colored output regardless of TTY");
37033
37092
  program.hook("preAction", async (_program, action) => {
37034
37093
  const { loadEnv: loadEnv2 } = await Promise.resolve().then(() => (init_env(), env_exports));
@@ -37056,10 +37115,21 @@ function createProgram() {
37056
37115
  "Show the model this text as a tool's description in place of the server's, for this run only (repeatable); the server is not changed",
37057
37116
  (val, prev) => [...prev, val],
37058
37117
  []
37059
- ).option("--format <fmt>", RUN_FORMATS, "console").option("-o, --output <path>", "Write the report to a file instead of stdout").action(
37118
+ ).option("--format <fmt>", RUN_FORMATS.join(" | "), "console").option("-o, --output <path>", "Write the report to a file instead of stdout").action(
37060
37119
  async (options, command) => {
37061
37120
  const globals = command.optsWithGlobals();
37062
37121
  const configPath = globals.config;
37122
+ if (command.args.length > 0) {
37123
+ process.stderr.write(
37124
+ `\`plune run\` takes no arguments, but got: ${command.args.join(" ")}
37125
+ Nothing was run. Its subcommands are: ${command.commands.map((c) => c.name()).join(", ")}.
37126
+ `
37127
+ );
37128
+ process.exit(2);
37129
+ return;
37130
+ }
37131
+ const format = formatOrExit(options.format, RUN_FORMATS);
37132
+ if (format === void 0) return;
37063
37133
  const [
37064
37134
  { handleRun: handleRun2 },
37065
37135
  { exitCodeFor: exitCodeFor2, cacheMissRows: cacheMissRows2, CACHE_STRICT_EXIT: CACHE_STRICT_EXIT2, RunConfigError: RunConfigError2 },
@@ -37110,7 +37180,7 @@ function createProgram() {
37110
37180
  if (options.only.length > 0 && result2.evals.length === 0) {
37111
37181
  process.stderr.write("No evals matched the selector.\n");
37112
37182
  }
37113
- const text6 = renderReport2(result2, toRunFormat(options.format), {
37183
+ const text6 = renderReport2(result2, format, {
37114
37184
  color: globals.color !== false && shouldColor(options.output)
37115
37185
  });
37116
37186
  writeReport2(text6, options.output);
@@ -37340,8 +37410,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
37340
37410
  }
37341
37411
  }
37342
37412
  );
37343
- program.command("report").description("Render the most recent run in a chosen format").option("--format <fmt>", RUN_FORMATS, "console").option("-o, --output <path>", "Write the report to a file instead of stdout").action(async (options, command) => {
37413
+ program.command("report").description("Render the most recent run in a chosen format").option("--format <fmt>", RUN_FORMATS.join(" | "), "console").option("-o, --output <path>", "Write the report to a file instead of stdout").action(async (options, command) => {
37344
37414
  const globals = command.optsWithGlobals();
37415
+ const format = formatOrExit(options.format, RUN_FORMATS);
37416
+ if (format === void 0) return;
37345
37417
  const [{ handleReport: handleReport2, ReportNotFoundError: ReportNotFoundError2 }, { renderReport: renderReport2 }] = await Promise.all([
37346
37418
  Promise.resolve().then(() => (init_report2(), report_exports)),
37347
37419
  Promise.resolve().then(() => (init_reporters(), reporters_exports))
@@ -37349,7 +37421,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
37349
37421
  const cwd = globals.config !== void 0 ? (0, import_node_path15.dirname)((0, import_node_path15.resolve)(globals.config)) : process.cwd();
37350
37422
  try {
37351
37423
  const result2 = handleReport2({ cwd });
37352
- const text6 = renderReport2(result2, toRunFormat(options.format), {
37424
+ const text6 = renderReport2(result2, format, {
37353
37425
  color: globals.color !== false && shouldColor(options.output)
37354
37426
  });
37355
37427
  writeReport2(text6, options.output);
@@ -37362,13 +37434,15 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
37362
37434
  failUnexpected(err, globals.verbose === true);
37363
37435
  }
37364
37436
  });
37365
- program.command("diff").description("Compare two `plune run --format json` outputs and report regressions").argument("<baseline>", "Path to the baseline run JSON (e.g. from main)").argument("<current>", "Path to the current run JSON (e.g. from the PR)").option("--format <fmt>", "console | json | markdown", "console").option(
37437
+ program.command("diff").description("Compare two `plune run --format json` outputs and report regressions").argument("<baseline>", "Path to the baseline run JSON (e.g. from main)").argument("<current>", "Path to the current run JSON (e.g. from the PR)").option("--format <fmt>", DIFF_FORMATS.join(" | "), "console").option(
37366
37438
  "--fail-on-regression",
37367
37439
  "Exit 1 when a pass\u2192fail regression is detected, 3 when none is but an eval was not measured",
37368
37440
  false
37369
37441
  ).option("--max-pass-rate-drop-percent <n>", "Gate: the overall pass rate may drop at most n percentage points").option("--max-cost-usd <n>", "Gate: the current run may cost at most n USD").option("--max-cost-increase-percent <n>", "Gate: the cost may grow at most n percent over the baseline").option("--max-tokens <n>", "Gate: the current run may use at most n tokens (input + output)").option("--waivers <file>", "YAML file of waivers for measured gate failures").option("-o, --output <path>", "Write the diff to a file instead of stdout").action(
37370
37442
  async (baseline, current, options, command) => {
37371
37443
  const verbose = command.optsWithGlobals().verbose === true;
37444
+ const format = formatOrExit(options.format, DIFF_FORMATS);
37445
+ if (format === void 0) return;
37372
37446
  const [{ diffFiles: diffFiles2, DiffInputError: DiffInputError2 }, { renderDiff: renderDiff2 }] = await Promise.all([
37373
37447
  Promise.resolve().then(() => (init_diff4(), diff_exports2)),
37374
37448
  Promise.resolve().then(() => (init_diff2(), diff_exports))
@@ -37376,7 +37450,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
37376
37450
  try {
37377
37451
  const { format: _format, output: _output, ...gateFlags } = options;
37378
37452
  const { diff: diff2, current: run } = diffFiles2({ baselinePath: baseline, currentPath: current, ...gateFlags });
37379
- writeReport2(renderDiff2(diff2, toFormat(options.format), run), options.output);
37453
+ writeReport2(renderDiff2(diff2, format, run), options.output);
37380
37454
  process.exitCode = diff2.gates?.exitCode ?? 0;
37381
37455
  } catch (err) {
37382
37456
  if (err instanceof DiffInputError2) {
@@ -37391,7 +37465,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
37391
37465
  );
37392
37466
  program.command("judge-check").description(
37393
37467
  "Compare a judge's verdicts in a saved run with a person's pass/fail labels: TPR, TNR, Cohen's kappa and its 95% interval. Local only"
37394
- ).argument("<labels.jsonl>", 'The labels file: one {"eval", "vars_hash", "output_hash", "human", "by", "at"} per line').option("--run <file>", "The saved run to read", ".plune/last-run.json").option("--init", "Write the labels file to fill in from the run, one line per row with an answer", false).option("--force", "With --init: write over an existing labels file", false).option("--eval <id>", "Only this eval").option("--check <n>", "The check to compare, by its position in a row from 1 (default: the one check a model judges)").option("--min-kappa <k>", "Exit 1 when an eval's kappa is below k or has no value").option("--max-interval-width <w>", "Warn when the 95% interval of kappa is wider than w (default 0.4)").exitOverride((err) => process.exit(err.exitCode === 0 ? 0 : 2)).action(async (labels, options, command) => {
37468
+ ).argument("<labels.jsonl>", 'The labels file: one {"eval", "vars_hash", "output_hash", "human", "by", "at"} per line').option("--run <file>", "The saved run to read", ".plune/last-run.json").option("--init", "Write the labels file to fill in from the run, one line per row with an answer", false).option("--force", "With --init: write over an existing labels file", false).option("--eval <id>", "Only this eval").option("--check <n>", "The check to compare, by its position in a row from 1 (default: the one check a model judges)").option("--min-kappa <k>", "Exit 1 when an eval's kappa is below k or has no value").option("--max-interval-width <w>", "Warn when the 95% interval of kappa is wider than w (default 0.4)").action(async (labels, options, command) => {
37395
37469
  const verbose = command.optsWithGlobals().verbose === true;
37396
37470
  const [{ handleJudgeCheck: handleJudgeCheck2 }, { JudgeCheckError: JudgeCheckError2 }] = await Promise.all([
37397
37471
  Promise.resolve().then(() => (init_judge_check(), judge_check_exports)),
package/dist/index.cjs CHANGED
@@ -1174,7 +1174,8 @@ var jsonSchemaAssertionSchema = import_zod.z.object({
1174
1174
  });
1175
1175
  var jevJudgeSchema = import_zod.z.strictObject({
1176
1176
  type: import_zod.z.literal("jev"),
1177
- model: import_zod.z.string().min(1),
1177
+ // A full version, never an alias: `jev-latest` would change the judge under a run without a word.
1178
+ model: import_zod.z.string().regex(/^jev-\d+\.\d+\.\d+$/, "must be a full Jev version such as jev-1.14.0; an alias such as jev-latest is not taken"),
1178
1179
  timeout: providerTimeoutSchema.optional()
1179
1180
  });
1180
1181
  var partialProviderSchema = providerConfigSchema.partial();
@@ -1767,6 +1768,9 @@ init_cjs_shims();
1767
1768
  // src/providers/prices.ts
1768
1769
  init_cjs_shims();
1769
1770
  var PRICE_TABLE = {
1771
+ // TypeSafe Jev, the experimental judge of `llm-judge`: input tokens only, its output is not billed.
1772
+ // Source: docs.typesafe.ai, read on 2026-11-24 (USD 0.042 per million input tokens).
1773
+ "jev-1.14.0": { input_per_1k_usd: 42e-6, output_per_1k_usd: 0 },
1770
1774
  // Anthropic, current models. Source: platform.claude.com/docs/en/about-claude/pricing — base
1771
1775
  // input and output tokens per million, read on 2026-09-29, kept here per thousand.
1772
1776
  "claude-fable-5-1": { input_per_1k_usd: 0.01, output_per_1k_usd: 0.05 },
@@ -2806,7 +2810,7 @@ var llmJudge = {
2806
2810
  const criteria = interpolate(ctx.params.criteria, ctx);
2807
2811
  const threshold = ctx.params.pass_threshold ?? DEFAULT_PASS_THRESHOLD;
2808
2812
  if (ctx.judge.decide !== void 0) {
2809
- const p = await ctx.judge.decide({
2813
+ const { probability: p } = await ctx.judge.decide({
2810
2814
  criteria,
2811
2815
  output: ctx.output,
2812
2816
  ...ctx.input !== void 0 ? { input: ctx.input } : {}
@@ -4167,14 +4171,16 @@ async function assess(p, output, input, transcript) {
4167
4171
  const judge = () => {
4168
4172
  if (jev !== void 0) {
4169
4173
  if (p.jevJudge === void 0) throw new Error("this run cannot build the jev judge of an llm-judge check");
4170
- const inner2 = p.jevJudge(jev, (usd) => {
4171
- judgeCost += usd;
4174
+ const inner2 = p.jevJudge(jev, (c) => {
4175
+ judgeCost += c.cost_usd;
4176
+ if (c.priced === false) judgeUnpriced = true;
4172
4177
  });
4173
4178
  return {
4174
4179
  ask: (q) => inner2.ask(q),
4175
- decide: (q) => {
4176
- judgedBy = `jev/${jev.model}`;
4177
- return inner2.decide(q);
4180
+ decide: async (q) => {
4181
+ const answer = await inner2.decide(q);
4182
+ judgedBy = `jev/${answer.model}`;
4183
+ return answer;
4178
4184
  }
4179
4185
  };
4180
4186
  }
@@ -4241,7 +4247,15 @@ async function runRow(p) {
4241
4247
  if (p.dryRun) {
4242
4248
  const est = estimateUsage(prompt5, maxTokens);
4243
4249
  const cost = p.provider.estimateCost(est);
4244
- return dryRunRow(p.row.vars, { ...est, ...costFields(cost) });
4250
+ let judged = 0;
4251
+ let unpriced = cost.priced === false;
4252
+ for (const a of p.assertions) {
4253
+ if (a.type !== "llm-judge" || a.provider?.type !== "jev" || p.jevCost === void 0) continue;
4254
+ const c = p.jevCost(a.provider.model, Math.ceil((prompt5.length + maxTokens * 4 + a.criteria.length) / 3));
4255
+ judged += c.cost_usd;
4256
+ if (c.priced === false) unpriced = true;
4257
+ }
4258
+ return dryRunRow(p.row.vars, { ...est, cost_usd: cost.cost_usd + judged, ...unpriced ? { priced: false } : cost.priced === void 0 ? {} : { priced: cost.priced } });
4245
4259
  }
4246
4260
  const key = cacheKey(
4247
4261
  {
@@ -4539,6 +4553,7 @@ async function runOrchestration(config, options, deps) {
4539
4553
  provider,
4540
4554
  resolveJudge,
4541
4555
  ...deps.jevJudge !== void 0 ? { jevJudge: deps.jevJudge } : {},
4556
+ ...deps.jevCost !== void 0 ? { jevCost: deps.jevCost } : {},
4542
4557
  embedder: deps.embedder,
4543
4558
  cache: deps.cache,
4544
4559
  now: deps.now,
@@ -4645,7 +4660,7 @@ init_cjs_shims();
4645
4660
  var JEV_BASE_URL = "https://api.typesafe.ai";
4646
4661
  var JEV_KEY_ENV = "TYPESAFE_API_KEY";
4647
4662
  var JEV_MAX_STATE_CHARS = 16e3;
4648
- var JEV_USD_PER_1M_INPUT_TOKENS = 0.042;
4663
+ var JEV_BASE_URL_ENV = "PLUNE_JEV_BASE_URL";
4649
4664
  var DEFAULT_TIMEOUT_MS = 3e4;
4650
4665
  var INSTRUCTIONS = "Does the answer meet the criterion?";
4651
4666
  var YES = "the answer meets the criterion";
@@ -4661,6 +4676,27 @@ ${q.output}
4661
4676
  Criterion:
4662
4677
  ${q.criteria}`;
4663
4678
  }
4679
+ function jevBaseUrl(env) {
4680
+ const own2 = env[JEV_BASE_URL_ENV];
4681
+ const [name, value] = own2 !== void 0 && own2 !== "" ? [JEV_BASE_URL_ENV, own2] : ["TYPESAFE_BASE_URL", env["TYPESAFE_BASE_URL"]];
4682
+ if (value === void 0 || value === "") return JEV_BASE_URL;
4683
+ let url;
4684
+ try {
4685
+ url = new URL(value);
4686
+ } catch {
4687
+ url = void 0;
4688
+ }
4689
+ const ok = url !== void 0 && url.protocol === "https:" && (url.hostname === "typesafe.ai" || url.hostname.endsWith(".typesafe.ai"));
4690
+ if (!ok)
4691
+ throw new Error(
4692
+ `${name} is ${value}: the jev judge asks only an https address under typesafe.ai, so that another model is not judged and reported as Jev. ` + (name === JEV_BASE_URL_ENV ? `Unset it or set it to ${JEV_BASE_URL}` : `Set ${JEV_BASE_URL_ENV}=${JEV_BASE_URL} for plune and keep TYPESAFE_BASE_URL for your other tools`)
4693
+ );
4694
+ return value.replace(/\/+$/, "");
4695
+ }
4696
+ function jevCost(model, inputTokens, pricing) {
4697
+ return resolveCostEntry({ input_tokens: inputTokens, output_tokens: 0 }, model, void 0, pricing);
4698
+ }
4699
+ var jevTokenEstimate = (chars) => Math.ceil(chars / 3);
4664
4700
  function probability(json) {
4665
4701
  const answer = json?.answers?.q;
4666
4702
  const p = answer?.type === "noul" ? answer.noul : void 0;
@@ -4672,6 +4708,7 @@ function makeJevJudge(cfg, deps) {
4672
4708
  return {
4673
4709
  ask: () => Promise.reject(new Error("a jev judge answers a yes-or-no question only: it cannot judge this kind of check")),
4674
4710
  async decide(q) {
4711
+ const base = jevBaseUrl(deps.env);
4675
4712
  const key = deps.env[JEV_KEY_ENV];
4676
4713
  if (key === void 0 || key === "")
4677
4714
  throw new AuthError(`${JEV_KEY_ENV} is not set: the jev judge of an llm-judge check needs it`, JEV_KEY_ENV);
@@ -4688,7 +4725,7 @@ function makeJevJudge(cfg, deps) {
4688
4725
  });
4689
4726
  const send = async () => {
4690
4727
  try {
4691
- return await deps.fetchFn(`${JEV_BASE_URL}/v1/systemone`, {
4728
+ return await deps.fetchFn(`${base}/v1/systemone`, {
4692
4729
  method: "POST",
4693
4730
  headers: { "content-type": "application/json", authorization: `Bearer ${key}` },
4694
4731
  body,
@@ -4707,9 +4744,11 @@ function makeJevJudge(cfg, deps) {
4707
4744
  const json = await res.json();
4708
4745
  const p = probability(json);
4709
4746
  const tokens = json.usage?.input_tokens;
4710
- const billed = typeof tokens === "number" && tokens >= 0 ? tokens : Math.ceil(state.length / 3);
4711
- deps.onCost(billed / 1e6 * JEV_USD_PER_1M_INPUT_TOKENS);
4712
- return p;
4747
+ const billed = typeof tokens === "number" && tokens >= 0 ? tokens : jevTokenEstimate(state.length);
4748
+ const answered = json.model;
4749
+ const model = typeof answered === "string" && answered !== "" ? answered : cfg.model;
4750
+ deps.onCost(jevCost(model, billed, deps.pricing));
4751
+ return { probability: p, model };
4713
4752
  }
4714
4753
  };
4715
4754
  }
@@ -4823,8 +4862,14 @@ function buildRealDeps(config, baseDir, dryRun) {
4823
4862
  ...isMockMode(process.env) ? {} : {
4824
4863
  jevJudge: (cfg, onCost) => {
4825
4864
  warnJevExperimental();
4826
- return makeJevJudge(cfg, { env: process.env, fetchFn: fetch, onCost });
4827
- }
4865
+ return makeJevJudge(cfg, {
4866
+ env: process.env,
4867
+ fetchFn: fetch,
4868
+ onCost,
4869
+ ...config.pricing !== void 0 ? { pricing: config.pricing } : {}
4870
+ });
4871
+ },
4872
+ jevCost: (model, inputTokens) => jevCost(model, inputTokens, config.pricing)
4828
4873
  }
4829
4874
  };
4830
4875
  }
@@ -4833,11 +4878,21 @@ function persist(result, baseDir) {
4833
4878
  fs5.mkdirSync(dir, { recursive: true });
4834
4879
  fs5.writeFileSync(path5.join(dir, "last-run.json"), JSON.stringify(result, null, 2));
4835
4880
  }
4881
+ function jevAddressCheck(config, env) {
4882
+ const checks = [...config.defaults?.assertions ?? [], ...config.evals.flatMap((ev) => ev.assertions)];
4883
+ if (!checks.some((a) => a.type === "llm-judge" && a.provider?.type === "jev")) return;
4884
+ try {
4885
+ jevBaseUrl(env);
4886
+ } catch (err) {
4887
+ throw new RunConfigError(err.message);
4888
+ }
4889
+ }
4836
4890
  async function handleRun(options, depsFactory) {
4837
4891
  const config = await loadConfig(
4838
4892
  options.configPath !== void 0 ? { configPath: options.configPath } : {}
4839
4893
  );
4840
4894
  const baseDir = options.configPath !== void 0 ? path5.dirname(path5.resolve(options.configPath)) : process.cwd();
4895
+ jevAddressCheck(config, process.env);
4841
4896
  for (const warning of [...mcpSecretWarnings(config), ...selfJudgeWarnings(config)])
4842
4897
  process.stderr.write(`warning: ${warning}
4843
4898
  `);
package/dist/index.d.cts CHANGED
@@ -609,6 +609,11 @@ interface DecisionQuestion {
609
609
  output: string;
610
610
  input?: string;
611
611
  }
612
+ /** A decision judge's answer: the probability of "yes", and the exact model version that gave it. */
613
+ interface DecisionAnswer {
614
+ probability: number;
615
+ model: string;
616
+ }
612
617
  interface Judge {
613
618
  /** Ask the judge LLM a prompt and return its raw text response. */
614
619
  ask(prompt: string): Promise<string>;
@@ -616,7 +621,7 @@ interface Judge {
616
621
  * Only a decision model has it (the experimental `jev` judge of an `llm-judge` check): the probability, 0 to 1,
617
622
  * that the answer meets the criteria. Such a judge gives no reason, and its `ask` throws.
618
623
  */
619
- decide?(question: DecisionQuestion): Promise<number>;
624
+ decide?(question: DecisionQuestion): Promise<DecisionAnswer>;
620
625
  }
621
626
 
622
627
  interface Cache {
@@ -691,7 +696,15 @@ interface RowParams {
691
696
  */
692
697
  resolveJudge?: (cfg: ProviderConfig) => Provider;
693
698
  /** Builds the experimental `jev` judge of an `llm-judge` check; `onCost` is charged to the row. Without it such a check errors the row. */
694
- jevJudge?: (cfg: JevJudgeConfig, onCost: (usd: number) => void) => Judge;
699
+ jevJudge?: (cfg: JevJudgeConfig, onCost: (cost: {
700
+ cost_usd: number;
701
+ priced?: boolean;
702
+ }) => void) => Judge;
703
+ /** Prices a `jev` judge call of so many input tokens, for a dry run. Without it a dry run leaves such a check out of the estimate. */
704
+ jevCost?: (model: string, inputTokens: number) => {
705
+ cost_usd: number;
706
+ priced?: boolean;
707
+ };
695
708
  }
696
709
  interface RunDeps {
697
710
  resolveProvider(cfg: ProviderConfig): Provider;
@@ -704,6 +717,8 @@ interface RunDeps {
704
717
  connectMcp?: AgentConnect;
705
718
  /** Builds the experimental `jev` judge of an `llm-judge` check. A run without it errors the rows of such a check. */
706
719
  jevJudge?: RowParams['jevJudge'];
720
+ /** Prices a `jev` judge call for a dry run. */
721
+ jevCost?: RowParams['jevCost'];
707
722
  }
708
723
 
709
724
  interface RunOptions {
package/dist/index.d.ts CHANGED
@@ -609,6 +609,11 @@ interface DecisionQuestion {
609
609
  output: string;
610
610
  input?: string;
611
611
  }
612
+ /** A decision judge's answer: the probability of "yes", and the exact model version that gave it. */
613
+ interface DecisionAnswer {
614
+ probability: number;
615
+ model: string;
616
+ }
612
617
  interface Judge {
613
618
  /** Ask the judge LLM a prompt and return its raw text response. */
614
619
  ask(prompt: string): Promise<string>;
@@ -616,7 +621,7 @@ interface Judge {
616
621
  * Only a decision model has it (the experimental `jev` judge of an `llm-judge` check): the probability, 0 to 1,
617
622
  * that the answer meets the criteria. Such a judge gives no reason, and its `ask` throws.
618
623
  */
619
- decide?(question: DecisionQuestion): Promise<number>;
624
+ decide?(question: DecisionQuestion): Promise<DecisionAnswer>;
620
625
  }
621
626
 
622
627
  interface Cache {
@@ -691,7 +696,15 @@ interface RowParams {
691
696
  */
692
697
  resolveJudge?: (cfg: ProviderConfig) => Provider;
693
698
  /** Builds the experimental `jev` judge of an `llm-judge` check; `onCost` is charged to the row. Without it such a check errors the row. */
694
- jevJudge?: (cfg: JevJudgeConfig, onCost: (usd: number) => void) => Judge;
699
+ jevJudge?: (cfg: JevJudgeConfig, onCost: (cost: {
700
+ cost_usd: number;
701
+ priced?: boolean;
702
+ }) => void) => Judge;
703
+ /** Prices a `jev` judge call of so many input tokens, for a dry run. Without it a dry run leaves such a check out of the estimate. */
704
+ jevCost?: (model: string, inputTokens: number) => {
705
+ cost_usd: number;
706
+ priced?: boolean;
707
+ };
695
708
  }
696
709
  interface RunDeps {
697
710
  resolveProvider(cfg: ProviderConfig): Provider;
@@ -704,6 +717,8 @@ interface RunDeps {
704
717
  connectMcp?: AgentConnect;
705
718
  /** Builds the experimental `jev` judge of an `llm-judge` check. A run without it errors the rows of such a check. */
706
719
  jevJudge?: RowParams['jevJudge'];
720
+ /** Prices a `jev` judge call for a dry run. */
721
+ jevCost?: RowParams['jevCost'];
707
722
  }
708
723
 
709
724
  interface RunOptions {
package/dist/index.js CHANGED
@@ -1136,7 +1136,8 @@ var jsonSchemaAssertionSchema = z.object({
1136
1136
  });
1137
1137
  var jevJudgeSchema = z.strictObject({
1138
1138
  type: z.literal("jev"),
1139
- model: z.string().min(1),
1139
+ // A full version, never an alias: `jev-latest` would change the judge under a run without a word.
1140
+ model: z.string().regex(/^jev-\d+\.\d+\.\d+$/, "must be a full Jev version such as jev-1.14.0; an alias such as jev-latest is not taken"),
1140
1141
  timeout: providerTimeoutSchema.optional()
1141
1142
  });
1142
1143
  var partialProviderSchema = providerConfigSchema.partial();
@@ -1729,6 +1730,9 @@ init_esm_shims();
1729
1730
  // src/providers/prices.ts
1730
1731
  init_esm_shims();
1731
1732
  var PRICE_TABLE = {
1733
+ // TypeSafe Jev, the experimental judge of `llm-judge`: input tokens only, its output is not billed.
1734
+ // Source: docs.typesafe.ai, read on 2026-11-24 (USD 0.042 per million input tokens).
1735
+ "jev-1.14.0": { input_per_1k_usd: 42e-6, output_per_1k_usd: 0 },
1732
1736
  // Anthropic, current models. Source: platform.claude.com/docs/en/about-claude/pricing — base
1733
1737
  // input and output tokens per million, read on 2026-09-29, kept here per thousand.
1734
1738
  "claude-fable-5-1": { input_per_1k_usd: 0.01, output_per_1k_usd: 0.05 },
@@ -2768,7 +2772,7 @@ var llmJudge = {
2768
2772
  const criteria = interpolate(ctx.params.criteria, ctx);
2769
2773
  const threshold = ctx.params.pass_threshold ?? DEFAULT_PASS_THRESHOLD;
2770
2774
  if (ctx.judge.decide !== void 0) {
2771
- const p = await ctx.judge.decide({
2775
+ const { probability: p } = await ctx.judge.decide({
2772
2776
  criteria,
2773
2777
  output: ctx.output,
2774
2778
  ...ctx.input !== void 0 ? { input: ctx.input } : {}
@@ -4129,14 +4133,16 @@ async function assess(p, output, input, transcript) {
4129
4133
  const judge = () => {
4130
4134
  if (jev !== void 0) {
4131
4135
  if (p.jevJudge === void 0) throw new Error("this run cannot build the jev judge of an llm-judge check");
4132
- const inner2 = p.jevJudge(jev, (usd) => {
4133
- judgeCost += usd;
4136
+ const inner2 = p.jevJudge(jev, (c) => {
4137
+ judgeCost += c.cost_usd;
4138
+ if (c.priced === false) judgeUnpriced = true;
4134
4139
  });
4135
4140
  return {
4136
4141
  ask: (q) => inner2.ask(q),
4137
- decide: (q) => {
4138
- judgedBy = `jev/${jev.model}`;
4139
- return inner2.decide(q);
4142
+ decide: async (q) => {
4143
+ const answer = await inner2.decide(q);
4144
+ judgedBy = `jev/${answer.model}`;
4145
+ return answer;
4140
4146
  }
4141
4147
  };
4142
4148
  }
@@ -4203,7 +4209,15 @@ async function runRow(p) {
4203
4209
  if (p.dryRun) {
4204
4210
  const est = estimateUsage(prompt5, maxTokens);
4205
4211
  const cost = p.provider.estimateCost(est);
4206
- return dryRunRow(p.row.vars, { ...est, ...costFields(cost) });
4212
+ let judged = 0;
4213
+ let unpriced = cost.priced === false;
4214
+ for (const a of p.assertions) {
4215
+ if (a.type !== "llm-judge" || a.provider?.type !== "jev" || p.jevCost === void 0) continue;
4216
+ const c = p.jevCost(a.provider.model, Math.ceil((prompt5.length + maxTokens * 4 + a.criteria.length) / 3));
4217
+ judged += c.cost_usd;
4218
+ if (c.priced === false) unpriced = true;
4219
+ }
4220
+ return dryRunRow(p.row.vars, { ...est, cost_usd: cost.cost_usd + judged, ...unpriced ? { priced: false } : cost.priced === void 0 ? {} : { priced: cost.priced } });
4207
4221
  }
4208
4222
  const key = cacheKey(
4209
4223
  {
@@ -4501,6 +4515,7 @@ async function runOrchestration(config, options, deps) {
4501
4515
  provider,
4502
4516
  resolveJudge,
4503
4517
  ...deps.jevJudge !== void 0 ? { jevJudge: deps.jevJudge } : {},
4518
+ ...deps.jevCost !== void 0 ? { jevCost: deps.jevCost } : {},
4504
4519
  embedder: deps.embedder,
4505
4520
  cache: deps.cache,
4506
4521
  now: deps.now,
@@ -4607,7 +4622,7 @@ init_esm_shims();
4607
4622
  var JEV_BASE_URL = "https://api.typesafe.ai";
4608
4623
  var JEV_KEY_ENV = "TYPESAFE_API_KEY";
4609
4624
  var JEV_MAX_STATE_CHARS = 16e3;
4610
- var JEV_USD_PER_1M_INPUT_TOKENS = 0.042;
4625
+ var JEV_BASE_URL_ENV = "PLUNE_JEV_BASE_URL";
4611
4626
  var DEFAULT_TIMEOUT_MS = 3e4;
4612
4627
  var INSTRUCTIONS = "Does the answer meet the criterion?";
4613
4628
  var YES = "the answer meets the criterion";
@@ -4623,6 +4638,27 @@ ${q.output}
4623
4638
  Criterion:
4624
4639
  ${q.criteria}`;
4625
4640
  }
4641
+ function jevBaseUrl(env) {
4642
+ const own2 = env[JEV_BASE_URL_ENV];
4643
+ const [name, value] = own2 !== void 0 && own2 !== "" ? [JEV_BASE_URL_ENV, own2] : ["TYPESAFE_BASE_URL", env["TYPESAFE_BASE_URL"]];
4644
+ if (value === void 0 || value === "") return JEV_BASE_URL;
4645
+ let url;
4646
+ try {
4647
+ url = new URL(value);
4648
+ } catch {
4649
+ url = void 0;
4650
+ }
4651
+ const ok = url !== void 0 && url.protocol === "https:" && (url.hostname === "typesafe.ai" || url.hostname.endsWith(".typesafe.ai"));
4652
+ if (!ok)
4653
+ throw new Error(
4654
+ `${name} is ${value}: the jev judge asks only an https address under typesafe.ai, so that another model is not judged and reported as Jev. ` + (name === JEV_BASE_URL_ENV ? `Unset it or set it to ${JEV_BASE_URL}` : `Set ${JEV_BASE_URL_ENV}=${JEV_BASE_URL} for plune and keep TYPESAFE_BASE_URL for your other tools`)
4655
+ );
4656
+ return value.replace(/\/+$/, "");
4657
+ }
4658
+ function jevCost(model, inputTokens, pricing) {
4659
+ return resolveCostEntry({ input_tokens: inputTokens, output_tokens: 0 }, model, void 0, pricing);
4660
+ }
4661
+ var jevTokenEstimate = (chars) => Math.ceil(chars / 3);
4626
4662
  function probability(json) {
4627
4663
  const answer = json?.answers?.q;
4628
4664
  const p = answer?.type === "noul" ? answer.noul : void 0;
@@ -4634,6 +4670,7 @@ function makeJevJudge(cfg, deps) {
4634
4670
  return {
4635
4671
  ask: () => Promise.reject(new Error("a jev judge answers a yes-or-no question only: it cannot judge this kind of check")),
4636
4672
  async decide(q) {
4673
+ const base = jevBaseUrl(deps.env);
4637
4674
  const key = deps.env[JEV_KEY_ENV];
4638
4675
  if (key === void 0 || key === "")
4639
4676
  throw new AuthError(`${JEV_KEY_ENV} is not set: the jev judge of an llm-judge check needs it`, JEV_KEY_ENV);
@@ -4650,7 +4687,7 @@ function makeJevJudge(cfg, deps) {
4650
4687
  });
4651
4688
  const send = async () => {
4652
4689
  try {
4653
- return await deps.fetchFn(`${JEV_BASE_URL}/v1/systemone`, {
4690
+ return await deps.fetchFn(`${base}/v1/systemone`, {
4654
4691
  method: "POST",
4655
4692
  headers: { "content-type": "application/json", authorization: `Bearer ${key}` },
4656
4693
  body,
@@ -4669,9 +4706,11 @@ function makeJevJudge(cfg, deps) {
4669
4706
  const json = await res.json();
4670
4707
  const p = probability(json);
4671
4708
  const tokens = json.usage?.input_tokens;
4672
- const billed = typeof tokens === "number" && tokens >= 0 ? tokens : Math.ceil(state.length / 3);
4673
- deps.onCost(billed / 1e6 * JEV_USD_PER_1M_INPUT_TOKENS);
4674
- return p;
4709
+ const billed = typeof tokens === "number" && tokens >= 0 ? tokens : jevTokenEstimate(state.length);
4710
+ const answered = json.model;
4711
+ const model = typeof answered === "string" && answered !== "" ? answered : cfg.model;
4712
+ deps.onCost(jevCost(model, billed, deps.pricing));
4713
+ return { probability: p, model };
4675
4714
  }
4676
4715
  };
4677
4716
  }
@@ -4785,8 +4824,14 @@ function buildRealDeps(config, baseDir, dryRun) {
4785
4824
  ...isMockMode(process.env) ? {} : {
4786
4825
  jevJudge: (cfg, onCost) => {
4787
4826
  warnJevExperimental();
4788
- return makeJevJudge(cfg, { env: process.env, fetchFn: fetch, onCost });
4789
- }
4827
+ return makeJevJudge(cfg, {
4828
+ env: process.env,
4829
+ fetchFn: fetch,
4830
+ onCost,
4831
+ ...config.pricing !== void 0 ? { pricing: config.pricing } : {}
4832
+ });
4833
+ },
4834
+ jevCost: (model, inputTokens) => jevCost(model, inputTokens, config.pricing)
4790
4835
  }
4791
4836
  };
4792
4837
  }
@@ -4795,11 +4840,21 @@ function persist(result, baseDir) {
4795
4840
  fs5.mkdirSync(dir, { recursive: true });
4796
4841
  fs5.writeFileSync(path6.join(dir, "last-run.json"), JSON.stringify(result, null, 2));
4797
4842
  }
4843
+ function jevAddressCheck(config, env) {
4844
+ const checks = [...config.defaults?.assertions ?? [], ...config.evals.flatMap((ev) => ev.assertions)];
4845
+ if (!checks.some((a) => a.type === "llm-judge" && a.provider?.type === "jev")) return;
4846
+ try {
4847
+ jevBaseUrl(env);
4848
+ } catch (err) {
4849
+ throw new RunConfigError(err.message);
4850
+ }
4851
+ }
4798
4852
  async function handleRun(options, depsFactory) {
4799
4853
  const config = await loadConfig(
4800
4854
  options.configPath !== void 0 ? { configPath: options.configPath } : {}
4801
4855
  );
4802
4856
  const baseDir = options.configPath !== void 0 ? path6.dirname(path6.resolve(options.configPath)) : process.cwd();
4857
+ jevAddressCheck(config, process.env);
4803
4858
  for (const warning of [...mcpSecretWarnings(config), ...selfJudgeWarnings(config)])
4804
4859
  process.stderr.write(`warning: ${warning}
4805
4860
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plune-ai/cli",
3
- "version": "0.39.15",
3
+ "version": "0.39.16",
4
4
  "mcpName": "ai.plune/cli",
5
5
  "description": "AI-powered assertion testing for LLM apps — write assertions, run them against any provider, get a pass/fail report (local, CI, or diff).",
6
6
  "keywords": [
@@ -101,7 +101,8 @@
101
101
  "tsup": "^8.0.0",
102
102
  "tsx": "^4.7.0",
103
103
  "typescript": "^5.4.0",
104
- "vitest": "^1.6.0"
104
+ "vitest": "^1.6.0",
105
+ "xmllint-wasm": "5.3.0"
105
106
  },
106
107
  "repository": {
107
108
  "type": "git",