@zhihaohong52/sonata 0.11.2 → 0.12.1

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.
Files changed (116) hide show
  1. package/dist/adapters/codex.js +6 -2
  2. package/dist/adapters/codex.js.map +1 -1
  3. package/dist/adapters/opencode.js +5 -2
  4. package/dist/adapters/opencode.js.map +1 -1
  5. package/dist/adapters/pi.js +6 -2
  6. package/dist/adapters/pi.js.map +1 -1
  7. package/dist/catalog.js +292 -52
  8. package/dist/catalog.js.map +1 -1
  9. package/dist/cli.js +57 -37
  10. package/dist/cli.js.map +1 -1
  11. package/dist/commands/agents.js +22 -1
  12. package/dist/commands/agents.js.map +1 -1
  13. package/dist/commands/catalog.js +26 -8
  14. package/dist/commands/catalog.js.map +1 -1
  15. package/dist/commands/doctor.js +139 -4
  16. package/dist/commands/doctor.js.map +1 -1
  17. package/dist/commands/init.js +36 -6
  18. package/dist/commands/init.js.map +1 -1
  19. package/dist/commands/serve.js +101 -5
  20. package/dist/commands/serve.js.map +1 -1
  21. package/dist/commands/status.js +45 -0
  22. package/dist/commands/status.js.map +1 -1
  23. package/dist/commands/sync.js +4 -0
  24. package/dist/commands/sync.js.map +1 -1
  25. package/dist/commands/usage.js +50 -0
  26. package/dist/commands/usage.js.map +1 -1
  27. package/dist/detect.js +120 -5
  28. package/dist/detect.js.map +1 -1
  29. package/dist/effort.js +39 -5
  30. package/dist/effort.js.map +1 -1
  31. package/dist/frontier.js +142 -0
  32. package/dist/frontier.js.map +1 -0
  33. package/dist/init/apply.js +10 -1
  34. package/dist/init/apply.js.map +1 -1
  35. package/dist/init/discover.js +10 -2
  36. package/dist/init/discover.js.map +1 -1
  37. package/dist/init/helpers.js.map +1 -1
  38. package/dist/init/interactive-state.js +5 -1
  39. package/dist/init/interactive-state.js.map +1 -1
  40. package/dist/migrations.js +18 -6
  41. package/dist/migrations.js.map +1 -1
  42. package/dist/native/router.js +225 -18
  43. package/dist/native/router.js.map +1 -1
  44. package/dist/tui-ink/agents-app.js +31 -4
  45. package/dist/tui-ink/agents-app.js.map +1 -1
  46. package/dist/tui-ink/agents-run.js +16 -9
  47. package/dist/tui-ink/agents-run.js.map +1 -1
  48. package/dist/tui-ink/alt-screen.js +36 -0
  49. package/dist/tui-ink/alt-screen.js.map +1 -0
  50. package/dist/tui-ink/app-config.js +130 -14
  51. package/dist/tui-ink/app-config.js.map +1 -1
  52. package/dist/tui-ink/app.js +18 -6
  53. package/dist/tui-ink/app.js.map +1 -1
  54. package/dist/tui-ink/components/byok-step.js +6 -3
  55. package/dist/tui-ink/components/byok-step.js.map +1 -1
  56. package/dist/tui-ink/components/login-screen.js +3 -1
  57. package/dist/tui-ink/components/login-screen.js.map +1 -1
  58. package/dist/tui-ink/components/menu.js +44 -0
  59. package/dist/tui-ink/components/menu.js.map +1 -0
  60. package/dist/tui-ink/components/models-step.js +4 -2
  61. package/dist/tui-ink/components/models-step.js.map +1 -1
  62. package/dist/tui-ink/components/multi-select.js +6 -2
  63. package/dist/tui-ink/components/multi-select.js.map +1 -1
  64. package/dist/tui-ink/components/providers-step.js +6 -3
  65. package/dist/tui-ink/components/providers-step.js.map +1 -1
  66. package/dist/tui-ink/components/ranked-select-state.js +96 -0
  67. package/dist/tui-ink/components/ranked-select-state.js.map +1 -1
  68. package/dist/tui-ink/components/ranked-select.js +75 -8
  69. package/dist/tui-ink/components/ranked-select.js.map +1 -1
  70. package/dist/tui-ink/components/screen.js +89 -0
  71. package/dist/tui-ink/components/screen.js.map +1 -0
  72. package/dist/tui-ink/components/search-select.js +4 -2
  73. package/dist/tui-ink/components/search-select.js.map +1 -1
  74. package/dist/tui-ink/components/text-input.js +3 -1
  75. package/dist/tui-ink/components/text-input.js.map +1 -1
  76. package/dist/tui-ink/launch.js +84 -2
  77. package/dist/tui-ink/launch.js.map +1 -1
  78. package/dist/tui-ink/screens/action-rows.js +58 -2
  79. package/dist/tui-ink/screens/action-rows.js.map +1 -1
  80. package/dist/tui-ink/screens/actions.js +157 -10
  81. package/dist/tui-ink/screens/actions.js.map +1 -1
  82. package/dist/tui-ink/screens/budget.js +13 -3
  83. package/dist/tui-ink/screens/budget.js.map +1 -1
  84. package/dist/tui-ink/screens/init.js +145 -0
  85. package/dist/tui-ink/screens/init.js.map +1 -0
  86. package/dist/tui-ink/screens/key-rows.js +28 -2
  87. package/dist/tui-ink/screens/key-rows.js.map +1 -1
  88. package/dist/tui-ink/screens/keys.js +32 -8
  89. package/dist/tui-ink/screens/keys.js.map +1 -1
  90. package/dist/tui-ink/screens/models-rows.js +42 -0
  91. package/dist/tui-ink/screens/models-rows.js.map +1 -1
  92. package/dist/tui-ink/screens/models.js +24 -6
  93. package/dist/tui-ink/screens/models.js.map +1 -1
  94. package/dist/tui-ink/screens/overview-rows.js +15 -10
  95. package/dist/tui-ink/screens/overview-rows.js.map +1 -1
  96. package/dist/tui-ink/screens/overview.js +17 -7
  97. package/dist/tui-ink/screens/overview.js.map +1 -1
  98. package/dist/tui-ink/screens/providers.js +20 -5
  99. package/dist/tui-ink/screens/providers.js.map +1 -1
  100. package/dist/tui-ink/screens/status-poll.js +112 -0
  101. package/dist/tui-ink/screens/status-poll.js.map +1 -0
  102. package/dist/tui-ink/screens/status.js +145 -0
  103. package/dist/tui-ink/screens/status.js.map +1 -0
  104. package/dist/tui-ink/screens/tiers.js +33 -21
  105. package/dist/tui-ink/screens/tiers.js.map +1 -1
  106. package/dist/tui-ink/screens/usage-view.js +97 -0
  107. package/dist/tui-ink/screens/usage-view.js.map +1 -0
  108. package/dist/tui-ink/screens/usage.js +106 -0
  109. package/dist/tui-ink/screens/usage.js.map +1 -0
  110. package/dist/tui-ink/steps.js +65 -0
  111. package/dist/tui-ink/steps.js.map +1 -1
  112. package/dist/tui-ink/theme-context.js +79 -0
  113. package/dist/tui-ink/theme-context.js.map +1 -0
  114. package/dist/tui-ink/theme.js +239 -0
  115. package/dist/tui-ink/theme.js.map +1 -0
  116. package/package.json +2 -2
