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

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 (37) hide show
  1. package/README.md +18 -0
  2. package/lib/daemon.js +94 -0
  3. package/lib/project-sessions.js +26 -0
  4. package/lib/public/css/base.css +18 -0
  5. package/lib/public/css/diagnostics.css +8 -0
  6. package/lib/public/css/icon-strip.css +201 -0
  7. package/lib/public/css/menus.css +2 -2
  8. package/lib/public/css/mobile-nav.css +24 -0
  9. package/lib/public/css/server-settings.css +100 -0
  10. package/lib/public/index.html +13 -0
  11. package/lib/public/modules/app-header.js +4 -7
  12. package/lib/public/modules/app-home-hub.js +31 -7
  13. package/lib/public/modules/app-messages.js +5 -0
  14. package/lib/public/modules/app-notifications.js +5 -1
  15. package/lib/public/modules/app-projects.js +10 -5
  16. package/lib/public/modules/command-palette.js +16 -5
  17. package/lib/public/modules/custom-icons-settings.js +399 -0
  18. package/lib/public/modules/custom-icons.js +114 -0
  19. package/lib/public/modules/diagnostics.js +10 -0
  20. package/lib/public/modules/emoji-picker.js +253 -6
  21. package/lib/public/modules/popover-position.js +192 -0
  22. package/lib/public/modules/project-icon.js +113 -0
  23. package/lib/public/modules/project-settings.js +2 -2
  24. package/lib/public/modules/project-switcher.js +2 -1
  25. package/lib/public/modules/scheduler-config.js +5 -8
  26. package/lib/public/modules/scheduler.js +5 -6
  27. package/lib/public/modules/server-settings.js +6 -0
  28. package/lib/public/modules/sidebar-mobile.js +4 -6
  29. package/lib/public/modules/sidebar-projects.js +35 -90
  30. package/lib/public/modules/sidebar-sessions.js +6 -20
  31. package/lib/public/modules/sticky-notes.js +4 -4
  32. package/lib/public/modules/terminal.js +5 -12
  33. package/lib/server-settings.js +221 -1
  34. package/lib/server.js +2 -0
  35. package/lib/sessions.js +16 -9
  36. package/lib/ws-schema.js +2 -0
  37. package/package.json +2 -1
package/README.md CHANGED
@@ -172,6 +172,24 @@ The test suite covers 12 areas across 26 test files:
172
172
 
173
173
  Run the suite: `npm test`
174
174
 
175
+ ### Local install for manual testing (developers only)
176
+
177
+ > **Warning:** This is a manual, developer-only convenience. Do not call it from CI, automated scripts, systemd units, or any other tooling. It is not a release or deploy mechanism.
178
+
179
+ To install the current working-tree build globally and test it as a real end-user install would behave:
180
+
181
+ ```bash
182
+ npm run install:local-test
183
+ ```
184
+
185
+ This runs `npm pack` (which respects the `files` list in `package.json`, so you get exactly what would ship to npm), installs the resulting tarball globally with `npm install -g`, and removes the tarball. The result is indistinguishable from `npm install -g @clagentic/console` — no symlinks, no `node_modules` shortcuts.
186
+
187
+ When done testing, uninstall with:
188
+
189
+ ```bash
190
+ npm uninstall -g @clagentic/console
191
+ ```
192
+
175
193
  ## FAQ
176
194
 
177
195
  **"Is this a Claude Code wrapper?"**
package/lib/daemon.js CHANGED
@@ -36,6 +36,7 @@ var { startMemoryHighWatcher } = require("./memory-limits");
36
36
  var { createDrain } = require("./drain");
37
37
  var liteDetect = require("./lite-detect");
38
38
  var { execFile: liteExecFile } = require("child_process");
39
+ var { SLUG_RE: CUSTOM_ICON_SLUG_RE, CUSTOM_EMOJI_CT } = require("./server-settings");
39
40
 
40
41
  var daemonVersion = require("../package.json").version;
41
42
  var configFile = process.env.CLAGENTIC_CONFIG || process.env.CLAY_CONFIG || require("./config").configPath();
@@ -753,6 +754,99 @@ var relay = createServer({
753
754
  });
754
755
  return { ok: true };
755
756
  },
