dsh-livebench-panel 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/lib/index.js +17 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -403,7 +403,7 @@ function apply(ctx) {
403
403
  /** The single run slot. */
404
404
  let run = null;
405
405
 
406
- const startRun = (body) => {
406
+ const startRun = async (body) => {
407
407
  const layout = livebenchLayout();
408
408
  if (!layout.available) {
409
409
  return { status: 409, payload: { ok: false, error: `LiveBench venv not found under ${layout.root}` } };
@@ -473,11 +473,23 @@ function apply(ctx) {
473
473
  PATH: `${join(layout.root, ".venv", "Scripts")}${delimiter}${process.env.PATH ?? ""}`,
474
474
  };
475
475
  // Only OpenAI-compatible providers can be routed with --api-base; for
476
- // those, hand the key over via env (never the command line).
476
+ // those, hand the key over via env (never the command line). The key is
477
+ // resolved through the harness credential seam when available (values may
478
+ // live encrypted in .credentials.yaml rather than in the process env),
479
+ // falling back to the plain environment variable.
477
480
  if (provider && provider.api === "openai-completions" && provider.baseURL) {
478
481
  args.push("--api-base", provider.baseURL);
479
- if (provider.keyEnv && process.env[provider.keyEnv]) {
480
- env.LIVEBENCH_API_KEY = process.env[provider.keyEnv];
482
+ if (provider.keyEnv) {
483
+ let key;
484
+ try {
485
+ const credentials = ctx.get ? ctx.get("credentials") : undefined;
486
+ if (credentials && typeof credentials.resolve === "function") {
487
+ const resolved = await credentials.resolve(provider.keyEnv);
488
+ if (resolved && typeof resolved.value === "string" && resolved.value.length > 0) key = resolved.value;
489
+ }
490
+ } catch { /* credential seam unavailable — fall through to env */ }
491
+ if (!key && process.env[provider.keyEnv]) key = process.env[provider.keyEnv];
492
+ if (key) env.LIVEBENCH_API_KEY = key;
481
493
  }
482
494
  }
483
495
 
@@ -581,7 +593,7 @@ function apply(ctx) {
581
593
  sendJson(res, 409, { ok: false, error: "another evaluation is already running" });
582
594
  return;
583
595
  }
584
- const result = startRun(body);
596
+ const result = await startRun(body);
585
597
  sendJson(res, result.status, result.payload);
586
598
  },
587
599
  }), `${name}: start route`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-livebench-panel",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "DSH web plugin: a LiveBench tab in the Trajectory view (right of 对话/轨迹). Run LiveBench evaluations against every model configured in the DeepSeek Harness — pick provider/model, category, task, release and question range from dropdowns, watch progress, and read scores in place.",
5
5
  "license": "MIT",
6
6
  "type": "module",