@clagentic/console 1.6.0-beta.1 → 1.6.0-beta.3

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 (46) hide show
  1. package/README.md +18 -0
  2. package/lib/daemon.js +94 -0
  3. package/lib/history-visibility.js +113 -0
  4. package/lib/project-sessions.js +51 -2
  5. package/lib/public/css/base.css +18 -0
  6. package/lib/public/css/diagnostics.css +99 -11
  7. package/lib/public/css/icon-strip.css +201 -0
  8. package/lib/public/css/menus.css +2 -2
  9. package/lib/public/css/mobile-nav.css +24 -0
  10. package/lib/public/css/server-settings.css +100 -0
  11. package/lib/public/index.html +17 -1
  12. package/lib/public/modules/app-header.js +72 -17
  13. package/lib/public/modules/app-home-hub.js +31 -7
  14. package/lib/public/modules/app-messages.js +5 -0
  15. package/lib/public/modules/app-notifications.js +5 -1
  16. package/lib/public/modules/app-projects.js +10 -5
  17. package/lib/public/modules/command-palette.js +16 -5
  18. package/lib/public/modules/custom-icons-settings.js +399 -0
  19. package/lib/public/modules/custom-icons.js +114 -0
  20. package/lib/public/modules/diagnostic-format.js +18 -2
  21. package/lib/public/modules/diagnostics.js +159 -8
  22. package/lib/public/modules/emoji-picker.js +274 -6
  23. package/lib/public/modules/history-visibility.js +98 -0
  24. package/lib/public/modules/popover-position.js +192 -0
  25. package/lib/public/modules/project-icon.js +113 -0
  26. package/lib/public/modules/project-settings.js +2 -2
  27. package/lib/public/modules/project-switcher.js +2 -1
  28. package/lib/public/modules/scheduler-config.js +5 -8
  29. package/lib/public/modules/scheduler.js +5 -6
  30. package/lib/public/modules/server-settings.js +6 -0
  31. package/lib/public/modules/sidebar-mobile.js +4 -6
  32. package/lib/public/modules/sidebar-projects.js +35 -90
  33. package/lib/public/modules/sidebar-sessions.js +6 -20
  34. package/lib/public/modules/sticky-notes.js +4 -4
  35. package/lib/public/modules/terminal.js +5 -12
  36. package/lib/sdk-bridge.js +59 -19
  37. package/lib/sdk-message-processor.js +58 -3
  38. package/lib/sdk-permission-ownership.js +85 -0
  39. package/lib/server-settings.js +221 -1
  40. package/lib/server.js +2 -0
  41. package/lib/sessions.js +77 -10
  42. package/lib/settings-preflight.js +52 -16
  43. package/lib/utils.js +23 -0
  44. package/lib/ws-schema.js +2 -0
  45. package/lib/yoke/adapters/diagnostic-patterns.js +25 -0
  46. package/package.json +2 -1
@@ -499,6 +499,207 @@
499
499
  drop-shadow(0 0 4px rgba(255,255,255,0.35));
500
500
  }
501
501
 
