@axlsdk/studio 0.18.2 → 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/README.md +1 -1
- package/dist/{chunk-RLG3DDQZ.js → chunk-S6HQOGOQ.js} +24 -9
- package/dist/chunk-S6HQOGOQ.js.map +1 -0
- package/dist/cli.cjs +22 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/assets/{index-CyKf66AB.js → index-7Nf4lAQm.js} +16 -16
- package/dist/client/index.html +1 -1
- package/dist/{connection-manager-8TQqoUtk.d.ts → connection-manager-DMjH2G5n.d.cts} +30 -21
- package/dist/{connection-manager-8TQqoUtk.d.cts → connection-manager-DMjH2G5n.d.ts} +30 -21
- package/dist/middleware.cjs +22 -7
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.cts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/middleware.js +1 -1
- package/dist/server/index.cjs +22 -7
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-RLG3DDQZ.js.map +0 -1
package/dist/middleware.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxlRuntime } from '@axlsdk/axl';
|
|
2
|
-
import { B as BroadcastTarget, C as ConnectionManager, a as BufferCaps, S as StudioEnv } from './connection-manager-
|
|
2
|
+
import { B as BroadcastTarget, C as ConnectionManager, a as BufferCaps, S as StudioEnv } from './connection-manager-DMjH2G5n.cjs';
|
|
3
3
|
import * as hono_types from 'hono/types';
|
|
4
4
|
import * as hono from 'hono';
|
|
5
5
|
import { IncomingMessage, ServerResponse, Server } from 'node:http';
|
package/dist/middleware.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxlRuntime } from '@axlsdk/axl';
|
|
2
|
-
import { B as BroadcastTarget, C as ConnectionManager, a as BufferCaps, S as StudioEnv } from './connection-manager-
|
|
2
|
+
import { B as BroadcastTarget, C as ConnectionManager, a as BufferCaps, S as StudioEnv } from './connection-manager-DMjH2G5n.js';
|
|
3
3
|
import * as hono_types from 'hono/types';
|
|
4
4
|
import * as hono from 'hono';
|
|
5
5
|
import { IncomingMessage, ServerResponse, Server } from 'node:http';
|
package/dist/middleware.js
CHANGED
package/dist/server/index.cjs
CHANGED
|
@@ -825,6 +825,7 @@ function emptyRetry() {
|
|
|
825
825
|
function emptyCostData() {
|
|
826
826
|
return {
|
|
827
827
|
totalCost: 0,
|
|
828
|
+
unpricedCalls: 0,
|
|
828
829
|
totalTokens: { input: 0, output: 0, reasoning: 0 },
|
|
829
830
|
byAgent: {},
|
|
830
831
|
byModel: {},
|
|
@@ -837,7 +838,7 @@ function reduceCost(acc, event) {
|
|
|
837
838
|
const isWorkflowStart = event.type === "workflow_start";
|
|
838
839
|
if (isWorkflowStart && event.workflow) {
|
|
839
840
|
const byWorkflow2 = { ...acc.byWorkflow };
|
|
840
|
-
const prev = byWorkflow2[event.workflow] ?? { cost: 0, executions: 0 };
|
|
841
|
+
const prev = byWorkflow2[event.workflow] ?? { cost: 0, executions: 0, unpricedCalls: 0 };
|
|
841
842
|
byWorkflow2[event.workflow] = { ...prev, executions: prev.executions + 1 };
|
|
842
843
|
return { ...acc, byWorkflow: byWorkflow2 };
|
|
843
844
|
}
|
|
@@ -845,6 +846,7 @@ function reduceCost(acc, event) {
|
|
|
845
846
|
const cost = (0, import_axl2.eventCostContribution)(event);
|
|
846
847
|
if (event.type === "ask_end") return acc;
|
|
847
848
|
const tokens = event.tokens ?? {};
|
|
849
|
+
const unpricedLeaf = (0, import_axl2.isUnpricedLeaf)(event);
|
|
848
850
|
const totalTokens = event.type === "agent_call_end" ? {
|
|
849
851
|
input: acc.totalTokens.input + finite(tokens.input),
|
|
850
852
|
output: acc.totalTokens.output + finite(tokens.output),
|
|
@@ -852,15 +854,25 @@ function reduceCost(acc, event) {
|
|
|
852
854
|
} : acc.totalTokens;
|
|
853
855
|
const byAgent = { ...acc.byAgent };
|
|
854
856
|
if (event.agent) {
|
|
855
|
-
const prev = byAgent[event.agent] ?? { cost: 0, calls: 0 };
|
|
856
|
-
byAgent[event.agent] = {
|
|
857
|
+
const prev = byAgent[event.agent] ?? { cost: 0, calls: 0, unpricedCalls: 0 };
|
|
858
|
+
byAgent[event.agent] = {
|
|
859
|
+
cost: prev.cost + cost,
|
|
860
|
+
calls: prev.calls + 1,
|
|
861
|
+
unpricedCalls: prev.unpricedCalls + (unpricedLeaf ? 1 : 0)
|
|
862
|
+
};
|
|
857
863
|
}
|
|
858
864
|
const byModel = { ...acc.byModel };
|
|
859
865
|
if (event.model) {
|
|
860
|
-
const prev = byModel[event.model] ?? {
|
|
866
|
+
const prev = byModel[event.model] ?? {
|
|
867
|
+
cost: 0,
|
|
868
|
+
calls: 0,
|
|
869
|
+
unpricedCalls: 0,
|
|
870
|
+
tokens: { input: 0, output: 0 }
|
|
871
|
+
};
|
|
861
872
|
byModel[event.model] = {
|
|
862
873
|
cost: prev.cost + cost,
|
|
863
874
|
calls: prev.calls + 1,
|
|
875
|
+
unpricedCalls: prev.unpricedCalls + (unpricedLeaf ? 1 : 0),
|
|
864
876
|
tokens: {
|
|
865
877
|
input: prev.tokens.input + finite(tokens.input),
|
|
866
878
|
output: prev.tokens.output + finite(tokens.output)
|
|
@@ -869,10 +881,11 @@ function reduceCost(acc, event) {
|
|
|
869
881
|
}
|
|
870
882
|
const byWorkflow = { ...acc.byWorkflow };
|
|
871
883
|
if (event.workflow) {
|
|
872
|
-
const prev = byWorkflow[event.workflow] ?? { cost: 0, executions: 0 };
|
|
884
|
+
const prev = byWorkflow[event.workflow] ?? { cost: 0, executions: 0, unpricedCalls: 0 };
|
|
873
885
|
byWorkflow[event.workflow] = {
|
|
874
886
|
cost: prev.cost + cost,
|
|
875
|
-
executions: prev.executions + (isWorkflowStart ? 1 : 0)
|
|
887
|
+
executions: prev.executions + (isWorkflowStart ? 1 : 0),
|
|
888
|
+
unpricedCalls: prev.unpricedCalls + (unpricedLeaf ? 1 : 0)
|
|
876
889
|
};
|
|
877
890
|
}
|
|
878
891
|
let retry = acc.retry;
|
|
@@ -903,15 +916,17 @@ function reduceCost(acc, event) {
|
|
|
903
916
|
byEmbedder = { ...acc.byEmbedder };
|
|
904
917
|
const modelKey = usage?.model ?? "unknown";
|
|
905
918
|
const embedTokens = typeof usage?.tokens === "number" ? finite(usage.tokens) : 0;
|
|
906
|
-
const prev = byEmbedder[modelKey] ?? { cost: 0, calls: 0, tokens: 0 };
|
|
919
|
+
const prev = byEmbedder[modelKey] ?? { cost: 0, calls: 0, unpricedCalls: 0, tokens: 0 };
|
|
907
920
|
byEmbedder[modelKey] = {
|
|
908
921
|
cost: prev.cost + cost,
|
|
909
922
|
calls: prev.calls + 1,
|
|
923
|
+
unpricedCalls: prev.unpricedCalls + (unpricedLeaf ? 1 : 0),
|
|
910
924
|
tokens: prev.tokens + embedTokens
|
|
911
925
|
};
|
|
912
926
|
}
|
|
913
927
|
return {
|
|
914
928
|
totalCost: acc.totalCost + cost,
|
|
929
|
+
unpricedCalls: acc.unpricedCalls + (unpricedLeaf ? 1 : 0),
|
|
915
930
|
totalTokens,
|
|
916
931
|
byAgent,
|
|
917
932
|
byModel,
|