axiom 0.9.0 → 0.11.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/README.md +2 -2
- package/dist/bin.cjs +22 -12
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +10 -10
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-VJQQJFVJ.js → chunk-EF32T5MG.js} +3 -1
- package/dist/chunk-EF32T5MG.js.map +1 -0
- package/dist/{chunk-Y2CPJRWO.js → chunk-NGGNYE5N.js} +3 -3
- package/dist/{chunk-Y2CPJRWO.js.map → chunk-NGGNYE5N.js.map} +1 -1
- package/dist/chunk-NR7XRR3Z.js +35 -0
- package/dist/chunk-NR7XRR3Z.js.map +1 -0
- package/dist/evals.cjs +19 -45
- package/dist/evals.cjs.map +1 -1
- package/dist/evals.d.cts +1 -1
- package/dist/evals.d.ts +1 -1
- package/dist/evals.js +6 -44
- package/dist/evals.js.map +1 -1
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/chunk-CKSTM4QJ.js +0 -25
- package/dist/chunk-CKSTM4QJ.js.map +0 -1
- package/dist/chunk-VJQQJFVJ.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Axiom AI SDK provides an API to wrap your AI calls with observability instrument
|
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
9
|
-
import { axiomAIMiddleware } from 'axiom';
|
|
9
|
+
import { axiomAIMiddleware } from 'axiom/ai';
|
|
10
10
|
import { wrapLanguageModel } from 'ai';
|
|
11
11
|
|
|
12
12
|
const openai = createOpenAI({
|
|
@@ -26,7 +26,7 @@ export const gpt4oMini = wrapLanguageModel({
|
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
import { tool } from 'ai';
|
|
29
|
-
import { wrapTool } from 'axiom';
|
|
29
|
+
import { wrapTool } from 'axiom/ai';
|
|
30
30
|
import { z } from 'zod';
|
|
31
31
|
|
|
32
32
|
const getWeather = tool({
|
package/dist/bin.cjs
CHANGED
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var import_env = __toESM(require("@next/env"), 1);
|
|
28
28
|
var import_commander4 = require("commander");
|
|
29
29
|
|
|
30
|
-
// src/commands/push.ts
|
|
30
|
+
// src/commands/push.command.ts
|
|
31
31
|
var import_commander = require("commander");
|
|
32
32
|
|
|
33
33
|
// src/transpiler.ts
|
|
@@ -211,7 +211,7 @@ ${argEntries}
|
|
|
211
211
|
}`;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
return `import { Type } from 'axiom';
|
|
214
|
+
return `import { Type } from 'axiom/ai';
|
|
215
215
|
|
|
216
216
|
export default {
|
|
217
217
|
name: '${prompt.name}',
|
|
@@ -236,7 +236,7 @@ ${options ? Object.entries(options).map(([key, value]) => ` ${key}: ${value}`
|
|
|
236
236
|
`;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
// src/commands/push.ts
|
|
239
|
+
// src/commands/push.command.ts
|
|
240
240
|
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
241
241
|
var import_node_readline = __toESM(require("readline"), 1);
|
|
242
242
|
async function askConfirmation(message) {
|
|
@@ -327,7 +327,7 @@ var loadPushCommand = (program2) => {
|
|
|
327
327
|
program2.addCommand(push);
|
|
328
328
|
};
|
|
329
329
|
|
|
330
|
-
// src/commands/pull.ts
|
|
330
|
+
// src/commands/pull.command.ts
|
|
331
331
|
var import_commander2 = require("commander");
|
|
332
332
|
var fs3 = __toESM(require("fs/promises"), 1);
|
|
333
333
|
var path2 = __toESM(require("path"), 1);
|
|
@@ -377,17 +377,21 @@ var loadPullCommand = (program2) => {
|
|
|
377
377
|
program2.addCommand(pull);
|
|
378
378
|
};
|
|
379
379
|
|
|
380
|
-
// src/commands/
|
|
380
|
+
// src/commands/eval.command.ts
|
|
381
381
|
var import_commander3 = require("commander");
|
|
382
382
|
|
|
383
383
|
// src/evals/run-vitest.ts
|
|
384
384
|
var import_node = require("vitest/node");
|
|
385
385
|
|
|
386
386
|
// src/evals/reporter.ts
|
|
387
|
+
var import_console_table_printer = require("console-table-printer");
|
|
387
388
|
var AxiomReporter = class {
|
|
388
389
|
onTestSuiteReady(_testSuite) {
|
|
389
390
|
}
|
|
390
391
|
onTestSuiteResult(testSuite) {
|
|
392
|
+
const scoreboard = new import_console_table_printer.Table({
|
|
393
|
+
title: testSuite.name
|
|
394
|
+
});
|
|
391
395
|
for (const test of testSuite.children.array()) {
|
|
392
396
|
if (test.type !== "test") continue;
|
|
393
397
|
const testMeta = test.meta();
|
|
@@ -395,10 +399,16 @@ var AxiomReporter = class {
|
|
|
395
399
|
return;
|
|
396
400
|
}
|
|
397
401
|
const scores = [];
|
|
398
|
-
for (const s of Object.entries(testMeta.eval.scores)) {
|
|
399
|
-
|
|
402
|
+
for (const [_, s] of Object.entries(testMeta.eval.scores)) {
|
|
403
|
+
const roundedScore = Math.round(s.score * 100) / 100;
|
|
404
|
+
scores.push({ name: s.name, score: roundedScore });
|
|
400
405
|
}
|
|
406
|
+
scoreboard.addRow({
|
|
407
|
+
case: testMeta.eval.order,
|
|
408
|
+
...Object.fromEntries(scores.map((s) => [s.name, s.score]))
|
|
409
|
+
});
|
|
401
410
|
}
|
|
411
|
+
scoreboard.printTable();
|
|
402
412
|
}
|
|
403
413
|
async onTestRunEnd(_testModules, _errors, _reason) {
|
|
404
414
|
}
|
|
@@ -431,12 +441,12 @@ var processor = new import_sdk_trace_node.BatchSpanProcessor(exporter, {
|
|
|
431
441
|
var provider = new import_sdk_trace_node.NodeTracerProvider({
|
|
432
442
|
resource: (0, import_resources.resourceFromAttributes)({
|
|
433
443
|
["service.name"]: "axiom-ai",
|
|
434
|
-
["service.version"]: "0.
|
|
444
|
+
["service.version"]: "0.11.0"
|
|
435
445
|
}),
|
|
436
446
|
spanProcessors: [processor]
|
|
437
447
|
});
|
|
438
448
|
provider.register();
|
|
439
|
-
var tracer = import_api.trace.getTracer("axiom-ai", "0.
|
|
449
|
+
var tracer = import_api.trace.getTracer("axiom-ai", "0.11.0");
|
|
440
450
|
var flush = async () => {
|
|
441
451
|
await provider.forceFlush();
|
|
442
452
|
};
|
|
@@ -462,10 +472,10 @@ var runVitest = async (file) => {
|
|
|
462
472
|
await flush();
|
|
463
473
|
};
|
|
464
474
|
|
|
465
|
-
// src/commands/
|
|
475
|
+
// src/commands/eval.command.ts
|
|
466
476
|
var loadRunCommand = (program2) => {
|
|
467
477
|
return program2.addCommand(
|
|
468
|
-
new import_commander3.Command("
|
|
478
|
+
new import_commander3.Command("eval").description("run evals locally").argument("<path>", "Path to an eval test file, should be in the form of *.eval.ts").action(async (file) => {
|
|
469
479
|
if (!process.env.AXIOM_URL || !process.env.AXIOM_TOKEN || !process.env.AXIOM_DATASET) {
|
|
470
480
|
throw new Error("AXIOM_URL, AXIOM_TOKEN, and AXIOM_DATASET must be set");
|
|
471
481
|
}
|
|
@@ -478,7 +488,7 @@ var loadRunCommand = (program2) => {
|
|
|
478
488
|
var { loadEnvConfig } = import_env.default;
|
|
479
489
|
loadEnvConfig(process.cwd());
|
|
480
490
|
var program = new import_commander4.Command();
|
|
481
|
-
program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.
|
|
491
|
+
program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.11.0");
|
|
482
492
|
loadPushCommand(program);
|
|
483
493
|
loadPullCommand(program);
|
|
484
494
|
loadRunCommand(program);
|
package/dist/bin.cjs.map
CHANGED
|
@@ -1 +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;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,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,MAAM;AACd;;;ADvBO,IAAM,iBAAiB,CAACC,aAAqB;AAClD,SAAOA,SAAQ;AAAA,IACb,IAAI,0BAAQ,KAAK,EACd,YAAY,mBAAmB,EAC/B,SAAS,UAAU,kEAAkE,EACrF,OAAO,OAAO,SAAiB;AAC9B,UAAI,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"]}
|
|
1
|
+
{"version":3,"sources":["../src/bin.ts","../src/commands/push.command.ts","../src/transpiler.ts","../src/commands/pull.command.ts","../src/commands/eval.command.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.command';\nimport { loadPullCommand } from './commands/pull.command';\nimport { loadRunCommand } from './commands/eval.command';\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/ai';\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('eval')\n .description('run evals locally')\n .argument('<path>', 'Path to an eval test file, should be in the form of *.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 { Table } from 'console-table-printer';\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 const scoreboard = new Table({\n title: testSuite.name,\n });\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 const roundedScore = Math.round(s.score * 100) / 100; // Number(s.score).toFixed(2)\n scores.push({ name: s.name, score: roundedScore });\n }\n\n scoreboard.addRow({\n case: testMeta.eval.order,\n ...Object.fromEntries(scores.map((s) => [s.name, s.score])),\n });\n }\n\n scoreboard.printTable();\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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ACb,SAAS;AAAA,EACX,CAAC;AAED,QAAM,GAAG,MAAM;AAEf,QAAM,cAAU,sCAAyB,IAAI,QAAQ,OAAO,QAAQ,MAAM;AAE1E,MAAI,CAAC,GAAG,iBAAiB,GAAG;AAC1B,YAAQ;AACR,UAAM,MAAM;AACZ,UAAM,GAAG,MAAM;AACf,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,MAAM;AACd;;;ADvBO,IAAM,iBAAiB,CAACC,aAAqB;AAClD,SAAOA,SAAQ;AAAA,IACb,IAAI,0BAAQ,MAAM,EACf,YAAY,mBAAmB,EAC/B,SAAS,UAAU,+DAA+D,EAClF,OAAO,OAAO,SAAiB;AAC9B,UAAI,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,QAAe;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.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
flush
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NGGNYE5N.js";
|
|
5
5
|
import {
|
|
6
6
|
AxiomReporter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NR7XRR3Z.js";
|
|
8
8
|
import "./chunk-KEXKKQVW.js";
|
|
9
9
|
|
|
10
10
|
// src/bin.ts
|
|
11
11
|
import pkg from "@next/env";
|
|
12
12
|
import { Command as Command4 } from "commander";
|
|
13
13
|
|
|
14
|
-
// src/commands/push.ts
|
|
14
|
+
// src/commands/push.command.ts
|
|
15
15
|
import { Command } from "commander";
|
|
16
16
|
|
|
17
17
|
// src/transpiler.ts
|
|
@@ -195,7 +195,7 @@ ${argEntries}
|
|
|
195
195
|
}`;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
return `import { Type } from 'axiom';
|
|
198
|
+
return `import { Type } from 'axiom/ai';
|
|
199
199
|
|
|
200
200
|
export default {
|
|
201
201
|
name: '${prompt.name}',
|
|
@@ -220,7 +220,7 @@ ${options ? Object.entries(options).map(([key, value]) => ` ${key}: ${value}`
|
|
|
220
220
|
`;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
// src/commands/push.ts
|
|
223
|
+
// src/commands/push.command.ts
|
|
224
224
|
import fs2 from "fs/promises";
|
|
225
225
|
import readline from "readline";
|
|
226
226
|
async function askConfirmation(message) {
|
|
@@ -311,7 +311,7 @@ var loadPushCommand = (program2) => {
|
|
|
311
311
|
program2.addCommand(push);
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
-
// src/commands/pull.ts
|
|
314
|
+
// src/commands/pull.command.ts
|
|
315
315
|
import { Command as Command2 } from "commander";
|
|
316
316
|
import * as fs3 from "fs/promises";
|
|
317
317
|
import * as path2 from "path";
|
|
@@ -361,7 +361,7 @@ var loadPullCommand = (program2) => {
|
|
|
361
361
|
program2.addCommand(pull);
|
|
362
362
|
};
|
|
363
363
|
|
|
364
|
-
// src/commands/
|
|
364
|
+
// src/commands/eval.command.ts
|
|
365
365
|
import { Command as Command3 } from "commander";
|
|
366
366
|
|
|
367
367
|
// src/evals/run-vitest.ts
|
|
@@ -386,10 +386,10 @@ var runVitest = async (file) => {
|
|
|
386
386
|
await flush();
|
|
387
387
|
};
|
|
388
388
|
|
|
389
|
-
// src/commands/
|
|
389
|
+
// src/commands/eval.command.ts
|
|
390
390
|
var loadRunCommand = (program2) => {
|
|
391
391
|
return program2.addCommand(
|
|
392
|
-
new Command3("
|
|
392
|
+
new Command3("eval").description("run evals locally").argument("<path>", "Path to an eval test file, should be in the form of *.eval.ts").action(async (file) => {
|
|
393
393
|
if (!process.env.AXIOM_URL || !process.env.AXIOM_TOKEN || !process.env.AXIOM_DATASET) {
|
|
394
394
|
throw new Error("AXIOM_URL, AXIOM_TOKEN, and AXIOM_DATASET must be set");
|
|
395
395
|
}
|
|
@@ -402,7 +402,7 @@ var loadRunCommand = (program2) => {
|
|
|
402
402
|
var { loadEnvConfig } = pkg;
|
|
403
403
|
loadEnvConfig(process.cwd());
|
|
404
404
|
var program = new Command4();
|
|
405
|
-
program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.
|
|
405
|
+
program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.11.0");
|
|
406
406
|
loadPushCommand(program);
|
|
407
407
|
loadPullCommand(program);
|
|
408
408
|
loadRunCommand(program);
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +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"],"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"],"mappings":";;;;;;;;;;AAGA,OAAO,SAAS;AAMhB,SAAS,WAAAA,gBAAe;;;ACTxB,SAAS,eAAe;;;ACAxB,SAAS,aAAa;AACtB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,gBAAgB;AAGzB,eAAsB,iBAAiB,UAAkB;AACvD,QAAM,SAAS,MAAM,MAAM;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,IACF;AAAA,EACF,CAAC;AAED,QAAM,OAAO,OAAO,YAAY,CAAC,EAAE;AAGnC,QAAM,UAAU,GAAG,OAAO;AAC1B,QAAM,eAAe,mBAAmB,KAAK,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,CAAC;AAC7F,QAAM,eAAe,KAAK,KAAK,SAAS,YAAY;AAEpD,MAAI;AAEF,UAAM,GAAG,UAAU,cAAc,MAAM,OAAO;AAG9C,UAAM,YAAY,UAAU,YAAY;AACxC,UAAM,SAAS,MAAM,OAAO;AAE5B,WAAO,OAAO,WAAW;AAAA,EAC3B,UAAE;AAEA,QAAI;AACF,YAAM,GAAG,OAAO,YAAY;AAAA,IAC9B,SAA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,cAAc,gCAAgC;AAIhD,IAAM,YAAY,OAAO,SAAiB;AAC/C,QAAM,KAAK,MAAM,aAAa,QAAQ;AAAA;AAAA,IAEpC,MAAM;AAAA,IACN,SAAS,CAAC,OAAO,OAAO,cAAc;AAAA,IACtC,WAAW,CAAC,WAAW,IAAI,cAAc,CAAC;AAAA,IAC1C,aAAa;AAAA,IACb,SAAS;AAAA,EACX,CAAC;AAED,QAAM,GAAG,MAAM;AAEf,QAAM,UAAU,yBAAyB,IAAI,QAAQ,OAAO,QAAQ,MAAM;AAE1E,MAAI,CAAC,GAAG,iBAAiB,GAAG;AAC1B,YAAQ;AACR,UAAM,MAAM;AACZ,UAAM,GAAG,MAAM;AACf,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,MAAM;AACd;;;ADvBO,IAAM,iBAAiB,CAACC,aAAqB;AAClD,SAAOA,SAAQ;AAAA,IACb,IAAIC,SAAQ,KAAK,EACd,YAAY,mBAAmB,EAC/B,SAAS,UAAU,kEAAkE,EACrF,OAAO,OAAO,SAAiB;AAC9B,UAAI,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;AAG1B,cAAc,QAAQ,IAAI,CAAC;AAO3B,IAAM,UAAU,IAAIC,SAAQ;AAE5B,QACG,KAAK,OAAO,EACZ,YAAY,kDAAkD,EAC9D,QAAQ,OAAe;AAE1B,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,eAAe,OAAO;AAEtB,QAAQ,MAAM;","names":["Command","fs","resolve","program","Command","fs","path","program","Command","Command","program","Command","Command"]}
|
|
1
|
+
{"version":3,"sources":["../src/bin.ts","../src/commands/push.command.ts","../src/transpiler.ts","../src/commands/pull.command.ts","../src/commands/eval.command.ts","../src/evals/run-vitest.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.command';\nimport { loadPullCommand } from './commands/pull.command';\nimport { loadRunCommand } from './commands/eval.command';\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/ai';\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('eval')\n .description('run evals locally')\n .argument('<path>', 'Path to an eval test file, should be in the form of *.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"],"mappings":";;;;;;;;;;AAGA,OAAO,SAAS;AAMhB,SAAS,WAAAA,gBAAe;;;ACTxB,SAAS,eAAe;;;ACAxB,SAAS,aAAa;AACtB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,gBAAgB;AAGzB,eAAsB,iBAAiB,UAAkB;AACvD,QAAM,SAAS,MAAM,MAAM;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,IACF;AAAA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ACzE;AACA,YAAM,UAAU,IAAI;AAAA,IACtB,CAAC;AAAA,EACL;AACF;;;AJXA,IAAM,EAAE,cAAc,IAAI;AAG1B,cAAc,QAAQ,IAAI,CAAC;AAO3B,IAAM,UAAU,IAAIC,SAAQ;AAE5B,QACG,KAAK,OAAO,EACZ,YAAY,kDAAkD,EAC9D,QAAQ,QAAe;AAE1B,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,eAAe,OAAO;AAEtB,QAAQ,MAAM;","names":["Command","fs","resolve","program","Command","fs","path","program","Command","Command","program","Command","Command"]}
|
|
@@ -23,6 +23,7 @@ var ATTR_EVAL_CASE_INDEX = "eval.case.index";
|
|
|
23
23
|
var ATTR_EVAL_CASE_INPUT = "eval.case.input";
|
|
24
24
|
var ATTR_EVAL_CASE_OUTPUT = "eval.case.output";
|
|
25
25
|
var ATTR_EVAL_CASE_EXPECTED = "eval.case.expected";
|
|
26
|
+
var ATTR_EVAL_CASE_SCORES = "eval.case.scores";
|
|
26
27
|
var ATTR_EVAL_CASE_METADATA = "eval.case.metadata";
|
|
27
28
|
var ATTR_EVAL_TASK_OUTPUT = "eval.task.output";
|
|
28
29
|
var ATTR_EVAL_TASK_NAME = "eval.task.name";
|
|
@@ -275,6 +276,7 @@ var Attr = {
|
|
|
275
276
|
Input: ATTR_EVAL_CASE_INPUT,
|
|
276
277
|
Output: ATTR_EVAL_CASE_OUTPUT,
|
|
277
278
|
Expected: ATTR_EVAL_CASE_EXPECTED,
|
|
279
|
+
Scores: ATTR_EVAL_CASE_SCORES,
|
|
278
280
|
Metadata: ATTR_EVAL_CASE_METADATA
|
|
279
281
|
},
|
|
280
282
|
Task: {
|
|
@@ -308,4 +310,4 @@ export {
|
|
|
308
310
|
SCHEMA_BASE_URL,
|
|
309
311
|
Attr
|
|
310
312
|
};
|
|
311
|
-
//# sourceMappingURL=chunk-
|
|
313
|
+
//# sourceMappingURL=chunk-EF32T5MG.js.map
|