sigrank 1.0.48 → 1.0.50
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/CHANGELOG.md +12 -0
- package/adapters/index.mjs +36 -4
- package/lib/constants.mjs +7 -1
- package/lib/update-check.mjs +139 -0
- package/manifest.json +1 -1
- package/package.json +3 -3
- package/presentation/cli.mjs +57 -3
- package/presentation/tui.mjs +175 -109
- package/submit/index.mjs +2 -2
- package/tools/_multi.mjs +64 -0
- package/tools/discover-peers.mjs +2 -2
- package/tools/index.mjs +12 -1
- package/tools/submit-verified.mjs +5 -17
- package/tools/tokenpull-submit.mjs +3 -15
- package/tools/tokenpull.mjs +3 -15
- package/tools/watch-tokenpull.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.49
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
* Combined (`multi`) submission no longer silently drops a platform. A platform with no local data is still skipped, but a platform whose read fails or times out now aborts the multi submission with an error naming it, and nothing is sent for multi (applies to `submit_verified`, `tokenpull_submit`, `tokenpull` and the TUI/CLI submit). Real incident: a timed-out Devin read shrank a combined all-time total from 61.5B to 7.7B.
|
|
8
|
+
* Devin `sessions.db` read: timeout raised from 60s to 5 min and configurable with `SIGRANK_DEVIN_TIMEOUT_MS`; a timeout is now an error instead of looking like "no Devin data".
|
|
9
|
+
|
|
10
|
+
### CLI / TUI
|
|
11
|
+
|
|
12
|
+
* "Update available" notice (header in the TUI, one line in plain CLI output). Non-blocking, 1.5s cap, silent offline, cached ~24h in `~/.sigrank-mcp/update-check.json`. Opt out with `SIGRANK_NO_UPDATE_CHECK=1` (also `NO_UPDATE_NOTIFIER`, `CI`).
|
|
13
|
+
* Dashboard: the Your Cascade table scrolls reliably (↑/↓, j/k, PgUp/PgDn, Home/End). Combined rows are part of the scrollable table, the ▲/▼ hints are exact, and the view stays on the same row while platforms load in.
|
|
14
|
+
|
|
3
15
|
## Unreleased
|
|
4
16
|
|
|
5
17
|
### TUI
|
package/adapters/index.mjs
CHANGED
|
@@ -113,18 +113,44 @@ function* parseJsonl(text, filePath) {
|
|
|
113
113
|
/** Run sqlite3 -json and return parsed rows, or [] on error/unavailability.
|
|
114
114
|
* execFile with an args array — no shell, so dbPath/sql need no quoting/escaping
|
|
115
115
|
* (matches the execFile hardening used in tools.mjs / tokenpull.mjs). */
|
|
116
|
-
async function sqliteJson(dbPath, sql, timeoutMs = 10_000) {
|
|
116
|
+
async function sqliteJson(dbPath, sql, timeoutMs = 10_000, { strict = false } = {}) {
|
|
117
117
|
try {
|
|
118
118
|
const { stdout } = await execFileP("sqlite3", ["-json", dbPath, sql], {
|
|
119
119
|
timeout: timeoutMs,
|
|
120
120
|
maxBuffer: 256 * 1024 * 1024, // 256MB — Devin's sessions.db yields ~15MB JSON
|
|
121
121
|
});
|
|
122
122
|
return JSON.parse(stdout || "[]");
|
|
123
|
-
} catch {
|
|
123
|
+
} catch (e) {
|
|
124
|
+
// strict: "no data" (sqlite3 not installed) stays an empty result, but a
|
|
125
|
+
// timeout / crash / unreadable db is a FAILED read and must be visible —
|
|
126
|
+
// swallowing it made a slow Devin read look like "Devin has no data" and
|
|
127
|
+
// dropped it from the combined total (2026-11-10).
|
|
128
|
+
if (strict && e?.code !== "ENOENT") {
|
|
129
|
+
const full = `${e?.stderr || ""}\n${e?.message || e}`;
|
|
130
|
+
const msg = full.trim().split("\n")[0];
|
|
131
|
+
const why =
|
|
132
|
+
e?.killed || e?.signal
|
|
133
|
+
? `timed out after ${Math.round(timeoutMs / 1000)}s (raise SIGRANK_DEVIN_TIMEOUT_MS)`
|
|
134
|
+
: /locked|busy/i.test(full)
|
|
135
|
+
? "database is locked (transient: try again when the app is closed)"
|
|
136
|
+
: e instanceof SyntaxError
|
|
137
|
+
? "could not parse sqlite output (corrupt or truncated)"
|
|
138
|
+
: msg;
|
|
139
|
+
const err = new Error(`sqlite read of ${dbPath} failed: ${why}`);
|
|
140
|
+
err.code = "SIGRANK_READ_FAILED";
|
|
141
|
+
throw err;
|
|
142
|
+
}
|
|
124
143
|
return [];
|
|
125
144
|
}
|
|
126
145
|
}
|
|
127
146
|
|
|
147
|
+
/** Devin sessions.db read timeout. A large history (>1 min via sqlite3) hit the
|
|
148
|
+
* old fixed 60s cap. Default 5 min; override with SIGRANK_DEVIN_TIMEOUT_MS. */
|
|
149
|
+
export function devinTimeoutMs(env = process.env) {
|
|
150
|
+
const n = Number(env.SIGRANK_DEVIN_TIMEOUT_MS);
|
|
151
|
+
return Number.isFinite(n) && n >= 1000 ? n : 300_000;
|
|
152
|
+
}
|
|
153
|
+
|
|
128
154
|
// ── Env-var helper ────────────────────────────────────────────────────────────
|
|
129
155
|
/** Resolve roots from env var or default. Supports comma-separated list. */
|
|
130
156
|
function roots(envVar, defaultPath) {
|
|
@@ -760,6 +786,7 @@ export const devinAdapter = {
|
|
|
760
786
|
async *records(root) {
|
|
761
787
|
for (const r of roots("DEVIN_HOME", root)) {
|
|
762
788
|
const dbPath = join(r, "sessions.db");
|
|
789
|
+
if (!existsSync(dbPath)) continue; // no Devin db = no local data (not a failure)
|
|
763
790
|
const rows = await sqliteJson(
|
|
764
791
|
dbPath,
|
|
765
792
|
`SELECT row_id, session_id,
|
|
@@ -771,7 +798,8 @@ export const devinAdapter = {
|
|
|
771
798
|
WHERE json_extract(chat_message, '$.role') = 'assistant'
|
|
772
799
|
AND json_extract(chat_message, '$.metadata.metrics.input_tokens') IS NOT NULL
|
|
773
800
|
ORDER BY created_at`,
|
|
774
|
-
|
|
801
|
+
devinTimeoutMs(),
|
|
802
|
+
{ strict: true },
|
|
775
803
|
);
|
|
776
804
|
for (const row of rows) {
|
|
777
805
|
const inputIncl = Number(row.input_tokens || 0);
|
|
@@ -827,9 +855,11 @@ export const otherAdapter = {
|
|
|
827
855
|
async *messages(root) {
|
|
828
856
|
const filePath = root || process.env.SIGRANK_OTHER_PATH;
|
|
829
857
|
if (!filePath) {
|
|
830
|
-
throw new Error(
|
|
858
|
+
throw Object.assign(new Error(
|
|
831
859
|
"other adapter: set SIGRANK_OTHER_PATH to a JSON file with your token pillars. " +
|
|
832
860
|
'Format: { "windows": { "all": { "input": N, "output": N, "cacheCreate": N, "cacheRead": N } } }',
|
|
861
|
+
),
|
|
862
|
+
{ code: "SIGRANK_NO_LOCAL_DATA" },
|
|
833
863
|
);
|
|
834
864
|
}
|
|
835
865
|
let text;
|
|
@@ -1169,6 +1199,7 @@ function makeCcusageAdapter(platform) {
|
|
|
1169
1199
|
export const antigravityAdapter = makeCcusageAdapter("antigravity");
|
|
1170
1200
|
export const grokAdapter = makeCcusageAdapter("grok");
|
|
1171
1201
|
export const zcodeAdapter = makeCcusageAdapter("zcode");
|
|
1202
|
+
export const clineAdapter = makeCcusageAdapter("cline");
|
|
1172
1203
|
|
|
1173
1204
|
// ── Registry ──────────────────────────────────────────────────────────────────
|
|
1174
1205
|
/** All non-Claude, non-Codex adapters keyed by platform ID. */
|
|
@@ -1193,6 +1224,7 @@ export const ADAPTERS = {
|
|
|
1193
1224
|
antigravity: antigravityAdapter,
|
|
1194
1225
|
grok: grokAdapter,
|
|
1195
1226
|
zcode: zcodeAdapter,
|
|
1227
|
+
cline: clineAdapter,
|
|
1196
1228
|
};
|
|
1197
1229
|
|
|
1198
1230
|
export const ALL_PLATFORMS = Object.keys(ADAPTERS).concat(["claude", "codex"]);
|
package/lib/constants.mjs
CHANGED
|
@@ -75,7 +75,7 @@ export const TOKSCALE_CLIENT_MAP = {
|
|
|
75
75
|
kiro: "other",
|
|
76
76
|
trae: "other",
|
|
77
77
|
warp: "other",
|
|
78
|
-
cline: "
|
|
78
|
+
cline: "cline",
|
|
79
79
|
"9router": "other",
|
|
80
80
|
gjc: "other",
|
|
81
81
|
grok: "grok",
|
|
@@ -102,6 +102,12 @@ export const TOKSCALE_CLIENT_MAP = {
|
|
|
102
102
|
hindsight: "other",
|
|
103
103
|
"micode-desktop": "other",
|
|
104
104
|
muse: "other",
|
|
105
|
+
aside: "other",
|
|
106
|
+
proma: "other",
|
|
107
|
+
vibe: "other",
|
|
108
|
+
bb: "other",
|
|
109
|
+
qoder: "other",
|
|
110
|
+
capy: "other",
|
|
105
111
|
synthetic: null,
|
|
106
112
|
};
|
|
107
113
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// lib/update-check.mjs — "update available" notice for the CLI and TUI.
|
|
2
|
+
//
|
|
3
|
+
// Contract: never delays startup, never throws, silent offline. The registry
|
|
4
|
+
// lookup has a short timeout and its result is cached ~24h in ~/.sigrank-mcp
|
|
5
|
+
// (dir 0700, file 0600 — same conventions as identity/keystore.mjs). Callers
|
|
6
|
+
// show the cached notice synchronously and refresh in the background.
|
|
7
|
+
//
|
|
8
|
+
// Opt out: SIGRANK_NO_UPDATE_CHECK=1 (also honours NO_UPDATE_NOTIFIER and CI).
|
|
9
|
+
// This module is never used by the MCP stdio server.
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
chmodSync,
|
|
13
|
+
existsSync,
|
|
14
|
+
mkdirSync,
|
|
15
|
+
readFileSync,
|
|
16
|
+
writeFileSync,
|
|
17
|
+
} from "node:fs";
|
|
18
|
+
import { homedir } from "node:os";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
|
|
21
|
+
export const REGISTRY_URL = "https://registry.npmjs.org/sigrank/latest";
|
|
22
|
+
export const CHECK_TTL_MS = 24 * 60 * 60 * 1000;
|
|
23
|
+
export const RETRY_AFTER_FAIL_MS = 60 * 60 * 1000;
|
|
24
|
+
export const CHECK_TIMEOUT_MS = 1500;
|
|
25
|
+
|
|
26
|
+
const defaultDir = () => join(homedir(), ".sigrank-mcp");
|
|
27
|
+
const truthy = (v) => v != null && v !== "" && v !== "0" && v !== "false";
|
|
28
|
+
|
|
29
|
+
/** True when the user (or CI) opted out of network update checks. */
|
|
30
|
+
export function updateCheckDisabled(env = process.env) {
|
|
31
|
+
return (
|
|
32
|
+
truthy(env.SIGRANK_NO_UPDATE_CHECK) ||
|
|
33
|
+
truthy(env.NO_UPDATE_NOTIFIER) ||
|
|
34
|
+
truthy(env.CI)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const parse = (v) => {
|
|
39
|
+
const m = /^(\d+)\.(\d+)\.(\d+)(?:-.+)?$/.exec(String(v || "").trim());
|
|
40
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** True when `latest` is a strictly newer release than `current`. */
|
|
44
|
+
export function isNewer(latest, current) {
|
|
45
|
+
const a = parse(latest);
|
|
46
|
+
const b = parse(current);
|
|
47
|
+
if (!a || !b) return false;
|
|
48
|
+
for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] > b[i];
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function formatUpdateNotice(latest) {
|
|
53
|
+
return `sigrank ${latest} available — npm install -g sigrank@latest`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const cachePath = (dir) => join(dir, "update-check.json");
|
|
57
|
+
|
|
58
|
+
function readCache(dir) {
|
|
59
|
+
try {
|
|
60
|
+
const c = JSON.parse(readFileSync(cachePath(dir), "utf-8"));
|
|
61
|
+
return c && typeof c === "object" ? c : null;
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function writeCache(dir, data) {
|
|
68
|
+
try {
|
|
69
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
70
|
+
const p = cachePath(dir);
|
|
71
|
+
writeFileSync(p, JSON.stringify(data), { mode: 0o600 });
|
|
72
|
+
chmodSync(p, 0o600);
|
|
73
|
+
} catch {
|
|
74
|
+
/* cache is best-effort */
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Synchronous, no network: the notice from the cached result, or null. */
|
|
79
|
+
export function cachedUpdateNotice({
|
|
80
|
+
current,
|
|
81
|
+
env = process.env,
|
|
82
|
+
dir = defaultDir(),
|
|
83
|
+
} = {}) {
|
|
84
|
+
if (updateCheckDisabled(env)) return null;
|
|
85
|
+
const latest = readCache(dir)?.latest;
|
|
86
|
+
return isNewer(latest, current) ? formatUpdateNotice(latest) : null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Refresh from the registry if the cache is stale, and return the notice (or
|
|
91
|
+
* null). Short timeout, fails silent, resolves with whatever is cached on error.
|
|
92
|
+
*/
|
|
93
|
+
export async function checkForUpdate({
|
|
94
|
+
current,
|
|
95
|
+
env = process.env,
|
|
96
|
+
dir = defaultDir(),
|
|
97
|
+
now = Date.now(),
|
|
98
|
+
fetchImpl = globalThis.fetch,
|
|
99
|
+
timeoutMs = CHECK_TIMEOUT_MS,
|
|
100
|
+
} = {}) {
|
|
101
|
+
try {
|
|
102
|
+
if (updateCheckDisabled(env) || typeof fetchImpl !== "function") return null;
|
|
103
|
+
const cache = readCache(dir);
|
|
104
|
+
const fresh =
|
|
105
|
+
cache &&
|
|
106
|
+
Number.isFinite(cache.checkedAt) &&
|
|
107
|
+
now - cache.checkedAt >= 0 &&
|
|
108
|
+
now - cache.checkedAt < CHECK_TTL_MS;
|
|
109
|
+
const coolingDown =
|
|
110
|
+
cache &&
|
|
111
|
+
Number.isFinite(cache.failedAt) &&
|
|
112
|
+
now - cache.failedAt >= 0 &&
|
|
113
|
+
now - cache.failedAt < RETRY_AFTER_FAIL_MS;
|
|
114
|
+
let latest = cache?.latest;
|
|
115
|
+
if (!fresh && !coolingDown) {
|
|
116
|
+
const ac = new AbortController();
|
|
117
|
+
const timer = setTimeout(() => ac.abort(), timeoutMs);
|
|
118
|
+
timer.unref?.();
|
|
119
|
+
try {
|
|
120
|
+
const res = await fetchImpl(REGISTRY_URL, {
|
|
121
|
+
signal: ac.signal,
|
|
122
|
+
headers: { accept: "application/json" },
|
|
123
|
+
});
|
|
124
|
+
if (!res?.ok) throw new Error(`registry ${res?.status}`);
|
|
125
|
+
const v = (await res.json())?.version;
|
|
126
|
+
if (!parse(v)) throw new Error("bad registry payload");
|
|
127
|
+
latest = v;
|
|
128
|
+
writeCache(dir, { latest, checkedAt: now });
|
|
129
|
+
} catch {
|
|
130
|
+
writeCache(dir, { latest: cache?.latest, checkedAt: cache?.checkedAt, failedAt: now });
|
|
131
|
+
} finally {
|
|
132
|
+
clearTimeout(timer);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return isNewer(latest, current) ? formatUpdateNotice(latest) : null;
|
|
136
|
+
} catch {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
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.50",
|
|
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.50",
|
|
4
4
|
"author": "SunrisesIllNeverSee (https://github.com/SunrisesIllNeverSee)",
|
|
5
5
|
"description": "Upsilon measurement engine distributed through the sigrank CLI/MCP compatibility package, with SigRank public leaderboard tools.",
|
|
6
6
|
"mcpName": "io.github.SunrisesIllNeverSee/sigrank-mcp",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"start": "node index.mjs",
|
|
27
|
-
"test": "node test.mjs && node --test __tests__/sign.test.mjs __tests__/cascade.test.mjs __tests__/badges.test.mjs __tests__/tui-input.test.mjs __tests__/standard-record.test.mjs __tests__/standard-cli.test.mjs __tests__/product-architecture.test.mjs __tests__/tteop-delegation.test.mjs __tests__/mcp-stdio.test.mjs",
|
|
27
|
+
"test": "node test.mjs && node --test __tests__/sign.test.mjs __tests__/cascade.test.mjs __tests__/badges.test.mjs __tests__/tui-input.test.mjs __tests__/standard-record.test.mjs __tests__/standard-cli.test.mjs __tests__/product-architecture.test.mjs __tests__/tteop-delegation.test.mjs __tests__/mcp-stdio.test.mjs __tests__/multi-update-scroll.test.mjs",
|
|
28
28
|
"test:packaged": "node scripts/packed-artifact-smoke.mjs",
|
|
29
29
|
"sync:platforms": "node scripts/sync-platforms.mjs"
|
|
30
30
|
},
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"token-cascade": "0.2.1",
|
|
85
|
-
"ccusage": "20.0.
|
|
85
|
+
"ccusage": "20.0.51",
|
|
86
86
|
"tokscale": "4.18.0",
|
|
87
87
|
"@modelcontextprotocol/server": "2.3.0"
|
|
88
88
|
},
|
package/presentation/cli.mjs
CHANGED
|
@@ -28,6 +28,8 @@ import { callTool, DEFAULT_API_BASE, pullActivePlatforms } from "../tools.mjs";
|
|
|
28
28
|
import { cascade, classify, CLASS_TIERS, UNCLASSED, tierOf } from "../cascade.mjs";
|
|
29
29
|
import { ALL_PLATFORMS } from "../adapters.mjs";
|
|
30
30
|
import { ensureIdentity, keystorePath } from "../keystore.mjs";
|
|
31
|
+
import { pkgVersion } from "../lib/pkg-version.mjs";
|
|
32
|
+
import { cachedUpdateNotice, checkForUpdate } from "../lib/update-check.mjs";
|
|
31
33
|
import { submitSignedWindow } from "../submit.mjs";
|
|
32
34
|
import {
|
|
33
35
|
LEADERBOARD_METRIC,
|
|
@@ -806,9 +808,15 @@ const WATCH_WINDOWS = ["7d", "30d", "90d", "all"];
|
|
|
806
808
|
// oh-my-pi tree (~46s), so `watch --platform claude` used to scan everything and then
|
|
807
809
|
// display one row — scan longer than refresh interval, permanently saturated.
|
|
808
810
|
// null / '' / 'all' still mean "everything", keeping withTokscaleBlind's omp row.
|
|
809
|
-
export async function
|
|
811
|
+
export async function detectActivePullsDetailed(platform, opts = {}) {
|
|
810
812
|
const scoped = platform && platform !== "all" ? [platform] : undefined;
|
|
811
|
-
return pullActivePlatforms({ platforms: scoped }, opts).catch(() =>
|
|
813
|
+
return pullActivePlatforms({ platforms: scoped }, opts).catch(() => ({
|
|
814
|
+
active: [],
|
|
815
|
+
failed: [],
|
|
816
|
+
}));
|
|
817
|
+
}
|
|
818
|
+
export async function detectActivePulls(platform, opts = {}) {
|
|
819
|
+
return (await detectActivePullsDetailed(platform, opts)).active;
|
|
812
820
|
}
|
|
813
821
|
|
|
814
822
|
async function runWatch({
|
|
@@ -840,7 +848,7 @@ async function runWatch({
|
|
|
840
848
|
const draw = async () => {
|
|
841
849
|
// Re-pull each tick so a platform that just started writing logs appears automatically.
|
|
842
850
|
// Scoped by platFilter, so a focused watch never scans platforms it cannot display.
|
|
843
|
-
const pulls = await
|
|
851
|
+
const { active: pulls, failed: failedReads } = await detectActivePullsDetailed(platFilter);
|
|
844
852
|
|
|
845
853
|
if (lines > 0) write(CURSOR_UP(lines));
|
|
846
854
|
|
|
@@ -859,6 +867,9 @@ async function runWatch({
|
|
|
859
867
|
` ${gold("⊙ SigRank")} ${bold("Watch")} ${dim(`${scopeLabel} · ${ts}`)}`,
|
|
860
868
|
);
|
|
861
869
|
push(` ${dim("─".repeat(w - 4))}`);
|
|
870
|
+
if (failedReads.length) {
|
|
871
|
+
push(` ${red("!")} ${dim(`could not read ${failedReads.map((f) => f.platform).join(", ")} — totals below exclude it (it is not "no data")`)}`);
|
|
872
|
+
}
|
|
862
873
|
|
|
863
874
|
if (pulls.length === 0) {
|
|
864
875
|
push();
|
|
@@ -1722,6 +1733,12 @@ async function runSubmit({ platform = "claude", window } = {}) {
|
|
|
1722
1733
|
return;
|
|
1723
1734
|
}
|
|
1724
1735
|
|
|
1736
|
+
if (out.status === "error" && out.reason === "platform_read_failed") {
|
|
1737
|
+
writeln(red(` ✗ ${out.detail}`));
|
|
1738
|
+
process.exitCode = 1;
|
|
1739
|
+
return;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1725
1742
|
writeln();
|
|
1726
1743
|
let anyRanked = false;
|
|
1727
1744
|
let anyReceivedNotRanked = false;
|
|
@@ -1759,6 +1776,16 @@ async function runSubmit({ platform = "claude", window } = {}) {
|
|
|
1759
1776
|
}
|
|
1760
1777
|
}
|
|
1761
1778
|
|
|
1779
|
+
/** True when the plain-CLI update notice applies: a short command, both streams a TTY. */
|
|
1780
|
+
export function shouldShowCliUpdateNotice(cmd, flags = {}, proc = process) {
|
|
1781
|
+
const short =
|
|
1782
|
+
cmd === "compare" ||
|
|
1783
|
+
cmd === "submit" ||
|
|
1784
|
+
cmd === "enroll" ||
|
|
1785
|
+
(cmd === "board" && (flags.once === true || flags.once === "true"));
|
|
1786
|
+
return short && !!proc.stderr?.isTTY && !!proc.stdout?.isTTY;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1762
1789
|
export async function runCli(argv) {
|
|
1763
1790
|
const args = argv.slice(2); // strip 'node' + script path
|
|
1764
1791
|
const cmd = args[0];
|
|
@@ -1807,6 +1834,32 @@ export async function runCli(argv) {
|
|
|
1807
1834
|
flags[key] = val;
|
|
1808
1835
|
}
|
|
1809
1836
|
|
|
1837
|
+
// Update notice (plain CLI): only for SHORT commands that reach printUpdateNotice
|
|
1838
|
+
// below. Interactive/long-running ones (start/run/tui/watch/board without --once)
|
|
1839
|
+
// are skipped: the TUI runs its own check, and two checks would race on
|
|
1840
|
+
// update-check.json. The notice goes to stderr and only on a TTY, so piped
|
|
1841
|
+
// stdout stays clean.
|
|
1842
|
+
const wantNotice = shouldShowCliUpdateNotice(cmd, flags, process);
|
|
1843
|
+
const noticeP = wantNotice
|
|
1844
|
+
? (async () => {
|
|
1845
|
+
const cached = cachedUpdateNotice({ current: pkgVersion() });
|
|
1846
|
+
return cached || (await checkForUpdate({ current: pkgVersion() }));
|
|
1847
|
+
})().catch(() => null)
|
|
1848
|
+
: null;
|
|
1849
|
+
const printUpdateNotice = async () => {
|
|
1850
|
+
if (!noticeP) return;
|
|
1851
|
+
const timer = { t: null };
|
|
1852
|
+
const n = await Promise.race([
|
|
1853
|
+
noticeP,
|
|
1854
|
+
new Promise((r) => {
|
|
1855
|
+
timer.t = setTimeout(() => r(null), 300);
|
|
1856
|
+
timer.t.unref?.();
|
|
1857
|
+
}),
|
|
1858
|
+
]);
|
|
1859
|
+
clearTimeout(timer.t);
|
|
1860
|
+
if (n) process.stderr.write(`\n ${gold("⬆")} ${dim(n)}\n`);
|
|
1861
|
+
};
|
|
1862
|
+
|
|
1810
1863
|
try {
|
|
1811
1864
|
if (cmd === "board") {
|
|
1812
1865
|
await runBoard({
|
|
@@ -1864,6 +1917,7 @@ export async function runCli(argv) {
|
|
|
1864
1917
|
await showHelp();
|
|
1865
1918
|
process.exit(2);
|
|
1866
1919
|
}
|
|
1920
|
+
await printUpdateNotice();
|
|
1867
1921
|
} catch (e) {
|
|
1868
1922
|
write(SHOW_CURSOR);
|
|
1869
1923
|
writeln(red(`\n ✗ ${e.message}`));
|
package/presentation/tui.mjs
CHANGED
|
@@ -24,12 +24,18 @@ import os from "os";
|
|
|
24
24
|
import path from "path";
|
|
25
25
|
import { pathToFileURL } from "node:url";
|
|
26
26
|
import { pkgVersion } from "../lib/pkg-version.mjs";
|
|
27
|
+
import { cachedUpdateNotice, checkForUpdate } from "../lib/update-check.mjs";
|
|
27
28
|
import { LEADERBOARD_METRIC } from "../lib/constants.mjs";
|
|
28
29
|
|
|
29
30
|
// Version read from the shared pkg-version helper (single source of truth —
|
|
30
31
|
// matches cli.mjs; never hardcode, that's what caused the version drift).
|
|
31
32
|
const VERSION = pkgVersion();
|
|
32
33
|
|
|
34
|
+
// "sigrank X available" text for the header; null unless runTui found a newer
|
|
35
|
+
// release (cached result at launch, registry refresh in the background).
|
|
36
|
+
let _updateNotice = null;
|
|
37
|
+
const _updateVersion = () => (_updateNotice ? _updateNotice.split(" ")[1] : null);
|
|
38
|
+
|
|
33
39
|
// Expensive platform readers that the Dashboard only runs on explicit user
|
|
34
40
|
// request. They remain in ALL_PLATFORMS and are still available to me, watch,
|
|
35
41
|
// Compare, and MCP tool calls when the caller explicitly selects the platform.
|
|
@@ -438,9 +444,11 @@ async function loadDashboardData({ includeOmp = false, onPrimary } = {}) {
|
|
|
438
444
|
// primary platform (claude) FAST, then fill the rest in fillDashboardRest. This is the SAME loader
|
|
439
445
|
// `me` and `watch` use, so the three views can't drift apart. (Verifier comparison still runs
|
|
440
446
|
// FRESH + on-demand in the Compare tab — see loadCompareData — never on this Dashboard path.)
|
|
441
|
-
const
|
|
442
|
-
() => [],
|
|
447
|
+
const first = await pullActivePlatforms({ platforms: ["claude"] }).catch(
|
|
448
|
+
() => ({ active: [], failed: [{ platform: "claude", error: "read failed" }] }),
|
|
443
449
|
);
|
|
450
|
+
const active = first.active;
|
|
451
|
+
const failedReads = [...first.failed];
|
|
444
452
|
// PERF: hand the primary platform to the TUI the moment it lands, so Trends (and the cascade)
|
|
445
453
|
// can paint without waiting on the board/batched fetches (up to 5s each) below. The batched
|
|
446
454
|
// "all" override further down mutates these same objects in place.
|
|
@@ -478,6 +486,7 @@ async function loadDashboardData({ includeOmp = false, onPrimary } = {}) {
|
|
|
478
486
|
|
|
479
487
|
return {
|
|
480
488
|
active,
|
|
489
|
+
failed: failedReads,
|
|
481
490
|
verifierMap: {},
|
|
482
491
|
tdPillars: null,
|
|
483
492
|
boardData,
|
|
@@ -496,9 +505,20 @@ async function loadDashboardData({ includeOmp = false, onPrimary } = {}) {
|
|
|
496
505
|
const dashboardPlatformRank = (p) =>
|
|
497
506
|
p === "claude" ? -2 : p === "codex" ? -1 : ALL_PLATFORMS.indexOf(p);
|
|
498
507
|
|
|
508
|
+
// Replace one platform's failure state on every read: a later good read clears it.
|
|
509
|
+
function recordPlatformFailures(dashData, platform, failed) {
|
|
510
|
+
dashData.failed = [
|
|
511
|
+
...(dashData.failed || []).filter((f) => f.platform !== platform),
|
|
512
|
+
...(failed || []).filter((f) => f.platform === platform),
|
|
513
|
+
];
|
|
514
|
+
}
|
|
515
|
+
export const _applyPlatformReadForTest = (dashData, platform, { failed }) =>
|
|
516
|
+
recordPlatformFailures(dashData, platform, failed);
|
|
517
|
+
|
|
499
518
|
async function pullDashboardPlatform(dashData, platform) {
|
|
500
519
|
try {
|
|
501
|
-
const active = await pullActivePlatforms({ platforms: [platform] });
|
|
520
|
+
const { active, failed } = await pullActivePlatforms({ platforms: [platform] });
|
|
521
|
+
recordPlatformFailures(dashData, platform, failed);
|
|
502
522
|
for (const d of active) {
|
|
503
523
|
if (!dashData.active.find((a) => a.platform === d.platform)) {
|
|
504
524
|
// Apply the same batched "all" override as loadDashboardData so
|
|
@@ -749,7 +769,15 @@ function renderTabBar(activeIdx) {
|
|
|
749
769
|
? `${c.bgCyan}${c.boldCyan}${lbl}${c.reset}`
|
|
750
770
|
: `${c.bgDim}${c.dim}${lbl}${c.reset}`;
|
|
751
771
|
}).join("");
|
|
772
|
+
const upd = _updateVersion();
|
|
752
773
|
const rights = [
|
|
774
|
+
...(upd
|
|
775
|
+
? [
|
|
776
|
+
dim(`${gold("v" + VERSION)}${c.reset}${c.dim} · `) + gold(`⬆ ${_updateNotice}`),
|
|
777
|
+
dim(`${gold("v" + VERSION)}${c.reset}${c.dim} `) + gold(`⬆ ${upd} available`),
|
|
778
|
+
dim(`${gold("v" + VERSION)}${c.reset}${c.dim} `) + gold(`⬆ ${upd}`),
|
|
779
|
+
]
|
|
780
|
+
: []),
|
|
753
781
|
right,
|
|
754
782
|
dim(`${gold("v" + VERSION)}${c.reset}${c.dim} · signalaf.com`),
|
|
755
783
|
gold("v" + VERSION),
|
|
@@ -1031,34 +1059,55 @@ function metricSpark(d, pick, fmt) {
|
|
|
1031
1059
|
|
|
1032
1060
|
const DASH_WINS = ["7d", "30d", "90d", "all"];
|
|
1033
1061
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
)
|
|
1062
|
+
/**
|
|
1063
|
+
* Pure scroll-window layout for the cascade table. `rows` is the full ordered
|
|
1064
|
+
* row list ({ platform, notes }: notes = extra lines printed after that
|
|
1065
|
+
* platform's last visible row). `lineBudget` is the number of TERMINAL LINES the
|
|
1066
|
+
* table may use, so ▲/▼ markers, blank separators and notes are all counted —
|
|
1067
|
+
* the old row-count budget overflowed the frame and cut the lower sections off.
|
|
1068
|
+
* Returns the clamped offset, how many rows fit from there, and the exact
|
|
1069
|
+
* above/below counts the hints print.
|
|
1070
|
+
*/
|
|
1071
|
+
export function cascadeWindow(rows, offset, lineBudget) {
|
|
1072
|
+
const n = rows.length;
|
|
1073
|
+
const linesFor = (o, k) => {
|
|
1074
|
+
let lines = (o > 0 ? 1 : 0) + 1 + k + (o + k < n ? 1 : 0); // ▲ + trailing blank + rows + ▼
|
|
1075
|
+
let prev = null;
|
|
1076
|
+
for (let i = o; i < o + k; i++) {
|
|
1077
|
+
const p = rows[i].platform;
|
|
1078
|
+
if (prev !== null && p !== prev) lines += 1 + (rows[i - 1].notes || 0); // blank + note of the group that ended
|
|
1079
|
+
prev = p;
|
|
1080
|
+
}
|
|
1081
|
+
if (k > 0) lines += rows[o + k - 1].notes || 0; // note of the last visible group
|
|
1082
|
+
return lines;
|
|
1083
|
+
};
|
|
1084
|
+
const fit = (o) => {
|
|
1085
|
+
let k = 0;
|
|
1086
|
+
while (o + k < n && linesFor(o, k + 1) <= lineBudget) k++;
|
|
1087
|
+
return Math.max(1, Math.min(k, n - o));
|
|
1088
|
+
};
|
|
1089
|
+
let maxOffset = Math.max(0, n - 1);
|
|
1090
|
+
for (let o = 0; o < n; o++) {
|
|
1091
|
+
if (o + fit(o) >= n) {
|
|
1092
|
+
maxOffset = o;
|
|
1093
|
+
break;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
const eff = Math.max(0, Math.min(Number.isFinite(offset) ? offset : 0, maxOffset));
|
|
1097
|
+
const count = n === 0 ? 0 : fit(eff);
|
|
1098
|
+
return { offset: eff, count, maxOffset, above: eff, below: n - eff - count, total: n };
|
|
1046
1099
|
}
|
|
1047
1100
|
|
|
1048
|
-
//
|
|
1049
|
-
//
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
const platformCount = active.length;
|
|
1053
|
-
const barLines = 4 + platformCount + (platformCount > 1 ? 1 : 0);
|
|
1054
|
-
const boardLines = 17;
|
|
1055
|
-
const sectionsBelow = barLines + boardLines;
|
|
1056
|
-
// used before cascade = header(2) + blank(1) + title(1) + blank(1) + col-header(1) + separator(1) = 7
|
|
1057
|
-
const usedBeforeCascade = 7;
|
|
1058
|
-
return Math.max(8, budget - usedBeforeCascade - sectionsBelow);
|
|
1059
|
-
}
|
|
1101
|
+
// Layout of the last rendered Dashboard cascade (set by renderDashboard) — the key
|
|
1102
|
+
// handler and footer hint read this so they use the SAME numbers as the frame.
|
|
1103
|
+
let _cascadeLayout = { total: 0, count: 0, maxOffset: 0, offset: 0 };
|
|
1104
|
+
const cascadeCanScroll = () => _cascadeLayout.maxOffset > 0;
|
|
1060
1105
|
|
|
1061
|
-
function renderDashboard(data, status = "",
|
|
1106
|
+
function renderDashboard(data, status = "", scrollState = 0) {
|
|
1107
|
+
// scrollState: a number (plain offset) or a { offset, anchor } object the caller
|
|
1108
|
+
// keeps — anchor is the "platform:window" key of the top visible row, so async
|
|
1109
|
+
// loads that insert rows above don't make the view jump.
|
|
1110
|
+
const scroll = typeof scrollState === "object" && scrollState ? scrollState : { offset: scrollState, anchor: null };
|
|
1062
1111
|
const w = W();
|
|
1063
1112
|
const budget = H() - 4; // 2 tab bar + 2 footer
|
|
1064
1113
|
const WINS = ["7d", "30d", "90d", "all"];
|
|
@@ -1212,8 +1261,6 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
|
|
|
1212
1261
|
// +2: "Where you sit" line. Two-column layout (≥130 cols) needs fewer rows.
|
|
1213
1262
|
const boardLines = w >= 130 ? 20 : 26;
|
|
1214
1263
|
const sectionsBelow = barLines + boardLines;
|
|
1215
|
-
const gapNotes = active.filter((d) => gapNote(d.platform)).length;
|
|
1216
|
-
const maxCascadeRows = Math.max(8, budget - used - sectionsBelow - gapNotes);
|
|
1217
1264
|
|
|
1218
1265
|
// SCROLL-VIEW (2026-06-27): Build the full list of cascade rows first, then
|
|
1219
1266
|
// slice by [scrollOffset, scrollOffset + maxCascadeRows]. This gives a real
|
|
@@ -1239,24 +1286,50 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
|
|
|
1239
1286
|
}
|
|
1240
1287
|
}
|
|
1241
1288
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1289
|
+
// Combined row(s) are part of the scrollable list (they used to be a separate
|
|
1290
|
+
// block that vanished whenever the cascade filled the viewport).
|
|
1291
|
+
if (active.length > 1) {
|
|
1292
|
+
const lbl = active.map((d) => d.platform).join("+");
|
|
1293
|
+
const hasEst = active.some((d) => d.estimated);
|
|
1294
|
+
for (const wk of WINS) {
|
|
1295
|
+
const cp = { input: 0, output: 0, cacheCreate: 0, cacheRead: 0 };
|
|
1296
|
+
let any = false;
|
|
1297
|
+
for (const d of active) {
|
|
1298
|
+
const wd = d.windows?.find((x) => x.window === wk);
|
|
1299
|
+
if (!wd || wd.pillars.input + wd.pillars.output === 0) continue;
|
|
1300
|
+
cp.input += wd.pillars.input ?? 0;
|
|
1301
|
+
cp.output += wd.pillars.output ?? 0;
|
|
1302
|
+
cp.cacheCreate += wd.pillars.cacheCreate ?? 0;
|
|
1303
|
+
cp.cacheRead += wd.pillars.cacheRead ?? 0;
|
|
1304
|
+
any = true;
|
|
1305
|
+
}
|
|
1306
|
+
if (!any) continue;
|
|
1307
|
+
allCascadeRows.push({ platform: lbl, winKey: wk, pillars: cp, estimated: hasEst, combined: true });
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
const combinedFirst = allCascadeRows.find((r) => r.combined)?.winKey;
|
|
1311
|
+
const rowKey = (r) => `${r.combined ? "multi" : r.platform}:${r.winKey}`; // combined label changes as platforms load
|
|
1312
|
+
for (const r of allCascadeRows) r.notes = r.combined || !gapNote(r.platform) ? 0 : 1;
|
|
1313
|
+
|
|
1314
|
+
// Keep the view anchored on the same row when rows load in asynchronously.
|
|
1315
|
+
let want = scroll.offset || 0;
|
|
1316
|
+
if (scroll.anchor) {
|
|
1317
|
+
const idx = allCascadeRows.findIndex((r) => rowKey(r) === scroll.anchor);
|
|
1318
|
+
if (idx >= 0) want = idx;
|
|
1319
|
+
}
|
|
1320
|
+
const lineBudget = Math.max(8, budget - used - sectionsBelow);
|
|
1321
|
+
const win = cascadeWindow(allCascadeRows, want, lineBudget);
|
|
1322
|
+
scroll.offset = win.offset;
|
|
1323
|
+
scroll.anchor = win.offset > 0 ? rowKey(allCascadeRows[win.offset]) : null;
|
|
1324
|
+
_cascadeLayout = win;
|
|
1325
|
+
const visibleRows = allCascadeRows.slice(win.offset, win.offset + win.count);
|
|
1251
1326
|
|
|
1252
1327
|
// ▲ indicator: rows above the current viewport
|
|
1253
|
-
if (
|
|
1254
|
-
emit(
|
|
1255
|
-
` ${dim(` ▲ ${effectiveOffset} row${effectiveOffset > 1 ? "s" : ""} above`)}`,
|
|
1256
|
-
);
|
|
1328
|
+
if (win.above > 0) {
|
|
1329
|
+
emit(` ${dim(` ▲ ${win.above} row${win.above > 1 ? "s" : ""} above · ↑↓ scroll`)}`);
|
|
1257
1330
|
}
|
|
1258
1331
|
|
|
1259
|
-
// Render the visible slice — group by platform (
|
|
1332
|
+
// Render the visible slice — group by platform (blank line between groups)
|
|
1260
1333
|
let lastPlatform = null;
|
|
1261
1334
|
for (const row of visibleRows) {
|
|
1262
1335
|
if (lastPlatform !== null && row.platform !== lastPlatform) {
|
|
@@ -1267,6 +1340,7 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
|
|
|
1267
1340
|
renderRow(
|
|
1268
1341
|
row.platform,
|
|
1269
1342
|
(s) => {
|
|
1343
|
+
if (row.combined) return row.winKey === combinedFirst ? bold(cyan(s)) : dim(s);
|
|
1270
1344
|
const pc = platformColor(row.platform);
|
|
1271
1345
|
return row.winKey === firstWin[row.platform] ? bold(pc(s)) : dim(s);
|
|
1272
1346
|
},
|
|
@@ -1283,37 +1357,12 @@ function renderDashboard(data, status = "", scrollOffset = 0) {
|
|
|
1283
1357
|
if (visibleRows.length > 0) emit();
|
|
1284
1358
|
|
|
1285
1359
|
// ▼ indicator: rows below the current viewport
|
|
1286
|
-
|
|
1287
|
-
if (canScroll && rowsBelow > 0) {
|
|
1360
|
+
if (win.below > 0) {
|
|
1288
1361
|
emit(
|
|
1289
|
-
` ${dim(` ▼ ${
|
|
1362
|
+
` ${dim(` ▼ ${win.below} row${win.below > 1 ? "s" : ""} below · ↑↓ scroll`)}${win.offset > 0 ? dim(` · ${win.offset}/${win.maxOffset}`) : ""}`,
|
|
1290
1363
|
);
|
|
1291
1364
|
}
|
|
1292
1365
|
|
|
1293
|
-
// combined
|
|
1294
|
-
if (active.length > 1 && used < budget - sectionsBelow) {
|
|
1295
|
-
const lbl = active.map((d) => d.platform).join("+");
|
|
1296
|
-
const hasEst = active.some((d) => d.estimated);
|
|
1297
|
-
let fst = true;
|
|
1298
|
-
for (const wk of WINS) {
|
|
1299
|
-
const cp = { input: 0, output: 0, cacheCreate: 0, cacheRead: 0 };
|
|
1300
|
-
let any = false;
|
|
1301
|
-
for (const d of active) {
|
|
1302
|
-
const wd = d.windows?.find((x) => x.window === wk);
|
|
1303
|
-
if (!wd || wd.pillars.input + wd.pillars.output === 0) continue;
|
|
1304
|
-
cp.input += wd.pillars.input ?? 0;
|
|
1305
|
-
cp.output += wd.pillars.output ?? 0;
|
|
1306
|
-
cp.cacheCreate += wd.pillars.cacheCreate ?? 0;
|
|
1307
|
-
cp.cacheRead += wd.pillars.cacheRead ?? 0;
|
|
1308
|
-
any = true;
|
|
1309
|
-
}
|
|
1310
|
-
if (!any) continue;
|
|
1311
|
-
renderRow(lbl, (s) => (fst ? bold(cyan(s)) : dim(s)), wk, cp, hasEst);
|
|
1312
|
-
fst = false;
|
|
1313
|
-
}
|
|
1314
|
-
emit();
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
1366
|
// (Υ Trend moved to the dedicated Trends tab [2] — every metric, with sub-views.)
|
|
1318
1367
|
|
|
1319
1368
|
// ── Token Composition — lifetime per platform (owner 2026-10-15: "combine token
|
|
@@ -2735,7 +2784,14 @@ function renderSubmitPreview(dashData, id, page = 0) {
|
|
|
2735
2784
|
return { pages: 0 };
|
|
2736
2785
|
}
|
|
2737
2786
|
const blocks = active.map((d) => ({ platform: d.platform, windows: d.windows }));
|
|
2738
|
-
|
|
2787
|
+
const failedReads = dashData?.failed ?? [];
|
|
2788
|
+
if (failedReads.length) {
|
|
2789
|
+
emit();
|
|
2790
|
+
emit(
|
|
2791
|
+
` ${red("!")} ${dim(`could not read ${failedReads.map((f) => f.platform).join(", ")} — the combined total will NOT be submitted until it reads (press [R]; Devin: SIGRANK_DEVIN_TIMEOUT_MS)`)}`,
|
|
2792
|
+
);
|
|
2793
|
+
}
|
|
2794
|
+
if (active.length >= 2 && !failedReads.length) {
|
|
2739
2795
|
const multi = WINS.map((wk) => {
|
|
2740
2796
|
const sum = { input: 0, output: 0, cacheCreate: 0, cacheRead: 0 };
|
|
2741
2797
|
let messages = 0;
|
|
@@ -3104,7 +3160,7 @@ export async function runTui({
|
|
|
3104
3160
|
let previewPages = 0;
|
|
3105
3161
|
let boardYouOnly = false; // FIX I2: [Y] toggles the Board to "just me" (hybrid model)
|
|
3106
3162
|
let boardUnique = false; // [U] Board: every submission (default, unchanged) ↔ best row per operator
|
|
3107
|
-
|
|
3163
|
+
const cascadeScroll = { offset: 0, anchor: null }; // cascade scroll state (Dashboard only); anchor = top row key, keeps the view put while rows load
|
|
3108
3164
|
let ompEnabled = false; // Session-only Dashboard toggle; deliberately OFF on every launch.
|
|
3109
3165
|
|
|
3110
3166
|
// ── Redraw (buffered: renders into memory, then paints as a locked frame)
|
|
@@ -3158,9 +3214,8 @@ export async function runTui({
|
|
|
3158
3214
|
}
|
|
3159
3215
|
// SCROLL-VIEW: show ↑↓ hint only when there are cascade rows to scroll
|
|
3160
3216
|
const scrollHint =
|
|
3161
|
-
dashData && Array.isArray(dashData.active) &&
|
|
3162
|
-
|
|
3163
|
-
? [{ k: "↑↓", label: "scroll cascade", pri: 2 }]
|
|
3217
|
+
dashData && Array.isArray(dashData.active) && cascadeCanScroll()
|
|
3218
|
+
? [{ k: "↑↓/PgUp/PgDn", label: "scroll cascade", pri: 2 }]
|
|
3164
3219
|
: [];
|
|
3165
3220
|
const ompHint = !dashData?._ompAvailable
|
|
3166
3221
|
? []
|
|
@@ -3308,6 +3363,18 @@ export async function runTui({
|
|
|
3308
3363
|
if (activeTab === 2) await redraw();
|
|
3309
3364
|
};
|
|
3310
3365
|
|
|
3366
|
+
// Update notice: show the cached result at once (no network), refresh from the
|
|
3367
|
+
// registry in the background (1.5s cap, silent offline, cached ~24h). Never awaited.
|
|
3368
|
+
_updateNotice = cachedUpdateNotice({ current: VERSION });
|
|
3369
|
+
checkForUpdate({ current: VERSION })
|
|
3370
|
+
.then((n) => {
|
|
3371
|
+
if (n && n !== _updateNotice) {
|
|
3372
|
+
_updateNotice = n;
|
|
3373
|
+
redraw().catch(() => {});
|
|
3374
|
+
}
|
|
3375
|
+
})
|
|
3376
|
+
.catch(() => {});
|
|
3377
|
+
|
|
3311
3378
|
// ── Initial data load
|
|
3312
3379
|
const loadAll = async () => {
|
|
3313
3380
|
// A2 (2026-06-27): paint the frame + a clear "reading your cascade…" status IMMEDIATELY,
|
|
@@ -3630,7 +3697,8 @@ export async function runTui({
|
|
|
3630
3697
|
let totalVerified = 0,
|
|
3631
3698
|
totalReceived = 0,
|
|
3632
3699
|
hadFail = false,
|
|
3633
|
-
didMulti = false
|
|
3700
|
+
didMulti = false,
|
|
3701
|
+
multiAbort = null;
|
|
3634
3702
|
for (const p of platforms) {
|
|
3635
3703
|
try {
|
|
3636
3704
|
const out = await callTool("submit_verified", { platform: p, confirm: true });
|
|
@@ -3655,6 +3723,10 @@ export async function runTui({
|
|
|
3655
3723
|
platform: "multi",
|
|
3656
3724
|
confirm: true,
|
|
3657
3725
|
});
|
|
3726
|
+
if (out.status === "error" && out.reason === "platform_read_failed") {
|
|
3727
|
+
// A platform read failed: the combined total was NOT submitted.
|
|
3728
|
+
multiAbort = (out.failed_platforms || []).map((f) => f.platform).join(", ") || "a platform";
|
|
3729
|
+
}
|
|
3658
3730
|
const ws = out.windows || [];
|
|
3659
3731
|
const received = ws.filter((w) => w.status === "received");
|
|
3660
3732
|
const verified = received.filter(
|
|
@@ -3669,7 +3741,14 @@ export async function runTui({
|
|
|
3669
3741
|
hadFail = true;
|
|
3670
3742
|
}
|
|
3671
3743
|
}
|
|
3672
|
-
if (
|
|
3744
|
+
if (multiAbort) {
|
|
3745
|
+
const outcome = totalReceived
|
|
3746
|
+
? hadFail
|
|
3747
|
+
? `per-platform: ${totalVerified}/${totalReceived} verified (sign in again [C] if rejected)`
|
|
3748
|
+
: `per-platform: ${totalVerified}/${totalReceived} verified`
|
|
3749
|
+
: "per-platform: nothing received";
|
|
3750
|
+
submitMsg = `${red("✗")} combined total NOT submitted: could not read ${multiAbort} · ${outcome} · press [R] and retry`;
|
|
3751
|
+
} else if (totalReceived && !hadFail && totalVerified === totalReceived) {
|
|
3673
3752
|
submitMsg = `${green("✓")} submitted · ${totalVerified} window${totalVerified > 1 ? "s" : ""} across ${platforms.length} platform${platforms.length > 1 ? "s" : ""}${didMulti ? " + combined" : ""} · verified`;
|
|
3674
3753
|
} else if (hadFail && totalReceived) {
|
|
3675
3754
|
submitMsg = `${red("✗")} device not verified — sign in again ([C])`;
|
|
@@ -3763,35 +3842,21 @@ export async function runTui({
|
|
|
3763
3842
|
// SCROLL-VIEW (2026-06-27): ↑/↓ (or j/k) scroll the cascade section on the
|
|
3764
3843
|
// Dashboard tab ONLY. The rest of the dashboard stays pinned. Only active
|
|
3765
3844
|
// when there are more cascade rows than fit in the viewport.
|
|
3766
|
-
if (activeTab === 0 && dashData && Array.isArray(dashData.active)) {
|
|
3767
|
-
const
|
|
3768
|
-
const
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
return;
|
|
3782
|
-
}
|
|
3783
|
-
if (key === "\x1b[5~") {
|
|
3784
|
-
// PageUp → scroll up by viewport
|
|
3785
|
-
cascadeScroll = Math.max(0, cascadeScroll - maxRows);
|
|
3786
|
-
await redraw();
|
|
3787
|
-
return;
|
|
3788
|
-
}
|
|
3789
|
-
if (key === "\x1b[6~") {
|
|
3790
|
-
// PageDown → scroll down by viewport
|
|
3791
|
-
cascadeScroll = Math.min(maxOff, cascadeScroll + maxRows);
|
|
3792
|
-
await redraw();
|
|
3793
|
-
return;
|
|
3794
|
-
}
|
|
3845
|
+
if (activeTab === 0 && dashData && Array.isArray(dashData.active) && cascadeCanScroll()) {
|
|
3846
|
+
const { maxOffset, count } = _cascadeLayout;
|
|
3847
|
+
const cur = cascadeScroll.offset;
|
|
3848
|
+
let next = null;
|
|
3849
|
+
if (key === "\x1b[A" || k === "k") next = cur - 1; // ↑ / k
|
|
3850
|
+
else if (key === "\x1b[B" || k === "j") next = cur + 1; // ↓ / j
|
|
3851
|
+
else if (key === "\x1b[5~") next = cur - Math.max(1, count - 1); // PageUp
|
|
3852
|
+
else if (key === "\x1b[6~") next = cur + Math.max(1, count - 1); // PageDown
|
|
3853
|
+
else if (key === "\x1b[H" || key === "\x1b[1~" || key === "\x1bOH") next = 0; // Home
|
|
3854
|
+
else if (key === "\x1b[F" || key === "\x1b[4~" || key === "\x1bOF") next = maxOffset; // End
|
|
3855
|
+
if (next !== null) {
|
|
3856
|
+
cascadeScroll.offset = Math.max(0, Math.min(maxOffset, next));
|
|
3857
|
+
cascadeScroll.anchor = null; // user moved: re-derive the anchor on render
|
|
3858
|
+
await redraw();
|
|
3859
|
+
return;
|
|
3795
3860
|
}
|
|
3796
3861
|
}
|
|
3797
3862
|
|
|
@@ -3835,7 +3900,7 @@ export async function runTui({
|
|
|
3835
3900
|
} // [C] → Connect from any read tab
|
|
3836
3901
|
|
|
3837
3902
|
// SCROLL-VIEW: reset cascade scroll when leaving the Dashboard tab
|
|
3838
|
-
if (switched && activeTab !== 0) cascadeScroll = 0;
|
|
3903
|
+
if (switched && activeTab !== 0) { cascadeScroll.offset = 0; cascadeScroll.anchor = null; }
|
|
3839
3904
|
|
|
3840
3905
|
// #9 (2026-06-27): Compare loads its FRESH verifier pull ON-DEMAND when the tab opens
|
|
3841
3906
|
// (NOT on the Dashboard load path — that pull is a 5–60s scan). Paint the "pulling fresh
|
|
@@ -3962,7 +4027,8 @@ export async function runTui({
|
|
|
3962
4027
|
return;
|
|
3963
4028
|
}
|
|
3964
4029
|
status = "refreshing…";
|
|
3965
|
-
cascadeScroll = 0; // SCROLL-VIEW: reset scroll on refresh
|
|
4030
|
+
cascadeScroll.offset = 0; // SCROLL-VIEW: reset scroll on refresh
|
|
4031
|
+
cascadeScroll.anchor = null;
|
|
3966
4032
|
// #9: on the Compare tab, [R] re-runs the FRESH verifier pull for the current platform
|
|
3967
4033
|
// (loadAll no longer touches Compare). Clearing compareData shows the spinner first.
|
|
3968
4034
|
if (activeTab === 2) {
|
package/submit/index.mjs
CHANGED
|
@@ -188,14 +188,14 @@ export async function submitSignedWindow(
|
|
|
188
188
|
return {
|
|
189
189
|
status: "not_enrolled",
|
|
190
190
|
reason: "not_enrolled",
|
|
191
|
-
detail: "Run `npx sigrank
|
|
191
|
+
detail: "Run `npx sigrank enroll` to bind this device first.",
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
if (!identity?.private_key_pkcs8_b64) {
|
|
195
195
|
return {
|
|
196
196
|
status: "error",
|
|
197
197
|
reason: "no_key",
|
|
198
|
-
detail: "No local signing key — re-run `npx sigrank
|
|
198
|
+
detail: "No local signing key — re-run `npx sigrank enroll`.",
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
|
package/tools/_multi.mjs
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tools/_multi.mjs — shared collector for the combined ("multi") cascade.
|
|
3
|
+
*
|
|
4
|
+
* "No local data" (empty read, platform not set up) is fine to skip. A platform
|
|
5
|
+
* whose read THROWS or times out is a FAILED read: dropping it silently submits
|
|
6
|
+
* a too-small combined total (2026-11-10: Devin timed out and the all-time
|
|
7
|
+
* total went out as 7.7B instead of 61.5B). Callers must abort on `failed`.
|
|
8
|
+
*/
|
|
9
|
+
import { ALL_PLATFORMS } from "../adapters/index.mjs";
|
|
10
|
+
import { pullByPlatform } from "./_helpers.mjs";
|
|
11
|
+
|
|
12
|
+
const hasTokens = (r) =>
|
|
13
|
+
!!r &&
|
|
14
|
+
(r.windows || []).some(
|
|
15
|
+
(w) =>
|
|
16
|
+
(w.pillars?.input || 0) +
|
|
17
|
+
(w.pillars?.output || 0) +
|
|
18
|
+
(w.pillars?.cacheCreate || 0) +
|
|
19
|
+
(w.pillars?.cacheRead || 0) >
|
|
20
|
+
0,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// Test-only reader override. Deliberately NOT reachable through ctx.opts, so a
|
|
24
|
+
// caller of the (signed) submit path cannot swap the real platform reader.
|
|
25
|
+
let _testPull = null;
|
|
26
|
+
export function _setMultiPullForTest(fn) {
|
|
27
|
+
_testPull = fn || null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Pull every platform. Returns { detected, failed:[{platform,error}] }. */
|
|
31
|
+
export async function collectMultiPlatforms(opts = {}, platforms = ALL_PLATFORMS) {
|
|
32
|
+
const detected = [];
|
|
33
|
+
const failed = [];
|
|
34
|
+
const pull = _testPull ?? pullByPlatform;
|
|
35
|
+
for (const p of platforms) {
|
|
36
|
+
let r;
|
|
37
|
+
try {
|
|
38
|
+
r = await pull(p, opts);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// Allow-list of abort conditions: only a real read failure of a store that
|
|
41
|
+
// exists (timeout, locked/corrupt db) aborts. Anything else (adapter not
|
|
42
|
+
// set up, stale SIGRANK_OTHER_PATH, no data) is "no data" and is skipped.
|
|
43
|
+
if (e?.code !== "SIGRANK_READ_FAILED") continue;
|
|
44
|
+
failed.push({ platform: p, error: String(e?.message || e) });
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (hasTokens(r)) detected.push(r);
|
|
48
|
+
}
|
|
49
|
+
return { detected, failed };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The result handlers return (and submit nothing) when a platform read failed. */
|
|
53
|
+
export function multiAbortResult(failed, extra = {}) {
|
|
54
|
+
const names = failed.map((f) => f.platform).join(", ");
|
|
55
|
+
return {
|
|
56
|
+
platform: "multi",
|
|
57
|
+
...extra,
|
|
58
|
+
status: "error",
|
|
59
|
+
reason: "platform_read_failed",
|
|
60
|
+
failed_platforms: failed,
|
|
61
|
+
detail: `multi aborted: could not read ${names} (${failed.map((f) => `${f.platform}: ${f.error}`).join("; ")}). Nothing was submitted, because a combined total without ${names} would be too small. Fix or retry (Devin: raise SIGRANK_DEVIN_TIMEOUT_MS).`,
|
|
62
|
+
windows: [],
|
|
63
|
+
};
|
|
64
|
+
}
|
package/tools/discover-peers.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import { LEADERBOARD_METRIC } from "../lib/constants.mjs";
|
|
|
33
33
|
export const TOOL_DEF = {
|
|
34
34
|
name: "discover_peers",
|
|
35
35
|
description:
|
|
36
|
-
"Discovers mentors, peers, and complementary operators for YOUR operator on the SigRank leaderboard. Uses your enrolled device identity — no codename needed. Finds operators you should learn from: (1) Mentors — 1-2 class tiers above you with similar cascade shapes, including the specific pillar delta that explains the yield gap (e.g. '12× your cache reads'). (2) Peers — same class tier, ranked by yield proximity. (3) Complementary — operators whose strength is your weakness. Use this after submit_verified to find who to learn from, then chain into self_improve with the mentor's pillar deltas as context. Requires enrollment (npx sigrank
|
|
36
|
+
"Discovers mentors, peers, and complementary operators for YOUR operator on the SigRank leaderboard. Uses your enrolled device identity — no codename needed. Finds operators you should learn from: (1) Mentors — 1-2 class tiers above you with similar cascade shapes, including the specific pillar delta that explains the yield gap (e.g. '12× your cache reads'). (2) Peers — same class tier, ranked by yield proximity. (3) Complementary — operators whose strength is your weakness. Use this after submit_verified to find who to learn from, then chain into self_improve with the mentor's pillar deltas as context. Requires enrollment (npx sigrank enroll). Intent: DISCOVER_PEERS.",
|
|
37
37
|
annotations: {
|
|
38
38
|
title: "Discover peers and mentors",
|
|
39
39
|
...ANNOTATIONS.readOnlyHint,
|
|
@@ -99,7 +99,7 @@ export async function handleDiscoverPeers(args, ctx) {
|
|
|
99
99
|
return {
|
|
100
100
|
status: "not_enrolled",
|
|
101
101
|
detail:
|
|
102
|
-
"Run `npx sigrank
|
|
102
|
+
"Run `npx sigrank enroll` to bind this device first, then submit_verified to appear on the board.",
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
|
package/tools/index.mjs
CHANGED
|
@@ -122,6 +122,7 @@ export function withTokscaleBlind(detected) {
|
|
|
122
122
|
* opts.callTool overrides the per-platform pull for tests (same opts-injection
|
|
123
123
|
* convention as opts.adapter in pullByPlatform) so the target-set logic is
|
|
124
124
|
* assertable without a real filesystem scan. */
|
|
125
|
+
const READ_FAILED = "SIGRANK_READ_FAILED";
|
|
125
126
|
async function _pullExplicit(platforms, opts = {}) {
|
|
126
127
|
const pull = opts.callTool || callTool;
|
|
127
128
|
const settled = await Promise.allSettled(
|
|
@@ -138,8 +139,17 @@ async function _pullExplicit(platforms, opts = {}) {
|
|
|
138
139
|
const rank = (p) =>
|
|
139
140
|
p === "claude" ? -2 : p === "codex" ? -1 : ALL_PLATFORMS.indexOf(p);
|
|
140
141
|
active.sort((a, b) => rank(a.platform) - rank(b.platform));
|
|
141
|
-
|
|
142
|
+
// Platforms whose read FAILED (SIGRANK_READ_FAILED: timeout, locked/corrupt db on
|
|
143
|
+
// an existing store) — not "no data". Callers building a combined total must
|
|
144
|
+
// refuse to show/submit a too-small one. Any other rejection (adapter not set up,
|
|
145
|
+
// unconfigured path) is treated as no data, as before.
|
|
146
|
+
const failed = settled
|
|
147
|
+
.map((r, i) => ({ r, platform: platforms[i] }))
|
|
148
|
+
.filter(({ r }) => r.status === "rejected" && r.reason?.code === READ_FAILED)
|
|
149
|
+
.map(({ r, platform }) => ({ platform, error: String(r.reason?.message || r.reason) }));
|
|
150
|
+
return { active, failed };
|
|
142
151
|
}
|
|
152
|
+
export const _pullExplicitForTest = (platforms, opts) => _pullExplicit(platforms, opts);
|
|
143
153
|
|
|
144
154
|
// ── Shared active-platform loader ───────────────────────────────────────────
|
|
145
155
|
// THE single data path for "show my cascade across platforms" — used by `me`,
|
|
@@ -147,6 +157,7 @@ async function _pullExplicit(platforms, opts = {}) {
|
|
|
147
157
|
// target platform via the tokenpull tool (enriched: pillars + cascade + card),
|
|
148
158
|
// keeps only platforms with real local data, and sorts claude → codex → rest.
|
|
149
159
|
// Pass `platforms` to scope it (e.g. ['claude'] for a fast first paint).
|
|
160
|
+
// Returns { active, failed }: failed = platforms whose read FAILED (not "no data").
|
|
150
161
|
export async function pullActivePlatforms({ platforms } = {}, opts = {}) {
|
|
151
162
|
// If the caller specified explicit platforms, use those.
|
|
152
163
|
if (platforms && platforms.length) {
|
|
@@ -6,13 +6,14 @@ import { ALL_PLATFORMS } from "../adapters/index.mjs";
|
|
|
6
6
|
import { ensureIdentity } from "../identity/keystore.mjs";
|
|
7
7
|
import { submitSignedWindow } from "../submit/index.mjs";
|
|
8
8
|
import { SUBMIT_OUTPUT, ANNOTATIONS } from "./_schemas.mjs";
|
|
9
|
+
import { collectMultiPlatforms, multiAbortResult } from "./_multi.mjs";
|
|
9
10
|
import { pullByPlatform, WINDOW_TYPE } from "./_helpers.mjs";
|
|
10
11
|
import { _computeReportBlock } from "./_report.mjs";
|
|
11
12
|
|
|
12
13
|
export const TOOL_DEF = {
|
|
13
14
|
name: "submit_verified",
|
|
14
15
|
description:
|
|
15
|
-
"Publish your LOCAL token runs to the SigRank board as a VERIFIED operator — the enrolled, signed path. Reads your pillars (tokenpull), builds the canonical Schema 1.0 snapshot per window, ed25519-signs it with your device key, and POSTs to /api/v1/snapshots. Requires `npx sigrank
|
|
16
|
+
"Publish your LOCAL token runs to the SigRank board as a VERIFIED operator — the enrolled, signed path. Reads your pillars (tokenpull), builds the canonical Schema 1.0 snapshot per window, ed25519-signs it with your device key, and POSTs to /api/v1/snapshots. Requires `npx sigrank enroll` first (a bound device). Only signed submissions from a trusted device rank on the board. Token-only; the private key never leaves your machine. Publishing requires `confirm: true` (ask the user first); pass dry_run:true to inspect the exact signed payload without publishing and without confirm.",
|
|
16
17
|
annotations: {
|
|
17
18
|
title: "Submit verified score",
|
|
18
19
|
...ANNOTATIONS.destructiveHint,
|
|
@@ -54,7 +55,7 @@ export async function handleSubmitVerified(args, ctx) {
|
|
|
54
55
|
if (!id.codename || !id.operator_id) {
|
|
55
56
|
return {
|
|
56
57
|
status: "not_enrolled",
|
|
57
|
-
detail: "Run `npx sigrank
|
|
58
|
+
detail: "Run `npx sigrank enroll` to bind this device first.",
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
61
|
if (!args?.dry_run && args?.confirm !== true) {
|
|
@@ -72,21 +73,8 @@ export async function handleSubmitVerified(args, ctx) {
|
|
|
72
73
|
// per window and publish as platform='multi' = the operator's TOTAL usage. Empty
|
|
73
74
|
// windows are skipped so a no-activity window never lands as a degenerate row.
|
|
74
75
|
if (platform === "multi") {
|
|
75
|
-
const detected =
|
|
76
|
-
|
|
77
|
-
const r = await pullByPlatform(p, ctx.opts).catch(() => null);
|
|
78
|
-
const live =
|
|
79
|
-
r &&
|
|
80
|
-
(r.windows || []).some(
|
|
81
|
-
(w) =>
|
|
82
|
-
w.pillars.input +
|
|
83
|
-
w.pillars.output +
|
|
84
|
-
w.pillars.cacheCreate +
|
|
85
|
-
w.pillars.cacheRead >
|
|
86
|
-
0,
|
|
87
|
-
);
|
|
88
|
-
if (live) detected.push(r);
|
|
89
|
-
}
|
|
76
|
+
const { detected, failed } = await collectMultiPlatforms(ctx.opts);
|
|
77
|
+
if (failed.length) return multiAbortResult(failed, { codename: id.codename, operator_id: id.operator_id });
|
|
90
78
|
if (detected.length < 2) {
|
|
91
79
|
return {
|
|
92
80
|
platform: "multi",
|
|
@@ -6,6 +6,7 @@ import { cascade } from "../analytics/cascade.mjs";
|
|
|
6
6
|
import { narrate } from "../presentation/narrate.mjs";
|
|
7
7
|
import { ALL_PLATFORMS } from "../adapters/index.mjs";
|
|
8
8
|
import { SUBMIT_OUTPUT, ANNOTATIONS } from "./_schemas.mjs";
|
|
9
|
+
import { collectMultiPlatforms, multiAbortResult } from "./_multi.mjs";
|
|
9
10
|
import {
|
|
10
11
|
pullByPlatform,
|
|
11
12
|
} from "./_helpers.mjs";
|
|
@@ -55,21 +56,8 @@ export async function handleTokenpullSubmit(args, ctx) {
|
|
|
55
56
|
// (cloud, via tokscale). Aggregate every locally-detected platform's pillars per
|
|
56
57
|
// window.
|
|
57
58
|
if (platform === "multi") {
|
|
58
|
-
const detected =
|
|
59
|
-
|
|
60
|
-
const r = await pullByPlatform(p, ctx.opts).catch(() => null);
|
|
61
|
-
const live =
|
|
62
|
-
r &&
|
|
63
|
-
(r.windows || []).some(
|
|
64
|
-
(w) =>
|
|
65
|
-
w.pillars.input +
|
|
66
|
-
w.pillars.output +
|
|
67
|
-
w.pillars.cacheCreate +
|
|
68
|
-
w.pillars.cacheRead >
|
|
69
|
-
0,
|
|
70
|
-
);
|
|
71
|
-
if (live) detected.push(r);
|
|
72
|
-
}
|
|
59
|
+
const { detected, failed } = await collectMultiPlatforms(ctx.opts);
|
|
60
|
+
if (failed.length) return multiAbortResult(failed, { codename: codename || undefined });
|
|
73
61
|
if (detected.length < 2) {
|
|
74
62
|
return {
|
|
75
63
|
platform: "multi",
|
package/tools/tokenpull.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { cascade } from "../analytics/cascade.mjs";
|
|
|
6
6
|
import { narrate } from "../presentation/narrate.mjs";
|
|
7
7
|
import { ALL_PLATFORMS } from "../adapters/index.mjs";
|
|
8
8
|
import { TOKENPULL_OUTPUT, ANNOTATIONS } from "./_schemas.mjs";
|
|
9
|
+
import { collectMultiPlatforms, multiAbortResult } from "./_multi.mjs";
|
|
9
10
|
import { pullByPlatform } from "./_helpers.mjs";
|
|
10
11
|
|
|
11
12
|
export const TOOL_DEF = {
|
|
@@ -33,21 +34,8 @@ export async function handleTokenpull(args, ctx) {
|
|
|
33
34
|
// MULTI: sum every locally-detected platform's pillars per window. Same logic as
|
|
34
35
|
// submit_verified's multi flow — Devin (cloud, via tokscale) is included.
|
|
35
36
|
if (platform === "multi") {
|
|
36
|
-
const detected =
|
|
37
|
-
|
|
38
|
-
const r = await pullByPlatform(p, ctx.opts).catch(() => null);
|
|
39
|
-
const live =
|
|
40
|
-
r &&
|
|
41
|
-
(r.windows || []).some(
|
|
42
|
-
(w) =>
|
|
43
|
-
w.pillars.input +
|
|
44
|
-
w.pillars.output +
|
|
45
|
-
w.pillars.cacheCreate +
|
|
46
|
-
w.pillars.cacheRead >
|
|
47
|
-
0,
|
|
48
|
-
);
|
|
49
|
-
if (live) detected.push(r);
|
|
50
|
-
}
|
|
37
|
+
const { detected, failed } = await collectMultiPlatforms(ctx.opts);
|
|
38
|
+
if (failed.length) return multiAbortResult(failed, {});
|
|
51
39
|
if (detected.length < 2) {
|
|
52
40
|
return {
|
|
53
41
|
platform: "multi",
|
|
@@ -126,7 +126,7 @@ export async function handleWatchTokenpull(args, ctx) {
|
|
|
126
126
|
} else {
|
|
127
127
|
auth_submit = {
|
|
128
128
|
status: "not_enrolled",
|
|
129
|
-
detail: "Run `npx sigrank
|
|
129
|
+
detail: "Run `npx sigrank enroll` to auto-submit verified runs.",
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
}
|