@clagentic/console 1.8.0 → 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.
Files changed (35) hide show
  1. package/lib/build-sha.json +2 -2
  2. package/lib/generated/claude-model-catalog.json +180 -0
  3. package/lib/model-catalog.js +202 -0
  4. package/lib/model-context-windows.js +9 -0
  5. package/lib/model-families.js +243 -0
  6. package/lib/project-connection.js +16 -4
  7. package/lib/project-sessions.js +102 -18
  8. package/lib/project.js +4 -0
  9. package/lib/public/css/menus.css +67 -0
  10. package/lib/public/css/server-settings.css +72 -0
  11. package/lib/public/index.html +3 -0
  12. package/lib/public/modules/app-loop-ui.js +4 -0
  13. package/lib/public/modules/app-messages.js +29 -4
  14. package/lib/public/modules/app-panels.js +93 -24
  15. package/lib/public/modules/app-rate-limit.js +1 -1
  16. package/lib/public/modules/model-context-windows.js +9 -0
  17. package/lib/public/modules/model-families.js +230 -0
  18. package/lib/public/modules/project-settings.js +1 -0
  19. package/lib/public/modules/scheduler.js +5 -0
  20. package/lib/public/modules/server-settings.js +14 -12
  21. package/lib/public/modules/settings-defaults.js +151 -41
  22. package/lib/public/modules/tools.js +38 -0
  23. package/lib/sdk-bridge.js +88 -13
  24. package/lib/sdk-message-processor.js +128 -3
  25. package/lib/server.js +55 -0
  26. package/lib/session-activity.js +282 -0
  27. package/lib/sessions.js +58 -3
  28. package/lib/terminal-manager.js +40 -0
  29. package/lib/utils.js +44 -0
  30. package/lib/ws-schema.js +1 -0
  31. package/lib/yoke/adapters/claude-worker.js +6 -2
  32. package/lib/yoke/adapters/claude.js +377 -87
  33. package/lib/yoke/adapters/codex.js +20 -0
  34. package/package.json +1 -1
  35. package/scripts/generate-model-catalog.js +337 -0
