@leostera/evalkit 0.4.0 → 0.6.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +67 -1
  2. package/README.md +10 -8
  3. package/dist/cli.mjs +1287 -266
  4. package/dist/dashboard/assets/index-BK9x-zoi.css +2 -0
  5. package/dist/dashboard/assets/index-DzsDLGHx.js +32 -0
  6. package/dist/dashboard/index.html +2 -2
  7. package/dist/files-C-U0-PWW.mjs +0 -2
  8. package/dist/index-db-vbqEGFaU.mjs +0 -2
  9. package/dist/index.d.mts +1344 -2
  10. package/dist/index.d.mts.map +1 -1
  11. package/dist/index.mjs +2 -4
  12. package/dist/runner.d.mts +807 -11
  13. package/dist/runner.d.mts.map +1 -1
  14. package/dist/runner.mjs +2 -2
  15. package/dist/share-worker.d.mts +76 -1
  16. package/dist/share-worker.d.mts.map +1 -1
  17. package/dist/share-worker.mjs +0 -2
  18. package/dist/share.d.mts +149 -6
  19. package/dist/share.d.mts.map +1 -1
  20. package/dist/share.mjs +1 -1
  21. package/dist/skills/evalkit/SKILL.md +32 -0
  22. package/dist/skills/evalkit-agents/SKILL.md +16 -0
  23. package/dist/skills/evalkit-datasets/SKILL.md +17 -0
  24. package/dist/skills/evalkit-evals/SKILL.md +19 -0
  25. package/dist/skills/evalkit-judges/SKILL.md +17 -0
  26. package/dist/skills/evalkit-matrices/SKILL.md +14 -0
  27. package/dist/skills/evalkit-results/SKILL.md +14 -0
  28. package/dist/{src-DoPs9Yug.mjs → src-CVSCn3bZ.mjs} +445 -115
  29. package/dist/{src-DzZueFn3.mjs → src-CZnDXP1K.mjs} +46 -10
  30. package/dist/{src-ButXPY8P.mjs → src-D4tCwxNb.mjs} +418 -94
  31. package/package.json +3 -2
  32. package/dist/cli.mjs.map +0 -1
  33. package/dist/dashboard/assets/index-D9NtA46z.css +0 -2
  34. package/dist/dashboard/assets/index-DrBwLKJD.js +0 -30
  35. package/dist/files-C-U0-PWW.mjs.map +0 -1
  36. package/dist/index-U6TUTBf7.d.mts +0 -1019
  37. package/dist/index-U6TUTBf7.d.mts.map +0 -1
  38. package/dist/index-db-HdZXelOS.d.mts +0 -142
  39. package/dist/index-db-HdZXelOS.d.mts.map +0 -1
  40. package/dist/index-db-vbqEGFaU.mjs.map +0 -1
  41. package/dist/index.mjs.map +0 -1
  42. package/dist/share-worker.mjs.map +0 -1
  43. package/dist/src-ButXPY8P.mjs.map +0 -1
  44. package/dist/src-DoPs9Yug.mjs.map +0 -1
  45. package/dist/src-DzZueFn3.mjs.map +0 -1
@@ -1,7 +1,6 @@
1
1
  import { n as asyncIndex, r as createShareApp, t as ShareIndexDb } from "./index-db-vbqEGFaU.mjs";
2
2
  import { mkdir, readFile, readdir, rename, writeFile } from "node:fs/promises";
3
3
  import { dirname, join, relative, resolve, sep } from "node:path";
4
- import { Database } from "bun:sqlite";
5
4
  //#region ../share/src/fs-files.ts
6
5
  /** Result files in a directory, for `evalkit share serve` and tests. */
7
6
  function directoryFiles(root) {
@@ -45,18 +44,57 @@ function directoryFiles(root) {
45
44
  };
46
45
  }
47
46
  //#endregion
48
- //#region ../share/src/index-bun.ts
49
- /** The index in a SQLite file, for `evalkit share serve` and tests. */
50
- function sqliteIndex(path) {
47
+ //#region ../share/src/index-sqlite.ts
48
+ const onBun = typeof globalThis.Bun !== "undefined";
49
+ /**
50
+ * The index in a SQLite file, for `evalkit share serve` and tests: bun:sqlite
51
+ * on Bun, node:sqlite on Node. Imported lazily so neither runtime loads the
52
+ * other's module.
53
+ */
54
+ async function sqliteIndex(path) {
55
+ return asyncIndex(new ShareIndexDb(onBun ? await bunSql(path) : await nodeSql(path)));
56
+ }
57
+ async function bunSql(path) {
58
+ const { Database } = await import("bun:sqlite");
51
59
  const db = new Database(path, { create: true });
52
60
  db.run("PRAGMA journal_mode = WAL");
53
- return asyncIndex(new ShareIndexDb({
61
+ return {
54
62
  all: (query, ...params) => db.query(query).all(...params),
55
63
  run: (query, ...params) => {
56
64
  db.query(query).run(...params);
57
65
  },
58
66
  transaction: (work) => db.transaction(work)()
59
- }));
67
+ };
68
+ }
69
+ async function nodeSql(path) {
70
+ const { DatabaseSync } = await import("node:sqlite");
71
+ const db = new DatabaseSync(path);
72
+ db.exec("PRAGMA journal_mode = WAL");
73
+ let depth = 0;
74
+ return {
75
+ all: (query, ...params) => db.prepare(query).all(...params),
76
+ run: (query, ...params) => {
77
+ db.prepare(query).run(...params);
78
+ },
79
+ transaction(work) {
80
+ if (depth++) try {
81
+ return work();
82
+ } finally {
83
+ depth--;
84
+ }
85
+ db.exec("BEGIN");
86
+ try {
87
+ const result = work();
88
+ db.exec("COMMIT");
89
+ return result;
90
+ } catch (error) {
91
+ db.exec("ROLLBACK");
92
+ throw error;
93
+ } finally {
94
+ depth--;
95
+ }
96
+ }
97
+ };
60
98
  }
61
99
  //#endregion
62
100
  //#region ../share/src/node.ts
@@ -83,16 +121,14 @@ function directoryAssets(root) {
83
121
  }
84
122
  };
85
123
  }
86
- /** A share server on Bun: files and `index.sqlite` live in `dir`. */
124
+ /** A share server on Bun or Node: files and `index.sqlite` live in `dir`. */
87
125
  async function createDirectoryShareApp(options) {
88
126
  await mkdir(options.dir, { recursive: true });
89
127
  return createShareApp({
90
128
  files: directoryFiles(join(options.dir, "files")),
91
- index: sqliteIndex(join(options.dir, "index.sqlite")),
129
+ index: await sqliteIndex(join(options.dir, "index.sqlite")),
92
130
  assets: directoryAssets(options.dashboardRoot)
93
131
  });
94
132
  }
95
133
  //#endregion
96
134
  export { directoryFiles as i, directoryAssets as n, sqliteIndex as r, createDirectoryShareApp as t };
97
-
98
- //# sourceMappingURL=src-DzZueFn3.mjs.map