@agentistics/mcp 2.111.3 → 2.112.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.
@@ -938,9 +938,9 @@ var ANTHROPIC_EDIT_POLICY = Object.freeze({
938
938
  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)."
939
939
  });
940
940
  // ../core/src/agentToolPolicy.ts
941
- var TASKS = { capability: "localShell", host: true, central: "refuse", allowance: null };
941
+ var TASKS = { capability: "localShell", host: true, allowance: null };
942
942
  var GROUPS = TASKS;
943
- var DATA = { host: false, central: "allow", allowance: null };
943
+ var DATA = { host: false, allowance: null };
944
944
  var PREFS = DATA;
945
945
  var AGENT_TOOL_POLICY = {
946
946
  agentistics_tasks: { ...TASKS, risk: "R", routes: ["GET /api/tasks"], reason: "lists the board; changes nothing" },
@@ -1000,10 +1000,16 @@ var AGENT_TOOL_POLICY = {
1000
1000
  routes: ["POST /api/session-notify"],
1001
1001
  reason: "a per-session on/off switch for delivery; reversible, and the session state is untouched"
1002
1002
  },
1003
+ agentistics_session_message: {
1004
+ ...GROUPS,
1005
+ risk: "W",
1006
+ routes: ["POST /api/session-message"],
1007
+ reason: "types a message into another session through the composer path; additive, rate-limited, sender verified"
1008
+ },
1003
1009
  agentistics_summary: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics"], reason: "reads computed metrics" },
1004
1010
  agentistics_harnesses: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics"], reason: "reads computed metrics per harness" },
1005
1011
  agentistics_projects: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics"], reason: "reads computed metrics per project" },
1006
- agentistics_sessions: { ...DATA, risk: "R", routes: ["GET /api/data"], reason: "reads session metadata (first_prompt is untrusted text, §4.8)" },
1012
+ 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)" },
1007
1013
  agentistics_costs: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics"], reason: "reads computed costs" },
1008
1014
  agentistics_repos: { ...DATA, capability: "localTranscripts", host: true, risk: "R", routes: ["GET /api/data", "GET /api/runtime/metrics"], reason: "reads computed metrics per repository" },
1009
1015
  agentistics_component_catalog: { ...DATA, risk: "R", routes: [], reason: "returns a static list; calls nothing" },
@@ -1021,9 +1027,7 @@ var AGENT_TOOL_POLICY = {
1021
1027
  agentistics_build_layout: { ...PREFS, risk: "W", routes: ["GET /api/preferences", "PUT /api/preferences"], reason: "writes a layout; reversible by another build or delete" },
1022
1028
  agentistics_export_pdf: { ...DATA, risk: "R", routes: [], reason: "composes a local dashboard URL; calls nothing and exports nothing itself" },
1023
1029
  agentistics_tags: { ...DATA, risk: "R", routes: ["GET /api/tags"], reason: "reads aggregate-only tag cards" },
1024
- agentistics_tag_detail: { ...DATA, risk: "R", routes: ["GET /api/tags", "GET /api/tags/:id"], reason: "reads one tag aggregate (counts and sums only)" },
1025
- agentistics_team_status: { ...PREFS, risk: "R", routes: ["GET /api/preferences"], reason: "reads mode and connection endpoints; returns no token" },
1026
- agentistics_team_members: { ...DATA, central: "only", risk: "R", routes: ["GET /api/team/members"], reason: "reads the member list; central only" }
1030
+ agentistics_tag_detail: { ...DATA, risk: "R", routes: ["GET /api/tags", "GET /api/tags/:id"], reason: "reads one tag aggregate (counts and sums only)" }
1027
1031
  };
1028
1032
  // session-tokens.ts
1029
1033
  function sessionHarness(s) {
@@ -1096,6 +1100,19 @@ function toolsForGate(tools, nativeVisible) {
1096
1100
  return { ...t, inputSchema: { ...t.inputSchema, properties: { ...props, harness: param } } };
1097
1101
  });
