sprag-cli 3.113.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.113.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,
@@ -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,7 +24,7 @@
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%. */
@@ -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
  /**
@@ -220,6 +231,12 @@ export function standingGuideLines(st, { lang = 'en', org = null, team = null }
220
231
  text = `${ko ? `${x}명을 더 앞지르면 ${s}` : `pass ${x} more to become ${s}`}${floorNote(g)}`;
221
232
  }
222
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.`);
223
240
  } else if (!up) {
224
241
  lines.push(ko ? ' 다음 등급: 도감에서 가장 높은 종입니다.' : ' Next species: the top species in the field guide.');
225
242
  } else {