@agentistics/mcp 2.173.1 → 2.175.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.
@@ -24,7 +24,7 @@ var HARNESS_CAPABILITIES = {
24
24
  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 },
25
25
  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 },
26
26
  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 },
27
- opencode: { tokens: false, cost: false, model: false, tools: false, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: false, contextWindow: false, compaction: false, skills: false, mcpServers: false },
27
+ opencode: { tokens: true, cost: true, model: true, tools: false, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: true, compaction: false, skills: false, mcpServers: false },
28
28
  agentistics: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: false, contextWindow: false, compaction: false, skills: false, mcpServers: false }
29
29
  };
30
30
  var HARNESS_SORT = {
@@ -115,6 +115,8 @@ function pricingKey(modelId) {
115
115
  return forwardKey || reverseKey || null;
116
116
  }
117
117
  function getModelPrice(modelId) {
118
+ if (modelId === "opencode/big-pickle" || /^opencode\/[^/]+-free$/.test(modelId))
119
+ return LOCAL_MODEL_PRICE;
118
120
  if (MODEL_PRICING[modelId])
119
121
  return MODEL_PRICING[modelId];
120
122
  if (isLocalModelId(modelId))
@@ -860,11 +862,11 @@ var CAPABILITY_REFINEMENTS = {
860
862
  gitLines: { source: `${P2}; ${REPLAY("antigravity")}`, state: { state: "partial", exactness: "exact", limit: "request-time line counts from edit payloads (CodeContent / ReplacementContent vs TargetContent), not git diff; agy stores no git metadata." } }
861
863
  },
862
864
  opencode: {
863
- tokens: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: "no legacy adapter surfaces an opencode SessionMeta at all; the canonical counters (input/output/cacheRead/cacheWrite + a separate additive reasoning counter) are real, read from each assistant message's own tokens field and proven equal to session.tokens_* by an independent recount." } },
864
- cost: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: "opencode's own per-message cost is carried as costSource: 'harness' (not the shared table) because both real sessions measured used unpriced local/free models (cost 0); no legacy adapter surfaces it on any surface." } },
865
- model: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: "the bare model id (message.modelID) is real; no legacy adapter surfaces it on any surface." } },
866
- tools: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: 'real tool calls (name, status, timing) from part rows of type "tool"; no legacy adapter surfaces them on any surface, and only the four tool names measured on the real store (bash, write, read, skill) are known to map through canonicalTool.' } },
867
- activeTime: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: "turn.started/turn.ended are emitted per user message and per settled assistant reply, closing 'last-line' always (opencode states no whole-turn duration, only per-step timing); no legacy adapter surfaces active_minutes on any surface." } }
865
+ tokens: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: "the canonical counters (input/output/cacheRead/cacheWrite + a separate additive reasoning counter) are real, read from each assistant message's own tokens field and proven equal to session.tokens_* by an independent recount." } },
866
+ cost: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: "opencode's own per-message cost is carried as costSource: 'harness' (not the shared table) because both real sessions measured used unpriced local/free models (cost 0); the local metrics adapter instead estimates API costs through the shared table." } },
867
+ model: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: "the bare model id (message.modelID) is real; the local metrics adapter also preserves unknown provider routes." } },
868
+ tools: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: 'real tool calls (name, status, timing) from part rows of type "tool"; the local metrics adapter does not count tool parts, and only the four tool names measured on the real store (bash, write, read, skill) are known to map through canonicalTool.' } },
869
+ activeTime: { source: REPLAY("opencode"), state: { state: "partial", exactness: "exact", limit: "turn.started/turn.ended are emitted per user message and per settled assistant reply, closing 'last-line' always (opencode states no whole-turn duration, only per-step timing); the local metrics adapter also reconstructs active_minutes from message boundaries." } }
868
870
  }
869
871
  };