@@ -144,10 +144,19 @@ function attachConnection(ctx) {
144
144
  if (sm.slashCommands) {
145
145
  sendTo(ws, { type: "slash_commands", commands: sm.slashCommands });
146
146
  }
147
- if (sm.currentModel) {
148
- sendTo(ws, { type: "model_info", model: sm.currentModel, models: initialModels, vendor: initialVendor, availableVendors: sm.availableVendors || [], installedVendors: sm.installedVendors || [] });
147
+ // lr-041af8: hydrate from the session this client is about to restore
148
+ // into (restoredActive, resolved above), not the shared project/global
149
+ // default. Every reconnect/page-load previously hydrated the chip from
150
+ // sm.currentModel regardless of which model the restored session had
151
+ // actually persisted (sessions.js's buildMetaLine/loadSessions round-trip
152
+ // it correctly to disk — only this display path never consulted it) —
153
+ // the root cause of "picked opus 4.7, session ran on it, chip still says
154
+ // sonnet after a reconnect." See effectiveSessionModel() in sessions.js.
155
+ var _initialModel = sm.effectiveSessionModel(restoredActive);
156
+ if (_initialModel) {
157
+ sendTo(ws, { type: "model_info", model: _initialModel, models: initialModels, vendor: initialVendor, availableVendors: sm.availableVendors || [], installedVendors: sm.installedVendors || [] });
149
158
  }
150
- sendTo(ws, { type: "config_state", model: sm.currentModel || "", mode: sm.currentPermissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
159
+ sendTo(ws, { type: "config_state", model: _initialModel, mode: sm.currentPermissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
151
160
  sendTo(ws, Object.assign({ type: "codex_config" }, getCodexConfig(sm)));
152
161
  sendTo(ws, { type: "term_list", terminals: tm.list(ws) });
153
162
  // Context sources sent after session is resolved (per-session storage)
@@ -217,7 +226,10 @@ function attachConnection(ctx) {
217
226
  // matches how every other index/count in the wire contract is derived
218
227
  // post-lr-2ea2a7.
219
228
  var _hasHistory = ((active._historyBaseIndex || 0) + active.history.length) > 0;
220
- sendTo(ws, { type: "session_switched", id: active.localId, cliSessionId: active.cliSessionId || null, loop: active.loop || null, vendor: active.vendor || null, hasHistory: _hasHistory, capabilities: _vendorCaps, agentName: active.agentName || null });
229
+ // lr-041af8: carry the restored session's own effective model — see
230
+ // effectiveSessionModel() in sessions.js and the model_info/config_state
231
+ // fix above in this same connect handler.
232
+ sendTo(ws, { type: "session_switched", id: active.localId, cliSessionId: active.cliSessionId || null, loop: active.loop || null, vendor: active.vendor || null, model: sm.effectiveSessionModel(active), hasHistory: _hasHistory, capabilities: _vendorCaps, agentName: active.agentName || null });
221
233
  // Send per-session context sources
222
234
  var sessionSources = loadContextSources(slug, active.localId);
223
235
  sendTo(ws, { type: "context_sources_state", active: sessionSources });
@@ -7,6 +7,7 @@ var liteDetect = require("./lite-detect");
7
7
  var { readMemAvailableMB } = require("./sdk-bridge");
8
8
  var agentsModule = require("./agents");
9
9
  var agentsFavorites = require("./agents-favorites");
10
+ var sessionActivity = require("./session-activity");
10
11
  // Kick off SDK agent discovery in the background at module load.
11
12
  // Errors are swallowed inside refresh(); the cache starts empty and fills
12
13
  // when the SDK subprocess completes initialization (~9s on this box).
@@ -174,10 +175,17 @@ function attachSessions(ctx) {
174
175
  catch (e) { /* recents are best-effort */ }
175
176
  }
176
177
  var newSess = sm.createSession(sessionOpts, ws);
177
- // Seed per-session model/mode from project defaults so the first query
178
- // uses the right values even before the user changes anything.
179
- newSess.model = sm.currentModel || null;
180
- newSess.permissionMode = sm.currentPermissionMode || null;
178
+ // Seed per-session model/mode from the project/global DEFAULT
179
+ // (sm._savedDefaultModel / sm._savedDefaultMode, populated at project
180
+ // startup from onGetProjectDefaultModel/onGetServerDefaultModel — see
181
+ // lib/project.js) so the first query uses the right values even before
182
+ // the user changes anything. Seeding from sm.currentModel/
183
+ // sm.currentPermissionMode directly is wrong (lr-db0437): those two
184
+ // fields also mirror whatever model/mode the CURRENTLY ACTIVE session
185
+ // happens to be using, so a brand-new session would inherit another
186
+ // session's in-progress choice instead of the actual saved default.
187
+ newSess.model = sm._savedDefaultModel || null;
188
+ newSess.permissionMode = sm._savedDefaultMode || null;
181
189
  ws._clayActiveSession = newSess.localId;
182
190
  // Apply project-level email defaults to new session
183
191
  if (typeof ctx._email === "object" && ctx._email.getEmailDefaults) {
@@ -348,6 +356,21 @@ function attachSessions(ctx) {
348
356
  return true;
349
357
  }
350
358
 
359
+ // lr-13c047 (Badge A non-switch clear path): let a client dismiss the
360
+ // Projects-tab cross-project unread badge for a specific project without
361
+ // requiring a full switch/connect to that project — previously the only
362
+ // clear path was connect-time (lib/server.js onConnection) or the
363
+ // same-project switchSession zeroing. slug is validated against the
364
+ // live project registry indirectly: markCrossProjectRead only mutates
365
+ // this ws's own crossProjectUnread map, so an invalid/unknown slug is
366
+ // harmless (its prefix simply matches nothing).
367
+ if (msg.type === "mark_cross_project_read") {
368
+ if (opts && typeof opts.markCrossProjectRead === "function" && typeof msg.slug === "string" && msg.slug) {
369
+ opts.markCrossProjectRead(ws, msg.slug);
370
+ }
371
+ return true;
372
+ }
373
+
351
374
  if (msg.type === "bulk_delete_sessions") {
352
375
  if (!Array.isArray(msg.sessionIds) || msg.sessionIds.length === 0) return true;
353
376
  var deletableIds = [];
@@ -536,8 +559,13 @@ function attachSessions(ctx) {
536
559
  // Re-sync chip state to the incoming session's own model/mode.
537
560
  // Sessions track their own model/permissionMode so the chip shows
538
561
  // per-session values rather than the shared project state.
562
+ // lr-041af8: routed through the shared effectiveSessionModel() helper
563
+ // (sessions.js) instead of re-deriving the same session-model-first
564
+ // fallback here — this was the one sender that already had the
565
+ // precedence right; sharing it prevents a future sender from
566
+ // reintroducing the sm.currentModel-only bug this task fixes.
539
567
  var _swSess = sm.sessions.get(msg.id);
540
- var _swModel = (_swSess && _swSess.model) || sm.currentModel || "";
568
+ var _swModel = sm.effectiveSessionModel(_swSess);
541
569
  var _swMode = (_swSess && _swSess.permissionMode) || sm.currentPermissionMode || "default";
542
570
  sendTo(ws, { type: "config_state", model: _swModel, mode: _swMode, effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
543
571
  var swPresKey = ws._clayUser ? ws._clayUser.id : "_default";
@@ -703,9 +731,30 @@ function attachSessions(ctx) {
703
731
  if (msg.type === "set_model" && msg.model) {
704
732
  var session = getSessionForWs(ws);
705
733
  if (session) {
706
- sdk.setModel(session, msg.model).then(function () {
734
+ sdk.setModel(session, msg.model).then(function (result) {
735
+ // lr-f22787: sdk.setModel now reports { ok, error } instead of
736
+ // always resolving as if the switch succeeded (it used to swallow
737
+ // an invalid/unentitled model ID with no signal back to the
738
+ // requesting client — see sdk-bridge.js's setModel). A missing
739
+ // `result` (older/no-op session-not-active branch) is still ok.
740
+ if (result && result.ok === false) {
741
+ sendTo(ws, { type: "error", text: "Failed to switch model: " + result.error });
742
+ return;
743
+ }
744
+ // lr-db0437: persist session.model to disk (meta line) so a
745
+ // daemon restart resumes with the same model instead of falling
746
+ // back to the project/global default (acceptance criterion:
747
+ // "session picked model X, daemon restarts, session still uses X").
748
+ sm.saveSessionFile(session);
707
749
  // Targeted reply — only this client's chip updates, not all sessions.
708
- sendTo(ws, { type: "config_state", model: session.model || sm.currentModel || "", mode: session.permissionMode || sm.currentPermissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
750
+ // lr-041af8: shared helper (see switch_session above and
751
+ // effectiveSessionModel() in sessions.js).
752
+ sendTo(ws, { type: "config_state", model: sm.effectiveSessionModel(session), mode: session.permissionMode || sm.currentPermissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
753
+ }).catch(function (e) {
754
+ // Defensive: setModel is not expected to reject (its own try/catch
755
+ // returns { ok: false } instead), but a rejection must still reach
756
+ // the client rather than vanish silently.
757
+ sendTo(ws, { type: "error", text: "Failed to switch model: " + (e.message || e) });
709
758
  });
710
759
  }
711
760
  return true;
@@ -724,6 +773,13 @@ function attachSessions(ctx) {
724
773
  " is bound to '" + vendorSession.vendor + "', refused rebind to '" + msg.vendor + "'");
725
774
  } else {
726
775
  vendorSession.vendor = msg.vendor;
776
+ // lr-041af8: clear THIS session's own model too, not just the
777
+ // shared sm.currentModel below — the old model belongs to the old
778
+ // vendor and must not survive the rebind on the session itself
779
+ // (previously only sm.currentModel was cleared, so a session with
780
+ // its own persisted .model kept showing a foreign-vendor model ID
781
+ // after switching vendor).
782
+ vendorSession.model = null;
727
783
  // Clear the shared model so the next query uses the vendor's default
728
784
  // instead of leaking the previous vendor's model into a fresh session.
729
785
  if (sm.currentModel) {
@@ -752,7 +808,15 @@ function attachSessions(ctx) {
752
808
  availableVendors: sm.availableVendors || [],
753
809
  installedVendors: sm.installedVendors || [],
754
810
  });
755
- send({ type: "config_state", model: sm.currentModel || "", mode: sm.currentPermissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
811
+ // lr-041af8: targeted, not broadcast — set_vendor acts on the
812
+ // requesting client's own session (vendorSession above); broadcasting
813
+ // this reply to every connected client via send() previously stomped
814
+ // on every OTHER session's displayed model with this session's
815
+ // (now-cleared) model, the same cross-session bleed class this task
816
+ // fixes elsewhere. vendorSession may be null (no active session for
817
+ // this ws yet) — effectiveSessionModel handles that by falling back
818
+ // to the shared default, same as every other targeted sender.
819
+ sendTo(ws, { type: "config_state", model: sm.effectiveSessionModel(vendorSession), mode: sm.currentPermissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
756
820
  }
757
821
  return true;
758
822
  }
@@ -761,10 +825,16 @@ function attachSessions(ctx) {
761
825
  if (typeof opts.onSetServerDefaultModel === "function") {
762
826
  opts.onSetServerDefaultModel(msg.model);
763
827
  }
764
- var session = getSessionForWs(ws);
765
- if (session) {
766
- sdk.setModel(session, msg.model);
767
- }
828
+ // lr-db0437: update the DEFAULT only — never the live session's model.
829
+ // A running session's model is set-in-stone until the user explicitly
830
+ // changes it via set_model; changing the server default must not
831
+ // silently retarget whatever session happens to be focused (that was
832
+ // the "reverse bleed" root cause this task fixes). sm.currentModel is
833
+ // consulted by new_session (this file) and by startQuery's fallback
834
+ // (sdk-bridge.js) as the project/global default.
835
+ sm.currentModel = msg.model;
836
+ sm._savedDefaultModel = msg.model;
837
+ send({ type: "config_state", model: sm.currentModel || "", mode: sm.currentPermissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
768
838
  return true;
769
839
  }
770
840
 
@@ -772,10 +842,10 @@ function attachSessions(ctx) {
772
842
  if (typeof opts.onSetProjectDefaultModel === "function") {
773
843
  opts.onSetProjectDefaultModel(slug, msg.model);
774
844
  }
775
- var session = getSessionForWs(ws);
776
- if (session) {
777
- sdk.setModel(session, msg.model);
778
- }
845
+ // lr-db0437: same as set_server_default_model above — default-only write.
846
+ sm.currentModel = msg.model;
847
+ sm._savedDefaultModel = msg.model;
848
+ send({ type: "config_state", model: sm.currentModel || "", mode: sm.currentPermissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
779
849
  return true;
780
850
  }
781
851
 
@@ -784,7 +854,8 @@ function attachSessions(ctx) {
784
854
  if (session) {
785
855
  sdk.setPermissionMode(session, msg.mode).then(function () {
786
856
  // Targeted reply — only update the requesting client's chip.
787
- sendTo(ws, { type: "config_state", model: session.model || sm.currentModel || "", mode: session.permissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
857
+ // lr-041af8: shared helper (see effectiveSessionModel() in sessions.js).
858
+ sendTo(ws, { type: "config_state", model: sm.effectiveSessionModel(session), mode: session.permissionMode || "default", effort: sm.currentEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
788
859
  });
789
860
  }
790
861
  return true;
@@ -1006,6 +1077,16 @@ function attachSessions(ctx) {
1006
1077
  session.sentToolResults = {};
1007
1078
  session.pendingPermissions = {};
1008
1079
  session.pendingAskUser = {};
1080
+ // lr-9bcd7b: a rewind destroys the in-flight query outright (the
1081
+ // queryInstance null-out above), so nothing can genuinely still be
1082
+ // running for this session afterward. Unlike the reconciliation
1083
+ // sites in sdk-message-processor.js/sdk-bridge.js, isProcessing:false
1084
+ // here is correct even without consulting the registry -- but the
1085
+ // registry itself must still be reset wholesale (leak-resistance
1086
+ // layer 4: never merge stale pre-rewind tokens into the post-rewind
1087
+ // session), or a Task token acquired before the rewind would
1088
+ // linger and make a LATER query look active for the wrong reason.
1089
+ sessionActivity.replaceRegistry(session);
1009
1090
  session.isProcessing = false;
1010
1091
  onProcessingChanged();
1011
1092
 
@@ -1324,7 +1405,10 @@ function attachSessions(ctx) {
1324
1405
  if (decision === "allow" || decision === "allow_always") {
1325
1406
  if (decision === "allow_always") {
1326
1407
  if (!session.allowedTools) session.allowedTools = {};
1327
- session.allowedTools[pending.toolName] = true;
1408
+ // lr-f969dc: keyed on toolName + input discriminator (not bare
1409
+ // toolName) so a Skill grant scopes to the specific skill that was
1410
+ // actually approved rather than silently authorizing every skill.
1411
+ session.allowedTools[utils.permissionGrantKey(pending.toolName, pending.toolInput)] = true;
1328
1412
  // Flush immediately (lr-8b2e) so the grant survives daemon restart /
1329
1413
  // resume-by-cliSessionId rehydration even without a later save
1330
1414
  // trigger — previously this lived only in the in-memory session
package/lib/project.js CHANGED
@@ -175,6 +175,9 @@ function createProjectContext(opts) {
175
175
  var getScheduleCount = opts.getScheduleCount || function () { return 0; };
176
176
  var onProcessingChanged = opts.onProcessingChanged || function () {};
177
177
  var onSessionDone = opts.onSessionDone || function () {};
178
+ // lr-13c047: fired when a session is deleted so server.js can prune the
179
+ // corresponding crossProjectUnread entry (Badge A prune-on-delete fix).
180
+ var onSessionDeleted = opts.onSessionDeleted || function () {};
178
181
  var onPresenceChange = opts.onPresenceChange || function () {};
179
182
  var updateChannel = opts.updateChannel || "stable";
180
183
  var onSetUpdateChannel = opts.onSetUpdateChannel || null;
@@ -437,6 +440,7 @@ function createProjectContext(opts) {
437
440
  }
438
441
  },
439
442
  onSessionDone: onSessionDone,
443
+ onSessionDeleted: onSessionDeleted,
440
444
  historyInMemMax: historyInMemMax,
441
445
  });
442
446
  sm.availableVendors = Object.keys(adapters);
@@ -519,6 +519,19 @@
519
519
  padding: 4px 14px 4px;
520
520
  }
521
521
 
522
+ /* lr-db0437: states which scope a model/mode picker applies to — "This
523
+ session only" / "Default for new sessions in this project" / "Server
524
+ default" / loop-scoped. Shared across the config-chip popover, project
525
+ settings, server settings, Ralph-loop preview, and scheduler task tabs
526
+ (some of those render inside .settings-card, not .config-section, hence
527
+ the standalone rule rather than nesting under .config-section-label). */
528
+ .config-scope-label {
529
+ font-size: 11px;
530
+ color: var(--text-dimmer);
531
+ padding: 0 14px 6px;
532
+ font-style: italic;
533
+ }
534
+
522
535
  .config-radio-list {
523
536
  display: flex;
524
537
  flex-direction: column;
@@ -544,6 +557,60 @@
544
557
  .config-radio-item:hover { background: rgba(var(--overlay-rgb),0.05); color: var(--text); }
545
558
  .config-radio-item.active { color: var(--accent); font-weight: 600; }
546
559
 
560
+ /* lr-f22787: same catalog-sourced marker as .settings-model-catalog-badge
561
+ (server-settings.css), for the session-chip model picker surface. */
562
+ .config-model-catalog-badge {
563
+ font-size: 10px;
564
+ font-weight: 600;
565
+ text-transform: uppercase;
566
+ letter-spacing: 0.04em;
567
+ color: var(--text-dimmer);
568
+ }
569
+
570
+ /* lr-f22787 (retired-disabled variant removed by lr-d3817f — retired
571
+ entries are filtered out of the picker entirely, never rendered): a
572
+ deprecated (still-runnable) entry keeps a marker only. */
573
+ .config-model-deprecated-badge {
574
+ font-size: 10px;
575
+ font-weight: 600;
576
+ text-transform: uppercase;
577
+ letter-spacing: 0.04em;
578
+ color: var(--warning, #e5a83d);
579
+ }
580
+
581
+ /* --- Older models disclosure (lr-e03635) — session-chip model picker's
582
+ collapsible escape hatch, mirroring the settings-panel disclosure
583
+ (.settings-older-models-toggle/-body in server-settings.css) for the
584
+ .config-radio-list surface. */
585
+ .config-older-models-toggle {
586
+ display: flex;
587
+ align-items: center;
588
+ justify-content: space-between;
589
+ width: 100%;
590
+ padding: 8px 14px;
591
+ border: none;
592
+ background: none;
593
+ color: var(--text-muted);
594
+ font-family: inherit;
595
+ font-size: 12px;
596
+ cursor: pointer;
597
+ text-align: left;
598
+ }
599
+
600
+ .config-older-models-toggle:hover { color: var(--text-secondary); background: rgba(var(--overlay-rgb),0.05); }
601
+
602
+ .config-older-models-toggle .settings-adv-chevron {
603
+ width: 14px;
604
+ height: 14px;
605
+ flex-shrink: 0;
606
+ transition: transform 0.15s;
607
+ }
608
+
609
+ .config-older-models-body {
610
+ display: flex;
611
+ flex-direction: column;
612
+ }
613
+
547
614
  /* Segmented control for effort */
548
615
  .config-segmented {
549
616
  display: flex;
@@ -424,6 +424,37 @@
424
424
  transform: translateY(-50%);
425
425
  }
426
426
 
427
+ /* lr-f22787: marks a model entry sourced from the release-time-generated
428
+ catalog (lib/generated/claude-model-catalog.json) rather than the
429
+ vendor's live enumeration — shown, never hidden, just visually
430
+ distinguished (PR body point (c)). */
431
+ .settings-model-catalog-badge {
432
+ font-size: 10px;
433
+ font-weight: 600;
434
+ text-transform: uppercase;
435
+ letter-spacing: 0.04em;
436
+ color: var(--text-dimmer);
437
+ background: rgba(var(--overlay-rgb), 0.08);
438
+ border-radius: 4px;
439
+ padding: 1px 5px;
440
+ margin-left: 6px;
441
+ }
442
+
443
+ /* lr-f22787 (retired-disabled variant removed by lr-d3817f — retired
444
+ entries are filtered out of the picker entirely, never rendered): a
445
+ deprecated (still-runnable) entry keeps a marker only. */
446
+ .settings-model-deprecated-badge {
447
+ font-size: 10px;
448
+ font-weight: 600;
449
+ text-transform: uppercase;
450
+ letter-spacing: 0.04em;
451
+ color: var(--warning, #e5a83d);
452
+ background: rgba(var(--warning-rgb, 229, 168, 61), 0.1);
453
+ border-radius: 4px;
454
+ padding: 1px 5px;
455
+ margin-left: 6px;
456
+ }
457
+
427
458
  .settings-model-name {
428
459
  font-size: 13px;
429
460
  font-weight: 500;
@@ -440,6 +471,47 @@
440
471
  color: var(--text-muted);
441
472
  }
442
473
 
474
+ /* --- Older models disclosure (lr-e03635) ---
475
+ Mirrors the in-section "Advanced" collapsible pattern (see
476
+ #settings-advanced-memory-toggle/-body) so the model picker's escape
477
+ hatch to older models behaves and looks identical to the existing
478
+ disclosure convention rather than inventing a new one. */
479
+ .settings-older-models-toggle {
480
+ display: flex;
481
+ align-items: center;
482
+ justify-content: space-between;
483
+ width: 100%;
484
+ margin-top: 4px;
485
+ padding: 8px 12px;
486
+ border: none;
487
+ background: none;
488
+ color: var(--text-dimmer);
489
+ font-family: inherit;
490
+ font-size: 12px;
491
+ cursor: pointer;
492
+ text-align: left;
493
+ border-radius: 8px;
494
+ }
495
+
496
+ .settings-older-models-toggle:hover {
497
+ color: var(--text-secondary);
498
+ background: rgba(var(--overlay-rgb), 0.04);
499
+ }
500
+
501
+ .settings-older-models-toggle .settings-adv-chevron {
502
+ width: 14px;
503
+ height: 14px;
504
+ flex-shrink: 0;
505
+ transition: transform 0.15s;
506
+ }
507
+
508
+ .settings-older-models-body {
509
+ display: flex;
510
+ flex-direction: column;
511
+ gap: 4px;
512
+ margin-top: 4px;
513
+ }
514
+
443
515
  /* --- Button group --- */
444
516
  .settings-btn-group {
445
517
  display: flex;
@@ -435,6 +435,7 @@
435
435
  <div id="config-popover" class="hidden">
436
436
  <div class="config-section">
437
437
  <div class="config-section-label">MODEL</div>
438
+ <div id="config-model-scope" class="config-scope-label">This session only</div>
438
439
  <div id="config-model-list" class="config-radio-list"></div>
439
440
  </div>
440
441
  <div class="config-section">
@@ -653,6 +654,7 @@
653
654
  <div class="settings-field">
654
655
  <label class="settings-label">Model</label>
655
656
  <div class="settings-hint">Choose the Claude model to use. Larger models are slower but more capable.</div>
657
+ <div id="ps-model-scope" class="config-scope-label"></div>
656
658
  <div id="ps-model-list" class="settings-model-list"></div>
657
659
  </div>
658
660
  </div>
@@ -1176,6 +1178,7 @@
1176
1178
  <div class="settings-field">
1177
1179
  <label class="settings-label">Model</label>
1178
1180
  <div class="settings-hint">Choose the Claude model to use. Larger models are slower but more capable.</div>
1181
+ <div id="ss-model-scope" class="config-scope-label"></div>
1179
1182
  <div id="ss-model-list" class="settings-model-list"></div>
1180
1183
  </div>
1181
1184
  </div>
@@ -772,6 +772,7 @@ function renderPreviewModelTab(bodyEl) {
772
772
  '<div class="settings-card"><div class="settings-field">' +
773
773
  '<label class="settings-label">Model</label>' +
774
774
  '<div class="settings-hint">Choose the Claude model for this loop.</div>' +
775
+ '<div id="rp-model-scope" class="config-scope-label"></div>' +
775
776
  '<div id="rp-model-list" class="settings-model-list"></div>' +
776
777
  '</div></div>' +
777
778
  '<div class="settings-card"><div class="settings-field">' +
@@ -818,6 +819,9 @@ function renderPreviewModelTab(bodyEl) {
818
819
  modelMsgType: "rp_set_model",
819
820
  modeMsgType: "rp_set_mode",
820
821
  effortMsgType: "rp_set_effort",
822
+ // lr-db0437: loop-scoped — this picker configures the Ralph-loop being
823
+ // created, not the current session or any project/server default.
824
+ scopeLabel: "Loop default (this Ralph-loop only)",
821
825
  };
822
826
 
823
827
  renderModelList("rp", opts);
@@ -35,7 +35,7 @@ import { handleAgentsList, handleAgentFavoriteToggled } from './agent-picker.js'
35
35
  import { handleProjectAgentsList, requestProjectAgents } from './at-agents.js';
36
36
  import { handleFindInSessionResults } from './session-search.js';
37
37
  import { handleInputSync, autoResize, resetAutoResize, builtinCommands, setScheduleBtnDisabled } from './input.js';
38
- import { startThinking, appendThinking, stopThinking, resetThinkingGroup, createToolItem, updateToolExecuting, updateToolResult, markAllToolsDone, closeToolGroup, removeToolFromGroup, resetToolState, getTools, getPlanContent, setPlanContent, renderPlanBanner, renderPlanCard, getTodoTools, handleTodoWrite, handleTaskCreate, handleTaskUpdate, applyDeadSessionTodoCompaction, isPlanFilePath, enableMainInput, addTurnMeta, updateSubagentActivity, addSubagentToolEntry, markSubagentDone, initSubagentStop, updateSubagentProgress, updateSubagentTaskStatus, renderAskUserQuestion, markAskUserAnswered, renderPermissionRequest, markPermissionCancelled, markPermissionResolved, renderElicitationRequest, markElicitationResolved } from './tools.js';
38
+ import { startThinking, appendThinking, stopThinking, resetThinkingGroup, createToolItem, updateToolExecuting, updateToolResult, markAllToolsDone, closeToolGroup, removeToolFromGroup, resetToolState, getTools, getPlanContent, setPlanContent, renderPlanBanner, renderPlanCard, getTodoTools, handleTodoWrite, handleTaskCreate, handleTaskUpdate, applyDeadSessionTodoCompaction, isPlanFilePath, enableMainInput, addTurnMeta, updateSubagentActivity, addSubagentToolEntry, markSubagentDone, initSubagentStop, updateSubagentProgress, updateSubagentTaskStatus, hasActiveSubagents, renderAskUserQuestion, markAskUserAnswered, renderPermissionRequest, markPermissionCancelled, markPermissionResolved, renderElicitationRequest, markElicitationResolved } from './tools.js';
39
39
  import { showDoneNotification, playDoneSound, isNotifAlertEnabled, isNotifSoundEnabled } from './notifications.js';
40
40
  import { handleFsRead, refreshIfOpen } from './filebrowser.js';
41
41
  import { isProjectSettingsOpen, refreshProjectSettingsModels, handleInstructionsRead, handleInstructionsWrite, handleProjectEnv, handleProjectEnvSaved, handleProjectSharedEnv, handleProjectSharedEnvSaved, handleProjectOwnerChanged, updateLiteVisibility, handleLiteProjectStatus, handleLiteEnrollResult, handleLiteUnenrollResult } from './project-settings.js';
@@ -647,7 +647,14 @@ registerHandlers({
647
647
  removePreThinking();
648
648
  stopThinking();
649
649
  resetThinkingGroup();
650
- setActivity(null);
650
+ // lr-1317b8 (Defect 2): this was an ungated clear-site, missed by the
651
+ // lr-255e clear-site audit. Any parent-turn assistant text delta after a
652
+ // subagent dispatch (e.g. the model narrating between tool calls) killed
653
+ // the indicator while the subagent was still genuinely running. Same
654
+ // guard as the 'result'/'done' handlers below.
655
+ if (!hasActiveSubagents()) {
656
+ setActivity(null);
657
+ }
651
658
  appendDelta(msg.text);
652
659
  },
653
660
 
@@ -799,7 +806,16 @@ registerHandlers({
799
806
  },
800
807
 
801
808
  result: function (msg) {
802
- setActivity(null);
809
+ // lr-255e: the parent turn's SDK stream ends with a normal 'result' as
810
+ // soon as a Task tool call is dispatched -- the Task itself keeps
811
+ // running as a background subagent. Clearing the activity indicator
812
+ // unconditionally here made the "thinking dots" vanish while a
813
+ // dispatched subagent was still genuinely working. Only clear it if no
814
+ // subagent is currently live; markSubagentDone() clears it once the
815
+ // last live subagent actually finishes.
816
+ if (!hasActiveSubagents()) {
817
+ setActivity(null);
818
+ }
803
819
  stopThinking();
804
820
  markAllToolsDone();
805
821
  closeToolGroup();
@@ -818,7 +834,16 @@ registerHandlers({
818
834
 
819
835
  done: function (msg) {
820
836
  removePreThinking();
821
- setActivity(null);
837
+ // lr-255e: 'done' can also fire while a backgrounded Task subagent is
838
+ // still genuinely running (task-stop/error/abort paths that bypass the
839
+ // 'result' handler never clear activeTaskToolIds). Same rule as the
840
+ // 'result' handler: don't kill the indicator out from under a live
841
+ // subagent. resetToolState() below intentionally still clears all
842
+ // per-turn tool tracking (including subagent liveness) once this
843
+ // handler is done deciding whether to clear the indicator.
844
+ if (!hasActiveSubagents()) {
845
+ setActivity(null);
846
+ }
822
847
  stopThinking();
823
848
  markAllToolsDone();
824
849
  closeToolGroup();