sigrank 0.0.216 → 0.0.218

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/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/anthropics/mcpb/main/schemas/mcpb-manifest-v0.4.schema.json",
3
3
  "manifest_version": "0.4",
4
4
  "name": "sigrank",
5
- "version": "0.0.215",
5
+ "version": "0.0.217",
6
6
  "description": "Ranks AI coding operators by token cascade efficiency (Yield = cache_read \u00d7 output / input\u00b2). 23 tools for yield calculation, local token usage pulls, signed submission, and tokscale-powered analytics (market share, developer profiles, model trends, cost analysis, device profiles, MCP usage, competitive intelligence). Privacy-first: runs locally, only four token counts leave the machine.",
7
7
  "author": {
8
8
  "name": "SunrisesIllNeverSee",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigrank",
3
- "version": "0.0.216",
3
+ "version": "0.0.218",
4
4
  "author": "SunrisesIllNeverSee (https://github.com/SunrisesIllNeverSee)",
5
5
  "description": "SigRank MCP server — AI operator evaluation and token cascade efficiency tools. The yield cascade + live leaderboard as MCP tools any agent can call.",
6
6
  "mcpName": "io.github.SunrisesIllNeverSee/sigrank-mcp",
@@ -341,6 +341,21 @@ async function loadDashboardData({ includeOmp = false } = {}) {
341
341
  new Promise((r) => setTimeout(() => r(null), 5000)),
342
342
  ]);
343
343
 
344
+ // Batched windows: fetch the signed-in operator's rolled-forward totals
345
+ // (never decrease when platforms delete old logs). Only fetched when signed in.
346
+ const id = loadIdentity();
347
+ const batchedPromise = (id && isSignedIn(id))
348
+ ? Promise.race([
349
+ fetch(`${DEFAULT_API_BASE}/api/v1/operators/${encodeURIComponent(id.codename)}`, {
350
+ headers: { accept: "application/json" },
351
+ })
352
+ .then((r) => (r.ok ? r.json() : null))
353
+ .then((d) => d?.batched ?? null)
354
+ .catch(() => null),
355
+ new Promise((r) => setTimeout(() => r(null), 5000)),
356
+ ])
357
+ : Promise.resolve(null);
358
+
344
359
  // FIX 0 + unify (0.14): progressive load via the SHARED loader (pullActivePlatforms) — paint the
345
360
  // primary platform (claude) FAST, then fill the rest in fillDashboardRest. This is the SAME loader
346
361
  // `me` and `watch` use, so the three views can't drift apart. (Verifier comparison still runs
@@ -350,11 +365,13 @@ async function loadDashboardData({ includeOmp = false } = {}) {
350
365
  );
351
366
 
352
367
  const boardData = await boardPromise;
