@clagentic/console 1.8.0 → 1.9.0-beta.2
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/bin/cli.js +12 -1
- package/lib/agents.js +13 -3
- package/lib/build-sha.json +2 -2
- package/lib/cli/ipc-subcommands.js +40 -4
- package/lib/daemon.js +25 -1
- package/lib/generated/claude-model-catalog.json +180 -0
- package/lib/model-catalog.js +202 -0
- package/lib/model-families.js +243 -0
- package/lib/project-connection.js +30 -5
- package/lib/project-loop.js +46 -2
- package/lib/project-sessions.js +133 -21
- package/lib/project-user-message.js +70 -3
- package/lib/project.js +11 -1
- package/lib/public/app.js +14 -4
- package/lib/public/css/base.css +14 -0
- package/lib/public/css/home-hub.css +28 -8
- package/lib/public/css/icon-strip.css +17 -0
- package/lib/public/css/menus.css +67 -0
- package/lib/public/css/messages.css +11 -0
- package/lib/public/css/mobile-nav.css +22 -0
- package/lib/public/css/server-settings.css +72 -0
- package/lib/public/css/sidebar.css +15 -0
- package/lib/public/css/title-bar.css +10 -1
- package/lib/public/index.html +4 -0
- package/lib/public/modules/activity-latch.js +159 -0
- package/lib/public/modules/activity-state.js +157 -0
- package/lib/public/modules/app-connection.js +10 -4
- package/lib/public/modules/app-favicon.js +88 -1
- package/lib/public/modules/app-home-hub.js +14 -11
- package/lib/public/modules/app-loop-ui.js +90 -2
- package/lib/public/modules/app-messages.js +117 -28
- package/lib/public/modules/app-panels.js +184 -56
- package/lib/public/modules/app-projects.js +28 -8
- package/lib/public/modules/app-rate-limit.js +14 -2
- 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/sidebar-mobile.js +32 -22
- package/lib/public/modules/sidebar-projects.js +42 -14
- package/lib/public/modules/sidebar-sessions.js +168 -48
- package/lib/public/modules/tools.js +22 -12
- package/lib/sdk-bridge.js +389 -35
- package/lib/sdk-message-processor.js +215 -7
- package/lib/sdk-skill-discovery.js +46 -6
- package/lib/sdk-slash-enrichment.js +5 -2
- package/lib/server-hub-sessions.js +70 -0
- package/lib/server.js +79 -22
- package/lib/session-activity.js +289 -0
- package/lib/sessions.js +104 -3
- package/lib/smtp.js +10 -1
- package/lib/terminal-manager.js +40 -0
- package/lib/utils.js +44 -0
- package/lib/ws-schema.js +17 -0
- package/lib/yoke/adapters/claude-worker.js +6 -2
- package/lib/yoke/adapters/claude.js +384 -88
- package/lib/yoke/adapters/codex.js +239 -31
- package/package.json +2 -2
- package/scripts/check-test-count.js +397 -0
- package/scripts/generate-model-catalog.js +337 -0
- package/scripts/test-file-completion-reporter.js +43 -0
- package/lib/model-context-windows.js +0 -65
- package/lib/public/modules/model-context-windows.js +0 -62
|
@@ -8,11 +8,12 @@ import { renderProjectIcon } from './project-icon.js';
|
|
|
8
8
|
import { store } from './store.js';
|
|
9
9
|
import { getWs, setWs } from './ws-ref.js';
|
|
10
10
|
import { getMessagesEl, getStatusDot } from './dom-refs.js';
|
|
11
|
+
import { sessionActivity, indicatorClass } from './activity-state.js';
|
|
11
12
|
import { userAvatarUrl } from './avatar.js';
|
|
12
13
|
import { showConfirm } from './app-misc.js';
|
|
13
14
|
// renderUserStrip is now reactive via store subscriber in sidebar-users.js
|
|
14
15
|
import { renderIconStrip } from './sidebar-projects.js';
|
|
15
|
-
import { updateCrossProjectBlink, stopUrgentBlink
|
|
16
|
+
import { updateCrossProjectBlink, stopUrgentBlink } from './app-favicon.js';
|
|
16
17
|
import { spawnDustParticles } from './sidebar.js';
|
|
17
18
|
import { isSearchOpen, closeSearch } from './session-search.js';
|
|
18
19
|
import { exitDmMode } from './app-dm.js';
|
|
@@ -313,13 +314,15 @@ export function renderTopbarPresence(serverUsers) {
|
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
export function renderProjectList() {
|
|
317
|
+
// lr-66c118: activity-state.js is the sole reader of the processing flag
|
|
318
|
+
// (CI-enforced) — Object.assign carries it through untouched rather than
|
|
319
|
+
// this mapper naming/reading the property itself.
|
|
316
320
|
var iconStripProjects = cachedProjects.map(function (p) {
|
|
317
|
-
return {
|
|
321
|
+
return Object.assign({}, p, {
|
|
318
322
|
slug: p.slug,
|
|
319
323
|
name: p.title || p.project,
|
|
320
324
|
icon: p.icon || null,
|
|
321
325
|
folderName: p.folderName || null,
|
|
322
|
-
isProcessing: p.isProcessing,
|
|
323
326
|
onlineUsers: p.onlineUsers || [],
|
|
324
327
|
unread: p.unread || 0,
|
|
325
328
|
pendingPermissions: p.pendingPermissions || 0,
|
|
@@ -327,7 +330,7 @@ export function renderProjectList() {
|
|
|
327
330
|
parentSlug: p.parentSlug || null,
|
|
328
331
|
branch: p.branch || null,
|
|
329
332
|
worktreeAccessible: p.worktreeAccessible !== undefined ? p.worktreeAccessible : true,
|
|
330
|
-
};
|
|
333
|
+
});
|
|
331
334
|
});
|
|
332
335
|
var st = store.snap();
|
|
333
336
|
var iconStripActiveSlug = st.currentSlug;
|
|
@@ -377,11 +380,20 @@ export function renderProjectList() {
|
|
|
377
380
|
}
|
|
378
381
|
}
|
|
379
382
|
}
|
|
380
|
-
// Re-apply current socket status to the active icon's dot
|
|
383
|
+
// Re-apply current socket status to the active icon's dot. st.processing
|
|
384
|
+
// is THIS client's own live turn-in-flight signal (set by setStatus() in
|
|
385
|
+
// app-connection.js) — always tone 'self', it can only ever be about the
|
|
386
|
+
// viewing user's own connection. lr-66c118: routed through the same
|
|
387
|
+
// derivation as every other dot rather than writing '.processing' as an
|
|
388
|
+
// independent 3rd state source (alongside the session-level processing
|
|
389
|
+
// flag and setActivity).
|
|
381
390
|
var dot = getStatusDot();
|
|
382
391
|
if (dot) {
|
|
383
|
-
if (st.connected
|
|
384
|
-
|
|
392
|
+
if (st.connected) {
|
|
393
|
+
dot.classList.add("connected");
|
|
394
|
+
var localActivityCls = indicatorClass(sessionActivity({ isProcessing: st.processing }));
|
|
395
|
+
if (localActivityCls) dot.classList.add(localActivityCls);
|
|
396
|
+
}
|
|
385
397
|
}
|
|
386
398
|
updateCrossProjectBlink();
|
|
387
399
|
}
|
|
@@ -406,7 +418,15 @@ export function resetClientState() {
|
|
|
406
418
|
setIsUserScrolledUp(false);
|
|
407
419
|
document.getElementById("new-msg-btn").classList.add("hidden");
|
|
408
420
|
setRewindMode(false);
|
|
409
|
-
setActivity
|
|
421
|
+
// lr-66c118 / lr-6e20f7: the setActivity clear call is removed here —
|
|
422
|
+
// setActivityEl(null) above already nulls the activity-widget ref, and
|
|
423
|
+
// getMessagesEl().innerHTML = "" already wiped the DOM element itself, so
|
|
424
|
+
// an explicit setActivity(null) call here would be redundant. The widget's
|
|
425
|
+
// OWN reactive clear (app-favicon.js's initActivityFooter, subscribed to
|
|
426
|
+
// store.processing) additionally still needs the DOM ref nulled out here —
|
|
427
|
+
// setActivityEl(null) above is exactly what makes that safe, since a
|
|
428
|
+
// reactive clear firing after this reset would otherwise find a stale ref
|
|
429
|
+
// pointing at an element already removed from the DOM by innerHTML="".
|
|
410
430
|
setStatus("connected");
|
|
411
431
|
// Always re-enable input on session switch. A loop running in another session
|
|
412
432
|
// has its own dedicated session and must not lock unrelated sessions.
|
|
@@ -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,
|
|
@@ -113,11 +113,23 @@ function updateRateLimitIndicator(msg) {
|
|
|
113
113
|
var isRejected = msg.status === "rejected";
|
|
114
114
|
var pillClass = "header-rate-limit" + (isRejected ? " rejected" : " warning");
|
|
115
115
|
var label = isRejected ? "Rate limited" : "Rate warning";
|
|
116
|
+
// lr-872f94: render the vendor-reported usedPercent in the pill itself
|
|
117
|
+
// (previously only surfaced in the transient warning popover text).
|
|
118
|
+
// Applies to both providers -- Codex's account/rateLimits/updated and
|
|
119
|
+
// Claude's rate_limit_info both carry `utilization` (0-1 fraction) through
|
|
120
|
+
// the same yokeType: "rate_limit" event shape (lib/sdk-message-processor.js).
|
|
121
|
+
var pct = typeof msg.utilization === "number" ? Math.round(msg.utilization * 100) : null;
|
|
122
|
+
var pctHtml = pct != null ? '<span class="header-pill-pct">' + pct + "%</span>" : "";
|
|
123
|
+
// lr-872f94 fold-in: this link was hardcoded to Claude's usage page even
|
|
124
|
+
// for Codex-triggered warnings/rejections. getVendorUsageMeta already
|
|
125
|
+
// exists for exactly this (used by the rate_limit_usage widget below).
|
|
126
|
+
var vendorMeta = getVendorUsageMeta(store.get('currentVendor') || "claude");
|
|
116
127
|
rateLimitIndicatorEl.innerHTML =
|
|
117
128
|
'<span class="' + pillClass + '">' +
|
|
118
129
|
iconHtml("alert-triangle") +
|
|
119
130
|
'<span class="header-pill-text">' + label + "</span>" +
|
|
120
|
-
|
|
131
|
+
pctHtml +
|
|
132
|
+
'<a href="' + vendorMeta.href + '" target="_blank" rel="noopener" class="rate-limit-link">' +
|
|
121
133
|
iconHtml("external-link") +
|
|
122
134
|
"</a>" +
|
|
123
135
|
"</span>";
|
|
@@ -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
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// settings-defaults.js — Shared rendering for model/mode/effort/thinking controls
|
|
2
2
|
// Used by both server-settings.js and project-settings.js
|
|
3
3
|
|
|
4
|
+
import { refreshIcons } from './icons.js';
|
|
5
|
+
import { isSonnetModel } from './model-families.js';
|
|
6
|
+
|
|
4
7
|
export var MODE_OPTIONS = [
|
|
5
8
|
{ value: "default", label: "Default", desc: "Claude asks for permission before running tools and editing files." },
|
|
6
9
|
{ value: "plan", label: "Plan", desc: "Claude creates a plan first and asks for approval before making changes." },
|
|
@@ -25,7 +28,8 @@ export var MODEL_DESCRIPTIONS = {
|
|
|
25
28
|
"default": "Automatically selects the best model for the task.",
|
|
26
29
|
"sonnet": "Fast and capable. Great balance of speed and intelligence.",
|
|
27
30
|
"haiku": "Fastest model. Best for quick tasks and simple questions.",
|
|
28
|
-
"opus": "
|
|
31
|
+
"opus": "Highly capable. Best for complex reasoning and analysis.",
|
|
32
|
+
"fable": "Anthropic's most capable model. Best for the hardest problems.",
|
|
29
33
|
// Codex/OpenAI families
|
|
30
34
|
"gpt-5.5": "Latest GPT-5.5. Frontier model for complex coding and agentic workflows.",
|
|
31
35
|
"gpt-5.4": "GPT-5.4. Strong reasoning and agentic coding.",
|
|
@@ -49,33 +53,125 @@ export function getModelDesc(model) {
|
|
|
49
53
|
return "";
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
// isSonnetModel re-exported from ./model-families.js (lr-d91ecf) — the
|
|
57
|
+
// single shared family-detection module also consumed by app-panels.js.
|
|
58
|
+
// Re-exported (not just imported) because server-settings.js imports it
|
|
59
|
+
// from this module directly.
|
|
60
|
+
export { isSonnetModel };
|
|
61
|
+
|
|
62
|
+
// --- Render functions ---
|
|
63
|
+
// Each takes an element ID prefix (e.g. "ss" or "ps"), a send function, and state getters.
|
|
56
64
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
// lr-db0437: every model/mode picker surface must state the scope it
|
|
66
|
+
// applies to ("This session only" / "Default for new sessions in this
|
|
67
|
+
// project" / "Server default" / loop-scoped) — model-scope honesty was the
|
|
68
|
+
// point of this task, not just the plumbing fix. Single shared renderer so
|
|
69
|
+
// each surface (session chip, project settings, server settings, Ralph-loop,
|
|
70
|
+
// scheduler) gets identical markup/behavior; each call site just passes its
|
|
71
|
+
// own static scope string via opts.scopeLabel.
|
|
72
|
+
export function renderScopeLabel(prefix, scopeLabel) {
|
|
73
|
+
var el = document.getElementById(prefix + "-model-scope");
|
|
74
|
+
if (!el) return;
|
|
75
|
+
if (scopeLabel) {
|
|
76
|
+
el.textContent = scopeLabel;
|
|
77
|
+
el.style.display = "";
|
|
78
|
+
} else {
|
|
79
|
+
el.style.display = "none";
|
|
80
|
+
}
|
|
60
81
|
}
|
|
61
82
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
83
|
+
// lr-e03635: split a models array into { latest, older } tiers.
|
|
84
|
+
//
|
|
85
|
+
// Both vendor adapters attach isLatest per model at the source (Codex from
|
|
86
|
+
// model/list's "upgrade" field, Claude from runtime ID version-ordering — see
|
|
87
|
+
// lib/yoke/adapters/claude.js deriveClaudeLatestTiers). A model with no
|
|
88
|
+
// isLatest field at all (an older/unenriched shape) is treated as latest —
|
|
89
|
+
// never hidden by a field it doesn't carry.
|
|
90
|
+
//
|
|
91
|
+
// Single shared partition function so every picker surface (renderModelList
|
|
92
|
+
// below and app-panels.js's session-chip rebuildModelList) applies identical
|
|
93
|
+
// tiering logic.
|
|
94
|
+
export function splitModelsByTier(models) {
|
|
95
|
+
var latest = [];
|
|
96
|
+
var older = [];
|
|
97
|
+
for (var i = 0; i < (models || []).length; i++) {
|
|
98
|
+
var m = models[i];
|
|
99
|
+
var isLatest = (m && typeof m === "object") ? (m.isLatest !== false) : true;
|
|
100
|
+
if (isLatest) latest.push(m);
|
|
101
|
+
else older.push(m);
|
|
102
|
+
}
|
|
103
|
+
return { latest: latest, older: older };
|
|
65
104
|
}
|
|
66
105
|
|
|
67
|
-
//
|
|
68
|
-
//
|
|
106
|
+
// Build one `.settings-model-item` row. Shared by the always-visible latest
|
|
107
|
+
// list and the collapsible older-models body so both render identically.
|
|
108
|
+
function buildModelItem(m, currentModel, listEl, opts) {
|
|
109
|
+
var value = m.value || "";
|
|
110
|
+
var label = m.displayName || value;
|
|
111
|
+
var item = document.createElement("div");
|
|
112
|
+
// lr-d3817f: a retired catalog entry is filtered out entirely upstream
|
|
113
|
+
// (model-catalog.js's filterSelectableCatalogModels) and never reaches
|
|
114
|
+
// this function — there is no isRetired/disabled row rendering here
|
|
115
|
+
// anymore. Only deprecated (still-runnable) entries carry a marker.
|
|
116
|
+
item.className = "settings-model-item" + (value === currentModel ? " active" : "");
|
|
117
|
+
item.dataset.model = value;
|
|
118
|
+
|
|
119
|
+
var nameSpan = document.createElement("span");
|
|
120
|
+
nameSpan.className = "settings-model-name";
|
|
121
|
+
nameSpan.textContent = label;
|
|
122
|
+
item.appendChild(nameSpan);
|
|
123
|
+
|
|
124
|
+
// lr-f22787: entries sourced from the release-time-generated catalog
|
|
125
|
+
// (not the vendor's live enumeration) get a small non-blocking marker —
|
|
126
|
+
// shown, never hidden, so the operator can still pick an older version
|
|
127
|
+
// while knowing it wasn't independently confirmed by this session's live
|
|
128
|
+
// vendor check.
|
|
129
|
+
if (m && m.fromCatalog) {
|
|
130
|
+
var catalogBadge = document.createElement("span");
|
|
131
|
+
catalogBadge.className = "settings-model-catalog-badge";
|
|
132
|
+
catalogBadge.textContent = "Catalog";
|
|
133
|
+
item.appendChild(catalogBadge);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// lr-f22787: deprecated (not retired) entries still run — marker only,
|
|
137
|
+
// no disabling. Retired entries never reach this function (lr-d3817f).
|
|
138
|
+
if (m && m.isDeprecated) {
|
|
139
|
+
var deprecatedBadge = document.createElement("span");
|
|
140
|
+
deprecatedBadge.className = "settings-model-deprecated-badge";
|
|
141
|
+
deprecatedBadge.textContent = "Deprecated";
|
|
142
|
+
item.appendChild(deprecatedBadge);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
var desc = getModelDesc(value);
|
|
146
|
+
if (desc) {
|
|
147
|
+
var descSpan = document.createElement("span");
|
|
148
|
+
descSpan.className = "settings-model-desc";
|
|
149
|
+
descSpan.textContent = desc;
|
|
150
|
+
item.appendChild(descSpan);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
item.addEventListener("click", function () {
|
|
154
|
+
opts.sendMsg(opts.modelMsgType, { model: value });
|
|
155
|
+
var items = listEl.querySelectorAll(".settings-model-item");
|
|
156
|
+
for (var j = 0; j < items.length; j++) items[j].classList.remove("active");
|
|
157
|
+
item.classList.add("active");
|
|
158
|
+
if (opts.onModelSelect) opts.onModelSelect(value);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
return item;
|
|
162
|
+
}
|
|
69
163
|
|
|
70
164
|
/**
|
|
71
165
|
* Render model list into `${prefix}-model-list`
|
|
72
166
|
* @param {string} prefix - Element ID prefix
|
|
73
|
-
* @param {object} opts - { models, currentModel, sendMsg, onModelSelect }
|
|
167
|
+
* @param {object} opts - { models, currentModel, sendMsg, onModelSelect, scopeLabel }
|
|
74
168
|
*/
|
|
75
169
|
export function renderModelList(prefix, opts) {
|
|
76
170
|
var listEl = document.getElementById(prefix + "-model-list");
|
|
77
171
|
if (!listEl) return;
|
|
78
172
|
|
|
173
|
+
renderScopeLabel(prefix, opts.scopeLabel);
|
|
174
|
+
|
|
79
175
|
var models = opts.models || [];
|
|
80
176
|
var currentModel = opts.currentModel || "";
|
|
81
177
|
|
|
@@ -85,38 +181,52 @@ export function renderModelList(prefix, opts) {
|
|
|
85
181
|
return;
|
|
86
182
|
}
|
|
87
183
|
|
|
88
|
-
|
|
89
|
-
(function (m) {
|
|
90
|
-
var value = m.value || "";
|
|
91
|
-
var label = m.displayName || value;
|
|
92
|
-
var item = document.createElement("div");
|
|
93
|
-
item.className = "settings-model-item" + (value === currentModel ? " active" : "");
|
|
94
|
-
item.dataset.model = value;
|
|
184
|
+
var tiers = splitModelsByTier(models);
|
|
95
185
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
item.appendChild(nameSpan);
|
|
186
|
+
for (var i = 0; i < tiers.latest.length; i++) {
|
|
187
|
+
listEl.appendChild(buildModelItem(tiers.latest[i], currentModel, listEl, opts));
|
|
188
|
+
}
|
|
100
189
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
190
|
+
// lr-e03635: empty-disclosure rule — if the vendor reports no older
|
|
191
|
+
// models, the disclosure must be ABSENT, not present-and-empty.
|
|
192
|
+
if (tiers.older.length > 0) {
|
|
193
|
+
// Reuse the existing in-section collapsible "Advanced" disclosure pattern
|
|
194
|
+
// (aria-expanded toggle + hidden body) rather than inventing a new one —
|
|
195
|
+
// see lib/public/index.html's settings-advanced-memory-toggle/-body for
|
|
196
|
+
// the reference implementation this mirrors.
|
|
197
|
+
var toggle = document.createElement("button");
|
|
198
|
+
toggle.type = "button";
|
|
199
|
+
toggle.className = "settings-older-models-toggle";
|
|
200
|
+
toggle.setAttribute("aria-expanded", "false");
|
|
201
|
+
|
|
202
|
+
var toggleLabel = document.createElement("span");
|
|
203
|
+
toggleLabel.textContent = "Older models";
|
|
204
|
+
toggle.appendChild(toggleLabel);
|
|
205
|
+
|
|
206
|
+
var chevron = document.createElement("i");
|
|
207
|
+
chevron.setAttribute("data-lucide", "chevron-right");
|
|
208
|
+
chevron.className = "settings-adv-chevron";
|
|
209
|
+
toggle.appendChild(chevron);
|
|
210
|
+
|
|
211
|
+
var body = document.createElement("div");
|
|
212
|
+
body.className = "settings-older-models-body hidden";
|
|
213
|
+
|
|
214
|
+
for (var k = 0; k < tiers.older.length; k++) {
|
|
215
|
+
body.appendChild(buildModelItem(tiers.older[k], currentModel, listEl, opts));
|
|
216
|
+
}
|
|
108
217
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
218
|
+
toggle.addEventListener("click", function () {
|
|
219
|
+
var isOpen = !body.classList.contains("hidden");
|
|
220
|
+
body.classList.toggle("hidden", isOpen);
|
|
221
|
+
toggle.setAttribute("aria-expanded", String(!isOpen));
|
|
222
|
+
chevron.style.transform = isOpen ? "" : "rotate(90deg)";
|
|
223
|
+
});
|
|
116
224
|
|
|
117
|
-
|
|
118
|
-
|
|
225
|
+
listEl.appendChild(toggle);
|
|
226
|
+
listEl.appendChild(body);
|
|
119
227
|
}
|
|
228
|
+
|
|
229
|
+
refreshIcons(listEl);
|
|
120
230
|
}
|
|
121
231
|
|
|
122
232
|
/**
|