@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
@@ -5,8 +5,6 @@
5
5
  "start_url": "/",
6
6
  "scope": "/",
7
7
  "display": "standalone",
8
- "background_color": "#080A0F",
9
- "theme_color": "#080A0F",
10
8
  "icons": [
11
9
  {
12
10
  "src": "icon-192.png",
@@ -1,46 +1,48 @@
1
1
  // admin.js — Admin management for multi-user mode (renders into server settings sections)
2
2
  import { iconHtml, refreshIcons } from './icons.js';
3
3
  import { showToast, copyToClipboard, escapeHtml } from './utils.js';
4
+ import { showOverlay } from './overlay.js';
5
+
6
+ // Every admin dialog opens here: the scrim, the card, the layer and the close
7
+ // control are the shared overlay component's. html is the dialog's inside (header,
8
+ // body and footer, already escaped); the returned handle's el holds it for lookups
9
+ // and its close() closes the dialog.
10
+ function openAdminModal(html) {
11
+ var handle = showOverlay({ kind: "modal", content: html, dialogClass: "admin-modal" });
12
+ refreshIcons(handle.el);
13
+ return handle;
14
+ }
4
15
 
5
16
  function showConfirmDialog(message, onConfirm) {
6
- var modal = document.createElement("div");
7
- modal.className = "admin-modal-overlay";
8
- var html = '<div class="admin-modal">' +
9
- '<div class="admin-modal-body" style="padding:20px 16px 16px">' +
10
- '<p class="admin-modal-desc" style="margin:0;font-size:14px;color:var(--text)">' + escapeHtml(message) + '</p>' +
17
+ var html = '<div class="admin-modal-body admin-modal-body-plain">' +
18
+ '<p class="admin-modal-desc admin-modal-desc-plain">' + escapeHtml(message) + '</p>' +
11
19
  '</div>' +
12
20
  '<div class="admin-modal-footer">' +
13
21
  '<button class="admin-modal-save admin-modal-confirm-danger">Revoke</button>' +
14
22
  '<button class="admin-modal-cancel">Cancel</button>' +
15
- '</div></div>';
16
- modal.innerHTML = html;
17
- document.body.appendChild(modal);
18
- refreshIcons(modal);
19
- modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { modal.remove(); });
20
- modal.addEventListener("click", function (e) { if (e.target === modal) modal.remove(); });
23
+ '</div>';
24
+ var handle = openAdminModal(html);
25
+ var modal = handle.el;
26
+ modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { handle.close(); });
21
27
  modal.querySelector(".admin-modal-confirm-danger").addEventListener("click", function () {
22
- modal.remove();
28
+ handle.close();
23
29
  onConfirm();
24
30
  });
25
31
  }
26
32
 
27
33
  function showConfirmResetPin(name, onConfirm) {
28
- var modal = document.createElement("div");
29
- modal.className = "admin-modal-overlay";
30
- var html = '<div class="admin-modal">' +
31
- '<div class="admin-modal-body" style="padding:20px 16px 16px">' +
32
- '<p class="admin-modal-desc" style="margin:0;font-size:14px;color:var(--text)">Reset PIN for <strong>' + escapeHtml(name) + '</strong>? A new temporary PIN will be generated and they will need to change it on next login.</p>' +
34
+ var html = '<div class="admin-modal-body admin-modal-body-plain">' +
35
+ '<p class="admin-modal-desc admin-modal-desc-plain">Reset PIN for <strong>' + escapeHtml(name) + '</strong>? A new temporary PIN will be generated and they will need to change it on next login.</p>' +
33
36
  '</div>' +
34
37
  '<div class="admin-modal-footer">' +
35
38
  '<button class="admin-modal-save">Reset PIN</button>' +
36
39
  '<button class="admin-modal-cancel">Cancel</button>' +
37
- '</div></div>';
38
- modal.innerHTML = html;
39
- document.body.appendChild(modal);
40
- modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { modal.remove(); });
41
- modal.addEventListener("click", function (e) { if (e.target === modal) modal.remove(); });
40
+ '</div>';
41
+ var handle = openAdminModal(html);
42
+ var modal = handle.el;
43
+ modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { handle.close(); });
42
44
  modal.querySelector(".admin-modal-save").addEventListener("click", function () {
43
- modal.remove();
45
+ handle.close();
44
46
  onConfirm();
45
47
  });