368
+ const batchedData = await batchedPromise;
353
369
  return {
354
370
  active,
355
371
  verifierMap: {},
356
372
  tdPillars: null,
357
373
  boardData,
374
+ batchedData,
358
375
  _loading: true,
359
376
  _remaining: dashboardEnabledPlatforms({
360
377
  includeManual: includeOmp,
@@ -743,8 +760,8 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
743
760
  // which is what was starving codex's cascade rows after the Your-Read/Three-Degrees panels landed.)
744
761
  const platformCount = active.length;
745
762
  const barLines = 4 + platformCount + (platformCount > 1 ? 1 : 0); // Token Composition: hr + header + platforms + combined + note
746
- // Your Read (hr+header+~3 wins+1 gap = 6) + Four Degrees (blank+hr+header+col-header+5 rows+note = 10) + status
747
- const boardLines = 17;
763
+ // Your Read (hr+header+up to 4 wins+up to 5 gaps+summary = 13) + Four Degrees (blank+hr+header+col-header+5 rows+note = 10) + Lifetime Tokens (blank+hr+header+platforms+combined+note = ~7) + status
764
+ const boardLines = 24;
748
765
  const sectionsBelow = barLines + boardLines;
749
766
  const maxCascadeRows = Math.max(8, budget - used - sectionsBelow);
750
767
 
@@ -923,24 +940,38 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
923
940
  if (you) {
924
941
  const wins = [],
925
942
  gaps = [];
926
- const chk = (label, val, fieldAvg, top, fmt, tip) => {
943
+ let aboveHcm = 0,
944
+ abovePower = 0,
945
+ totalMetrics = 0;
946
+ // Three-tier comparison: HCM (field median) → Power (top-100 median) → Top (best operator)
947
+ const chk = (label, val, hcm, power, top, fmt, tip) => {
927
948
  if (val == null) return;
928
- if (val >= top * 0.9)
949
+ totalMetrics++;
950
+ if (val >= top * 0.9) {
929
951
  wins.push(`${label} ${fmt(val)} — ${gold("top tier")}`);
930
- else if (val >= fieldAvg)
931
- wins.push(`${label} ${fmt(val)} — above field avg`);
932
- else
952
+ aboveHcm++;
953
+ abovePower++;
954
+ } else if (val >= power) {
955
+ wins.push(`${label} ${fmt(val)} — ${paint(c.boldCyan, "power-user tier")}`);
956
+ aboveHcm++;
957
+ abovePower++;
958
+ } else if (val >= hcm) {
959
+ wins.push(`${label} ${fmt(val)} — above field, ${dim("approaching power-user")}`);
960
+ aboveHcm++;
961
+ } else {
933
962
  gaps.push({
934
963
  label,
935
- txt: `${label} ${fmt(val)} — below field (${fmt(fieldAvg)}): ${tip}`,
964
+ txt: `${label} ${fmt(val)} — below field (${fmt(hcm)}): ${tip}`,
936
965
  val,
937
- fieldAvg,
966
+ hcm,
938
967
  });
968
+ }
939
969
  };
940
970
  chk(
941
971
  "Υ Yield",
942
972
  you.yield,
943
973
  TD.hcm.yield,
974
+ TD.power.yield,
944
975
  TD.top.yield,
945
976
  fmtY,
946
977
  "compound more — reuse cache, raise output",
@@ -949,6 +980,7 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
949
980
  "SNR",
950
981
  you.snr,
951
982
  TD.hcm.snr,
983
+ TD.power.snr,
952
984
  TD.top.snr,
953
985
  fmtSNR,
954
986
  "tighten prompts — less input per unit output",
@@ -957,6 +989,7 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
957
989
  "Leverage",
958
990
  you.leverage,
959
991
  TD.hcm.lev,
992
+ TD.power.lev,
960
993
  TD.top.lev,
961
994
  (v) => fmtLev(v) + "×",
962
995
  "lean on cache-read — amplify prior context",
@@ -965,17 +998,39 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
965
998
  "Velocity",
966
999
  you.velocity,
967
1000
  TD.hcm.vel,
1001
+ TD.power.vel,
968
1002
  TD.top.vel,
969
1003
  (v) => v.toFixed(2),
970
1004
  "more output per input token",
971
1005
  );
972
- for (const w of wins.slice(0, 3)) emit(` ${paint(c.green, "▲")} ${w}`);
973
- // weakest gap gets the prescriptive tip
974
- const weakest = gaps.sort(
975
- (a, b) => a.val / a.fieldAvg - b.val / b.fieldAvg,
976
- )[0];
977
- if (weakest) emit(` ${paint(c.magenta, "▽")} ${dim(weakest.txt)}`);
978
- if (!wins.length && !weakest) emit(` ${dim(" building your read…")}`);
1006
+ chk(
1007
+ "10xDEV",
1008
+ you.dev10x,
1009
+ TD.hcm.d10,
1010
+ TD.power.d10,
1011
+ TD.top.d10,
1012
+ (v) => v.toFixed(2),
1013
+ "raise leverage — every 10× lev adds 1 to 10xDEV",
1014
+ );
1015
+ for (const w of wins.slice(0, 4)) emit(` ${paint(c.green, "▲")} ${w}`);
1016
+ // all gaps shown; weakest gets the prescriptive tip
1017
+ const sortedGaps = gaps.sort(
1018
+ (a, b) => a.val / a.hcm - b.val / b.hcm,
1019
+ );
1020
+ for (let i = 0; i < sortedGaps.length; i++) {
1021
+ const g = sortedGaps[i];
1022
+ if (i === 0) emit(` ${paint(c.magenta, "▽")} ${dim(g.txt)}`);
1023
+ else emit(` ${paint(c.magenta, "▽")} ${dim(g.label + " below field")}`);
1024
+ }
1025
+ if (!wins.length && !sortedGaps.length) emit(` ${dim(" building your read…")}`);
1026
+ // summary line — where you sit across all metrics
1027
+ if (totalMetrics > 0) {
1028
+ const hcmStr = `${aboveHcm}/${totalMetrics}`;
1029
+ const pwrStr = `${abovePower}/${totalMetrics}`;
1030
+ emit(
1031
+ ` ${dim(`above HCM on ${bold(hcmStr)} · above Power on ${bold(pwrStr)}`)}`,
1032
+ );
1033
+ }
979
1034
  } else {
980
1035
  emit(` ${dim(" reading your cascade… (press [R] to refresh)")}`);
981
1036
  }
@@ -1019,6 +1074,49 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
1019
1074
  );
1020
1075
  }
1021
1076
 
1077
+ // ── Lifetime Tokens — submission-based rolled-forward totals (never decrease)
1078
+ // Shows when the operator is signed in and has submission history. The batched
1079
+ // data comes from the server (computeBatchedWindows over snapshot_submissions).
1080
+ const batched = data?.batchedData;
1081
+ if (batched && used < budget - 4) {
1082
+ const fmtT = (n) => {
1083
+ if (n >= 1e9) return (n / 1e9).toFixed(1) + "B";
1084
+ if (n >= 1e6) return (n / 1e6).toFixed(1) + "M";
1085
+ if (n >= 1e3) return (n / 1e3).toFixed(1) + "K";
1086
+ return String(n);
1087
+ };
1088
+ const total = (p) => (p?.input ?? 0) + (p?.output ?? 0) + (p?.cacheCreate ?? 0) + (p?.cacheRead ?? 0);
1089
+ emit();
1090
+ emit(` ${hr()}`);
1091
+ emit(` ${bold("Lifetime Tokens")} ${dim("archived submissions · never decreases")}`);
1092
+ const platforms = Object.entries(batched.per_platform ?? {});
1093
+ for (const [plat, pw] of platforms) {
1094
+ if (used >= budget - 2) break;
1095
+ const pc = platformColor(plat);
1096
+ const allT = total(pw.all);
1097
+ const d90T = total(pw["90d"]);
1098
+ emit(
1099
+ ` ${padEnd(pc(plat), 10)} ${padStart(fmtT(allT), 8)} total ${dim("·")} ${padStart(fmtT(d90T), 8)} in last 90d`,
1100
+ );
1101
+ }
1102
+ if (platforms.length > 1) {
1103
+ const cAll = total(batched.combined?.all);
1104
+ const c90 = total(batched.combined?.["90d"]);
1105
+ emit(
1106
+ ` ${padEnd(bold("combined"), 10)} ${padStart(bold(fmtT(cAll)), 8)} total ${dim("·")} ${padStart(bold(fmtT(c90)), 8)} in last 90d`,
1107
+ );
1108
+ }
1109
+ // Find the earliest baseline date across platforms
1110
+ const baselineDates = platforms.map(([, pw]) => pw.baseline_date).filter(Boolean).sort();
1111
+ const subCounts = platforms.map(([, pw]) => pw.submission_count ?? 0);
1112
+ const totalSubs = subCounts.reduce((a, b) => a + b, 0);
1113
+ if (baselineDates.length > 0) {
1114
+ emit(
1115
+ ` ${dim(`${totalSubs} submission${totalSubs !== 1 ? "s" : ""} archived · baseline ${baselineDates[0].slice(0, 10)}`)}`,
1116
+ );
1117
+ }
1118
+ }
1119
+
1022
1120
  if (status && used < budget) emit(` ${dim(status)}`);
1023
1121
  }
1024
1122
 
@@ -118,6 +118,74 @@ export const OPERATOR_OUTPUT = {
118
118
  },
119
119
  },
