@clagentic/console 1.8.0-beta.2 → 1.9.0-beta.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.
- package/lib/build-sha.json +2 -2
- package/lib/generated/claude-model-catalog.json +180 -0
- package/lib/model-catalog.js +202 -0
- package/lib/model-context-windows.js +9 -0
- package/lib/model-families.js +243 -0
- package/lib/project-connection.js +16 -4
- package/lib/project-sessions.js +102 -18
- package/lib/project.js +4 -0
- package/lib/public/css/menus.css +67 -0
- package/lib/public/css/server-settings.css +72 -0
- package/lib/public/index.html +3 -0
- package/lib/public/modules/app-loop-ui.js +4 -0
- package/lib/public/modules/app-messages.js +29 -4
- package/lib/public/modules/app-panels.js +93 -24
- package/lib/public/modules/app-rate-limit.js +1 -1
- package/lib/public/modules/model-context-windows.js +9 -0
- package/lib/public/modules/model-families.js +230 -0
- package/lib/public/modules/project-settings.js +1 -0
- package/lib/public/modules/scheduler.js +5 -0
- package/lib/public/modules/server-settings.js +14 -12
- package/lib/public/modules/settings-defaults.js +151 -41
- package/lib/public/modules/tools.js +38 -0
- package/lib/sdk-bridge.js +88 -13
- package/lib/sdk-message-processor.js +128 -3
- package/lib/server.js +55 -0
- package/lib/session-activity.js +282 -0
- package/lib/sessions.js +58 -3
- package/lib/terminal-manager.js +40 -0
- package/lib/utils.js +44 -0
- package/lib/ws-schema.js +1 -0
- package/lib/yoke/adapters/claude-worker.js +6 -2
- package/lib/yoke/adapters/claude.js +377 -87
- package/lib/yoke/adapters/codex.js +20 -0
- package/package.json +1 -1
- package/scripts/generate-model-catalog.js +337 -0
|
@@ -7,6 +7,8 @@ import { store } from './store.js';
|
|
|
7
7
|
import { getWs } from './ws-ref.js';
|
|
8
8
|
import { VENDOR_NAMES } from './app-rendering.js';
|
|
9
9
|
import { KNOWN_CONTEXT_WINDOWS, resolveModelContextWindow as _resolveModelContextWindowCore } from './model-context-windows.js';
|
|
10
|
+
import { splitModelsByTier } from './settings-defaults.js';
|
|
11
|
+
import { isSonnetModel } from './model-families.js';
|
|
10
12
|
|
|
11
13
|
// --- Module-owned state (not in store) ---
|
|
12
14
|
// sessionUsage.context = last-turn context fill (lastStreamInputTokens) — not cumulative,
|
|
@@ -153,11 +155,9 @@ function thinkingDisplayName(value) {
|
|
|
153
155
|
return value || "Adaptive";
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return lower.indexOf("sonnet") !== -1;
|
|
160
|
-
}
|
|
158
|
+
// isSonnetModel imported from ./model-families.js (lr-d91ecf) — the single
|
|
159
|
+
// shared family-detection module; this file used to carry its own private
|
|
160
|
+
// copy of the same substring check.
|
|
161
161
|
|
|
162
162
|
function hasBeta(name) {
|
|
163
163
|
var betas = store.get('currentBetas');
|
|
@@ -167,32 +167,101 @@ function hasBeta(name) {
|
|
|
167
167
|
return false;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
// Build one .config-radio-item button for a model entry (string or rich object).
|
|
171
|
+
function buildConfigModelItem(item, currentModel) {
|
|
172
|
+
// Support both object { value, displayName } and plain string formats
|
|
173
|
+
var value = typeof item === "string" ? item : (item.value || "");
|
|
174
|
+
var label = typeof item === "string" ? item : (item.displayName || value);
|
|
175
|
+
// lr-d3817f: retired entries are filtered out upstream (model-catalog.js's
|
|
176
|
+
// filterSelectableCatalogModels) and never reach this function — no
|
|
177
|
+
// disabled/retired-badge rendering here anymore. Deprecated (still-
|
|
178
|
+
// runnable) entries still get a marker.
|
|
179
|
+
var isDeprecated = !!(item && typeof item === "object" && item.isDeprecated);
|
|
180
|
+
var btn = document.createElement("button");
|
|
181
|
+
btn.className = "config-radio-item";
|
|
182
|
+
if (value === currentModel) btn.classList.add("active");
|
|
183
|
+
btn.dataset.model = value;
|
|
184
|
+
btn.textContent = label;
|
|
185
|
+
// lr-f22787: same non-blocking "Catalog" marker as the settings picker
|
|
186
|
+
// (settings-defaults.js buildModelItem) for entries sourced from the
|
|
187
|
+
// release-time-generated catalog rather than the vendor's live list.
|
|
188
|
+
if (item && typeof item === "object" && item.fromCatalog) {
|
|
189
|
+
var catalogBadge = document.createElement("span");
|
|
190
|
+
catalogBadge.className = "config-model-catalog-badge";
|
|
191
|
+
catalogBadge.textContent = " (Catalog)";
|
|
192
|
+
btn.appendChild(catalogBadge);
|
|
193
|
+
}
|
|
194
|
+
if (isDeprecated) {
|
|
195
|
+
var deprecatedBadge = document.createElement("span");
|
|
196
|
+
deprecatedBadge.className = "config-model-deprecated-badge";
|
|
197
|
+
deprecatedBadge.textContent = " (Deprecated)";
|
|
198
|
+
btn.appendChild(deprecatedBadge);
|
|
199
|
+
}
|
|
200
|
+
btn.addEventListener("click", function () {
|
|
201
|
+
var model = this.dataset.model;
|
|
202
|
+
sendSetModel(model);
|
|
203
|
+
});
|
|
204
|
+
return btn;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function sendSetModel(model) {
|
|
208
|
+
var ws = getWs();
|
|
209
|
+
if (ws && ws.readyState === 1) {
|
|
210
|
+
ws.send(JSON.stringify({ type: "set_model", model: model }));
|
|
211
|
+
}
|
|
212
|
+
configPopover.classList.add("hidden");
|
|
213
|
+
configChip.classList.remove("active");
|
|
214
|
+
}
|
|
215
|
+
|
|
170
216
|
function rebuildModelList() {
|
|
171
217
|
if (!configModelList) return;
|
|
172
218
|
configModelList.innerHTML = "";
|
|
173
219
|
var s = store.snap();
|
|
174
220
|
var list = s.currentModels.length > 0 ? s.currentModels : (s.currentModel ? [{ value: s.currentModel, displayName: s.currentModel }] : []);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
221
|
+
|
|
222
|
+
// lr-e03635: same latest/older tiering as every other picker surface
|
|
223
|
+
// (renderModelList in settings-defaults.js) — default to latest models,
|
|
224
|
+
// with a collapsible "Older models" disclosure for the rest.
|
|
225
|
+
var tiers = splitModelsByTier(list);
|
|
226
|
+
|
|
227
|
+
for (var i = 0; i < tiers.latest.length; i++) {
|
|
228
|
+
configModelList.appendChild(buildConfigModelItem(tiers.latest[i], s.currentModel));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Empty-disclosure rule: absent, not present-and-empty.
|
|
232
|
+
if (tiers.older.length > 0) {
|
|
233
|
+
var toggle = document.createElement("button");
|
|
234
|
+
toggle.type = "button";
|
|
235
|
+
toggle.className = "config-older-models-toggle";
|
|
236
|
+
toggle.setAttribute("aria-expanded", "false");
|
|
237
|
+
|
|
238
|
+
var toggleLabel = document.createElement("span");
|
|
239
|
+
toggleLabel.textContent = "Older models";
|
|
240
|
+
toggle.appendChild(toggleLabel);
|
|
241
|
+
|
|
242
|
+
var chevron = document.createElement("i");
|
|
243
|
+
chevron.setAttribute("data-lucide", "chevron-right");
|
|
244
|
+
chevron.className = "settings-adv-chevron";
|
|
245
|
+
toggle.appendChild(chevron);
|
|
246
|
+
|
|
247
|
+
var body = document.createElement("div");
|
|
248
|
+
body.className = "config-older-models-body hidden";
|
|
249
|
+
for (var k = 0; k < tiers.older.length; k++) {
|
|
250
|
+
body.appendChild(buildConfigModelItem(tiers.older[k], s.currentModel));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
toggle.addEventListener("click", function () {
|
|
254
|
+
var isOpen = !body.classList.contains("hidden");
|
|
255
|
+
body.classList.toggle("hidden", isOpen);
|
|
256
|
+
toggle.setAttribute("aria-expanded", String(!isOpen));
|
|
257
|
+
chevron.style.transform = isOpen ? "" : "rotate(90deg)";
|
|
193
258
|
});
|
|
194
|
-
|
|
259
|
+
|
|
260
|
+
configModelList.appendChild(toggle);
|
|
261
|
+
configModelList.appendChild(body);
|
|
195
262
|
}
|
|
263
|
+
|
|
264
|
+
refreshIcons(configModelList);
|
|
196
265
|
}
|
|
197
266
|
|
|
198
267
|
function rebuildModeList() {
|
|
@@ -7,7 +7,7 @@ import { getWs } from './ws-ref.js';
|
|
|
7
7
|
import { addToMessages, scrollToBottom } from './app-rendering.js';
|
|
8
8
|
import { userAvatarUrl } from './avatar.js';
|
|
9
9
|
import { clearScheduleDelay, setScheduleDelayForSession, clearScheduleDelayForSession, restoreScheduleDelayUi } from './input.js';
|
|
10
|
-
import { isSonnetModel, isOpusModel } from './
|
|
10
|
+
import { isSonnetModel, isOpusModel } from './model-families.js';
|
|
11
11
|
import {
|
|
12
12
|
getRateLimitResetsAt, setRateLimitResetsAt,
|
|
13
13
|
getRateLimitResetTimer, setRateLimitResetTimer,
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
* The map is keyed by a lowercase model-name substring. Lookup is a linear scan so
|
|
13
13
|
* insertion order matters for overlapping substrings — more-specific keys should
|
|
14
14
|
* appear before less-specific ones.
|
|
15
|
+
*
|
|
16
|
+
* Fallback-only (lr-d91ecf): this map is consulted only when the vendor
|
|
17
|
+
* hasn't reported a context window for the active model at runtime
|
|
18
|
+
* (resolveModelContextWindow returns 0 for anything not listed here, and
|
|
19
|
+
* callers degrade gracefully — see resolveContextWindow in app-panels.js,
|
|
20
|
+
* which falls back further to the SDK-reported value before a last-resort
|
|
21
|
+
* default). A vendor-reported window always wins when present; this table
|
|
22
|
+
* exists only to cover models/betas the vendor's runtime response doesn't
|
|
23
|
+
* carry a window for.
|
|
15
24
|
*/
|
|
16
25
|
|
|
17
26
|
export var KNOWN_CONTEXT_WINDOWS = {
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* model-families.js — shared source of truth for Claude model family/version
|
|
3
|
+
* parsing, derived display names, and capability heuristics. (lr-d91ecf)
|
|
4
|
+
*
|
|
5
|
+
* This is the ES module (browser) copy. The CJS backend copy lives at
|
|
6
|
+
* lib/model-families.js and is consumed by lib/yoke/adapters/claude.js. A CI
|
|
7
|
+
* test (test/model-families-parity.test.js) asserts both files produce
|
|
8
|
+
* identical results so they cannot silently drift — same discipline as the
|
|
9
|
+
* existing lib/model-context-windows.js / lib/public/modules/
|
|
10
|
+
* model-context-windows.js pair (lr-336f).
|
|
11
|
+
*
|
|
12
|
+
* Before this module existed, family/version detection was duplicated three
|
|
13
|
+
* ways: lib/yoke/adapters/claude.js (parseClaudeModelVersion etc., added by
|
|
14
|
+
* lr-e03635), lib/public/modules/settings-defaults.js (isSonnetModel/
|
|
15
|
+
* isOpusModel/isHaikuModel), and lib/public/modules/app-panels.js (its own
|
|
16
|
+
* private isSonnetModel copy). This is the single shared location — do not
|
|
17
|
+
* add a fourth copy elsewhere.
|
|
18
|
+
*
|
|
19
|
+
* No hardcoded model IDs or display-name tables: everything here is derived
|
|
20
|
+
* from the ID string's family substring + numeric version ordering, so a
|
|
21
|
+
* model release the code has never seen gets a sane display name and correct
|
|
22
|
+
* latest/older tiering with zero code changes.
|
|
23
|
+
*
|
|
24
|
+
* When adding a new family (e.g. a brand-new Claude product line): update
|
|
25
|
+
* BOTH this file and lib/model-families.js. The parity test will fail if
|
|
26
|
+
* they disagree.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export var CLAUDE_MODEL_FAMILIES = ["opus", "sonnet", "haiku", "fable"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* True if the given model ID string belongs to the given family (substring
|
|
33
|
+
* match on the lowercased ID). Generic helper backing isSonnetModel/
|
|
34
|
+
* isOpusModel/isHaikuModel below.
|
|
35
|
+
*/
|
|
36
|
+
function isClaudeFamily(model, family) {
|
|
37
|
+
if (!model) return false;
|
|
38
|
+
var str = typeof model === "string" ? model : (model.value || "");
|
|
39
|
+
return str.toLowerCase().indexOf(family) !== -1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function isSonnetModel(model) { return isClaudeFamily(model, "sonnet"); }
|
|
43
|
+
export function isOpusModel(model) { return isClaudeFamily(model, "opus"); }
|
|
44
|
+
export function isHaikuModel(model) { return isClaudeFamily(model, "haiku"); }
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Parse a single ID/description-style string into { family, version } (or
|
|
48
|
+
* null). Shared core behind parseClaudeModelVersion below — no family
|
|
49
|
+
* resolution fallback, just the raw substring + numeric-segment extraction.
|
|
50
|
+
*/
|
|
51
|
+
function parseClaudeFamilyVersion(str) {
|
|
52
|
+
var lower = (str || "").toLowerCase();
|
|
53
|
+
// Strip pinned-version/beta suffix like "[1m]" before parsing.
|
|
54
|
+
var clean = lower.replace(/\[.*?\]$/, "").trim();
|
|
55
|
+
|
|
56
|
+
var family = null;
|
|
57
|
+
for (var i = 0; i < CLAUDE_MODEL_FAMILIES.length; i++) {
|
|
58
|
+
if (clean.indexOf(CLAUDE_MODEL_FAMILIES[i]) !== -1) { family = CLAUDE_MODEL_FAMILIES[i]; break; }
|
|
59
|
+
}
|
|
60
|
+
if (!family) return null;
|
|
61
|
+
|
|
62
|
+
// Numeric segments after the family name, stopping before a trailing date
|
|
63
|
+
// stamp (8 digits, e.g. "-20250929") which is a release date, not a version.
|
|
64
|
+
var afterFamily = clean.slice(clean.indexOf(family) + family.length);
|
|
65
|
+
var withoutDate = afterFamily.replace(/-?\d{8}\b/, "");
|
|
66
|
+
var nums = withoutDate.match(/\d+/g);
|
|
67
|
+
var version = nums ? nums.map(function(n) { return parseInt(n, 10); }) : [];
|
|
68
|
+
|
|
69
|
+
return { family: family, version: version };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Extract ONLY the leading dotted-number run immediately following the
|
|
74
|
+
* family name in free-text description prose (e.g. "Opus 4.8 with 1M
|
|
75
|
+
* context" -> [4, 8], stopping before the unrelated "1" in "1M"). Unlike
|
|
76
|
+
* parseClaudeFamilyVersion (which scans the entire remainder of a tight ID
|
|
77
|
+
* string), description text can contain trailing prose with unrelated
|
|
78
|
+
* digits, so only a contiguous number immediately after the family name
|
|
79
|
+
* (allowing a single separator character, e.g. the space in "Opus 4.8") is
|
|
80
|
+
* trusted as the version.
|
|
81
|
+
*/
|
|
82
|
+
function parseClaudeFamilyVersionFromDescription(str) {
|
|
83
|
+
var lower = (str || "").toLowerCase();
|
|
84
|
+
var family = null;
|
|
85
|
+
for (var i = 0; i < CLAUDE_MODEL_FAMILIES.length; i++) {
|
|
86
|
+
if (lower.indexOf(CLAUDE_MODEL_FAMILIES[i]) !== -1) { family = CLAUDE_MODEL_FAMILIES[i]; break; }
|
|
87
|
+
}
|
|
88
|
+
if (!family) return null;
|
|
89
|
+
|
|
90
|
+
var afterFamily = lower.slice(lower.indexOf(family) + family.length);
|
|
91
|
+
var m = afterFamily.match(/^[\s-]?(\d+(?:\.\d+)*)/);
|
|
92
|
+
var version = m ? m[1].split(".").map(function(n) { return parseInt(n, 10); }) : [];
|
|
93
|
+
|
|
94
|
+
return { family: family, version: version };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Parse a raw Claude model ID into { family, version } for ordering.
|
|
99
|
+
* version is an array of numeric segments (e.g. "claude-opus-4-6" -> [4, 6]),
|
|
100
|
+
* so comparison is lexicographic-numeric (4.6 > 4.5 > 4 > 3.7 > 3.5 > 3).
|
|
101
|
+
* Returns null when the ID doesn't match a known family (e.g. an ID with no
|
|
102
|
+
* family substring at all) — such entries are excluded from the tiering
|
|
103
|
+
* comparison entirely and default to isLatest: true (never hidden behind a
|
|
104
|
+
* disclosure we can't reason about).
|
|
105
|
+
*
|
|
106
|
+
* Live Claude runtimes report an alias for `modelId` (e.g. "opus", "sonnet",
|
|
107
|
+
* "fable") with NO version digits at all — the family resolves but the
|
|
108
|
+
* version array comes back empty. When the caller also has the vendor's
|
|
109
|
+
* `description` string (e.g. "Opus 4.8 with 1M context", "Sonnet 4.6"), pass
|
|
110
|
+
* it as the optional second argument: if the alias itself carried no version
|
|
111
|
+
* digits, ONLY the leading number immediately after the family name in the
|
|
112
|
+
* description is trusted (see parseClaudeFamilyVersionFromDescription) —
|
|
113
|
+
* trailing prose digits (e.g. the "1" in "1M context") are never picked up.
|
|
114
|
+
* This is what lets an alias-only model list still surface real version
|
|
115
|
+
* numbers (lr-5c07ce) without ever hardcoding a model ID.
|
|
116
|
+
*/
|
|
117
|
+
export function parseClaudeModelVersion(modelId, description) {
|
|
118
|
+
var parsed = parseClaudeFamilyVersion(modelId);
|
|
119
|
+
if (!parsed) return null;
|
|
120
|
+
if (parsed.version.length === 0 && description) {
|
|
121
|
+
var fromDesc = parseClaudeFamilyVersionFromDescription(description);
|
|
122
|
+
if (fromDesc && fromDesc.family === parsed.family && fromDesc.version.length > 0) {
|
|
123
|
+
return { family: parsed.family, version: fromDesc.version };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return parsed;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Compare two version arrays lexicographically (missing segments treated as 0).
|
|
131
|
+
* Returns >0 if a > b, <0 if a < b, 0 if equal.
|
|
132
|
+
*/
|
|
133
|
+
export function compareClaudeVersions(a, b) {
|
|
134
|
+
var len = Math.max(a.length, b.length);
|
|
135
|
+
for (var i = 0; i < len; i++) {
|
|
136
|
+
var av = a[i] || 0;
|
|
137
|
+
var bv = b[i] || 0;
|
|
138
|
+
if (av !== bv) return av - bv;
|
|
139
|
+
}
|
|
140
|
+
return 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Given the full list of raw model IDs (or rich objects) reported by the
|
|
145
|
+
* vendor, compute isLatest per model: true iff it holds the max version
|
|
146
|
+
* within its own family, or its ID doesn't parse into a known family at all
|
|
147
|
+
* (unparseable entries are never hidden).
|
|
148
|
+
*
|
|
149
|
+
* When an entry is a rich object with a `description` field, it feeds
|
|
150
|
+
* parseClaudeModelVersion's optional second argument (see its doc comment) —
|
|
151
|
+
* this is what lets a live alias-only list (value: "opus"/"sonnet"/"haiku",
|
|
152
|
+
* no version digits) still tier correctly against a real versioned ID that
|
|
153
|
+
* might appear alongside it, using the version embedded in the vendor's
|
|
154
|
+
* description text instead of a hardcoded table (lr-5c07ce).
|
|
155
|
+
* @returns {Object<string, boolean>} map of raw model value -> isLatest
|
|
156
|
+
*/
|
|
157
|
+
export function deriveClaudeLatestTiers(models) {
|
|
158
|
+
var parsed = models.map(function(m) {
|
|
159
|
+
var value = (m && typeof m === "object") ? (m.value || "") : String(m || "");
|
|
160
|
+
var description = (m && typeof m === "object") ? m.description : null;
|
|
161
|
+
return { value: value, parsed: parseClaudeModelVersion(value, description) };
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
var maxVersionByFamily = {};
|
|
165
|
+
for (var i = 0; i < parsed.length; i++) {
|
|
166
|
+
var p = parsed[i].parsed;
|
|
167
|
+
if (!p) continue;
|
|
168
|
+
var current = maxVersionByFamily[p.family];
|
|
169
|
+
if (!current || compareClaudeVersions(p.version, current) > 0) {
|
|
170
|
+
maxVersionByFamily[p.family] = p.version;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
var result = {};
|
|
175
|
+
for (var j = 0; j < parsed.length; j++) {
|
|
176
|
+
var entry = parsed[j];
|
|
177
|
+
if (!entry.parsed) {
|
|
178
|
+
result[entry.value] = true; // unparseable — never hidden
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
var maxV = maxVersionByFamily[entry.parsed.family];
|
|
182
|
+
result[entry.value] = compareClaudeVersions(entry.parsed.version, maxV) === 0;
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Title-case a family name for display (e.g. "opus" -> "Opus").
|
|
188
|
+
function titleCaseFamily(family) {
|
|
189
|
+
return family.charAt(0).toUpperCase() + family.slice(1);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Derive a human-readable display name purely from the parsed family +
|
|
194
|
+
* version — no lookup table, so an ID the code has never seen still gets a
|
|
195
|
+
* sane label with zero code changes (e.g. "claude-opus-4-6" -> "Opus 4.6").
|
|
196
|
+
* Falls back to stripping the "claude-" prefix for IDs with no recognized
|
|
197
|
+
* family substring at all (e.g. "default" -> "Default").
|
|
198
|
+
*
|
|
199
|
+
* @param {string} modelId
|
|
200
|
+
* @param {string} [description] - optional vendor description string (e.g.
|
|
201
|
+
* "Opus 4.8 with 1M context"). When modelId is a bare alias with no
|
|
202
|
+
* version digits (the live runtime shape for opus/sonnet/haiku/fable —
|
|
203
|
+
* lr-5c07ce), the version embedded in description is used instead, so
|
|
204
|
+
* "Opus" (alias) displays as "Opus 4.8" rather than just "Opus".
|
|
205
|
+
*/
|
|
206
|
+
export function claudeDisplayName(modelId, description) {
|
|
207
|
+
var parsed = parseClaudeModelVersion(modelId, description);
|
|
208
|
+
if (parsed) {
|
|
209
|
+
var label = titleCaseFamily(parsed.family);
|
|
210
|
+
if (parsed.version.length > 0) {
|
|
211
|
+
label += " " + parsed.version.join(".");
|
|
212
|
+
}
|
|
213
|
+
return label;
|
|
214
|
+
}
|
|
215
|
+
// Fallback: strip "claude-" prefix, title-case remainder
|
|
216
|
+
var stripped = (modelId || "").replace(/^claude-/i, "");
|
|
217
|
+
return stripped;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Haiku models do not support extended thinking.
|
|
221
|
+
export function claudeModelSupportsThinking(modelId) {
|
|
222
|
+
return !isHaikuModel(modelId);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Models known to support effort control. Currently all Claude 4.x opus/sonnet
|
|
226
|
+
// models support effort; haiku does not (no reasoning). Defaults to true for
|
|
227
|
+
// unknown models so new releases are not accidentally silenced.
|
|
228
|
+
export function claudeModelSupportsEffort(modelId) {
|
|
229
|
+
return !isHaikuModel(modelId);
|
|
230
|
+
}
|
|
@@ -605,6 +605,7 @@ function psDefaultsOpts() {
|
|
|
605
605
|
modeMsgType: "set_project_default_mode",
|
|
606
606
|
effortMsgType: "set_project_default_effort",
|
|
607
607
|
betasMsgType: "set_project_default_betas",
|
|
608
|
+
scopeLabel: "Default for new sessions in this project",
|
|
608
609
|
onModelSelect: function (model) {
|
|
609
610
|
renderBetaCard("ps", Object.assign({}, psDefaultsOpts(), { overrideModel: model }));
|
|
610
611
|
},
|
|
@@ -770,6 +770,7 @@ function renderModelTab(bodyEl, rec) {
|
|
|
770
770
|
'<div class="settings-card"><div class="settings-field">' +
|
|
771
771
|
'<label class="settings-label">Model</label>' +
|
|
772
772
|
'<div class="settings-hint">Choose the Claude model for this task.</div>' +
|
|
773
|
+
'<div id="ls-model-scope" class="config-scope-label"></div>' +
|
|
773
774
|
'<div id="ls-model-list" class="settings-model-list"></div>' +
|
|
774
775
|
'</div></div>' +
|
|
775
776
|
'<div class="settings-card"><div class="settings-field">' +
|
|
@@ -822,6 +823,10 @@ function renderModelTab(bodyEl, rec) {
|
|
|
822
823
|
modelMsgType: "loop_set_model",
|
|
823
824
|
modeMsgType: "loop_set_mode",
|
|
824
825
|
effortMsgType: "loop_set_effort",
|
|
826
|
+
// lr-db0437: loop-scoped — this picker configures the specific scheduled/
|
|
827
|
+
// loop task being edited, not the current session or any project/server
|
|
828
|
+
// default.
|
|
829
|
+
scopeLabel: "Task default (this scheduled task only)",
|
|
825
830
|
};
|
|
826
831
|
|
|
827
832
|
renderModelList("ls", opts);
|
|
@@ -183,17 +183,13 @@ export function initServerSettings(appCtx) {
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
//
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (ws && ws.readyState === 1) {
|
|
194
|
-
ws.send(JSON.stringify({ type: "set_server_default_model", model: model }));
|
|
195
|
-
}
|
|
196
|
-
});
|
|
186
|
+
// lr-db0437: the model-row click used to be double-handled — this
|
|
187
|
+
// delegated listener sent the (correct) set_server_default_model message,
|
|
188
|
+
// while renderModelList's own click handler (settings-defaults.js) sent
|
|
189
|
+
// set_model (session-scoped, wrong for a default picker — see
|
|
190
|
+
// ssDefaultsOpts() above). Now that ssDefaultsOpts() sends the correct
|
|
191
|
+
// message type itself, this second listener would just double-send the
|
|
192
|
+
// same message on every click.
|
|
197
193
|
|
|
198
194
|
// PIN buttons
|
|
199
195
|
var pinSetBtn = document.getElementById("settings-pin-set-btn");
|
|
@@ -659,10 +655,16 @@ function ssDefaultsOpts() {
|
|
|
659
655
|
currentThinkingBudget: ctx.currentThinkingBudget || 10000,
|
|
660
656
|
currentBetas: ctx.currentBetas || [],
|
|
661
657
|
sendMsg: ssSendMsg,
|
|
662
|
-
|
|
658
|
+
// lr-db0437: was "set_model" — the session-scoped message type, wrong for
|
|
659
|
+
// a server DEFAULT picker. Every sibling control on this same panel
|
|
660
|
+
// (mode/effort/betas below) already uses the set_server_default_* type;
|
|
661
|
+
// the model row was the one surface still routing through the live
|
|
662
|
+
// session's setModel handler instead of the default-setter.
|
|
663
|
+
modelMsgType: "set_server_default_model",
|
|
663
664
|
modeMsgType: "set_server_default_mode",
|
|
664
665
|
effortMsgType: "set_server_default_effort",
|
|
665
666
|
betasMsgType: "set_server_default_betas",
|
|
667
|
+
scopeLabel: "Server default",
|
|
666
668
|
onModelSelect: function (model) { updateSsBetaCard(model); },
|
|
667
669
|
};
|
|
668
670
|
}
|