@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
@@ -14,6 +14,7 @@
14
14
  // An in-flight save is debounced so rapid drag reorders don't spam.
15
15
 
16
16
  import { refreshIcons } from './icons.js';
17
+ import { showOverlay } from './overlay.js';
17
18
 
18
19
  // Registry order = default order for users who haven't customized. Users
19
20
  // with saved preferences keep their own order (applyPreferences uses
@@ -311,8 +312,7 @@ var _openMenu = null;
311
312
 
312
313
  function openPaletteContextMenu(x, y, items) {
313
314
  closePaletteContextMenu();
314
- var menu = document.createElement('div');
315
- menu.className = 'tool-palette-ctx-menu';
315
+ var buttons = [];
316
316
  for (var i = 0; i < items.length; i++) {
317
317
  (function (item) {
318
318
  var btn = document.createElement('button');
@@ -324,29 +324,19 @@ function openPaletteContextMenu(x, y, items) {
324
324
  closePaletteContextMenu();
325
325
  item.action();
326
326
  });
327
- menu.appendChild(btn);
327
+ buttons.push(btn);
328
328
  })(items[i]);
329
329
  }
330
- document.body.appendChild(menu);
331
- // Clamp to viewport.
332
- var rect = menu.getBoundingClientRect();
333
- var px = x, py = y;
334
- if (px + rect.width > window.innerWidth - 4) px = window.innerWidth - rect.width - 4;
335
- if (py + rect.height > window.innerHeight - 4) py = window.innerHeight - rect.height - 4;
336
- menu.style.left = px + 'px';
337
- menu.style.top = py + 'px';
338
- _openMenu = menu;
330
+ // Placed at the pointer and clamped to the viewport by the shared component;
331
+ // outside click and Escape are the registry's.
332
+ _openMenu = showOverlay({ kind: 'menu', className: 'tool-palette-ctx-menu', content: buttons, anchor: { x: x, y: y } });
339
333
  }
340
334
 
341
335
  function closePaletteContextMenu() {
342
- if (_openMenu && _openMenu.parentNode) _openMenu.parentNode.removeChild(_openMenu);
336
+ if (_openMenu) _openMenu.close();
343
337
  _openMenu = null;
344
338
  }
345
339
 
346
- document.addEventListener('click', function () { closePaletteContextMenu(); });
347
- document.addEventListener('keydown', function (e) {
348
- if (e.key === 'Escape') closePaletteContextMenu();
349
- });
350
340
  window.addEventListener('blur', function () { closePaletteContextMenu(); });
351
341
  window.addEventListener('resize', function () { closePaletteContextMenu(); });
352
342
 
@@ -3,12 +3,12 @@ import { iconHtml, refreshIcons } from './icons.js';
3
3
  import { renderMarkdown, highlightCodeBlocks, renderMermaidBlocks } from './markdown.js';
4
4
  import { renderUnifiedDiff, renderSplitDiff, renderPatchDiff, reconstructPatchSources } from './diff.js';
5
5
  import { openFile } from './filebrowser.js';
6
- import { getChatLayout } from './theme.js';
7
6
  import { store } from './store.js';
8
- import { VENDOR_NAMES } from './app-rendering.js';
9
7
  import { createPromptController } from './prompts.js';
10
8
  import { isAgentDispatchTool } from './agent-dispatch-tool.js';
11
9
  import { createAgentAvatar } from './agent-avatar.js';
10
+ import { assistantIdentity, composerPlaceholder } from './assistant-identity.js';
11
+ import { listedVendor } from './session-vendor-state.js';
12
12
 
13
13
  var SUBAGENT_AVATAR_SIZE = 16;
14
14
 