757
+ // Rename a custom-icon upload: oldSlug -> newSlug. Rewrites every
758
+ // config.projects[].icon and config.folderMeta[].icon reference that
759
+ // pointed at the old ":oldSlug:" sentinel, renames the file on disk, and
760
+ // broadcasts the updated project/folder list — all as one atomic op
761
+ // (lr-d1d9, LOCKED DECISION: rewrite references, not block-on-in-use).
762
+ // Doing this as a WS op (rather than a bare HTTP route) is what makes the
763
+ // file-rename + reference-rewrite + broadcast atomic: the daemon holds both
764
+ // the on-disk custom-emoji file and the in-memory config.projects/folderMeta
765
+ // that reference it, so there's no window where they can observably diverge.
766
+ onRenameCustomIcon: function (oldSlug, newSlug) {
767
+ if (typeof oldSlug !== "string" || typeof newSlug !== "string") {
768
+ return { ok: false, error: "Missing oldSlug or newSlug" };
769
+ }
770
+ if (!CUSTOM_ICON_SLUG_RE.test(oldSlug) || !CUSTOM_ICON_SLUG_RE.test(newSlug)) {
771
+ return { ok: false, error: "Invalid slug" };
772
+ }
773
+ if (oldSlug === newSlug) {
774
+ return { ok: false, error: "New slug must differ from the current slug" };
775
+ }
776
+
777
+ var customEmojiDir = path.join(CONFIG_DIR, "custom-emoji");
778
+ var oldFile = null;
779
+ var oldExt = null;
780
+ var newSlugExists = false;
781
+ try {
782
+ // Scan the FULL directory (no early break) — the newSlug collision
783
+ // check must run even when oldSlug's file happens to sort before
784
+ // newSlug's file in readdirSync order (e.g. alphabetically).
785
+ var existingFiles = fs.readdirSync(customEmojiDir);
786
+ for (var efi = 0; efi < existingFiles.length; efi++) {
787
+ var ef = existingFiles[efi];
788
+ var efExt = path.extname(ef).slice(1);
789
+ if (!CUSTOM_EMOJI_CT[efExt]) continue;
790
+ var efBasename = path.basename(ef, "." + efExt);
791
+ if (efBasename === oldSlug) { oldFile = ef; oldExt = efExt; }
792
+ // A 409 on newSlug must catch a collision regardless of extension.
793
+ if (efBasename === newSlug) { newSlugExists = true; }
794
+ }
795
+ } catch (e) {
796
+ return { ok: false, error: "Custom icon storage unavailable" };
797
+ }
798
+ if (newSlugExists) {
799
+ return { ok: false, error: "A custom icon named \"" + newSlug + "\" already exists" };
800
+ }
801
+ if (!oldFile) {
802
+ return { ok: false, error: "Custom icon \"" + oldSlug + "\" not found" };
803
+ }
804
+
805
+ // Defense-in-depth: resolve both paths and confirm they stay within
806
+ // customEmojiDir, mirroring the safePath/resolve-prefix guard used by the
807
+ // existing POST/GET/DELETE routes in server-settings.js.
808
+ var oldPath = path.join(customEmojiDir, oldFile);
809
+ var newFile = newSlug + "." + oldExt;
810
+ var newPath = path.join(customEmojiDir, newFile);
811
+ var resolvedOld = path.resolve(customEmojiDir, oldFile);
812
+ var resolvedNew = path.resolve(customEmojiDir, newFile);
813
+ if (!resolvedOld.startsWith(customEmojiDir + path.sep) || !resolvedNew.startsWith(customEmojiDir + path.sep)) {
814
+ return { ok: false, error: "Invalid path" };
815
+ }
816
+
817
+ try {
818
+ fs.renameSync(oldPath, newPath);
819
+ } catch (e) {
820
+ return { ok: false, error: "Rename failed: " + e.message };
821
+ }
822
+
823
+ // Rewrite every reference to the old sentinel across projects + folders.
824
+ var oldSentinel = ":" + oldSlug + ":";
825
+ var newSentinel = ":" + newSlug + ":";
826
+ for (var pi = 0; pi < config.projects.length; pi++) {
827
+ if (config.projects[pi].icon === oldSentinel) {
828
+ config.projects[pi].icon = newSentinel;
829
+ }
830
+ }
831
+ if (config.folderMeta) {
832
+ var folderNames = Object.keys(config.folderMeta);
833
+ for (var fni = 0; fni < folderNames.length; fni++) {
834
+ var fMeta = config.folderMeta[folderNames[fni]];
835
+ if (fMeta && fMeta.icon === oldSentinel) {
836
+ fMeta.icon = newSentinel;
837
+ }
838
+ }
839
+ }
840
+ saveConfig(config);
841
+ try { syncClayrc(config.projects); } catch (e) {}
842
+ relay.broadcastAll({
843
+ type: "projects_updated",
844
+ projects: relay.getProjects(),
845
+ projectCount: config.projects.length,
846
+ folderMeta: config.folderMeta || {},
847
+ });
848
+ return { ok: true, slug: newSlug, url: "/api/custom-emoji/" + newSlug };
849
+ },
756
850
  onProjectOwnerChanged: function (slug, ownerId) {
757
851
  console.log("[daemon] onProjectOwnerChanged:", slug, "→", ownerId);
758
852
  var oldOwnerId = null;
@@ -1585,6 +1585,32 @@ function attachSessions(ctx) {
1585
1585
  return true;
1586
1586
  }
1587
1587
 
1588
+ // --- Rename a custom-icon upload (lr-d1d9) ---
1589
+ // Auth parity with the picker's POST/DELETE /api/custom-emoji HTTP routes:
1590
+ // no admin gate, no ownership model. Every WS connection reaching this
1591
+ // handler already passed the upgrade-time isRequestAuthed() check in
1592
+ // server.js, so no additional per-message auth check is needed here —
1593
+ // same posture as the neighboring set_project_icon / set_folder_icon ops.
1594
+ if (msg.type === "rename_custom_icon") {
1595
+ if (!msg.oldSlug || !msg.newSlug) {
1596
+ sendTo(ws, { type: "rename_custom_icon_result", ok: false, error: "Missing oldSlug or newSlug" });
1597
+ return true;
1598
+ }
1599
+ if (typeof opts.onRenameCustomIcon === "function") {
1600
+ var renameIconResult = opts.onRenameCustomIcon(msg.oldSlug, msg.newSlug);
1601
+ sendTo(ws, {
1602
+ type: "rename_custom_icon_result",
1603
+ ok: renameIconResult.ok,
1604
+ oldSlug: msg.oldSlug,
1605
+ newSlug: renameIconResult.slug || msg.newSlug,
1606
+ error: renameIconResult.error,
1607
+ });
1608
+ } else {
1609
+ sendTo(ws, { type: "rename_custom_icon_result", ok: false, error: "Not supported" });
1610
+ }
1611
+ return true;
1612
+ }
1613
+
1588
1614
  // --- Daemon config / server management (admin-only in multi-user mode) ---
1589
1615
  if (msg.type === "get_daemon_config" || msg.type === "set_pin" || msg.type === "set_keep_awake" ||
1590
1616
  msg.type === "set_auto_continue" || msg.type === "set_image_retention" || msg.type === "set_mem_available_threshold" ||
@@ -285,3 +285,21 @@ html, body {
285
285
  color: var(--text);
286
286
  }
287
287
 
288
+ /* Mobile (lr-2fdd): bottom:80px occludes the bottom-nav / input box / content
289
+ on narrow viewports (iOS screenshot showed the toast covering content just
290
+ above the Projects/Chat/Team/More nav). Top-anchor instead — per Andy's
291
+ steer ("should top align more than bottom align") — clearing the notch /
292
+ status bar via the safe-area inset. Desktop placement is unchanged. */
293
+ @media (max-width: 768px) {
294
+ .toast,
295
+ .sw-update-banner {
296
+ top: calc(var(--safe-top) + 12px);
297
+ bottom: auto;
298
+ transform: translateX(-50%) translateY(-8px);
299
+ }
300
+ .toast.visible,
301
+ .sw-update-banner.visible {
302
+ transform: translateX(-50%) translateY(0);
303
+ }
304
+ }
305
+
@@ -264,6 +264,14 @@
264
264
  right: 16px;
265
265
  transform: translateY(8px);
266
266
  max-width: none;
267
+ /* lr-2fdd: bottom:80px (inherited from base .toast) occludes the
268
+ bottom-nav / input box / content on mobile (iOS screenshot showed
269
+ the PREFLIGHT WARNING toast covering the UPCOMING card just above
270
+ the Projects/Chat/Team/More nav). Top-anchor instead, matching the
271
+ base .toast / .sw-update-banner mobile fix so the whole toast
272
+ family lands the same way. */
273
+ top: calc(var(--safe-top) + 12px);
274
+ bottom: auto;
267
275
  }
268
276
  .toast-diagnostic.visible {
269
277
  transform: translateY(0);
@@ -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
+
@@ -1053,6 +1053,7 @@
1053
1053
  <button class="settings-nav-item" data-section="claudemd"><span>Instructions</span></button>
1054
1054
  <button class="settings-nav-item" data-section="environment"><span>Environment</span></button>
1055
1055
  <button class="settings-nav-item" data-section="storage"><span>Storage</span></button>
1056
+ <button class="settings-nav-item" data-section="custom-icons"><span>Custom Icons</span></button>
1056
1057
  <div class="settings-nav-separator settings-admin-only"></div>
1057
1058
  <div class="settings-nav-category settings-admin-only">Admin</div>
1058
1059
  <button class="settings-nav-item settings-admin-only" data-section="admin-users"><span>Users</span></button>
@@ -1321,6 +1322,18 @@
1321
1322
  </label>
1322
1323
  </div>
1323
1324
  </div>
1325
+ <div class="server-settings-section" data-section="custom-icons">
1326
+ <h2>Custom Icons</h2>
1327
+ <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>
1328
+ <div class="custom-icons-header">
1329
+ <input type="text" id="custom-icons-filter-input" class="settings-btn-sm custom-icons-filter-input" placeholder="Filter by name…" autocomplete="off" spellcheck="false">
1330
+ <button class="settings-btn-sm" id="custom-icons-upload-btn"><i data-lucide="upload"></i> Upload</button>
1331
+ <input type="file" id="custom-icons-file-input" accept="image/png,image/jpeg,image/gif,image/webp" style="display:none">
1332
+ </div>
1333
+ <div id="custom-icons-list">
1334
+ <!-- rows rendered by JS (custom-icons-settings.js) -->
1335
+ </div>
1336
+ </div>
1324
1337
  <!-- Clagentic: Lite — always rendered; JS toggles installed vs not-installed sub-states -->
1325
1338
  <div class="server-settings-section" data-section="lite" id="settings-clagentic-section">
1326
1339
  <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) {
@@ -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