46
48
  }
@@ -237,12 +239,8 @@ function showPermissionsModal(user, body) {
237
239
  perms[k] = (user.permissions && user.permissions[k] !== undefined) ? user.permissions[k] : DEFAULT_PERMISSIONS[k];
238
240
  }
239
241
 
240
- var modal = document.createElement("div");
241
- modal.className = "admin-modal-overlay";
242
- var html = '<div class="admin-modal">' +
243
- '<div class="admin-modal-header">' +
242
+ var html = '<div class="admin-modal-header">' +
244
243
  '<h3>Permissions: ' + escapeHtml(user.displayName || user.username) + '</h3>' +
245
- '<button class="admin-modal-close">&times;</button>' +
246
244
  '</div>' +
247
245
  '<div class="admin-modal-body">' +
248
246
  '<div class="admin-perms-list">';
@@ -263,15 +261,11 @@ function showPermissionsModal(user, body) {
263
261
  '<div class="admin-modal-footer">' +
264
262
  '<button class="admin-modal-save" id="admin-perms-save">Save</button>' +
265
263
  '<button class="admin-modal-cancel">Cancel</button>' +
266
- '</div></div>';
267
-
268
- modal.innerHTML = html;
269
- document.body.appendChild(modal);
270
- refreshIcons(modal);
264
+ '</div>';
271
265
 
272
- modal.querySelector(".admin-modal-close").addEventListener("click", function () { modal.remove(); });
273
- modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { modal.remove(); });
274
- modal.addEventListener("click", function (e) { if (e.target === modal) modal.remove(); });
266
+ var handle = openAdminModal(html);
267
+ var modal = handle.el;
268
+ modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { handle.close(); });
275
269
 