@@ -6,6 +6,7 @@ import { connect } from 'node:net';
6
6
  import { reportPathFor } from '../report-contract.js';
7
7
  import { spawn } from 'node:child_process';
8
8
  import { isReadOnlyRole } from '../config.js';
9
+ import { wireEffort } from '../effort.js';
9
10
  const run = promisify(execFile);
10
11
  /**
11
12
  * Codex model discovery.
@@ -188,8 +189,11 @@ function buildScript(input) {
188
189
  // the launch, which the ranked dispatch already reads as "try the next
189
190
  // candidate".
190
191
  const common = [`-m ${shellQuote(input.modelId)}`];
191
- if (input.effort !== undefined)
192
- common.push(`-c model_reasoning_effort="${input.effort}"`);
192
+ // `default` means "as the model ships", so no flag is passed at all — codex
193
+ // then uses its own configured default, which is the request.
194
+ const codexEffort = wireEffort(input.effort);
195
+ if (codexEffort !== undefined)
196
+ common.push(`-c model_reasoning_effort="${codexEffort}"`);
193
197
  let invocation;
194
198
  if (interactive) {
195
199
  // The user's config may set approval_policy=never globally; override it so
@@ -1 +1 @@
1
- {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IA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G,CAAC,GAAG,gBAAgB,IAAI,CAAC,mDAAmD,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC5H,KAAK,EAAE,CAAC;YACV,CAAC;YACD,MAAM,KAAK,GAAG,KAAK;iBAChB,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,gBAAgB,CAAC;iBACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;iBACvB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAC/B,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/D,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;;;;OAMG;IACH,WAAW,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE;IAC3C;;;OAGG;IACH,kBAAkB,EAAE,kBAAkB;IACtC,MAAM,EAAE,WAAW;CACpB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { isReadOnlyRole } from '../config.js';
2
+ import { wireEffort } from '../effort.js';
2
3
  /**
3
4
  * Empty, and that is the finding rather than an omission.
4
5
  *
@@ -76,8 +77,10 @@ function buildScript(input) {
76
77
  // Safe to place before the positional message: `opencode run --help` on
77
78
  // 1.18.29 declares `--variant` as `[string]`, unlike `-f`, which is `[array]`
78
79
  // and greedily eats the next positional — the bug the note below exists for.
79
- if (input.effort !== undefined)
80
- flags.push(`--variant ${input.effort}`);
80
+ // `default` passes no `--variant`, so opencode uses the model's own default.
81
+ const variant = wireEffort(input.effort);
82
+ if (variant !== undefined)
83
+ flags.push(`--variant ${variant}`);
81
84
  // `-f` is declared as an array option, so it greedily consumes any following
82
85
  // positional. The message MUST come before `-f` or opencode treats the prompt
83
86
  // text as a second filename and exits with "File not found".
@@ -1 +1 @@
1
- {"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../src/adapters/opencode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,MAAM,eAAe,GAAa,EAAE,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,SAAS,QAAQ,CAAC,KAAgB;IAChC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACzC,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9C,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAC,KAAgB;IACnC,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE5C,4EAA4E;IAC5E,8EAA8E;IAC9E,6EAA6E;IAC7E,8EAA8E;IAC9E,EAAE;IACF,sEAAsE;IACtE,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CACb,0EAA0E;YAC1E,0EAA0E;YAC1E,0DAA0D,CAC3D,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC;IAC/F,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9B,8EAA8E;IAC9E,yEAAyE;IACzE,4EAA4E;IAC5E,8EAA8E;IAC9E,EAAE;IACF,8EAA8E;IAC9E,2EAA2E;IAC3E,6EAA6E;IAC7E,8EAA8E;IAC9E,MAAM,KAAK,GAAG,CAAC,KAAK,EAA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EAA4E;IAC5E,2EAA2E;IAC3E,wEAAwE;IACxE,qEAAqE;IACrE,4EAA4E;IAC5E,2EAA2E;IAC3E,qDAAqD;IACrD,EAAE;IACF,4EAA4E;IAC5E,4EAA4E;IAC5E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,KAAK,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;AAChG,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,IAAI,EAAE,UAAU;IAChB,cAAc,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;IACzC,iBAAiB,EAAE,iBAAiB;IACpC,WAAW,EAAE,CAAC,qBAAqB,CAAC;IACpC,IAAI,EAAE,WAAW;IACjB,oBAAoB,EAAE,KAAK;IAC3B,cAAc,EAAE,eAAe;IAC/B,cAAc;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,iEAAiE;IACjE,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;CACjC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { execFile } from 'node:child_process';
2
2
  import { promisify } from 'node:util';
3
3
  import { isReadOnlyRole } from '../config.js';
4
+ import { wireEffort } from '../effort.js';
4
5
  const run = promisify(execFile);
5
6
  /**
6
7
  * Pi adapter.
@@ -57,8 +58,11 @@ function buildScript(input) {
57
58
  // it prints `Warning: Invalid thinking level "none"` and continues at its
58
59
  // own default, so an unmapped `none` would silently run WITH thinking, the
59
60
  // opposite of what was asked for, with nothing downstream able to see it.
60
- if (input.effort !== undefined)
61
- flags.push(`--thinking ${piThinkingLevel(input.effort)}`);
61
+ // `default` passes no `--thinking`, so pi uses its own default. Distinct
62
+ // from `none`, which maps to pi's `off` and actively disables thinking.
63
+ const thinking = wireEffort(input.effort);
64
+ if (thinking !== undefined)
65
+ flags.push(`--thinking ${piThinkingLevel(thinking)}`);
62
66
  // `--tools` is an allowlist, genuinely enforced: a read-only role gets only
63
67
  // the read-side tools and cannot write even in bypassPermissions.
64
68
  if (readOnly)
@@ -1 +1 @@
1
- {"version":3,"file":"pi.js","sourceRoot":"","sources":["../../src/adapters/pi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEhC;;;;;;;;;;;;GAYG;AAEH;;;;;;;GAOG;AACH,MAAM,eAAe,GAAa,EAAE,CAAC;AAErC,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AACzC,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC;AAED,SAAS,WAAW,CAAC,KAAgB;IACnC,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;IAErE,4EAA4E;IAC5E,uEAAuE;IACvE,0EAA0E;IAC1E,8EAA8E;IAC9E,EAAE;IACF,sEAAsE;IACtE,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CACb,oEAAoE;YACpE,0EAA0E;YAC1E,0DAA0D,CAC3D,CAAC;IACJ,CAAC;IAED,uEAAuE;IACvE,0EAA0E;IAC1E,yEAAyE;IACzE,2EAA2E;IAC3E,gBAAgB;IAChB,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,WAAW,UAAU,CAAC,KAAK,CA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AChC,MAAM,EAAE,QAAQ;CACjB,CAAC"}
package/dist/catalog.js CHANGED
@@ -11,10 +11,22 @@
11
11
  import { existsSync, readFileSync } from 'node:fs';
12
12
  import { join } from 'node:path';
13
13
  import { EFFORT_LEVELS, isEffort, joinCandidate, splitCandidate } from './effort.js';
14
+ import { frontierIndices, keptAfterGate, kneeIndex } from './frontier.js';
14
15
  export const AA_ATTRIBUTION = 'Model rankings by Artificial Analysis — https://artificialanalysis.ai';
15
- /** Coding Index at or above this ⇒ complex-eligible. Chosen so today's
16
- * mid-tier coders (deepseek-v4-flash class) sit just above the line. */
17
- export const AA_CAPABLE_CODING_INDEX = 40;
16
+ /**
17
+ * The capability an unscored model is ranked as: a mid-table stand-in, so a
18
+ * model the catalog does not know sorts among known ones rather than first or
19
+ * last.
20
+ *
21
+ * This used to be `AA_CAPABLE_CODING_INDEX`, a threshold that excluded any
22
+ * catalog-scored model with a coding index below 40 from every tier. It was
23
+ * removed: it gated on a score no tier ranks by, it excluded rather than
24
+ * demoted, it could not judge a new model (no coding index yet), and when
25
+ * every candidate failed it the fallback ranked them all anyway. Measured on
26
+ * the real catalog, the best of the 27 models it caught had under a third of
27
+ * the value of the model leading `simple`, so the frontier already sinks them.
28
+ */
29
+ export const UNSCORED_PLACEHOLDER_INDEX = 40;
18
30
  /**
19
31
  * A model may cost at most this multiple of the cheapest *selected* model's
20
32
  * per-task cost and still be eligible for a simple tier.
@@ -59,6 +71,28 @@ export const SIMPLE_COST_CEILING = 12;
59
71
  * not signal, and cost should call it instead.
60
72
  */