1098
1102
  }
1103
+ function startedByIndex(rows) {
1104
+ const out = new Map;
1105
+ for (const r of rows) {
1106
+ if (!r.parentSessionId)
1107
+ continue;
1108
+ const parent = (r.parentConversationId ? rows.find((p) => p.conversationId === r.parentConversationId) : undefined) ?? rows.find((p) => p.id === r.parentSessionId || p.conversationId === r.parentSessionId);
1109
+ const who = { id: parent?.id ?? r.parentSessionId, ...parent?.title ? { title: parent.title } : {} };
1110
+ out.set(r.id, who);
1111
+ if (r.conversationId)
1112
+ out.set(r.conversationId, who);
1113
+ }
1114
+ return out;
1115
+ }
1099
1116
 
1100
1117
  // agent-audit.ts
1101
1118
  import { createHash } from "node:crypto";
@@ -2143,6 +2160,19 @@ var TOOLS = [
2143
2160
  required: ["ref"]
2144
2161
  }
2145
2162
  },
2163
+ {
2164
+ name: "agentistics_session_message",
2165
+ description: "Send a message to ANOTHER agentistics session — the standard channel between a session and the one that started it (or the ones it started). `to` is a session reference (managed id, conversation id, exact title or unique id prefix); `kind` is handback (work finished/committed), block (you cannot continue) or question (you need a decision); `body` is the text. It is typed into the target's own conversation through the same path its composer uses, headed `[from session <id> · <kind>]`, and — when YOUR session is filed on a task or subtask — also recorded there as a comment of that kind. Use it to report to the session that started you instead of asking the user; a parent may message its children the same way. Refused for a session that does not exist, for yourself, from a process that is not a verified agentop session, and more than once per 2 seconds to the same session.",
2166
+ inputSchema: {
2167
+ type: "object",
2168
+ properties: {
2169
+ to: { type: "string", description: "The target session reference." },
2170
+ kind: { type: "string", enum: ["handback", "block", "question"] },
2171
+ body: { type: "string", description: "The message." }
2172
+ },
2173
+ required: ["to", "kind", "body"]
2174
+ }
2175
+ },
2146
2176
  {
2147
2177
  name: "agentistics_summary",
2148
2178
  description: "Get an overview of AI coding usage metrics (across all tracked harnesses — Claude Code, Codex, Gemini, Copilot, Antigravity — or scoped to one): total tokens, estimated cost, sessions, streak, most used model, and top project. Good starting point for any metrics question.",
@@ -2334,16 +2364,6 @@ var TOOLS = [
2334
2364
  name: "agentistics_repos",
2335
2365
  description: "List repositories, grouped by normalized git remote (independent of local path or which machine produced the session), with session/message/token/cost totals and last-active date. Sessions with no linked repository are grouped under 'unlinked'. Optionally scope to a single harness. Rows tagged source \"projections\" (read from the journal) carry personTurns (the person's turns); there `messages` is a deprecated alias of personTurns, and subagent spend is reported apart (subagentTokens, subagentCostUSD).",
2336
2366
  inputSchema: { type: "object", properties: { harness: HARNESS_PARAM }, required: [] }
2337
- },
2338
- {
2339
- name: "agentistics_team_status",
2340
- description: "Get this machine's team-mode status: solo, central, or member. In member mode, lists its central connections (label, endpoint, connected/error state, last push). Use for 'am I connected to a team' or 'what central do I push to' questions.",
2341
- inputSchema: { type: "object", properties: {}, required: [] }
2342
- },
2343
- {
2344
- name: "agentistics_team_members",
2345
- description: "List members of this team, central only: display name, online/presence status, latency, and last-seen timestamp. For usage/cost per member use agentistics_summary or agentistics_sessions against this central's own /api/data. Returns an explanatory message when this machine is not running as a central (solo/member mode).",
2346
- inputSchema: { type: "object", properties: {}, required: [] }
2347
2367
  }
2348
2368
  ];