276
270
  modal.querySelector("#admin-perms-save").addEventListener("click", function () {
277
271
  var toggles = modal.querySelectorAll(".admin-perm-toggle");
@@ -282,7 +276,7 @@ function showPermissionsModal(user, body) {
282
276
  apiPut("/api/admin/users/" + user.id + "/permissions", { permissions: newPerms }).then(function (data) {
283
277
  if (data.ok) {
284
278
  showToast("Permissions updated");
285
- modal.remove();
279
+ handle.close();
286
280
  // Update cached user
287
281
  for (var c = 0; c < cachedUsers.length; c++) {
288
282
  if (cachedUsers[c].id === user.id) {
@@ -300,12 +294,8 @@ function showPermissionsModal(user, body) {
300
294
  }
301
295
 
302
296
  function showAddUserModal(body) {
303
- var modal = document.createElement("div");
304
- modal.className = "admin-modal-overlay";
305
- var html = '<div class="admin-modal">' +
306
- '<div class="admin-modal-header">' +
297
+ var html = '<div class="admin-modal-header">' +
307
298
  '<h3>Add User</h3>' +
308
- '<button class="admin-modal-close">' + iconHtml("x") + '</button>' +
309
299
  '</div>' +
310
300
  '<div class="admin-modal-body">' +
311
301
  '<p class="admin-modal-desc">Create a new user account. A temporary 6-digit PIN will be generated automatically. The user must change it on first login.</p>' +
@@ -322,10 +312,9 @@ function showAddUserModal(body) {
322
312
  '<div class="admin-modal-footer">' +
323
313
  '<button class="admin-modal-save" id="admin-new-user-create">Create User</button>' +
324
314
  '<button class="admin-modal-cancel">Cancel</button>' +
325
- '</div></div>';
326
- modal.innerHTML = html;
327
- document.body.appendChild(modal);
328
- refreshIcons(modal);
315
+ '</div>';
316
+ var handle = openAdminModal(html);
317
+ var modal = handle.el;
329
318
 
330
319
  var usernameInput = modal.querySelector("#admin-new-username");
331
320
  var displayNameInput = modal.querySelector("#admin-new-displayname");
@@ -334,9 +323,7 @@ function showAddUserModal(body) {
334
323
  var createBtn = modal.querySelector("#admin-new-user-create");
335
324
  var errorEl = modal.querySelector("#admin-new-user-error");
336
325
 
337
- modal.querySelector(".admin-modal-close").addEventListener("click", function () { modal.remove(); });
338
- modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { modal.remove(); });
339
- modal.addEventListener("click", function (e) { if (e.target === modal) modal.remove(); });
326
+ modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { handle.close(); });
340
327
 
341
328
  usernameInput.focus();
342
329
  usernameInput.addEventListener("keydown", function (e) {
@@ -361,7 +348,7 @@ function showAddUserModal(body) {
361
348
  role: roleSelect.value,
362
349
  }).then(function (data) {
363
350
  if (data.ok) {
364
- modal.remove();
351
+ handle.close();
365
352
  showTempPinModal(data.user, data.tempPin);
366
353
  loadUsersTab(body);
367
354
  } else {
@@ -380,12 +367,8 @@ function showAddUserModal(body) {
380
367
  }
381
368
 
382
369
  function showTempPinModal(user, tempPin) {
383
- var modal = document.createElement("div");
384
- modal.className = "admin-modal-overlay";
385
- var html = '<div class="admin-modal">' +
386
- '<div class="admin-modal-header">' +
370
+ var html = '<div class="admin-modal-header">' +
387
371
  '<h3>User Created</h3>' +
388
- '<button class="admin-modal-close">' + iconHtml("x") + '</button>' +
389
372
  '</div>' +
390
373
  '<div class="admin-modal-body">' +
391
374
  '<p class="admin-modal-desc">Account for <strong>' + escapeHtml(user.displayName || user.username) + '</strong> has been created. Share these credentials with the user:</p>' +
@@ -393,19 +376,16 @@ function showTempPinModal(user, tempPin) {
393
376
  '<div class="admin-temp-pin-row"><span class="admin-temp-pin-label">Username</span><code class="admin-temp-pin-value">' + escapeHtml(user.username) + '</code></div>' +
394
377
  '<div class="admin-temp-pin-row"><span class="admin-temp-pin-label">Temporary PIN</span><code class="admin-temp-pin-value admin-temp-pin-highlight">' + escapeHtml(tempPin) + '</code></div>' +
395
378
  '</div>' +
396
- '<p class="admin-modal-desc" style="margin-top:12px;color:var(--text-secondary);font-size:12px;">This PIN is one-time use. The user will be prompted to set a new PIN on first login.</p>' +
379
+ '<p class="admin-modal-desc admin-modal-desc-note">This PIN is one-time use. The user will be prompted to set a new PIN on first login.</p>' +
397
380
  '</div>' +
398
381
  '<div class="admin-modal-footer">' +
399
382
  '<button class="admin-modal-save" id="admin-copy-credentials">Copy Credentials</button>' +
400
383
  '<button class="admin-modal-cancel">Close</button>' +
401
- '</div></div>';
402
- modal.innerHTML = html;
403
- document.body.appendChild(modal);
404
- refreshIcons(modal);
384
+ '</div>';
385
+ var handle = openAdminModal(html);
386
+ var modal = handle.el;
405
387
 
406
- modal.querySelector(".admin-modal-close").addEventListener("click", function () { modal.remove(); });
407
- modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { modal.remove(); });
408
- modal.addEventListener("click", function (e) { if (e.target === modal) modal.remove(); });
388
+ modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { handle.close(); });
409
389
 
410
390
  modal.querySelector("#admin-copy-credentials").addEventListener("click", function () {
411
391
  var text = "Username: " + user.username + "\nTemporary PIN: " + tempPin;
@@ -551,12 +531,8 @@ function createInvite(body) {
551
531
  }
552
532
 
553
533
  function showEmailInvitePrompt(body) {
554
- var modal = document.createElement("div");
555
- modal.className = "admin-modal-overlay";
556
- var html = '<div class="admin-modal">' +
557
- '<div class="admin-modal-header">' +
534
+ var html = '<div class="admin-modal-header">' +
558
535
  '<h3>Send Email Invite</h3>' +
559
- '<button class="admin-modal-close">' + iconHtml("x") + '</button>' +
560
536
  '</div>' +
561
537
  '<div class="admin-modal-body">' +
562
538
  '<p class="admin-modal-desc">Enter the email address to send an invitation to:</p>' +
@@ -566,18 +542,15 @@ function showEmailInvitePrompt(body) {
566
542
  '<div class="admin-modal-footer">' +
567
543
  '<button class="admin-modal-save" id="admin-invite-send">Send Invite</button>' +
568
544
  '<button class="admin-modal-cancel">Cancel</button>' +
569
- '</div></div>';
570
- modal.innerHTML = html;
571
- document.body.appendChild(modal);
572
- refreshIcons(modal);
545
+ '</div>';
546
+ var handle = openAdminModal(html);
547
+ var modal = handle.el;
573
548
 
574
549
  var emailInput = modal.querySelector("#admin-invite-email");
575
550
  var sendBtn = modal.querySelector("#admin-invite-send");
576
551
  var errorEl = modal.querySelector("#admin-invite-error");
577
552
 
578
- modal.querySelector(".admin-modal-close").addEventListener("click", function () { modal.remove(); });
579
- modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { modal.remove(); });
580
- modal.addEventListener("click", function (e) { if (e.target === modal) modal.remove(); });
553
+ modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { handle.close(); });
581
554
 
582
555
  emailInput.focus();
583
556
  emailInput.addEventListener("keydown", function (e) {
@@ -596,7 +569,7 @@ function showEmailInvitePrompt(body) {
596
569
  apiPost("/api/admin/invites/email", { email: email }).then(function (data) {
597
570
  if (data.ok) {
598
571
  showToast("Invite sent to " + email);
599
- modal.remove();
572
+ handle.close();
600
573
  loadInvitesTab(body);
601
574
  } else {
602
575
  errorEl.textContent = data.error || "Failed to send invite";
@@ -894,13 +867,8 @@ function showProjectUsersModal(slug, parentBody) {
894
867
  var access = results[1];
895
868
  var allowed = access.allowedUsers || [];
896
869
 
897
- var modal = document.createElement("div");
898
- modal.className = "admin-modal-overlay";
899
-
900
- var html = '<div class="admin-modal">';
901
- html += '<div class="admin-modal-header">';
870
+ var html = '<div class="admin-modal-header">';
902
871
  html += '<h3>Manage Access: ' + escapeHtml(slug) + '</h3>';
903
- html += '<button class="admin-modal-close">' + iconHtml("x") + '</button>';
904
872
  html += '</div>';
905
873
  html += '<div class="admin-modal-body">';
906
874
  html += '<p class="admin-modal-desc">Select users who can access this private project:</p>';
@@ -920,17 +888,11 @@ function showProjectUsersModal(slug, parentBody) {
920
888
  html += '<button class="admin-modal-save">Save</button>';
921
889
  html += '<button class="admin-modal-cancel">Cancel</button>';
922
890
  html += '</div>';
923
- html += '</div>';
924
891
 
925
- modal.innerHTML = html;
926
- document.body.appendChild(modal);
927
- refreshIcons(modal);
892
+ var handle = openAdminModal(html);
893
+ var modal = handle.el;
928
894
 
929
- modal.querySelector(".admin-modal-close").addEventListener("click", function () { modal.remove(); });
930
- modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { modal.remove(); });
931
- modal.addEventListener("click", function (e) {
932
- if (e.target === modal) modal.remove();
933
- });
895
+ modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { handle.close(); });
934
896
 
935
897
  modal.querySelector(".admin-modal-save").addEventListener("click", function () {
936
898
  var checkboxes = modal.querySelectorAll('input[type="checkbox"]');
@@ -941,7 +903,7 @@ function showProjectUsersModal(slug, parentBody) {
941
903
  apiPut("/api/admin/projects/" + slug + "/users", { allowedUsers: selectedUsers }).then(function (data) {
942
904
  if (data.ok) {
943
905
  showToast("Project access updated");
944
- modal.remove();
906
+ handle.close();
945
907
  loadProjectsTab(parentBody);
946
908
  } else {
947
909
  showToast(data.error || "Failed to update access");
@@ -93,7 +93,109 @@ export function senderAgentKey(injected) {
93
93
  return null;
94
94
  }
95
95
 
96
+ // Fixed built-in icons for the console's own injected senders. A system kind
97
+ // never takes a seed or a roster choice; each draws one glyph, stroked with
98
+ // currentColor so the theme tokens in css/agent-picker.css colour it in every
99
+ // theme. The markup is static, never built from message text.
100
+ var SYSTEM_ICONS = Object.freeze({
101
+ scheduled: Object.freeze({
102
+ label: "Scheduled message",
103
+ svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"></circle><polyline points="12 7 12 12 15.5 14"></polyline></svg>',
104
+ }),
105
+ loop: Object.freeze({
106
+ label: "Loop",
107
+ svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17 2l4 4-4 4"></path><path d="M3 11V9a3 3 0 0 1 3-3h15"></path><path d="M7 22l-4-4 4-4"></path><path d="M21 13v2a3 3 0 0 1-3 3H3"></path></svg>',
108
+ }),
109
+ trigger: Object.freeze({
110
+ label: "External trigger",
111
+ svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polygon points="13 2 4 14 12 14 11 22 20 10 12 10 13 2"></polygon></svg>',
112
+ }),
113
+ // Any automation whose initiator has no icon of its own.
114
+ automation: Object.freeze({
115
+ label: "Automation",
116
+ svg: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="4" width="16" height="16" rx="3"></rect><path d="M9 9h6v6H9z"></path></svg>',
117
+ }),
118
+ });
119
+
120
+ // The turn initiators (lib/turn-initiator.js) each system kind covers.
121
+ var SYSTEM_KIND_OF_INITIATOR = Object.freeze({
122
+ "scheduled": "scheduled",
123
+ "scheduled-now": "scheduled",
124
+ "loop": "loop",
125
+ "trigger": "trigger",
126
+ });
127
+
128
+ var GENERIC_SYSTEM_KIND = "automation";
129
+
130
+ /**
131
+ * The system kind of an injected sender ("scheduled", "loop", "trigger"), or
132
+ * null when it is an agent or a human. Every console automation (senderKind
133
+ * "automation") has one: its initiator's own kind, else the generic
134
+ * "automation" kind, so none ever draws a seeded robot.
135
+ */
136
+ export function systemKindOf(injected) {
137
+ if (!injected || injected.senderKind !== "automation") return null;
138
+ return Object.prototype.hasOwnProperty.call(SYSTEM_KIND_OF_INITIATOR, injected.initiator)
139
+ ? SYSTEM_KIND_OF_INITIATOR[injected.initiator]
140
+ : GENERIC_SYSTEM_KIND;
141
+ }
142
+
143
+ /** The fixed icon of a system kind: { kind, label, svg }, or null for an unknown kind. */
144
+ export function resolveSystemAvatar(kind) {
145
+ var icon = Object.prototype.hasOwnProperty.call(SYSTEM_ICONS, kind) ? SYSTEM_ICONS[kind] : null;
146
+ return icon ? { kind: kind, label: icon.label, svg: icon.svg } : null;
147
+ }
148
+
149
+ // The four avatar tints (--av0 to --av3) an initial can sit on.
150
+ var TINT_COUNT = 4;
151
+
152
+ /** Which tint (0-3) an agent's initial sits on: the same key always gives the same one. */
153
+ export function agentTintIndex(key) {
154
+ var text = String(key == null ? "" : key);
155
+ var hash = 5381;
156
+ for (var i = 0; i < text.length; i++) hash = ((hash * 33) + text.charCodeAt(i)) >>> 0;
157
+ return hash % TINT_COUNT;
158
+ }
159
+
160
+ /** The letter an agent shows when it has no picked image. */
161
+ export function agentInitial(key) {
162
+ var text = String(key == null ? "" : key).trim();
163
+ return text ? text.charAt(0).toUpperCase() : "?";
164
+ }
165
+
166
+ // An initial-option avatar: the picked image when the roster holds one that
167
+ // resolves, otherwise the initial on a tint. Never the resolver's robot.
168
+ function paintInitial(el) {
169
+ var key = el.dataset.agentKey;
170
+ var size = Number(el.dataset.agentSize) || 64;
171
+ var choice = agentAvatarChoice(key);
172
+ var url = choice ? urlOfChoice(choice, key, size) : null;
173
+ el.textContent = "";
174
+ var tint = "agent-avatar-tint-" + agentTintIndex(key);
175
+ if (url) {
176
+ el.classList.remove("agent-avatar-initial");
177
+ for (var t = 0; t < TINT_COUNT; t++) el.classList.remove("agent-avatar-tint-" + t);
178
+ var img = document.createElement("img");
179
+ img.alt = "";
180
+ img.width = size;
181
+ img.height = size;
182
+ // A picked image that fails to load (a deleted custom icon) drops to the initial.
183
+ img.addEventListener("error", function () { paintInitialFallback(el, key); });
184
+ img.src = url;
185
+ el.appendChild(img);
186
+ return;
187
+ }
188
+ paintInitialFallback(el, key, tint);
189
+ }
190
+
191
+ function paintInitialFallback(el, key, tint) {
192
+ el.textContent = agentInitial(key);
193
+ el.classList.add("agent-avatar-initial");
194
+ el.classList.add(tint || "agent-avatar-tint-" + agentTintIndex(key));
195
+ }
196
+
96
197
  function paint(img) {
198
+ if (img.dataset.agentInitial === "1") { paintInitial(img); return; }
97
199
  var key = img.dataset.agentKey;
98
200
  var size = Number(img.dataset.agentSize) || 64;
99
201
  var resolved = resolveAgentAvatar(key, size, img._agentDefaultUrl);
@@ -124,8 +226,37 @@ export function bindAgentAvatar(img, key, size, defaultUrl) {
124
226
  return img;
125
227
  }
126
228
 
127
- /** A new <img> showing the avatar for key. */
128
- export function createAgentAvatar(key, size, className, defaultUrl) {
229
+ /**
230
+ * A new <img> showing the avatar for key.
231
+ * options.initial: draw it as a round element (a span) that shows the picked
232
+ * image when there is one and otherwise the agent's initial on one of four
233
+ * tints, instead of the default or seeded robot. defaultUrl is ignored then.
234
+ * options.systemKind: draw the fixed built-in icon of that system kind (see
235
+ * resolveSystemAvatar) in a round element; key and defaultUrl are ignored and no
236
+ * seed or roster choice applies. An unknown kind falls through to the agent avatar.
237
+ */
238
+ export function createAgentAvatar(key, size, className, defaultUrl, options) {
239
+ var system = options && options.systemKind ? resolveSystemAvatar(options.systemKind) : null;
240
+ if (system) {
241
+ var badge = document.createElement("span");
242
+ badge.className = (className ? className + " " : "") + "agent-avatar-system";
243
+ badge.dataset.agentSystemKind = system.kind;
244
+ badge.dataset.agentSize = String(size);
245
+ badge.setAttribute("role", "img");
246
+ badge.setAttribute("aria-label", system.label);
247
+ badge.innerHTML = system.svg;
248
+ return badge;
249
+ }
250
+ if (options && options.initial) {
251
+ var span = document.createElement("span");
252
+ span.className = className || "";
253
+ span.dataset.agentKey = key;
254
+ span.dataset.agentSize = String(size);
255
+ span.dataset.agentInitial = "1";
256
+ span.setAttribute("role", "img");
257
+ paintInitial(span);
258
+ return span;
259
+ }
129
260
  var img = document.createElement("img");
130
261
  if (className) img.className = className;
131
262
  img.alt = "";
@@ -148,6 +279,6 @@ export function applyIdentityAvatar(img, identity, size) {
148
279
  export function refreshAgentAvatars(root) {
149
280
  var scope = root || (typeof document !== "undefined" ? document.body : null);
150
281
  if (!scope || typeof scope.querySelectorAll !== "function") return;
151
- var imgs = scope.querySelectorAll("img[data-agent-key]");
282
+ var imgs = scope.querySelectorAll("img[data-agent-key], [data-agent-initial]");
152
283
  for (var i = 0; i < imgs.length; i++) paint(imgs[i]);
153
284
  }
@@ -13,7 +13,7 @@ import { getWs } from './ws-ref.js';
13
13
  import { registerTeamSection, closeTeamView, isSectionContainerShown } from './team-view.js';
14
14
  import { isMobileViewport } from './popover-position.js';
15
15
  import { resolveInjectedIdentity } from './injected-identity.js';
16
- import { applyIdentityAvatar } from './agent-avatar.js';
16
+ import { applyIdentityAvatar, createAgentAvatar } from './agent-avatar.js';
17
17
  import { relativeTime } from './relative-time.js';
18
18
 
19
19
  var SECTION_ID = "agent-messages";
@@ -81,6 +81,7 @@ function el(tag, className, text) {
81
81
  }
82
82
 
83
83
  function avatarOf(identity) {
84
+ if (identity.systemKind) return createAgentAvatar(null, AVATAR_SIZE, "am-avatar", null, { systemKind: identity.systemKind });
84
85
  var img = el("img", "am-avatar");
85
86
  img.alt = "";
86
87
  img.width = AVATAR_SIZE;
@@ -15,8 +15,11 @@ import { escapeHtml } from './utils.js';
15
15
  import { iconHtml, refreshIcons } from './icons.js';
16
16
  import { store } from './store.js';
17
17
  import { getWs } from './ws-ref.js';
18
+ import { showOverlay } from './overlay.js';
18
19
 
19
20
  var paletteEl = null;
21
+ // The open picker (overlay.js); null until it is first opened.
22
+ var pickerHandle = null;
20
23
  var inputEl = null;
21
24
  var resultsEl = null;
22
25
  var tabsEl = null;
@@ -50,7 +53,16 @@ export function initAgentPicker() {
50
53
  }
51
54
 
52
55
  export function isAgentPickerOpen() {
53
- return paletteEl && !paletteEl.classList.contains("hidden");
56
+ return !!pickerHandle && pickerHandle.isOpen();
57
+ }
58
+
59
+ // Opens the picker as a panel of the shared overlay; it closes through
60
+ // closeAgentPicker, Escape, the scrim, the close control or a back swipe.
61
+ // Returns false when a dialog is open and the panel was refused (overlay-registry.js
62
+ // isPanelBlocked); the openers then do nothing more.
63
+ function showPicker() {
64
+ pickerHandle = showOverlay({ kind: "modal", panel: true, el: paletteEl, closeLabel: "Close agents", onRemove: resetPicker });
65
+ return pickerHandle.isOpen();
54
66
  }
55
67
 
56
68
  export function openAgentPicker() {
@@ -60,7 +72,7 @@ export function openAgentPicker() {
60
72
  if (store.get('dmMode')) return;
61
73
  _preferredTargetSlug = null;
62
74
  _catalogReceived = false;
63
- paletteEl.classList.remove("hidden");
75
+ if (!showPicker()) return;
64
76
  inputEl.value = "";
65
77
  activeIndex = -1;
66
78
  items = [];
@@ -82,7 +94,7 @@ export function openAgentPickerForPreferred(slug) {
82
94
  if (!paletteEl || !slug) return;
83
95
  _preferredTargetSlug = slug;
84
96
  _catalogReceived = false;
85
- paletteEl.classList.remove("hidden");
97
+ if (!showPicker()) return;
86
98
  inputEl.value = "";
87
99
  activeIndex = -1;
88
100
  items = [];
@@ -105,8 +117,11 @@ export function openAgentPickerForPreferred(slug) {
105
117
  }
106
118
 
107
119
  export function closeAgentPicker() {
108
- if (!paletteEl) return;
109
- paletteEl.classList.add("hidden");
120
+ if (pickerHandle) pickerHandle.close();
121
+ }
122
+
123
+ // The picker closed, however: its search state goes with it.
124
+ function resetPicker() {
110
125
  inputEl.value = "";
111
126
  resultsEl.innerHTML = "";
112
127
  items = [];
@@ -139,14 +154,13 @@ export function handleAgentFavoriteToggled(_msg) { /* re-render comes via agents
139
154
 
140
155
  function buildDOM() {
141
156
  paletteEl = document.createElement("div");
142
- paletteEl.className = "cmd-palette agent-picker hidden";
157
+ paletteEl.className = "agent-picker hidden";
143
158
  paletteEl.innerHTML =
144
- '<div class="cmd-palette-backdrop"></div>' +
145
- '<div class="cmd-palette-dialog">' +
159
+ '<div class="overlay-modal-backdrop"></div>' +
160
+ '<div class="overlay-modal-dialog cmd-palette-dialog">' +
146
161
  '<div class="cmd-palette-input-row">' +
147
162
  '<i data-lucide="bot"></i>' +
148
163
  '<input class="cmd-palette-input" type="text" placeholder="Search agents…" autocomplete="off" spellcheck="false" />' +
149
- '<span class="cmd-palette-kbd agent-picker-close"><i data-lucide="x"></i></span>' +
150
164
  '</div>' +
151
165
  '<div class="agent-picker-tabs">' +
152
166
  '<button class="agent-picker-tab active" data-tab="favorites" type="button">Favorites</button>' +
@@ -169,17 +183,9 @@ function buildDOM() {
169
183
  resultsEl = paletteEl.querySelector(".cmd-palette-results");
170
184
  tabsEl = paletteEl.querySelector(".agent-picker-tabs");
171
185
 
172
- paletteEl.querySelector(".cmd-palette-backdrop").addEventListener("click", closeAgentPicker);
173
- paletteEl.querySelector(".agent-picker-close").addEventListener("click", closeAgentPicker);
174
-
175
186
  inputEl.addEventListener("input", render);
176
187
 
177
188
  inputEl.addEventListener("keydown", function (e) {
178
- if (e.key === "Escape") {
179
- e.preventDefault();
180
- closeAgentPicker();
181
- return;
182
- }
183
189
  if (e.key === "ArrowDown") {
184
190
  e.preventDefault();
185
191
  setActive(activeIndex + 1);
@@ -217,10 +223,6 @@ function buildDOM() {
217
223
  });
218
224
  })(tabButtons[ti]);
219
225
  }
220
-
221
- paletteEl.querySelector(".cmd-palette-dialog").addEventListener("click", function (e) {
222
- e.stopPropagation();
223
- });
224
226
  }
225
227
 
226
228
  function syncTabUi() {