@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
@@ -0,0 +1,98 @@
1
+ // app-modals.js - the confirm, paste and image modals.
2
+ //
3
+ // Each opens through the shared overlay component as a "modal" (overlay-modal.js):
4
+ // the scrim, the card, the layer and the close control are the component's, and
5
+ // Escape, a click on the scrim and the close control all close it. Only what is
6
+ // inside the card is drawn here.
7
+
8
+ import { showOverlay } from './overlay.js';
9
+ import { iconHtml } from './icons.js';
10
+ import { copyToClipboard } from './utils.js';
11
+
12
+ // One of each is open at most; showing another replaces it.
13
+ var confirmHandle = null;
14
+ var pasteHandle = null;
15
+ var imageHandle = null;
16
+
17
+ function el(tag, className, text) {
18
+ var node = document.createElement(tag);
19
+ if (className) node.className = className;
20
+ if (text !== undefined) node.textContent = text;
21
+ return node;
22
+ }
23
+
24
+ // Open a modal and keep its handle in a slot; the slot clears when it closes.
25
+ function openInSlot(get, set, opts) {
26
+ if (get()) get().close();
27
+ var handle = null;
28
+ var userRemove = opts.onRemove;
29
+ opts.onRemove = function (node) {
30
+ if (get() === handle) set(null);
31
+ if (userRemove) userRemove(node);
32
+ };
33
+ handle = showOverlay(opts);
34
+ set(handle);
35
+ return handle;
36
+ }
37
+
38
+ /**
39
+ * Ask the operator to confirm. Escape, a click on the scrim and the close control
40
+ * all cancel: onConfirm does not run.
41
+ *
42
+ * @param {string} text
43
+ * @param {function(): void} onConfirm runs after the modal has closed, so it may
44
+ * open another confirmation.
45
+ * @param {string} [okLabel="Delete"]
46
+ * @param {boolean} [destructive=true] false draws the confirming button as a
47
+ * plain accent button.
48
+ */
49
+ export function showConfirm(text, onConfirm, okLabel, destructive) {
50
+ var handle = null;
51
+ var cancel = el("button", "confirm-btn confirm-cancel", "Cancel");
52
+ var ok = el("button", "confirm-btn " + (destructive === false ? "confirm-ok" : "confirm-delete"), okLabel || "Delete");
53
+ var actions = el("div", "confirm-actions");
54
+ actions.appendChild(cancel);
55
+ actions.appendChild(ok);
56
+ cancel.addEventListener("click", function () { handle.close(); });
57
+ ok.addEventListener("click", function () {
58
+ handle.close();
59
+ if (onConfirm) onConfirm();
60
+ });
61
+ handle = openInSlot(
62
+ function () { return confirmHandle; },
63
+ function (h) { confirmHandle = h; },
64
+ { kind: "modal", id: "confirm-modal", content: [el("div", "confirm-text", text), actions], closeLabel: "Cancel" }
65
+ );
66
+ }
67
+
68
+ /** Show the text the operator pasted, with a button that copies it. */
69
+ export function showPasteModal(text) {
70
+ var copy = el("button", "paste-modal-copy");
71
+ copy.setAttribute("type", "button");
72
+ copy.setAttribute("title", "Copy to clipboard");
73
+ copy.innerHTML = iconHtml("copy");
74
+ copy.addEventListener("click", function () { copyToClipboard(text, "Copied to clipboard"); });
75
+ var actions = el("div", "paste-modal-actions");
76
+ actions.appendChild(copy);
77
+ var header = el("div", "paste-modal-header");
78
+ header.appendChild(el("span", "paste-modal-title", "Pasted content"));
79
+ header.appendChild(actions);
80
+
81
+ openInSlot(
82
+ function () { return pasteHandle; },
83
+ function (h) { pasteHandle = h; },
84
+ { kind: "modal", id: "paste-modal", dialogClass: "paste-modal-dialog", content: [header, el("pre", "paste-modal-body", text)] }
85
+ );
86
+ }
87
+
88
+ /** Show an image full size over the page. */
89
+ export function showImageModal(src) {
90
+ var img = el("img", "image-modal-img");
91
+ img.setAttribute("alt", "");
92
+ img.setAttribute("src", src);
93
+ openInSlot(
94
+ function () { return imageHandle; },
95
+ function (h) { imageHandle = h; },
96
+ { kind: "modal", id: "image-modal", card: false, scrim: "dark", content: img }
97
+ );
98
+ }
@@ -19,6 +19,8 @@ import { isSurfaceWanted, shouldChimeForNotification } from './notification-pref
19
19
  import { playDoneSound, isNotifSoundEnabled } from './notifications.js';