120
120
  },
121
+ batched: {
122
+ type: "object",
123
+ description:
124
+ "Submission-based rolled-forward totals (never decrease when platforms delete old logs). Present when the operator has submission history.",
125
+ properties: {
126
+ per_platform: {
127
+ type: "object",
128
+ description: "Per-platform batched windows",
129
+ additionalProperties: {
130
+ type: "object",
131
+ properties: {
132
+ "90d": {
133
+ type: "object",
134
+ description: "Rolled-forward 90d pillars (sum of batches <=90 days old)",
135
+ properties: {
136
+ input: { type: "integer" },
137
+ output: { type: "integer" },
138
+ cacheCreate: { type: "integer" },
139
+ cacheRead: { type: "integer" },
140
+ },
141
+ },
142
+ all: {
143
+ type: "object",
144
+ description: "All-time pillars (baseline + all deltas — never decreases)",
145
+ properties: {
146
+ input: { type: "integer" },
147
+ output: { type: "integer" },
148
+ cacheCreate: { type: "integer" },
149
+ cacheRead: { type: "integer" },
150
+ },
151
+ },
152
+ submission_count: {
153
+ type: "integer",
154
+ description: "Number of archived submissions for this platform",
155
+ },
156
+ baseline_date: {
157
+ type: "string",
158
+ description: "ISO date of the first (baseline) submission",
159
+ },
160
+ },
161
+ },
162
+ },
163
+ combined: {
164
+ type: "object",
165
+ description: "Combined batched windows across all platforms",
166
+ properties: {
167
+ "90d": {
168
+ type: "object",
169
+ properties: {
170
+ input: { type: "integer" },
171
+ output: { type: "integer" },
172
+ cacheCreate: { type: "integer" },
173
+ cacheRead: { type: "integer" },
174
+ },
175
+ },
176
+ all: {
177
+ type: "object",
178
+ properties: {
179
+ input: { type: "integer" },
180
+ output: { type: "integer" },
181
+ cacheCreate: { type: "integer" },
182
+ cacheRead: { type: "integer" },
183
+ },
184
+ },
185
+ },
186
+ },
187
+ },
188
+ },
121
189
  },
122
190
  };
123
191