sigrank 1.0.4 → 1.0.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/bin/sigrank.mjs +13 -9
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/tools/standard-record.mjs +60 -29
package/bin/sigrank.mjs
CHANGED
|
@@ -69,9 +69,13 @@ async function exportStandardRecord() {
|
|
|
69
69
|
const platform = flag("platform", "claude");
|
|
70
70
|
const window = flag("window", "30d");
|
|
71
71
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
);
|
|
72
|
+
const explicitFlags = ["input", "output", "cache-write", "cache-read"];
|
|
73
|
+
const hasExplicit = explicitFlags.some((name) => flag(name) !== undefined);
|
|
74
|
+
const explicit = ["input", "output"].every((name) => flag(name) !== undefined);
|
|
75
|
+
|
|
76
|
+
if (hasExplicit && !explicit) {
|
|
77
|
+
throw new Error("Explicit Standard export requires both --input and --output.");
|
|
78
|
+
}
|
|
75
79
|
|
|
76
80
|
let pillars;
|
|
77
81
|
let sourcePlatform = platform;
|
|
@@ -80,8 +84,8 @@ async function exportStandardRecord() {
|
|
|
80
84
|
pillars = {
|
|
81
85
|
input: Number(flag("input")),
|
|
82
86
|
output: Number(flag("output")),
|
|
83
|
-
cache_write: Number(flag("cache-write")),
|
|
84
|
-
cache_read: Number(flag("cache-read")),
|
|
87
|
+
cache_write: flag("cache-write") === undefined ? null : Number(flag("cache-write")),
|
|
88
|
+
cache_read: flag("cache-read") === undefined ? null : Number(flag("cache-read")),
|
|
85
89
|
};
|
|
86
90
|
} else {
|
|
87
91
|
const pulled = await callTool("tokenpull", { platform });
|
|
@@ -97,14 +101,14 @@ async function exportStandardRecord() {
|
|
|
97
101
|
pillars = {
|
|
98
102
|
input: selected.pillars.input,
|
|
99
103
|
output: selected.pillars.output,
|
|
100
|
-
cache_write: selected.pillars.cacheCreate,
|
|
101
|
-
cache_read: selected.pillars.cacheRead,
|
|
104
|
+
cache_write: selected.pillars.cacheCreate ?? null,
|
|
105
|
+
cache_read: selected.pillars.cacheRead ?? null,
|
|
102
106
|
};
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
for (const [key, value] of Object.entries(pillars)) {
|
|
106
|
-
if (!Number.isFinite(value) || value < 0) {
|
|
107
|
-
throw new Error(`${key} must be a non-negative
|
|
110
|
+
if (value !== null && (!Number.isFinite(value) || !Number.isInteger(value) || value < 0)) {
|
|
111
|
+
throw new Error(`${key} must be a non-negative integer token count or null.`);
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
|
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": "1.0.
|
|
5
|
+
"version": "1.0.4",
|
|
6
6
|
"description": "Ranks AI coding operators by token cascade efficiency (Yield = cache_read \u00d7 output / input\u00b2). 25 tools including SigRank Standard record, 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": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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",
|
|
@@ -6,7 +6,7 @@ export const SIGRANK_STANDARD_VERSION = "sigrank/0.1-draft";
|
|
|
6
6
|
export const TOOL_DEF = {
|
|
7
7
|
name: "get_sigrank_standard_record",
|
|
8
8
|
description:
|
|
9
|
-
"Build a SigRank Standard v0.1-draft portable operator record from
|
|
9
|
+
"Build a SigRank Standard v0.1-draft portable operator record from available token telemetry. Input and output are required; unavailable cache telemetry remains null. Computes the canonical cascade locally through @sigrank/cascade and returns the normative core metrics: Yield, Leverage, Velocity, SNR, and 10xDEV. No data is submitted or persisted.",
|
|
10
10
|
annotations: {
|
|
11
11
|
title: "Export SigRank standard record",
|
|
12
12
|
...ANNOTATIONS.readOnlyHint,
|
|
@@ -17,26 +17,29 @@ export const TOOL_DEF = {
|
|
|
17
17
|
inputSchema: {
|
|
18
18
|
type: "object",
|
|
19
19
|
additionalProperties: false,
|
|
20
|
-
required: ["input", "output"
|
|
20
|
+
required: ["input", "output"],
|
|
21
21
|
properties: {
|
|
22
|
-
input: { type: "
|
|
23
|
-
output: { type: "
|
|
24
|
-
cache_write: { type: "
|
|
25
|
-
cache_read: { type: "
|
|
22
|
+
input: { type: "integer", minimum: 0, description: "Fresh input tokens." },
|
|
23
|
+
output: { type: "integer", minimum: 0, description: "Output tokens." },
|
|
24
|
+
cache_write: { type: ["integer", "null"], minimum: 0, description: "Cache-write / cache-creation tokens, or null when unavailable." },
|
|
25
|
+
cache_read: { type: ["integer", "null"], minimum: 0, description: "Cache-read tokens, or null when unavailable." },
|
|
26
26
|
provider: { type: "string", description: "Optional provider identifier." },
|
|
27
27
|
model: { type: "string", description: "Optional model identifier." },
|
|
28
28
|
tool: { type: "string", description: "Optional tool/client identifier." },
|
|
29
|
-
timestamp: { type: "string", description: "Optional ISO-8601 timestamp. Defaults to the current time." }
|
|
29
|
+
timestamp: { type: "string", format: "date-time", description: "Optional ISO-8601 timestamp. Defaults to the current time." }
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
outputSchema: {
|
|
33
33
|
type: "object",
|
|
34
|
-
|
|
34
|
+
additionalProperties: false,
|
|
35
|
+
required: ["spec", "timestamp", "source", "telemetry", "metrics", "warnings"],
|
|
35
36
|
properties: {
|
|
36
|
-
spec: {
|
|
37
|
-
timestamp: { type: "string", description: "ISO-8601 record timestamp." },
|
|
37
|
+
spec: { const: SIGRANK_STANDARD_VERSION, description: "SigRank specification version." },
|
|
38
|
+
timestamp: { type: "string", format: "date-time", description: "ISO-8601 record timestamp." },
|
|
38
39
|
source: {
|
|
39
40
|
type: "object",
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
required: ["provider", "model", "tool"],
|
|
40
43
|
properties: {
|
|
41
44
|
provider: { type: "string" },
|
|
42
45
|
model: { type: "string" },
|
|
@@ -45,15 +48,19 @@ export const TOOL_DEF = {
|
|
|
45
48
|
},
|
|
46
49
|
telemetry: {
|
|
47
50
|
type: "object",
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
required: ["input", "output", "cache_write", "cache_read"],
|
|
48
53
|
properties: {
|
|
49
|
-
input: { type: "
|
|
50
|
-
output: { type: "
|
|
51
|
-
cache_write: { type: "
|
|
52
|
-
cache_read: { type: "
|
|
54
|
+
input: { type: "integer", minimum: 0 },
|
|
55
|
+
output: { type: "integer", minimum: 0 },
|
|
56
|
+
cache_write: { type: ["integer", "null"], minimum: 0 },
|
|
57
|
+
cache_read: { type: ["integer", "null"], minimum: 0 }
|
|
53
58
|
}
|
|
54
59
|
},
|
|
55
60
|
metrics: {
|
|
56
61
|
type: "object",
|
|
62
|
+
additionalProperties: false,
|
|
63
|
+
required: ["yield", "leverage", "velocity", "snr", "dev10x"],
|
|
57
64
|
properties: {
|
|
58
65
|
yield: { type: ["number", "null"] },
|
|
59
66
|
leverage: { type: ["number", "null"] },
|
|
@@ -67,24 +74,48 @@ export const TOOL_DEF = {
|
|
|
67
74
|
}
|
|
68
75
|
};
|
|
69
76
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const output = Number(args?.output);
|
|
73
|
-
const cacheWrite = Number(args?.cache_write);
|
|
74
|
-
const cacheRead = Number(args?.cache_read);
|
|
77
|
+
const ISO_DATE_TIME =
|
|
78
|
+
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
function tokenCount(value, name, required) {
|
|
81
|
+
if (value === null || value === undefined) {
|
|
82
|
+
if (required) throw new Error(`${name} is required.`);
|
|
83
|
+
return null;
|
|
78
84
|
}
|
|
79
|
-
if (
|
|
80
|
-
throw new Error(
|
|
85
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value)) {
|
|
86
|
+
throw new Error(`${name} must be a non-negative integer token count.`);
|
|
87
|
+
}
|
|
88
|
+
if (value < 0) throw new Error(`${name} must be a non-negative integer token count.`);
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function recordTimestamp(value) {
|
|
93
|
+
if (value === undefined) return new Date().toISOString();
|
|
94
|
+
if (typeof value !== "string" || !ISO_DATE_TIME.test(value) || !Number.isFinite(Date.parse(value))) {
|
|
95
|
+
throw new Error("timestamp must be a valid ISO-8601 date-time.");
|
|
81
96
|
}
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function handleGetSigRankStandardRecord(args) {
|
|
101
|
+
const input = tokenCount(args?.input, "input", true);
|
|
102
|
+
const output = tokenCount(args?.output, "output", true);
|
|
103
|
+
const cacheWrite = tokenCount(args?.cache_write, "cache_write", false);
|
|
104
|
+
const cacheRead = tokenCount(args?.cache_read, "cache_read", false);
|
|
82
105
|
|
|
83
|
-
const c = cascade({
|
|
106
|
+
const c = cascade({
|
|
107
|
+
input,
|
|
108
|
+
output,
|
|
109
|
+
cacheCreate: cacheWrite ?? 0,
|
|
110
|
+
cacheRead: cacheRead ?? 0,
|
|
111
|
+
});
|
|
112
|
+
const warnings = [...(c.warnings || [])];
|
|
113
|
+
if (cacheWrite === null) warnings.push("cache_write is unavailable; 10xDEV is undefined.");
|
|
114
|
+
if (cacheRead === null) warnings.push("cache_read is unavailable; Yield, Leverage, and 10xDEV are undefined.");
|
|
84
115
|
|
|
85
116
|
return {
|
|
86
117
|
spec: SIGRANK_STANDARD_VERSION,
|
|
87
|
-
timestamp: args?.timestamp
|
|
118
|
+
timestamp: recordTimestamp(args?.timestamp),
|
|
88
119
|
source: {
|
|
89
120
|
provider: args?.provider || "unknown",
|
|
90
121
|
model: args?.model || "unknown",
|
|
@@ -97,12 +128,12 @@ export async function handleGetSigRankStandardRecord(args) {
|
|
|
97
128
|
cache_read: cacheRead,
|
|
98
129
|
},
|
|
99
130
|
metrics: {
|
|
100
|
-
yield: c.yield,
|
|
101
|
-
leverage: c.leverage,
|
|
131
|
+
yield: cacheRead === null ? null : c.yield,
|
|
132
|
+
leverage: cacheRead === null ? null : c.leverage,
|
|
102
133
|
velocity: c.velocity,
|
|
103
134
|
snr: c.snr,
|
|
104
|
-
dev10x: c.dev10x,
|
|
135
|
+
dev10x: cacheWrite === null || cacheRead === null ? null : c.dev10x,
|
|
105
136
|
},
|
|
106
|
-
warnings
|
|
137
|
+
warnings,
|
|
107
138
|
};
|
|
108
139
|
}
|