sprag-cli 3.112.0 → 3.114.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprag-cli",
3
- "version": "3.112.0",
3
+ "version": "3.114.0",
4
4
  "description": "The delegation layer for Claude Code and Codex: each task goes to the model and effort that fits it, down to cheaper models for lookups and up to higher effort when a cheaper run would miss, backed by public replay cases, with a live statusline and team rules for Pro and Enterprise.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cost.js CHANGED
@@ -2,7 +2,8 @@
2
2
  * Cost impact estimation based on Anthropic pricing.
3
3
  * Source: https://platform.claude.com/docs/en/about-claude/pricing
4
4
  * Prices per million tokens (USD). Updated 2026-10 for Fable 5.1, Opus 5.5,
5
- * Sonnet 5 / 5.5 and Haiku 5.5 (checked against the pricing page 2026-10-09).
5
+ * Sonnet 5 / 5.5 and Haiku 5.5 (checked against the pricing page 2026-10-09),
6
+ * and 2026-11 for Fable 5.2 (from the Claude Code release notes).
6
7
  *
7
8
  * Note: Opus 4.5/4.6/4.7 use reduced pricing ($5/$25) vs. older Opus 4/4.1 ($15/$75).
8
9
  * Cache writes are now tracked separately for 5m and 1h TTLs, each with their own rate.
@@ -21,6 +22,17 @@ export const LONG_PROMPT_THRESHOLD = 100_000;
21
22
  // or a correction is a new row, never an edit of an old one, so a run is
22
23
  // always priced at the rate that applied when it happened (#15).