20
20
  import { initNotifyClient, noteNotificationsState, routeTo, takePendingSession, takePendingPlace, registerPlace } from './notify-client.js';
21
21
  import { applyBuildOffer, withdrawBuildOffer, openDiagnosticsPanel } from './diagnostics.js';
22
+ import { showOverlay } from './overlay.js';
23
+ import { getStack, addToStack, removeFromStack, clearGroup } from './overlay-stack.js';
22
24
  import '../notify-sw-logic.js';
23
25
 
24
26
  // The server dismisses a prompt's banner once the prompt settles, however it
@@ -27,12 +29,24 @@ var notifications = [];
27
29
  // The notification behind each banner on screen, by id.
28
30
  var shownNotifs = Object.create(null);
29
31
  var unreadCount = 0;
32
+ // The shared overlay stack (overlay-stack.js): this module's banners sit in it
33
+ // beside the toasts, and clear only their own group.
30
34
  var bannerContainer = null;
35
+ var BANNER_GROUP = "notifications";
31
36
  var bellBtn = null;
32
37
  var badgeEl = null;
33
38
 
34
39
  var BUILD_OFFER_TYPE = "build_update_offer";
35
40
 
41
+ // The product logo in a banner's icon slot (rounded by css, not inline).
42
+ var LOGO_HTML = '<img class="notif-banner-logo" src="/icon-banded-76.png" width="32" height="32" alt="Clagentic: Console">';
43
+
44
+ // The offer is the transport for the diagnostics pop-up and entry; the bell's
45
+ // list and count leave it out, so a lone offer never reads as an unread item
46
+ // the bell cannot show.
47
+ function isBuildOffer(n) { return !!n && n.type === BUILD_OFFER_TYPE; }
48
+ function isBellListed(n) { return !isBuildOffer(n); }
49
+
36
50
  var activeAuthRequiredMsg = null;
37
51
  var authReminderVisible = false;
38
52
 
