@agentistics/mcp 2.3.1 → 2.3.2
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/agentistics-mcp.js +51 -19
- package/package.json +1 -1
package/dist/agentistics-mcp.js
CHANGED
|
@@ -89,6 +89,31 @@ function getModelPrice(modelId) {
|
|
|
89
89
|
return MODEL_PRICING[hit];
|
|
90
90
|
return { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 };
|
|
91
91
|
}
|
|
92
|
+
function sessionModelUsage(s, fallbackModel) {
|
|
93
|
+
const breakdown = s.model_usage;
|
|
94
|
+
if (breakdown && typeof breakdown === "object") {
|
|
95
|
+
const entries = Object.entries(breakdown).filter(([m, u]) => m && u);
|
|
96
|
+
if (entries.length > 0)
|
|
97
|
+
return entries;
|
|
98
|
+
}
|
|
99
|
+
const model = s.model || fallbackModel || "";
|
|
100
|
+
if (!model)
|
|
101
|
+
return [];
|
|
102
|
+
return [[model, {
|
|
103
|
+
inputTokens: s.input_tokens ?? 0,
|
|
104
|
+
outputTokens: s.output_tokens ?? 0,
|
|
105
|
+
cacheReadInputTokens: s.cache_read_input_tokens ?? 0,
|
|
106
|
+
cacheCreationInputTokens: s.cache_creation_input_tokens ?? 0,
|
|
107
|
+
webSearchRequests: 0,
|
|
108
|
+
costUSD: 0
|
|
109
|
+
}]];
|
|
110
|
+
}
|
|
111
|
+
function sessionCostUSD(s, fallbackModel) {
|
|
112
|
+
const entries = sessionModelUsage(s, fallbackModel);
|
|
113
|
+
if (entries.length === 0)
|
|
114
|
+
return null;
|
|
115
|
+
return entries.reduce((sum, [model, u]) => sum + calcCost(u, model), 0);
|
|
116
|
+
}
|
|
92
117
|
function calcCost(usage, modelId) {
|
|
93
118
|
const price = getModelPrice(modelId);
|
|
94
119
|
return usage.inputTokens / 1e6 * price.input + usage.outputTokens / 1e6 * price.output + usage.cacheReadInputTokens / 1e6 * price.cacheRead + usage.cacheCreationInputTokens / 1e6 * price.cacheWrite;
|
|
@@ -298,24 +323,7 @@ var PLAN_CATALOG = [
|
|
|
298
323
|
}
|
|
299
324
|
];
|
|
300
325
|
var BY_ID = new Map(PLAN_CATALOG.map((entry) => [entry.id, entry]));
|
|
301
|
-
//
|
|
302
|
-
var API = process.env.AGENTISTICS_API ?? "http://localhost:47291";
|
|
303
|
-
function calcCostUSD(input, output, cacheRead, cacheWrite, model) {
|
|
304
|
-
return calcCost({
|
|
305
|
-
inputTokens: input,
|
|
306
|
-
outputTokens: output,
|
|
307
|
-
cacheReadInputTokens: cacheRead,
|
|
308
|
-
cacheCreationInputTokens: cacheWrite,
|
|
309
|
-
webSearchRequests: 0,
|
|
310
|
-
costUSD: 0
|
|
311
|
-
}, model);
|
|
312
|
-
}
|
|
313
|
-
var HARNESS_IDS = ["claude", "codex", "gemini", "copilot", "antigravity"];
|
|
314
|
-
var HARNESS_PARAM = {
|
|
315
|
-
type: "string",
|
|
316
|
-
enum: ["all", ...HARNESS_IDS],
|
|
317
|
-
description: "Scope to one harness (claude | codex | gemini | copilot | antigravity), or 'all' (default) for the unified view across every harness."
|
|
318
|
-
};
|
|
326
|
+
// session-tokens.ts
|
|
319
327
|
function sessionHarness(s) {
|
|
320
328
|
return s.harness ?? "claude";
|
|
321
329
|
}
|
|
@@ -329,11 +337,35 @@ function sessionTokens(s) {
|
|
|
329
337
|
const output = s.output_tokens ?? 0;
|
|
330
338
|
const cacheRead = s.cache_read_input_tokens ?? 0;
|
|
331
339
|
const cacheWrite = s.cache_creation_input_tokens ?? 0;
|
|
332
|
-
|
|
340
|
+
const cost = sessionCostUSD({
|
|
341
|
+
model: s.model,
|
|
342
|
+
model_usage: s.model_usage,
|
|
343
|
+
input_tokens: input,
|
|
344
|
+
output_tokens: output,
|
|
345
|
+
cache_read_input_tokens: cacheRead,
|
|
346
|
+
cache_creation_input_tokens: cacheWrite
|
|
347
|
+
}) ?? calcCost({
|
|
348
|
+
inputTokens: input,
|
|
349
|
+
outputTokens: output,
|
|
350
|
+
cacheReadInputTokens: cacheRead,
|
|
351
|
+
cacheCreationInputTokens: cacheWrite,
|
|
352
|
+
webSearchRequests: 0,
|
|
353
|
+
costUSD: 0
|
|
354
|
+
}, "");
|
|
355
|
+
return { input, output, cacheRead, cacheWrite, cost };
|
|
333
356
|
}
|
|
334
357
|
function sessionMessages(s) {
|
|
335
358
|
return (s.user_message_count ?? 0) + (s.assistant_message_count ?? 0);
|
|
336
359
|
}
|
|
360
|
+
|
|
361
|
+
// agentistics-mcp.ts
|
|
362
|
+
var API = process.env.AGENTISTICS_API ?? "http://localhost:47291";
|
|
363
|
+
var HARNESS_IDS = ["claude", "codex", "gemini", "copilot", "antigravity"];
|
|
364
|
+
var HARNESS_PARAM = {
|
|
365
|
+
type: "string",
|
|
366
|
+
enum: ["all", ...HARNESS_IDS],
|
|
367
|
+
description: "Scope to one harness (claude | codex | gemini | copilot | antigravity), or 'all' (default) for the unified view across every harness."
|
|
368
|
+
};
|
|
337
369
|
var CATALOG = [
|
|
338
370
|
{ id: "kpi.messages", label: "Messages", category: "kpi", defaultW: 3, defaultH: 3, minW: 2, minH: 2, description: "Total message count in selected period" },
|
|
339
371
|
{ id: "kpi.sessions", label: "Sessions", category: "kpi", defaultW: 3, defaultH: 3, minW: 2, minH: 2, description: "Session count + avg msgs/session" },
|