axiom 0.25.0 → 0.26.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/bin.cjs CHANGED
@@ -255,10 +255,10 @@ async function askConfirmation(message) {
255
255
  input: process.stdin,
256
256
  output: process.stdout
257
257
  });
258
- return new Promise((resolve3) => {
258
+ return new Promise((resolve4) => {
259
259
  rl.question(`${message} (y/N): `, (answer) => {
260
260
  rl.close();
261
- resolve3(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
261
+ resolve4(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
262
262
  });
263
263
  });
264
264
  }
@@ -477,7 +477,11 @@ var r = process.env.FORCE_TTY !== void 0 || (0, import_tty.isatty)(1);
477
477
  var u = p(r);
478
478
 
479
479
  // src/evals/run-vitest.ts
480
- var import_node_path3 = __toESM(require("path"), 1);
480
+ var import_node_url = require("url");
481
+ var import_node_path3 = require("path");
482
+ var import_node_fs = require("fs");
483
+ var import_node_os2 = require("os");
484
+ var import_node_path4 = __toESM(require("path"), 1);
481
485
  var import_node = require("vitest/node");
482
486
 
483
487
  // src/evals/context/storage.ts
@@ -879,7 +883,7 @@ var import_api4 = require("@opentelemetry/api");
879
883
  // package.json
880
884
  var package_default = {
881
885
  name: "axiom",
882
- version: "0.25.0",
886
+ version: "0.26.0",
883
887
  type: "module",
884
888
  author: "Axiom, Inc.",
885
889
  contributors: [
@@ -1998,11 +2002,11 @@ function setupEvalProvider(connection) {
1998
2002
  axiomProvider = new import_sdk_trace_node.NodeTracerProvider({
1999
2003
  resource: (0, import_resources.resourceFromAttributes)({
2000
2004
  ["service.name"]: "axiom",
2001
- ["service.version"]: "0.25.0"
2005
+ ["service.version"]: "0.26.0"
2002
2006
  }),
2003
2007
  spanProcessors: [processor]
2004
2008
  });
2005
- axiomTracer = axiomProvider.getTracer("axiom", "0.25.0");
2009
+ axiomTracer = axiomProvider.getTracer("axiom", "0.26.0");
2006
2010
  }
2007
2011
  async function initInstrumentation(config) {
2008
2012
  if (initialized) {
@@ -2014,7 +2018,7 @@ async function initInstrumentation(config) {
2014
2018
  }
2015
2019
  initializationPromise = (async () => {
2016
2020
  if (!config.enabled) {
2017
- axiomTracer = import_api10.trace.getTracer("axiom", "0.25.0");
2021
+ axiomTracer = import_api10.trace.getTracer("axiom", "0.26.0");
2018
2022
  initialized = true;
2019
2023
  return;
2020
2024
  }
@@ -2077,6 +2081,9 @@ var flush = async () => {
2077
2081
  };
2078
2082
 
2079
2083
  // src/evals/run-vitest.ts
2084
+ var import_meta2 = {};
2085
+ var __filename = (0, import_node_url.fileURLToPath)(import_meta2.url);
2086
+ var __dirname = (0, import_node_path3.dirname)(__filename);
2080
2087
  var printCollectedEvals = (result, rootDir) => {
2081
2088
  if (!result.testModules || result.testModules.length === 0) {
2082
2089
  console.log(u.yellow("\nNo evaluations found\n"));
@@ -2086,7 +2093,7 @@ var printCollectedEvals = (result, rootDir) => {
2086
2093
  let totalEvals = 0;
2087
2094
  let totalCases = 0;
2088
2095
  for (const module2 of result.testModules) {
2089
- const relativePath = import_node_path3.default.relative(rootDir, module2.moduleId);
2096
+ const relativePath = import_node_path4.default.relative(rootDir, module2.moduleId);
2090
2097
  for (const suite of module2.children.suites()) {
2091
2098
  totalEvals++;
2092
2099
  const caseCount = suite.children.size;
@@ -2116,6 +2123,16 @@ var runVitest = async (dir, opts) => {
2116
2123
  if (opts.debug) {
2117
2124
  console.log(u.bgWhite(u.blackBright(" Debug mode enabled ")));
2118
2125
  }
2126
+ const tmpDir = (0, import_node_path3.join)((0, import_node_os2.tmpdir)(), "axiom-eval", opts.runId);
2127
+ (0, import_node_fs.mkdirSync)(tmpDir, { recursive: true });
2128
+ const nameRegistryFile = (0, import_node_path3.join)(tmpDir, "names.jsonl");
2129
+ const abortFile = (0, import_node_path3.join)(tmpDir, "abort.txt");
2130
+ (0, import_node_fs.writeFileSync)(nameRegistryFile, "", "utf8");
2131
+ if ((0, import_node_fs.existsSync)(abortFile)) {
2132
+ (0, import_node_fs.unlinkSync)(abortFile);
2133
+ }
2134
+ process.env.AXIOM_NAME_REGISTRY_FILE = nameRegistryFile;
2135
+ process.env.AXIOM_ABORT_FILE = abortFile;
2119
2136
  if (opts.list) {
2120
2137
  console.log(u.bgWhite(u.blackBright(" List mode ")));
2121
2138
  }
@@ -2135,6 +2152,7 @@ var runVitest = async (dir, opts) => {
2135
2152
  disableConsoleIntercept: true,
2136
2153
  testTimeout: opts.config?.eval?.timeoutMs || 6e4,
2137
2154
  globals: true,
2155
+ runner: (0, import_node_path3.resolve)(__dirname, "evals", "custom-runner.js"),
2138
2156
  provide: {
2139
2157
  baseline: opts.baseline,
2140
2158
  debug: opts.debug,
@@ -2151,6 +2169,12 @@ var runVitest = async (dir, opts) => {
2151
2169
  process.exit(0);
2152
2170
  }
2153
2171
  await vi.start();
2172
+ if ((0, import_node_fs.existsSync)(abortFile)) {
2173
+ const message = (0, import_node_fs.readFileSync)(abortFile, "utf8");
2174
+ console.error("\n" + message);
2175
+ await vi.close();
2176
+ process.exit(1);
2177
+ }
2154
2178
  const dispose = (0, import_node.registerConsoleShortcuts)(vi, process.stdin, process.stdout);
2155
2179
  if (!vi.shouldKeepServer()) {
2156
2180
  dispose();
@@ -2162,7 +2186,7 @@ var runVitest = async (dir, opts) => {
2162
2186
  };
2163
2187
 
2164
2188
  // src/cli/commands/eval.command.ts
2165
- var import_node_fs = require("fs");
2189
+ var import_node_fs2 = require("fs");
2166
2190
 
2167
2191
  // src/context.ts
2168
2192
  function overrideFlags(partial) {
@@ -2228,7 +2252,7 @@ var loadEvalCommand = (program2, flagOverrides = {}) => {
2228
2252
  include = [target];
2229
2253
  } else {
2230
2254
  try {
2231
- const stat = (0, import_node_fs.lstatSync)(target);
2255
+ const stat = (0, import_node_fs2.lstatSync)(target);
2232
2256
  if (stat.isDirectory()) {
2233
2257
  include = config?.eval?.include || [];
2234
2258
  } else {
@@ -2278,8 +2302,8 @@ var loadEvalCommand = (program2, flagOverrides = {}) => {
2278
2302
 
2279
2303
  // src/cli/utils/parse-flag-overrides.ts
2280
2304
  var import_zod5 = require("zod");
2281
- var import_node_fs2 = require("fs");
2282
- var import_node_path4 = require("path");
2305
+ var import_node_fs3 = require("fs");
2306
+ var import_node_path5 = require("path");
2283
2307
  var FLAG_RE = /^--flag\.([^=]+)(?:=(.*))?$/;
2284
2308
  var CONFIG_RE = /^--flags-config(?:=(.*))?$/;
2285
2309
  function ensureNoSpaceSeparatedSyntax(flagName, value, nextToken, flagType) {
@@ -2309,9 +2333,9 @@ function coerceValue(raw) {
2309
2333
  }
2310
2334
  }
2311
2335
  function loadConfigFile(path4) {
2312
- const abs = (0, import_node_path4.resolve)(process.cwd(), path4);
2336
+ const abs = (0, import_node_path5.resolve)(process.cwd(), path4);
2313
2337
  try {
2314
- const contents = (0, import_node_fs2.readFileSync)(abs, "utf8");
2338
+ const contents = (0, import_node_fs3.readFileSync)(abs, "utf8");
2315
2339
  const parsed = JSON.parse(contents);
2316
2340
  if (typeof parsed !== "object" || Array.isArray(parsed) || parsed === null) {
2317
2341
  console.error(
@@ -2384,7 +2408,7 @@ var import_commander4 = require("commander");
2384
2408
  var loadVersionCommand = (program2) => {
2385
2409
  return program2.addCommand(
2386
2410
  new import_commander4.Command("version").description("cli version").action(() => {
2387
- console.log("0.25.0");
2411
+ console.log("0.26.0");
2388
2412
  })
2389
2413
  );
2390
2414
  };
@@ -2394,7 +2418,7 @@ var { loadEnvConfig } = import_env.default;
2394
2418
  loadEnvConfig(process.cwd());
2395
2419
  var { cleanedArgv, overrides } = extractOverrides(process.argv.slice(2));
2396
2420
  var program = new import_commander5.Command();
2397
- program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.25.0");
2421
+ program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.26.0");
2398
2422
  loadPushCommand(program);
2399
2423
  loadPullCommand(program);
2400
2424
  loadEvalCommand(program, overrides);