@@ -44,14 +58,11 @@ export function initAppNotifications() {
44
58
  bellBtn = document.getElementById("notif-center-btn");
45
59
  badgeEl = document.getElementById("notif-center-badge");
46
60
 
47
- // Create banner container
48
- bannerContainer = document.createElement("div");
49
- bannerContainer.className = "notif-banner-container";
50
- document.body.appendChild(bannerContainer);
61
+ bannerContainer = getStack();
51
62
 
52
63
  initNotifyClient();
53
64
  // The build-update offer's action (the restart button) lives in the
54
- // diagnostics panel; a tap on its banner or push opens it.
65
+ // diagnostics panel; a tap on its push opens it.
55
66
  registerPlace(BUILD_OFFER_TYPE, openDiagnosticsPanel);
56
67
 
57
68
  if (bellBtn) {
@@ -68,18 +79,19 @@ export function initAppNotifications() {
68
79
 
69
80
  function showAllBanners() {
70
81
  // Clear existing banners first
71
- if (bannerContainer) bannerContainer.innerHTML = "";
82
+ if (bannerContainer) clearGroup(BANNER_GROUP);
72
83
 
73
- for (var i = 0; i < notifications.length; i++) {
74
- showNotificationBanner(notifications[i], false);
84
+ var listed = notifications.filter(isBellListed);
85
+ for (var i = 0; i < listed.length; i++) {
86
+ showNotificationBanner(listed[i], false);
75
87
  }
76
88
 
77
89
  if (activeAuthRequiredMsg) showAuthRequiredBanner(activeAuthRequiredMsg);
78
90
  if (authReminderVisible) showLoginReminderBanner();
79
91
 
80
92
  // Check if any banner actually got rendered (update/auth banners can be suppressed)
81
- var hasVisibleBanner = bannerContainer.children.length > 0;
82
- if (notifications.length === 0 && !hasVisibleBanner) {
93
+ var hasVisibleBanner = bannerContainer.querySelectorAll(".notif-banner").length > 0;
94
+ if (!notifications.some(isBellListed) && !hasVisibleBanner) {
83
95
  showBanner({
84
96
  id: "_empty",
85
97
  type: "info",
@@ -95,8 +107,11 @@ function showAllBanners() {
95
107
  // ========================================================
96
108
 
97
109
  // An update notice has its own banner (the "Update now" action); every other
98
- // notification renders from the generic one.
110
+ // notification renders from the generic one. The build-update offer has none:
111
+ // its one alert is the diagnostics pop-up carrying the restart action
112
+ // (diagnostics.js), so a stack banner would show the same offer twice.
99
113
  function showNotificationBanner(notif, autoDismissMs) {
114
+ if (isBuildOffer(notif)) return;
100
115
  if (notif.type === "update_available") showUpdateBanner({ version: notif.meta && notif.meta.version }, notif.id);
101
116
  else showBanner(notif, autoDismissMs);
102
117
  }
@@ -107,34 +122,32 @@ function showBanner(notif, autoDismissMs) {
107
122
  var isEmpty = notif.id === "_empty";
108
123
  var isPermission = notif.type === "permission_request" && notif.meta && notif.meta.requestId;
109
124
  var isAuthRequired = notif.type === "auth_required";
110
- var isBuildOffer = notif.type === BUILD_OFFER_TYPE;
111
125
  var isUserMention = notif.type === "user_mention";
112
126
  var isReminder = notif.type === "permission_reminder";
113
127
  var projectIcon = isEmpty ? null : getProjectIcon(notif.slug);
114
128
  var projectName = isEmpty ? "" : (isAuthRequired ? "CLAGENTIC" : getProjectName(notif.slug));
115
129
  var userMentionAvatarSrc = isUserMention ? buildUserMentionAvatarSrc(notif) : null;
116
130
 
117
- var banner = document.createElement("div");
118
- banner.className = "notif-banner" + (isAuthRequired ? " notif-banner-update notif-banner-auth" : isPermission ? " notif-banner-permission" : isUserMention ? " notif-banner-user-mention" : isReminder ? " notif-banner-reminder" : "");
119
- if (!isEmpty) banner.setAttribute("data-notif-id", notif.id);
120
- if (!isEmpty && notif.type) banner.setAttribute("data-notif-type", notif.type);
131
+ var attrs = {};
132
+ if (!isEmpty) attrs["data-notif-id"] = notif.id;
133
+ if (!isEmpty && notif.type) attrs["data-notif-type"] = notif.type;
121
134
  if (!isEmpty && notif.liveInState === true) {
122
- banner.setAttribute("data-live-in-state", "true");
135
+ attrs["data-live-in-state"] = "true";
123
136
  shownNotifs[notif.id] = notif;
124
137
  }
125
- if (isAuthRequired) banner.setAttribute("data-auth-banner", "true");
138
+ if (isAuthRequired) attrs["data-auth-banner"] = "true";
126
139
 
127
140
  var iconHtmlStr = userMentionAvatarSrc
128
141
  ? '<img class="notif-banner-avatar" src="' + escapeHtml(userMentionAvatarSrc) + '" alt="' + escapeHtml((notif.meta && notif.meta.fromName) || "User") + '">'
129
142
  : isAuthRequired
130
- ? '<img src="/icon-banded-76.png" width="32" height="32" alt="Clagentic: Console" style="border-radius:8px">'
143
+ ? LOGO_HTML
131
144
  : projectIcon
132
145
  // projectIconHtml() routes custom (:slug:) icons to a safe <img> tag and
133
146
  // emoji to escaped text — the raw `projectIcon` interpolation previously
134
147
  // showed ':slug:' as literal text (lr-a6da).
135
148
  ? '<span class="notif-banner-emoji">' + projectIconHtml(projectIcon) + '</span>'
136
149
  : isEmpty
137
- ? '<img src="/icon-banded-76.png" width="32" height="32" alt="Clagentic: Console" style="border-radius:8px">'
150
+ ? LOGO_HTML
138
151
  : iconHtml("folder");
139
152
 
140
153
  // A tool-approval prompt is titled "Can I ...?", like its card.
@@ -163,7 +176,7 @@ function showBanner(notif, autoDismissMs) {
163
176
  // The server says whose prompt this is (project, session, agent): a banner
164
177
  // reaches every client whatever project it is viewing, and the tool request
165
178
  // alone does not say.
166
- banner.innerHTML =
179
+ var content =
167
180
  '<div class="notif-banner-icon">' + iconHtmlStr + '</div>' +
168
181
  '<div class="notif-banner-body">' +
169
182
  (projectName ? '<div class="notif-banner-project">' + escapeHtml(projectName) + '</div>' : '') +
@@ -171,38 +184,35 @@ function showBanner(notif, autoDismissMs) {
171
184
  '<div class="notif-banner-title">' + escapeHtml(notif.title) + '</div>' +
172
185
  (notif.body ? '<div class="notif-banner-text">' + escapeHtml(notif.body) + '</div>' : '') +
173
186
  actionsHtml +
174
- '</div>' +
175
- (!isEmpty ? '<button class="notif-banner-close">' + iconHtml("x") + '</button>' : '');
176
-
177
- bannerContainer.appendChild(banner);
187
+ '</div>';
188
+
189
+ var banner = showOverlay({
190
+ kind: "banner",
191
+ group: BANNER_GROUP,
192
+ className: "notif-banner" + (isAuthRequired ? " notif-banner-update notif-banner-auth" : isPermission ? " notif-banner-permission" : isUserMention ? " notif-banner-user-mention" : isReminder ? " notif-banner-reminder" : ""),
193
+ attrs: attrs,
194
+ content: content,
195
+ // The empty-state note has nothing to dismiss: it goes by itself.
196
+ dismissible: !isEmpty,
197
+ closeLabel: "Dismiss notification",
198
+ // Auto-dismiss (number = ms, true = 3 s, false = stay)
199
+ timeout: typeof autoDismissMs === "number" ? autoDismissMs : (autoDismissMs === true ? 3000 : null),
200
+ onDismiss: function () {
201
+ if (isAuthRequired) activeAuthRequiredMsg = null;
202
+ dismissNotif(notif.id);
203
+ },
204
+ onRemove: bannerRemoved,
205
+ }).el;
178
206
  refreshIcons();
179
207
  ensureClearAllButton();
180
208
 
181
- requestAnimationFrame(function () {
182
- banner.classList.add("show");
183
- });
184
-
185
209
  if (!isEmpty) {
186
210
  if (!isAuthRequired) {
187
- // Click banner body -> navigate + dismiss. An offer is not declined by
188
- // looking at it: its tap opens the place the restart lives in, and only
189
- // its close button declines it.
190
- banner.addEventListener("click", function (e) {
191
- if (e.target.closest(".notif-banner-close")) return;
192
- removeBanner(banner);
193
- if (!isBuildOffer) dismissNotif(notif.id);
194
- navigateToNotification(notif);
195
- });
196
- }
197
-
198
- // Close button -> dismiss
199
- var closeBtn = banner.querySelector(".notif-banner-close");
200
- if (closeBtn) {
201
- closeBtn.addEventListener("click", function (e) {
202
- e.stopPropagation();
203
- if (isAuthRequired) activeAuthRequiredMsg = null;
211
+ // Click banner body -> navigate + dismiss.
212
+ banner.addEventListener("click", function () {
204
213
  removeBanner(banner);
205
214
  dismissNotif(notif.id);
215
+ navigateToNotification(notif);
206
216
  });
207
217
  }
208
218
 
@@ -237,13 +247,6 @@ function showBanner(notif, autoDismissMs) {
237
247
  }
238
248
  }
239
249
  }
240
-
241
- // Auto-dismiss (number = ms, false = stay)
242
- if (typeof autoDismissMs === "number") {
243
- setTimeout(function () { removeBanner(banner); }, autoDismissMs);
244
- } else if (autoDismissMs === true) {
245
- setTimeout(function () { removeBanner(banner); }, 3000);
246
- }
247
250
  }
248
251
 
249
252
  function startLoginCommand(loginCommand, vendor) {
@@ -263,29 +266,27 @@ function showLoginReminderBanner() {
263
266
  authReminderVisible = true;
264
267
  var existing = bannerContainer.querySelector('[data-auth-reminder="true"]');
265
268
  if (existing) removeBanner(existing);
266
- var banner = document.createElement("div");
267
- banner.className = "notif-banner notif-banner-update";
268
- banner.setAttribute("data-notif-id", "_auth_reminder");
269
- banner.setAttribute("data-auth-reminder", "true");
270
- banner.innerHTML =
271
- '<div class="notif-banner-icon">' + iconHtml("check-circle") + '</div>' +
272
- '<div class="notif-banner-body">' +
273
- '<div class="notif-banner-project">CONSOLE</div>' +
274
- '<div class="notif-banner-title">Login started</div>' +
275
- '<div class="notif-banner-text">After the login completes, open a new session so Clagentic: Console picks up the fresh auth state.</div>' +
276
- '<div class="notif-banner-actions">' +
277
- '<button class="notif-banner-new-session notif-banner-update-now">Open new session</button>' +
278
- '</div>' +
279
- '</div>' +
280
- '<button class="notif-banner-close">' + iconHtml("x") + '</button>';
281
-
282
- bannerContainer.appendChild(banner);
269
+ var banner = showOverlay({
270
+ kind: "banner",
271
+ group: BANNER_GROUP,
272
+ className: "notif-banner notif-banner-update",
273
+ attrs: { "data-notif-id": "_auth_reminder", "data-auth-reminder": "true" },
274
+ content:
275
+ '<div class="notif-banner-icon">' + iconHtml("check-circle") + '</div>' +
276
+ '<div class="notif-banner-body">' +
277
+ '<div class="notif-banner-project">CONSOLE</div>' +
278
+ '<div class="notif-banner-title">Login started</div>' +
279
+ '<div class="notif-banner-text">After the login completes, open a new session so Clagentic: Console picks up the fresh auth state.</div>' +
280
+ '<div class="notif-banner-actions">' +
281
+ '<button class="notif-banner-new-session notif-banner-update-now">Open new session</button>' +
282
+ '</div>' +
283
+ '</div>',
284
+ closeLabel: "Dismiss notification",
285
+ onDismiss: function () { authReminderVisible = false; },
286
+ onRemove: bannerRemoved,
287
+ }).el;
283
288
  refreshIcons();
284
289
 
285
- requestAnimationFrame(function () {
286
- banner.classList.add("show");
287
- });
288
-
289
290
  var newSessionBtn = banner.querySelector(".notif-banner-new-session");
290
291
  if (newSessionBtn) {
291
292
  newSessionBtn.addEventListener("click", function (e) {
@@ -298,15 +299,6 @@ function showLoginReminderBanner() {
298
299
  removeBanner(banner);
299
300
  });
300
301
  }
301
-
302
- var closeBtn = banner.querySelector(".notif-banner-close");
303
- if (closeBtn) {
304
- closeBtn.addEventListener("click", function (e) {
305
- e.stopPropagation();
306
- authReminderVisible = false;
307
- removeBanner(banner);
308
- });
309
- }
310
302
  }
311
303
 
312
304
  /**
@@ -341,18 +333,15 @@ export function showAuthRequiredBanner(msg) {
341
333
  }
342
334
 
343
335
  function removeBanner(banner) {
344
- if (!banner || !banner.parentNode) return;
336
+ removeFromStack(banner);
337
+ }
338
+
339
+ // Runs when a banner starts to leave, whoever closed it. The clear-all button
340
+ // is updated right away so it disappears before the last banner finishes
341
+ // fading out; the count skips a banner that is leaving.
342
+ function bannerRemoved(banner) {
345
343
  delete shownNotifs[banner.getAttribute("data-notif-id")];
346
- banner.classList.remove("show");
347
- banner.classList.add("hide");
348
- // Update the clear-all button right away so it disappears before the
349
- // last banner finishes animating out, and again after the node is
350
- // actually removed in case the count check depends on DOM presence.
351
344
  ensureClearAllButton();
352
- setTimeout(function () {
353
- if (banner.parentNode) banner.parentNode.removeChild(banner);
354
- ensureClearAllButton();
355
- }, 300);
356
345
  }
357
346
 
358
347
  // Count real (non-"_empty", not in hide animation) banners to decide
@@ -378,7 +367,7 @@ function ensureClearAllButton() {
378
367
  btn.className = 'notif-banner-clear-all';
379
368
  btn.innerHTML = iconHtml('x') + '<span>Clear all</span>';
380
369
  btn.addEventListener('click', clearAllBanners);
381
- bannerContainer.insertBefore(btn, bannerContainer.firstChild);
370
+ addToStack(btn, { first: true, group: BANNER_GROUP });
382
371
  refreshIcons();
383
372
  } else if (existing && existing.parentNode) {
384
373
  existing.parentNode.removeChild(existing);
@@ -450,7 +439,7 @@ export function handleNotificationsState(msg) {
450
439
  // this page was away) is withdrawn, so a dead restart action cannot stay.
451
440
  function syncBuildOffer(list) {
452
441
  var offer = list.filter(function (n) { return n.type === BUILD_OFFER_TYPE; })[0];
453
- if (offer) applyBuildOffer(offer);
442
+ if (offer) applyBuildOffer(offer, { popup: isSurfaceWanted("banner", offer.category) });
454
443
  else withdrawBuildOffer();
455
444
  }
456
445
 
@@ -490,7 +479,7 @@ export function handleNotificationCreated(msg) {
490
479
  notifications.unshift(notif);
491
480
  unreadCount = msg.unreadCount;
492
481
  updateBadge();
493
- if (notif.type === BUILD_OFFER_TYPE) applyBuildOffer(notif);
482
+ if (notif.type === BUILD_OFFER_TYPE) applyBuildOffer(notif, { popup: isSurfaceWanted("banner", notif.category) });
494
483
 
495
484
  // A banner stays until acted on when the type registry says so (the
496
485
  // notification's persistent flag; lib/notify/types.js), or when it carries
@@ -510,7 +499,11 @@ export function handleNotificationCreated(msg) {
510
499
  export function handleNotificationDismissed(msg) {
511
500
  var ids = msg.ids || [];
512
501
  var closedOffer = notifications.some(function (n) { return n.type === BUILD_OFFER_TYPE && ids.indexOf(n.id) !== -1; });
513
- if (closedOffer) withdrawBuildOffer();
502
+ // A dismissal the core sends with the notification that replaces it (an
503
+ // offer refreshed: its change list arrived) is not a close: the pop-up on
504
+ // screen stays until the replacement swaps it. Only a resolve or decline,
505
+ // which carry no replacement, withdraws the offer.
506
+ if (closedOffer && !msg.replaced) withdrawBuildOffer();
514
507
  notifications = notifications.filter(function (n) { return ids.indexOf(n.id) === -1; });
515
508
  unreadCount = msg.unreadCount;
516
509
  updateBadge();
@@ -523,12 +516,15 @@ export function handleNotificationDismissed(msg) {
523
516
  }
524
517
  }
525
518
 
526
- export function handleNotificationDismissedAll() {
527
- withdrawBuildOffer();
528
- notifications = [];
529
- unreadCount = 0;
519
+ // msg.kept names what the clear-all left standing (the build-update offer, which
520
+ // only its own close declines). The entry, the pop-up and the list keep it.
521
+ export function handleNotificationDismissedAll(msg) {
522
+ var kept = msg && Array.isArray(msg.kept) ? msg.kept : [];
523
+ notifications = notifications.filter(function (n) { return kept.indexOf(n.id) !== -1; });
524
+ if (!notifications.some(function (n) { return n.type === BUILD_OFFER_TYPE; })) withdrawBuildOffer();
525
+ unreadCount = msg && typeof msg.unreadCount === "number" ? msg.unreadCount : notifications.length;
530
526
  updateBadge();
531
- if (bannerContainer) bannerContainer.innerHTML = "";
527
+ if (bannerContainer) clearGroup(BANNER_GROUP);
532
528
  }
533
529
 
534
530
  // ========================================================
@@ -537,8 +533,11 @@ export function handleNotificationDismissedAll() {
537
533
 
538
534
  function updateBadge() {
539
535
  if (!badgeEl) return;
540
- if (unreadCount > 0) {
541
- badgeEl.textContent = unreadCount > 99 ? "99+" : String(unreadCount);
536
+ // The server's count includes the offer (it is a held notification); the
537
+ // list the page holds says how many of those the bell does not show.
538
+ var count = Math.max(0, unreadCount - notifications.filter(isBuildOffer).length);
539
+ if (count > 0) {
540
+ badgeEl.textContent = count > 99 ? "99+" : String(count);
542
541
  badgeEl.classList.remove("hidden");
543
542
  } else {
544
543
  badgeEl.classList.add("hidden");
@@ -590,10 +589,6 @@ function showUpdateBanner(msg, notifId) {
590
589
  var isHeadless = store.get('isHeadlessMode');
591
590
  var updTag = msg.version.indexOf("-beta") !== -1 ? "beta" : "latest";
592
591
 
593
- var banner = document.createElement("div");
594
- banner.className = "notif-banner notif-banner-update";
595
- banner.setAttribute("data-notif-id", notifId || "_update");
596
-
597
592
  var actionsHtml = '';
598
593
  if (!isHeadless) {
599
594
  actionsHtml =
@@ -602,25 +597,29 @@ function showUpdateBanner(msg, notifId) {
602
597
  '</div>';
603
598
  }
604
599
 
605
- banner.innerHTML =
606
- '<div class="notif-banner-icon"><img src="/icon-banded-76.png" width="32" height="32" alt="Clagentic: Console" style="border-radius:8px"></div>' +
607
- '<div class="notif-banner-body">' +
608
- '<div class="notif-banner-project">CLAGENTIC</div>' +
609
- '<div class="notif-banner-title">v' + escapeHtml(msg.version) + ' is available</div>' +
610
- (isHeadless
611
- ? '<div class="notif-banner-text">Run: npx @clagentic/console@' + escapeHtml(updTag) + '</div>'
612
- : '') +
613
- actionsHtml +
614
- '</div>' +
615
- '<button class="notif-banner-close">' + iconHtml("x") + '</button>';
616
-
617
- bannerContainer.appendChild(banner);
600
+ // Close -> dismiss. No local throttle; the next hourly check raises a new
601
+ // update_available, which re-shows naturally.
602
+ var banner = showOverlay({
603
+ kind: "banner",
604
+ group: BANNER_GROUP,
605
+ className: "notif-banner notif-banner-update",
606
+ attrs: { "data-notif-id": notifId || "_update" },
607
+ content:
608
+ '<div class="notif-banner-icon">' + LOGO_HTML + '</div>' +
609
+ '<div class="notif-banner-body">' +
610
+ '<div class="notif-banner-project">CLAGENTIC</div>' +
611
+ '<div class="notif-banner-title">v' + escapeHtml(msg.version) + ' is available</div>' +
612
+ (isHeadless
613
+ ? '<div class="notif-banner-text">Run: npx @clagentic/console@' + escapeHtml(updTag) + '</div>'
614
+ : '') +
615
+ actionsHtml +
616
+ '</div>',
617
+ closeLabel: "Dismiss notification",
618
+ onDismiss: function () { if (notifId) dismissNotif(notifId); },
619
+ onRemove: bannerRemoved,
620
+ }).el;
618
621
  refreshIcons();
619
622
 
620
- requestAnimationFrame(function () {
621
- banner.classList.add("show");
622
- });
623
-
624
623
  // A tap on the notice opens the update UI, like a tap on its push.
625
624
  banner.addEventListener("click", function (e) {
626
625
  if (e.target.closest("button")) return;
@@ -641,16 +640,6 @@ function showUpdateBanner(msg, notifId) {
641
640
  });
642
641
  }
643
642
 
644
- // Close button -> dismiss. No local throttle; the next hourly check raises
645
- // a new update_available, which re-shows naturally.
646
- var closeBtn = banner.querySelector(".notif-banner-close");
647
- if (closeBtn) {
648
- closeBtn.addEventListener("click", function (e) {
649
- e.stopPropagation();
650
- if (notifId) dismissNotif(notifId);
651
- removeBanner(banner);
652
- });
653
- }
654
643
  }
655
644
 
656
645
  // ========================================================
@@ -11,6 +11,8 @@ import { splitModelsByTier } from './settings-defaults.js';
11
11
  import { isSonnetModel } from './model-families.js';
12
12
  import { modeOptions } from './mode-options.js';
13
13
  import { isNearingCompaction } from './compaction-state.js';
14
+ import { openInfoPanel } from './info-panel.js';
15
+ import { closeMenu, isMenuOpen } from './overlay-registry.js';
14
16
 
15
17
  // --- Module-owned state (not in store) ---
16
18
  // sessionUsage.context = last-turn context fill (lastStreamInputTokens) — not cumulative,
@@ -44,7 +46,6 @@ var configWebsearchSection = null;
44
46
  var configWebsearchBar = null;
45
47
 
46
48
  var usagePanel = null;
47
- var usagePanelClose = null;
48
49
  var usageCostEl = null;
49
50
  var usageContextEl = null;
50
51
  var usageOutputEl = null;
@@ -52,7 +53,6 @@ var usageCacheWriteEl = null;
52
53
  var usageTurnsEl = null;
53
54
 
54
55
  var statusPanel = null;
55
- var statusPanelClose = null;
56
56
  var statusPidEl = null;
57
57
  var statusUptimeEl = null;
58
58
  var statusRssEl = null;
@@ -541,7 +541,6 @@ export function initPanels() {
541
541
 
542
542
  // Usage panel DOM refs
543
543
  usagePanel = $("usage-panel");
544
- usagePanelClose = $("usage-panel-close");
545
544
  usageCostEl = $("usage-cost");
546
545
  usageContextEl = $("usage-context");
547
546
  usageOutputEl = $("usage-output");
@@ -550,7 +549,6 @@ export function initPanels() {
550
549
 
551
550
  // Status panel DOM refs
552
551
  statusPanel = $("status-panel");
553
- statusPanelClose = $("status-panel-close");
554
552
  statusPidEl = $("status-pid");
555
553
  statusUptimeEl = $("status-uptime");
556
554
  statusRssEl = $("status-rss");
@@ -640,22 +638,6 @@ export function initPanels() {
640
638
  }
641
639
  });
642
640
 
643
- if (usagePanelClose) {
644
- usagePanelClose.addEventListener("click", function () {
645
- usagePanel.classList.add("hidden");
646
- });
647
- }
648
-
649
- if (statusPanelClose) {
650
- statusPanelClose.addEventListener("click", function () {
651
- statusPanel.classList.add("hidden");
652
- if (statusRefreshTimer) {
653
- clearInterval(statusRefreshTimer);
654
- statusRefreshTimer = null;
655
- }
656
- });
657
- }
658
-
659
641
  if (contextPanelClose) {
660
642
  contextPanelClose.addEventListener("click", function () {
661
643
  setContextView("off");
@@ -801,12 +783,16 @@ export function accumulateUsage(cost, usage, lastStreamInputTokens) {
801
783
  export function resetUsage() {
802
784
  sessionUsage = { cost: 0, context: 0, output: 0, cacheWrite: 0, turns: 0 };
803
785
  updateUsagePanel();
804
- if (usagePanel) usagePanel.classList.add("hidden");
786
+ if (usagePanel) closeMenu(usagePanel);
805
787
  }
806
788
 
807
789
  export function toggleUsagePanel() {
808
790
  if (!usagePanel) return;
809
- usagePanel.classList.toggle("hidden");
791
+ if (isMenuOpen(usagePanel)) {
792
+ closeMenu(usagePanel);
793
+ return;
794
+ }
795
+ openInfoPanel(usagePanel, { label: "Close usage" });
810
796
  refreshIcons();
811
797
  }
812
798
 
@@ -852,20 +838,30 @@ export function requestProcessStats() {
852
838
 
853
839
  export function toggleStatusPanel() {
854
840
  if (!statusPanel) return;
855
- var opening = statusPanel.classList.contains("hidden");
856
- statusPanel.classList.toggle("hidden");
857
- if (opening) {
858
- requestProcessStats();
859
- statusRefreshTimer = setInterval(requestProcessStats, 5000);
860
- } else {
861
- if (statusRefreshTimer) {
862
- clearInterval(statusRefreshTimer);
863
- statusRefreshTimer = null;
864
- }
841
+ if (isMenuOpen(statusPanel)) {
842
+ closeMenu(statusPanel);
843
+ return;
865
844
  }
845
+ // The footer status line is the control that toggles it.
846
+ openInfoPanel(statusPanel, {
847
+ label: "Close status",
848
+ opener: document.getElementById("footer-status"),
849
+ onRemove: stopStatusRefresh,
850
+ });
851
+ requestProcessStats();
852
+ stopStatusRefresh();
853
+ statusRefreshTimer = setInterval(requestProcessStats, 5000);
866
854
  refreshIcons();
867
855
  }
868
856
 
857
+ // Stats are polled only while the panel is open, however it was closed.
858
+ function stopStatusRefresh() {
859
+ if (statusRefreshTimer) {
860
+ clearInterval(statusRefreshTimer);
861
+ statusRefreshTimer = null;
862
+ }
863
+ }
864
+
869
865
  // --- Context panel ---
870
866
 
871
867
  /**