23
24
  const PRICE_HISTORY = {
25
+ // Fable 5.2 — $8/$40 with $0.20 cache reads (Claude Code 2.1.321 release
26
+ // notes, 2026-11-09). The notes give no cache write rates, so the 5m/1h
27
+ // rows assume the standard multipliers (1.25x and 2x input).
28
+ 'claude-fable-5-2': [{
29
+ from: null,
30
+ input: 8.0,
31
+ cacheWrite5m: 10.0,
32
+ cacheWrite1h: 16.0,
33
+ cacheRead: 0.2,
34
+ output: 40.0,
35
+ }],
24
36
  // Fable 5.1 / Mythos 5.1 — same prices as Fable 5 except cache reads, which
25
37
  // drop to $0.25.
26
38
  'claude-fable-5-1': [{
@@ -217,6 +229,7 @@ const ALIAS_HISTORY = {
217
229
  fable: [
218
230
  { from: '2026-06-09', model: 'claude-fable-5' },
219
231
  { from: '2026-09-01', model: 'claude-fable-5-1' },
232
+ { from: '2026-11-09', model: 'claude-fable-5-2' },
220
233
  ],
221
234
  };
222
235
 
@@ -255,6 +268,7 @@ export function detectPricingTier(model, { at } = {}) {
255
268
  // under-estimated costs ~3x ($3/$15 vs the real $10/$50).
256
269
  if (m.includes('fable') || m.includes('mythos')) {
257
270
  // `(?!\d)` keeps a date suffix (`fable-5-20261001`) from reading as 5.1.
271
+ if (/(fable|mythos)[-_.]?5[-_.]2(?!\d)/.test(m)) return 'claude-fable-5-2';
258
272
  if (/(fable|mythos)[-_.]?5[-_.]1(?!\d)/.test(m)) return 'claude-fable-5-1';
259
273
  return 'claude-fable-5';
260
274
  }
@@ -302,6 +316,7 @@ export function detectPricingTier(model, { at } = {}) {
302
316
  const TIER_RANK = {
303
317
  'claude-fable-5': 3,
304
318
  'claude-fable-5-1': 3,
319
+ 'claude-fable-5-2': 3,
305
320
  'claude-opus-5-5': 2,
306
321
  'claude-opus-legacy': 2,
307
322
  'claude-opus-new': 2,
@@ -30,8 +30,8 @@ import { bedrockDisplayFromId } from '../stdin-payload.js';
30
30
  import { modelFamily } from '../savings-ledger.js';
31
31
  import { shareLegend } from '../model-share.js';
32
32
  import { STAR_URL } from '../star-note.js';
33
- import { speciesLabel } from '../office-species.js';
34
- import { standingFeedbackShort } from '../team-standing.js';
33
+ import { GRADES, speciesLabel } from '../office-species.js';
34
+ import { scorePctOf, nextOf, nextGradeUp, floorPct } from '../team-standing.js';
35
35
  import { cellWidth } from '../cell-width.js';
36
36
 
37
37
  // The 8-color ANSI defaults (RED=31, GREEN=32, YELLOW=33…) read as garish
@@ -434,15 +434,19 @@ function buildTeamSeg(team, c, mode = 'icon', now = Date.now()) {
434
434
  /**
435
435
  * The team line (multi-line layout): the licensed team this machine belongs
436
436
  * to, on a line of its own so it never blends into the diagnostics chips, and
437
- * what the standing asks of you. Head: plan, organization, team, member id.
438
- * Breakdown: the rank with the animal, then the short feedback from
439
- * src/team-standing.js (people to pass for #1, the next species and what it
440
- * takes). Null for a machine that has not joined; the chip above stands in on
441
- * the single-line layouts.
442
- * icon: "👥 Pro · amazon · AWS-FSI · member-1e500474 | 종합 점수 12명 중 3위, 팀 4명 중 1위 🦊 여우 · 1위까지 2명 · 다음 🐆 치타: 2명 더 (77%부터)"
443
- * 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)"
437
+ * where the standing comes from. Head: plan, organization, team, member id.
438
+ * Tail, two groups apart by a gray pipe: the species with a gauge of the score
439
+ * percentile and the species one row up, then the ranks the score is made of
440
+ * (overall, team, spend, delegation, and prompts where capture is on). The only
441
+ * percentages on the line are score percentiles (the gauge and the next
442
+ * species' starting percentile); the two axes are ranks. Null for a machine
443
+ * that has not joined; the chip above stands in on the single-line layouts.
444
+ * icon: "👥 Pro · amazon · AWS-FSI · member-1e500474 | 🦊 여우 ▰▰▰▰▰▰▰▰▰▱▱▱ 75% → 🐆 치타 77% | 종합 3/12위 · 팀 1/4위 · 사용량 2/12위 · 위임률 5/12위"
445
+ * text: "Pro · amazon · AWS-FSI · member-1e500474 | Fox 75% → Cheetah 77% | overall #3/12 · team #1/4 · spend #2/12 · delegation #5/12"
446
+ * Text mode draws no gauge, as the other gauges do not. An older server sends no
447
+ * axis ranks, and the second group then holds the overall rank (and the team's).
444
448
  */
445
- function buildTeamLine(team, c, isIcon, g, mode = 'icon', now = Date.now()) {
449
+ function buildTeamLine(team, c, isIcon, g, mode = 'icon', now = Date.now(), color = true) {
446
450
  if (!team || typeof team !== 'object' || !team.label) return null;
447
451
  const ko = team.lang === 'ko';
448
452
  const emoji = mode === 'icon';
@@ -453,22 +457,58 @@ function buildTeamLine(team, c, isIcon, g, mode = 'icon', now = Date.now()) {
453
457
  const head = `${isIcon && g.team ? `${g.team} ` : ''}${[plan, org, teamName, team.label].filter(Boolean).join(' · ')}`;
454
458
  const st = team.standing;
455
459
  const fresh = st && Number.isFinite(st.fetchedAt) && now - st.fetchedAt <= TEAM_STANDING_MAX_AGE_MS;
456
- const parts = [];
457
- if (fresh) {
458
- const animal = speciesLabel(st.grade, team.lang, { emoji });
459
- const ranked = animal && Number.isInteger(st.rank) && Number.isInteger(st.ranked) && st.rank >= 1 && st.ranked >= st.rank;
460
- if (ranked) {
461
- const inTeam = Number.isInteger(st.teamRank) && Number.isInteger(st.teamRanked)
462
- && st.teamRank >= 1 && st.teamRanked >= st.teamRank && st.teamRanked < st.ranked;
463
- const teamPlace = inTeam ? (ko ? `, 팀 ${st.teamRanked}명 중 ${st.teamRank}위` : `, team #${st.teamRank} of ${st.teamRanked}`) : '';
464
- parts.push(ko ? `종합 점수 ${st.ranked}명 중 ${st.rank}위${teamPlace} ${animal}` : `overall score #${st.rank} of ${st.ranked}${teamPlace} ${animal}`);
465
- } else if (animal) {
466
- parts.push(animal);
460
+ // Groups of items: ' · ' inside a group, ' | ' between groups.
461
+ const groups = [];
462
+ const animal = fresh ? speciesLabel(st.grade, team.lang, { emoji }) : null;
463
+ if (animal) {
464
+ const ranked = Number.isInteger(st.rank) && Number.isInteger(st.ranked) && st.rank >= 1 && st.ranked >= st.rank;
465
+ if (st.grade === 'ghost' || !ranked) {
466
+ groups.push([animal, ko ? '이 기간 업로드 없음' : 'no usage this period']);
467
+ } else if (st.idle === true || st.grade === 'chick') {
468
+ groups.push([animal], [ko ? '지출이 생기면 순위에 오름' : 'spend to enter the standings']);
469
+ } else {
470
+ const sr = scorePctOf(st);
471
+ const pctNow = Math.round(sr * 100);
472
+ // Text mode has no gauge glyph (like every other gauge on the line).
473
+ const bar = isIcon ? `${gaugeColored(sr * 100, c, GRAY, color, mode)} ` : '';
474
+ if (st.ranked === 1) {
475
+ groups.push(
476
+ [`${animal} ${bar}${pctNow}% ${ko ? '혼자라 고정' : 'fixed while alone'}`],
477
+ [ko ? '동료가 참여하면 사용량과 위임률 순위로 등급이 갈림' : 'once a colleague joins, the spend and delegation ranks decide the species'],
478
+ );
479
+ } else {
480
+ const next = nextOf(st, sr);
481
+ const nextRow = next ? GRADES.find((r) => r.key === next.grade) : null;
482
+ const up = nextRow || nextGradeUp(st.grade);
483
+ const first = [];
484
+ let tail = '';
485
+ if (up) {
486
+ const label = speciesLabel(up.key, team.lang, { emoji }) || up.key;
487
+ const floor = up.minSr >= 0 ? ` ${floorPct(up)}%` : '';
488
+ const needDlg = nextRow ? next.needDlg : up.needDlg;
489
+ const rule = needDlg ? (ko ? ' (위임률 중앙값 이상 필요)' : ' (needs median delegation or more)') : '';
490
+ tail = ` → ${label}${floor}${rule}`;
491
+ }
492
+ first.push(`${animal} ${bar}${pctNow}%${tail}`);
493
+ if (!up) first.push(ko ? '도감 최상위' : 'top of the field guide');
494
+ groups.push(first);
495
+
496
+ const inTeam = Number.isInteger(st.teamRank) && Number.isInteger(st.teamRanked)
497
+ && st.teamRank >= 1 && st.teamRanked >= st.teamRank && st.teamRanked < st.ranked;
498
+ const has = (v) => Number.isFinite(v);
499
+ const rk = (koName, enName, r, n) => (ko ? `${koName} ${r}/${n}위` : `${enName} #${r}/${n}`);
500
+ const ranks = [`${st.crown && emoji ? '👑 ' : ''}${rk('종합', 'overall', st.rank, st.ranked)}`];
501
+ if (inTeam) ranks.push(rk('팀', 'team', st.teamRank, st.teamRanked));
502
+ if (has(st.spendRank)) ranks.push(rk('사용량', 'spend', st.spendRank, st.ranked));
503
+ if (has(st.dlgRank)) ranks.push(rk('위임률', 'delegation', st.dlgRank, st.ranked));
504
+ if (has(st.promptRank)) ranks.push(rk('프롬프트', 'prompts', st.promptRank, st.ranked));
505
+ groups.push(ranks);
506
+ }
467
507
  }
468
- parts.push(...standingFeedbackShort(st, team.lang, { emoji }));
469
508
  }
470
- const tail = parts.length
471
- ? ` ${c(GRAY)}|${c(RESET)} ${parts.map((p) => `${c(GRAY)}${p}${c(RESET)}`).join(` ${c(GRAY)}·${c(RESET)} `)}`
509
+ const dot = ` ${c(GRAY)}·${c(RESET)} `;
510
+ const tail = groups.length
511
+ ? ` ${c(GRAY)}|${c(RESET)} ${groups.map((items) => items.map((p) => `${c(GRAY)}${p}${c(RESET)}`).join(dot)).join(` ${c(GRAY)}|${c(RESET)} `)}`
472
512
  : '';
473
513
  return { usd: 0, line: `${c(GRAY)}${c(BOLD)}${head}${c(RESET)}${tail}` };
474
514
  }
@@ -1748,7 +1788,7 @@ export function formatReport(data, { color = true, verbose = false, timer = true
1748
1788
  // these slots, so this is the only place that knows how each chip is built.
1749
1789
  // The team gets a line of its own in the multi-line layout (buildTeamLine),
1750
1790
  // and its chip steps aside; the single-line layout keeps the chip.
1751
- const teamLine = singleLine ? null : buildTeamLine(data.team, c, isIcon, g, mode);
1791
+ const teamLine = singleLine ? null : buildTeamLine(data.team, c, isIcon, g, mode, Date.now(), color);
1752
1792
  const built = {
1753
1793
  capWarn: buildCapWarnSeg(capWarn, c, isIcon, g, color, mode),
1754
1794
  spike: buildSpikeSeg(spikeChip, c),
@@ -63,6 +63,17 @@ export const GRADES = [
63
63
  row('frog', 0.08, 'low'), row('mouse', 0.04, 'low'), row('chick', -1, 'low'),
64
64
  ];
65
65
 
66
+ /**
67
+ * Below `n` ranked people the score percentile is squeezed into [lo, hi], so two
68
+ * people never land on the chick by percentile alone. Copied from SMALL_TEAM and
69
+ * squeezeSr in site/assets/scene/office-scene.js; test/office-species.test.js
70
+ * pins the two.
71
+ */
72
+ export const SMALL_TEAM = { n: 5, lo: 0.3, hi: 0.7 };
73
+ export function squeezeSr(sr, n) {
74
+ return n < SMALL_TEAM.n ? SMALL_TEAM.lo + (SMALL_TEAM.hi - SMALL_TEAM.lo) * sr : sr;
75
+ }
76
+
66
77
  /** Tier names as the office page shows them (`of.tier.<tier>` in site/team/index.html). */
67
78
  export const TIER_NAMES = {
68
79
  power: { en: 'AI power user', ko: 'AI 파워 유저' },
@@ -24,13 +24,13 @@
24
24
  * Pure: no I/O, so the tests pin every wording.
25
25
  */
26
26
 
27
- import { GRADES, TIER_NAMES, speciesLabel } from './office-species.js';
27
+ import { GRADES, SMALL_TEAM, squeezeSr, TIER_NAMES, speciesLabel } from './office-species.js';
28
28
 
29
29
  const pct = (v) => `${Math.round(Number(v) * 100)}%`;
30
30
  /** A weight as a percentage with one decimal where it has one: 0.625 → 62.5%, 0.5 → 50%. */
31
31
  const pctW = (v) => `${Math.round(Number(v) * 1000) / 10}%`;
32
32
  const money = (v) => `$${Number(v).toFixed(2)}`;
33
- const floorPct = (g) => Math.round(g.minSr * 100);
33
+ export const floorPct = (g) => Math.round(g.minSr * 100);
34
34
  /**
35
35
  * Percentage points from the score percentile `sr` up to the floor of species
36
36
  * `g`, at least 1 while the floor is not cleared, 0 when it already is (then
@@ -48,6 +48,9 @@ export function nextGradeUp(key) {
48
48
  return i > 0 ? GRADES[i - 1] : null;
49
49
  }
50
50
 
51
+ // 2 to 4 ranked people: the office squeezes the percentile into [lo, hi] (SMALL_TEAM).
52
+ const isSmall = (st) => st.ranked >= 2 && st.ranked < SMALL_TEAM.n;
53
+
51
54
  const isRanked = (st) => Number.isInteger(st.rank) && Number.isInteger(st.ranked) && st.rank >= 1 && st.ranked >= st.rank;
52
55
 
53
56
  /**
@@ -56,13 +59,16 @@ const isRanked = (st) => Number.isInteger(st.rank) && Number.isInteger(st.ranked
56
59
  * Otherwise the server's `scorePct` when it sent one, else read off the rank:
57
60
  * the office ranks a score as (people below + ties / 2) / (people − 1), so
58
61
  * without ties rank r of n is (n − r) / (n − 1). Ties (two identical scores)
59
- * would put the true value a little lower. Null when there is no rank.
62
+ * would put the true value a little lower. With 2 to 4 ranked people the rank
63
+ * reading is squeezed the way the office does (squeezeSr); the server's
64
+ * `scorePct` is used as it is, since the server sends the squeezed value.
65
+ * Null when there is no rank.
60
66
  */
61
67
  export function scorePctOf(st) {
62
68
  if (!st || typeof st !== 'object' || !isRanked(st)) return null;
63
69
  if (st.ranked < 2) return 0.5;
64
70
  if (Number.isFinite(st.scorePct)) return st.scorePct;
65
- return (st.ranked - st.rank) / (st.ranked - 1);
71
+ return squeezeSr((st.ranked - st.rank) / (st.ranked - 1), st.ranked);
66
72
  }
67
73
 
68
74
  /**
@@ -71,6 +77,8 @@ export function scorePctOf(st) {
71
77
  * the percentile: people to pass = ceil((floor − percentile) × (people − 1)).
72
78
  * Whether the delegation-share rule still stands in the way is known only with
73
79
  * the share and the median; without them a species with the rule keeps it.
80
+ * With 2 to 4 ranked people the pass count uses the squeezed span, and the
81
+ * result is null when the next species starts above SMALL_TEAM.hi.
74
82
  * Null when idle, alone, on the top row, or without a percentile.
75
83
  */
76
84
  export function nextOf(st, sr = scorePctOf(st)) {
@@ -80,8 +88,11 @@ export function nextOf(st, sr = scorePctOf(st)) {
80
88
  if (st.idle === true || st.grade === 'chick' || !Number.isFinite(sr) || !isRanked(st) || st.ranked < 2) return null;
81
89
  const up = nextGradeUp(st.grade);
82
90
  if (!up || !(up.minSr >= 0)) return null;
91
+ // Few people ranked: the percentile only reaches SMALL_TEAM.hi, so a higher species is closed.
92
+ if (isSmall(st) && up.minSr > SMALL_TEAM.hi) return null;
93
+ const span = isSmall(st) ? SMALL_TEAM.hi - SMALL_TEAM.lo : 1;
83
94
  const dlgOk = Number.isFinite(st.dlg) && Number.isFinite(st.medianDlg) && st.dlg >= st.medianDlg;
84
- return { grade: up.key, pass: Math.max(0, Math.ceil((up.minSr - sr) * (st.ranked - 1) - 1e-6)), needDlg: up.needDlg && !dlgOk };
95
+ return { grade: up.key, pass: Math.max(0, Math.ceil((up.minSr - sr) / span * (st.ranked - 1) - 1e-6)), needDlg: up.needDlg && !dlgOk };
85
96
  }
86
97
 
87
98
  /**
@@ -154,10 +165,16 @@ export function standingGuideLines(st, { lang = 'en', org = null, team = null }
154
165
  // The caller's own figures, when the server sent them.
155
166
  if (has(st.dlg) || has(st.spent) || has(st.scorePct)) {
156
167
  const parts = [];
157
- if (has(st.spent)) parts.push(ko ? `지출 ${money(st.spent)}` : `spent ${money(st.spent)}`);
168
+ // The rank on each axis (server migration 20261109000200), out of the ranked people.
169
+ const axis = (r) => (has(r) ? (ko ? `${r}/${st.ranked}위` : `#${r}/${st.ranked}`) : '');
170
+ if (has(st.spent)) {
171
+ const rk = axis(st.spendRank);
172
+ parts.push(ko ? `지출 ${money(st.spent)}${rk ? ` (${rk})` : ''}` : `spent ${money(st.spent)}${rk ? ` (${rk})` : ''}`);
173
+ }
158
174
  if (has(st.dlg)) {
159
- const med = has(st.medianDlg) ? (ko ? ` (회사 중앙값 ${pct(st.medianDlg)})` : ` (company median ${pct(st.medianDlg)})`) : '';
160
- parts.push(ko ? `위임 비율 ${pct(st.dlg)}${med}` : `delegation share ${pct(st.dlg)}${med}`);
175
+ const rk = axis(st.dlgRank);
176
+ const med = has(st.medianDlg) ? (ko ? `${rk ? ', ' : ' ('}회사 중앙값 ${pct(st.medianDlg)})` : `${rk ? ', ' : ' ('}company median ${pct(st.medianDlg)})`) : (rk ? ')' : '');
177
+ parts.push(ko ? `위임 비율 ${pct(st.dlg)}${rk ? ` (${rk}` : ''}${med}` : `delegation share ${pct(st.dlg)}${rk ? ` (${rk}` : ''}${med}`);
161
178
  }
162
179
  if (has(st.scorePct)) parts.push(ko ? `점수 백분위 ${pct(st.scorePct)}` : `score percentile ${pct(st.scorePct)}`);
163
180
  lines.push(` ${ko ? '이 컴퓨터' : 'This machine'}: ${parts.join(' · ')}`);
@@ -214,6 +231,12 @@ export function standingGuideLines(st, { lang = 'en', org = null, team = null }
214
231
  text = `${ko ? `${x}명을 더 앞지르면 ${s}` : `pass ${x} more to become ${s}`}${floorNote(g)}`;
215
232
  }
216
233
  lines.push(` ${ko ? '다음 등급' : 'Next species'}: ${text}`);
234
+ } else if (up && isSmall(st) && up.minSr > SMALL_TEAM.hi) {
235
+ // Few people ranked: the next species sits above the squeezed range. The
236
+ // same line when the server sent no `next` for this reason.
237
+ lines.push(ko
238
+ ? ` 다음 등급: 순위에 오른 사람이 ${SMALL_TEAM.n}명이 되면 더 높은 등급이 열립니다. 지금은 인원이 적어 등급이 보통과 활발 사이에서만 갈립니다.`
239
+ : ` Next species: higher species open once ${SMALL_TEAM.n} people are ranked. With fewer, species stay between Normal and Active.`);
217
240
  } else if (!up) {
218
241
  lines.push(ko ? ' 다음 등급: 도감에서 가장 높은 종입니다.' : ' Next species: the top species in the field guide.');
219
242
  } else {
@@ -227,67 +250,6 @@ export function standingGuideLines(st, { lang = 'en', org = null, team = null }
227
250
  return lines;
228
251
  }
229
252
 
230
- /**
231
- * The short form for the statusline's team line: where the rank puts you and
232
- * what the next species takes, as two or three phrases. The same facts as the
233
- * block above, without the sentences.
234
- * ['1위까지 2명', '다음 🐆 치타: 2명 더 (77%부터)']
235
- * `emoji: false` keeps the species names bare (narrow and text modes).
236
- */
237
- export function standingFeedbackShort(st, lang = 'en', { emoji = true } = {}) {
238
- if (!st || typeof st !== 'object' || typeof st.grade !== 'string') return [];
239
- const ko = lang === 'ko';
240
- const label = (k) => speciesLabel(k, lang, { emoji }) || k;
241
- const has = (v) => Number.isFinite(v);
242
- const ranked = Number.isInteger(st.rank) && Number.isInteger(st.ranked) && st.rank >= 1 && st.ranked >= st.rank;
243
- if (st.grade === 'ghost' || !ranked) return [ko ? '이 기간 업로드 없음' : 'no usage this period'];
244
- const idle = st.idle === true || st.grade === 'chick';
245
- // Alone in the standings the percentile is 50% by definition and nothing
246
- // moves it, so the line says that and what would: a colleague joining.
247
- if (st.ranked === 1 && !idle) {
248
- return ko
249
- ? ['지금 50%, 혼자라 고정', '동료가 참여하면 순위 시작']
250
- : ['now 50%, fixed while alone', 'standings start when a colleague joins'];
251
- }
252
- const out = [];
253
- if (st.crown) out.push(ko ? `${emoji ? '👑 ' : ''}회사 1위` : `${emoji ? '👑 ' : ''}#1 in the company`);
254
- else if (st.rank === 1 && st.ranked === 1) out.push(ko ? '혼자 순위에 있음' : 'alone in the standings');
255
- else if (st.rank === 1) out.push(ko ? '회사 1위' : '#1 in the company');
256
- else out.push(ko ? `1위까지 ${st.rank - 1}명` : `${st.rank - 1} to pass for #1`);
257
-
258
- const sr = scorePctOf(st);
259
- const next = nextOf(st, sr);
260
- const up = nextGradeUp(st.grade);
261
- const floor = (g) => (g && g.minSr >= 0 ? (ko ? `${floorPct(g)}%부터` : `${floorPct(g)}% and up`) : '');
262
- if (next) {
263
- const s = label(next.grade);
264
- const g = GRADES.find((x) => x.key === next.grade);
265
- const x = Math.max(1, Number(next.pass) || 0);
266
- const c = has(st.medianDlg) ? pct(st.medianDlg) : (ko ? '회사 중앙값' : 'the company median');
267
- const pts = pointsTo(g, sr);
268
- if (pts !== null) {
269
- // With the percentile: where you are and how many points more.
270
- const now = pct(sr);
271
- if (next.needDlg && !(Number(next.pass) > 0)) out.push(ko ? `지금 ${now}, 위임 비율 ${c} 이상이면 ${s}` : `now ${now}, delegation share ${c} or more for ${s}`);
272
- else if (next.needDlg) out.push(ko ? `지금 ${now}, ${pts}%p 더 오르고 위임 비율 ${c} 이상이면 ${s}` : `now ${now}, ${pts} pts more and delegation share ${c} or more for ${s}`);
273
- else out.push(ko ? `지금 ${now}, ${Math.max(1, pts)}%p 더 오르면 ${s} (${x}명 앞지르기)` : `now ${now}, ${Math.max(1, pts)} pts more for ${s} (pass ${x})`);
274
- } else if (next.needDlg && !(Number(next.pass) > 0)) {
275
- out.push(ko ? `다음 ${s}: 위임 비율 ${c} 이상` : `next ${s}: delegation share ${c} or more`);
276
- } else if (next.needDlg) {
277
- out.push(ko ? `다음 ${s}: ${x}명 더, 위임 비율 ${c} 이상` : `next ${s}: ${x} more and delegation share ${c} or more`);
278
- } else {
279
- out.push(ko ? `다음 ${s}: ${x}명 더${floor(g) ? ` (${floor(g)})` : ''}` : `next ${s}: ${x} more${floor(g) ? ` (${floor(g)})` : ''}`);
280
- }
281
- } else if (idle) {
282
- out.push(ko ? '지출이 생기면 순위에 오름' : 'spend to enter the standings');
283
- } else if (!up) {
284
- out.push(ko ? '도감 최상위' : 'top of the field guide');
285
- } else {
286
- out.push(ko ? `다음 ${label(up.key)} (${floor(up)})` : `next ${label(up.key)} (${floor(up)})`);
287
- }
288
- return out;
289
- }
290
-
291
253
  /**
292
254
  * The field guide: every species by tier, best first, with the percentile each
293
255
  * one starts at and a marker on the caller's own. Shared by the ranked and the
package/src/team-sync.js CHANGED
@@ -127,6 +127,9 @@ async function refreshStanding({ memberKey, dir, fetch, now }) {
127
127
  // The same score counted within the member's own team.
128
128
  teamRank: num(r.team_rank), teamRanked: num(r.team_ranked),
129
129
  teamName: typeof r.team_name === 'string' && r.team_name ? r.team_name : null,
130
+ // The two (three, with prompt capture) ranks the overall score adds, each out
131
+ // of `ranked` (server migration 20261109000200). An older server omits them.
132
+ spendRank: num(r.spend_rank), dlgRank: num(r.dlg_rank), promptRank: num(r.prompt_rank),
130
133
  };
131
134
  saveTeamState({
132
135
  ...cur,
@@ -161,13 +164,17 @@ export function readTeamChip({ dir = userDataDir() } = {}) {
161
164
  ? {
162
165
  grade: st.grade, rank: Number.isFinite(st.rank) ? st.rank : null, ranked: Number.isFinite(st.ranked) ? st.ranked : null,
163
166
  teamRank: Number.isFinite(st.teamRank) ? st.teamRank : null, teamRanked: Number.isFinite(st.teamRanked) ? st.teamRanked : null,
164
- // What the team line says about moving up (src/team-standing.js standingFeedbackShort).
167
+ // What the team line shows: the gauge, the next species and the axis ranks (statusline.js buildTeamLine).
165
168
  crown: !!st.crown,
166
169
  next: st.next && typeof st.next === 'object' && typeof st.next.grade === 'string'
167
170
  ? { grade: st.next.grade, pass: Number.isFinite(st.next.pass) ? st.next.pass : 0, needDlg: !!st.next.needDlg }
168
171
  : null,
169
172
  idle: typeof st.idle === 'boolean' ? st.idle : null,
170
173
  medianDlg: Number.isFinite(st.medianDlg) ? st.medianDlg : null,
174
+ scorePct: Number.isFinite(st.scorePct) ? st.scorePct : null,
175
+ spendRank: Number.isFinite(st.spendRank) ? st.spendRank : null,
176
+ dlgRank: Number.isFinite(st.dlgRank) ? st.dlgRank : null,
177
+ promptRank: Number.isFinite(st.promptRank) ? st.promptRank : null,
171
178
  fetchedAt: Number(st.fetchedAt) || 0,
172
179
  }
173
180
  : null,