@ls-stack/agent-eval 0.7.0 → 0.8.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/{app-TjV5nDMM.mjs → app-ZFLdu8-r.mjs} +40 -4
- package/dist/apps/web/dist/assets/index-CvJmtK1T.js +113 -0
- package/dist/apps/web/dist/index.html +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/{cli-BTtgQLjB.mjs → cli-DQK5W0je.mjs} +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{runner-CBDZos0Z.mjs → runner--XPZ5D7N.mjs} +1 -1
- package/dist/{runner-DGVoOyJt.mjs → runner-CmVPWava.mjs} +2 -2
- package/dist/{src-Bt5Fz9HS.mjs → src-r3FQAaw6.mjs} +1 -1
- package/package.json +1 -1
- package/dist/apps/web/dist/assets/index-gGumCEnD.js +0 -112
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { C as updateManualScoreRequestSchema, S as createRunRequestSchema } from "./runOrchestration-HaMahl6b.mjs";
|
|
2
|
-
import "./src-
|
|
3
|
-
import { t as getRunnerInstance } from "./runner-
|
|
2
|
+
import "./src-r3FQAaw6.mjs";
|
|
3
|
+
import { t as getRunnerInstance } from "./runner-CmVPWava.mjs";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
|
-
import { dirname, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
6
|
+
import { z } from "zod/v4";
|
|
6
7
|
import { existsSync } from "node:fs";
|
|
8
|
+
import { resultify } from "t-result";
|
|
7
9
|
import { fileURLToPath } from "node:url";
|
|
8
10
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
9
11
|
import { Hono } from "hono";
|
|
@@ -226,10 +228,44 @@ const runsRoutes = new Hono().get("/", (c) => {
|
|
|
226
228
|
});
|
|
227
229
|
});
|
|
228
230
|
//#endregion
|
|
231
|
+
//#region ../../apps/server/src/packageManager.ts
|
|
232
|
+
const packageJsonSchema = z.object({ packageManager: z.string().optional() });
|
|
233
|
+
const packageManagerNameSeparatorRegex = /[ @/]/;
|
|
234
|
+
function normalizePackageManager(value) {
|
|
235
|
+
if (!value) return void 0;
|
|
236
|
+
const name = value.split(packageManagerNameSeparatorRegex)[0];
|
|
237
|
+
if (name === "npm" || name === "pnpm" || name === "yarn" || name === "bun") return name;
|
|
238
|
+
}
|
|
239
|
+
async function readPackageManagerField(workspaceRoot) {
|
|
240
|
+
const packageJson = await resultify(() => readFile(join(workspaceRoot, "package.json"), "utf8"));
|
|
241
|
+
if (packageJson.error) return void 0;
|
|
242
|
+
const parsedJson = resultify(() => JSON.parse(packageJson.value));
|
|
243
|
+
if (parsedJson.error) return void 0;
|
|
244
|
+
const parsedPackage = resultify(() => packageJsonSchema.parse(parsedJson.value));
|
|
245
|
+
if (parsedPackage.error) return void 0;
|
|
246
|
+
return normalizePackageManager(parsedPackage.value.packageManager);
|
|
247
|
+
}
|
|
248
|
+
function detectFromLockfile(workspaceRoot) {
|
|
249
|
+
if (existsSync(join(workspaceRoot, "pnpm-lock.yaml"))) return "pnpm";
|
|
250
|
+
if (existsSync(join(workspaceRoot, "yarn.lock"))) return "yarn";
|
|
251
|
+
if (existsSync(join(workspaceRoot, "bun.lock")) || existsSync(join(workspaceRoot, "bun.lockb"))) return "bun";
|
|
252
|
+
if (existsSync(join(workspaceRoot, "package-lock.json"))) return "npm";
|
|
253
|
+
}
|
|
254
|
+
/** Detect the package manager users should use when running workspace CLI commands. */
|
|
255
|
+
async function detectWorkspacePackageManager(workspaceRoot) {
|
|
256
|
+
return await readPackageManagerField(workspaceRoot) ?? detectFromLockfile(workspaceRoot) ?? normalizePackageManager(process.env.npm_config_user_agent) ?? "pnpm";
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region ../../apps/server/src/routes/workspace.ts
|
|
260
|
+
const workspaceRoutes = new Hono().get("/", async (c) => {
|
|
261
|
+
const packageManager = await detectWorkspacePackageManager(getRunnerInstance().getWorkspaceRoot());
|
|
262
|
+
return c.json({ packageManager }, 200);
|
|
263
|
+
});
|
|
264
|
+
//#endregion
|
|
229
265
|
//#region ../../apps/server/src/app.ts
|
|
230
266
|
const baseApp = new Hono();
|
|
231
267
|
baseApp.use("/*", cors());
|
|
232
|
-
baseApp.route("/api/evals", evalsRoutes).route("/api/runs", runsRoutes).route("/api/cache", cacheRoutes).route("/api", assetsRoutes);
|
|
268
|
+
baseApp.route("/api/evals", evalsRoutes).route("/api/runs", runsRoutes).route("/api/cache", cacheRoutes).route("/api/workspace", workspaceRoutes).route("/api", assetsRoutes);
|
|
233
269
|
const serverDir = dirname(fileURLToPath(import.meta.url));
|
|
234
270
|
const webDist = process.env.AGENT_EVALS_WEB_DIST ? resolve(process.env.AGENT_EVALS_WEB_DIST) : resolve(serverDir, "../../web/dist");
|
|
235
271
|
if (existsSync(webDist)) {
|