@agentistics/mcp 2.60.0 → 2.60.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.
@@ -24,6 +24,14 @@ function isLocalModelId(modelId) {
24
24
  var LOCAL_MODEL_PRICE = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cacheWrite1h: 0 };
25
25
 
26
26
  // ../core/src/types.ts
27
+ var HARNESS_CAPABILITIES = {
28
+ claude: { tokens: true, cost: true, model: true, tools: true, agents: true, gitLines: true, dynamicWorkflows: true, activeTime: true, contextWindow: true, compaction: true, skills: true, mcpServers: true },
29
+ codex: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: true, compaction: false, skills: false, mcpServers: false },
30
+ gemini: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: false, compaction: false, skills: false, mcpServers: false },
31
+ copilot: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: true, dynamicWorkflows: false, activeTime: true, contextWindow: false, compaction: false, skills: false, mcpServers: false },
32
+ antigravity: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: true, compaction: false, skills: false, mcpServers: false },
33
+ kimi: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: true, compaction: false, skills: false, mcpServers: true }
34
+ };
27
35
  var HARNESS_SORT = {
28
36
  claude: 0,
29
37
  codex: 1,
@@ -37,6 +45,7 @@ var BASE_MODEL_PRICING = {
37
45
  "claude-fable-5": { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
38
46
  "claude-mythos-5": { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
39
47
  "claude-opus-5": { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
48
+ "claude-opus-5-5": { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 5 },
40
49
  "claude-opus-4-8": { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
41
50
  "claude-opus-4-7": { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
42
51
  "claude-sonnet-5": { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 },
@@ -123,6 +132,36 @@ function calcCost(usage, modelId) {
123
132
  const cacheWriteCost = hasTtlBreakdown ? (usage.cacheCreation1hInputTokens ?? 0) / 1e6 * price.cacheWrite1h + (usage.cacheCreation5mInputTokens ?? 0) / 1e6 * price.cacheWrite : usage.cacheCreationInputTokens / 1e6 * price.cacheWrite;
124
133
  return usage.inputTokens / 1e6 * price.input + usage.outputTokens / 1e6 * price.output + usage.cacheReadInputTokens / 1e6 * price.cacheRead + cacheWriteCost;
125
134
  }
135
+ // ../core/src/tokens.ts
136
+ var EMPTY_TOKENS = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
137
+ function usageTokens(u) {
138
+ return {
139
+ input: u?.inputTokens ?? 0,
140
+ output: u?.outputTokens ?? 0,
141
+ cacheRead: u?.cacheReadInputTokens ?? 0,
142
+ cacheWrite: u?.cacheCreationInputTokens ?? 0
143
+ };
144
+ }
145
+ function addTokens(a, b) {
146
+ return {
147
+ input: a.input + b.input,
148
+ output: a.output + b.output,
149
+ cacheRead: a.cacheRead + b.cacheRead,
150
+ cacheWrite: a.cacheWrite + b.cacheWrite
151
+ };
152
+ }
153
+ function sumTokens(parts) {
154
+ let acc = EMPTY_TOKENS;
155
+ for (const p of parts)
156
+ acc = addTokens(acc, p);
157
+ return acc;
158
+ }
159
+ function totalTokens(b) {
160
+ return b.input + b.output + b.cacheRead + b.cacheWrite;
161
+ }
162
+ function usageTokenTotal(u) {
163
+ return totalTokens(usageTokens(u));
164
+ }
126
165
  // ../core/src/team.ts
127
166
  var DEFAULT_TEAM = Object.freeze({
128
167
  schema: 2,
@@ -381,6 +420,218 @@ var IMAGE_EXTENSIONS = new Set(["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg
381
420
  // ../core/src/pasteSanitize.ts
382
421
  var BRACKETED_PASTE_START = "\x1B[200~";
383
422
  var MARKER_LEN = BRACKETED_PASTE_START.length;
423
+ // ../core/src/canonical/event.ts
424
+ var REQUIRED_EVENT_TYPES = [
425
+ "session.started",
426
+ "session.ended",
427
+ "run.started",
428
+ "run.ended",
429
+ "agent.started",
430
+ "agent.ended",
431
+ "model.invoked",
432
+ "model.completed",
433
+ "model.failed",
434
+ "tool.requested",
435
+ "tool.completed",
436
+ "tool.failed"
437
+ ];
438
+ var EVENT_TYPES = [
439
+ ...REQUIRED_EVENT_TYPES,
440
+ "model.started",
441
+ "model.delta",
442
+ "tool.approved",
443
+ "tool.denied",
444
+ "tool.progress",
445
+ "mcp.requested",
446
+ "mcp.completed",
447
+ "browser.session.started",
448
+ "browser.tab.created",
449
+ "browser.tab.focused",
450
+ "browser.navigation",
451
+ "browser.click",
452
+ "browser.input",
453
+ "browser.scroll",
454
+ "browser.screenshot",
455
+ "browser.download",
456
+ "browser.tab.closed",
457
+ "context.compacted",
458
+ "context.window.observed",
459
+ "policy.requested",
460
+ "policy.approved",
461
+ "policy.denied",
462
+ "alm.task.created",
463
+ "alm.task.updated",
464
+ "alm.task.completed",
465
+ "alm.evidence.attached",
466
+ "process.started",
467
+ "process.ended"
468
+ ];
469
+ var EVENT_TYPE_SET = new Set(EVENT_TYPES);
470
+ // ../core/src/canonical/event-id.ts
471
+ var PROVIDER_KEYED_TYPES = [
472
+ "model.invoked",
473
+ "model.started",
474
+ "model.delta",
475
+ "model.completed",
476
+ "model.failed"
477
+ ];
478
+ var PROVIDER_KEYED = new Set(PROVIDER_KEYED_TYPES);
479
+ var K = new Uint32Array([
480
+ 1116352408,
481
+ 1899447441,
482
+ 3049323471,
483
+ 3921009573,
484
+ 961987163,
485
+ 1508970993,
486
+ 2453635748,
487
+ 2870763221,
488
+ 3624381080,
489
+ 310598401,
490
+ 607225278,
491
+ 1426881987,
492
+ 1925078388,
493
+ 2162078206,
494
+ 2614888103,
495
+ 3248222580,
496
+ 3835390401,
497
+ 4022224774,
498
+ 264347078,
499
+ 604807628,
500
+ 770255983,
501
+ 1249150122,
502
+ 1555081692,
503
+ 1996064986,
504
+ 2554220882,
505
+ 2821834349,
506
+ 2952996808,
507
+ 3210313671,
508
+ 3336571891,
509
+ 3584528711,
510
+ 113926993,
511
+ 338241895,
512
+ 666307205,
513
+ 773529912,
514
+ 1294757372,
515
+ 1396182291,
516
+ 1695183700,
517
+ 1986661051,
518
+ 2177026350,
519
+ 2456956037,
520
+ 2730485921,
521
+ 2820302411,
522
+ 3259730800,
523
+ 3345764771,
524
+ 3516065817,
525
+ 3600352804,
526
+ 4094571909,
527
+ 275423344,
528
+ 430227734,
529
+ 506948616,
530
+ 659060556,
531
+ 883997877,
532
+ 958139571,
533
+ 1322822218,
534
+ 1537002063,
535
+ 1747873779,
536
+ 1955562222,
537
+ 2024104815,
538
+ 2227730452,
539
+ 2361852424,
540
+ 2428436474,
541
+ 2756734187,
542
+ 3204031479,
543
+ 3329325298
544
+ ]);
545
+ // ../core/src/canonical/capabilities.ts
546
+ var CAPABILITY_METRICS = Object.keys(HARNESS_CAPABILITIES.claude);
547
+ var SUPPORTED_EXACTNESS = {
548
+ cost: "estimated"
549
+ };
550
+ var TYPES = "packages/core/src/types.ts";
551
+ var INFO = "packages/web/src/lib/harness.ts HARNESS_INFO";
552
+ var MASTER = "docs/superpowers/specs/2026-09-19-agentistics-runtime-master.md";
553
+ var COMPACTION = {
554
+ state: "not_supported",
555
+ reason: "Claude Code writes a compact_boundary system line; no other harness has an equivalent marker, so the compaction figures are absent rather than zero.",
556
+ source: `${TYPES} HarnessCapabilities.compaction docstring`
557
+ };
558
+ var SKILLS = {
559
+ state: "not_applicable",
560
+ reason: "Claude Code writes a Skill tool_use naming the skill; no other harness has the concept at all, so skills are absent rather than an empty map.",
561
+ source: `${TYPES} HarnessCapabilities.skills docstring`
562
+ };
563
+ var LEGACY_FALSE_NOTES = {
564
+ codex: {
565
+ agents: { state: "not_supported", reason: "Codex does not record per-subagent breakdowns in its transcripts.", source: `${INFO}.codex.missing (Subagent metrics)` },
566
+ gitLines: { state: "not_supported", reason: "Git line counts are not present in Codex transcripts.", source: `${INFO}.codex.missing (Git line counts)` },
567
+ compaction: COMPACTION,
568
+ skills: SKILLS,
569
+ mcpServers: { state: "not_supported", reason: "Codex records no MCP tool at all, so the MCP server cannot be read back off tool_counts.", source: `${TYPES} HarnessCapabilities.mcpServers docstring` }
570
+ },
571
+ gemini: {
572
+ agents: { state: "not_supported", reason: "Gemini CLI does not record per-subagent breakdowns.", source: `${INFO}.gemini.missing (Subagent metrics)` },
573
+ gitLines: { state: "not_supported", reason: "Gemini's tool calls name the file they touched but carry no diff counters.", source: `${TYPES} HARNESS_CAPABILITIES entry comment (gemini)` },
574
+ compaction: COMPACTION,
575
+ skills: SKILLS,
576
+ mcpServers: { state: "not_supported", reason: "Gemini records no MCP tool at all, so the MCP server cannot be read back off tool_counts.", source: `${TYPES} HarnessCapabilities.mcpServers docstring` }
577
+ },
578
+ copilot: {
579
+ agents: { state: "not_supported", reason: "Sub-agent metrics are not available in Copilot local event logs.", source: `${INFO}.copilot.missing (Sub-agent metrics)` },
580
+ contextWindow: { state: "not_supported", reason: "Copilot's only token report is a cumulative one written at shutdown, and a cumulative total is not a context size.", source: `${TYPES} HarnessCapabilities.contextWindow docstring` },
581
+ compaction: COMPACTION,
582
+ skills: SKILLS,
583
+ mcpServers: { state: "not_supported", reason: "Copilot keeps MCP names in mcp_tool_names and never records the server.", source: `${TYPES} HarnessCapabilities.mcpServers docstring` }
584
+ },
585
+ antigravity: {
586
+ agents: { state: "not_supported", reason: "An invoke_subagent child is a whole conversation of its own instead of an agent invocation recorded on the parent, so there is no per-invocation list to show.", source: `${INFO}.antigravity.missing (Sub-agent table)` },
587
+ gitLines: { state: "not_supported", reason: "agy has no git integration, and its transcript only lets us count added lines; removals need the replaced blob (TargetContent), which agy does not write for its normal edit path.", source: `${TYPES} HARNESS_CAPABILITIES entry comment (antigravity)` },
588
+ compaction: COMPACTION,
589
+ mcpServers: { state: "not_supported", reason: "Antigravity writes MCP tools as mcp_ with one underscore and call_mcp_tool, so the MCP server cannot be read back off tool_counts.", source: `${TYPES} HarnessCapabilities.mcpServers docstring` }
590
+ },
591
+ kimi: {
592
+ agents: { state: "not_supported", reason: "Kimi's agent tree is merged into one set of session totals with no per-agent breakdown.", source: `${MASTER} §5` },
593
+ gitLines: { state: "not_supported", reason: "Kimi records the Edit/Write strings but no diff counters.", source: `${TYPES} HARNESS_CAPABILITIES entry comment (kimi)` },
594
+ compaction: COMPACTION,
595
+ skills: SKILLS
596
+ }
597
+ };
598
+ var NO_RECORDED_REASON = "no reason recorded — needs review";
599
+ function fromLegacyCapabilities(legacy, notes = LEGACY_FALSE_NOTES) {
600
+ const result = {};
601
+ for (const harnessId of Object.keys(legacy)) {
602
+ const harnessCaps = legacy[harnessId];
603
+ const harnessNotes = notes[harnessId];
604
+ const states = {};
605
+ for (const metric of Object.keys(harnessCaps)) {
606
+ const supported = harnessCaps[metric];
607
+ if (supported) {
608
+ states[metric] = { state: "supported", exactness: SUPPORTED_EXACTNESS[metric] ?? "exact" };
609
+ continue;
610
+ }
611
+ const note = harnessNotes?.[metric];
612
+ if (note) {
613
+ states[metric] = { state: note.state, reason: note.reason, source: note.source };
614
+ } else {
615
+ states[metric] = { state: "unknown", reason: NO_RECORDED_REASON, source: null };
616
+ }
617
+ }
618
+ result[harnessId] = states;
619
+ }
620
+ return result;
621
+ }
622
+ var CAPABILITY_STATES = fromLegacyCapabilities(HARNESS_CAPABILITIES);
623
+ // ../core/src/provider/edit-policy.ts
624
+ var ANTHROPIC_EDIT_POLICY = Object.freeze({
625
+ provider: "anthropic",
626
+ kinds: Object.freeze({
627
+ "tool-result": "unverified",
628
+ "tool-input": "unverified",
629
+ reasoning: "immutable",
630
+ "assistant-text": "immutable"
631
+ }),
632
+ status: "declared-unverified",
633
+ source: "CM §7 (docs/superpowers/specs/2026-09-25-runtime-context-manager-design.md), citing " + "Anthropic's documentation that editing earlier turns can invalidate later reasoning blocks " + "(signed signature_delta, R12 §1.3); assistant-text immutability is a product rule (CM §7 line 227)."
634
+ });
384
635
  // session-tokens.ts
385
636
  function sessionHarness(s) {
386
637
  return s.harness ?? "claude";
@@ -415,15 +666,37 @@ function sessionTokens2(s) {
415
666
  function sessionMessages(s) {
416
667
  return (s.user_message_count ?? 0) + (s.assistant_message_count ?? 0);
417
668
  }
669
+ function statsCacheTotals(sc) {
670
+ const entries = Object.entries(sc?.modelUsage ?? {});
671
+ const b = sumTokens(entries.map(([, u]) => usageTokens(u)));
672
+ let cost = 0;
673
+ let top = null;
674
+ for (const [model, u] of entries) {
675
+ cost += calcCost({
676
+ inputTokens: u.inputTokens ?? 0,
677
+ outputTokens: u.outputTokens ?? 0,
678
+ cacheReadInputTokens: u.cacheReadInputTokens ?? 0,
679
+ cacheCreationInputTokens: u.cacheCreationInputTokens ?? 0,
680
+ webSearchRequests: 0,
681
+ costUSD: 0
682
+ }, model);
683
+ const n = usageTokenTotal(u);
684
+ if (!top || n > top.n)
685
+ top = { model, n };
686
+ }
687
+ return { ...b, tokens: totalTokens(b), cost, topModel: top?.model ?? null };
688
+ }
689
+ function harnessParam() {
690
+ return {
691
+ type: "string",
692
+ enum: ["all", ...HARNESS_ORDER],
693
+ description: `Scope to one harness (${HARNESS_ORDER.join(" | ")}), or 'all' (default) for the unified view across every harness.`
694
+ };
695
+ }
418
696
 
419
697
  // agentistics-mcp.ts
420
698
  var API = process.env.AGENTISTICS_API ?? "http://localhost:47291";
421
- var HARNESS_IDS = ["claude", "codex", "gemini", "copilot", "antigravity"];
422
- var HARNESS_PARAM = {
423
- type: "string",
424
- enum: ["all", ...HARNESS_IDS],
425
- description: "Scope to one harness (claude | codex | gemini | copilot | antigravity), or 'all' (default) for the unified view across every harness."
426
- };
699
+ var HARNESS_PARAM = harnessParam();
427
700
  var CATALOG = [
428
701
  { id: "kpi.messages", label: "Messages", category: "kpi", defaultW: 3, defaultH: 3, minW: 2, minH: 2, description: "Total message count in selected period" },
429
702
  { id: "kpi.sessions", label: "Sessions", category: "kpi", defaultW: 3, defaultH: 3, minW: 2, minH: 2, description: "Session count + avg msgs/session" },
@@ -1175,7 +1448,7 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
1175
1448
  const unified = !harness || harness === "all";
1176
1449
  const data = await apiGet("/api/data");
1177
1450
  const sc = data.statsCache ?? {};
1178
- const totals = sc.allTimeTotals ?? {};
1451
+ const totals = statsCacheTotals(sc);
1179
1452
  const allSessions = filterSessions(data.sessions ?? [], harness);
1180
1453
  let totalCostUSD = 0;
1181
1454
  let totalInput = 0, totalOutput = 0, totalCacheRead = 0, totalCacheWrite = 0;
@@ -1197,18 +1470,18 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
1197
1470
  activeDates.add(String(s.start_time).slice(0, 10));
1198
1471
  }
1199
1472
  const claudeFallback = unified || harness === "claude";
1200
- const topModel = Object.entries(modelTokens).sort(([, a], [, b]) => b - a)[0]?.[0] ?? (claudeFallback ? Object.entries(sc.modelUsage ?? {}).sort(([, a], [, b]) => (b.totalTokens ?? 0) - (a.totalTokens ?? 0))[0]?.[0] ?? "—" : "—");
1473
+ const topModel = Object.entries(modelTokens).sort(([, a], [, b]) => b - a)[0]?.[0] ?? (claudeFallback ? totals.topModel ?? "—" : "—");
1201
1474
  const topProject = Object.entries(projectSessions).sort(([, a], [, b]) => b - a)[0]?.[0] ?? "—";
1202
1475
  return {
1203
1476
  content: [{
1204
1477
  type: "text",
1205
1478
  text: JSON.stringify({
1206
1479
  harness: unified ? "all" : harness,
1207
- totalInputTokens: totalInput || (claudeFallback ? totals.inputTokens ?? 0 : 0),
1208
- totalOutputTokens: totalOutput || (claudeFallback ? totals.outputTokens ?? 0 : 0),
1209
- totalCacheReadTokens: totalCacheRead || (claudeFallback ? totals.cacheReadTokens ?? 0 : 0),
1210
- totalCacheWriteTokens: totalCacheWrite || (claudeFallback ? totals.cacheWriteTokens ?? 0 : 0),
1211
- estimatedCostUSD: Math.round(totalCostUSD * 100) / 100,
1480
+ totalInputTokens: totalInput || (claudeFallback ? totals.input : 0),
1481
+ totalOutputTokens: totalOutput || (claudeFallback ? totals.output : 0),
1482
+ totalCacheReadTokens: totalCacheRead || (claudeFallback ? totals.cacheRead : 0),
1483
+ totalCacheWriteTokens: totalCacheWrite || (claudeFallback ? totals.cacheWrite : 0),
1484
+ estimatedCostUSD: Math.round((totalCostUSD || (claudeFallback ? totals.cost : 0)) * 100) / 100,
1212
1485
  totalSessions: allSessions.length,
1213
1486
  topModel,
1214
1487
  topProject,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentistics/mcp",
3
- "version": "2.60.0",
3
+ "version": "2.60.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",