@clagentic/console 1.12.0 → 1.13.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 (243) hide show
  1. package/README.md +7 -1
  2. package/bin/cli.js +18 -15
  3. package/lib/agent-roster-ws.js +38 -13
  4. package/lib/agent-roster.js +111 -12
  5. package/lib/agents.js +68 -33
  6. package/lib/atomic-install.js +334 -0
  7. package/lib/build-changes.js +33 -4
  8. package/lib/build-sha.json +2 -2
  9. package/lib/build-update-offer.js +12 -0
  10. package/lib/chat-width.js +31 -0
  11. package/lib/cli/agent-usage.js +126 -0
  12. package/lib/cli/arg-validation.js +1 -1
  13. package/lib/cli/compact-output.js +69 -0
  14. package/lib/cli/ipc-subcommands.js +92 -67
  15. package/lib/cli/output.js +28 -0
  16. package/lib/cli/restart-verb.js +132 -0
  17. package/lib/cli/schedule-input-subcommands.js +45 -8
  18. package/lib/cli/session-subcommands.js +37 -11
  19. package/lib/cli/settings-subcommands.js +74 -0
  20. package/lib/cli-transcript-title.js +56 -3
  21. package/lib/client-files.js +79 -0
  22. package/lib/daemon.js +100 -28
  23. package/lib/default-avatar-color.js +4 -0
  24. package/lib/drain.js +58 -10
  25. package/lib/mcp-tool-input.js +2 -2
  26. package/lib/model-families.js +49 -1
  27. package/lib/notify/type-registry.js +4 -0
  28. package/lib/notify/types.js +7 -4
  29. package/lib/pages.js +13 -63
  30. package/lib/permission-summary.js +12 -16
  31. package/lib/plan-usage-reader.js +70 -0
  32. package/lib/project-connection.js +4 -2
  33. package/lib/project-filesystem.js +6 -7
  34. package/lib/project-notifications.js +55 -8
  35. package/lib/project-prompt-expiry-settings.js +42 -0
  36. package/lib/project-sessions.js +52 -0
  37. package/lib/project-settings-gate.js +98 -0
  38. package/lib/project-user-mention.js +3 -2
  39. package/lib/project.js +1 -1
  40. package/lib/prompt-expiry-settings.js +49 -0
  41. package/lib/prompt-expiry.js +24 -3
  42. package/lib/prompt-kinds/codecs.js +6 -2
  43. package/lib/public/app.js +36 -36
  44. package/lib/public/css/admin.css +156 -170
  45. package/lib/public/css/agent-messages.css +24 -24
  46. package/lib/public/css/agent-picker.css +90 -38
  47. package/lib/public/css/agent-roster.css +61 -27
  48. package/lib/public/css/at-agents.css +10 -10
  49. package/lib/public/css/base.css +207 -184
  50. package/lib/public/css/chat-layout.css +228 -0
  51. package/lib/public/css/command-palette.css +86 -88
  52. package/lib/public/css/diagnostics.css +78 -204
  53. package/lib/public/css/diff.css +10 -10
  54. package/lib/public/css/filebrowser.css +32 -60
  55. package/lib/public/css/home-hub.css +100 -100
  56. package/lib/public/css/icon-strip.css +195 -238
  57. package/lib/public/css/input.css +191 -212
  58. package/lib/public/css/login-panel.css +16 -16
  59. package/lib/public/css/loop.css +96 -187
  60. package/lib/public/css/mention.css +49 -110
  61. package/lib/public/css/menus.css +162 -169
  62. package/lib/public/css/messages.css +49 -123
  63. package/lib/public/css/mobile-nav.css +207 -264
  64. package/lib/public/css/notifications-center.css +45 -124
  65. package/lib/public/css/overlay.css +269 -0
  66. package/lib/public/css/overlays.css +134 -156
  67. package/lib/public/css/playbook.css +41 -41
  68. package/lib/public/css/profile.css +43 -112
  69. package/lib/public/css/rewind.css +112 -112
  70. package/lib/public/css/scheduler-modal.css +27 -135
  71. package/lib/public/css/scheduler.css +204 -210
  72. package/lib/public/css/server-settings.css +173 -239
  73. package/lib/public/css/session-search.css +20 -20
  74. package/lib/public/css/settings-nav.css +197 -0
  75. package/lib/public/css/sidebar.css +213 -304
  76. package/lib/public/css/skills.css +121 -135
  77. package/lib/public/css/sticky-notes.css +114 -200
  78. package/lib/public/css/stt.css +17 -26
  79. package/lib/public/css/team-panel.css +36 -36
  80. package/lib/public/css/team-view.css +9 -9
  81. package/lib/public/css/title-bar.css +83 -100
  82. package/lib/public/css/tooltip.css +10 -10
  83. package/lib/public/css/user-settings.css +78 -131
  84. package/lib/public/css/user-shell.css +125 -29
  85. package/lib/public/index.html +178 -177
  86. package/lib/public/manifest.json +0 -2
  87. package/lib/public/modules/admin.js +54 -92
  88. package/lib/public/modules/agent-avatar.js +134 -3
  89. package/lib/public/modules/agent-messages.js +2 -1
  90. package/lib/public/modules/agent-picker.js +23 -21
  91. package/lib/public/modules/agent-roster-groups.js +128 -0
  92. package/lib/public/modules/agent-roster.js +40 -11
  93. package/lib/public/modules/app-connection.js +13 -1
  94. package/lib/public/modules/app-cursors.js +9 -9
  95. package/lib/public/modules/app-favicon.js +8 -16
  96. package/lib/public/modules/app-header.js +28 -19
  97. package/lib/public/modules/app-history-replay.js +67 -4
  98. package/lib/public/modules/app-home-hub.js +15 -0
  99. package/lib/public/modules/app-loop-ui.js +41 -47
  100. package/lib/public/modules/app-loop-wizard.js +9 -10
  101. package/lib/public/modules/app-messages.js +32 -36
  102. package/lib/public/modules/app-misc.js +22 -92
  103. package/lib/public/modules/app-modals.js +98 -0
  104. package/lib/public/modules/app-notifications.js +124 -135
  105. package/lib/public/modules/app-panels.js +28 -32
  106. package/lib/public/modules/app-projects.js +30 -40
  107. package/lib/public/modules/app-rate-limit.js +26 -9
  108. package/lib/public/modules/app-rendering.js +128 -110
  109. package/lib/public/modules/app-skills-install.js +6 -4
  110. package/lib/public/modules/assistant-identity.js +55 -0
  111. package/lib/public/modules/at-agents.js +3 -0
  112. package/lib/public/modules/build-guard.js +25 -11
  113. package/lib/public/modules/chat-width-choice.js +75 -0
  114. package/lib/public/modules/chat-width-prefs.js +52 -0
  115. package/lib/public/modules/chat-width.js +102 -0
  116. package/lib/public/modules/collapsible-text.js +36 -4
  117. package/lib/public/modules/command-palette.js +28 -34
  118. package/lib/public/modules/context-sources.js +3 -5
  119. package/lib/public/modules/diagnostics.js +130 -129
  120. package/lib/public/modules/info-panel.js +31 -0
  121. package/lib/public/modules/injected-identity.js +8 -8
  122. package/lib/public/modules/input-list-menu.js +39 -0
  123. package/lib/public/modules/input.js +22 -21
  124. package/lib/public/modules/markdown.js +10 -11
  125. package/lib/public/modules/mcp-ui.js +4 -14
  126. package/lib/public/modules/mention.js +100 -229
  127. package/lib/public/modules/message-header.js +80 -0
  128. package/lib/public/modules/message-participants.js +39 -0
  129. package/lib/public/modules/mobile-action-sheet.js +46 -0
  130. package/lib/public/modules/mobile-nav-sheet.js +104 -0
  131. package/lib/public/modules/model-families.js +41 -4
  132. package/lib/public/modules/note-order.js +39 -0
  133. package/lib/public/modules/notifications.js +35 -52
  134. package/lib/public/modules/overlay-history.js +73 -19
  135. package/lib/public/modules/overlay-menu.js +123 -0
  136. package/lib/public/modules/overlay-modal.js +186 -0
  137. package/lib/public/modules/overlay-registry.js +392 -0
  138. package/lib/public/modules/overlay-stack.js +110 -0
  139. package/lib/public/modules/overlay.js +117 -0
  140. package/lib/public/modules/popover-position.js +18 -2
  141. package/lib/public/modules/preference-sync.js +28 -0
  142. package/lib/public/modules/profile.js +24 -49
  143. package/lib/public/modules/project-settings.js +27 -172
  144. package/lib/public/modules/prompt-expiry-controls.js +46 -0
  145. package/lib/public/modules/prompt-kinds/command-summary.js +149 -0
  146. package/lib/public/modules/prompt-kinds/permission.js +70 -92
  147. package/lib/public/modules/prompts.js +1 -2
  148. package/lib/public/modules/qrcode.js +6 -21
  149. package/lib/public/modules/queued-button.js +15 -2
  150. package/lib/public/modules/rewind.js +9 -3
  151. package/lib/public/modules/schedule-time.js +32 -7
  152. package/lib/public/modules/scheduled-outbox.js +51 -18
  153. package/lib/public/modules/scheduler-config.js +87 -127
  154. package/lib/public/modules/scheduler.js +29 -26
  155. package/lib/public/modules/serialized-save.js +79 -0
  156. package/lib/public/modules/server-settings.js +75 -65
  157. package/lib/public/modules/session-grants.js +16 -19
  158. package/lib/public/modules/session-list-avatars.js +98 -0
  159. package/lib/public/modules/session-vendor-state.js +86 -0
  160. package/lib/public/modules/settings-access.js +35 -0
  161. package/lib/public/modules/settings-hub.js +125 -0
  162. package/lib/public/modules/settings-nav.js +182 -0
  163. package/lib/public/modules/shell-line.js +24 -0
  164. package/lib/public/modules/sidebar-mobile.js +151 -195
  165. package/lib/public/modules/sidebar-projects.js +88 -129
  166. package/lib/public/modules/sidebar-sessions.js +66 -34
  167. package/lib/public/modules/sidebar.js +2 -2
  168. package/lib/public/modules/skills.js +11 -26
  169. package/lib/public/modules/sticky-notes.js +19 -16
  170. package/lib/public/modules/stt.js +9 -23
  171. package/lib/public/modules/terminal.js +86 -90
  172. package/lib/public/modules/theme-choice.js +126 -0
  173. package/lib/public/modules/theme-colors.js +19 -0
  174. package/lib/public/modules/theme-prefs.js +121 -0
  175. package/lib/public/modules/theme.js +227 -605
  176. package/lib/public/modules/tool-palette.js +7 -17
  177. package/lib/public/modules/tools.js +8 -10
  178. package/lib/public/modules/user-settings.js +59 -115
  179. package/lib/public/modules/user-shell.js +9 -2
  180. package/lib/public/modules/utils.js +10 -12
  181. package/lib/public/modules/vendor-picker.js +4 -2
  182. package/lib/public/modules/vendor-registry.js +1 -2
  183. package/lib/public/style.css +3 -1
  184. package/lib/public/sw.js +9 -2
  185. package/lib/public/theme-core.js +411 -0
  186. package/lib/request-body.js +70 -0
  187. package/lib/sdk-bridge.js +227 -88
  188. package/lib/sdk-message-processor.js +44 -16
  189. package/lib/server-admin.js +198 -200
  190. package/lib/server-auth.js +16 -13
  191. package/lib/server-dm.js +4 -3
  192. package/lib/server-settings.js +177 -130
  193. package/lib/server.js +87 -36
  194. package/lib/session-background-tasks.js +79 -0
  195. package/lib/session-directory.js +138 -13
  196. package/lib/session-input-ipc.js +2 -0
  197. package/lib/session-input.js +39 -5
  198. package/lib/session-list-avatars.js +16 -0
  199. package/lib/session-reclaim.js +37 -25
  200. package/lib/session-vendor.js +37 -0
  201. package/lib/sessions.js +99 -34
  202. package/lib/settings-ipc.js +60 -0
  203. package/lib/settings-registry.js +86 -0
  204. package/lib/terminal-manager.js +17 -5
  205. package/lib/theme-files.js +132 -0
  206. package/lib/theme-seed.js +136 -0
  207. package/lib/themes/clagentic-dark.json +13 -6
  208. package/lib/themes/clagentic-light.json +12 -5
  209. package/lib/updater.js +6 -4
  210. package/lib/usage-store.js +97 -10
  211. package/lib/users-preferences.js +118 -19
  212. package/lib/users.js +19 -10
  213. package/lib/vendor-catalog.js +130 -0
  214. package/lib/ws-schema.js +4 -2
  215. package/lib/yoke/adapters/claude.js +81 -1
  216. package/lib/yoke/adapters/codex-user-shell.js +87 -23
  217. package/lib/yoke/adapters/codex.js +89 -5
  218. package/lib/yoke/codex-binary.js +59 -0
  219. package/package.json +1 -1
  220. package/scripts/check-test-count.js +5 -0
  221. package/scripts/install-local-test.js +50 -9
  222. package/scripts/write-build-sha.js +18 -2
  223. package/lib/public/css/channel-layout.css +0 -329
  224. package/lib/themes/ayu-light.json +0 -9
  225. package/lib/themes/catppuccin-latte.json +0 -9
  226. package/lib/themes/catppuccin-mocha.json +0 -9
  227. package/lib/themes/dracula.json +0 -9
  228. package/lib/themes/everforest-light.json +0 -9
  229. package/lib/themes/everforest.json +0 -9
  230. package/lib/themes/github-light.json +0 -9
  231. package/lib/themes/gruvbox-dark.json +0 -9
  232. package/lib/themes/gruvbox-light.json +0 -9
  233. package/lib/themes/monokai.json +0 -9
  234. package/lib/themes/nord-light.json +0 -9
  235. package/lib/themes/nord.json +0 -9
  236. package/lib/themes/one-dark.json +0 -9
  237. package/lib/themes/one-light.json +0 -9
  238. package/lib/themes/rose-pine-dawn.json +0 -9
  239. package/lib/themes/rose-pine.json +0 -9
  240. package/lib/themes/solarized-dark.json +0 -9
  241. package/lib/themes/solarized-light.json +0 -9
  242. package/lib/themes/tokyo-night-light.json +0 -9
  243. package/lib/themes/tokyo-night.json +0 -9
