@agentistics/mcp 2.140.3 → 2.140.5
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.
- package/dist/agentistics-mcp.js +20 -10
- package/package.json +1 -1
package/dist/agentistics-mcp.js
CHANGED
|
@@ -1077,7 +1077,7 @@ function harnessAggregate(rows) {
|
|
|
1077
1077
|
for (const r of rows)
|
|
1078
1078
|
by.set(r.harness, [...by.get(r.harness) ?? [], r]);
|
|
1079
1079
|
return [...by].map(([harness, list]) => {
|
|
1080
|
-
const live = list.filter((r) => r.status !== "hold");
|
|
1080
|
+
const live = list.filter((r) => r.status !== "hold" && !r.yieldsTo);
|
|
1081
1081
|
const status = live.length ? live.reduce((best, r) => STATUS_RANK[r.status] < STATUS_RANK[best] ? r.status : best, "hold") : "hold";
|
|
1082
1082
|
const paces = live.flatMap((r) => r.paceStatus ? [r.paceStatus] : []);
|
|
1083
1083
|
const paceStatus = paces.length ? paces.reduce((best, p) => PACE_RANK[p] < PACE_RANK[best] ? p : best) : undefined;
|
|
@@ -1091,11 +1091,14 @@ function harnessAggregate(rows) {
|
|
|
1091
1091
|
});
|
|
1092
1092
|
}
|
|
1093
1093
|
var roomOf = (b) => Math.max(b.fiveHourPct, b.weekPct);
|
|
1094
|
+
function pickAccount(candidates) {
|
|
1095
|
+
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;
|
|
1096
|
+
}
|
|
1094
1097
|
function routeRecommendation(budgets, kind, authorHarness) {
|
|
1095
1098
|
const allowTight = kind === "lead";
|
|
1096
1099
|
const aggregates = new Map(harnessAggregate(budgets.filter((b) => b.plan !== "unregistered")).map((a) => [a.harness, a]));
|
|
1097
1100
|
const eligibleHarness = (agg) => eligibleAccounts(agg.harness).length > 0 && agg.status !== "hold" && (allowTight || agg.status !== "tight") && agg.harness !== (kind === "qa" ? authorHarness : undefined);
|
|
1098
|
-
const eligibleAccounts = (h) => budgets.filter((b) => b.harness === h && b.spawnable !== false && b.plan !== "unregistered" && b.status !== "hold" && (allowTight || b.status !== "tight"));
|
|
1101
|
+
const eligibleAccounts = (h) => budgets.filter((b) => b.harness === h && b.spawnable !== false && b.plan !== "unregistered" && !b.yieldsTo && b.status !== "hold" && (allowTight || b.status !== "tight"));
|
|
1099
1102
|
const harnesses = [...aggregates.values()].filter(eligibleHarness);
|
|
1100
1103
|
const ordered = [...harnesses].sort((a, b) => {
|
|
1101
1104
|
const ap = a.paceStatus === "under" ? 0 : 1;
|
|
@@ -1120,11 +1123,9 @@ function routeRecommendation(budgets, kind, authorHarness) {
|
|
|
1120
1123
|
if (!pickAgg)
|
|
1121
1124
|
return noRoute();
|
|
1122
1125
|
const candidates = eligibleAccounts(pickAgg.harness);
|
|
1123
|
-
|
|
1126
|
+
const pick = pickAccount(candidates);
|
|
1127
|
+
if (!pick)
|
|
1124
1128
|
return noRoute();
|
|
1125
|
-
const indexed = candidates.map((b, i) => ({ b, i }));
|
|
1126
|
-
indexed.sort((x, y) => roomOf(x.b) - roomOf(y.b) || (y.b.updatedAt ?? 0) - (x.b.updatedAt ?? 0) || y.i - x.i);
|
|
1127
|
-
const pick = indexed[0].b;
|
|
1128
1129
|
const selected = preference.find(([h]) => h === pick.harness);
|
|
1129
1130
|
const alternatives = ordered.filter((a) => a.harness !== pick.harness).map((a) => a.harness);
|
|
1130
1131
|
const accountAlternatives = ordered.flatMap((a) => eligibleAccounts(a.harness).filter((b) => !(b.harness === pick.harness && b.account === pick.account)).map((b) => ({ harness: b.harness, account: b.account ?? "default" })));
|
|
@@ -1134,6 +1135,7 @@ function routeRecommendation(budgets, kind, authorHarness) {
|
|
|
1134
1135
|
return {
|
|
1135
1136
|
harness: pick.harness,
|
|
1136
1137
|
...pick.account ? { account: pick.account } : {},
|
|
1138
|
+
...pick.accountLabel ? { accountLabel: pick.accountLabel } : {},
|
|
1137
1139
|
...selected?.[1] ? { model: selected[1] } : {},
|
|
1138
1140
|
reason: `${pick.harness} is the preferred eligible plan for ${kind}.${paceText}`,
|
|
1139
1141
|
alternatives,
|
|
@@ -1530,14 +1532,22 @@ function sessionProof(env, readKey = (p) => readFileSync(p, "utf8"), readProc =
|
|
|
1530
1532
|
}
|
|
1531
1533
|
|
|
1532
1534
|
// plan-limits-tool.ts
|
|
1535
|
+
var plainLabel = (v) => typeof v === "string" ? v.replace(/@/g, "") : undefined;
|
|
1533
1536
|
function planLimitsTool(args, body) {
|
|
1534
|
-
const budgets = body.budgets ?? []
|
|
1535
|
-
|
|
1537
|
+
const budgets = (body.budgets ?? []).map((b) => {
|
|
1538
|
+
const { accountLabel, ...rest } = b;
|
|
1539
|
+
const label = plainLabel(accountLabel);
|
|
1540
|
+
return label !== undefined ? { ...rest, accountLabel: label } : rest;
|
|
1541
|
+
});
|
|
1542
|
+
const routed = args?.kind ? routeRecommendation(budgets, args.kind, args.authorHarness) : undefined;
|
|
1543
|
+
const recommendation = routed?.accountLabel !== undefined ? { ...routed, accountLabel: plainLabel(routed.accountLabel) } : routed;
|
|
1544
|
+
const aggregates = harnessAggregate(budgets);
|
|
1536
1545
|
return {
|
|
1537
1546
|
budgets,
|
|
1538
1547
|
harnesses: body.harnesses ?? {},
|
|
1539
|
-
freeSlots: body.freeSlots ?? (budgets.length ? Math.max(...
|
|
1540
|
-
freeSlotsByHarness: body.freeSlotsByHarness ?? Object.fromEntries(
|
|
1548
|
+
freeSlots: body.freeSlots ?? (budgets.length ? Math.max(...aggregates.map((b) => b.freeSlots)) : 0),
|
|
1549
|
+
freeSlotsByHarness: body.freeSlotsByHarness ?? Object.fromEntries(aggregates.map((b) => [b.harness, b.freeSlots])),
|
|
1550
|
+
freeSlotsByAccount: body.freeSlotsByAccount ?? Object.fromEntries(budgets.filter((b) => b.account).map((b) => [b.account, b.freeSlots ?? 0])),
|
|
1541
1551
|
liveSessions: body.liveSessions ?? budgets.flatMap((b) => b.liveSessions ?? []).filter((s, i, all) => all.findIndex((x) => x.id === s.id) === i),
|
|
1542
1552
|
...body.pauseUntil !== undefined ? { pauseUntil: body.pauseUntil } : {},
|
|
1543
1553
|
...recommendation ? { recommendation } : {},
|
package/package.json
CHANGED