axiom 0.1.6 → 1.0.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 (97) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +61 -123
  3. package/dist/bin.cjs +486 -0
  4. package/dist/bin.cjs.map +1 -0
  5. package/dist/bin.d.cts +1 -0
  6. package/dist/bin.d.ts +1 -0
  7. package/dist/bin.js +410 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/chunk-CKSTM4QJ.js +25 -0
  10. package/dist/chunk-CKSTM4QJ.js.map +1 -0
  11. package/dist/chunk-KEXKKQVW.js +41 -0
  12. package/dist/chunk-KEXKKQVW.js.map +1 -0
  13. package/dist/chunk-P444X2AY.js +45 -0
  14. package/dist/chunk-P444X2AY.js.map +1 -0
  15. package/dist/chunk-VJQQJFVJ.js +311 -0
  16. package/dist/chunk-VJQQJFVJ.js.map +1 -0
  17. package/dist/evals.cjs +646 -0
  18. package/dist/evals.cjs.map +1 -0
  19. package/dist/evals.d.cts +143 -0
  20. package/dist/evals.d.ts +143 -0
  21. package/dist/evals.js +267 -0
  22. package/dist/evals.js.map +1 -0
  23. package/dist/handlebars-4NZUZGZE.js +5865 -0
  24. package/dist/handlebars-4NZUZGZE.js.map +1 -0
  25. package/dist/index.cjs +7895 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.cts +268 -0
  28. package/dist/index.d.ts +268 -0
  29. package/dist/index.js +1669 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/reporter-B9Ly79ok.d.cts +18 -0
  32. package/dist/reporter-B9Ly79ok.d.ts +18 -0
  33. package/package.json +96 -31
  34. package/.npmignore +0 -1
  35. package/LICENSE +0 -20
  36. package/bin/axiom +0 -3
  37. package/index.js +0 -2
  38. package/lib/bus.coffee +0 -3
  39. package/lib/cli.coffee +0 -56
  40. package/lib/core/delegate.coffee +0 -109
  41. package/lib/core/init.coffee +0 -52
  42. package/lib/core/internal.coffee +0 -66
  43. package/lib/core/link.coffee +0 -28
  44. package/lib/core/listen.coffee +0 -12
  45. package/lib/core/load.coffee +0 -81
  46. package/lib/core/loadProcess.coffee +0 -64
  47. package/lib/core/log.coffee +0 -18
  48. package/lib/core/logLevels.coffee +0 -16
  49. package/lib/core/request.coffee +0 -106
  50. package/lib/core/reset.coffee +0 -7
  51. package/lib/core/respond.coffee +0 -54
  52. package/lib/core/respondOnce.coffee +0 -17
  53. package/lib/core/send.coffee +0 -27
  54. package/lib/core/wireUpLoggers.coffee +0 -29
  55. package/lib/core.coffee +0 -11
  56. package/lib/errorTypes.coffee +0 -56
  57. package/lib/findProjectRoot.coffee +0 -20
  58. package/lib/getSafeCore.coffee +0 -22
  59. package/lib/getSafeRetriever.coffee +0 -11
  60. package/lib/helpers/ns-replace.coffee +0 -8
  61. package/lib/retriever.coffee +0 -29
  62. package/sample/project1/a1/package.json +0 -0
  63. package/sample/project1/appExtensions/doStuff.coffee +0 -4
  64. package/sample/project1/b1/b2/b3/.gitinclude +0 -0
  65. package/sample/project1/config/sample.coffee +0 -2
  66. package/sample/project1/index.js +0 -2
  67. package/sample/project1/main.coffee +0 -4
  68. package/sample/project1/package.json +0 -3
  69. package/sample/project2/index.js +0 -2
  70. package/sample/project2/main.coffee +0 -12
  71. package/sample/project2/package.json +0 -1
  72. package/sample/protocol/config/connect.coffee +0 -13
  73. package/sample/protocol/extensions/workInProgress.coffee +0 -11
  74. package/sample/protocol/index.js +0 -2
  75. package/sample/protocol/main.coffee +0 -20
  76. package/sample/protocol/package.json +0 -10
  77. package/test/cli.coffee +0 -141
  78. package/test/config.coffee +0 -77
  79. package/test/core.coffee +0 -472
  80. package/test/findProjectRoot.coffee +0 -31
  81. package/test/helpers/mockRetriever.coffee +0 -38
  82. package/test/init.coffee +0 -118
  83. package/test/internal.coffee +0 -41
  84. package/test/link.coffee +0 -66
  85. package/test/load.coffee +0 -300
  86. package/test/log.coffee +0 -94
  87. package/test/mocha.opts +0 -5
  88. package/test/retriever.coffee +0 -35
  89. package/tmp/README.md +0 -45
  90. package/tmp/app.coffee +0 -37
  91. package/tmp/axiom +0 -28
  92. package/tmp/cli_usage.md +0 -69
  93. package/tmp/createServer.coffee +0 -42
  94. package/tmp/err.stack.test.coffee +0 -50
  95. package/tmp/err.stack.test.js +0 -64
  96. package/tmp/hello.coffee +0 -2
  97. package/tmp/message.coffee +0 -26
