@agentistics/mcp 2.204.0 → 2.204.1

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.
@@ -237,6 +237,51 @@ function calcCost(usage, modelId) {
237
237
  const cacheWriteCost = hasTtlBreakdown ? (usage.cacheCreation1hInputTokens ?? 0) / 1e6 * price.cacheWrite1h + (usage.cacheCreation5mInputTokens ?? 0) / 1e6 * price.cacheWrite : usage.cacheCreationInputTokens / 1e6 * price.cacheWrite;
238
238
  return usage.inputTokens / 1e6 * price.input + usage.outputTokens / 1e6 * price.output + usage.cacheReadInputTokens / 1e6 * price.cacheRead + cacheWriteCost;
239
239
  }
240
+ // ../core/src/contextWindows.ts
241
+ var ANTHROPIC_DOCS = "platform.claude.com/docs/en/about-claude/models/overview";
242
+ var CONTEXT_WINDOWS = {
243
+ "gemini-3.8-flash": { tokens: 1048576, verifiedAt: "2026-10-20", source: "ai.google.dev/gemini-api/docs/models/gemini-3.8-flash" },
244
+ "claude-fable-5": { tokens: 1e6, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS },
245
+ "claude-mythos-5": { tokens: 1e6, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS },
246
+ "claude-opus-5": { tokens: 1e6, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS },
247
+ "claude-opus-4-8": { tokens: 1e6, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS },
248
+ "claude-opus-4-7": { tokens: 1e6, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS },
249
+ "claude-opus-4-6": { tokens: 1e6, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS },
250
+ "claude-sonnet-5": { tokens: 1e6, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS },
251
+ "claude-sonnet-4-6": { tokens: 1e6, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS },
252
+ "claude-haiku-4-5": { tokens: 200000, verifiedAt: "2026-08-14", source: ANTHROPIC_DOCS }
253
+ };
254
+ function resolveContextWindow(modelId) {
255
+ const id = (modelId ?? "").trim();
256
+ if (id === "")
257
+ return null;
258
+ const exact = CONTEXT_WINDOWS[id];
259
+ if (exact)
260
+ return exact;
261
+ let best = null;
262
+ for (const [key, win] of Object.entries(CONTEXT_WINDOWS)) {
263
+ if (!id.startsWith(key))
264
+ continue;
265
+ if (!best || key.length > best.key.length)
266
+ best = { key, win };
267
+ }
268
+ return best?.win ?? null;
269
+ }
270
+ function contextFraction(used, window) {
271
+ if (used === undefined || window === undefined)
272
+ return null;
273
+ if (!Number.isFinite(used) || !Number.isFinite(window))
274
+ return null;
275
+ if (window <= 0 || used < 0)
276
+ return null;
277
+ return used / window;
278
+ }
279
+ function contextReading(meta) {
280
+ const ok = (n) => typeof n === "number" && Number.isFinite(n) && n > 0;
281
+ const used = ok(meta.context_tokens) ? meta.context_tokens : null;
282
+ const window = ok(meta.context_window) ? meta.context_window : resolveContextWindow(meta.model)?.tokens ?? null;
283
+ return { used, window, fraction: used !== null && window !== null ? contextFraction(used, window) : null };
284
+ }
240
285
  // ../core/src/tokens.ts
241
286
  var EMPTY_TOKENS = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
242
287
  function usageTokens2(u) {
@@ -2146,6 +2191,19 @@ var PROJECTED_TOOLS = {
2146
2191
  // agentistics-mcp.ts
2147
2192
  var API = process.env.AGENTISTICS_API ?? "http://localhost:47291";
2148
2193
  var HARNESS_PARAM = harnessParam(false);
2194
+ function contextFields(s) {
2195
+ if (!HARNESS_CAPABILITIES[sessionHarness(s)]?.contextWindow)
2196
+ return {};
2197
+ const r = contextReading({ context_tokens: s.context_tokens, context_window: s.context_window, model: s.model });
2198
+ if (r.used === null)
2199
+ return {};
2200
+ return {
2201
+ contextTokens: r.used,
2202
+ contextWindow: r.window,
2203
+ contextFraction: r.fraction,
2204
+ ...r.window === null ? { contextLimit: "not reported" } : {}
2205
+ };
2206
+ }
2149
2207
  async function nativeVisibleNow() {
2150
2208
  try {
2151
2209
  const res = await fetch(`${API}/api/engine`, { signal: AbortSignal.timeout(2000) });
@@ -3539,6 +3597,7 @@ async function callTool(req) {
3539
3597
  ...s.tokens_unavailable ? {} : { estimatedCostUSD: unpriced > 0 && unpriced === input + output + cacheRead + cacheWrite ? null : Math.round(cost * 1e4) / 1e4 },
3540
3598
  ...unpriced > 0 ? { unpricedTokens: unpriced } : {},
3541
3599
  model: s.model ?? null,
3600
+ ...contextFields(s),
3542
3601
  ...startedBy.get(s.session_id) ? { startedBy: startedBy.get(s.session_id) } : {},
3543
3602
  ...delivered.get(s.session_id) ? { deliveredStillOpen: delivered.get(s.session_id) } : {}
3544
3603
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentistics/mcp",
3
- "version": "2.204.0",
3
+ "version": "2.204.1",
4
4
  "description": "Agentistics MCP server — Claude Code analytics for Claude Desktop and Claude Code",
5
5
  "type": "module",
6
6
  "main": "./dist/agentistics-mcp.js",