@@ -228,8 +228,7 @@ export function disableMainInput() {
228
228
 
229
229
  export function enableMainInput() {
230
230
  ctx.inputEl.disabled = false;
231
- var _v = store.get('currentVendor') || "claude";
232
- ctx.inputEl.placeholder = "Message " + (VENDOR_NAMES[_v] || VENDOR_NAMES.claude) + "...";
231
+ ctx.inputEl.placeholder = composerPlaceholder(function (k) { return store.get(k); });
233
232
  }
234
233
 
235
234
  // --- Operator prompts (permission, plan, AskUserQuestion, elicitation) ---
@@ -258,7 +257,6 @@ var prompts = createPromptController({
258
257
  ctx.ws.send(JSON.stringify(payload));
259
258
  return true;
260
259
  },
261
- layout: function () { return getChatLayout(); },
262
260
  toolSummary: toolSummary,
263
261
  vendorIdentity: vendorIdentity,
264
262
  getContextPercent: function () { return ctx.getContextPercent ? ctx.getContextPercent() : 0; },
@@ -299,12 +297,12 @@ export function restoreUnconfirmedPrompts(message) {
299
297
  prompts.restoreUnconfirmed(message);
300
298
  }
301
299
 
300
+ // The card's speaker: the vendor the request names, else the one the session
301
+ // list records for the active session, else a neutral identity with no avatar.
302
+ // Never a vendor that nothing says the session runs on.
302
303
  function vendorIdentity(vendor) {
303
- var vendorAvatars = { claude: "/claude-code-avatar.png", codex: "/codex-avatar.png" };
304
- return {
305
- name: (vendor && VENDOR_NAMES[vendor]) || VENDOR_NAMES.claude,
306
- avatar: (vendor && vendorAvatars[vendor]) || vendorAvatars.claude,
307
- };
304
+ var identity = assistantIdentity(vendor, null, listedVendor(store.get('sessionVendors'), store.get('activeSessionId')));
305
+ return { name: identity.name, avatar: identity.avatarUrl };
308
306
  }
309
307
 
310
308
  // --- Plan mode rendering ---
@@ -3,15 +3,26 @@
3
3
 
4
4
  import { refreshIcons } from './icons.js';
5
5
  import { showToast } from './utils.js';
6
- import { toggleDarkMode, getCurrentTheme, getChatLayout, setChatLayout, getBrand, setBrand, applyServerThemePrefs } from './theme.js';
6
+ import { applyServerThemePrefs } from './theme.js';
7
+ import { mountThemeChoice } from './theme-choice.js';
8
+ import { mountChatWidthChoice } from './chat-width-choice.js';
9
+ import { applyServerChatWidth } from './chat-width.js';
10
+ import {
11
+ sessionListAvatarsEnabled, setSessionListAvatars, onSessionListAvatarsChange,
12
+ applyServerSessionListAvatars
13
+ } from './session-list-avatars.js';
7
14
  import { setSTTLang } from './stt.js';
8
15
  import { userAvatarUrl } from './avatar.js';
16
+ import { showOverlay } from './overlay.js';
17
+ import { isPhoneSettingsLayout } from './settings-access.js';
18
+ import { mountSettingsBack } from './settings-nav.js';
9
19
 
10
20
  var ctx = null;
11
21
  var settingsEl = null;
12
22
  var openBtn = null;
13
- var closeBtn = null;
14
- var backdrop = null;
23
+ // The handle of the last panel open (overlay.js); null until the panel is first
24
+ // opened and kept after it closes. isOpen() says whether it is open now.
25
+ var panelHandle = null;
15
26
  var navItems = null;
16
27
  var sections = null;
17
28
  var pinForm = null;
@@ -19,14 +30,12 @@ var pinSetBtn = null;
19
30
  var pinCancelBtn = null;
20
31
  var pinEnabled = false;
21
32
  var currentProfile = null;
22
-
33
+ var backBar = null;
23
34
 
24
35
  export function initUserSettings(appCtx) {
25
36
  ctx = appCtx;
26
37
  settingsEl = document.getElementById('user-settings');
27
38
  openBtn = document.getElementById('user-settings-btn');
28
- closeBtn = document.getElementById('user-settings-close');
29
- backdrop = document.getElementById('user-settings-backdrop');
30
39
 
31
40
  if (!settingsEl || !openBtn) return;
32
41
 
@@ -38,24 +47,6 @@ export function initUserSettings(appCtx) {
38
47
  openUserSettings();
39
48
  });
40
49
 
41
- if (closeBtn) {
42
- closeBtn.addEventListener('click', function () {
43
- closeUserSettings();
44
- });
45
- }
46
-
47
- if (backdrop) {
48
- backdrop.addEventListener('click', function () {
49
- closeUserSettings();
50
- });
51
- }
52
-
53
- document.addEventListener('keydown', function (e) {
54
- if (e.key === 'Escape' && isUserSettingsOpen()) {
55
- closeUserSettings();
56
- }
57
- });
58
-
59
50
  for (var i = 0; i < navItems.length; i++) {
60
51
  navItems[i].addEventListener('click', function () {
61
52
  var section = this.dataset.section;
@@ -63,13 +54,12 @@ export function initUserSettings(appCtx) {
63
54
  });
64
55
  }
65
56
 
66
- // Mobile nav dropdown
67
- var navDropdown = document.getElementById('user-settings-nav-dropdown');
68
- if (navDropdown) {
69
- navDropdown.addEventListener('change', function () {
70
- switchSection(this.value);
71
- });
72
- }
57
+ // Phone: the Back bar stands in for the section list, which the shared
58
+ // Settings list replaces there.
59
+ backBar = mountSettingsBack(settingsEl.querySelector('.us-modal-nav'), {
60
+ label: 'Back to Settings',
61
+ onBack: closeUserSettings,
62
+ });
73
63
 
74
64
  // PIN save button
75
65
  var pinInput = document.getElementById('us-pin-input');
@@ -165,57 +155,27 @@ export function initUserSettings(appCtx) {
165
155
  });
166
156
  }
167
157
 
168
- // Brand switcher (Clagentic / Classic)
169
- var brandSwitcher = document.getElementById('us-brand-switcher');
170
- if (brandSwitcher) {
171
- var brandBtns = brandSwitcher.querySelectorAll('.layout-option');
172
- for (var bi = 0; bi < brandBtns.length; bi++) {
173
- brandBtns[bi].addEventListener('click', function () {
174
- var brand = this.dataset.brand;
175
- setBrand(brand);
176
- for (var bj = 0; bj < brandBtns.length; bj++) {
177
- brandBtns[bj].classList.toggle('selected', brandBtns[bj].dataset.brand === brand);
178
- }
179
- });
180
- }
181
- }
182
-
183
- // Theme switcher (Light / Dark)
158
+ // Theme choice (Dark, Light, Follow system, custom themes): the shared component
184
159
  var themeSwitcher = document.getElementById('us-theme-switcher');
185
160
  if (themeSwitcher) {
186
- var themeBtns = themeSwitcher.querySelectorAll('.layout-option');
187
- for (var ti = 0; ti < themeBtns.length; ti++) {
188
- themeBtns[ti].addEventListener('click', function () {
189
- var mode = this.dataset.theme;
190
- var current = getCurrentTheme();
191
- var currentMode = (current && current.variant) || 'dark';
192
- if (mode !== currentMode) toggleDarkMode();
193
- for (var tj = 0; tj < themeBtns.length; tj++) {
194
- themeBtns[tj].classList.toggle('selected', themeBtns[tj].dataset.theme === mode);
195
- }
196
- });
197
- }
161
+ mountThemeChoice(themeSwitcher, { layout: 'cards' });
198
162
  }
199
163
 
200
- // Layout switcher (Bubble / Channel)
201
- var layoutSwitcher = document.getElementById('us-layout-switcher');
202
- if (layoutSwitcher) {
203
- var layoutBtns = layoutSwitcher.querySelectorAll('.layout-option');
204
- for (var li = 0; li < layoutBtns.length; li++) {
205
- layoutBtns[li].addEventListener('click', function () {
206
- var layout = this.dataset.layout;
207
- setChatLayout(layout);
208
- for (var lj = 0; lj < layoutBtns.length; lj++) {
209
- layoutBtns[lj].classList.toggle('selected', layoutBtns[lj].dataset.layout === layout);
210
- }
211
- // Save to server
212
- fetch('/api/user/chat-layout', {
213
- method: 'PUT',
214
- headers: { 'Content-Type': 'application/json' },
215
- body: JSON.stringify({ layout: layout }),
216
- }).catch(function () {});
217
- });
218
- }
164
+ // Chat width (Compact, Comfortable, Wide, Full): the shared component, beside the theme
165
+ var widthSwitcher = document.getElementById('us-width-switcher');
166
+ if (widthSwitcher) {
167
+ mountChatWidthChoice(widthSwitcher, { showDescriptions: true });
168
+ }
169
+
170
+ // Avatars in session list: applied at once, saved per user. The checkbox follows
171
+ // the setting, so a change from another device or surface updates it too.
172
+ var listAvatarsToggle = document.getElementById('us-session-list-avatars');
173
+ if (listAvatarsToggle) {
174
+ listAvatarsToggle.checked = sessionListAvatarsEnabled();
175
+ listAvatarsToggle.addEventListener('change', function () {
176
+ setSessionListAvatars(this.checked);
177
+ });
178
+ onSessionListAvatarsChange(function (on) { listAvatarsToggle.checked = on; });
219
179
  }
220
180
 
221
181
  // Logout button
@@ -235,7 +195,15 @@ export function initUserSettings(appCtx) {
235
195
  // Optional `initialSection` lets callers deep-link directly into a specific
236
196
  // settings tab. Falls back to Account so existing callers and the icon click are unchanged.
237
197
  export function openUserSettings(initialSection) {
238
- settingsEl.classList.remove('hidden');
198
+ // On a phone the panel is a page of the Settings list, so a back swipe
199
+ // closes it like the other settings panels (the history option); desktop
200
+ // holds no entry.
201
+ panelHandle = showOverlay({
202
+ kind: 'modal', panel: true, el: settingsEl, history: isPhoneSettingsLayout,
203
+ onRemove: function () { openBtn.classList.remove('active'); },
204
+ });
205
+ // Refused while a dialog is open (overlay-registry.js isPanelBlocked).
206
+ if (!panelHandle.isOpen()) return;
239
207
  openBtn.classList.add('active');
240
208
  refreshIcons(settingsEl);
241
209
  populateAccount();
@@ -244,12 +212,11 @@ export function openUserSettings(initialSection) {
244
212
  }
245
213
 
246
214
  export function closeUserSettings() {
247
- settingsEl.classList.add('hidden');
248
- openBtn.classList.remove('active');
215
+ if (panelHandle) panelHandle.close();
249
216
  }
250
217
 
251
218
  export function isUserSettingsOpen() {
252
- return settingsEl && !settingsEl.classList.contains('hidden');
219
+ return !!panelHandle && panelHandle.isOpen();
253
220
  }
254
221
 
255
222
  function switchSection(sectionName) {
@@ -259,8 +226,11 @@ function switchSection(sectionName) {
259
226
  for (var j = 0; j < sections.length; j++) {
260
227
  sections[j].classList.toggle('active', sections[j].dataset.section === sectionName);
261
228
  }
262
- var navDropdown = document.getElementById('user-settings-nav-dropdown');
263
- if (navDropdown) navDropdown.value = sectionName;
229
+ if (backBar) {
230
+ for (var k = 0; k < navItems.length; k++) {
231
+ if (navItems[k].dataset.section === sectionName) backBar.setTitle(navItems[k].textContent.trim());
232
+ }
233
+ }
264
234
  }
265
235
 
266
236
  function stopProp(e) {
@@ -384,37 +354,11 @@ function populateAccount() {
384
354
  var acToggle = document.getElementById('us-auto-continue');
385
355
  if (acToggle) acToggle.checked = !!data.autoContinueOnRateLimit;
386
356
  // Apply server-side theme preferences (overrides stale localStorage on mobile/cross-device)
387
- applyServerThemePrefs(data.themeMode, data.themeBrand);
388
- // Brand switcher
389
- var bSwitcher = document.getElementById('us-brand-switcher');
390
- if (bSwitcher) {
391
- var currentBrand = getBrand();
392
- var bBtns = bSwitcher.querySelectorAll('.layout-option');
393
- for (var bi = 0; bi < bBtns.length; bi++) {
394
- bBtns[bi].classList.toggle('selected', bBtns[bi].dataset.brand === currentBrand);
395
- }
396
- }
397
- // Theme switcher
398
- var tSwitcher = document.getElementById('us-theme-switcher');
399
- if (tSwitcher) {
400
- var currentMode = (getCurrentTheme() && getCurrentTheme().variant) || 'dark';
401
- var tBtns = tSwitcher.querySelectorAll('.layout-option');
402
- for (var ti = 0; ti < tBtns.length; ti++) {
403
- tBtns[ti].classList.toggle('selected', tBtns[ti].dataset.theme === currentMode);
404
- }
405
- }
406
- // Layout switcher: sync from server response
407
- if (data.chatLayout) {
408
- setChatLayout(data.chatLayout); // update local cache + CSS
409
- }
410
- var lSwitcher = document.getElementById('us-layout-switcher');
411
- if (lSwitcher) {
412
- var currentLayout = getChatLayout();
413
- var lBtns = lSwitcher.querySelectorAll('.layout-option');
414
- for (var li = 0; li < lBtns.length; li++) {
415
- lBtns[li].classList.toggle('selected', lBtns[li].dataset.layout === currentLayout);
416
- }
417
- }
357
+ // (the theme choice component re-renders itself when the theme changes)
358
+ applyServerThemePrefs({ themeMode: data.themeMode, themeId: data.themeId });
359
+ // Chat width: the server's value applies (the component re-renders itself)
360
+ applyServerChatWidth({ chatWidth: data.chatWidth });
361
+ applyServerSessionListAvatars({ sessionListAvatars: data.sessionListAvatars });
418
362
  }).catch(function () {});
419
363
  }
420
364
 
@@ -7,7 +7,7 @@
7
7
  // comes back. Handlers are registered by app-messages.js.
8
8
 
9
9
  import { store } from './store.js';
10
- import { addToMessages, addSystemMessage, scrollToBottom } from './app-rendering.js';
10
+ import { addToMessages, addSystemMessage, scrollToBottom, keepAtBottom, releaseFromBottom } from './app-rendering.js';
11
11
  import { setSendBtnMode } from './app-favicon.js';
12
12
  import { buildCard, fillCard, showRunning } from './shell-card.js';
13
13
  import { createChatQueue } from './shell-queue.js';
@@ -141,11 +141,12 @@ var chatQueue = createChatQueue({
141
141
  handle.refresh = function () { paintSendNow(sendNowBtn, entry.kind); };
142
142
  handle.refresh();
143
143
  }
144
+ keepAtBottom(el);
144
145
  addToMessages(el);
145
146
  scrollToBottom();
146
147
  return handle;
147
148
  },
148
- hide: function (handle) { handle.el.remove(); },
149
+ hide: function (handle) { releaseFromBottom(handle.el); handle.el.remove(); },
149
150
  markUnsent: function (handle, why) {
150
151
  handle.el.className = "shell-queued unsent";
151
152
  handle.tag.textContent = "Not sent";
@@ -303,6 +304,7 @@ function drawInflight(item) {
303
304
  item.actionsEl = actions;
304
305
  item.buttons = { sendNow: sendNowBtn, edit: editBtn, cancel: cancelBtn };
305
306
  paintInflight(item);
307
+ keepAtBottom(el);
306
308
  addToMessages(el);
307
309
  scrollToBottom();
308
310
  }
@@ -310,6 +312,7 @@ function drawInflight(item) {
310
312
  function removeInflight(item) {
311
313
  inflight.delete(item.messageId);
312
314
  sentOn.delete(item.messageId);
315
+ if (item.el) releaseFromBottom(item.el);
313
316
  if (item.el && item.el.remove) item.el.remove();
314
317
  }
315
318
 
@@ -762,6 +765,7 @@ export function handleSessionShown(inputEl) {
762
765
  // The transcript is rebuilt from the server's history, which has every message
763
766
  // the agent took in. What was still waiting is drawn again from the server's
764
767
  // queued_message_tracked frames, which follow the replay.
768
+ inflight.forEach(function (item) { if (item.el) releaseFromBottom(item.el); });
765
769
  inflight.clear();
766
770
  pending.forEach(function (p) { p.card = null; });
767
771
  var back = chatQueue.takeParked(scope);
@@ -773,6 +777,9 @@ export function handleSessionShown(inputEl) {
773
777
  back.forEach(function (b) {
774
778
  if (b.kind === "shell") items.push(shellItem(b.command, scope));
775
779
  else if (b.kind === "draft") drafts.push(b.text);
780
+ // Chat that had an image cannot be rebuilt with it, and a send is permanent:
781
+ // its text (with the re-attach note) goes to the composer instead of the queue.
782
+ else if (b.imageCount > 0) drafts.push(b.text);
776
783
  else items.push({ scope: scope, kind: "chat", text: b.text, images: [], pastes: [], steerNow: false, imageCount: 0, restoreText: b.text });
777
784
  });
778
785
  chatQueue.restore(items);
@@ -1,25 +1,23 @@
1
+ import { showOverlay } from './overlay.js';
2
+
1
3
  export function showToast(message, level, detail) {
2
- var el = document.createElement("div");
3
- el.className = "toast";
4
- if (level) el.classList.add("toast-" + level);
5
- el.textContent = message;
4
+ var text = document.createElement("div");
5
+ text.className = "overlay-text";
6
+ text.textContent = message;
7
+ var content = [text];
6
8
  if (detail) {
7
9
  var detailEl = document.createElement("div");
8
- detailEl.style.cssText = "font-size:11px;opacity:0.7;margin-top:4px;max-width:300px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap";
10
+ detailEl.className = "overlay-detail";
9
11
  detailEl.textContent = detail.split("\n")[0];
10
- el.appendChild(detailEl);
12
+ content.push(detailEl);
11
13
  }
12
- document.body.appendChild(el);
13
- requestAnimationFrame(function () { el.classList.add("visible"); });
14
14
  // "warn" and "error" toasts carry actionable failure text (e.g. the
15
15
  // worktree-remove "not a valid working tree" error, lr-76fbc3) that a
16
16
  // 1500ms toast dismisses before it can be read. Give both levels the same
17
17
  // longer window; plain success/info toasts keep the short default.
18
18
  var duration = (level === "warn" || level === "error") ? 5000 : 1500;
19
- setTimeout(function () {
20
- el.classList.remove("visible");
21
- setTimeout(function () { el.remove(); }, 300);
22
- }, duration);
19
+ // A plain toast leaves by itself, so it draws no close control.
20
+ showOverlay({ kind: "toast", severity: level, content: content, dismissible: false, timeout: duration });
23
21
  }
24
22
 
25
23
  var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) ||
@@ -32,10 +32,12 @@ export function renderVendorPicker(container, rows, actions) {
32
32
  label.className = "vendor-toggle-label";
33
33
  label.textContent = row.displayName;
34
34
  btn.appendChild(label);
35
- if (row.checkFailed || row.version) {
35
+ // Every agent has the same shape: icon, name. An installed CLI's version is
36
+ // not shown here (the button's tooltip still names the binary that will run).
37
+ if (row.checkFailed) {
36
38
  var note = document.createElement("span");
37
39
  note.className = "vendor-toggle-note";
38
- note.textContent = row.checkFailed ? "Could not check" : row.version;
40
+ note.textContent = "Could not check";
39
41
  btn.appendChild(note);
40
42
  }
41
43
  btn.addEventListener("click", function () { actions.onSelect(row.id); });
@@ -117,7 +117,7 @@ export function loginCommandFor(vendorId) {
117
117
  * An agent that is not usable says why when its probe knows (not installed, too
118
118
  * old, an override that points nowhere); one that is usable says which binary
119
119
  * and version will run.
120
- * @returns {Array<{id: string, displayName: string, icon: string, installed: boolean, checkFailed: boolean, active: boolean, version: string, title: string}>}
120
+ * @returns {Array<{id: string, displayName: string, icon: string, installed: boolean, checkFailed: boolean, active: boolean, title: string}>}
121
121
  */
122
122
  export function pickerRows(vendors, current) {
123
123
  return (vendors || []).map(function (v) {
@@ -135,7 +135,6 @@ export function pickerRows(vendors, current) {
135
135
  installed: !!v.installed,
136
136
  checkFailed: checkFailed,
137
137
  active: v.id === current,
138
- version: v.installed && detail.version ? detail.version : "",
139
138
  title: title,
140
139
  };
141
140
  });
@@ -1,4 +1,5 @@
1
1
  @import url("css/base.css");
2
+ @import url("css/overlay.css");
2
3
  @import url("css/login-panel.css");
3
4
  @import url("css/icon-strip.css");
4
5
  @import url("css/title-bar.css");
@@ -6,7 +7,7 @@
6
7
  @import url("css/overlays.css");
7
8
  @import url("css/menus.css");
8
9
  @import url("css/messages.css?v=20260407");
9
- @import url("css/channel-layout.css");
10
+ @import url("css/chat-layout.css");
10
11
  @import url("css/rewind.css");
11
12
  @import url("css/input.css");
12
13
  @import url("css/filebrowser.css");
@@ -24,6 +25,7 @@
24
25
  @import url("css/stt.css");
25
26
  @import url("css/profile.css");
26
27
  @import url("css/user-settings.css");
28
+ @import url("css/settings-nav.css");
27
29
  @import url("css/admin.css");
28
30
  @import url("css/session-search.css");
29
31
  @import url("css/tooltip.css");
package/lib/public/sw.js CHANGED
@@ -1,5 +1,10 @@
1
1
  var CACHE_NAME = "clagentic-console-offline-v__VERSION__";
2
2
 
3
+ // Colours of the offline placeholder page. The server fills this in when it
4
+ // serves the worker (lib/theme-seed.js), from the bundled theme files, so the
5
+ // worker holds no colour of its own.
6
+ var OFFLINE_PAGE_CSS = "__OFFLINE_PAGE_CSS__";
7
+
3
8
  // Minimal app-shell paths pre-cached on install so the new cache generation
4
9
  // is never empty at activate time. Without this, an offline mobile client
5
10
  // that goes offline in the window between activate (old cache deleted) and
@@ -98,9 +103,11 @@ self.addEventListener("fetch", function (event) {
98
103
  if (indexCached) return indexCached;
99
104
  return new Response(
100
105
  "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>Clagentic: Console</title>" +
101
- "<style>body{margin:0;background:#000;color:#888;display:flex;" +
106
+ "<style>body{margin:0;display:flex;" +
102
107
  "align-items:center;justify-content:center;height:100vh;" +
103
- "font-family:monospace;font-size:1.2em}</style></head>" +
108
+ "font-family:monospace;font-size:1.2em}" +
109
+ OFFLINE_PAGE_CSS +
110
+ "</style></head>" +
104
111
  "<body><p>Waiting for server&hellip;</p></body></html>",
105
112
  { headers: { "Content-Type": "text/html" } }
106
113
  );