sprag-cli 3.103.1 β 3.105.0
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/README.ko.md +25 -4
- package/README.md +38 -10
- package/bin/cli.js +17 -4
- package/evals/README.md +101 -0
- package/evals/SUMMARY.md +18 -0
- package/evals/summary.json +224 -0
- package/package.json +13 -2
- package/presets/delegation/bounds.md +4 -3
- package/src/commands/delegate.js +12 -9
- package/src/commands/install.js +40 -0
- package/src/commands/proof.js +80 -0
- package/src/commands/saved.js +26 -19
- package/src/commands/team.js +6 -2
- package/src/delegation-guard.js +42 -7
- package/src/effort-raise-ledger.js +117 -0
- package/src/formatters/statusline.js +121 -19
- package/src/glyphs.js +3 -0
- package/src/installer.js +14 -13
- package/src/office-species.js +29 -0
- package/src/route-scan.js +25 -15
- package/src/team-standing.js +255 -0
- package/src/team-sync.js +37 -2
|
@@ -31,6 +31,7 @@ import { modelFamily } from '../savings-ledger.js';
|
|
|
31
31
|
import { shareLegend } from '../model-share.js';
|
|
32
32
|
import { STAR_URL } from '../star-note.js';
|
|
33
33
|
import { speciesLabel } from '../office-species.js';
|
|
34
|
+
import { standingFeedbackShort } from '../team-standing.js';
|
|
34
35
|
import { cellWidth } from '../cell-width.js';
|
|
35
36
|
|
|
36
37
|
// The 8-color ANSI defaults (RED=31, GREEN=32, YELLOW=33β¦) read as garish
|
|
@@ -399,10 +400,12 @@ function buildVersionSeg(version, update, c, isIcon, verbose, g) {
|
|
|
399
400
|
const TEAM_STANDING_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
400
401
|
|
|
401
402
|
/**
|
|
402
|
-
* Team chip: the member id and, once the server has told us,
|
|
403
|
-
*
|
|
403
|
+
* Team chip: the member id, the organization and, once the server has told us,
|
|
404
|
+
* the overall-score rank and the animal that member is in the team's virtual
|
|
405
|
+
* office (`member-1e500474 amazon overall score #3 of 12 π¦ Fox`). Renders only
|
|
404
406
|
* for a joined machine. A missing, unknown or day-old standing leaves just the
|
|
405
|
-
* member label
|
|
407
|
+
* member label (and the organization, when known). The office page calls the
|
|
408
|
+
* ranked figure the overall score (spend rank, delegation rank, prompt rank). Gray like the other identity chips; the emoji brings its own colour.
|
|
406
409
|
* The emoji draws only in icon mode: narrow (the IntelliJ default, whose font has
|
|
407
410
|
* no animal emoji) and text keep the animal's name and the rank.
|
|
408
411
|
*/
|
|
@@ -413,8 +416,60 @@ function buildTeamSeg(team, c, mode = 'icon', now = Date.now()) {
|
|
|
413
416
|
const animal = fresh ? speciesLabel(st.grade, team.lang, { emoji: mode === 'icon' }) : null;
|
|
414
417
|
// The rank among the ranked people, the same standing the office drawer shows; a ghost has none.
|
|
415
418
|
const ranked = animal && Number.isInteger(st.rank) && Number.isInteger(st.ranked) && st.rank >= 1 && st.ranked >= st.rank;
|
|
416
|
-
|
|
417
|
-
|
|
419
|
+
// The rank within the person's own team rides behind the organization rank,
|
|
420
|
+
// only when the team is a strict part of the ranked people: in a one-team
|
|
421
|
+
// organization the two are the same number.
|
|
422
|
+
const inTeam = ranked && Number.isInteger(st.teamRank) && Number.isInteger(st.teamRanked)
|
|
423
|
+
&& st.teamRank >= 1 && st.teamRanked >= st.teamRank && st.teamRanked < st.ranked && typeof team.team === 'string' && team.team;
|
|
424
|
+
const teamPlace = inTeam ? (team.lang === 'ko' ? `, ${team.team} ν ${st.teamRanked}λͺ
μ€ ${st.teamRank}μ` : `, team ${team.team} #${st.teamRank} of ${st.teamRanked}`) : '';
|
|
425
|
+
const place = ranked ? (team.lang === 'ko' ? ` μ’
ν© μ μ ${st.ranked}λͺ
μ€ ${st.rank}μ${teamPlace}` : ` overall score #${st.rank} of ${st.ranked}${teamPlace}`) : '';
|
|
426
|
+
const org = typeof team.org === 'string' && team.org ? ` ${team.org}` : '';
|
|
427
|
+
// The plan leads (`Pro`, `Enterprise`): the chip describes a licensed team, so
|
|
428
|
+
// the license is the first thing it says, and the standing follows.
|
|
429
|
+
const plan = typeof team.plan === 'string' && team.plan ? `${team.plan[0].toUpperCase()}${team.plan.slice(1)} ` : '';
|
|
430
|
+
return `${c(GRAY)}${plan}${team.label}${org}${animal ? `${place} ${animal}` : ''}${c(RESET)}`;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* The team line (multi-line layout): the licensed team this machine belongs
|
|
435
|
+
* to, on a line of its own so it never blends into the diagnostics chips, and
|
|
436
|
+
* what the standing asks of you. Head: plan, organization, team, member id.
|
|
437
|
+
* Breakdown: the rank with the animal, then the short feedback from
|
|
438
|
+
* src/team-standing.js (people to pass for #1, the next species and what it
|
|
439
|
+
* takes). Null for a machine that has not joined; the chip above stands in on
|
|
440
|
+
* the single-line layouts.
|
|
441
|
+
* icon: "π₯ Pro Β· amazon Β· AWS-FSI Β· member-1e500474 | μ’
ν© μ μ 12λͺ
μ€ 3μ, ν 4λͺ
μ€ 1μ π¦ μ¬μ° Β· 1μκΉμ§ 2λͺ
Β· λ€μ π μΉν: 2λͺ
λ (77%λΆν°)"
|
|
442
|
+
* text: "Pro Β· amazon Β· AWS-FSI Β· member-1e500474 | overall score #3 of 12, team #1 of 4 Fox Β· 2 to pass for #1 Β· next Cheetah: 2 more (77% and up)"
|
|
443
|
+
*/
|
|
444
|
+
function buildTeamLine(team, c, isIcon, g, mode = 'icon', now = Date.now()) {
|
|
445
|
+
if (!team || typeof team !== 'object' || !team.label) return null;
|
|
446
|
+
const ko = team.lang === 'ko';
|
|
447
|
+
const emoji = mode === 'icon';
|
|
448
|
+
const plan = typeof team.plan === 'string' && team.plan ? `${team.plan[0].toUpperCase()}${team.plan.slice(1)}` : null;
|
|
449
|
+
const org = typeof team.org === 'string' && team.org ? team.org : null;
|
|
450
|
+
const teamName = typeof team.team === 'string' && team.team && team.team !== org ? team.team : null;
|
|
451
|
+
// Narrow has no verified glyph for the team, so its head starts with the words.
|
|
452
|
+
const head = `${isIcon && g.team ? `${g.team} ` : ''}${[plan, org, teamName, team.label].filter(Boolean).join(' Β· ')}`;
|
|
453
|
+
const st = team.standing;
|
|
454
|
+
const fresh = st && Number.isFinite(st.fetchedAt) && now - st.fetchedAt <= TEAM_STANDING_MAX_AGE_MS;
|
|
455
|
+
const parts = [];
|
|
456
|
+
if (fresh) {
|
|
457
|
+
const animal = speciesLabel(st.grade, team.lang, { emoji });
|
|
458
|
+
const ranked = animal && Number.isInteger(st.rank) && Number.isInteger(st.ranked) && st.rank >= 1 && st.ranked >= st.rank;
|
|
459
|
+
if (ranked) {
|
|
460
|
+
const inTeam = Number.isInteger(st.teamRank) && Number.isInteger(st.teamRanked)
|
|
461
|
+
&& st.teamRank >= 1 && st.teamRanked >= st.teamRank && st.teamRanked < st.ranked;
|
|
462
|
+
const teamPlace = inTeam ? (ko ? `, ν ${st.teamRanked}λͺ
μ€ ${st.teamRank}μ` : `, team #${st.teamRank} of ${st.teamRanked}`) : '';
|
|
463
|
+
parts.push(ko ? `μ’
ν© μ μ ${st.ranked}λͺ
μ€ ${st.rank}μ${teamPlace} ${animal}` : `overall score #${st.rank} of ${st.ranked}${teamPlace} ${animal}`);
|
|
464
|
+
} else if (animal) {
|
|
465
|
+
parts.push(animal);
|
|
466
|
+
}
|
|
467
|
+
parts.push(...standingFeedbackShort(st, team.lang, { emoji }));
|
|
468
|
+
}
|
|
469
|
+
const tail = parts.length
|
|
470
|
+
? ` ${c(GRAY)}|${c(RESET)} ${parts.map((p) => `${c(GRAY)}${p}${c(RESET)}`).join(` ${c(GRAY)}Β·${c(RESET)} `)}`
|
|
471
|
+
: '';
|
|
472
|
+
return { usd: 0, line: `${c(GRAY)}${c(BOLD)}${head}${c(RESET)}${tail}` };
|
|
418
473
|
}
|
|
419
474
|
|
|
420
475
|
/**
|
|
@@ -1147,13 +1202,29 @@ function buildDelegatedSeg(data, singleLine, c, isIcon, verbose, g) {
|
|
|
1147
1202
|
const delegateExtra = savingsChip && delegationSaved === 0 ? unresolvedSeg : null;
|
|
1148
1203
|
|
|
1149
1204
|
// Sonnet delegations the guard ran at high effort because the call passed
|
|
1150
|
-
// none
|
|
1151
|
-
//
|
|
1152
|
-
//
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1205
|
+
// none, in the shape of the other two savings: "Effort saved" is the routing
|
|
1206
|
+
// saving those raised runs produced (a part of Routing saved, never added to
|
|
1207
|
+
// it), and the raise count rides as the breakdown. A raise with no measured
|
|
1208
|
+
// saving (no registered rule routed the run) keeps the gray count chip, as a
|
|
1209
|
+
// bare document count does for Doc2md. `sprag saved` prints what the runs cost.
|
|
1210
|
+
// icon: "π¬ $12.4" verbose: "π¬ Effort saved $12.4 Β· 3 raised"
|
|
1211
|
+
// text: "Effort saved $12.4"
|
|
1212
|
+
// no saving measured: icon "π¬β3" | text "effortβ3" | verbose "effort raised Γ3"
|
|
1213
|
+
const raisedInfo = data.effortRaises;
|
|
1214
|
+
const raised = Number(raisedInfo && raisedInfo.count) || 0;
|
|
1215
|
+
const keptUsd = Number(raisedInfo && raisedInfo.kept) || 0;
|
|
1216
|
+
const keptRuns = Number(raisedInfo && raisedInfo.keptRuns) || 0;
|
|
1217
|
+
const hasKept = raised > 0 && keptRuns > 0 && keptUsd !== 0;
|
|
1218
|
+
const keptTone = keptUsd < 0 ? RED : GREEN;
|
|
1219
|
+
const raisedSince = formatSince(raisedInfo && raisedInfo.since);
|
|
1220
|
+
const effortLabel = isIcon ? (verbose ? `${g.effort} Effort saved` : g.effort) : 'Effort saved';
|
|
1221
|
+
let raisedSeg = null;
|
|
1222
|
+
if (hasKept) {
|
|
1223
|
+
raisedSeg = `${c(keptTone)}${effortLabel}${c(RESET)} ${formatMoney(keptUsd)}${sinceInline(raisedSince)}`
|
|
1224
|
+
+ (verbose ? ` ${c(GRAY)}Β· ${raised} raised${c(RESET)}` : '');
|
|
1225
|
+
} else if (raised > 0) {
|
|
1226
|
+
raisedSeg = `${c(GRAY)}${verbose ? `effort raised Γ${raised}` : isIcon ? `${g.effort}β${raised}` : `effortβ${raised}`}${c(RESET)}`;
|
|
1227
|
+
}
|
|
1157
1228
|
|
|
1158
1229
|
// Routing-savings headline line (multi-line layout). The lifetime sum from
|
|
1159
1230
|
// the delegation ledger β the number the whole tool exists to grow, so it
|
|
@@ -1198,16 +1269,38 @@ function buildDelegatedSeg(data, singleLine, c, isIcon, verbose, g) {
|
|
|
1198
1269
|
(pairText ? ` ${c(GRAY)}|${c(RESET)} ${pairText}` : '');
|
|
1199
1270
|
}
|
|
1200
1271
|
|
|
1272
|
+
// The Effort saved line (multi-line layout), under the savings lines and in
|
|
1273
|
+
// their anatomy: the figure, the same reset mark as Routing saved, then the
|
|
1274
|
+
// breakdown, where the raise count sits as `mediumβhigh ΓN $X` (Claude
|
|
1275
|
+
// Code's default effort to the one the guard set). Raises that no rule
|
|
1276
|
+
// routed have no saving to show and are counted as `no rule ΓN (n/a)`, as
|
|
1277
|
+
// Doc2md counts a format with no baseline. Built only beside a Routing saved
|
|
1278
|
+
// line and only with a measured saving; a bare count stays a chip.
|
|
1279
|
+
// icon: "π¬ Effort saved $12.4 since 11/1 | mediumβhigh Γ2 $12.4 Β· no rule Γ1 (n/a)"
|
|
1280
|
+
// text: "Effort saved $12.4 since 11/1 | mediumβhigh Γ2 $12.4 Β· no rule Γ1 (n/a)"
|
|
1281
|
+
let raisedLine = null;
|
|
1282
|
+
if (totalsLine && hasKept) {
|
|
1283
|
+
const head = isIcon ? `${g.effort} Effort saved` : 'Effort saved';
|
|
1284
|
+
const parts = [`${c(GRAY)}mediumβhigh Γ${keptRuns} ${formatMoney(keptUsd)}${c(RESET)}`];
|
|
1285
|
+
if (raised > keptRuns) parts.push(`${c(GRAY)}no rule Γ${raised - keptRuns} ${verbose ? '(no saving measured)' : '(n/a)'}${c(RESET)}`);
|
|
1286
|
+
raisedLine =
|
|
1287
|
+
`${c(keptTone)}${c(BOLD)}${head}${c(RESET)} ` +
|
|
1288
|
+
`${c(keptTone)}${formatMoney(keptUsd)}${c(RESET)}` +
|
|
1289
|
+
sinceWord(raisedSince) +
|
|
1290
|
+
` ${c(GRAY)}|${c(RESET)} ${parts.join(` ${c(GRAY)}Β·${c(RESET)} `)}`;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1201
1293
|
return {
|
|
1202
1294
|
// Dropped when the same story already owns a headline line above, which
|
|
1203
1295
|
// would otherwise repeat it on line 2. The unresolved-runs chip survives the
|
|
1204
1296
|
// headline when that headline is a dated zero, since a zero is exactly when
|
|
1205
|
-
// the dropped runs matter.
|
|
1206
|
-
//
|
|
1297
|
+
// the dropped runs matter. The raise chip steps aside for its own line the
|
|
1298
|
+
// same way, and stays on line 2 while there is no line to carry it.
|
|
1207
1299
|
chips: totalsLine
|
|
1208
|
-
? (totalsNum === 0 ? [unresolvedSeg, raisedSeg] : [raisedSeg])
|
|
1300
|
+
? (totalsNum === 0 ? [unresolvedSeg, raisedLine ? null : raisedSeg] : [raisedLine ? null : raisedSeg])
|
|
1209
1301
|
: [delegateSeg, raisedSeg, delegateExtra],
|
|
1210
1302
|
headline: totalsLine ? { usd: Number(totals && totals.total) || 0, line: totalsLine } : null,
|
|
1303
|
+
raisedHeadline: raisedLine ? { usd: keptUsd, line: raisedLine } : null,
|
|
1211
1304
|
};
|
|
1212
1305
|
}
|
|
1213
1306
|
|
|
@@ -1481,7 +1574,7 @@ function arrangeSegments(order, s) {
|
|
|
1481
1574
|
/**
|
|
1482
1575
|
* The headline lines that sit above the chips, as one string of `line\n` pairs.
|
|
1483
1576
|
*/
|
|
1484
|
-
function buildHeadlines(delegated, doc2md, want, eol, columns = 0, c = (v) => v) {
|
|
1577
|
+
function buildHeadlines(delegated, doc2md, want, eol, columns = 0, c = (v) => v, teamLine = null) {
|
|
1485
1578
|
// Each savings source that earned real money gets a headline line, ordered
|
|
1486
1579
|
// biggest saver first β the top line is the one the eye lands on, so it
|
|
1487
1580
|
// goes to whichever habit is actually paying for the tool. The diagnostics
|
|
@@ -1490,6 +1583,11 @@ function buildHeadlines(delegated, doc2md, want, eol, columns = 0, c = (v) => v)
|
|
|
1490
1583
|
if (delegated.headline && want('delegated')) headlines.push(delegated.headline);
|
|
1491
1584
|
if (doc2md.headline && want('doc2md')) headlines.push(doc2md.headline);
|
|
1492
1585
|
headlines.sort((a, b) => b.usd - a.usd);
|
|
1586
|
+
// The effort-raise line closes the savings lines rather than competing with
|
|
1587
|
+
// them: its figure is a part of Routing saved, not a saver of its own.
|
|
1588
|
+
if (delegated.raisedHeadline && want('delegated')) headlines.push(delegated.raisedHeadline);
|
|
1589
|
+
// The team line comes last: identity and standing, after the money.
|
|
1590
|
+
if (teamLine && want('team')) headlines.push(teamLine);
|
|
1493
1591
|
const rows = columns
|
|
1494
1592
|
? headlines.flatMap((h) => wrapHeadline(h.line, availWidth(columns), c))
|
|
1495
1593
|
: headlines.map((h) => h.line);
|
|
@@ -1549,6 +1647,9 @@ export function formatReport(data, { color = true, verbose = false, timer = true
|
|
|
1549
1647
|
|
|
1550
1648
|
// One slot per chip; segmentsNamed() maps the names in the segment list onto
|
|
1551
1649
|
// these slots, so this is the only place that knows how each chip is built.
|
|
1650
|
+
// The team gets a line of its own in the multi-line layout (buildTeamLine),
|
|
1651
|
+
// and its chip steps aside; the single-line layout keeps the chip.
|
|
1652
|
+
const teamLine = singleLine ? null : buildTeamLine(data.team, c, isIcon, g, mode);
|
|
1552
1653
|
const built = {
|
|
1553
1654
|
capWarn: buildCapWarnSeg(capWarn, c, isIcon, g, color, mode),
|
|
1554
1655
|
spike: buildSpikeSeg(spikeChip, c),
|
|
@@ -1585,7 +1686,8 @@ export function formatReport(data, { color = true, verbose = false, timer = true
|
|
|
1585
1686
|
// check β this render path never touches the network.
|
|
1586
1687
|
version: buildVersionSeg(options.version, data.update, c, isIcon, verbose, g),
|
|
1587
1688
|
// Member id and office animal, from team.json; null unless this machine joined a team.
|
|
1588
|
-
team
|
|
1689
|
+
// Null when the team line carries it (multi-line layout), so no empty slot is drawn.
|
|
1690
|
+
team: teamLine ? null : buildTeamSeg(data.team, c, mode),
|
|
1589
1691
|
// Delegation-rule registry (`rules 10 Β· β 1`), opt-in through `--segments`.
|
|
1590
1692
|
rules: buildRulesSeg(data.ruleStats, c, g),
|
|
1591
1693
|
};
|
|
@@ -1598,8 +1700,8 @@ export function formatReport(data, { color = true, verbose = false, timer = true
|
|
|
1598
1700
|
// "erase from cursor to EOL" CSI. Only emitted when color (i.e. ANSI) is
|
|
1599
1701
|
// allowed β --no-color/NO_COLOR consumers expect escape-free output.
|
|
1600
1702
|
const eol = color ? '\x1b[K' : '';
|
|
1601
|
-
if (singleLine || !columns) return buildHeadlines(delegated, doc2md, want, eol) + segs.join(' Β· ') + eol;
|
|
1602
|
-
const headlines = buildHeadlines(delegated, doc2md, want, eol, columns, c);
|
|
1703
|
+
if (singleLine || !columns) return buildHeadlines(delegated, doc2md, want, eol, 0, c, teamLine) + segs.join(' Β· ') + eol;
|
|
1704
|
+
const headlines = buildHeadlines(delegated, doc2md, want, eol, columns, c, teamLine);
|
|
1603
1705
|
|
|
1604
1706
|
// The chips that stop the work: layoutChips drops from the tail when the
|
|
1605
1707
|
// terminal is narrow, and these must survive that.
|
package/src/glyphs.js
CHANGED
|
@@ -56,6 +56,8 @@ const ICON = {
|
|
|
56
56
|
hit: 'π§ ',
|
|
57
57
|
ttl: 'β³',
|
|
58
58
|
month: 'π΅',
|
|
59
|
+
// Team: the people this machine is ranked among. U+1F465, East Asian Width W.
|
|
60
|
+
team: 'π₯',
|
|
59
61
|
ctx: 'π¦',
|
|
60
62
|
saved: 'π°',
|
|
61
63
|
used: 'π',
|
|
@@ -87,6 +89,7 @@ const NARROW = {
|
|
|
87
89
|
hit: 'β', // bullseye: a cache hit
|
|
88
90
|
ttl: 'β', // a partly elapsed dial
|
|
89
91
|
month: 'β', // a running total
|
|
92
|
+
team: '', // no glyph verified in the font yet; the team line's own words lead it
|
|
90
93
|
ctx: 'β§', // a box filling up
|
|
91
94
|
saved: 'β',
|
|
92
95
|
used: 'β©', // a split square: what the spend is made of
|
package/src/installer.js
CHANGED
|
@@ -1097,10 +1097,11 @@ export function removeDoc2mdHook() {
|
|
|
1097
1097
|
// timeout is safe and catches a hung read fast. The size lives in that one
|
|
1098
1098
|
// constant; quoting a number here is only ever a stale copy of it.
|
|
1099
1099
|
//
|
|
1100
|
-
// Installed by `
|
|
1101
|
-
//
|
|
1102
|
-
//
|
|
1103
|
-
//
|
|
1100
|
+
// Installed by `sprag install` (on by default since v3.104.0) and by
|
|
1101
|
+
// `delegate on`, removed by `delegate off`. Idempotent. Kept out of
|
|
1102
|
+
// `installAll()` because install.js has to read the user's choice first: an
|
|
1103
|
+
// explicit `delegate off` must survive an upgrade, and the install prints what
|
|
1104
|
+
// the hook appends before the first delegation it rewrites.
|
|
1104
1105
|
const DELEGATION_GUARD_HOOK_COMMAND = `${CLI} delegate --hook`;
|
|
1105
1106
|
// Install, remove and the status readout all judge a command through
|
|
1106
1107
|
// isDelegationGuardHookCommand() below, which compares whole tokens.
|
|
@@ -1327,17 +1328,17 @@ export function uninstallAll({ purge = false } = {}) {
|
|
|
1327
1328
|
// The state directory stays so a reinstall keeps ledgers and preferences,
|
|
1328
1329
|
// with one exception carved out just below.
|
|
1329
1330
|
result.kept.push('state directory (savings ledgers, config, cache) β remove with --purge');
|
|
1330
|
-
// delegate.enabled is not a preference, it is an
|
|
1331
|
-
// registered
|
|
1332
|
-
//
|
|
1333
|
-
//
|
|
1334
|
-
//
|
|
1335
|
-
//
|
|
1336
|
-
// uninstall. Config it does not own is left untouched.
|
|
1331
|
+
// An explicit `delegate.enabled: true` is not a preference, it is an
|
|
1332
|
+
// assertion that a hook is registered, and the hooks were just removed
|
|
1333
|
+
// above. Dropping the key returns the guard to its default, so a later
|
|
1334
|
+
// reinstall registers it again the way a fresh install would. An explicit
|
|
1335
|
+
// `false` is the user's choice and is kept. Config it does not own is left
|
|
1336
|
+
// untouched.
|
|
1337
1337
|
try {
|
|
1338
1338
|
const cfg = loadConfig();
|
|
1339
|
-
if (cfg?.delegate?.enabled) {
|
|
1340
|
-
|
|
1339
|
+
if (cfg?.delegate?.enabled === true) {
|
|
1340
|
+
const { enabled: _dropped, ...rest } = cfg.delegate;
|
|
1341
|
+
cfg.delegate = rest;
|
|
1341
1342
|
saveConfig(cfg);
|
|
1342
1343
|
result.removed.push('delegate flag');
|
|
1343
1344
|
}
|
package/src/office-species.js
CHANGED
|
@@ -42,6 +42,35 @@ export const SPECIES = {
|
|
|
42
42
|
ghost: { emoji: 'π»', en: 'Ghost', ko: 'μ λ Ή' },
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* The species ladder, best first: the overall-score percentile a species starts
|
|
47
|
+
* at (`minSr`), its tier, and whether it also needs the delegation share at or
|
|
48
|
+
* above the company median (`needDlg`). `gt` marks a strict floor. Copied from
|
|
49
|
+
* GRADES in site/assets/scene/office-scene.js, and test/office-species.test.js
|
|
50
|
+
* pins the two, so `sprag team status` and the office page show one ladder.
|
|
51
|
+
* The chick is the idle row (no spend in the period) and has no floor.
|
|
52
|
+
*/
|
|
53
|
+
const row = (key, minSr, tier, needDlg = false, gt = false) => ({ key, minSr, tier, needDlg, gt });
|
|
54
|
+
export const GRADES = [
|
|
55
|
+
row('dragon', 0.98, 'power', true), row('unicorn', 0.95, 'power', true), row('lion', 0.92, 'power', true),
|
|
56
|
+
row('tiger', 0.89, 'power', true), row('eagle', 0.85, 'power', true), row('wolf', 0.8, 'power', true),
|
|
57
|
+
row('cheetah', 0.77, 'active'), row('fox', 0.74, 'active'), row('owl', 0.71, 'active'), row('husky', 0.68, 'active'),
|
|
58
|
+
row('panda', 0.65, 'active'), row('koala', 0.62, 'active'), row('penguin', 0.58, 'active'), row('raccoon', 0.54, 'active'),
|
|
59
|
+
row('cat', 0.5, 'active'),
|
|
60
|
+
row('dog', 0.47, 'normal'), row('bear', 0.44, 'normal'), row('monkey', 0.41, 'normal'), row('deer', 0.38, 'normal'),
|
|
61
|
+
row('elephant', 0.35, 'normal'), row('pig', 0.32, 'normal'), row('sheep', 0.29, 'normal'), row('rabbit', 0.25, 'normal', false, true),
|
|
62
|
+
row('duck', 0.22, 'low'), row('hedgehog', 0.19, 'low'), row('squirrel', 0.16, 'low'), row('hamster', 0.12, 'low'),
|
|
63
|
+
row('frog', 0.08, 'low'), row('mouse', 0.04, 'low'), row('chick', -1, 'low'),
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
/** Tier names as the office page shows them (`of.tier.<tier>` in site/team/index.html). */
|
|
67
|
+
export const TIER_NAMES = {
|
|
68
|
+
power: { en: 'AI power user', ko: 'AI νμ μ μ ' },
|
|
69
|
+
active: { en: 'Active', ko: 'νλ°' },
|
|
70
|
+
normal: { en: 'Normal', ko: '보ν΅' },
|
|
71
|
+
low: { en: 'Getting started', ko: 'νμ© μ₯λ € νμ' },
|
|
72
|
+
};
|
|
73
|
+
|
|
45
74
|
/**
|
|
46
75
|
* `"<emoji> <name>"` for a grade key in the given language, or null for an unknown key.
|
|
47
76
|
* `emoji: false` leaves just the name, for terminals whose font has no animal emoji (IntelliJ).
|
package/src/route-scan.js
CHANGED
|
@@ -725,11 +725,14 @@ export async function runRouteScan({ days = 14, trace = null } = {}) {
|
|
|
725
725
|
let unresolvedRuns = 0; // delegated runs dropped for an unpriceable model id
|
|
726
726
|
const unresolvedModels = new Set();
|
|
727
727
|
// Sonnet delegations the guard ran at high effort because the call passed
|
|
728
|
-
// none (src/delegation-guard.js).
|
|
729
|
-
// run: the raise is sprag's own action, so its
|
|
730
|
-
// saving is claimed.
|
|
731
|
-
//
|
|
732
|
-
|
|
728
|
+
// none (src/delegation-guard.js). Collected whether or not a rule covers the
|
|
729
|
+
// run: the raise is sprag's own action, so its cost is shown even where no
|
|
730
|
+
// saving is claimed. Each run becomes an event in the effort-raise ledger
|
|
731
|
+
// (src/effort-raise-ledger.js), which is read live with the routing reset
|
|
732
|
+
// mark, like the savings ledger. The cost is what the run cost on its own
|
|
733
|
+
// model, priced the way the ledger prices `cost`; the savings already
|
|
734
|
+
// include it.
|
|
735
|
+
const raiseEvents = [];
|
|
733
736
|
// `sprag saved reset routing` zeroes the money, not the rule-health sample:
|
|
734
737
|
// see tallyDelegatedRun. readResetMarks never throws (no file = no reset).
|
|
735
738
|
const routingMark = readResetMarks(userDataDir()).routing;
|
|
@@ -773,15 +776,17 @@ export async function runRouteScan({ days = 14, trace = null } = {}) {
|
|
|
773
776
|
for (const [sessionPath, index] of runIndexBySession) {
|
|
774
777
|
// Every run of the session, not only those joined to a categorized episode
|
|
775
778
|
// and past the tier gate: a sonnet run under a sonnet main session saves
|
|
776
|
-
// nothing, yet the guard raised it all the same. The reset mark
|
|
777
|
-
//
|
|
779
|
+
// nothing, yet the guard raised it all the same. The reset mark is not
|
|
780
|
+
// applied here: the ledger is evidence, and the mark applies when it is read
|
|
781
|
+
// (as savings-ledger does), so a reset zeroes the count without a rescan.
|
|
778
782
|
for (const run of index.all) {
|
|
779
|
-
if (!run.effortRaised
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
783
|
+
if (!run.effortRaised) continue;
|
|
784
|
+
raiseEvents.push({
|
|
785
|
+
key: run.path,
|
|
786
|
+
ts: run.endedAt ?? run.startedAt ?? null,
|
|
787
|
+
cost: isRecognizedModelId(run.model) ? exactCost(runTotals(run), run.model, { at: runTime(run) }) : null,
|
|
788
|
+
model: run.model,
|
|
789
|
+
});
|
|
785
790
|
}
|
|
786
791
|
const used = new Set();
|
|
787
792
|
const eps = all.filter((x) => x.sessionPath === sessionPath);
|
|
@@ -927,8 +932,6 @@ export async function runRouteScan({ days = 14, trace = null } = {}) {
|
|
|
927
932
|
resolved: [...resolved],
|
|
928
933
|
unresolvedRuns,
|
|
929
934
|
unresolvedModels: [...unresolvedModels].slice(0, 5),
|
|
930
|
-
// `since` is the earliest counted run (ms), so a reader can date the count.
|
|
931
|
-
effortRaises: { ...effortRaises, cost: Math.round(effortRaises.cost * 100) / 100 },
|
|
932
935
|
};
|
|
933
936
|
try {
|
|
934
937
|
const dir = stateDir();
|
|
@@ -1027,6 +1030,13 @@ export async function runRouteScan({ days = 14, trace = null } = {}) {
|
|
|
1027
1030
|
} catch {
|
|
1028
1031
|
// ledger write failure only delays the statusline totals, never the scan
|
|
1029
1032
|
}
|
|
1033
|
+
// Its own try so a failure here never blocks the savings ledger above.
|
|
1034
|
+
try {
|
|
1035
|
+
const { recordEffortRaises } = await import('./effort-raise-ledger.js');
|
|
1036
|
+
recordEffortRaises(raiseEvents);
|
|
1037
|
+
} catch {
|
|
1038
|
+
// the effort-raise chip just stays stale until the next scan
|
|
1039
|
+
}
|
|
1030
1040
|
|
|
1031
1041
|
return cache;
|
|
1032
1042
|
}
|