package/dist/bin.cjs ADDED
@@ -0,0 +1,486 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/bin.ts
27
+ var import_env = __toESM(require("@next/env"), 1);
28
+ var import_commander4 = require("commander");
29
+
30
+ // src/commands/push.ts
31
+ var import_commander = require("commander");
32
+
33
+ // src/transpiler.ts
34
+ var import_esbuild = require("esbuild");
35
+ var import_node_os = __toESM(require("os"), 1);
36
+ var import_promises = __toESM(require("fs/promises"), 1);
37
+ var import_node_path = __toESM(require("path"), 1);
38
+ var import_node_path2 = require("path");
39
+ async function loadPromptModule(filePath) {
40
+ const result = await (0, import_esbuild.build)({
41
+ entryPoints: [filePath],
42
+ bundle: true,
43
+ write: false,
44
+ platform: "node",
45
+ format: "esm",
46
+ target: ["node18"],
47
+ sourcemap: false,
48
+ external: [
49
+ // Only Node.js built-ins should be external
50
+ "fs",
51
+ "fs/promises",
52
+ "node:fs",
53
+ "node:fs/promises",
54
+ "readline",
55
+ "node:readline",
56
+ "path",
57
+ "node:path",
58
+ "os",
59
+ "node:os",
60
+ "url",
61
+ "node:url",
62
+ "util",
63
+ "node:util",
64
+ "crypto",
65
+ "node:crypto",
66
+ "events",
67
+ "node:events",
68
+ "stream",
69
+ "node:stream",
70
+ "buffer",
71
+ "node:buffer",
72
+ "process",
73
+ "node:process"
74
+ ]
75
+ });
76
+ const code = result.outputFiles[0].text;
77
+ const tempDir = import_node_os.default.tmpdir();
78
+ const tempFileName = `axiom-ai-prompt-${Date.now()}-${Math.random().toString(36).substring(2)}.mjs`;
79
+ const tempFilePath = import_node_path.default.join(tempDir, tempFileName);
80
+ try {
81
+ await import_promises.default.writeFile(tempFilePath, code, "utf-8");
82
+ const moduleUrl = `file://${tempFilePath}`;
83
+ const module2 = await import(moduleUrl);
84
+ return module2.default || module2;
85
+ } finally {
86
+ try {
87
+ await import_promises.default.unlink(tempFilePath);
88
+ } catch (error) {
89
+ console.warn(`Failed to clean up temporary file ${tempFilePath}:`, error);
90
+ }
91
+ }
92
+ }
93
+ function convertTypeBoxArgumentsToJsonSchema(arguments_) {
94
+ if (!arguments_ || typeof arguments_ !== "object") {
95
+ return {
96
+ type: "object",
97
+ properties: {},
98
+ required: [],
99
+ additionalProperties: false
100
+ };
101
+ }
102
+ const properties = {};
103
+ const required = [];
104
+ for (const [key, value] of Object.entries(arguments_)) {
105
+ if (value && typeof value === "object" && value.type) {
106
+ properties[key] = {
107
+ type: value.type,
108
+ ...value.description && { description: value.description },
109
+ ...value.enum && { enum: value.enum },
110
+ ...value.items && { items: value.items },
111
+ ...value.properties && { properties: value.properties },
112
+ ...value.required && { required: value.required }
113
+ };
114
+ required.push(key);
115
+ }
116
+ }
117
+ return {
118
+ type: "object",
119
+ properties,
120
+ required,
121
+ additionalProperties: false
122
+ };
123
+ }
124
+ function extractPromptFromModule(moduleContent, filePath) {
125
+ const fileBaseName = (0, import_node_path2.basename)(filePath, ".ts");
126
+ const defaultId = fileBaseName.toLowerCase().replace(/[^a-z0-9]/g, "-");
127
+ const convertedArguments = convertTypeBoxArgumentsToJsonSchema(moduleContent.arguments);
128
+ const prompt = {
129
+ name: moduleContent.name || "Untitled Prompt",
130
+ slug: moduleContent.slug || defaultId,
131
+ messages: moduleContent.messages || [],
132
+ model: moduleContent.model,
133
+ options: moduleContent.options,
134
+ arguments: convertedArguments,
135
+ id: moduleContent.id || defaultId,
136
+ version: moduleContent.version || "1.0.0",
137
+ // Optional fields from API response
138
+ ...moduleContent.promptId && { promptId: moduleContent.promptId },
139
+ ...moduleContent.description && { description: moduleContent.description }
140
+ };
141
+ if (!prompt.name) {
142
+ throw new Error("Prompt must have a name");
143
+ }
144
+ if (!prompt.slug) {
145
+ throw new Error("Prompt must have a slug");
146
+ }
147
+ if (!Array.isArray(prompt.messages)) {
148
+ throw new Error("Prompt messages must be an array");
149
+ }
150
+ if (!prompt.model) {
151
+ throw new Error("Prompt must have a model");
152
+ }
153
+ return prompt;
154
+ }
155
+ function transformJsonSchemaToTypeBox(schema) {
156
+ if (schema.type === "string") {
157
+ if (schema.enum && Array.isArray(schema.enum)) {
158
+ const literals = schema.enum.map((value) => `Type.Literal('${value}')`).join(", ");
159
+ const options = schema.description ? `, { description: '${schema.description}' }` : "";
160
+ return `Type.Union([${literals}]${options})`;
161
+ } else {
162
+ const options = schema.description ? `{ description: '${schema.description}' }` : "";
163
+ return `Type.String(${options})`;
164
+ }
165
+ }
166
+ if (schema.type === "number" || schema.type === "integer") {
167
+ const typeMethod = schema.type === "integer" ? "Integer" : "Number";
168
+ const options = schema.description ? `{ description: '${schema.description}' }` : "";
169
+ return `Type.${typeMethod}(${options})`;
170
+ }
171
+ if (schema.type === "boolean") {
172
+ const options = schema.description ? `{ description: '${schema.description}' }` : "";
173
+ return `Type.Boolean(${options})`;
174
+ }
175
+ if (schema.type === "array") {
176
+ const itemsType = schema.items ? transformJsonSchemaToTypeBox(schema.items) : "Type.String()";
177
+ const options = schema.description ? `, { description: '${schema.description}' }` : "";
178
+ return `Type.Array(${itemsType}${options})`;
179
+ }
180
+ if (schema.type === "object") {
181
+ if (schema.properties) {
182
+ const props = Object.entries(schema.properties).map(([key, value]) => {
183
+ const isRequired = schema.required && schema.required.includes(key);
184
+ const propType = transformJsonSchemaToTypeBox(value);
185
+ return ` ${key}: ${isRequired ? propType : `Type.Optional(${propType})`}`;
186
+ }).join(",\n");
187
+ const options = schema.description ? `, { description: '${schema.description}' }` : "";
188
+ return `Type.Object({
189
+ ${props}
190
+ }${options})`;
191
+ } else {
192
+ const options = schema.description ? `{ description: '${schema.description}' }` : "";
193
+ return `Type.Object({}${options ? `, ${options}` : ""})`;
194
+ }
195
+ }
196
+ return "Type.String()";
197
+ }
198
+ function generatePromptFileFromApiResponse(apiResponse) {
199
+ const { prompt, version } = apiResponse;
200
+ const { data, options } = version;
201
+ let argumentsCode = "{}";
202
+ if (data.arguments && data.arguments.properties) {
203
+ const argEntries = Object.entries(data.arguments.properties).map(([key, schema]) => {
204
+ const isRequired = data.arguments.required && data.arguments.required.includes(key);
205
+ const typeCode = transformJsonSchemaToTypeBox(schema);
206
+ return ` ${key}: ${isRequired ? typeCode : `Type.Optional(${typeCode})`}`;
207
+ }).join(",\n");
208
+ if (argEntries) {
209
+ argumentsCode = `{
210
+ ${argEntries}
211
+ }`;
212
+ }
213
+ }
214
+ return `import { Type } from 'axiom';
215
+
216
+ export default {
217
+ name: '${prompt.name}',
218
+ slug: '${prompt.slug}',
219
+ description: '${prompt.description || ""}',
220
+ messages: [${data.messages.map(
221
+ (msg) => `
222
+ {
223
+ role: '${msg.role}',
224
+ content: '${msg.content.replace(/'/g, "\\'")}',
225
+ }`
226
+ ).join(",")}
227
+ ],
228
+ model: '${data.model || "gpt-4"}',
229
+ options: {
230
+ ${options ? Object.entries(options).map(([key, value]) => ` ${key}: ${value}`).join(",\n") : ""}
231
+ },
232
+ arguments: ${argumentsCode},
233
+ version: '${version.version}',
234
+ promptId: '${prompt.promptId}',
235
+ };
236
+ `;
237
+ }
238
+
239
+ // src/commands/push.ts
240
+ var import_promises2 = __toESM(require("fs/promises"), 1);
241
+ var import_node_readline = __toESM(require("readline"), 1);
242
+ async function askConfirmation(message) {
243
+ const rl = import_node_readline.default.createInterface({
244
+ input: process.stdin,
245
+ output: process.stdout
246
+ });
247
+ return new Promise((resolve2) => {
248
+ rl.question(`${message} (y/N): `, (answer) => {
249
+ rl.close();
250
+ resolve2(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
251
+ });
252
+ });
253
+ }
254
+ var loadPushCommand = (program2) => {
255
+ const push = new import_commander.Command("push").description("Push a new version of an object").argument(
256
+ "<object>",
257
+ "The object to push, could be a prompt, en eval, a monitor, a dashboard, etc."
258
+ ).option("--prod", "Adds the production tag to the prompt").option("--yes", "Automatically confirm overwriting the file with server response").action(async (filePath, options) => {
259
+ let content = null;
260
+ if (!filePath.endsWith(".prompt.ts")) {
261
+ console.error("Prompt files must end with .prompt.ts");
262
+ process.exit(1);
263
+ }
264
+ try {
265
+ const moduleContent = await loadPromptModule(filePath);
266
+ const promptData = extractPromptFromModule(moduleContent, filePath);
267
+ content = promptData;
268
+ console.log(`Transpiled prompt: ${promptData.name} (${promptData.slug})`);
269
+ } catch (error) {
270
+ console.error("Failed to transpile prompt file:", error);
271
+ process.exit(1);
272
+ }
273
+ if (!content) {
274
+ console.error("No content found");
275
+ process.exit(1);
276
+ }
277
+ let shouldProceed = options.yes;
278
+ if (!shouldProceed) {
279
+ shouldProceed = await askConfirmation(
280
+ `This will push "${content.name}" to Axiom and overwrite ${filePath}, are you sure you want to continue?`
281
+ );
282
+ }
283
+ if (!shouldProceed) {
284
+ console.log("Push operation cancelled.");
285
+ process.exit(0);
286
+ }
287
+ try {
288
+ const response = await fetch(`${process.env.AXIOM_URL}/v1/prompts`, {
289
+ method: "POST",
290
+ headers: {
291
+ Authorization: `Bearer ${process.env.AXIOM_TOKEN}`,
292
+ "Content-Type": "application/json",
293
+ "x-axiom-client": "axiom-ai-cli",
294
+ "x-axiom-check": "good"
295
+ },
296
+ body: JSON.stringify({
297
+ ...content,
298
+ tags: options.yes ? ["production"] : []
299
+ })
300
+ });
301
+ if (!response.ok) {
302
+ try {
303
+ const errorText = await response.clone().json();
304
+ console.error(`Failed to fetch prompt: ${response.status} ${response.statusText}`);
305
+ console.error(JSON.stringify(errorText, null, 2));
306
+ process.exit(1);
307
+ } catch (_error) {
308
+ const errorText = await response.clone().text();
309
+ console.error(`Failed to fetch prompt: ${response.status} ${response.statusText}`);
310
+ console.error(errorText);
311
+ process.exit(1);
312
+ }
313
+ }
314
+ const apiResponse = await response.json();
315
+ console.log(
316
+ `Successfully pushed prompt: ${apiResponse.prompt.name} (${apiResponse.prompt.slug})`
317
+ );
318
+ console.log(`Version: ${apiResponse.version.version}`);
319
+ const updatedTsContent = generatePromptFileFromApiResponse(apiResponse);
320
+ await import_promises2.default.writeFile(filePath, updatedTsContent, "utf-8");
321
+ console.log(`Successfully updated ${filePath}`);
322
+ } catch (error) {
323
+ console.error("Failed to push prompt:", error);
324
+ process.exit(1);
325
+ }
326
+ });
327
+ program2.addCommand(push);
328
+ };
329
+
330
+ // src/commands/pull.ts
331
+ var import_commander2 = require("commander");
332
+ var fs3 = __toESM(require("fs/promises"), 1);
333
+ var path2 = __toESM(require("path"), 1);
334
+ var loadPullCommand = (program2) => {
335
+ const pull = new import_commander2.Command("pull").description("Pull a version of an object").argument(
336
+ "<slug>",
337
+ "The object to pull, could be a prompt, en eval, a monitor, a dashboard, etc."
338
+ ).option("--version <version>", "The version to pull, default: latest", "latest").option("--output <path>", "Output file path (optional, defaults to <slug>.prompt.ts)").action(async (slug, options) => {
339
+ try {
340
+ console.log(`Pulling prompt: ${slug} (version: ${options.version})`);
341
+ const url = `${process.env.AXIOM_URL}/v1/prompts/${slug}`;
342
+ const response = await fetch(url, {
343
+ method: "GET",
344
+ headers: {
345
+ Authorization: `Bearer ${process.env.AXIOM_TOKEN}`,
346
+ "Content-Type": "application/json",
347
+ "x-axiom-client": "axiom-ai-cli",
348
+ "x-axiom-check": "good"
349
+ }
350
+ });
351
+ if (!response.ok) {
352
+ try {
353
+ const errorText = await response.clone().json();
354
+ console.error(`Failed to fetch prompt: ${response.status} ${response.statusText}`);
355
+ console.error(JSON.stringify(errorText, null, 2));
356
+ process.exit(1);
357
+ } catch (_error) {
358
+ const errorText = await response.clone().text();
359
+ console.error(`Failed to fetch prompt: ${response.status} ${response.statusText}`);
360
+ console.error(errorText);
361
+ process.exit(1);
362
+ }
363
+ }
364
+ const apiResponse = await response.json();
365
+ const tsContent = generatePromptFileFromApiResponse(apiResponse);
366
+ const outputPath = options.output || `${slug}.prompt.ts`;
367
+ const fullPath = path2.resolve(outputPath);
368
+ await fs3.writeFile(fullPath, tsContent, "utf-8");
369
+ console.log(`Successfully generated prompt file: ${fullPath}`);
370
+ console.log(`Prompt: ${apiResponse.prompt.name} (${apiResponse.prompt.slug})`);
371
+ console.log(`Version: ${apiResponse.version.version}`);
372
+ } catch (error) {
373
+ console.error("Failed to pull prompt:", error);
374
+ process.exit(1);
375
+ }
376
+ });
377
+ program2.addCommand(pull);
378
+ };
379
+
380
+ // src/commands/run.ts
381
+ var import_commander3 = require("commander");
382
+
383
+ // src/evals/run-vitest.ts
384
+ var import_node = require("vitest/node");
385
+
386
+ // src/evals/reporter.ts
387
+ var AxiomReporter = class {
388
+ onTestSuiteReady(_testSuite) {
389
+ }
390
+ onTestSuiteResult(testSuite) {
391
+ for (const test of testSuite.children.array()) {
392
+ if (test.type !== "test") continue;
393
+ const testMeta = test.meta();
394
+ if (!testMeta.eval) {
395
+ return;
396
+ }
397
+ const scores = [];
398
+ for (const s of Object.entries(testMeta.eval.scores)) {
399
+ scores.push({ name: s[1].name, score: s[1].score });
400
+ }
401
+ }
402
+ }
403
+ async onTestRunEnd(_testModules, _errors, _reason) {
404
+ }
405
+ };
406
+
407
+ // src/evals/instrument.ts
408
+ var import_sdk_trace_node = require("@opentelemetry/sdk-trace-node");
409
+ var import_resources = require("@opentelemetry/resources");
410
+ var import_exporter_trace_otlp_http = require("@opentelemetry/exporter-trace-otlp-http");
411
+ var import_api = require("@opentelemetry/api");
412
+ var collectorOptions = {
413
+ url: process.env.AXIOM_URL ? `${process.env.AXIOM_URL}/v1/traces` : "https://api.axiom.co/v1/traces",
414
+ // Axiom API endpoint for trace data
415
+ headers: {
416
+ Authorization: `Bearer ${process.env.AXIOM_TOKEN}`,
417
+ // Replace API_TOKEN with your actual API token
418
+ "X-Axiom-Dataset": process.env.AXIOM_DATASET || ""
419
+ // Replace DATASET_NAME with your dataset
420
+ },
421
+ concurrencyLimit: 10
422
+ // an optional limit on pending requests
423
+ };
424
+ var exporter = new import_exporter_trace_otlp_http.OTLPTraceExporter(collectorOptions);
425
+ var processor = new import_sdk_trace_node.BatchSpanProcessor(exporter, {
426
+ maxQueueSize: 2048,
427
+ maxExportBatchSize: 512,
428
+ scheduledDelayMillis: 5e3,
429
+ exportTimeoutMillis: 3e4
430
+ });
431
+ var provider = new import_sdk_trace_node.NodeTracerProvider({
432
+ resource: (0, import_resources.resourceFromAttributes)({
433
+ ["service.name"]: "axiom-ai",
434
+ ["service.version"]: "1.0.0"
435
+ }),
436
+ spanProcessors: [processor]
437
+ });
438
+ provider.register();
439
+ var tracer = import_api.trace.getTracer("axiom-ai", "1.0.0");
440
+ var flush = async () => {
441
+ await provider.forceFlush();
442
+ };
443
+
444
+ // src/evals/run-vitest.ts
445
+ var runVitest = async (file) => {
446
+ const vi = await (0, import_node.createVitest)("test", {
447
+ // root: process.cwd(),
448
+ mode: "test",
449
+ include: [file ? file : "**/*.eval.ts"],
450
+ reporters: ["verbose", new AxiomReporter()],
451
+ environment: "node",
452
+ browser: void 0
453
+ });
454
+ await vi.start();
455
+ const dispose = (0, import_node.registerConsoleShortcuts)(vi, process.stdin, process.stdout);
456
+ if (!vi.shouldKeepServer()) {
457
+ dispose();
458
+ await flush();
459
+ await vi.close();
460
+ process.exit(0);
461
+ }
462
+ await flush();
463
+ };
464
+
465
+ // src/commands/run.ts
466
+ var loadRunCommand = (program2) => {
467
+ return program2.addCommand(
468
+ new import_commander3.Command("run").description("run evals locally").argument("<path>", "Path to an eval test file, should be in the form of name.eval.ts").action(async (file) => {
469
+ if (!process.env.AXIOM_URL || !process.env.AXIOM_TOKEN || !process.env.AXIOM_DATASET) {
470
+ throw new Error("AXIOM_URL, AXIOM_TOKEN, and AXIOM_DATASET must be set");
471
+ }
472
+ await runVitest(file);
473
+ })
474
+ );
475
+ };
476
+
477
+ // src/bin.ts
478
+ var { loadEnvConfig } = import_env.default;
479
+ loadEnvConfig(process.cwd());
480
+ var program = new import_commander4.Command();
481
+ program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("1.0.0");
482
+ loadPushCommand(program);
483
+ loadPullCommand(program);
484
+ loadRunCommand(program);
485
+ program.parse();
486
+ //# sourceMappingURL=bin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bin.ts","../src/commands/push.ts","../src/transpiler.ts","../src/commands/pull.ts","../src/commands/run.ts","../src/evals/run-vitest.ts","../src/evals/reporter.ts","../src/evals/instrument.ts"],"sourcesContent":["#!/usr/bin/env node\n\n// Load environment variables using @next/env\nimport pkg from '@next/env';\nconst { loadEnvConfig } = pkg;\n\n// Load .env files from the current working directory\nloadEnvConfig(process.cwd());\n\nimport { Command } from 'commander';\nimport { loadPushCommand } from './commands/push';\nimport { loadPullCommand } from './commands/pull';\nimport { loadRunCommand } from './commands/run';\n\nconst program = new Command();\n\nprogram\n .name('axiom')\n .description(\"Axiom's CLI to manage your objects and run evals\")\n .version(__SDK_VERSION__);\n\nloadPushCommand(program);\nloadPullCommand(program);\nloadRunCommand(program);\n\nprogram.parse();\n","import { Command } from 'commander';\nimport {\n loadPromptModule,\n extractPromptFromModule,\n generatePromptFileFromApiResponse,\n} from '../transpiler';\nimport type { Prompt } from '../types';\nimport fs from 'node:fs/promises';\nimport readline from 'node:readline';\n\nasync function askConfirmation(message: string): Promise<boolean> {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise((resolve) => {\n rl.question(`${message} (y/N): `, (answer) => {\n rl.close();\n resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');\n });\n });\n}\n\nexport const loadPushCommand = (program: Command) => {\n const push = new Command('push')\n .description('Push a new version of an object')\n .argument(\n '<object>',\n 'The object to push, could be a prompt, en eval, a monitor, a dashboard, etc.',\n )\n .option('--prod', 'Adds the production tag to the prompt')\n .option('--yes', 'Automatically confirm overwriting the file with server response')\n .action(async (filePath: string, options: { yes?: boolean; prod?: boolean }) => {\n let content: Prompt | null = null;\n if (!filePath.endsWith('.prompt.ts')) {\n console.error('Prompt files must end with .prompt.ts');\n process.exit(1);\n }\n\n try {\n const moduleContent = await loadPromptModule(filePath);\n const promptData = extractPromptFromModule(moduleContent, filePath);\n\n content = promptData;\n\n console.log(`Transpiled prompt: ${promptData.name} (${promptData.slug})`);\n } catch (error) {\n console.error('Failed to transpile prompt file:', error);\n process.exit(1);\n }\n\n if (!content) {\n console.error('No content found');\n process.exit(1);\n }\n\n let shouldProceed = options.yes;\n if (!shouldProceed) {\n shouldProceed = await askConfirmation(\n `This will push \"${content.name}\" to Axiom and overwrite ${filePath}, are you sure you want to continue?`,\n );\n }\n\n if (!shouldProceed) {\n console.log('Push operation cancelled.');\n process.exit(0);\n }\n\n try {\n const response = await fetch(`${process.env.AXIOM_URL}/v1/prompts`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${process.env.AXIOM_TOKEN}`,\n 'Content-Type': 'application/json',\n 'x-axiom-client': 'axiom-ai-cli',\n 'x-axiom-check': 'good',\n },\n body: JSON.stringify({\n ...content,\n tags: options.yes ? ['production'] : [],\n }),\n });\n\n if (!response.ok) {\n try {\n const errorText = await response.clone().json();\n console.error(`Failed to fetch prompt: ${response.status} ${response.statusText}`);\n console.error(JSON.stringify(errorText, null, 2));\n process.exit(1);\n } catch (_error) {\n const errorText = await response.clone().text();\n console.error(`Failed to fetch prompt: ${response.status} ${response.statusText}`);\n console.error(errorText);\n process.exit(1);\n }\n }\n\n const apiResponse = await response.json();\n console.log(\n `Successfully pushed prompt: ${apiResponse.prompt.name} (${apiResponse.prompt.slug})`,\n );\n console.log(`Version: ${apiResponse.version.version}`);\n\n const updatedTsContent = generatePromptFileFromApiResponse(apiResponse);\n\n await fs.writeFile(filePath, updatedTsContent, 'utf-8');\n\n console.log(`Successfully updated ${filePath}`);\n } catch (error) {\n console.error('Failed to push prompt:', error);\n process.exit(1);\n }\n });\n\n program.addCommand(push);\n};\n","import { build } from 'esbuild';\nimport os from 'node:os';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { basename } from 'node:path';\nimport type { Prompt } from './types';\n\nexport async function loadPromptModule(filePath: string) {\n const result = await build({\n entryPoints: [filePath],\n bundle: true,\n write: false,\n platform: 'node',\n format: 'esm',\n target: ['node18'],\n sourcemap: false,\n external: [\n // Only Node.js built-ins should be external\n 'fs',\n 'fs/promises',\n 'node:fs',\n 'node:fs/promises',\n 'readline',\n 'node:readline',\n 'path',\n 'node:path',\n 'os',\n 'node:os',\n 'url',\n 'node:url',\n 'util',\n 'node:util',\n 'crypto',\n 'node:crypto',\n 'events',\n 'node:events',\n 'stream',\n 'node:stream',\n 'buffer',\n 'node:buffer',\n 'process',\n 'node:process',\n ],\n });\n\n const code = result.outputFiles[0].text;\n\n // Create a unique temporary file\n const tempDir = os.tmpdir();\n const tempFileName = `axiom-ai-prompt-${Date.now()}-${Math.random().toString(36).substring(2)}.mjs`;\n const tempFilePath = path.join(tempDir, tempFileName);\n\n try {\n // Write the bundled code to temporary file\n await fs.writeFile(tempFilePath, code, 'utf-8');\n\n // Dynamically import the temporary module\n const moduleUrl = `file://${tempFilePath}`;\n const module = await import(moduleUrl);\n\n return module.default || module;\n } finally {\n // Clean up the temporary file\n try {\n await fs.unlink(tempFilePath);\n } catch (error) {\n // Ignore cleanup errors - temp files will be cleaned up by OS eventually\n console.warn(`Failed to clean up temporary file ${tempFilePath}:`, error);\n }\n }\n}\n\n/**\n * Convert TypeBox arguments to JSON Schema format expected by the API\n */\nfunction convertTypeBoxArgumentsToJsonSchema(arguments_: Record<string, any>): any {\n if (!arguments_ || typeof arguments_ !== 'object') {\n return {\n type: 'object',\n properties: {},\n required: [],\n additionalProperties: false,\n };\n }\n\n const properties: Record<string, any> = {};\n const required: string[] = [];\n\n for (const [key, value] of Object.entries(arguments_)) {\n if (value && typeof value === 'object' && value.type) {\n // This is a TypeBox schema object that has been serialized\n properties[key] = {\n type: value.type,\n ...(value.description && { description: value.description }),\n ...(value.enum && { enum: value.enum }),\n ...(value.items && { items: value.items }),\n ...(value.properties && { properties: value.properties }),\n ...(value.required && { required: value.required }),\n };\n\n // For now, treat all arguments as required (this matches the existing behavior)\n // In the future, we could detect Type.Optional() usage\n required.push(key);\n }\n }\n\n return {\n type: 'object',\n properties,\n required,\n additionalProperties: false,\n };\n}\n\nexport function extractPromptFromModule(moduleContent: any, filePath: string): Prompt {\n // Generate ID from file path if not provided\n const fileBaseName = basename(filePath, '.ts'); // Remove .ts extension\n const defaultId = fileBaseName.toLowerCase().replace(/[^a-z0-9]/g, '-');\n\n // Convert TypeBox arguments to JSON Schema format\n const convertedArguments = convertTypeBoxArgumentsToJsonSchema(moduleContent.arguments);\n\n // Extract and validate required fields from the module content\n const prompt: Prompt = {\n name: moduleContent.name || 'Untitled Prompt',\n slug: moduleContent.slug || defaultId,\n messages: moduleContent.messages || [],\n model: moduleContent.model,\n options: moduleContent.options,\n arguments: convertedArguments,\n id: moduleContent.id || defaultId,\n version: moduleContent.version || '1.0.0',\n // Optional fields from API response\n ...(moduleContent.promptId && { promptId: moduleContent.promptId }),\n ...(moduleContent.description && { description: moduleContent.description }),\n };\n\n // Validate required fields\n if (!prompt.name) {\n throw new Error('Prompt must have a name');\n }\n if (!prompt.slug) {\n throw new Error('Prompt must have a slug');\n }\n if (!Array.isArray(prompt.messages)) {\n throw new Error('Prompt messages must be an array');\n }\n\n if (!prompt.model) {\n throw new Error('Prompt must have a model');\n }\n\n return prompt;\n}\n\n/**\n * Transform JSON Schema to TypeBox/Template validator format\n */\nexport function transformJsonSchemaToTypeBox(schema: any): string {\n if (schema.type === 'string') {\n if (schema.enum && Array.isArray(schema.enum)) {\n // Handle enum as Union of Literals\n const literals = schema.enum.map((value: string) => `Type.Literal('${value}')`).join(', ');\n const options = schema.description ? `, { description: '${schema.description}' }` : '';\n return `Type.Union([${literals}]${options})`;\n } else {\n // Regular string\n const options = schema.description ? `{ description: '${schema.description}' }` : '';\n return `Type.String(${options})`;\n }\n }\n\n if (schema.type === 'number' || schema.type === 'integer') {\n const typeMethod = schema.type === 'integer' ? 'Integer' : 'Number';\n const options = schema.description ? `{ description: '${schema.description}' }` : '';\n return `Type.${typeMethod}(${options})`;\n }\n\n if (schema.type === 'boolean') {\n const options = schema.description ? `{ description: '${schema.description}' }` : '';\n return `Type.Boolean(${options})`;\n }\n\n if (schema.type === 'array') {\n const itemsType = schema.items ? transformJsonSchemaToTypeBox(schema.items) : 'Type.String()';\n const options = schema.description ? `, { description: '${schema.description}' }` : '';\n return `Type.Array(${itemsType}${options})`;\n }\n\n if (schema.type === 'object') {\n if (schema.properties) {\n const props = Object.entries(schema.properties)\n .map(([key, value]: [string, any]) => {\n const isRequired = schema.required && schema.required.includes(key);\n const propType = transformJsonSchemaToTypeBox(value);\n return ` ${key}: ${isRequired ? propType : `Type.Optional(${propType})`}`;\n })\n .join(',\\n');\n\n const options = schema.description ? `, { description: '${schema.description}' }` : '';\n return `Type.Object({\\n${props}\\n }${options})`;\n } else {\n const options = schema.description ? `{ description: '${schema.description}' }` : '';\n return `Type.Object({}${options ? `, ${options}` : ''})`;\n }\n }\n\n // Fallback for unknown types\n return 'Type.String()';\n}\n\n/**\n * Generate TypeScript prompt file content from API response\n */\nexport function generatePromptFileFromApiResponse(apiResponse: any): string {\n const { prompt, version } = apiResponse;\n const { data, options } = version;\n\n // Transform arguments from JSON Schema to TypeBox format\n let argumentsCode = '{}';\n if (data.arguments && data.arguments.properties) {\n const argEntries = Object.entries(data.arguments.properties)\n .map(([key, schema]: [string, any]) => {\n const isRequired = data.arguments.required && data.arguments.required.includes(key);\n const typeCode = transformJsonSchemaToTypeBox(schema);\n return ` ${key}: ${isRequired ? typeCode : `Type.Optional(${typeCode})`}`;\n })\n .join(',\\n');\n\n if (argEntries) {\n argumentsCode = `{\\n${argEntries}\\n }`;\n }\n }\n\n // Generate the TypeScript file content\n return `import { Type } from 'axiom';\n\nexport default {\n name: '${prompt.name}',\n slug: '${prompt.slug}',\n description: '${prompt.description || ''}',\n messages: [${data.messages\n .map(\n (msg: any) => `\n {\n role: '${msg.role}',\n content: '${msg.content.replace(/'/g, \"\\\\'\")}',\n }`,\n )\n .join(',')}\n ],\n model: '${data.model || 'gpt-4'}',\n options: {\n${\n options\n ? Object.entries(options)\n .map(([key, value]) => ` ${key}: ${value}`)\n .join(',\\n')\n : ''\n}\n },\n arguments: ${argumentsCode},\n version: '${version.version}',\n promptId: '${prompt.promptId}',\n};\n`;\n}\n","import { Command } from 'commander';\nimport { generatePromptFileFromApiResponse } from '../transpiler';\nimport * as fs from 'fs/promises';\nimport * as path from 'path';\n\nexport const loadPullCommand = (program: Command) => {\n const pull = new Command('pull')\n .description('Pull a version of an object')\n .argument(\n '<slug>',\n 'The object to pull, could be a prompt, en eval, a monitor, a dashboard, etc.',\n )\n .option('--version <version>', 'The version to pull, default: latest', 'latest')\n .option('--output <path>', 'Output file path (optional, defaults to <slug>.prompt.ts)')\n .action(async (slug: string, options: { version: string; output?: string }) => {\n try {\n console.log(`Pulling prompt: ${slug} (version: ${options.version})`);\n\n const url = `${process.env.AXIOM_URL}/v1/prompts/${slug}`;\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${process.env.AXIOM_TOKEN}`,\n 'Content-Type': 'application/json',\n 'x-axiom-client': 'axiom-ai-cli',\n 'x-axiom-check': 'good',\n },\n });\n\n if (!response.ok) {\n try {\n const errorText = await response.clone().json();\n console.error(`Failed to fetch prompt: ${response.status} ${response.statusText}`);\n console.error(JSON.stringify(errorText, null, 2));\n process.exit(1);\n } catch (_error) {\n const errorText = await response.clone().text();\n console.error(`Failed to fetch prompt: ${response.status} ${response.statusText}`);\n console.error(errorText);\n process.exit(1);\n }\n }\n\n const apiResponse = await response.json();\n\n const tsContent = generatePromptFileFromApiResponse(apiResponse);\n\n const outputPath = options.output || `${slug}.prompt.ts`;\n const fullPath = path.resolve(outputPath);\n\n await fs.writeFile(fullPath, tsContent, 'utf-8');\n\n console.log(`Successfully generated prompt file: ${fullPath}`);\n console.log(`Prompt: ${apiResponse.prompt.name} (${apiResponse.prompt.slug})`);\n console.log(`Version: ${apiResponse.version.version}`);\n } catch (error) {\n console.error('Failed to pull prompt:', error);\n process.exit(1);\n }\n });\n\n program.addCommand(pull);\n};\n","import { Command } from 'commander';\nimport { runVitest } from '../evals/run-vitest';\n\nexport const loadRunCommand = (program: Command) => {\n return program.addCommand(\n new Command('run')\n .description('run evals locally')\n .argument('<path>', 'Path to an eval test file, should be in the form of name.eval.ts')\n .action(async (file: string) => {\n if (!process.env.AXIOM_URL || !process.env.AXIOM_TOKEN || !process.env.AXIOM_DATASET) {\n throw new Error('AXIOM_URL, AXIOM_TOKEN, and AXIOM_DATASET must be set');\n }\n await runVitest(file);\n }),\n );\n};\n","import { createVitest, registerConsoleShortcuts } from 'vitest/node';\nimport { AxiomReporter } from './reporter';\nimport { flush } from './instrument';\n\nexport const runVitest = async (file: string) => {\n const vi = await createVitest('test', {\n // root: process.cwd(),\n mode: 'test',\n include: [file ? file : '**/*.eval.ts'],\n reporters: ['verbose', new AxiomReporter()],\n environment: 'node',\n browser: undefined,\n });\n\n await vi.start();\n\n const dispose = registerConsoleShortcuts(vi, process.stdin, process.stdout);\n\n if (!vi.shouldKeepServer()) {\n dispose();\n await flush();\n await vi.close();\n process.exit(0);\n }\n\n await flush();\n};\n","import type { SerializedError } from 'vitest';\nimport type { Reporter, TestModule, TestRunEndReason, TestSuite } from 'vitest/node.js';\nimport type { TaskMeta } from 'vitest/index.cjs';\nimport type { EvalReport } from './eval';\n\n/**\n * Custom Vitest reporter for Axiom AI evaluations.\n *\n * This reporter collects evaluation results and scores from tests\n * and processes them for further analysis and reporting.\n *\n * @experimental This API is experimental and may change in future versions.\n */\nexport class AxiomReporter implements Reporter {\n onTestSuiteReady(_testSuite: TestSuite) {}\n\n onTestSuiteResult(testSuite: TestSuite) {\n for (const test of testSuite.children.array()) {\n if (test.type !== 'test') continue;\n const testMeta = test.meta() as TaskMeta & { eval: EvalReport };\n\n if (!testMeta.eval) {\n return;\n }\n\n // build scores array\n const scores: { name: string; score: number }[] = [];\n for (const s of Object.entries(testMeta.eval.scores)) {\n scores.push({ name: s[1].name, score: s[1].score });\n }\n }\n }\n\n async onTestRunEnd(\n _testModules: ReadonlyArray<TestModule>,\n _errors: ReadonlyArray<SerializedError>,\n _reason: TestRunEndReason,\n ) {}\n}\n","import { BatchSpanProcessor, NodeTracerProvider } from '@opentelemetry/sdk-trace-node';\nimport { resourceFromAttributes } from '@opentelemetry/resources';\nimport { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\nimport { trace, type Context, type SpanOptions } from '@opentelemetry/api';\n\nconst collectorOptions = {\n url: process.env.AXIOM_URL\n ? `${process.env.AXIOM_URL}/v1/traces`\n : 'https://api.axiom.co/v1/traces', // Axiom API endpoint for trace data\n headers: {\n Authorization: `Bearer ${process.env.AXIOM_TOKEN}`, // Replace API_TOKEN with your actual API token\n 'X-Axiom-Dataset': process.env.AXIOM_DATASET || '', // Replace DATASET_NAME with your dataset\n },\n concurrencyLimit: 10, // an optional limit on pending requests\n};\n\n// export const consoleExporter = new ConsoleSpanExporter()\nexport const exporter = new OTLPTraceExporter(collectorOptions);\n\nconst processor = new BatchSpanProcessor(exporter, {\n maxQueueSize: 2048,\n maxExportBatchSize: 512,\n scheduledDelayMillis: 5000,\n exportTimeoutMillis: 30000,\n});\n\nconst provider = new NodeTracerProvider({\n resource: resourceFromAttributes({\n ['service.name']: 'axiom-ai',\n ['service.version']: __SDK_VERSION__,\n }),\n spanProcessors: [processor],\n});\n\nprovider.register();\n\n// Create a shared tracer instance\nconst tracer = trace.getTracer('axiom-ai', __SDK_VERSION__);\n\nexport const flush = async () => {\n await provider.forceFlush();\n};\n\nexport const startSpan = (name: string, opts: SpanOptions, context?: Context) => {\n return tracer.startSpan(name, opts, context);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,iBAAgB;AAMhB,IAAAA,oBAAwB;;;ACTxB,uBAAwB;;;ACAxB,qBAAsB;AACtB,qBAAe;AACf,sBAAe;AACf,uBAAiB;AACjB,IAAAC,oBAAyB;AAGzB,eAAsB,iBAAiB,UAAkB;AACvD,QAAM,SAAS,UAAM,sBAAM;AAAA,IACzB,aAAa,CAAC,QAAQ;AAAA,IACtB,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,QAAQ,CAAC,QAAQ;AAAA,IACjB,WAAW;AAAA,IACX,UAAU;AAAA;AAAA,MAER;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA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I,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ,IAAI,eAAe,CAAC,QAAQ,IAAI,eAAe;AACpF,cAAM,IAAI,MAAM,uDAAuD;AAAA,MACzE;AACA,YAAM,UAAU,IAAI;AAAA,IACtB,CAAC;AAAA,EACL;AACF;;;AJXA,IAAM,EAAE,cAAc,IAAI,WAAAC;AAG1B,cAAc,QAAQ,IAAI,CAAC;AAO3B,IAAM,UAAU,IAAI,0BAAQ;AAE5B,QACG,KAAK,OAAO,EACZ,YAAY,kDAAkD,EAC9D,QAAQ,OAAe;AAE1B,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,eAAe,OAAO;AAEtB,QAAQ,MAAM;","names":["import_commander","import_node_path","os","path","fs","module","import_promises","readline","resolve","program","fs","import_commander","fs","path","program","import_commander","program","pkg"]}
package/dist/bin.d.cts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/bin.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node