2349
2369
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: toolsForGate(TOOLS, await nativeVisibleNow()) }));
@@ -2571,6 +2591,16 @@ async function callTool(req) {
2571
2591
  });
2572
2592
  return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
2573
2593
  }
2594
+ case "agentistics_session_message": {
2595
+ const a = args;
2596
+ const body = await apiSend("POST", "/api/session-message", {
2597
+ to: a?.to,
2598
+ kind: a?.kind,
2599
+ body: a?.body,
2600
+ session: sessionProof(process.env)
2601
+ });
2602
+ return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
2603
+ }
2574
2604
  case "agentistics_summary": {
2575
2605
  const harness = args?.harness;
2576
2606
  return text(await analytics("agentistics_summary", harness, {
@@ -2595,6 +2625,7 @@ async function callTool(req) {
2595
2625
  const limit = Math.min(args?.limit ?? 20, 50);
2596
2626
  const harness = args?.harness;
2597
2627
  const data = await apiGet("/api/data");
2628
+ const startedBy = await apiGet("/api/fleet").then((f) => startedByIndex(f?.rows ?? [])).catch(() => new Map);
2598
2629
  const rows = filterSessions(data.sessions ?? [], harness).slice(0, limit).map((s) => {
2599
2630
  const { input, output, cacheRead, cacheWrite, cost, unpriced } = sessionTokens2(s);
2600
2631
  return {
@@ -2611,7 +2642,8 @@ async function callTool(req) {
2611
2642
  totalTokens: input + output + cacheRead + cacheWrite,
2612
2643
  estimatedCostUSD: unpriced > 0 && unpriced === input + output + cacheRead + cacheWrite ? null : Math.round(cost * 1e4) / 1e4,
2613
2644
  ...unpriced > 0 ? { unpricedTokens: unpriced } : {},
2614
- model: s.model ?? null
2645
+ model: s.model ?? null,
2646
+ ...startedBy.get(s.session_id) ? { startedBy: startedBy.get(s.session_id) } : {}
2615
2647
  };
2616
2648
  });
2617
2649
  return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }] };
@@ -2862,41 +2894,6 @@ async function callTool(req) {
2862
2894
  metrics: (q) => fetch(`${API}/api/runtime/metrics?${q}`)
2863
2895
  }));
2864
2896
  }
2865
- case "agentistics_team_status": {
2866
- const prefs = await getPrefs();
2867
- const team = prefs.team;
2868
- const mode = team?.mode ?? "solo";
2869
- const connections = (team?.connections ?? []).map((c) => ({
2870
- id: c.id,
2871
- label: c.label ?? null,
2872
- endpoint: c.endpoint
2873
- }));
2874
- return {
2875
- content: [{
2876
- type: "text",
2877
- text: JSON.stringify({ mode, connections }, null, 2)
2878
- }]
2879
- };
2880
- }
2881
- case "agentistics_team_members": {
2882
- const res = await fetch(`${API}/api/team/members`);
2883
- if (res.status === 404) {
2884
- return { content: [{ type: "text", text: "This machine is not running as a central (solo or member mode) — there is no member roster here. Use agentistics_team_status to see the current mode." }] };
2885
- }
2886
- if (!res.ok)
2887
- throw new Error(`GET /api/team/members → HTTP ${res.status}`);
2888
- const data = await res.json();
2889
- const members = data.members ?? [];
2890
- const rows = members.map((m) => ({
2891
- id: m.id,
2892
- name: m.user,
2893
- label: m.label,
2894
- online: m.online ?? false,
2895
- latencyMs: m.latencyMs ?? null,
2896
- lastSeenAt: m.lastSeenAt ?? null
2897
- }));
2898
- return { content: [{ type: "text", text: JSON.stringify(rows, null, 2) }] };
2899
- }
2900
2897
  default:
2901
2898
  throw new Error(`Unknown tool: ${name}`);
2902
2899
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentistics/mcp",
3
- "version": "2.111.3",
3
+ "version": "2.112.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",