sigrank 0.0.230 → 0.0.231
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/analytics/cascade.mjs +65 -106
- package/manifest.json +1 -1
- package/package.json +2 -1
package/analytics/cascade.mjs
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* cascade.mjs —
|
|
3
|
-
* Mirrors sigrank-app/lib/ingest/bridge.ts computeCascadeMetrics() so rank_paste
|
|
4
|
-
* reproduces the canonical MO§ES Υ 18436.98 from its 4 raw token pillars.
|
|
5
|
-
* Paper-and-pencil math, open by design; proprietary threshold cuts stay server-side.
|
|
2
|
+
* cascade.mjs — SigRank yield cascade facade.
|
|
6
3
|
*
|
|
7
|
-
*
|
|
4
|
+
* The canonical cascade math (Υ Yield, SNR, Leverage, Velocity, 10xDEV, and the
|
|
5
|
+
* 24-stage RS05 class taxonomy) now lives in the `@sigrank/cascade` package.
|
|
6
|
+
* This file re-exports the canonical functions and adds local-only helpers that
|
|
7
|
+
* are presentation/MCP-specific and intentionally NOT part of the canonical
|
|
8
|
+
* math package:
|
|
9
|
+
* - CLASS_TIERS, SIGNAL_CLASSES, UNCLASSED (display taxonomy)
|
|
10
|
+
* - tierOf(), stageOf() (display helpers)
|
|
11
|
+
* - detectMode(), MODE_EXPECTED_YIELD, qualityScore() (mode/quality layer)
|
|
12
|
+
* - parsePillars() (text → 4 pillars extractor)
|
|
13
|
+
*
|
|
14
|
+
* The cascade() wrapper preserves the object-signature
|
|
15
|
+
* ({ input, output, cacheCreate, cacheRead }) used throughout this repo and
|
|
16
|
+
* re-attaches the `mode` field (detectMode) that the canonical package
|
|
17
|
+
* intentionally omits (mode is a presentation-layer concern, not canonical
|
|
18
|
+
* math).
|
|
19
|
+
*
|
|
20
|
+
* Canonical reference: MO§ES Υ 18436.98 from (1251211, 11296121, 128196310, 2555179769).
|
|
21
|
+
*
|
|
22
|
+
* Degenerate-input policy (inherited from the canonical package):
|
|
8
23
|
* - Any pillar that collapses a denominator (i=0, o=0, cw=0, cr=0) returns null for
|
|
9
24
|
* the affected metrics rather than Infinity/NaN.
|
|
10
25
|
* - A `warnings[]` array is attached when any metric is null so callers can surface the
|
|
@@ -13,76 +28,64 @@
|
|
|
13
28
|
* Callers that require a fully-formed result should check `warnings.length === 0`.
|
|
14
29
|
*/
|
|
15
30
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// SNR: undefined when both i and o are 0 (empty session)
|
|
29
|
-
const snrDenom = i + o;
|
|
30
|
-
const snr = snrDenom > 0 ? o / snrDenom : null;
|
|
31
|
-
if (snr === null) warnings.push("snr_undefined: input+output=0");
|
|
32
|
-
|
|
33
|
-
// velocity: undefined when i=0 (no fresh input — pure cache-only session)
|
|
34
|
-
const velocity = i > 0 ? o / i : null;
|
|
35
|
-
if (velocity === null) warnings.push("velocity_undefined: input=0");
|
|
36
|
-
|
|
37
|
-
// leverage: undefined when i=0
|
|
38
|
-
const leverage = i > 0 ? cr / i : null;
|
|
39
|
-
if (leverage === null) warnings.push("leverage_undefined: input=0");
|
|
40
|
-
|
|
41
|
-
// Υ = leverage × velocity = (Cr·O)/I² — null when either component is null
|
|
42
|
-
const yield_ =
|
|
43
|
-
leverage !== null && velocity !== null ? leverage * velocity : null;
|
|
44
|
-
if (yield_ === null && !warnings.some((w) => w.startsWith("yield")))
|
|
45
|
-
warnings.push("yield_undefined: requires input>0");
|
|
31
|
+
// ─── Canonical math (from @sigrank/cascade) ─────────────────────────────────
|
|
32
|
+
import {
|
|
33
|
+
cascade as cascadeCanonical,
|
|
34
|
+
round,
|
|
35
|
+
classify,
|
|
36
|
+
RS05_CLASS_THRESHOLDS,
|
|
37
|
+
fieldStats,
|
|
38
|
+
percentileOf,
|
|
39
|
+
rankOf,
|
|
40
|
+
operatorSignature,
|
|
41
|
+
evaluateOperator,
|
|
42
|
+
} from "@sigrank/cascade";
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
// Re-export the canonical functions so existing import paths keep working.
|
|
45
|
+
export {
|
|
46
|
+
round,
|
|
47
|
+
classify,
|
|
48
|
+
RS05_CLASS_THRESHOLDS,
|
|
49
|
+
fieldStats,
|
|
50
|
+
percentileOf,
|
|
51
|
+
rankOf,
|
|
52
|
+
operatorSignature,
|
|
53
|
+
evaluateOperator,
|
|
54
|
+
};
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
/**
|
|
57
|
+
* The four raw token pillars → the cascade.
|
|
58
|
+
*
|
|
59
|
+
* Object-signature wrapper around the canonical `@sigrank/cascade` cascade()
|
|
60
|
+
* (which takes positional args). Re-attaches the `mode` field via detectMode()
|
|
61
|
+
* so the 20+ call sites in this repo that read `result.mode` keep working.
|
|
62
|
+
*/
|
|
63
|
+
export function cascade({ input, output, cacheCreate, cacheRead }) {
|
|
64
|
+
const result = cascadeCanonical(input, output, cacheCreate, cacheRead);
|
|
65
|
+
// Re-attach mode — the canonical package intentionally omits it (mode is a
|
|
66
|
+
// presentation-layer concern, not canonical math).
|
|
67
|
+
result.mode = detectMode({ input, output, cacheCreate, cacheRead });
|
|
68
68
|
return result;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
// ─── Local-only display taxonomy (not in @sigrank/cascade) ───────────────────
|
|
72
|
+
|
|
71
73
|
/**
|
|
72
74
|
* CLASS_TIERS — the 8 base tier names (K.01–K.08) for display: glyph, color,
|
|
73
75
|
* meaning. SINGLE SOURCE OF TRUTH for tier-level display info.
|
|
74
76
|
*
|
|
75
77
|
* The permanent class is an EXPERIENCE ladder keyed on TOTAL TOKENS. Each tier
|
|
76
78
|
* has 3 sub-stages (I/II/III) — 24 stages total. The 24 thresholds live in
|
|
77
|
-
* RS05_CLASS_THRESHOLDS
|
|
78
|
-
* (e.g. "REFINER II"). Use tierOf() to
|
|
79
|
+
* RS05_CLASS_THRESHOLDS (re-exported from @sigrank/cascade above). classify()
|
|
80
|
+
* returns the full sub-stage string (e.g. "REFINER II"). Use tierOf() to
|
|
81
|
+
* extract the base tier name.
|
|
79
82
|
*
|
|
80
83
|
* TRANSMITTER is NOT on this ladder — it is a temporary peak badge (RS.08).
|
|
81
84
|
* The client does not evaluate the badge (owner is still calibrating it);
|
|
82
85
|
* the server does it on read.
|
|
83
86
|
*
|
|
84
|
-
* Mirrors the server's canon-ids.ts CLASS_TIERS (display)
|
|
85
|
-
*
|
|
87
|
+
* Mirrors the server's canon-ids.ts CLASS_TIERS (display). Order is descending
|
|
88
|
+
* (ARCH+ → IGNITER).
|
|
86
89
|
*/
|
|
87
90
|
export const CLASS_TIERS = [
|
|
88
91
|
"ARCH+",
|
|
@@ -112,42 +115,6 @@ export const SIGNAL_CLASSES = [
|
|
|
112
115
|
"IGNITER I", "IGNITER II", "IGNITER III",
|
|
113
116
|
];
|
|
114
117
|
|
|
115
|
-
/**
|
|
116
|
-
* RS05_CLASS_THRESHOLDS — 24 total-token breakpoints (8 tiers × 3 sub-stages).
|
|
117
|
-
* Mirrors the server's lib/analytics/ruleset.ts RS05_CLASS_THRESHOLDS exactly.
|
|
118
|
-
* Calibrated from the HCM cut (1,626 operators) using target distribution
|
|
119
|
-
* (Option C): IGNITER 10%, BEARER 12.5%, REFINER 15%, SEEKER 22.5%, BASE 20%,
|
|
120
|
-
* POWER 15%, ARCH 5%, ARCH+ 0% (aspirational). Each tier split into 3
|
|
121
|
-
* equal-population sub-stages. Update this one constant to stay in parity
|
|
122
|
-
* when the owner tweaks server-side.
|
|
123
|
-
*/
|
|
124
|
-
export const RS05_CLASS_THRESHOLDS = [
|
|
125
|
-
{ class: "ARCH+ I", totalMin: 7068201104627 },
|
|
126
|
-
{ class: "ARCH+ II", totalMin: 3000000000000 },
|
|
127
|
-
{ class: "ARCH+ III", totalMin: 1000000000000 },
|
|
128
|
-
{ class: "ARCH I", totalMin: 186207267611 },
|
|
129
|
-
{ class: "ARCH II", totalMin: 98543134083 },
|
|
130
|
-
{ class: "ARCH III", totalMin: 68766193943 },
|
|
131
|
-
{ class: "POWER I", totalMin: 39958782379 },
|
|
132
|
-
{ class: "POWER II", totalMin: 26955905621 },
|
|
133
|
-
{ class: "POWER III", totalMin: 19141226889 },
|
|
134
|
-
{ class: "BASE I", totalMin: 13960345961 },
|
|
135
|
-
{ class: "BASE II", totalMin: 10189224970 },
|
|
136
|
-
{ class: "BASE III", totalMin: 7747041813 },
|
|
137
|
-
{ class: "SEEKER I", totalMin: 5446673659 },
|
|
138
|
-
{ class: "SEEKER II", totalMin: 4014577247 },
|
|
139
|
-
{ class: "SEEKER III", totalMin: 2961798768 },
|
|
140
|
-
{ class: "REFINER I", totalMin: 2358346840 },
|
|
141
|
-
{ class: "REFINER II", totalMin: 1845750357 },
|
|
142
|
-
{ class: "REFINER III", totalMin: 1334876308 },
|
|
143
|
-
{ class: "BEARER I", totalMin: 984078167 },
|
|
144
|
-
{ class: "BEARER II", totalMin: 714619043 },
|
|
145
|
-
{ class: "BEARER III", totalMin: 431702990 },
|
|
146
|
-
{ class: "IGNITER I", totalMin: 216393332 },
|
|
147
|
-
{ class: "IGNITER II", totalMin: 88999166 },
|
|
148
|
-
{ class: "IGNITER III", totalMin: 0 },
|
|
149
|
-
];
|
|
150
|
-
|
|
151
118
|
/** The degenerate-case class returned when totalTokens is null/undefined
|
|
152
119
|
* (all-zero / empty session). Distinct from IGNITER III (which is a real
|
|
153
120
|
* low-experience tier) so callers can tell "no data" from "bottom tier". */
|
|
@@ -174,17 +141,7 @@ export function stageOf(cls) {
|
|
|
174
141
|
return stage === "I" || stage === "II" || stage === "III" ? stage : null;
|
|
175
142
|
}
|
|
176
143
|
|
|
177
|
-
|
|
178
|
-
* cacheCreate + cacheRead). Descending first-match-wins scan over
|
|
179
|
-
* RS05_CLASS_THRESHOLDS — mirrors the server's assignClass(totalTokens).
|
|
180
|
-
* Returns a full sub-stage string (e.g. "REFINER II") or UNCLASSED. */
|
|
181
|
-
export function classify(totalTokens) {
|
|
182
|
-
if (totalTokens == null || !Number.isFinite(totalTokens)) return UNCLASSED;
|
|
183
|
-
for (const t of RS05_CLASS_THRESHOLDS) {
|
|
184
|
-
if (totalTokens >= t.totalMin) return t.class;
|
|
185
|
-
}
|
|
186
|
-
return "IGNITER III";
|
|
187
|
-
}
|
|
144
|
+
// ─── Mode / quality layer (not in @sigrank/cascade) ──────────────────────────
|
|
188
145
|
|
|
189
146
|
/**
|
|
190
147
|
* detectMode — classify an operator's current working mode from 4 token pillars.
|
|
@@ -262,6 +219,8 @@ export function qualityScore(actualYield, mode) {
|
|
|
262
219
|
return actualYield / expected;
|
|
263
220
|
}
|
|
264
221
|
|
|
222
|
+
// ─── Text parsing (not in @sigrank/cascade) ──────────────────────────────────
|
|
223
|
+
|
|
265
224
|
/**
|
|
266
225
|
* Extract the 4 pillars from pasted text: JSON object OR 4 whitespace numbers.
|
|
267
226
|
*
|
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.
|
|
5
|
+
"version": "0.0.230",
|
|
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.
|
|
3
|
+
"version": "0.0.231",
|
|
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",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
85
|
+
"@sigrank/cascade": "^0.1.1",
|
|
85
86
|
"ccusage": "^20.0.19",
|
|
86
87
|
"tokscale": "^4.7.0"
|
|
87
88
|
},
|