@axlsdk/studio 0.18.1 → 0.19.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/cli.cjs CHANGED
@@ -822,6 +822,7 @@ function emptyRetry() {
822
822
  function emptyCostData() {
823
823
  return {
824
824
  totalCost: 0,
825
+ unpricedCalls: 0,
825
826
  totalTokens: { input: 0, output: 0, reasoning: 0 },
826
827
  byAgent: {},
827
828
  byModel: {},
@@ -834,7 +835,7 @@ function reduceCost(acc, event) {
834
835
  const isWorkflowStart = event.type === "workflow_start";
835
836
  if (isWorkflowStart && event.workflow) {
836
837
  const byWorkflow2 = { ...acc.byWorkflow };
837
- const prev = byWorkflow2[event.workflow] ?? { cost: 0, executions: 0 };
838
+ const prev = byWorkflow2[event.workflow] ?? { cost: 0, executions: 0, unpricedCalls: 0 };
838
839
  byWorkflow2[event.workflow] = { ...prev, executions: prev.executions + 1 };
839
840
  return { ...acc, byWorkflow: byWorkflow2 };
840
841
  }
@@ -842,6 +843,7 @@ function reduceCost(acc, event) {
842
843
  const cost = (0, import_axl2.eventCostContribution)(event);
843
844
  if (event.type === "ask_end") return acc;
844
845
  const tokens = event.tokens ?? {};
846
+ const unpricedLeaf = (0, import_axl2.isUnpricedLeaf)(event);
845
847
  const totalTokens = event.type === "agent_call_end" ? {
846
848
  input: acc.totalTokens.input + finite(tokens.input),
847
849
  output: acc.totalTokens.output + finite(tokens.output),
@@ -849,15 +851,25 @@ function reduceCost(acc, event) {
849
851
  } : acc.totalTokens;
850
852
  const byAgent = { ...acc.byAgent };
851
853
  if (event.agent) {
852
- const prev = byAgent[event.agent] ?? { cost: 0, calls: 0 };
853
- byAgent[event.agent] = { cost: prev.cost + cost, calls: prev.calls + 1 };
854
+ const prev = byAgent[event.agent] ?? { cost: 0, calls: 0, unpricedCalls: 0 };
855
+ byAgent[event.agent] = {
856
+ cost: prev.cost + cost,
857
+ calls: prev.calls + 1,
858
+ unpricedCalls: prev.unpricedCalls + (unpricedLeaf ? 1 : 0)
859
+ };
854
860
  }
855
861
  const byModel = { ...acc.byModel };
856
862
  if (event.model) {
857
- const prev = byModel[event.model] ?? { cost: 0, calls: 0, tokens: { input: 0, output: 0 } };
863
+ const prev = byModel[event.model] ?? {
864
+ cost: 0,
865
+ calls: 0,
866
+ unpricedCalls: 0,
867
+ tokens: { input: 0, output: 0 }
868
+ };
858
869
  byModel[event.model] = {
859
870
  cost: prev.cost + cost,
860
871
  calls: prev.calls + 1,
872
+ unpricedCalls: prev.unpricedCalls + (unpricedLeaf ? 1 : 0),
861
873
  tokens: {
862
874
  input: prev.tokens.input + finite(tokens.input),
863
875
  output: prev.tokens.output + finite(tokens.output)
@@ -866,10 +878,11 @@ function reduceCost(acc, event) {
866
878
  }
867
879
  const byWorkflow = { ...acc.byWorkflow };
868
880
  if (event.workflow) {
869
- const prev = byWorkflow[event.workflow] ?? { cost: 0, executions: 0 };
881
+ const prev = byWorkflow[event.workflow] ?? { cost: 0, executions: 0, unpricedCalls: 0 };
870
882
  byWorkflow[event.workflow] = {
871
883
  cost: prev.cost + cost,
872
- executions: prev.executions + (isWorkflowStart ? 1 : 0)
884
+ executions: prev.executions + (isWorkflowStart ? 1 : 0),
885
+ unpricedCalls: prev.unpricedCalls + (unpricedLeaf ? 1 : 0)
873
886
  };
874
887
  }
875
888
  let retry = acc.retry;
@@ -900,15 +913,17 @@ function reduceCost(acc, event) {
900
913
  byEmbedder = { ...acc.byEmbedder };
901
914
  const modelKey = usage?.model ?? "unknown";
902
915
  const embedTokens = typeof usage?.tokens === "number" ? finite(usage.tokens) : 0;
903
- const prev = byEmbedder[modelKey] ?? { cost: 0, calls: 0, tokens: 0 };
916
+ const prev = byEmbedder[modelKey] ?? { cost: 0, calls: 0, unpricedCalls: 0, tokens: 0 };
904
917
  byEmbedder[modelKey] = {
905
918
  cost: prev.cost + cost,
906
919
  calls: prev.calls + 1,
920
+ unpricedCalls: prev.unpricedCalls + (unpricedLeaf ? 1 : 0),
907
921
  tokens: prev.tokens + embedTokens
908
922
  };
909
923
  }
910
924
  return {
911
925
  totalCost: acc.totalCost + cost,
926
+ unpricedCalls: acc.unpricedCalls + (unpricedLeaf ? 1 : 0),
912
927
  totalTokens,
913
928
  byAgent,
914
929
  byModel,