@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.cjs CHANGED
@@ -1786,12 +1786,10 @@ function computeTraceSummary(messages) {
1786
1786
  }
1787
1787
  }
1788
1788
  }
1789
- const toolNames = Object.keys(toolCallCounts).sort();
1790
1789
  return {
1791
1790
  trace: {
1792
1791
  eventCount: totalToolCalls,
1793
- toolNames,
1794
- toolCallsByName: toolCallCounts,
1792
+ toolCalls: toolCallCounts,
1795
1793
  errorCount: 0,
1796
1794
  llmCallCount,
1797
1795
  ...hasAnyDuration ? { toolDurations } : {}
@@ -1815,7 +1813,7 @@ var DEFAULT_EXPLORATION_TOOLS = [
1815
1813
  function explorationRatio(summary, explorationTools = DEFAULT_EXPLORATION_TOOLS) {
1816
1814
  if (summary.eventCount === 0) return void 0;
1817
1815
  const explorationCalls = explorationTools.reduce(
1818
- (sum, tool2) => sum + (summary.toolCallsByName[tool2] ?? 0),
1816
+ (sum, tool2) => sum + (summary.toolCalls[tool2] ?? 0),
1819
1817
  0
1820
1818
  );
1821
1819
  return explorationCalls / summary.eventCount;
@@ -15832,11 +15830,9 @@ var ToolTrajectoryEvaluator = class {
15832
15830
  for (const call of toolCalls) {
15833
15831
  toolCallsByName[call.name] = (toolCallsByName[call.name] ?? 0) + 1;
15834
15832
  }
15835
- const toolNames = Object.keys(toolCallsByName).sort();
15836
15833
  return {
15837
15834
  eventCount: toolCalls.length,
15838
- toolNames,
15839
- toolCallsByName,
15835
+ toolCalls: toolCallsByName,
15840
15836
  errorCount: 0
15841
15837
  };
15842
15838
  }
@@ -15854,7 +15850,7 @@ var ToolTrajectoryEvaluator = class {
15854
15850
  const assertions = [];
15855
15851
  for (const toolName of toolNames) {
15856
15852
  const required = minimums[toolName];
15857
- const actual = summary.toolCallsByName[toolName] ?? 0;
15853
+ const actual = summary.toolCalls[toolName] ?? 0;
15858
15854
  if (actual >= required) {
15859
15855
  assertions.push({
15860
15856
  text: `${toolName}: called ${actual} times (required >=${required})`,
@@ -18535,7 +18531,7 @@ async function runBatchEvaluation(options) {
18535
18531
  const providerResponse = batchResponse[i];
18536
18532
  const output = providerResponse.output;
18537
18533
  const hasExecutionMetrics = providerResponse.tokenUsage !== void 0 || providerResponse.costUsd !== void 0 || providerResponse.durationMs !== void 0;
18538
- const computed = output ? computeTraceSummary(output) : hasExecutionMetrics ? { trace: { eventCount: 0, toolNames: [], toolCallsByName: {}, errorCount: 0 } } : void 0;
18534
+ const computed = output ? computeTraceSummary(output) : hasExecutionMetrics ? { trace: { eventCount: 0, toolCalls: {}, errorCount: 0 } } : void 0;
18539
18535
  const merged = computed ? mergeExecutionMetrics(computed, {
18540
18536
  tokenUsage: providerResponse.tokenUsage,
18541
18537
  costUsd: providerResponse.costUsd,
@@ -18932,7 +18928,7 @@ async function runEvalCase(options) {
18932
18928
  }
18933
18929
  const output = providerResponse.output;
18934
18930
  const hasExecutionMetrics = providerResponse.tokenUsage !== void 0 || providerResponse.costUsd !== void 0 || providerResponse.durationMs !== void 0;
18935
- const computed = output ? computeTraceSummary(output) : hasExecutionMetrics ? { trace: { eventCount: 0, toolNames: [], toolCallsByName: {}, errorCount: 0 } } : void 0;
18931
+ const computed = output ? computeTraceSummary(output) : hasExecutionMetrics ? { trace: { eventCount: 0, toolCalls: {}, errorCount: 0 } } : void 0;
18936
18932
  const merged = computed ? mergeExecutionMetrics(computed, {
18937
18933
  tokenUsage: providerResponse.tokenUsage,
18938
18934
  costUsd: providerResponse.costUsd,
@@ -20312,7 +20308,10 @@ var OtelTraceExporter = class {
20312
20308
  if (result.trace) {
20313
20309
  const t = result.trace;
20314
20310
  rootSpan.setAttribute("agentv.trace.event_count", t.eventCount);
20315
- rootSpan.setAttribute("agentv.trace.tool_names", t.toolNames.join(","));
20311
+ rootSpan.setAttribute(
20312
+ "agentv.trace.tool_names",
20313
+ Object.keys(t.toolCalls).sort().join(",")
20314
+ );
20316
20315
  if (t.llmCallCount != null)
20317
20316
  rootSpan.setAttribute("agentv.trace.llm_call_count", t.llmCallCount);
20318
20317
  }