@agentv/core 3.6.0 → 3.7.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
@@ -251,10 +251,8 @@ interface TokenUsage {
251
251
  interface TraceSummary {
252
252
  /** Total number of events in trace */
253
253
  readonly eventCount: number;
254
- /** Unique tool names, sorted alphabetically */
255
- readonly toolNames: readonly string[];
256
254
  /** Map of tool name to call count */
257
- readonly toolCallsByName: Readonly<Record<string, number>>;
255
+ readonly toolCalls: Readonly<Record<string, number>>;
258
256
  /** Number of error events */
259
257
  readonly errorCount: number;
260
258
  /** Per-tool duration arrays in milliseconds (optional) */
package/dist/index.d.ts CHANGED
@@ -251,10 +251,8 @@ interface TokenUsage {
251
251
  interface TraceSummary {
252
252
  /** Total number of events in trace */
253
253
  readonly eventCount: number;
254
- /** Unique tool names, sorted alphabetically */
255
- readonly toolNames: readonly string[];
256
254
  /** Map of tool name to call count */
257
- readonly toolCallsByName: Readonly<Record<string, number>>;
255
+ readonly toolCalls: Readonly<Record<string, number>>;
258
256
  /** Number of error events */
259
257
  readonly errorCount: number;
260
258
  /** Per-tool duration arrays in milliseconds (optional) */
package/dist/index.js CHANGED
@@ -83,12 +83,10 @@ function computeTraceSummary(messages) {
83
83
  }
84
84
  }
85
85
  }
86
- const toolNames = Object.keys(toolCallCounts).sort();
87
86
  return {
88
87
  trace: {
89
88
  eventCount: totalToolCalls,
90
- toolNames,
91
- toolCallsByName: toolCallCounts,
89
+ toolCalls: toolCallCounts,
92
90
  errorCount: 0,
93
91
  llmCallCount,
94
92
  ...hasAnyDuration ? { toolDurations } : {}
@@ -112,7 +110,7 @@ var DEFAULT_EXPLORATION_TOOLS = [
112
110
  function explorationRatio(summary, explorationTools = DEFAULT_EXPLORATION_TOOLS) {
113
111
  if (summary.eventCount === 0) return void 0;
114
112
  const explorationCalls = explorationTools.reduce(
115
- (sum, tool2) => sum + (summary.toolCallsByName[tool2] ?? 0),
113
+ (sum, tool2) => sum + (summary.toolCalls[tool2] ?? 0),
116
114
  0
117
115
  );
118
116
  return explorationCalls / summary.eventCount;
@@ -12780,11 +12778,9 @@ var ToolTrajectoryEvaluator = class {
12780
12778
  for (const call of toolCalls) {
12781
12779
  toolCallsByName[call.name] = (toolCallsByName[call.name] ?? 0) + 1;
12782
12780
  }
12783
- const toolNames = Object.keys(toolCallsByName).sort();
12784
12781
  return {
12785
12782
  eventCount: toolCalls.length,
12786
- toolNames,
12787
- toolCallsByName,
12783
+ toolCalls: toolCallsByName,
12788
12784
  errorCount: 0
12789
12785
  };
12790
12786
  }
@@ -12802,7 +12798,7 @@ var ToolTrajectoryEvaluator = class {
12802
12798
  const assertions = [];
12803
12799
  for (const toolName of toolNames) {
12804
12800
  const required = minimums[toolName];
12805
- const actual = summary.toolCallsByName[toolName] ?? 0;
12801
+ const actual = summary.toolCalls[toolName] ?? 0;
12806
12802
  if (actual >= required) {
12807
12803
  assertions.push({
12808
12804
  text: `${toolName}: called ${actual} times (required >=${required})`,
@@ -15483,7 +15479,7 @@ async function runBatchEvaluation(options) {
15483
15479
  const providerResponse = batchResponse[i];
15484
15480
  const output = providerResponse.output;
15485
15481
  const hasExecutionMetrics = providerResponse.tokenUsage !== void 0 || providerResponse.costUsd !== void 0 || providerResponse.durationMs !== void 0;
15486
- const computed = output ? computeTraceSummary(output) : hasExecutionMetrics ? { trace: { eventCount: 0, toolNames: [], toolCallsByName: {}, errorCount: 0 } } : void 0;
15482
+ const computed = output ? computeTraceSummary(output) : hasExecutionMetrics ? { trace: { eventCount: 0, toolCalls: {}, errorCount: 0 } } : void 0;
15487
15483
  const merged = computed ? mergeExecutionMetrics(computed, {
15488
15484
  tokenUsage: providerResponse.tokenUsage,
15489
15485
  costUsd: providerResponse.costUsd,
@@ -15880,7 +15876,7 @@ async function runEvalCase(options) {
15880
15876
  }
15881
15877
  const output = providerResponse.output;
15882
15878
  const hasExecutionMetrics = providerResponse.tokenUsage !== void 0 || providerResponse.costUsd !== void 0 || providerResponse.durationMs !== void 0;
15883
- const computed = output ? computeTraceSummary(output) : hasExecutionMetrics ? { trace: { eventCount: 0, toolNames: [], toolCallsByName: {}, errorCount: 0 } } : void 0;
15879
+ const computed = output ? computeTraceSummary(output) : hasExecutionMetrics ? { trace: { eventCount: 0, toolCalls: {}, errorCount: 0 } } : void 0;
15884
15880
  const merged = computed ? mergeExecutionMetrics(computed, {
15885
15881
  tokenUsage: providerResponse.tokenUsage,
15886
15882
  costUsd: providerResponse.costUsd,
@@ -17260,7 +17256,10 @@ var OtelTraceExporter = class {
17260
17256
  if (result.trace) {
17261
17257
  const t = result.trace;
17262
17258
  rootSpan.setAttribute("agentv.trace.event_count", t.eventCount);
17263
- rootSpan.setAttribute("agentv.trace.tool_names", t.toolNames.join(","));
17259
+ rootSpan.setAttribute(
17260
+ "agentv.trace.tool_names",
17261
+ Object.keys(t.toolCalls).sort().join(",")
17262
+ );
17264
17263
  if (t.llmCallCount != null)
17265
17264
  rootSpan.setAttribute("agentv.trace.llm_call_count", t.llmCallCount);
17266
17265
  }