61
73
  export const AA_CAPABILITY_TIE_MARGIN = 1.0;
74
+ /**
75
+ * The capability *class* a score falls in — the margin applied transitively.
76
+ *
77
+ * "Within the margin" cannot be asked pairwise. Tolerance is not transitive:
78
+ * with scores 52.1, 51.5 and 51.0 the first two are a tie and so are the last
79
+ * two, but 52.1 and 51.0 are 1.1 apart and rank outright. Add prices running
80
+ * the other way (3.0, 2.0, 1.0) and the comparator cycles — B beats A on
81
+ * price, C beats B on price, A beats C on capability. Measured on exactly
82
+ * that fixture: six input permutations produced THREE different orderings of
83
+ * the same three candidates, so the tier a user got depended on the order
84
+ * their models happened to be declared in.
85
+ *
86
+ * Quantising first makes the comparison an integer equality, which cannot
87
+ * cycle. The cost is a boundary: two scores either side of a class edge are
88
+ * separated even when closer together than the margin. That is the standard
89
+ * trade for bucketing, and it is the safe direction — it can only ever rank
90
+ * by capability where the old code ranked by price, never produce an order
91
+ * that depends on input.
92
+ */
93
+ export function capabilityClass(index) {
94
+ return Math.round(index / AA_CAPABILITY_TIE_MARGIN);
95
+ }
62
96
  /**
63
97
  * Capability, best available measure first.
64
98
  *
@@ -71,6 +105,39 @@ export const AA_CAPABILITY_TIE_MARGIN = 1.0;
71
105
  export function capabilityOf(entry) {
72
106
  return entry.agenticIndex ?? entry.codingIndex ?? entry.intelligenceIndex ?? 0;
73
107
  }
108
+ /**
109
+ * Capability as the `complex` tier measures it: reasoning first.
110
+ *
111
+ * `complex` is the one tier defined by judgement rather than throughput —
112
+ * "needs a design decision affecting other components, or is ambiguous about
113
+ * what done means" — and the agentic index does not describe that. It
114
+ * describes driving tools in a loop, which every tier does equally.
115
+ *
116
+ * The two disagree materially rather than academically. Measured 2026-09-21
117
+ * over one project's 22 complex candidates: on the agentic index
118
+ * `glm-5.3-flash` (50.9), `gpt-5.6-sol@max` (50.2) and `gpt-6-astra@max`
119
+ * (51.0) all sit inside `AA_CAPABILITY_TIE_MARGIN`, so the tie-break decided
120
+ * the top of the tier — and the tie-break is *cost*, in the one tier
121
+ * deliberately left cost-uncapped. The cheapest of the three led. On the
122
+ * intelligence index the same three are 41.8 / 47.0 / 52.7, a 10.9 spread
123
+ * the margin cannot swallow, so the ranking is decided by the measurement
124
+ * rather than by the price.
125
+ *
126
+ * **Every tier ranks on this now, `simple` and `normal` included.** They used
127
+ * `capabilityOf` (agentic first), on the reasoning that throughput is the
128
+ * right numerator for a value tier. The coverage figure that justified it —
129
+ * "agentic on 95%" — did not hold: AA publishes agentic scores days after
130
+ * intelligence, so every new model arrives without one. Measured on one real
131
+ * config: 22 of 36 candidates had an agentic score, all 36 an intelligence
132
+ * one. `capabilityOf` then fell back per model, putting two scales on one
133
+ * frontier axis, and the knee it found (`glm-5.3-flash`, agentic 50.9) was
134
+ * not even on the frontier when measured on one scale — `mimo-v2.6-pro` beats
135
+ * it on intelligence and on price. A metric only a subset of the candidates
136
+ * carry cannot rank all of them.
137
+ */
138
+ export function reasoningOf(entry) {
139
+ return entry.intelligenceIndex ?? entry.agenticIndex ?? entry.codingIndex ?? 0;
140
+ }
74
141
  /**
75
142
  * The key an AA score is stored and looked up under.
76
143
  *
@@ -258,8 +325,13 @@ export function unpinnedCandidates(config, aa, upstreamFor = configIdUpstream(co
258
325
  const gateways = Object.keys(config.native?.gateways ?? {});
259
326
  const out = [];
260
327
  for (const [role, lists] of Object.entries(config.tiers)) {
261
- for (const tier of ['simple', 'complex']) {
262
- for (const candidate of lists[tier]) {
328
+ // `normal` is included, and was missing: it was added after this refusal
329
+ // and the loop was never widened, so a bare key in `normal` alone slipped
330
+ // through the very check that exists to stop a candidate ranking on one
331
+ // row's score and then running at the gateway's default. Guarded rather
332
+ // than indexed, because `normal` is optional and absent is valid.
333
+ for (const tier of ['simple', 'normal', 'complex']) {
334
+ for (const candidate of lists[tier] ?? []) {
263
335
  const { key, effort } = splitCandidate(candidate);
264
336
  if (effort !== undefined)
265
337
  continue;
@@ -295,7 +367,7 @@ const identityUpstream = (key) => key;
295
367
  * first spelling that scores wins, so a later one can only add a score where
296
368
  * there was none, never move a model that already matches.
297
369
  */