502
+ /* Custom-image icon rendered as <img> (project-icon.js) */
503
+ .project-emoji-img {
504
+ display: block;
505
+ width: 22px;
506
+ height: 22px;
507
+ object-fit: contain;
508
+ pointer-events: none;
509
+ }
510
+
511
+ /* Hub project icon rendered via renderProjectIcon */
512
+ .hub-project-icon .project-emoji-img {
513
+ width: 18px;
514
+ height: 18px;
515
+ }
516
+
517
+ /* --- Custom emoji picker panel --- */
518
+ .emoji-picker-custom-panel {
519
+ width: 100%;
520
+ }
521
+
522
+ .emoji-picker-slug-confirm {
523
+ padding: 6px 0 8px;
524
+ display: flex;
525
+ flex-direction: column;
526
+ gap: 6px;
527
+ }
528
+
529
+ .emoji-picker-slug-confirm.hidden {
530
+ display: none;
531
+ }
532
+
533
+ .emoji-picker-slug-label {
534
+ font-size: 11px;
535
+ font-weight: 600;
536
+ color: var(--text-secondary);
537
+ text-transform: uppercase;
538
+ letter-spacing: 0.04em;
539
+ }
540
+
541
+ .emoji-picker-slug-input {
542
+ width: 100%;
543
+ box-sizing: border-box;
544
+ background: var(--input-bg, var(--bg-secondary));
545
+ border: 1px solid var(--border);
546
+ border-radius: 6px;
547
+ color: var(--text);
548
+ font-family: inherit;
549
+ font-size: 13px;
550
+ padding: 5px 8px;
551
+ outline: none;
552
+ transition: border-color 0.15s;
553
+ }
554
+
555
+ .emoji-picker-slug-input:focus {
556
+ border-color: var(--accent, #7c6cf8);
557
+ }
558
+
559
+ .emoji-picker-slug-actions {
560
+ display: flex;
561
+ gap: 6px;
562
+ justify-content: flex-end;
563
+ }
564
+
565
+ .emoji-picker-slug-actions button {
566
+ padding: 4px 12px;
567
+ border-radius: 5px;
568
+ font-size: 12px;
569
+ font-weight: 500;
570
+ font-family: inherit;
571
+ cursor: pointer;
572
+ border: 1px solid var(--border);
573
+ background: var(--bg-alt);
574
+ color: var(--text-secondary);
575
+ transition: background 0.15s;
576
+ }
577
+
578
+ .emoji-picker-slug-actions button:hover {
579
+ background: var(--bg-hover, var(--bg-alt));
580
+ color: var(--text);
581
+ }
582
+
583
+ .emoji-picker-slug-actions button.primary {
584
+ background: var(--accent);
585
+ color: #fff;
586
+ border-color: var(--accent);
587
+ }
588
+
589
+ .emoji-picker-slug-actions button.primary:hover {
590
+ opacity: 0.9;
591
+ }
592
+
593
+ /* Upload tile in the custom emoji grid */
594
+ .emoji-picker-upload-tile {
595
+ font-size: 22px;
596
+ font-weight: 300;
597
+ color: var(--text-dimmer);
598
+ border: 1.5px dashed var(--border);
599
+ border-radius: 6px;
600
+ background: transparent;
601
+ transition: border-color 0.15s, color 0.15s, background 0.15s;
602
+ }
603
+
604
+ .emoji-picker-upload-tile:hover {
605
+ border-color: var(--accent);
606
+ color: var(--accent);
607
+ background: rgba(var(--accent-rgb, 124, 58, 237), 0.06);
608
+ transform: none;
609
+ }
610
+
611
+ /* Individual custom-emoji tile (image + delete button) */
612
+ .emoji-picker-custom-tile {
613
+ position: relative;
614
+ width: 32px;
615
+ height: 32px;
616
+ border-radius: 6px;
617
+ cursor: pointer;
618
+ }
619
+
620
+ .emoji-picker-custom-tile:hover {
621
+ background: rgba(var(--overlay-rgb), 0.08);
622
+ }
623
+
624
+ .emoji-picker-custom-img {
625
+ width: 32px;
626
+ height: 32px;
627
+ object-fit: contain;
628
+ border-radius: 4px;
629
+ display: block;
630
+ }
631
+
632
+ .emoji-picker-custom-delete {
633
+ position: absolute;
634
+ top: -6px;
635
+ right: -6px;
636
+ width: 16px;
637
+ height: 16px;
638
+ border-radius: 50%;
639
+ background: var(--error, #ef4444);
640
+ color: #fff;
641
+ font-size: 12px;
642
+ line-height: 1;
643
+ border: none;
644
+ cursor: pointer;
645
+ display: none;
646
+ align-items: center;
647
+ justify-content: center;
648
+ padding: 0;
649
+ z-index: 2;
650
+ }
651
+
652
+ .emoji-picker-custom-tile:hover .emoji-picker-custom-delete {
653
+ display: flex;
654
+ }
655
+
656
+ .emoji-picker-custom-empty {
657
+ font-size: 12px;
658
+ color: var(--text-tertiary, var(--text-dimmer));
659
+ padding: 8px 4px;
660
+ text-align: center;
661
+ }
662
+
663
+ /* --- Mobile-responsive emoji picker --- */
664
+ @media (max-width: 768px) {
665
+ .emoji-picker {
666
+ /* On mobile, stretch to fill most of the viewport width, but never
667
+ past it — clamp against 100vw/100vh so the picker can't overflow
668
+ regardless of where the anchor that triggered it was positioned. */
669
+ width: calc(100vw - 24px);
670
+ max-width: min(340px, calc(100vw - 24px));
671
+ /* Limit height so it doesn't cover the entire screen, and clamp the
672
+ same way vertically. sidebar-projects.js (positionEmojiPicker)
673
+ centers the picker in the viewport on mobile and sets inline
674
+ top/left in px — it intentionally does not use left/right, so
675
+ nothing here should set them (a prior !important left/right pair
676
+ fought the JS top clamp and pushed the picker off-screen; lr-149e). */
677
+ max-height: min(70vh, calc(100vh - 24px));
678
+ overflow: hidden;
679
+ }
680
+
681
+ .emoji-picker-scroll {
682
+ max-height: calc(min(70vh, 100vh - 24px) - 120px);
683
+ }
684
+
685
+ .emoji-picker-grid {
686
+ /* Reduce from 8 to 6 columns on narrow screens */
687
+ grid-template-columns: repeat(6, 1fr);
688
+ }
689
+
690
+ /* Custom panel on mobile: upload tile + grid both need to fit the narrower layout */
691
+ .emoji-picker-custom-tile,
692
+ .emoji-picker-upload-tile {
693
+ width: 40px;
694
+ height: 40px;
695
+ }
696
+
697
+ .emoji-picker-custom-img {
698
+ width: 40px;
699
+ height: 40px;
700
+ }
701
+ }
702
+
502
703
  /* --- Project context menu --- */
503
704
  .project-ctx-menu {
504
705
  position: fixed;
@@ -669,7 +669,7 @@
669
669
  #info-panels:empty { display: none; }
670
670
 
671
671
  /* --- Usage panel --- */
672
- #usage-panel, #status-panel, #context-panel, #team-panel {
672
+ #usage-panel, #status-panel, #context-panel, #team-panel, #diagnostics-panel {
673
673
  background: var(--bg-alt);
674
674
  border: 1px solid var(--border);
675
675
  border-radius: 12px;
@@ -678,7 +678,7 @@
678
678
  pointer-events: auto;
679
679
  }
680
680
 
681
- #usage-panel.hidden, #status-panel.hidden, #context-panel.hidden, #team-panel.hidden { display: none; }
681
+ #usage-panel.hidden, #status-panel.hidden, #context-panel.hidden, #team-panel.hidden, #diagnostics-panel.hidden { display: none; }
682
682
 
683
683
  .usage-panel-header {
684
684
  display: flex;
@@ -171,6 +171,15 @@
171
171
  font-weight: 600;
172
172
  color: var(--text-secondary);
173
173
  flex-shrink: 0;
174
+ overflow: hidden;
175
+ }
176
+
177
+ /* Custom-image icons rendered via renderProjectIcon inside mobile abbrev box */
178
+ .mobile-project-abbrev .project-emoji-img {
179
+ width: 26px;
180
+ height: 26px;
181
+ object-fit: contain;
182
+ border-radius: 4px;
174
183
  }
175
184
 
176
185
  .mobile-project-item.active .mobile-project-abbrev {
@@ -178,6 +187,21 @@
178
187
  color: #fff;
179
188
  }
180
189
 
190
+ /* mobile-chat-project-icon: icon in the chat header title area */
191
+ .mobile-chat-project-icon .project-emoji-img {
192
+ width: 28px;
193
+ height: 28px;
194
+ object-fit: contain;
195
+ border-radius: 4px;
196
+ }
197
+
198
+ /* mobile-folder-emoji-overlay: icon overlaid on folder icon */
199
+ .mobile-folder-emoji-overlay .project-emoji-img {
200
+ width: 18px;
201
+ height: 18px;
202
+ object-fit: contain;
203
+ }
204
+
181
205
  .mobile-project-name {
182
206
  flex: 1;
183
207
  overflow: hidden;
@@ -1072,3 +1072,103 @@
1072
1072
  margin-top: 2px;
1073
1073
  }
1074
1074
 
1075
+ /* ===== Custom Icons settings section (lr-d1d9) ===== */
1076
+ .custom-icons-header {
1077
+ display: flex;
1078
+ align-items: center;
1079
+ gap: 8px;
1080
+ margin-bottom: 14px;
1081
+ }
1082
+ /* lr-0847: slug filter box — grows to fill the row, Upload stays fixed width */
1083
+ .custom-icons-filter-input {
1084
+ flex: 1;
1085
+ min-width: 0;
1086
+ cursor: text;
1087
+ background: var(--bg);
1088
+ color: var(--text);
1089
+ font-family: inherit;
1090
+ }
1091
+ .custom-icons-filter-input::placeholder {
1092
+ color: var(--text-dimmer);
1093
+ }
1094
+ .custom-icons-list {
1095
+ display: flex;
1096
+ flex-direction: column;
1097
+ gap: 6px;
1098
+ }
1099
+ .custom-icons-row {
1100
+ display: flex;
1101
+ align-items: center;
1102
+ gap: 12px;
1103
+ padding: 10px 12px;
1104
+ border: 1px solid var(--border);
1105
+ border-radius: 8px;
1106
+ background: var(--bg-alt);
1107
+ }
1108
+ .custom-icons-thumb {
1109
+ flex-shrink: 0;
1110
+ display: flex;
1111
+ align-items: center;
1112
+ justify-content: center;
1113
+ width: 36px;
1114
+ height: 36px;
1115
+ }
1116
+ .custom-icons-thumb .project-emoji-img {
1117
+ width: 36px;
1118
+ height: 36px;
1119
+ border-radius: 8px;
1120
+ border: 1px solid rgba(var(--overlay-rgb), 0.1);
1121
+ object-fit: cover;
1122
+ background: var(--bg);
1123
+ }
1124
+ .custom-icons-meta {
1125
+ flex: 1;
1126
+ min-width: 0;
1127
+ }
1128
+ .custom-icons-slug {
1129
+ font-family: "Roboto Mono", monospace;
1130
+ font-size: 13px;
1131
+ color: var(--text);
1132
+ overflow: hidden;
1133
+ text-overflow: ellipsis;
1134
+ white-space: nowrap;
1135
+ }
1136
+ .custom-icons-detail {
1137
+ margin-top: 2px;
1138
+ }
1139
+ .custom-icons-actions {
1140
+ flex-shrink: 0;
1141
+ display: flex;
1142
+ gap: 6px;
1143
+ }
1144
+ .custom-icons-actions .settings-btn-sm .lucide {
1145
+ width: 14px;
1146
+ height: 14px;
1147
+ }
1148
+ .custom-icons-rename-form {
1149
+ display: flex;
1150
+ align-items: center;
1151
+ gap: 6px;
1152
+ flex: 1;
1153
+ min-width: 0;
1154
+ }
1155
+ .custom-icons-rename-input {
1156
+ flex: 1;
1157
+ min-width: 0;
1158
+ padding: 6px 10px;
1159
+ border: 1px solid var(--border);
1160
+ border-radius: 6px;
1161
+ background: var(--bg);
1162
+ color: var(--text);
1163
+ font-family: "Roboto Mono", monospace;
1164
+ font-size: 13px;
1165
+ outline: none;
1166
+ }
1167
+ .custom-icons-rename-input:focus {
1168
+ border-color: var(--accent);
1169
+ }
1170
+ .custom-icons-rename-error {
1171
+ color: var(--error);
1172
+ margin-top: 4px;
1173
+ }
1174
+
@@ -342,7 +342,10 @@
342
342
  <div id="diagnostics-panel" class="hidden" role="region" aria-label="Diagnostics" aria-expanded="false" tabindex="-1">
343
343
  <div class="usage-panel-header">
344
344
  <span>Diagnostics</span>
345
- <button class="diagnostics-panel-close" aria-label="Close diagnostics panel"><i data-lucide="x"></i></button>
345
+ <div class="diagnostics-panel-header-actions">
346
+ <button class="diagnostics-panel-clear-all" aria-label="Clear all diagnostics">Clear all</button>
347
+ <button class="diagnostics-panel-close" aria-label="Close diagnostics panel"><i data-lucide="x"></i></button>
348
+ </div>
346
349
  </div>
347
350
  <div class="usage-panel-body diagnostics-panel-body">
348
351
  <div id="diagnostics-panel-list">
@@ -1053,6 +1056,7 @@
1053
1056
  <button class="settings-nav-item" data-section="claudemd"><span>Instructions</span></button>
1054
1057
  <button class="settings-nav-item" data-section="environment"><span>Environment</span></button>
1055
1058
  <button class="settings-nav-item" data-section="storage"><span>Storage</span></button>
1059
+ <button class="settings-nav-item" data-section="custom-icons"><span>Custom Icons</span></button>
1056
1060
  <div class="settings-nav-separator settings-admin-only"></div>
1057
1061
  <div class="settings-nav-category settings-admin-only">Admin</div>
1058
1062
  <button class="settings-nav-item settings-admin-only" data-section="admin-users"><span>Users</span></button>
@@ -1321,6 +1325,18 @@
1321
1325
  </label>
1322
1326
  </div>
1323
1327
  </div>
1328
+ <div class="server-settings-section" data-section="custom-icons">
1329
+ <h2>Custom Icons</h2>
1330
+ <p class="settings-hint" style="margin-bottom: 16px;">Manage uploaded custom icons available to any project or folder across this server. Uploads are stored server-wide, not per-project.</p>
1331
+ <div class="custom-icons-header">
1332
+ <input type="text" id="custom-icons-filter-input" class="settings-btn-sm custom-icons-filter-input" placeholder="Filter by name…" autocomplete="off" spellcheck="false">
1333
+ <button class="settings-btn-sm" id="custom-icons-upload-btn"><i data-lucide="upload"></i> Upload</button>
1334
+ <input type="file" id="custom-icons-file-input" accept="image/png,image/jpeg,image/gif,image/webp" style="display:none">
1335
+ </div>
1336
+ <div id="custom-icons-list">
1337
+ <!-- rows rendered by JS (custom-icons-settings.js) -->
1338
+ </div>
1339
+ </div>
1324
1340
  <!-- Clagentic: Lite — always rendered; JS toggles installed vs not-installed sub-states -->
1325
1341
  <div class="server-settings-section" data-section="lite" id="settings-clagentic-section">
1326
1342
  <h2>Clagentic: Lite</h2>
@@ -11,6 +11,7 @@ import { processMessage } from './app-messages.js';
11
11
  import { saveToolState, resetToolState, restoreToolState } from './tools.js';
12
12
  import { getSessionUsage, setSessionUsage, getContextData, setContextData, updateContextPanel, updateUsagePanel } from './app-panels.js';
13
13
  import { onHistoryPrepended as onSessionSearchHistoryPrepended } from './session-search.js';
14
+ import { positionPopover } from './popover-position.js';
14
15
 
15
16
  // --- Module-owned state ---
16
17
  var sessionInfoPopover = null;
@@ -104,13 +105,9 @@ export function initHeader() {
104
105
  sessionInfoPopover = pop;
105
106
  refreshIcons();
106
107
 
107
- var btnRect = headerInfoBtn.getBoundingClientRect();
108
- pop.style.top = (btnRect.bottom + 6) + "px";
109
- pop.style.left = btnRect.left + "px";
110
- var popRect = pop.getBoundingClientRect();
111
- if (popRect.right > window.innerWidth - 8) {
112
- pop.style.left = (window.innerWidth - popRect.width - 8) + "px";
113
- }
108
+ // Four-edge clamp (lr-a10a): the prior right-only clamp could leave
109
+ // the popover's bottom edge off-screen on short viewports.
110
+ positionPopover(pop, headerInfoBtn, { placement: "below" });
114
111
  });
115
112
 
116
113
  document.addEventListener("click", function (e) {
@@ -132,6 +129,22 @@ export function updateHistorySentinel() {
132
129
  var messagesEl = getMessagesEl();
133
130
  var existing = messagesEl.querySelector(".history-sentinel");
134
131
  if (store.get('historyFrom') > 0) {
132
+ // Never render a solitary sentinel (lr-c24b): if there is no visible
133
+ // message currently rendered below where the sentinel would sit, a lone
134
+ // "Load earlier messages" button with nothing above it is not a useful
135
+ // affordance — trigger a load instead of displaying it. This can happen
136
+ // after a prepend page advanced historyFrom without rendering any
137
+ // visible content. Skipped mid-initial-replay (replayingHistory): that
138
+ // path's own history_meta -> item stream -> history_done sequence is
139
+ // already populating #messages and has not finished yet, so an empty
140
+ // container at this instant is expected, not a stuck page.
141
+ var hasRenderedContent = !!(existing ? existing.nextElementSibling : messagesEl.firstElementChild);
142
+ if (!hasRenderedContent && !store.get('replayingHistory')) {
143
+ if (existing) existing.remove();
144
+ if (historySentinelObserver) { historySentinelObserver.disconnect(); historySentinelObserver = null; }
145
+ if (!store.get('loadingMore')) requestMoreHistory();
146
+ return;
147
+ }
135
148
  if (!existing) {
136
149
  var sentinel = document.createElement("div");
137
150
  sentinel.className = "history-sentinel";
@@ -156,15 +169,26 @@ export function updateHistorySentinel() {
156
169
  }
157
170
  }
158
171
 
172
+ // Sends the load_more_history request. Assumes the caller has already
173
+ // validated preconditions (ws connected, historyFrom > 0) and set
174
+ // loadingMore — shared by requestMoreHistory (guarded, user/observer-
175
+ // triggered) and prependOlderHistory's auto-advance (lr-c24b), which is
176
+ // already mid-load and must not be blocked by the loadingMore guard.
177
+ function sendLoadMoreHistory(before) {
178
+ var ws = getWs();
179
+ if (!ws) return;
180
+ var messagesEl = getMessagesEl();
181
+ var btn = messagesEl.querySelector(".load-more-btn");
182
+ if (btn) btn.classList.add("loading");
183
+ ws.send(JSON.stringify({ type: "load_more_history", before: before }));
184
+ }
185
+
159
186
  export function requestMoreHistory() {
160
187
  var ws = getWs();
161
188
  var s = store.snap();
162
189
  if (s.loadingMore || s.historyFrom <= 0 || !ws || !s.connected) return;
163
190
  store.set({ loadingMore: true });
164
- var messagesEl = getMessagesEl();
165
- var btn = messagesEl.querySelector(".load-more-btn");
166
- if (btn) btn.classList.add("loading");
167
- ws.send(JSON.stringify({ type: "load_more_history", before: s.historyFrom }));
191
+ sendLoadMoreHistory(s.historyFrom);
168
192
  }
169
193
 
170
194
  export function prependOlderHistory(items, meta) {
@@ -196,6 +220,16 @@ export function prependOlderHistory(items, meta) {
196
220
  var anchorEl = getPrependAnchor();
197
221
  var anchorOffset = anchorEl ? anchorEl.getBoundingClientRect().top : 0;
198
222
 
223
+ // Snapshot the sibling immediately before the anchor (or the last child,
224
+ // when the container was empty) so the batch's visible yield can be
225
+ // measured after rendering (lr-c24b). addToMessages() (app-rendering.js)
226
+ // is the single choke point for top-level #messages insertion during
227
+ // processMessage(), and it always inserts immediately before the current
228
+ // prepend anchor — so any new node from this batch appears between this
229
+ // snapshot and anchorEl. anchorEl itself is never removed/replaced by the
230
+ // rendering pipeline, so it remains a stable reference across the batch.
231
+ var siblingBeforeAnchor = anchorEl ? anchorEl.previousSibling : messagesEl.lastChild;
232
+
199
233
  // Process each item through the rendering pipeline
200
234
  for (var i = 0; i < items.length; i++) {
201
235
  processMessage(items[i]);
@@ -207,6 +241,13 @@ export function prependOlderHistory(items, meta) {
207
241
  // Clear prepend mode
208
242
  setPrependAnchor(null);
209
243
 
244
+ // Did this page render any visible DOM? If the sibling immediately before
245
+ // the anchor (or the container's last child, for an initially-empty
246
+ // container) is unchanged, the batch inserted nothing new.
247
+ var renderedNoVisibleContent = anchorEl
248
+ ? anchorEl.previousSibling === siblingBeforeAnchor
249
+ : messagesEl.lastChild === siblingBeforeAnchor;
250
+
210
251
  // Restore saved state
211
252
  store.set({ currentMsgEl: savedMsgEl, currentFullText: savedFullText });
212
253
  resetCurrentFullText(savedFullText);
@@ -226,7 +267,7 @@ export function prependOlderHistory(items, meta) {
226
267
  }
227
268
 
228
269
  // Update state
229
- store.set({ historyFrom: meta.from, loadingMore: false });
270
+ store.set({ historyFrom: meta.from });
230
271
 
231
272
  // Renumber data-turn attributes in DOM order
232
273
  var turnEls = messagesEl.querySelectorAll("[data-turn]");
@@ -235,12 +276,26 @@ export function prependOlderHistory(items, meta) {
235
276
  }
236
277
  setTurnCounter(turnEls.length);
237
278
 
238
- // Update sentinel
239
- if (meta.hasMore) {
240
- var btn = messagesEl.querySelector(".load-more-btn");
241
- if (btn) btn.classList.remove("loading");
279
+ // Auto-advance when this page rendered nothing visible (lr-c24b): the
280
+ // server already extends the window by turn boundary to surface a visible
281
+ // event when possible, but a bounded extension can still exhaust its step
282
+ // cap on a pathologically long invisible-yield run. One user click (or one
283
+ // sentinel auto-load) must always surface >=1 message when older history
284
+ // exists — settle loadingMore:false only once something rendered, or there
285
+ // is nothing left to load.
286
+ if (renderedNoVisibleContent && meta.hasMore) {
287
+ // loadingMore stays true; the next history_prepend response re-enters
288
+ // this function and re-evaluates.
289
+ sendLoadMoreHistory(meta.from);
242
290
  } else {
243
- updateHistorySentinel();
291
+ store.set({ loadingMore: false });
292
+ // Update sentinel
293
+ if (meta.hasMore) {
294
+ var btn = messagesEl.querySelector(".load-more-btn");
295
+ if (btn) btn.classList.remove("loading");
296
+ } else {
297
+ updateHistorySentinel();
298
+ }
244
299
  }
245
300
 
246
301
  // Notify in-session search that history was prepended (for pending scroll targets)
@@ -5,6 +5,7 @@ import { store } from './store.js';
5
5
  import { getWs } from './ws-ref.js';
6
6
  import { escapeHtml } from './utils.js';
7
7
  import { switchProject, getCachedProjects, renderProjectList } from './app-projects.js';
8
+ import { renderProjectIcon, projectIconHtml } from './project-icon.js';
8
9
  import { openSchedulerToTab } from './scheduler.js';
9
10
  // playbook imports removed (Quick Start section removed from hub)
10
11
  import { exitDmMode } from './app-dm.js';
@@ -330,13 +331,33 @@ export function renderHomeHub(projects) {
330
331
  (function (proj) {
331
332
  var item = document.createElement("div");
332
333
  item.className = "hub-project-item";
333
- var dotClass = "hub-project-dot" + (proj.isProcessing ? " processing" : "");
334
- var iconHtml = proj.icon ? '<span class="hub-project-icon">' + proj.icon + '</span>' : '';
334
+
335
+ var dot = document.createElement("span");
336
+ dot.className = "hub-project-dot" + (proj.isProcessing ? " processing" : "");
337
+ item.appendChild(dot);
338
+
339
+ if (proj.icon) {
340
+ var iconSpan = document.createElement("span");
341
+ iconSpan.className = "hub-project-icon";
342
+ // renderProjectIcon routes custom (:slug:) to <img> and emoji to text,
343
+ // avoiding the pre-existing XSS gap of raw proj.icon in innerHTML.
344
+ renderProjectIcon(proj.icon, iconSpan, null);
345
+ item.appendChild(iconSpan);
346
+ }
347
+
348
+ var nameSpan = document.createElement("span");
349
+ nameSpan.className = "hub-project-name";
350
+ nameSpan.textContent = proj.title || proj.project || proj.slug;
351
+ item.appendChild(nameSpan);
352
+
335
353
  var sessionsLabel = typeof proj.sessions === "number" ? proj.sessions : "";
336
- item.innerHTML = '<span class="' + dotClass + '"></span>' +
337
- iconHtml +
338
- '<span class="hub-project-name">' + escapeHtml(proj.title || proj.project || proj.slug) + '</span>' +
339
- (sessionsLabel !== "" ? '<span class="hub-project-sessions">' + sessionsLabel + '</span>' : '');
354
+ if (sessionsLabel !== "") {
355
+ var sessSpan = document.createElement("span");
356
+ sessSpan.className = "hub-project-sessions";
357
+ sessSpan.textContent = String(sessionsLabel);
358
+ item.appendChild(sessSpan);
359
+ }
360
+
340
361
  item.addEventListener("click", function () {
341
362
  switchProject(proj.slug);
342
363
  });
@@ -428,8 +449,11 @@ export function handleHubRecentSessions(msg) {
428
449
  sessions.forEach(function (sess) {
429
450
  var item = document.createElement("div");
430
451
  item.className = "hub-recent-item";
452
+ // projectIconHtml() routes custom (:slug:) icons to a safe <img> tag and
453
+ // emoji to escaped text, replacing the raw escapeHtml(sess.projectIcon)
454
+ // which showed ':slug:' as literal text (lr-a6da).
431
455
  var iconHtml = sess.projectIcon
432
- ? '<span class="hub-recent-project-icon">' + escapeHtml(sess.projectIcon) + '</span>'
456
+ ? '<span class="hub-recent-project-icon">' + projectIconHtml(sess.projectIcon) + '</span>'
433
457
  : '<span class="hub-recent-project-icon hub-recent-project-icon--blank"></span>';
434
458
  var timeStr = formatRelativeTime(sess.lastActivity);
435
459
  var agentBadge = sess.agentName
@@ -24,6 +24,7 @@ import { handleFsList, handleFsRead, handleFileChanged, handleDirChanged, handle
24
24
  import { getPendingNavigate, peekPendingNavigate } from './pending-navigate.js';
25
25
  import { isProjectSettingsOpen, refreshProjectSettingsModels, handleInstructionsRead, handleInstructionsWrite, handleProjectEnv, handleProjectEnvSaved, handleProjectSharedEnv, handleProjectSharedEnvSaved, handleProjectOwnerChanged, updateLiteVisibility, handleLiteProjectStatus, handleLiteEnrollResult, handleLiteUnenrollResult } from './project-settings.js';
26
26
  import { updateSettingsModels, updateSettingsStats, updateDaemonConfig, handleSetPinResult, handleKeepAwakeChanged, handleAutoContinueChanged, handleRefreshAgentsResult, handleRestartResult, handleShutdownResult, handleSharedEnv, handleSharedEnvSaved, handleGlobalClaudeMdRead, handleGlobalClaudeMdWrite, updateSsLiteVisibility } from './server-settings.js';
27
+ import { handleRenameCustomIconResult } from './custom-icons-settings.js';
27
28
  import { handleTermList, handleTermCreated, sendTerminalCommand, handleTermOutput, handleTermResized, handleTermExited, handleTermClosed } from './terminal.js';
28
29
  import { updateTerminalList, handleContextSourcesState } from './context-sources.js';
29
30
  import { handleNotesList, handleNoteCreated, handleNoteUpdated, handleNoteDeleted } from './sticky-notes.js';
@@ -1219,6 +1220,10 @@ export function processMessage(msg) {
1219
1220
  updateProjectList(msg);
1220
1221
  break;
1221
1222
 
1223
+ case "rename_custom_icon_result":
1224
+ handleRenameCustomIconResult(msg);
1225
+ break;
1226
+
1222
1227
  case "project_owner_changed":
1223
1228
  store.set({ currentProjectOwnerId: msg.ownerId });
1224
1229
  handleProjectOwnerChanged(msg);
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { refreshIcons, iconHtml } from './icons.js';
6
6
  import { escapeHtml } from './utils.js';
7
+ import { projectIconHtml } from './project-icon.js';
7
8
  import { store } from './store.js';
8
9
  import { getWs } from './ws-ref.js';
9
10
  import { getCachedProjects } from './app-projects.js';
@@ -101,7 +102,10 @@ function showBanner(notif, autoDismissMs) {
101
102
  : isAuthRequired
102
103
  ? '<img src="/icon-banded-76.png" width="32" height="32" alt="Clagentic:Console" style="border-radius:8px">'
103
104
  : projectIcon
104
- ? '<span class="notif-banner-emoji">' + projectIcon + '</span>'
105
+ // projectIconHtml() routes custom (:slug:) icons to a safe <img> tag and
106
+ // emoji to escaped text — the raw `projectIcon` interpolation previously
107
+ // showed ':slug:' as literal text (lr-a6da).
108
+ ? '<span class="notif-banner-emoji">' + projectIconHtml(projectIcon) + '</span>'
105
109
  : isEmpty
106
110
  ? '<img src="/icon-banded-76.png" width="32" height="32" alt="Clagentic:Console" style="border-radius:8px">'
107
111
  : iconHtml("folder");