sigrank 0.0.217 → 0.0.219

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.216",
5
+ "version": "0.0.218",
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.217",
3
+ "version": "0.0.219",
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+up to 4 wins+up to 5 gaps+summary = 13) + Four Degrees (blank+hr+header+col-header+5 rows+note = 10) + status
747
- const boardLines = 20;
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
 
@@ -1057,6 +1074,49 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
1057
1074
  );
1058
1075
  }
1059
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
+
1060
1120
  if (status && used < budget) emit(` ${dim(status)}`);
1061
1121
  }
1062
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