@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
@@ -7,14 +7,18 @@ import { iconHtml, refreshIcons } from './icons.js';
7
7
  import { getSessionTools } from './tool-palette.js';
8
8
  import { parseEmojis } from './markdown.js';
9
9
  import { renderProjectIcon } from './project-icon.js';
10
- import { getCurrentTheme, getChatLayout, setChatLayout, toggleDarkMode, getBrand, setBrand } from './theme.js';
11
10
  import { openCommandPalette } from './command-palette.js';
12
11
  import { openAgentPicker, openAgentPickerForPreferred } from './agent-picker.js';
13
12
  import { openProjectSettings } from './project-settings.js';
13
+ import { canOpenProjectSettings } from './settings-access.js';
14
+ import { openSettingsHub } from './settings-hub.js';
14
15
  import {
15
16
  getCachedSessions,
16
17
  getDateGroup,
17
- openResumePicker
18
+ openResumePicker,
19
+ showSessionCtxMenu,
20
+ compactingBadgeHtml,
21
+ privateIndicatorHtml
18
22
  } from './sidebar-sessions.js';
19
23
  import {
20
24
  getCachedProjectList,
@@ -25,6 +29,9 @@ import {
25
29
  toggleFolderCollapsed,
26
30
  showProjectCtxMenu,
27
31
  showFolderCtxMenu,
32
+ showEmojiPicker,
33
+ showProjectAccessPopover,
34
+ canManageProjectAccess,
28
35
  groupByFolders,
29
36
  groupProjects
30
37
  } from './sidebar-projects.js';
@@ -35,6 +42,7 @@ import {
35
42
  getCachedDmRemovedUsers
36
43
  } from './sidebar-users.js';
37
44
  import { sessionActivity, rollupActivity, indicatorClass } from './activity-state.js';
45
+ import { sessionListAvatarsEnabled, onSessionListAvatarsChange, createSessionAgentAvatar } from './session-list-avatars.js';
38
46
 
39
47
  import { store } from './store.js';
40
48
  import { capabilityGate } from './vendor-registry.js';
@@ -46,12 +54,19 @@ import { showHomeHub, hideHomeHub, isHomeHubVisible } from './app-home-hub.js';
46
54
  import { openTerminal } from './terminal.js';
47
55
  import { loadRootDirectory } from './filebrowser.js';
48
56
  import { renderTeamSections } from './team-view.js';
57
+ import { showNavSheet, closeNavSheet, wireNavTabs, NAV_SHEET_EXIT_MS } from './mobile-nav-sheet.js';
58
+ import { showActionSheet } from './mobile-action-sheet.js';
59
+ import { showOverlay } from './overlay.js';
49
60
 
50
61
  // --- Mobile state ---
51
62
  var mobileChatSheetOpen = false;
52
63
  var expandedMobileLoopGroups = new Set();
53
64
  var expandedMobileLoopRuns = new Set();
54
65
 
66
+ // The open phone chat list repaints when "Avatars in session list" changes, as
67
+ // the desktop sidebar and Recent Sessions do.
68
+ onSessionListAvatarsChange(function () { refreshMobileChatSheet(); });
69
+
55
70
  export function openMobileSheet(type) {
56
71
  var sheet = document.getElementById("mobile-sheet");
57
72
  if (!sheet) return;
@@ -92,19 +107,20 @@ export function openMobileSheet(type) {
92
107
  renderSheetMore(listEl);
93
108
  }
94
109
 
95
- sheet.classList.remove("hidden", "closing");
110
+ // Opens the sheet, or keeps it open and changes what it shows (a nav button
111
+ // while another nav sheet is open): mobile-nav-sheet.js.
112
+ showNavSheet(type, { onClose: onMobileSheetClosed });
96
113
  // Always start at the top so the header actions are immediately visible
97
114
  if (listEl) listEl.scrollTop = 0;
98
115
  refreshIcons();
99
116
  }
100
117
 
101
118
  // Duration must match the .closing animation in mobile-nav.css
102
- var SHEET_CLOSE_MS = 230;
103
-
104
- function closeMobileSheet() {
105
- var sheet = document.getElementById("mobile-sheet");
106
- if (!sheet || sheet.classList.contains("hidden")) return;
119
+ var SHEET_CLOSE_MS = NAV_SHEET_EXIT_MS;
107
120
 
121
+ // The sheet closed, whether by a nav button, the close control, Escape, the
122
+ // scrim or a drag.
123
+ function onMobileSheetClosed(sheet) {
108
124
  mobileChatSheetOpen = false;
109
125
 
110
126
  // Return file tree to sidebar if it was moved
@@ -115,13 +131,16 @@ function closeMobileSheet() {
115
131
  sidebarFilesPanel.appendChild(fileTree);
116
132
  }
117
133
  }
118
- sheet.classList.add("closing");
134
+ // After the slide-down, unless the sheet was opened again meanwhile.
119
135
  setTimeout(function () {
120
- sheet.classList.add("hidden");
121
- sheet.classList.remove("closing", "sheet-files");
136
+ if (sheet.classList.contains("hidden")) sheet.classList.remove("sheet-files");
122
137
  }, SHEET_CLOSE_MS);
123
138
  }
124
139
 
140
+ function closeMobileSheet() {
141
+ closeNavSheet();
142
+ }
143
+
125
144
  // Close the sheet and run fn after the close animation completes.
126
145
  // Use this for session/project switches so the history replay flood
127
146
  // doesn't begin while the sheet slide-down is still animating.
@@ -378,7 +397,7 @@ function renderSheetSessions(listEl) {
378
397
  moreBtn.innerHTML = '<i data-lucide="ellipsis"></i>';
379
398
  moreBtn.title = "Project actions";
380
399
  moreBtn.addEventListener("click", function () {
381
- showChatProjectActionSheet(currentProject);
400
+ showChatProjectActionSheet(currentProject, moreBtn);
382
401
  });
383
402
  chatHeader.appendChild(moreBtn);
384
403
 
@@ -398,84 +417,125 @@ function renderSheetSessions(listEl) {
398
417
  }
399
418
 
400
419
  // Show a mini action sheet for current project actions (replaces old chips + context menu)
401
- function showChatProjectActionSheet(proj) {
402
- var overlay = document.createElement("div");
403
- overlay.className = "mobile-action-sheet-overlay";
404
-
405
- var sheet = document.createElement("div");
406
- sheet.className = "mobile-action-sheet";
420
+ // anchorEl: the visible control the picker and the access popover hang from.
421
+ function showChatProjectActionSheet(proj, anchorEl) {
422
+ var actions = [];
407
423
 
408
424
  function addAction(icon, label, handler) {
409
- var btn = document.createElement("button");
410
- btn.className = "mobile-action-sheet-item";
411
- btn.innerHTML = '<i data-lucide="' + icon + '"></i><span>' + label + '</span>';
412
- btn.addEventListener("click", function () {
413
- document.body.removeChild(overlay);
414
- handler();
415
- });
416
- sheet.appendChild(btn);
425
+ actions.push({ icon: icon, label: label, handler: handler });
417
426
  }
418
427
 
419
428
  if (proj) {
420
- addAction("settings", "Project Settings", function () {
421
- setTimeout(function () {
422
- openProjectSettings(proj.slug, {
423
- slug: proj.slug, name: proj.name, icon: proj.icon,
424
- projectOwnerId: store.get('currentProjectOwnerId'),
425
- ownerLocked: store.get('ownerLocked')
426
- });
427
- }, 250);
428
- });
429
+ if (canOpenProjectSettings(store.get('permissions'))) {
430
+ addAction("settings", "Project Settings", function () {
431
+ setTimeout(function () {
432
+ openProjectSettings(proj.slug, {
433
+ slug: proj.slug, name: proj.name, icon: proj.icon,
434
+ projectOwnerId: store.get('currentProjectOwnerId'),
435
+ ownerLocked: store.get('ownerLocked')
436
+ });
437
+ }, 250);
438
+ });
439
+ }
429
440
 
441
+ // Anchored to the visible "..." button: the icon strip is hidden on a phone.
430
442
  addAction("smile", "Set Icon", function () {
431
- // Trigger emoji picker via icon strip button context menu
432
- setTimeout(function () {
433
- var stripEl = document.querySelector('[data-slug="' + proj.slug + '"]');
434
- if (stripEl) {
435
- var ctxEvt = new MouseEvent("contextmenu", { bubbles: true, cancelable: true });
436
- stripEl.dispatchEvent(ctxEvt);
437
- }
438
- }, 250);
443
+ setTimeout(function () { showEmojiPicker(proj.slug, anchorEl); }, 250);
439
444
  });
440
445
 
441
446
  addAction("bot", "Set Preferred Agent", function () {
442
447
  setTimeout(function () { openAgentPickerForPreferred(proj.slug); }, 250);
443
448
  });
444
449
 
445
- // Manage Access: only show for multi-user if owner/admin
446
- var perms = store.get('permissions');
447
- var isMultiUser = store.get('isMultiUser');
448
- if (isMultiUser && (!perms || perms.manageAccess !== false)) {
450
+ // Manage Access: multi-user only, and the same owner/admin gate as the
451
+ // desktop project menu; it opens the same access popover.
452
+ if (store.get('isMultiUser') && canManageProjectAccess(proj.slug)) {
449
453
  addAction("users", "Manage Access", function () {
450
- setTimeout(function () {
451
- var accessBtn = document.getElementById("manage-access-btn");
452
- if (accessBtn) accessBtn.click();
453
- }, 250);
454
+ setTimeout(function () { showProjectAccessPopover(anchorEl, proj.slug); }, 250);
454
455
  });
455
456
  }
456
457
  }
457
458
 
458
- var cancelBtn = document.createElement("button");
459
- cancelBtn.className = "mobile-action-sheet-cancel";
460
- cancelBtn.textContent = "Cancel";
461
- cancelBtn.addEventListener("click", function () {
462
- document.body.removeChild(overlay);
463
- });
464
- sheet.appendChild(cancelBtn);
459
+ showActionSheet({ actions: actions });
460
+ }
465
461
 
466
- overlay.appendChild(sheet);
467
- overlay.addEventListener("click", function (e) {
468
- if (e.target === overlay) document.body.removeChild(overlay);
462
+ // Rename from the phone list. The desktop rename edits the desktop list in place,
463
+ // which a phone does not show, and the open list is rebuilt on every session
464
+ // update, so a dialog is used: it survives the rebuild.
465
+ function promptMobileSessionRename(sessionId, currentTitle) {
466
+ var handle = null;
467
+ var input = document.createElement("input");
468
+ input.type = "text";
469
+ input.className = "session-rename-input";
470
+ input.value = currentTitle || "New Session";
471
+ input.setAttribute("aria-label", "Session name");
472
+
473
+ var cancel = document.createElement("button");
474
+ cancel.className = "confirm-btn confirm-cancel";
475
+ cancel.textContent = "Cancel";
476
+ var save = document.createElement("button");
477
+ save.className = "confirm-btn confirm-ok";
478
+ save.textContent = "Rename";
479
+ var actions = document.createElement("div");
480
+ actions.className = "confirm-actions";
481
+ actions.appendChild(cancel);
482
+ actions.appendChild(save);
483
+
484
+ var text = document.createElement("div");
485
+ text.className = "confirm-text";
486
+ text.textContent = "Rename session";
487
+
488
+ function commit() {
489
+ var newTitle = input.value.trim();
490
+ handle.close();
491
+ if (newTitle && newTitle !== currentTitle && getWs() && store.get('connected')) {
492
+ getWs().send(JSON.stringify({ type: "rename_session", id: sessionId, title: newTitle }));
493
+ }
494
+ }
495
+ cancel.addEventListener("click", function () { handle.close(); });
496
+ save.addEventListener("click", commit);
497
+ input.addEventListener("keydown", function (e) {
498
+ if (e.key === "Enter") { e.preventDefault(); commit(); }
469
499
  });
470
- document.body.appendChild(overlay);
471
- refreshIcons();
500
+
501
+ handle = showOverlay({ kind: "modal", content: [text, input, actions], closeLabel: "Cancel" });
502
+ input.focus();
503
+ input.select();
472
504
  }
473
505
 
474
- // Helper: create a mobile session item element
506
+ // Helper: create a mobile session row: the session button plus its actions
507
+ // control. The control is a sibling, not a child, because a button cannot hold a
508
+ // button.
475
509
  function createMobileSessionItem(s) {
510
+ var row = document.createElement("div");
511
+ row.className = "mobile-session-row";
512
+ row.appendChild(createMobileSessionButton(s));
513
+
514
+ var actionsBtn = document.createElement("button");
515
+ actionsBtn.className = "mobile-session-row-actions";
516
+ actionsBtn.title = "Session actions";
517
+ actionsBtn.setAttribute("aria-label", "Session actions");
518
+ actionsBtn.innerHTML = iconHtml("ellipsis");
519
+ actionsBtn.addEventListener("click", function (e) {
520
+ e.stopPropagation();
521
+ showSessionCtxMenu(actionsBtn, s.id, s.title, s.cliSessionId, s, {
522
+ onRename: promptMobileSessionRename,
523
+ opener: actionsBtn
524
+ });
525
+ });
526
+ row.appendChild(actionsBtn);
527
+ return row;
528
+ }
529
+
530
+ function createMobileSessionButton(s) {
476
531
  var el = document.createElement("button");
477
532
  el.className = "mobile-session-item" + (s.active ? " active" : "");
478
533
 
534
+ // With avatars on, the agent's avatar leads the row, before the processing dot.
535
+ if (s.agentName && sessionListAvatarsEnabled()) {
536
+ el.appendChild(createSessionAgentAvatar(s.agentName));
537
+ }
538
+
479
539
  // Processing dot (left side, before title)
480
540
  var msiActivityState = sessionActivity(s, store.get('myUserId'));
481
541
  var msiActivityCls = indicatorClass(msiActivityState);
@@ -486,12 +546,16 @@ function createMobileSessionItem(s) {
486
546
  el.appendChild(dot);
487
547
  }
488
548
 
549
+ // The same compacting and private indicators the desktop row draws, in the
550
+ // same order.
551
+ el.insertAdjacentHTML("beforeend", compactingBadgeHtml(s) + privateIndicatorHtml(s));
552
+
489
553
  // lr-7db0 — agent badge for sessions cast as a named agent. Icon-only with
490
554
  // the agent name in `title`, matching desktop sidebar-sessions.js. Built as
491
555
  // a span via innerHTML to reuse iconHtml() the same way desktop does, then
492
556
  // appended before the title node so the agent name does not leak into the
493
557
  // text node (mobile reads .textContent for window-title sync).
494
- if (s.agentName) {
558
+ if (s.agentName && !sessionListAvatarsEnabled()) {
495
559
  var agentBadge = document.createElement("span");
496
560
  agentBadge.className = "session-agent-badge";
497
561
  agentBadge.title = "Agent: " + s.agentName;
@@ -1040,15 +1104,6 @@ function renderSheetMore(listEl) {
1040
1104
  return btn;
1041
1105
  }
1042
1106
 
1043
- function addInlineRow(icon, label, valueText) {
1044
- var row = document.createElement("div");
1045
- row.className = "mobile-more-item mobile-more-inline-row";
1046
- row.innerHTML = '<i data-lucide="' + icon + '"></i><span class="mobile-more-item-label">' + label + '</span>'
1047
- + '<span class="mobile-more-inline-value">' + valueText + '</span>';
1048
- listEl.appendChild(row);
1049
- return row;
1050
- }
1051
-
1052
1107
  // --- Section 1: Tools (driven from SESSION_TOOLS registry) ---
1053
1108
  // File browser and terminal need special mobile handlers; everything
1054
1109
  // else is proxied through the palette button ID.
@@ -1075,92 +1130,16 @@ function renderSheetMore(listEl) {
1075
1130
 
1076
1131
  addDivider();
1077
1132
 
1078
- // --- Section 2: Project & Server ---
1079
- addItem("folder-cog", "Project Settings", function () {
1080
- closeMobileSheet();
1081
- setTimeout(function () {
1082
- var proj = null;
1083
- for (var pi = 0; pi < getCachedProjectList().length; pi++) {
1084
- if (getCachedProjectList()[pi].slug === getCachedCurrentSlug()) {
1085
- proj = getCachedProjectList()[pi];
1086
- break;
1087
- }
1088
- }
1089
- if (proj && store.get('ownerLocked')) proj = Object.assign({}, proj, { ownerLocked: true });
1090
- openProjectSettings(getCachedCurrentSlug(), proj);
1091
- }, 250);
1092
- });
1093
- addItem("settings", "Server Settings", function () {
1133
+ // --- Section 2: Settings ---
1134
+ // One entry. Every setting, the user's, the project's and the server's, is
1135
+ // reached from the Settings list it opens; none is edited in this sheet.
1136
+ var settingsItem = addItem("settings", "Settings", function () {
1094
1137
  closeMobileSheet();
1095
- var btn = document.getElementById("server-settings-btn");
1096
- if (btn) setTimeout(function () { btn.click(); }, 250);
1097
- });
1098
-
1099
- addDivider();
1100
-
1101
- // --- Section 3: Appearance ---
1102
-
1103
- // Dark mode — real toggle switch
1104
- var isDark = getCurrentTheme().variant === "dark";
1105
- var themeRow = document.createElement("div");
1106
- themeRow.className = "mobile-more-item mobile-more-toggle-row";
1107
-
1108
- var themeLeft = document.createElement("span");
1109
- themeLeft.className = "mobile-more-toggle-left";
1110
- themeLeft.innerHTML = '<i data-lucide="' + (isDark ? "moon" : "sun") + '"></i><span class="mobile-more-item-label">Dark mode</span>';
1111
- themeRow.appendChild(themeLeft);
1112
-
1113
- var toggleWrap = document.createElement("label");
1114
- toggleWrap.className = "mobile-settings-theme-toggle";
1115
- var toggleInput = document.createElement("input");
1116
- toggleInput.type = "checkbox";
1117
- toggleInput.checked = isDark;
1118
- var toggleThumb = document.createElement("span");
1119
- toggleThumb.className = "mobile-settings-theme-thumb";
1120
- toggleWrap.appendChild(toggleInput);
1121
- toggleWrap.appendChild(toggleThumb);
1122
- themeRow.appendChild(toggleWrap);
1123
- listEl.appendChild(themeRow);
1124
-
1125
- toggleInput.addEventListener("change", function () {
1126
- toggleDarkMode();
1127
- setTimeout(function () {
1128
- var nowDark = getCurrentTheme().variant === "dark";
1129
- toggleInput.checked = nowDark;
1130
- themeLeft.innerHTML = '<i data-lucide="' + (nowDark ? "moon" : "sun") + '"></i><span class="mobile-more-item-label">Dark mode</span>';
1131
- refreshIcons();
1132
- }, 50);
1133
- });
1134
-
1135
- // Chat layout — inline selector showing current value
1136
- var currentLayout = getChatLayout();
1137
- var layoutRow = addInlineRow("layout-panel-left", "Chat layout", currentLayout === "bubble" ? "Bubble" : "Channel");
1138
- layoutRow.style.cursor = "pointer";
1139
- layoutRow.addEventListener("click", function () {
1140
- var next = getChatLayout() === "bubble" ? "channel" : "bubble";
1141
- setChatLayout(next);
1142
- fetch('/api/user/chat-layout', {
1143
- method: 'PUT',
1144
- headers: { 'Content-Type': 'application/json' },
1145
- body: JSON.stringify({ layout: next })
1146
- });
1147
- var valEl = layoutRow.querySelector(".mobile-more-inline-value");
1148
- if (valEl) valEl.textContent = next === "bubble" ? "Bubble" : "Channel";
1149
- });
1150
-
1151
- // Brand — inline selector showing current value
1152
- var currentBrand = getBrand();
1153
- var brandRow = addInlineRow("palette", "Brand", currentBrand === "clagentic" ? "Clagentic" : "Classic");
1154
- brandRow.style.cursor = "pointer";
1155
- brandRow.addEventListener("click", function () {
1156
- var nb = getBrand() === "classic" ? "clagentic" : "classic";
1157
- setBrand(nb);
1158
- var valEl = brandRow.querySelector(".mobile-more-inline-value");
1159
- if (valEl) valEl.textContent = nb === "clagentic" ? "Clagentic" : "Classic";
1160
- refreshIcons();
1138
+ openSettingsHub();
1161
1139
  });
1140
+ settingsItem.insertAdjacentHTML("beforeend", '<i data-lucide="chevron-right"></i>');
1162
1141
 
1163
- // --- Section 4: App ---
1142
+ // --- Section 3: App ---
1164
1143
  if (!document.documentElement.classList.contains("pwa-standalone")) {
1165
1144
  addDivider();
1166
1145
  addItem("smartphone", "Open as app", function () {
@@ -1173,13 +1152,11 @@ function renderSheetMore(listEl) {
1173
1152
 
1174
1153
  export function initSidebarMobile() {
1175
1154
 
1176
- // --- Mobile sheet close handlers ---
1155
+ // The close control, the scrim and Escape close the sheet through the shared
1156
+ // overlay component (mobile-nav-sheet.js).
1177
1157
  var mobileSheet = document.getElementById("mobile-sheet");
1178
1158
  if (mobileSheet) {
1179
- var sheetBackdrop = mobileSheet.querySelector(".mobile-sheet-backdrop");
1180
- var sheetCloseBtn = mobileSheet.querySelector(".mobile-sheet-close");
1181
- if (sheetBackdrop) sheetBackdrop.addEventListener("click", closeMobileSheet);
1182
- if (sheetCloseBtn) sheetCloseBtn.addEventListener("click", closeMobileSheet);
1159
+ var sheetBackdrop = mobileSheet.querySelector(".overlay-modal-backdrop");
1183
1160
 
1184
1161
  // --- Drag to dismiss sheet ---
1185
1162
  var sheetHandle = mobileSheet.querySelector(".mobile-sheet-handle");
@@ -1226,18 +1203,7 @@ export function initSidebarMobile() {
1226
1203
  sheetBackdrop.style.opacity = "";
1227
1204
  }
1228
1205
  // Close without animation since we already animated
1229
- var sheet = document.getElementById("mobile-sheet");
1230
- if (sheet) {
1231
- if (sheet.classList.contains("sheet-files")) {
1232
- var fileTree = document.getElementById("file-tree");
1233
- var sidebarFilesPanel = document.getElementById("sidebar-panel-files");
1234
- if (fileTree && sidebarFilesPanel) {
1235
- sidebarFilesPanel.appendChild(fileTree);
1236
- }
1237
- }
1238
- sheet.classList.add("hidden");
1239
- sheet.classList.remove("closing", "sheet-files");
1240
- }
1206
+ closeNavSheet({ immediate: true });
1241
1207
  }, 230);
1242
1208
  } else {
1243
1209
  sheetContent.style.transition = "transform 0.2s ease-out";
@@ -1281,30 +1247,20 @@ export function initSidebarMobile() {
1281
1247
  }
1282
1248
  }
1283
1249
 
1284
- for (var t = 0; t < mobileTabs.length; t++) {
1285
- (function (tab) {
1286
- tab.addEventListener("click", function () {
1287
- var name = tab.dataset.tab;
1288
-
1289
- if (name === "projects") {
1290
- openMobileSheet("projects");
1291
- setMobileTabActive("projects");
1292
- } else if (name === "chat") {
1293
- openMobileSheet("sessions");
1294
- setMobileTabActive("chat");
1295
- } else if (name === "team") {
1296
- openMobileSheet("team");
1297
- setMobileTabActive("team");
1298
- } else if (name === "more") {
1299
- openMobileSheet("more");
1300
- setMobileTabActive("more");
1301
- }
1302
- });
1303
- })(mobileTabs[t]);
1304
- }
1250
+ // One rule for every nav sheet: the open sheet's button closes it, another
1251
+ // button switches to its own sheet.
1252
+ wireNavTabs(mobileTabs, {
1253
+ open: function (type, tabName) {
1254
+ openMobileSheet(type);
1255
+ setMobileTabActive(tabName);
1256
+ },
1257
+ close: closeMobileSheet,
1258
+ });
1305
1259
 
1306
1260
  if (mobileHomeBtn) {
1307
1261
  mobileHomeBtn.addEventListener("click", function () {
1262
+ // The nav stays in view under a sheet, so the full-screen view replaces it.
1263
+ closeMobileSheet();
1308
1264
  closeSidebar();
1309
1265
  if (isHomeHubVisible()) {
1310
1266
  hideHomeHub();