298
- function normalizedFor(key, providers, upstreamFor) {
370
+ export function normalizedFor(key, providers, upstreamFor) {
299
371
  const upstream = upstreamFor(key);
300
372
  const spellings = typeof upstream === 'string' ? [upstream] : upstream;
301
373
  // Each spelling is offered stripped of the configured gateway names, then
@@ -346,13 +418,23 @@ const CURATED = {
346
418
  'qwen3.8-max': { capable: true },
347
419
  'ox-alpha-free': { capable: false },
348
420
  };
421
+ /**
422
+ * Whether a model may be ranked, and which source said so.
423
+ *
424
+ * An AA-scored model is always eligible: its position is the ranking's job.
425
+ * Without a score, the curated table answers, then a default.
426
+ */
349
427
  export function lookupModel(name, aa, providers = [], upstreamFor = identityUpstream) {
350
428
  const { key, effort } = splitCandidate(name);
351
429
  const normalized = normalizedFor(key, providers, upstreamFor);
352
430
  const scored = aaEntryFor(normalized, aa, effort);
353
431
  if (scored !== undefined) {
354
432
  return {
355
- capable: scored.codingIndex >= AA_CAPABLE_CODING_INDEX,
433
+ // Always eligible. A scored model's place is decided by the frontier and
434
+ // the tier's sort, which demote a weak model to the end of the list
435
+ // rather than removing it — see `UNSCORED_PLACEHOLDER_INDEX` for the
436
+ // threshold this replaced and why.
437
+ capable: true,
356
438
  source: 'aa',
357
439
  };
358
440
  }
@@ -433,11 +515,17 @@ export function unpinnedVariants(saved, aa, providers = [], upstreamFor = identi
433
515
  return expanded.length > 1 || expanded[0] !== candidate ? expanded : [];
434
516
  });
435
517
  }
518
+ /** A candidate's measurements for the ranking board — capability on the given metric and cost per task — or just its key and effort when the catalog does not score it. */
519
+ export function candidateFacts(candidate, aa, providers = [], upstreamFor = identityUpstream, metric = capabilityOf) {
520
+ const { key, effort } = splitCandidate(candidate);
521
+ const entry = scoreFor(candidate, aa, providers, upstreamFor);
522
+ if (entry === undefined)
523
+ return { key, effort };
524
+ return { key, effort, capability: metric(entry), costPerTask: entry.costPerTask };
525
+ }
436
526
  /**
437
- * A ranking row: `<key> @<effort>`, then the capability and the cost the
438
- * ranking actually sorts on, so a user comparing two rows sees the numbers
439
- * that ordered them. Per-task cost where AA costed the model, else the
440
- * per-1M blend — labelled, because the two are different units.
527
+ * One ranking row's text: the candidate, its intelligence score and its cost
528
+ * per task, or a note that AA publishes no per-task cost for it.
441
529
  */
442
530
  export function candidateLabel(candidate, aa, providers = [], upstreamFor = identityUpstream) {
443
531
  const { key, effort } = splitCandidate(candidate);
@@ -447,7 +535,7 @@ export function candidateLabel(candidate, aa, providers = [], upstreamFor = iden
447
535
  return head;
448
536
  if (entry.costPerTask === undefined)
449
537
  return `${head} (AA publishes no cost-per-task — add by hand to sonata.toml)`;
450
- return `${head.padEnd(32)} ${capabilityOf(entry).toFixed(1).padStart(4)} $${entry.costPerTask.toFixed(3)}/task`;
538
+ return `${head.padEnd(32)} ${reasoningOf(entry).toFixed(1).padStart(4)} $${entry.costPerTask.toFixed(3)}/task`;
451
539
  }
452
540
  /**
453
541
  * Which of `modelKeys` the ranking catalog can actually score.
@@ -469,23 +557,25 @@ export function catalogCoverage(modelKeys, aa, providers = [], upstreamFor = ide
469
557
  }
470
558
  /** Rank for ordering within a tier: the role's AA score when known, else a
471
559
  * fixed mid score so curated/default models interleave stably. */
472
- function rank(key, aa, providers = [], upstreamFor = identityUpstream) {
560
+ function rank(key, aa, providers = [], upstreamFor = identityUpstream, metric = capabilityOf) {
473
561
  const scored = scoreFor(key, aa, providers, upstreamFor);
474
562
  return scored !== undefined
475
- ? { index: capabilityOf(scored), price: scored.costPerTask ?? 0 }
476
- : { index: AA_CAPABLE_CODING_INDEX, price: 0 };
563
+ ? { index: metric(scored), price: scored.costPerTask ?? 0 }
564
+ : { index: UNSCORED_PLACEHOLDER_INDEX, price: 0 };
477
565
  }
478
566
  /**
479
- * Capability per dollar — how a simple tier is ordered.
567
+ * Capability per task-dollar — how `simple` and `normal` are ordered.
480
568
  *
481
- * A simple tier exists to do grunt work cheaply, so the model that returns the
482
- * most capability per dollar wins, not the most capable model that happens to
483
- * clear a price threshold (which is what this used to do, and is backwards for
484
- * a tier whose whole purpose is cost). Price is floored before dividing so a
485
- * free model sorts first rather than dividing by zero.
569
+ * No price floor. This divided by `max(price, 0.01)`, a guard from when
570
+ * prices were per-token rates, and per-task costs now run well under a cent:
571
+ * `gpt-6-luna@low` costs $0.0045 and `gpt-5.6-luna@low` $0.0098, both floored
572
+ * to $0.01, so the halved price vanished and a 0.1-point intelligence gap
573
+ * decided `simple`'s lead the wrong way. A non-positive price is not "very
574
+ * cheap", it is missing data, and scores zero — the spec's rule that a zero
575
+ * cost per task is unscored, not free.
486
576
  */
487
577
  function valueOf(r) {
488
- return r.index / Math.max(r.price, 0.01);
578
+ return r.price > 0 ? r.index / r.price : 0;
489
579
  }
490
580
  /**
491
581
  * Rank a role's selected models into the three tiers.
@@ -519,16 +609,24 @@ export function proposeTiers(modelKeys, aa, providers = [], avoided = new Set(),
519
609
  // built-in proposal path usable because there is no exclusion data yet.
520
610
  const candidates = taskCostedCandidates(expandCandidates(modelKeys, aa, providers, upstreamFor), aa, providers, upstreamFor);
521
611
  const bareKey = (candidate) => splitCandidate(candidate).key;
522
- const rankOf = (k) => rank(k, aa, providers, upstreamFor);
612
+ // Two rankers, because the tiers measure different things. `simple` and
613
+ // `normal` are value tiers and want throughput per dollar; `complex` is a
614
+ // judgement tier and wants reasoning. See `reasoningOf`.
615
+ // Intelligence for every tier, not agentic for the value tiers. Agentic
616
+ // is missing for every model AA has only just scored — measured, 14 of 36
617
+ // candidates on one real config — and `capabilityOf` then fell back to
618
+ // intelligence per model, so the value frontier plotted old models by
619
+ // agentic and new ones by intelligence on one axis. That mixed axis made
620
+ // `glm-5.3-flash` the knee (agentic 50.9) although `mimo-v2.6-pro` beats
621
+ // it on intelligence AND price. Intelligence is the one score AA publishes
622
+ // for every model from day one, and the scale its own frontier chart uses.
623
+ const rankOf = (k) => rank(k, aa, providers, upstreamFor, reasoningOf);
624
+ const rankReasoning = (k) => rank(k, aa, providers, upstreamFor, reasoningOf);
523
625
  // An avoided model sorts after every non-avoided one, whatever it scores.
524
626
  // Demotion, not exclusion: the tier keeps it as a fallback candidate, so
525
627
  // avoiding a gateway costs preference rather than the depth a ranked list
526
628
  // exists to provide.
527
629
  const avoidance = (a, b) => Number(avoided.has(bareKey(a))) - Number(avoided.has(bareKey(b)));
528
- // Complex work wants the most capable model, cost breaking ties — including
529
- // a near-tie: a capability gap within AA_CAPABILITY_TIE_MARGIN is treated as
530
- // noise rather than a real edge, so price decides it the same as an exact
531
- // tie would. A real edge (bigger than the margin) still wins outright.
532
630
  // When capability and price both tie, the higher effort level leads. The
533
631
  // levels of one model are the case: AA prices a level-less row per 1M
534
632
  // tokens, so every level shares one price, and adjacent levels sit inside
@@ -540,12 +638,112 @@ export function proposeTiers(modelKeys, aa, providers = [], avoided = new Set(),
540
638
  return effort === undefined ? -1 : EFFORT_LEVELS.indexOf(effort);
541
639
  };
542
640
  const byLevel = (a, b) => levelOf(b) - levelOf(a);
641
+ // A scored candidate with no intelligence index has only an agentic or
642
+ // coding score, and `reasoningOf` would plot that on the intelligence axis
643
+ // beside every other model. Such a candidate stays in the tier as fallback
644
+ // depth — demoted, as avoidance and the gate demote — but never sets the
645
+ // frontier and never competes with intelligence scores for a position.
646
+ // Only a MIX is off-scale: when no candidate has an intelligence score (an
647
+ // old cache, a fixture) they all share the fallback, and demoting every one
648
+ // of them would just delete the knee. Unscored candidates (no catalog)
649
+ // share the placeholder, the catalog-less path's own single scale.
650
+ const lacksIntelligence = (k) => {
651
+ const entry = scoreFor(k, aa, providers, upstreamFor);
652
+ return entry !== undefined && !Number.isFinite(entry.intelligenceIndex);
653
+ };
654
+ const mixed = candidates.some((k) => !lacksIntelligence(k));
655
+ const offScale = (k) => mixed && lacksIntelligence(k);
656
+ const scaleOrder = (a, b) => Number(offScale(a)) - Number(offScale(b));
657
+ const capable = (k) => lookupModel(k, aa, providers, upstreamFor).capable;
658
+ const perTask = (k) => scoreFor(k, aa, providers, upstreamFor)?.costPerTask;
659
+ /**
660
+ * The frontier geometry for one metric.
661
+ *
662
+ * Computed per tier rather than once, because the tiers measure different
663
+ * things — `capabilityOf` is throughput and `reasoningOf` is judgement, a
664
+ * split `catalog.ts` already makes for measured reasons — and bounding a
665
+ * value tier with a knee derived from a metric it does not rank on is the
666
+ * same unit-mixing error as comparing a per-task cost with a per-token one.
667
+ * They genuinely differ: on one real config the agentic knee is
668
+ * `glm-5.3-flash` and the intelligence knee is `mimo-v2.6-pro`.
669
+ *
670
+ * The knee is taken from the FULL frontier and the gate applied after, never
671
+ * the reverse. `kneeIndex` records why: Kneedle measures against a chord
672
+ * between the endpoints, the gate removes the far endpoint, and a knee
673
+ * computed afterwards would inherit the gate's tuned fraction.
674
+ */
675
+ const geometryFor = (metric) => {
676
+ const pool = candidates.filter((k) => capable(k) && !offScale(k) && (perTask(k) ?? 0) > 0);
677
+ const points = pool.map((k) => ({
678
+ capability: rank(k, aa, providers, upstreamFor, metric).index,
679
+ cost: perTask(k) ?? 0,
680
+ }));
681
+ const order = frontierIndices(points);
682
+ const frontier = order.map((i) => points[i]);
683
+ // `undefined` when the frontier has no knee (too few points, or no
684
+ // tradeoff to find). Then there is nothing to promote in `normal`, and
685
+ // `complex`'s floor is -Infinity so every candidate counts as at-or-above
686
+ // it — plain capability order, which is what the spec's degradation says.
687
+ const at = kneeIndex(frontier);
688
+ const knee = at === undefined ? undefined : pool[order[at]];
689
+ const kept = keptAfterGate(frontier);
690
+ const wasteful = new Set(order.slice(kept).map((i) => pool[i]));
691
+ return {
692
+ knee,
693
+ wasteful,
694
+ kneeCapability: at === undefined ? Number.NEGATIVE_INFINITY : frontier[at].capability,
695
+ };
696
+ };
697
+ const valueGeometry = geometryFor(reasoningOf);
698
+ const powerGeometry = geometryFor(reasoningOf);
699
+ /**
700
+ * A gated rung sorts after every rung that pays, whatever it scores.
701
+ *
702
+ * Demotion rather than exclusion, exactly as `avoid_gateways` demotes: the
703
+ * tier keeps it as a last-resort candidate, so declining to pay for it costs
704
+ * preference rather than the depth a ranked list exists to provide. Ordered
705
+ * after the avoidance term, since a gate is sonata's judgement and avoidance
706
+ * is the user's.
707
+ */
708
+ const gateOrder = (set) => (a, b) => Number(set.has(a)) - Number(set.has(b));
709
+ /**
710
+ * Dominated candidates need no term of their own, and that is provable: if X
711
+ * dominates Y then X is at least as capable AND costs no more, so `byValue`
712
+ * and `byCapability` both already place X first. Checked exhaustively
713
+ * against a real catalog — 1762 dominating pairs, zero violations under
714
+ * either key. An explicit demotion pass was not merely redundant, it
715
+ * introduced an inversion that ranked a weaker frontier rung above a
716
+ * stronger dominated one inside a capability-ordered tier.
717
+ */
543
718
  const byCapability = (a, b) => {
544
- const ra = rankOf(a);
545
- const rb = rankOf(b);
546
- const gap = Math.abs(rb.index - ra.index) <= AA_CAPABILITY_TIE_MARGIN ? 0 : rb.index - ra.index;
547
- const byPrice = ra.price - rb.price;
548
- return avoidance(a, b) || gap || byPrice || byLevel(a, b);
719
+ const ra = rankReasoning(a);
720
+ const rb = rankReasoning(b);
721
+ return avoidance(a, b)
722
+ || scaleOrder(a, b)
723
+ || gateOrder(powerGeometry.wasteful)(a, b)
724
+ // Knee-and-above leads; below-knee follows as fallback depth rather than
725
+ // being excluded. The knee decides the lead, not membership — excluding
726
+ // left one real config's `complex` with five live candidates, so a
727
+ // provider-wide 402 would exhaust it while capable models sat unused.
728
+ || Number(ra.index < powerGeometry.kneeCapability) - Number(rb.index < powerGeometry.kneeCapability)
729
+ // The tie margin survives the band's deletion, and it has to: the gate
730
+ // cannot reach this case. Measured — `qwen3.8-max` (58.4) outranked
731
+ // `glm-5.3-flash` (58.2) on a 0.2-point edge while costing 10.5x as
732
+ // much per task. Both sit on the frontier (dearer AND better), and a
733
+ // two-point frontier can never be gated, so raw capability order alone
734
+ // pays ten times over for a gap that is benchmark noise.
735
+ //
736
+ // Compared as a quantised CLASS rather than a pairwise tolerance,
737
+ // because a pairwise one is not transitive: it produced a genuine
738
+ // 3-cycle on a real fixture, which made the sort depend on input order
739
+ // and the tier differ run to run.
740
+ || capabilityClass(rb.index) - capabilityClass(ra.index)
741
+ || ra.price - rb.price
742
+ // A real capability edge breaks an equal price, after the class has had
743
+ // its say: where there is no money to save there is nothing to trade,
744
+ // and suppressing the difference would pick the worse rung for nothing.
745
+ || rb.index - ra.index
746
+ || byLevel(a, b);
549
747
  };
550
748
  // Simple work wants the most capability per dollar, capability breaking
551
749
  // ties. At one price, value *is* capability, so a score inside the tie
@@ -557,31 +755,61 @@ export function proposeTiers(modelKeys, aa, providers = [], avoided = new Set(),
557
755
  const byValue = (a, b) => {
558
756
  const ra = rankOf(a);
559
757
  const rb = rankOf(b);
560
- if (ra.price === rb.price && Math.abs(rb.index - ra.index) <= AA_CAPABILITY_TIE_MARGIN) {
758
+ const scaled = scaleOrder(a, b);
759
+ if (scaled !== 0)
760
+ return avoidance(a, b) || scaled;
761
+ const gated = gateOrder(valueGeometry.wasteful)(a, b);
762
+ if (gated !== 0)
763
+ return avoidance(a, b) || gated;
764
+ if (ra.price === rb.price && capabilityClass(ra.index) === capabilityClass(rb.index)) {
561
765
  return avoidance(a, b) || byLevel(a, b);
562
766
  }
563
767
  return avoidance(a, b) || valueOf(rb) - valueOf(ra) || rb.index - ra.index || byLevel(a, b);
564
768
  };
565
- const capable = (k) => lookupModel(k, aa, providers, upstreamFor).capable;
566
- const perTask = (k) => scoreFor(k, aa, providers, upstreamFor)?.costPerTask;
567
769
  const complex = candidates.filter(capable).sort(byCapability);
568
- const normal = candidates.filter(capable).sort(byValue);
770
+ const valueOrdered = candidates.filter(capable).sort(byValue);
771
+ /**
772
+ * `normal` leads with the knee, and that is the point of computing one.
773
+ *
774
+ * Used only as a boundary, the best balance point on the frontier led
775
+ * nothing — the analysis was performed and then discarded. `normal` is the
776
+ * *default* tier and means "you know what to change but not exactly how";
777
+ * leading it with the cheapest thing on offer is not a sensible default, and
778
+ * it also gave `simple` and `normal` the same lead, which is the collapse
779
+ * `SIMPLE_CAPABILITY_FLOOR` caused and was deleted for.
780
+ *
781
+ * An avoided or gated knee does not lead: those two judgements outrank this
782
+ * one, and promoting a model the user asked to avoid would make
783
+ * `avoid_gateways` a suggestion.
784
+ */
785
+ const knee = valueGeometry.knee;
786
+ const kneeLeads = knee !== undefined
787
+ && !avoided.has(bareKey(knee))
788
+ && !valueGeometry.wasteful.has(knee)
789
+ && valueOrdered.includes(knee);
790
+ const normal = kneeLeads
791
+ ? [knee, ...valueOrdered.filter((k) => k !== knee)]
792
+ : valueOrdered;
569
793
  // Anchor the cap to the best-value model that can actually lead. Avoided
570
794
  // models remain fallbacks but must not raise the price paid by preferred ones.
571
- const anchor = normal.find((k) => !avoided.has(bareKey(k))) ?? normal[0];
795
+ //
796
+ // Anchored on the VALUE order rather than on `normal`, because `normal` now
797
+ // leads with the knee — which is deliberately not the cheapest model, so
798
+ // using it would raise the cap by whatever the knee costs and let `simple`
799
+ // reach models it exists to exclude.
800
+ const anchor = valueOrdered.find((k) => !avoided.has(bareKey(k))) ?? valueOrdered[0];
572
801
  const anchorCost = anchor === undefined ? undefined : perTask(anchor);
573
802
  const ceiling = anchorCost === undefined ? undefined : anchorCost * SIMPLE_COST_CEILING;
574
- // Filtering `normal` rather than sorting again is what stops `simple`
803
+ // Filtering the value order rather than sorting again is what stops `simple`
575
804
  // disagreeing with it about order: it never does its own sort.
576
805
  //
577
- // The result is a **subsequence, not a prefix**. `normal` is ordered by
578
- // value, and value is not monotonic in cost — a dearer model with a much
579
- // better score outranks a cheap weak one — so an over-ceiling candidate can
580
- // sit ahead of an under-ceiling one and the filter skips past it.
581
- // Truncating at the first over-ceiling candidate would make it a true
582
- // prefix and would drop the qualifying cheap models behind it, which is the
583
- // opposite of what a cheap tier is for.
584
- const simple = ceiling === undefined ? [] : normal.filter((k) => {
806
+ // The result is a **subsequence, not a prefix**. Value is not monotonic in
807
+ // cost — a dearer model with a much better score outranks a cheap weak one —
808
+ // so an over-ceiling candidate can sit ahead of an under-ceiling one and the
809
+ // filter skips past it. Truncating at the first over-ceiling candidate would
810
+ // drop the qualifying cheap models behind it, the opposite of what a cheap
811
+ // tier is for.
812
+ const simple = ceiling === undefined ? [] : valueOrdered.filter((k) => {
585
813
  const cost = perTask(k);
586
814
  return cost !== undefined && cost <= ceiling;
587
815
  });
@@ -608,9 +836,11 @@ export function aaCatalogAgeDays(fetchedAt, now) {
608
836
  // as negative age; treat it as current.
609
837
  return Math.max(0, Math.floor((now.getTime() - at) / 86_400_000));
610
838
  }
839
+ /** Where the cached Artificial Analysis catalog lives under a home directory. */
611
840
  export function aaCatalogPath(home) {
612
841
  return join(home, '.config', 'sonata', 'catalog.json');
613
842
  }
843
+ /** Read the cached Artificial Analysis catalog, or `undefined` when there is none or it will not parse. */
614
844
  export function loadAaCatalog(home) {
615
845
  const path = aaCatalogPath(home);
616
846
  if (!existsSync(path))
@@ -628,16 +858,26 @@ export function loadAaCatalog(home) {
628
858
  for (const [name, entry] of Object.entries(doc.models)) {
629
859
  if (entry !== null &&
630
860
  typeof entry === 'object' &&
631
- Number.isFinite(entry.codingIndex) &&
861
+ // At least one real score, not specifically a coding one: a coding
862
+ // index is optional now, and requiring it here would drop exactly
863
+ // the rows the stand-in bug was hiding — at load time instead.
864
+ [entry.codingIndex, entry.agenticIndex, entry.intelligenceIndex].some((v) => Number.isFinite(v)) &&
632
865
  Number.isFinite(entry.blendedPriceUsd)) {
633
866
  // An unknown level is a hand-edit or a foreign writer; the score is
634
867
  // still good, so keep the row and drop only the field.
635
- const { effort, costPerTask, ...rest } = entry;
868
+ const { effort, costPerTask, codingIndex, agenticIndex, intelligenceIndex, ...rest } = entry;
636
869
  // Same treatment as `effort`: the row's score is still good, so drop
637
- // only the malformed field and let the model read as uncosted.
638
- const kept = typeof costPerTask === 'number' && Number.isFinite(costPerTask)
639
- ? { ...rest, costPerTask }
640
- : rest;
870
+ // only the malformed field and let the model read as uncosted. Each
871
+ // optional score likewise: one finite score admits the row, so a
872
+ // string beside it would otherwise reach `toFixed` in a label.
873
+ const finite = (v) => typeof v === 'number' && Number.isFinite(v);
874
+ const kept = {
875
+ ...rest,
876
+ ...(finite(codingIndex) ? { codingIndex } : {}),
877
+ ...(finite(agenticIndex) ? { agenticIndex } : {}),
878
+ ...(finite(intelligenceIndex) ? { intelligenceIndex } : {}),
879
+ ...(finite(costPerTask) ? { costPerTask } : {}),
880
+ };
641
881
  models[name] = effort !== undefined && isEffort(effort) ? { ...kept, effort } : kept;
642
882
  }
643
883
  }