@axlsdk/axl 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1075,6 +1075,7 @@ declare class AxlRuntime extends EventEmitter {
1075
1075
  private executions;
1076
1076
  private pendingDecisionResolvers;
1077
1077
  private abortControllers;
1078
+ private registeredEvals;
1078
1079
  private mcpManager?;
1079
1080
  private memoryManager?;
1080
1081
  private spanManager;
@@ -1112,6 +1113,33 @@ declare class AxlRuntime extends EventEmitter {
1112
1113
  getAgents(): Agent[];
1113
1114
  /** Get a registered standalone agent by name. */
1114
1115
  getAgent(name: string): Agent | undefined;
1116
+ /**
1117
+ * Register an eval config for Studio introspection and execution.
1118
+ * The config should be the result of `defineEval()` from `@axlsdk/eval`.
1119
+ * An optional `executeWorkflow` function can override the default behavior
1120
+ * of calling `runtime.execute()`.
1121
+ */
1122
+ registerEval(name: string, config: unknown, executeWorkflow?: (input: unknown) => Promise<{
1123
+ output: unknown;
1124
+ cost?: number;
1125
+ }>): void;
1126
+ /** Get metadata about all registered evals. */
1127
+ getRegisteredEvals(): Array<{
1128
+ name: string;
1129
+ workflow: string;
1130
+ dataset: string;
1131
+ scorers: string[];
1132
+ }>;
1133
+ /** Get a registered eval config by name. */
1134
+ getRegisteredEval(name: string): {
1135
+ config: unknown;
1136
+ executeWorkflow?: (input: unknown) => Promise<{
1137
+ output: unknown;
1138
+ cost?: number;
1139
+ }>;
1140
+ } | undefined;
1141
+ /** Run a registered eval by name. */
1142
+ runRegisteredEval(name: string): Promise<unknown>;
1115
1143
  /** Get all execution info (running + completed). */
1116
1144
  getExecutions(): ExecutionInfo[];
1117
1145
  /** Register a custom provider instance. */
package/dist/index.d.ts CHANGED
@@ -1075,6 +1075,7 @@ declare class AxlRuntime extends EventEmitter {
1075
1075
  private executions;
1076
1076
  private pendingDecisionResolvers;
1077
1077
  private abortControllers;
1078
+ private registeredEvals;
1078
1079
  private mcpManager?;
1079
1080
  private memoryManager?;
1080
1081
  private spanManager;
@@ -1112,6 +1113,33 @@ declare class AxlRuntime extends EventEmitter {
1112
1113
  getAgents(): Agent[];
1113
1114
  /** Get a registered standalone agent by name. */
1114
1115
  getAgent(name: string): Agent | undefined;
1116
+ /**
1117
+ * Register an eval config for Studio introspection and execution.
1118
+ * The config should be the result of `defineEval()` from `@axlsdk/eval`.
1119
+ * An optional `executeWorkflow` function can override the default behavior
1120
+ * of calling `runtime.execute()`.
1121
+ */
1122
+ registerEval(name: string, config: unknown, executeWorkflow?: (input: unknown) => Promise<{
1123
+ output: unknown;
1124
+ cost?: number;
1125
+ }>): void;
1126
+ /** Get metadata about all registered evals. */
1127
+ getRegisteredEvals(): Array<{
1128
+ name: string;
1129
+ workflow: string;
1130
+ dataset: string;
1131
+ scorers: string[];
1132
+ }>;
1133
+ /** Get a registered eval config by name. */
1134
+ getRegisteredEval(name: string): {
1135
+ config: unknown;
1136
+ executeWorkflow?: (input: unknown) => Promise<{
1137
+ output: unknown;
1138
+ cost?: number;
1139
+ }>;
1140
+ } | undefined;
1141
+ /** Run a registered eval by name. */
1142
+ runRegisteredEval(name: string): Promise<unknown>;
1115
1143
  /** Get all execution info (running + completed). */
1116
1144
  getExecutions(): ExecutionInfo[];
1117
1145
  /** Register a custom provider instance. */
package/dist/index.js CHANGED
@@ -4577,6 +4577,7 @@ var AxlRuntime = class extends EventEmitter2 {
4577
4577
  executions = /* @__PURE__ */ new Map();
4578
4578
  pendingDecisionResolvers = /* @__PURE__ */ new Map();
4579
4579
  abortControllers = /* @__PURE__ */ new Map();
4580
+ registeredEvals = /* @__PURE__ */ new Map();
4580
4581
  mcpManager;
4581
4582
  memoryManager;
4582
4583
  spanManager = new NoopSpanManager();
@@ -4672,6 +4673,52 @@ var AxlRuntime = class extends EventEmitter2 {
4672
4673
  getAgent(name) {
4673
4674
  return this.agents.get(name);
4674
4675
  }
4676
+ /**
4677
+ * Register an eval config for Studio introspection and execution.
4678
+ * The config should be the result of `defineEval()` from `@axlsdk/eval`.
4679
+ * An optional `executeWorkflow` function can override the default behavior
4680
+ * of calling `runtime.execute()`.
4681
+ */
4682
+ registerEval(name, config, executeWorkflow) {
4683
+ this.registeredEvals.set(name, { config, executeWorkflow });
4684
+ }
4685
+ /** Get metadata about all registered evals. */
4686
+ getRegisteredEvals() {
4687
+ const result = [];
4688
+ for (const [name, { config }] of this.registeredEvals) {
4689
+ const cfg = config;
4690
+ result.push({
4691
+ name,
4692
+ workflow: cfg.workflow ?? "unknown",
4693
+ dataset: cfg.dataset?.name ?? "unknown",
4694
+ scorers: (cfg.scorers ?? []).map((s) => s.name ?? "unknown")
4695
+ });
4696
+ }
4697
+ return result;
4698
+ }
4699
+ /** Get a registered eval config by name. */
4700
+ getRegisteredEval(name) {
4701
+ return this.registeredEvals.get(name);
4702
+ }
4703
+ /** Run a registered eval by name. */
4704
+ async runRegisteredEval(name) {
4705
+ const entry = this.registeredEvals.get(name);
4706
+ if (!entry) throw new Error(`Eval "${name}" is not registered`);
4707
+ if (entry.executeWorkflow) {
4708
+ let runEvalFn;
4709
+ try {
4710
+ ({ runEval: runEvalFn } = await import("@axlsdk/eval"));
4711
+ } catch {
4712
+ throw new Error(
4713
+ "axl-eval is required for AxlRuntime.runRegisteredEval(). Install it with: npm install @axlsdk/eval"
4714
+ );
4715
+ }
4716
+ return runEvalFn(entry.config, entry.executeWorkflow);
4717
+ }
4718
+ return this.eval(
4719
+ entry.config
4720
+ );
4721
+ }
4675
4722
  /** Get all execution info (running + completed). */
4676
4723
  getExecutions() {
4677
4724
  return [...this.executions.values()];
@@ -5055,10 +5102,10 @@ var AxlRuntime = class extends EventEmitter2 {
5055
5102
  async eval(config) {
5056
5103
  let runEval;
5057
5104
  try {
5058
- ({ runEval } = await import("axl-eval"));
5105
+ ({ runEval } = await import("@axlsdk/eval"));
5059
5106
  } catch {
5060
5107
  throw new Error(
5061
- "axl-eval is required for AxlRuntime.eval(). Install it with: npm install axl-eval"
5108
+ "axl-eval is required for AxlRuntime.eval(). Install it with: npm install @axlsdk/eval"
5062
5109
  );
5063
5110
  }
5064
5111
  const executeWorkflow = async (input) => {
@@ -5085,10 +5132,10 @@ var AxlRuntime = class extends EventEmitter2 {
5085
5132
  async evalCompare(baseline, candidate) {
5086
5133
  let evalCompareFn;
5087
5134
  try {
5088
- ({ evalCompare: evalCompareFn } = await import("axl-eval"));
5135
+ ({ evalCompare: evalCompareFn } = await import("@axlsdk/eval"));
5089
5136
  } catch {
5090
5137
  throw new Error(
5091
- "axl-eval is required for AxlRuntime.evalCompare(). Install it with: npm install axl-eval"
5138
+ "axl-eval is required for AxlRuntime.evalCompare(). Install it with: npm install @axlsdk/eval"
5092
5139
  );
5093
5140
  }
5094
5141
  return evalCompareFn(baseline, candidate);