axiom 0.22.1 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +107 -92
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +7 -49
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-LCFHQBLT.js → chunk-MNPGB5RW.js} +2 -2
- package/dist/{chunk-LCFHQBLT.js.map → chunk-MNPGB5RW.js.map} +1 -1
- package/dist/{chunk-YPTTF7HZ.js → chunk-N7MOZLNM.js} +19 -4
- package/dist/chunk-N7MOZLNM.js.map +1 -0
- package/dist/{chunk-VR4MJDHN.js → chunk-WXAXKFRV.js} +62 -8
- package/dist/chunk-WXAXKFRV.js.map +1 -0
- package/dist/config.js +1 -2
- package/dist/evals.cjs +103 -5
- package/dist/evals.cjs.map +1 -1
- package/dist/evals.js +3 -3
- package/dist/{handlebars-T3GOD5O3.js → handlebars-LMQRDB6O.js} +4 -2
- package/dist/{handlebars-T3GOD5O3.js.map → handlebars-LMQRDB6O.js.map} +1 -1
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-NV3Y4T4G.js +0 -22
- package/dist/chunk-NV3Y4T4G.js.map +0 -1
- package/dist/chunk-VR4MJDHN.js.map +0 -1
- package/dist/chunk-YPTTF7HZ.js.map +0 -1
package/dist/bin.cjs
CHANGED
|
@@ -610,7 +610,7 @@ var import_api4 = require("@opentelemetry/api");
|
|
|
610
610
|
// package.json
|
|
611
611
|
var package_default = {
|
|
612
612
|
name: "axiom",
|
|
613
|
-
version: "0.22.
|
|
613
|
+
version: "0.22.2",
|
|
614
614
|
type: "module",
|
|
615
615
|
author: "Axiom, Inc.",
|
|
616
616
|
contributors: [
|
|
@@ -1561,11 +1561,111 @@ var import_sdk_trace_node = require("@opentelemetry/sdk-trace-node");
|
|
|
1561
1561
|
var import_resources = require("@opentelemetry/resources");
|
|
1562
1562
|
var import_exporter_trace_otlp_http = require("@opentelemetry/exporter-trace-otlp-http");
|
|
1563
1563
|
var import_api10 = require("@opentelemetry/api");
|
|
1564
|
+
|
|
1565
|
+
// src/config/loader.ts
|
|
1566
|
+
var import_c12 = require("c12");
|
|
1567
|
+
var import_defu = require("defu");
|
|
1568
|
+
|
|
1569
|
+
// src/config/index.ts
|
|
1570
|
+
var DEFAULT_EVAL_INCLUDE = ["**/*.eval.{ts,js,mts,mjs,cts,cjs}"];
|
|
1571
|
+
function createPartialDefaults() {
|
|
1572
|
+
return {
|
|
1573
|
+
eval: {
|
|
1574
|
+
url: process.env.AXIOM_URL || "https://api.axiom.co",
|
|
1575
|
+
token: process.env.AXIOM_TOKEN,
|
|
1576
|
+
dataset: process.env.AXIOM_DATASET,
|
|
1577
|
+
instrumentation: null,
|
|
1578
|
+
include: [...DEFAULT_EVAL_INCLUDE],
|
|
1579
|
+
exclude: [],
|
|
1580
|
+
timeoutMs: 6e4
|
|
1581
|
+
}
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
function validateConfig(config) {
|
|
1585
|
+
const errors = [];
|
|
1586
|
+
if (!config.eval?.token) {
|
|
1587
|
+
errors.push(
|
|
1588
|
+
"eval.token is required (set in axiom.config.ts or AXIOM_TOKEN environment variable)"
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
if (!config.eval?.dataset) {
|
|
1592
|
+
errors.push(
|
|
1593
|
+
"eval.dataset is required (set in axiom.config.ts or AXIOM_DATASET environment variable)"
|
|
1594
|
+
);
|
|
1595
|
+
}
|
|
1596
|
+
if (!config.eval?.url) {
|
|
1597
|
+
console.log(
|
|
1598
|
+
"eval.url was not specified. Defaulting to `https://api.axiom.co`. Please set it in axiom.config.ts or AXIOM_URL environment variable if you want to use a different endpoint."
|
|
1599
|
+
);
|
|
1600
|
+
}
|
|
1601
|
+
const instrumentation = config.eval?.instrumentation;
|
|
1602
|
+
if (instrumentation !== null && instrumentation !== void 0 && typeof instrumentation !== "function") {
|
|
1603
|
+
errors.push(
|
|
1604
|
+
"eval.instrumentation must be a function returning OTEL setup information or null."
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
if (errors.length > 0) {
|
|
1608
|
+
throw new AxiomCLIError(`Invalid Axiom configuration:
|
|
1609
|
+
- ${errors.join("\n - ")}`);
|
|
1610
|
+
}
|
|
1611
|
+
return config;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
// src/config/loader.ts
|
|
1615
|
+
function customMerger(target, source) {
|
|
1616
|
+
const merged = (0, import_defu.defu)(source, target);
|
|
1617
|
+
if (source?.eval && "include" in source.eval) {
|
|
1618
|
+
merged.eval.include = source.eval.include;
|
|
1619
|
+
}
|
|
1620
|
+
return merged;
|
|
1621
|
+
}
|
|
1622
|
+
async function loadConfig(cwd = process.cwd()) {
|
|
1623
|
+
try {
|
|
1624
|
+
const defaults = createPartialDefaults();
|
|
1625
|
+
const result = await (0, import_c12.loadConfig)({
|
|
1626
|
+
name: "axiom",
|
|
1627
|
+
cwd,
|
|
1628
|
+
// Support common config file extensions
|
|
1629
|
+
configFile: "axiom.config",
|
|
1630
|
+
// Don't use defaultConfig - we'll merge manually to control array behavior
|
|
1631
|
+
// Disable configs other than .ts/.js/.mts/.mjs/.cts/.cjs
|
|
1632
|
+
rcFile: false,
|
|
1633
|
+
globalRc: false,
|
|
1634
|
+
packageJson: false,
|
|
1635
|
+
giget: false
|
|
1636
|
+
});
|
|
1637
|
+
const mergedConfig = customMerger(defaults, result.config);
|
|
1638
|
+
const validatedConfig = validateConfig(mergedConfig);
|
|
1639
|
+
return {
|
|
1640
|
+
config: validatedConfig
|
|
1641
|
+
};
|
|
1642
|
+
} catch (error) {
|
|
1643
|
+
if (error instanceof AxiomCLIError) {
|
|
1644
|
+
throw error;
|
|
1645
|
+
}
|
|
1646
|
+
throw new AxiomCLIError(`Failed to load config file: ${errorToString(error)}`);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
// src/evals/instrument.ts
|
|
1564
1651
|
var axiomProvider;
|
|
1565
1652
|
var axiomTracer;
|
|
1566
1653
|
var userProvider;
|
|
1567
1654
|
var initializationPromise = null;
|
|
1568
1655
|
var initialized = false;
|
|
1656
|
+
async function resolveInstrumentationHook(config) {
|
|
1657
|
+
if (config.eval.instrumentation) {
|
|
1658
|
+
return config.eval.instrumentation;
|
|
1659
|
+
}
|
|
1660
|
+
try {
|
|
1661
|
+
const { config: loadedConfig } = await loadConfig(process.cwd());
|
|
1662
|
+
return loadedConfig.eval.instrumentation ?? null;
|
|
1663
|
+
} catch (error) {
|
|
1664
|
+
throw new AxiomCLIError(
|
|
1665
|
+
`Failed to reload instrumentation from config: ${errorToString(error)}`
|
|
1666
|
+
);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1569
1669
|
async function runInstrumentationHook(hook, options) {
|
|
1570
1670
|
try {
|
|
1571
1671
|
return await hook(options);
|
|
@@ -1595,11 +1695,11 @@ function setupEvalProvider(connection) {
|
|
|
1595
1695
|
axiomProvider = new import_sdk_trace_node.NodeTracerProvider({
|
|
1596
1696
|
resource: (0, import_resources.resourceFromAttributes)({
|
|
1597
1697
|
["service.name"]: "axiom",
|
|
1598
|
-
["service.version"]: "0.22.
|
|
1698
|
+
["service.version"]: "0.22.2"
|
|
1599
1699
|
}),
|
|
1600
1700
|
spanProcessors: [processor]
|
|
1601
1701
|
});
|
|
1602
|
-
axiomTracer = axiomProvider.getTracer("axiom", "0.22.
|
|
1702
|
+
axiomTracer = axiomProvider.getTracer("axiom", "0.22.2");
|
|
1603
1703
|
}
|
|
1604
1704
|
async function initInstrumentation(config) {
|
|
1605
1705
|
if (initialized) {
|
|
@@ -1611,12 +1711,12 @@ async function initInstrumentation(config) {
|
|
|
1611
1711
|
}
|
|
1612
1712
|
initializationPromise = (async () => {
|
|
1613
1713
|
if (!config.enabled) {
|
|
1614
|
-
axiomTracer = import_api10.trace.getTracer("axiom", "0.22.
|
|
1714
|
+
axiomTracer = import_api10.trace.getTracer("axiom", "0.22.2");
|
|
1615
1715
|
initialized = true;
|
|
1616
1716
|
return;
|
|
1617
1717
|
}
|
|
1618
1718
|
const connection = resolveAxiomConnection(config.config);
|
|
1619
|
-
const hook = config.config
|
|
1719
|
+
const hook = await resolveInstrumentationHook(config.config);
|
|
1620
1720
|
let hookResult = void 0;
|
|
1621
1721
|
if (hook) {
|
|
1622
1722
|
config.config.eval.instrumentation = hook;
|
|
@@ -1769,91 +1869,6 @@ function isGlob(str) {
|
|
|
1769
1869
|
return /[*?[\]{}!]/.test(str);
|
|
1770
1870
|
}
|
|
1771
1871
|
|
|
1772
|
-
// src/config/loader.ts
|
|
1773
|
-
var import_c12 = require("c12");
|
|
1774
|
-
var import_defu = require("defu");
|
|
1775
|
-
|
|
1776
|
-
// src/config/index.ts
|
|
1777
|
-
var DEFAULT_EVAL_INCLUDE = ["**/*.eval.{ts,js,mts,mjs,cts,cjs}"];
|
|
1778
|
-
function createPartialDefaults() {
|
|
1779
|
-
return {
|
|
1780
|
-
eval: {
|
|
1781
|
-
url: process.env.AXIOM_URL || "https://api.axiom.co",
|
|
1782
|
-
token: process.env.AXIOM_TOKEN,
|
|
1783
|
-
dataset: process.env.AXIOM_DATASET,
|
|
1784
|
-
instrumentation: null,
|
|
1785
|
-
include: [...DEFAULT_EVAL_INCLUDE],
|
|
1786
|
-
exclude: [],
|
|
1787
|
-
timeoutMs: 6e4
|
|
1788
|
-
}
|
|
1789
|
-
};
|
|
1790
|
-
}
|
|
1791
|
-
function validateConfig(config) {
|
|
1792
|
-
const errors = [];
|
|
1793
|
-
if (!config.eval?.token) {
|
|
1794
|
-
errors.push(
|
|
1795
|
-
"eval.token is required (set in axiom.config.ts or AXIOM_TOKEN environment variable)"
|
|
1796
|
-
);
|
|
1797
|
-
}
|
|
1798
|
-
if (!config.eval?.dataset) {
|
|
1799
|
-
errors.push(
|
|
1800
|
-
"eval.dataset is required (set in axiom.config.ts or AXIOM_DATASET environment variable)"
|
|
1801
|
-
);
|
|
1802
|
-
}
|
|
1803
|
-
if (!config.eval?.url) {
|
|
1804
|
-
console.log(
|
|
1805
|
-
"eval.url was not specified. Defaulting to `https://api.axiom.co`. Please set it in axiom.config.ts or AXIOM_URL environment variable if you want to use a different endpoint."
|
|
1806
|
-
);
|
|
1807
|
-
}
|
|
1808
|
-
const instrumentation = config.eval?.instrumentation;
|
|
1809
|
-
if (instrumentation !== null && instrumentation !== void 0 && typeof instrumentation !== "function") {
|
|
1810
|
-
errors.push(
|
|
1811
|
-
"eval.instrumentation must be a function returning OTEL setup information or null."
|
|
1812
|
-
);
|
|
1813
|
-
}
|
|
1814
|
-
if (errors.length > 0) {
|
|
1815
|
-
throw new AxiomCLIError(`Invalid Axiom configuration:
|
|
1816
|
-
- ${errors.join("\n - ")}`);
|
|
1817
|
-
}
|
|
1818
|
-
return config;
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
// src/config/loader.ts
|
|
1822
|
-
function customMerger(target, source) {
|
|
1823
|
-
const merged = (0, import_defu.defu)(source, target);
|
|
1824
|
-
if (source?.eval && "include" in source.eval) {
|
|
1825
|
-
merged.eval.include = source.eval.include;
|
|
1826
|
-
}
|
|
1827
|
-
return merged;
|
|
1828
|
-
}
|
|
1829
|
-
async function loadConfig(cwd = process.cwd()) {
|
|
1830
|
-
try {
|
|
1831
|
-
const defaults = createPartialDefaults();
|
|
1832
|
-
const result = await (0, import_c12.loadConfig)({
|
|
1833
|
-
name: "axiom",
|
|
1834
|
-
cwd,
|
|
1835
|
-
// Support common config file extensions
|
|
1836
|
-
configFile: "axiom.config",
|
|
1837
|
-
// Don't use defaultConfig - we'll merge manually to control array behavior
|
|
1838
|
-
// Disable configs other than .ts/.js/.mts/.mjs/.cts/.cjs
|
|
1839
|
-
rcFile: false,
|
|
1840
|
-
globalRc: false,
|
|
1841
|
-
packageJson: false,
|
|
1842
|
-
giget: false
|
|
1843
|
-
});
|
|
1844
|
-
const mergedConfig = customMerger(defaults, result.config);
|
|
1845
|
-
const validatedConfig = validateConfig(mergedConfig);
|
|
1846
|
-
return {
|
|
1847
|
-
config: validatedConfig
|
|
1848
|
-
};
|
|
1849
|
-
} catch (error) {
|
|
1850
|
-
if (error instanceof AxiomCLIError) {
|
|
1851
|
-
throw error;
|
|
1852
|
-
}
|
|
1853
|
-
throw new AxiomCLIError(`Failed to load config file: ${errorToString(error)}`);
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
1872
|
// src/cli/commands/eval.command.ts
|
|
1858
1873
|
var loadEvalCommand = (program2, flagOverrides = {}) => {
|
|
1859
1874
|
return program2.addCommand(
|
|
@@ -2029,7 +2044,7 @@ var import_commander4 = require("commander");
|
|
|
2029
2044
|
var loadVersionCommand = (program2) => {
|
|
2030
2045
|
return program2.addCommand(
|
|
2031
2046
|
new import_commander4.Command("version").description("cli version").action(() => {
|
|
2032
|
-
console.log("0.22.
|
|
2047
|
+
console.log("0.22.2");
|
|
2033
2048
|
})
|
|
2034
2049
|
);
|
|
2035
2050
|
};
|
|
@@ -2039,7 +2054,7 @@ var { loadEnvConfig } = import_env.default;
|
|
|
2039
2054
|
loadEnvConfig(process.cwd());
|
|
2040
2055
|
var { cleanedArgv, overrides } = extractOverrides(process.argv.slice(2));
|
|
2041
2056
|
var program = new import_commander5.Command();
|
|
2042
|
-
program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.22.
|
|
2057
|
+
program.name("axiom").description("Axiom's CLI to manage your objects and run evals").version("0.22.2");
|
|
2043
2058
|
loadPushCommand(program);
|
|
2044
2059
|
loadPullCommand(program);
|
|
2045
2060
|
loadEvalCommand(program, overrides);
|