870
872
  function applyCapabilityRefinements(base, refinements = CAPABILITY_REFINEMENTS) {
@@ -1000,7 +1002,7 @@ var AGENT_TOOL_POLICY = {
1000
1002
  agentistics_harnesses: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics", "GET /api/plan-limits"], reason: "reads computed metrics per harness and whether each can be spawned" },
1001
1003
  agentistics_plan_limits: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/plan-limits"], reason: "reads subscription windows and routing guidance; does not start work" },
1002
1004
  agentistics_projects: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics"], reason: "reads computed metrics per project" },
1003
- agentistics_sessions: { ...DATA, capability: "localShell", host: true, risk: "R", routes: ["GET /api/data", "GET /api/fleet"], reason: "reads session metadata (first_prompt is untrusted text, §4.8)" },
1005
+ agentistics_sessions: { ...DATA, capability: "localShell", host: true, risk: "R", routes: ["GET /api/data", "GET /api/fleet", "GET /api/flows/delivered-open"], reason: "reads session metadata (first_prompt is untrusted text, §4.8)" },
1004
1006
  agentistics_costs: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics"], reason: "reads computed costs" },
1005
1007
  agentistics_repos: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics"], reason: "reads computed metrics per repository" },
1006
1008
  agentistics_component_catalog: { ...DATA, risk: "R", routes: [], reason: "returns a static list; calls nothing" },
@@ -1286,6 +1288,22 @@ function startedByIndex(rows) {
1286
1288
  function startedByFleetPayload(payload) {
1287
1289
  return startedByIndex(Array.isArray(payload.rows) ? payload.rows : []);
1288
1290
  }
1291
+ function deliveredOpenByConversation(payload) {
1292
+ const out = new Map;
1293
+ const list = payload && typeof payload === "object" && Array.isArray(payload.sessions) ? payload.sessions : [];
1294
+ for (const raw of list) {
1295
+ if (!raw || typeof raw !== "object")
1296
+ continue;
1297
+ const d = raw;
1298
+ if (typeof d.sessionId !== "string" || typeof d.handbackAt !== "string")
1299
+ continue;
1300
+ const entry = { managedId: d.sessionId, handbackAt: d.handbackAt, ...d.lastRun && typeof d.lastRun === "object" ? { lastRun: d.lastRun } : {} };
1301
+ if (typeof d.conversationId === "string")
1302
+ out.set(d.conversationId, entry);
1303
+ out.set(d.sessionId, entry);
1304
+ }
1305
+ return out;
1306
+ }
1289
1307
 
1290
1308
  // agent-audit.ts
1291
1309
  import { createHash } from "node:crypto";
@@ -2528,7 +2546,7 @@ var TOOLS = [
2528
2546
  },
2529
2547
  {
2530
2548
  name: "agentistics_sessions",
2531
- description: "Get the most recent sessions with harness, project path, duration, message count, token usage, and model. Optionally scope to a single harness.",
2549
+ description: "Get the most recent sessions with harness, project path, duration, message count, token usage, and model. Optionally scope to a single harness. With AGENTISTICS_FLOWS on, a worker that handed back and is still open carries `deliveredStillOpen` ({managedId, handbackAt, lastRun?}): close it with agentistics_flow_run name=fechar-entregue {sessionId: managedId}, which only closes it when stopped, clean and saved.",
2532
2550
  inputSchema: {
2533
2551
  type: "object",
2534
2552
  properties: {
@@ -3068,6 +3086,7 @@ async function callTool(req) {
3068
3086
  const harness = args?.harness;
3069
3087
  const data = await apiGet("/api/data");
3070
3088
  const startedBy = await apiGet("/api/fleet?format=links-v1").then((f) => startedByFleetPayload(f ?? {})).catch(() => new Map);
3089
+ const delivered = await apiGet("/api/flows/delivered-open").then((d) => deliveredOpenByConversation(d)).catch(() => new Map);
3071
3090
  const rows = filterSessions(data.sessions ?? [], harness).slice(0, limit).map((s) => {
3072
3091
  const { input, output, cacheRead, cacheWrite, cost, unpriced } = sessionTokens2(s);
3073
3092
  return {
@@ -3087,7 +3106,8 @@ async function callTool(req) {
3087
3106
  ...s.tokens_unavailable ? {} : { estimatedCostUSD: unpriced > 0 && unpriced === input + output + cacheRead + cacheWrite ? null : Math.round(cost * 1e4) / 1e4 },
3088
3107
  ...unpriced > 0 ? { unpricedTokens: unpriced } : {},
3089
3108
  model: s.model ?? null,
3090
- ...startedBy.get(s.session_id) ? { startedBy: startedBy.get(s.session_id) } : {}
3109
+ ...startedBy.get(s.session_id) ? { startedBy: startedBy.get(s.session_id) } : {},
3110
+ ...delivered.get(s.session_id) ? { deliveredStillOpen: delivered.get(s.session_id) } : {}
3091
3111
  };
3092
3112
  });
3093
3113
  return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }] };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentistics/mcp",
3
- "version": "2.173.1",
3
+ "version": "2.175.0",
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",