@@ -6,14 +6,18 @@ import { escapeHtml } from './utils.js';
6
6
  import { store } from './store.js';
7
7
  import { getWs } from './ws-ref.js';
8
8
  import { showConfirm } from './app-misc.js';
9
+ import { showOverlay } from './overlay.js';
9
10
  import { openRalphWizard } from './app-loop-wizard.js';
10
11
  import { openSchedulerToTab } from './scheduler.js';
11
12
  import { renderModelList, renderModeList, renderEffortBar, renderThinkingBar } from './settings-defaults.js';
12
13
  import { approveToolsCardHtml, bindApproveToolsToggle } from './approve-tools-toggle.js';
13
14
  import { loopHooksWarningHtml } from './loop-hooks-warning.js';
15
+ import { composerPlaceholder, LOOP_QUEUE_PLACEHOLDER } from './assistant-identity.js';
14
16
 
15
17
  // Execution modal: module-internal UI var (not in store)
16
18
  var pendingIterations = 20;
19
+ // The open preview modal (overlay.js); null until it is first opened.
20
+ var previewHandle = null;
17
21
 
18
22
  // ========================================================
19
23
  // Init
@@ -60,7 +64,8 @@ export function initLoopUi() {
60
64
  initLoopQueueModeSync();
61
65
 
62
66
  // --- Preview modal listeners ---
63
- // Backdrop click intentionally does NOT close the modal (no way to reopen it)
67
+ // The scrim, Escape and the close control close the preview (the shared modal);
68
+ // the sticky bar's preview button opens it again.
64
69
 
65
70
  // Run button in preview modal footer
66
71
  var previewRunBtn = document.getElementById("ralph-preview-run");
@@ -242,9 +247,11 @@ function applyLoopQueueMode(queueMode) {
242
247
  var inputEl = document.getElementById("input");
243
248
  if (inputEl) {
244
249
  if (queueMode) {
245
- inputEl.placeholder = "Message queues for the next loop iteration…";
246
- } else if (inputEl.placeholder.indexOf("queues for the next loop iteration") !== -1) {
247
- inputEl.placeholder = "Message Claude Code...";
250
+ inputEl.placeholder = LOOP_QUEUE_PLACEHOLDER;
251
+ } else if (inputEl.placeholder === LOOP_QUEUE_PLACEHOLDER) {
252
+ // The store still holds the old queue mode here; the placeholder is the
253
+ // one for the mode being applied.
254
+ inputEl.placeholder = composerPlaceholder(function (k) { return k === "loopQueueMode" ? false : store.get(k); });
248
255
  }
249
256
  }
250
257
  store.set({ loopQueueMode: queueMode });
@@ -449,9 +456,13 @@ export function updateLoopPendingBanner() {
449
456
  // Pending-message popover: list + per-item dismiss (lr-4a9c)
450
457
  // ========================================================
451
458
 
459
+ var loopPendingPopover = null;
460
+
452
461
  function closeLoopPendingPopover() {
453
- var existing = document.getElementById("loop-pending-popover");
454
- if (existing) existing.remove();
462
+ if (loopPendingPopover) {
463
+ loopPendingPopover.close();
464
+ loopPendingPopover = null;
465
+ }
455
466
  }
456
467
 
457
468
  function toggleLoopPendingPopover(anchorEl) {
@@ -461,27 +472,18 @@ function toggleLoopPendingPopover(anchorEl) {
461
472
  return;
462
473
  }
463
474
 
464
- var popover = document.createElement("div");
465
- popover.id = "loop-pending-popover";
466
- popover.className = "loop-pending-popover";
467
- anchorEl.parentNode.appendChild(popover);
475
+ // Hangs under the sticky's header (the pill's parent), right-aligned, as it
476
+ // did when the popover was a child of the header.
477
+ loopPendingPopover = showOverlay({
478
+ kind: "popover",
479
+ id: "loop-pending-popover",
480
+ className: "loop-pending-popover",
481
+ anchor: anchorEl.parentNode,
482
+ opener: anchorEl,
483
+ placement: "below-right-aligned",
484
+ });
468
485
  renderLoopPendingPopoverList();
469
-
470
- // Close on outside click (deferred so this click doesn't immediately close it).
471
- setTimeout(function () {
472
- document.addEventListener("click", onOutsideClick);
473
- }, 0);
474
- function onOutsideClick(e) {
475
- var pop = document.getElementById("loop-pending-popover");
476
- if (!pop) {
477
- document.removeEventListener("click", onOutsideClick);
478
- return;
479
- }
480
- if (!pop.contains(e.target) && e.target !== anchorEl) {
481
- closeLoopPendingPopover();
482
- document.removeEventListener("click", onOutsideClick);
483
- }
484
- }
486
+ if (loopPendingPopover) loopPendingPopover.reposition();
485
487
  }
486
488
 
487
489
  function renderLoopPendingPopoverList() {
@@ -552,10 +554,12 @@ export function updateRalphBars() {
552
554
  // Internal: toggleLoopPopover
553
555
  // ========================================================
554
556
 
557
+ // The open loop status dialog; the banner's button opens it and closes it again.
558
+ var loopStatusHandle = null;
559
+
555
560
  function toggleLoopPopover() {
556
- var existing = document.getElementById("loop-status-modal");
557
- if (existing) {
558
- existing.remove();
561
+ if (loopStatusHandle && loopStatusHandle.isOpen()) {
562
+ loopStatusHandle.close();
559
563
  return;
560
564
  }
561
565
 
@@ -565,16 +569,10 @@ function toggleLoopPopover() {
565
569
  var _s = store.snap();
566
570
  var statusText = "Iteration #" + _s.loopIteration + " / " + _s.loopMaxIterations;
567
571
 
568
- var modal = document.createElement("div");
569
- modal.id = "loop-status-modal";
570
- modal.className = "loop-status-modal";
571
- modal.innerHTML =
572
- '<div class="loop-status-backdrop"></div>' +
573
- '<div class="loop-status-dialog">' +
572
+ var content =
574
573
  '<div class="loop-status-dialog-header">' +
575
574
  '<span class="loop-status-dialog-icon">' + iconHtml("repeat") + '</span>' +
576
575
  '<span class="loop-status-dialog-title">Loop</span>' +
577
- '<button class="loop-status-dialog-close" title="Close">' + iconHtml("x") + '</button>' +
578
576
  '</div>' +
579
577
  '<div class="loop-status-dialog-body">' +
580
578
  '<div class="loop-status-dialog-row">' +
@@ -588,16 +586,13 @@ function toggleLoopPopover() {
588
586
  '</div>' +
589
587
  '<div class="loop-status-dialog-footer">' +
590
588
  '<button class="loop-status-dialog-stop">' + iconHtml("square") + ' Stop loop</button>' +
591
- '</div>' +
592
- '</div>';
589
+ '</div>';
593
590
 
594
- document.body.appendChild(modal);
595
- refreshIcons();
596
-
597
- function closeModal() { modal.remove(); }
591
+ var handle = showOverlay({ kind: "modal", id: "loop-status-modal", dialogClass: "loop-status-dialog", content: content });
592
+ loopStatusHandle = handle;
593
+ var modal = handle.el;
598
594
 
599
- modal.querySelector(".loop-status-backdrop").addEventListener("click", closeModal);
600
- modal.querySelector(".loop-status-dialog-close").addEventListener("click", closeModal);
595
+ function closeModal() { handle.close(); }
601
596
 
602
597
  modal.querySelector(".loop-status-dialog-stop").addEventListener("click", function(e) {
603
598
  e.stopPropagation();
@@ -810,14 +805,13 @@ export function openRalphPreviewModal() {
810
805
  _previewLoopSettings = {};
811
806
  _previewApproveTools = true;
812
807
  showRalphPreviewTab("prompt");
813
- modal.classList.remove("hidden");
808
+ previewHandle = showOverlay({ kind: "modal", el: modal });
814
809
  refreshIcons();
815
810
  syncIterationsUi();
816
811
  }
817
812
 
818
813
  function closeRalphPreviewModal() {
819
- var modal = document.getElementById("ralph-preview-modal");
820
- if (modal) modal.classList.add("hidden");
814
+ if (previewHandle) previewHandle.close();
821
815
  }
822
816
 
823
817
  // Pending loop settings for the preview modal (saved to LOOP.json on launch)
@@ -5,6 +5,10 @@ import { refreshIcons } from './icons.js';
5
5
  import { store } from './store.js';
6
6
  import { getWs } from './ws-ref.js';
7
7
  import { requireSkills } from './app-skills-install.js';
8
+ import { showOverlay } from './overlay.js';
9
+
10
+ // The open wizard (overlay.js); null until it is first opened.
11
+ var wizardHandle = null;
8
12
 
9
13
  // --- Module-owned state (not in store) ---
10
14
  var wizardStep = 1;
@@ -38,14 +42,10 @@ export function initLoopWizard() {
38
42
  cronPreview = document.getElementById("ralph-cron-preview");
39
43
 
40
44
  // --- Wizard button listeners ---
41
- var wizardCloseBtn = document.getElementById("ralph-wizard-close");
42
- var wizardBackdrop = document.querySelector(".ralph-wizard-backdrop");
43
45
  var wizardBackBtn = document.getElementById("ralph-wizard-back");
44
46
  var wizardSkipBtn = document.getElementById("ralph-wizard-skip");
45
47
  var wizardNextBtn = document.getElementById("ralph-wizard-next");
46
48
 
47
- if (wizardCloseBtn) wizardCloseBtn.addEventListener("click", closeRalphWizard);
48
- if (wizardBackdrop) wizardBackdrop.addEventListener("click", closeRalphWizard);
49
49
  if (wizardBackBtn) wizardBackBtn.addEventListener("click", wizardBack);
50
50
  if (wizardSkipBtn) wizardSkipBtn.addEventListener("click", wizardSkip);
51
51
  if (wizardNextBtn) wizardNextBtn.addEventListener("click", wizardNext);
@@ -181,7 +181,7 @@ export function openRalphWizard(source) {
181
181
  } else {
182
182
  wizardStep = 1;
183
183
  }
184
- el.classList.remove("hidden");
184
+ wizardHandle = showOverlay({ kind: "modal", el: el });
185
185
  var statusEl = document.getElementById("ralph-install-status");
186
186
  if (statusEl) { statusEl.classList.add("hidden"); statusEl.innerHTML = ""; }
187
187
 
@@ -194,8 +194,7 @@ export function openRalphWizard(source) {
194
194
  }
195
195
 
196
196
  export function closeRalphWizard() {
197
- var el = document.getElementById("ralph-wizard");
198
- if (el) el.classList.add("hidden");
197
+ if (wizardHandle) wizardHandle.close();
199
198
  }
200
199
 
201
200
  // --- Internal wizard helpers ---
@@ -361,20 +360,20 @@ function validateLastStep() {
361
360
  if (promptAuthor === "clay") {
362
361
  var taskEl = document.getElementById("ralph-task");
363
362
  if (!wd.task) {
364
- if (taskEl) { taskEl.focus(); taskEl.style.borderColor = "#e74c3c"; setTimeout(function() { taskEl.style.borderColor = ""; }, 2000); }
363
+ if (taskEl) { taskEl.focus(); taskEl.style.borderColor = "var(--error)"; setTimeout(function() { taskEl.style.borderColor = ""; }, 2000); }
365
364
  return false;
366
365
  }
367
366
  } else {
368
367
  var promptInput = document.getElementById("ralph-prompt-input");
369
368
  if (!wd.promptText) {
370
- if (promptInput) { promptInput.focus(); promptInput.style.borderColor = "#e74c3c"; setTimeout(function() { promptInput.style.borderColor = ""; }, 2000); }
369
+ if (promptInput) { promptInput.focus(); promptInput.style.borderColor = "var(--error)"; setTimeout(function() { promptInput.style.borderColor = ""; }, 2000); }
371
370
  return false;
372
371
  }
373
372
  }
374
373
  if (loopModeChoice === "judge" && judgeAuthor === "me") {
375
374
  var judgeInput = document.getElementById("ralph-judge-input");
376
375
  if (!wd.judgeText) {
377
- if (judgeInput) { judgeInput.focus(); judgeInput.style.borderColor = "#e74c3c"; setTimeout(function() { judgeInput.style.borderColor = ""; }, 2000); }
376
+ if (judgeInput) { judgeInput.focus(); judgeInput.style.borderColor = "var(--error)"; setTimeout(function() { judgeInput.style.borderColor = ""; }, 2000); }
378
377
  return false;
379
378
  }
380
379
  }
@@ -45,6 +45,7 @@ import { isProjectSettingsOpen, refreshProjectSettingsModels, handleInstructions
45
45
  import { updateSettingsModels, updateSettingsStats, updateDaemonConfig, handleSharedEnv, handleSharedEnvSaved, updateSsLiteVisibility } from './server-settings.js';
46
46
  import { handleRenameCustomIconResult } from './custom-icons-settings.js';
47
47
  import { handlePermissionSettings, handlePermissionModeApplied } from './permission-settings.js';
48
+ import { handlePromptExpirySettings } from './prompt-expiry-controls.js';
48
49
  import { handleShellResult, handleUserShellSettings, handleSessionShown, handleHistoryReplayed, handleMessageDelivered, handleQueuedMessageCancelled, handleQueuedMessageTracked, handleQueuedMessageSendNow } from './user-shell.js';
49
50
  import { handleTermList, handleTermCreated, sendTerminalCommand, markLoginTerminal, handleTermOutput, handleTermResized, handleTermExited, handleTermClosed } from './terminal.js';
50
51
  import { consumePendingTerm } from './pending-term-request.js';
@@ -52,6 +53,7 @@ import { updateTerminalList,handleContextSourcesState } from './context-sources.
52
53
  import { handleNotesList, handleNoteCreated, handleNoteUpdated, handleNoteDeleted } from './sticky-notes.js';
53
54
  import { handleSkillInstalled, handleSkillUninstalled } from './skills.js';
54
55
  import { applyVendorRegistry, defaultVendorId } from './vendor-registry.js';
56
+ import { vendorStateForSwitch, sessionVendorMap, isForeignModelInfo } from './session-vendor-state.js';
55
57
  import { showRewindModal, onRewindComplete, setRewindMode, onRewindError, clearPendingRewindUuid, addRewindButton } from './rewind.js';
56
58
  import { checkAdminAccess } from './admin.js';
57
59
  import { showImageModal, sendExtensionCommand, handleMcpToolCallMessage } from './app-misc.js';
@@ -60,7 +62,7 @@ import { handleLoopRegistryUpdated, handleScheduleRunStarted, handleScheduleRunF
60
62
 
61
63
  // --- App module imports ---
62
64
  import { injectedFromMessage } from './injected-label.js';
63
- import { scrollToBottom, addToMessages, addUserMessage, addSystemMessage, appendDelta, finalizeAssistantBlock, addConflictMessage, addContextOverflowMessage, showSuggestionChips, removePreThinking } from './app-rendering.js';
65
+ import { scrollToBottom, addToMessages, addUserMessage, addSystemMessage, appendDelta, finalizeAssistantBlock, addConflictMessage, addContextOverflowMessage, showSuggestionChips } from './app-rendering.js';
64
66
  import { startUrgentBlink, stopUrgentBlink, blinkSessionDot, updateCrossProjectBlink, reconcileActivityFooter } from './app-favicon.js';
65
67
  import { setStatus, observeBuildInfo } from './app-connection.js';
66
68
  import { getModelEffortLevels, accumulateUsage, setSessionUsage, updateUsagePanel, accumulateContext, updateContextPanel, renderCtxPopover, updateStatusPanel } from './app-panels.js';
@@ -276,8 +278,12 @@ registerHandlers({
276
278
  // currentModels with the wrong vendor's list and trigger app-panels
277
279
  // to request models for the "wrong" vendor, which feeds back into a
278
280
  // ping-pong loop of vendor flapping. See issue #336.
279
- var _curV = store.get('currentVendor');
280
- if (msg.vendor && _curV && msg.vendor !== _curV) return;
281
+ // A model_info that names its session is also that session's alone: it must
282
+ // not set the vendor or models of a browser on another session.
283
+ if (isForeignModelInfo(msg, {
284
+ currentVendor: store.get('currentVendor'),
285
+ activeSessionId: store.get('activeSessionId'),
286
+ })) return;
281
287
 
282
288
  var _modelVal = msg.model;
283
289
  if (_modelVal && typeof _modelVal === "object") _modelVal = _modelVal.value || _modelVal.displayName || "";
@@ -303,6 +309,7 @@ registerHandlers({
303
309
  },
304
310
 
305
311
  permission_settings: handlePermissionSettings,
312
+ prompt_expiry_settings: handlePromptExpirySettings,
306
313
  shell_result: handleShellResult,
307
314
  message_delivered: handleMessageDelivered,
308
315
  queued_message_cancelled: handleQueuedMessageCancelled,
@@ -410,6 +417,8 @@ registerHandlers({
410
417
 
411
418
  session_list: function (msg) {
412
419
  renderSessionList(msg.sessions || []);
420
+ // What the header falls back to when the page holds no vendor of its own.
421
+ store.set({ sessionVendors: sessionVendorMap(msg.sessions) });
413
422
  syncKeepAliveButton(msg.sessions || []);
414
423
  handlePaletteSessionSwitch();
415
424
  // lr-5edd64: 'processing' (the transcript footer's field) is now a pure
@@ -546,27 +555,17 @@ registerHandlers({
546
555
  // recurrence) — see the comment down there for why the ordering
547
556
  // matters. Do not move this store.set({ processing: ... }) back up
548
557
  // here without re-reading that comment.
549
- if (msg.vendor) {
550
- if (!store.get('vendorSelectionLocked') || msg.hasHistory) {
551
- store.set({ currentVendor: msg.vendor });
552
- }
553
- // Sessions with history have their vendor structurally bound to
554
- // the session: lock so a late-arriving default-adapter model_info
555
- // can't flip the UI back. Previously this branch unlocked, which
556
- // is what allowed the feedback loop in issue #336.
557
- if (msg.hasHistory) {
558
- store.set({ vendorSelectionLocked: true });
559
- }
560
- } else if (msg.hasHistory) {
561
- // Existing session without explicit vendor: reset to the default agent
562
- store.set({ currentVendor: defaultVendorId() });
563
- store.set({ vendorSelectionLocked: false });
564
- } else if (!msg.hasHistory) {
565
- // New session without vendor: no mate vendor lookup needed
566
- }
567
- if (!msg.hasHistory && !msg.vendor) {
568
- // Preserve explicit pre-message vendor choice on brand-new sessions.
569
- }
558
+ // Sessions with history have their vendor structurally bound to the session
559
+ // and locked, so a late-arriving default-adapter model_info can't flip the
560
+ // UI back (issue #336). A brand-new session without a vendor keeps the
561
+ // visitor's own pre-message choice (carried across the reset below), else
562
+ // nothing is imposed (null). A vendor the server could not read shows none.
563
+ var _boundVendor = vendorStateForSwitch(msg, {
564
+ currentVendor: store.get('currentVendor'),
565
+ vendorSelectionLocked: store.get('vendorSelectionLocked'),
566
+ sameSession: _prevSid === msg.id,
567
+ }, defaultVendorId());
568
+ if (_boundVendor) store.set(_boundVendor);
570
569
  // Show vendor toggle only for new sessions (no history).
571
570
  // Agent sessions are Claude Code-only — hide the toggle entirely so
572
571
  // the user cannot switch an agent session to Codex (which has no
@@ -584,6 +583,14 @@ registerHandlers({
584
583
  // Session presence is now tracked server-side (user-presence.json)
585
584
  clearRemoteCursors();
586
585
  resetClientState();
586
+ // The named agent this session is cast as, for the assistant's header. Set
587
+ // after the reset, which clears it for a project switch.
588
+ store.set({ currentAgentName: msg.agentName || null });
589
+ // The vendor settled above belongs to this session, but the reset wipes it
590
+ // (it is also the project-switch reset): apply it again, or the header
591
+ // falls back to a default vendor and a model_info for another session can
592
+ // set it.
593
+ if (_boundVendor) store.set(_boundVendor);
587
594
  // Re-derive 'processing' from sessionIsProcessing (set above), NOT from
588
595
  // a second raw msg.isProcessing read — this file's CI invariant test
589
596
  // locks .isProcessing reads to exactly the one documented site above,
@@ -761,9 +768,6 @@ registerHandlers({
761
768
  // applied at history_done time.
762
769
  store.set({ sessionIsProcessing: true });
763
770
  applyDeadSessionTodoCompaction();
764
- if (!store.get('dmMode')) {
765
- removePreThinking(); // drop pre-thinking dots before showing activity indicator
766
- }
767
771
  }
768
772
  }
769
773
  },
@@ -788,7 +792,6 @@ registerHandlers({
788
792
  },
789
793
 
790
794
  thinking_start: function (msg) {
791
- removePreThinking();
792
795
  startThinking();
793
796
  },
794
797
 
@@ -802,7 +805,6 @@ registerHandlers({
802
805
 
803
806
  delta: function (msg) {
804
807
  if (typeof msg.text !== "string") return;
805
- removePreThinking();
806
808
  stopThinking();
807
809
  resetThinkingGroup();
808
810
  // lr-66c118: the setActivity clear-call removed here (was gated on
@@ -815,7 +817,6 @@ registerHandlers({
815
817
  },
816
818
 
817
819
  tool_start: function (msg) {
818
- removePreThinking();
819
820
  stopThinking();
820
821
  markAllToolsDone();
821
822
  if (msg.name === "EnterPlanMode") {
@@ -971,7 +972,6 @@ registerHandlers({
971
972
  // cross-session — there was no other session-scoped state to guard here
972
973
  // once the store-wide latch write is gone.
973
974
  done: function (msg) {
974
- removePreThinking();
975
975
  // lr-66c118: the setActivity clear call is removed here too — see the
976
976
  // 'result' handler above. resetToolState() below still clears all
977
977
  // per-turn tool tracking (including subagent liveness) unconditionally.
@@ -1001,7 +1001,6 @@ registerHandlers({
1001
1001
  // process_conflict, context_overflow, auth_required) — setActivity
1002
1002
  // collapses to ONE optimistic raise (input.js) with no manual clears.
1003
1003
  error: function (msg) {
1004
- removePreThinking();
1005
1004
  // Only an error that names its request frees a row; any other error is not
1006
1005
  // about a scheduled request.
1007
1006
  failScheduledRequests(msg.text, msg.requestId);
@@ -1017,12 +1016,10 @@ registerHandlers({
1017
1016
  },
1018
1017
 
1019
1018
  process_conflict: function (msg) {
1020
- removePreThinking();
1021
1019
  addConflictMessage(msg);
1022
1020
  },
1023
1021
 
1024
1022
  context_overflow: function (msg) {
1025
- removePreThinking();
1026
1023
  addContextOverflowMessage(msg);
1027
1024
  },
1028
1025
 
@@ -1030,7 +1027,6 @@ registerHandlers({
1030
1027
  // that field is now a pure projection (see session_list/session_switched
1031
1028
  // handlers), and nothing else in this handler was gated by the guard.
1032
1029
  auth_required: function (msg) {
1033
- removePreThinking();
1034
1030
  stopThinking();
1035
1031
  markAllToolsDone();
1036
1032
  closeToolGroup();
@@ -1522,6 +1518,6 @@ registerHandlers({
1522
1518
  notification_dismissed: handleNotificationDismissed,
1523
1519
 
1524
1520
  notification_dismissed_all: function (msg) {
1525
- handleNotificationDismissedAll();
1521
+ handleNotificationDismissedAll(msg);
1526
1522
  },
1527
1523
  });
@@ -1,14 +1,14 @@
1
- // app-misc.js - Modals (image, paste, confirm), force PIN, PWA install, extension bridge
1
+ // app-misc.js - Force PIN, PWA install, extension bridge; re-exports the image, paste and confirm modals
2
2
  // Extracted from app.js (PR-34)
3
3
 
4
- import { refreshIcons, iconHtml } from './icons.js';
4
+ import { iconHtml } from './icons.js';
5
5
  import { escapeHtml, copyToClipboard } from './utils.js';
6
6
  import { getWs } from './ws-ref.js';
7
7
  import { updateBrowserTabList } from './context-sources.js';
8
8
  import { setExtensionConnected } from './mcp-ui.js';
9
+ import { showOverlay } from './overlay.js';
9
10
 
10
11
  // --- Module-owned state ---
11
- var confirmCallback = null;
12
12
  var _extRequestCallbacks = {};
13
13
 
14
14
  // Queue for extension messages that arrived before WS was ready
@@ -44,19 +44,6 @@ export function flushPendingExtMessages() {
44
44
  }
45
45
 
46
46
  export function initMisc() {
47
- // --- Confirm modal listeners ---
48
- var confirmModal = document.getElementById("confirm-modal");
49
- var confirmOk = document.getElementById("confirm-ok");
50
- var confirmCancel = document.getElementById("confirm-cancel");
51
-
52
- confirmOk.addEventListener("click", function () {
53
- if (confirmCallback) confirmCallback();
54
- hideConfirm();
55
- });
56
-
57
- confirmCancel.addEventListener("click", hideConfirm);
58
- confirmModal.querySelector(".confirm-backdrop").addEventListener("click", hideConfirm);
59
-
60
47
  // --- PWA install prompt ---
61
48
  (function () {
62
49
  var installPill = document.getElementById("pwa-install-pill");
@@ -81,18 +68,19 @@ export function initMisc() {
81
68
  installPill.classList.remove("hidden");
82
69
  });
83
70
 
71
+ var handle = null;
72
+
84
73
  function openModal() {
85
- modal.classList.remove("hidden");
74
+ handle = showOverlay({ kind: "modal", el: modal });
86
75
  lucide.createIcons({ nodes: [modal] });
87
76
  }
88
77
 
89
78
  function closeModal() {
90
- modal.classList.add("hidden");
79
+ if (handle) handle.close();
91
80
  }
92
81
 
93
82
  installPill.addEventListener("click", openModal);
94
83
  cancelBtn.addEventListener("click", closeModal);
95
- modal.querySelector(".pwa-modal-backdrop").addEventListener("click", closeModal);
96
84
 
97
85
  confirmBtn.addEventListener("click", function () {
98
86
  var port = parseInt(location.port, 10);
@@ -237,72 +225,17 @@ export function handleMcpToolCallMessage(msg) {
237
225
  }
238
226
  }
239
227
 
240
- export function showImageModal(src) {
241
- var modal = document.getElementById("image-modal");
242
- var img = document.getElementById("image-modal-img");
243
- if (!modal || !img) return;
244
- img.src = src;
245
- modal.classList.remove("hidden");
246
- refreshIcons(modal);
247
- }
248
-
249
- export function closeImageModal() {
250
- var modal = document.getElementById("image-modal");
251
- if (modal) modal.classList.add("hidden");
252
- }
253
-
254
- export function showPasteModal(text) {
255
- var modal = document.getElementById("paste-modal");
256
- var body = document.getElementById("paste-modal-body");
257
- if (!modal || !body) return;
258
- body.textContent = text;
259
- modal.classList.remove("hidden");
260
- }
261
-
262
- export function closePasteModal() {
263
- var modal = document.getElementById("paste-modal");
264
- if (modal) modal.classList.add("hidden");
265
- }
266
-
267
- export function showConfirm(text, onConfirm, okLabel, destructive) {
268
- var confirmText = document.getElementById("confirm-text");
269
- var confirmOk = document.getElementById("confirm-ok");
270
- var confirmModal = document.getElementById("confirm-modal");
271
- confirmText.textContent = text;
272
- confirmCallback = onConfirm;
273
- confirmOk.textContent = okLabel || "Delete";
274
- confirmOk.className = "confirm-btn " + (destructive === false ? "confirm-ok" : "confirm-delete");
275
- confirmModal.classList.remove("hidden");
276
- }
277
-
278
- export function hideConfirm() {
279
- var confirmModal = document.getElementById("confirm-modal");
280
- confirmModal.classList.add("hidden");
281
- confirmCallback = null;
282
- }
228
+ // The image, paste and confirm modals live in app-modals.js; callers keep
229
+ // importing them from here.
230
+ export { showImageModal, showPasteModal, showConfirm } from './app-modals.js';
283
231
 
232
+ // The PIN screen that cannot be dismissed: a modal that is not dismissible, on a
233
+ // solid scrim, so neither Escape nor a click outside gets past it. Its look is in
234
+ // css/overlays.css (the same .pin-digit boxes the login page draws).
284
235
  export function showForceChangePinOverlay() {
285
- // Inject the same .pin-digit / .pin-wrap CSS the login page uses, so this
286
- // overlay behaves identically: visible focus ring, filled state, etc.
287
- // The login page (lib/pages.js) loads this CSS inline; the main app
288
- // doesn't, so we add it once here.
289
- if (!document.getElementById("fcp-style")) {
290
- var st = document.createElement("style");
291
- st.id = "fcp-style";
292
- st.textContent =
293
- "#force-change-pin-overlay .pin-wrap{display:flex;gap:8px;justify-content:center;margin-bottom:16px}" +
294
- "#force-change-pin-overlay .pin-digit{width:44px;height:56px;background:var(--input-bg);border:1.5px solid var(--border);border-radius:8px;color:var(--text);font-family:'Courier New',Courier,'Roboto Mono',monospace;font-size:28px;font-weight:700;text-align:center;line-height:56px;outline:none;caret-color:transparent;transition:border-color 0.15s,box-shadow 0.15s}" +
295
- "#force-change-pin-overlay .pin-digit:focus{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-20,rgba(124,58,237,0.25))}" +
296
- "#force-change-pin-overlay .pin-digit.filled{color:var(--text)}";
297
- document.head.appendChild(st);
298
- }
299
-
300
- var ov = document.createElement("div");
301
- ov.id = "force-change-pin-overlay";
302
- ov.style.cssText = "position:fixed;inset:0;background:var(--bg,#0e0e10);z-index:99999;display:flex;align-items:center;justify-content:center;flex-direction:column";
303
- ov.innerHTML = '<div style="width:100%;max-width:380px;padding:24px;text-align:center">' +
304
- '<h2 style="margin:0 0 8px;color:var(--text,#fff);font-size:22px">Set your new PIN</h2>' +
305
- '<p style="margin:0 0 24px;color:var(--text-secondary,#aaa);font-size:14px">Your temporary PIN has expired. Please set a new 6-digit PIN to continue.</p>' +
236
+ var content = '<div class="fcp-card">' +
237
+ '<h2 class="fcp-title">Set your new PIN</h2>' +
238
+ '<p class="fcp-desc">Your temporary PIN has expired. Please set a new 6-digit PIN to continue.</p>' +
306
239
  '<div class="pin-wrap" id="fcp-boxes">' +
307
240
  '<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
308
241
  '<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
@@ -311,11 +244,12 @@ export function showForceChangePinOverlay() {
311
244
  '<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
312
245
  '<input class="pin-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off">' +
313
246
  '</div>' +
314
- '<button id="fcp-save" disabled style="width:100%;padding:12px;border:none;border-radius:10px;background:var(--accent);color:#fff;font-size:15px;font-weight:600;cursor:pointer;opacity:0.5;transition:opacity 0.15s">Save PIN</button>' +
315
- '<div id="fcp-err" style="margin-top:12px;color:var(--error,#ef4444);font-size:13px;min-height:1.3em"></div>' +
316
- '<button id="fcp-logout" type="button" style="margin-top:8px;background:none;border:none;color:var(--text-dimmer,#888);font-size:13px;cursor:pointer;text-decoration:underline">Log out and start over</button>' +
247
+ '<button id="fcp-save" class="fcp-save" disabled>Save PIN</button>' +
248
+ '<div id="fcp-err" class="fcp-err"></div>' +
249
+ '<button id="fcp-logout" class="fcp-logout" type="button">Log out and start over</button>' +
317
250
  '</div>';
318
- document.body.appendChild(ov);
251
+ var handle = showOverlay({ kind: "modal", id: "force-change-pin-overlay", content: content, dismissible: false, card: false, scrim: "solid" });
252
+ var ov = handle.el;
319
253
 
320
254
  var boxes = ov.querySelectorAll(".pin-digit");
321
255
  var saveBtn = ov.querySelector("#fcp-save");
@@ -338,7 +272,6 @@ export function showForceChangePinOverlay() {
338
272
  function updateBtn() {
339
273
  var ready = getPin().length === 6;
340
274
  saveBtn.disabled = !ready;
341
- saveBtn.style.opacity = ready ? "1" : "0.5";
342
275
  }
343
276
 
344
277
  for (var i = 0; i < boxes.length; i++) {
@@ -390,7 +323,6 @@ export function showForceChangePinOverlay() {
390
323
  var pin = getPin();
391
324
  if (pin.length !== 6) return;
392
325
  saveBtn.disabled = true;
393
- saveBtn.style.opacity = "0.5";
394
326
  errEl.textContent = "";
395
327
  fetch("/api/user/pin", {
396
328
  method: "PUT",
@@ -398,16 +330,14 @@ export function showForceChangePinOverlay() {
398
330
  body: JSON.stringify({ newPin: pin }),
399
331
  }).then(function (r) { return r.json(); }).then(function (d) {
400
332
  if (d.ok) {
401
- ov.remove();
333
+ handle.close();
402
334
  return;
403
335
  }
404
336
  errEl.textContent = d.error || "Failed to save PIN";
405
337
  saveBtn.disabled = false;
406
- saveBtn.style.opacity = "1";
407
338
  }).catch(function () {
408
339
  errEl.textContent = "Connection error";
409
340
  saveBtn.disabled = false;
410
- saveBtn.style.opacity = "1";
411
341
  });
412
342
  }
413
343
  saveBtn.addEventListener("click", doSave);