@agentistics/mcp 2.155.0 → 2.157.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.
@@ -1,5 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // session-role-args.ts
4
+ function sessionRoleBody(a, session) {
5
+ const retire = typeof a?.retirePredecessor === "string" ? a.retirePredecessor.trim() : "";
6
+ return {
7
+ ...a?.ref ? { ref: a.ref } : {},
8
+ ...a?.role !== undefined ? { role: a.role } : {},
9
+ ...retire ? { retirePredecessor: retire } : {},
10
+ session: session ?? null
11
+ };
12
+ }
13
+
3
14
  // orphan-guard.ts
4
15
  function installOrphanGuard(d) {
5
16
  const initial = d.getPpid();
@@ -1072,6 +1083,8 @@ var PLAN_WINDOW_MS = {
1072
1083
  "5h": 5 * 60 * 60000,
1073
1084
  week: 7 * 24 * 60 * 60000
1074
1085
  };
1086
+ var AGY_WEEK_MAX_MS = 7 * DAY_MS + 60 * 60000;
1087
+ var AGY_SAME_RESET_MS = 5 * 60000;
1075
1088
  var PLAN_LIMITS_STALE_MS = 10 * 60000;
1076
1089
  var PROJECTED_MAX_PCT_PER_HOUR = 100 / 0.5 * 0.99;
1077
1090
  var ROUTE_PREFERENCES = {
@@ -1083,6 +1096,9 @@ var ROUTE_PREFERENCES = {
1083
1096
  qa: [["gemini"], ["copilot"], ["codex"], ["claude", "sonnet"]],
1084
1097
  probe: [["claude", "haiku"], ["gemini"]]
1085
1098
  };
1099
+ for (const k of ["spec-impl", "mechanical", "qa", "probe"])
1100
+ ROUTE_PREFERENCES[k] = [...ROUTE_PREFERENCES[k], ["antigravity"]];
1101
+ var HARNESS_VENDOR = { claude: "anthropic", codex: "openai", gemini: "google" };
1086
1102
  var STATUS_RANK = { ok: 0, tight: 1, hold: 2 };
1087
1103
  var PACE_RANK = { under: 0, on: 1, over: 2 };
1088
1104
  function harnessAggregate(rows) {
@@ -1108,6 +1124,15 @@ function pickAccount(candidates) {
1108
1124
  return candidates.map((b, i) => ({ b, i })).sort((x, y) => (x.b.daysToWeekReset > 0 ? x.b.weekResetsAt : Infinity) - (y.b.daysToWeekReset > 0 ? y.b.weekResetsAt : Infinity) || roomOf(x.b) - roomOf(y.b) || (y.b.updatedAt ?? 0) - (x.b.updatedAt ?? 0) || y.i - x.i)[0]?.b;
1109
1125
  }
1110
1126
  function routeRecommendation(budgets, kind, authorHarness) {
1127
+ const authorVendor = kind === "qa" && authorHarness ? HARNESS_VENDOR[authorHarness] : undefined;
1128
+ budgets = budgets.flatMap((b) => {
1129
+ if (!b.scopes?.length)
1130
+ return [b];
1131
+ return b.scopes.filter((sb) => !(authorVendor && sb.scope.providers.includes(authorVendor))).map(({ scope, ...sb }) => {
1132
+ const { scopes: _scopes, ...row } = b;
1133
+ return { ...row, ...sb, scope: scope.id, model: scope.models[0], scopeProviders: scope.providers };
1134
+ });
1135
+ });
1111
1136
  const aggregates = new Map(harnessAggregate(budgets.filter((b) => b.plan !== "unregistered")).map((a) => [a.harness, a]));
1112
1137
  const eligibleHarness = (agg) => eligibleAccounts(agg.harness).length > 0 && agg.status !== "hold" && agg.harness !== (kind === "qa" ? authorHarness : undefined);
1113
1138
  const eligibleAccounts = (h) => budgets.filter((b) => b.harness === h && b.spawnable !== false && b.plan !== "unregistered" && !b.yieldsTo && b.status !== "hold");
@@ -1151,7 +1176,7 @@ function routeRecommendation(budgets, kind, authorHarness) {
1151
1176
  harness: pick.harness,
1152
1177
  ...pick.account ? { account: pick.account } : {},
1153
1178
  ...pick.accountLabel ? { accountLabel: pick.accountLabel } : {},
1154
- ...selected?.[1] ? { model: selected[1] } : {},
1179
+ ...pick.scope && pick.model ? { model: pick.model, scope: pick.scope } : selected?.[1] ? { model: selected[1] } : {},
1155
1180
  reason: `${pick.harness} is the preferred eligible plan for ${kind}.${budgetText}${paceText}`,
1156
1181
  alternatives,
1157
1182
  accountAlternatives,
@@ -2390,7 +2415,8 @@ var TOOLS = [
2390
2415
  type: "object",
2391
2416
  properties: {
2392
2417
  ref: { type: "string", description: "A session reference (managed id, conversation id, exact title or unique id prefix). Omit for your own session." },
2393
- role: { type: "string", enum: ["leader", "worker", "auto"], description: "The role to set. Omit to read it." }
2418
+ role: { type: "string", enum: ["leader", "worker", "auto"], description: "The role to set. Omit to read it." },
2419
+ retirePredecessor: { type: "string", description: "A leader taking over can pass the previous leader on the SAME task (managed id, conversation id, exact title or unique id prefix); the server closes it when it goes quiet. Only for your own session declared leader; otherwise the role still changes and the reply says why the retire was refused." }
2394
2420
  },
2395
2421
  required: []
2396
2422
  }
@@ -2879,11 +2905,7 @@ async function callTool(req) {
2879
2905
  }
2880
2906
  case "agentistics_session_role": {
2881
2907
  const a = args;
2882
- const body = await apiSend("POST", "/api/session-roles", {
2883
- ...a?.ref ? { ref: a.ref } : {},
2884
- ...a?.role !== undefined ? { role: a.role } : {},
2885
- session: sessionProof(process.env) ?? null
2886
- });
2908
+ const body = await apiSend("POST", "/api/session-roles", sessionRoleBody(a, sessionProof(process.env)));
2887
2909
  return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
2888
2910
  }
2889
2911
  case "agentistics_session_switch_account": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentistics/mcp",
3
- "version": "2.155.0",
3
+ "version": "2.157.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",