@clagentic/console 1.0.0-beta.4 → 1.0.1-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 (93) hide show
  1. package/CREDITS.md +1 -0
  2. package/LICENSE +1 -0
  3. package/README.md +64 -174
  4. package/bin/cli.js +10 -15
  5. package/lib/agents-favorites.js +1 -0
  6. package/lib/ask-user-mcp-server.js +1 -0
  7. package/lib/config.js +1 -0
  8. package/lib/crisis-safety.js +1 -0
  9. package/lib/daemon.js +38 -2
  10. package/lib/dm.js +1 -0
  11. package/lib/mcp-local.js +1 -0
  12. package/lib/os-users.js +1 -0
  13. package/lib/pages.js +8 -71
  14. package/lib/project-connection.js +3 -28
  15. package/lib/project-external-trigger.js +1 -0
  16. package/lib/project-http.js +1 -0
  17. package/lib/project-knowledge.js +3 -2
  18. package/lib/project-loop.js +1 -1
  19. package/lib/project-mcp.js +1 -0
  20. package/lib/project-memory.js +1 -0
  21. package/lib/project-sessions.js +2 -1
  22. package/lib/project-user-message.js +2 -1
  23. package/lib/project.js +1 -0
  24. package/lib/public/app.js +2 -1
  25. package/lib/public/css/admin.css +23 -0
  26. package/lib/public/css/base.css +52 -0
  27. package/lib/public/css/channel-layout.css +1 -0
  28. package/lib/public/css/debate.css +1 -0
  29. package/lib/public/css/filebrowser.css +14 -0
  30. package/lib/public/css/home-hub.css +1 -0
  31. package/lib/public/css/icon-strip.css +2 -15
  32. package/lib/public/css/loop.css +1 -0
  33. package/lib/public/css/mention.css +2 -1
  34. package/lib/public/css/server-settings.css +206 -41
  35. package/lib/public/css/session-search.css +1 -0
  36. package/lib/public/css/stt.css +1 -0
  37. package/lib/public/index.html +45 -48
  38. package/lib/public/modules/admin.js +55 -2
  39. package/lib/public/modules/app-connection.js +1 -1
  40. package/lib/public/modules/app-dm.js +1 -1
  41. package/lib/public/modules/app-favicon.js +1 -0
  42. package/lib/public/modules/app-home-hub.js +1 -0
  43. package/lib/public/modules/app-loop-ui.js +1 -1
  44. package/lib/public/modules/app-loop-wizard.js +1 -1
  45. package/lib/public/modules/app-messages.js +16 -4
  46. package/lib/public/modules/app-misc.js +2 -9
  47. package/lib/public/modules/app-notifications.js +2 -2
  48. package/lib/public/modules/app-panels.js +13 -7
  49. package/lib/public/modules/app-projects.js +1 -0
  50. package/lib/public/modules/app-rate-limit.js +1 -1
  51. package/lib/public/modules/app-rendering.js +9 -4
  52. package/lib/public/modules/app-skills-install.js +1 -1
  53. package/lib/public/modules/command-palette.js +1 -1
  54. package/lib/public/modules/mention.js +3 -2
  55. package/lib/public/modules/notifications.js +34 -0
  56. package/lib/public/modules/playbook.js +1 -0
  57. package/lib/public/modules/profile.js +1 -1
  58. package/lib/public/modules/project-settings.js +179 -12
  59. package/lib/public/modules/project-switcher.js +29 -91
  60. package/lib/public/modules/server-settings.js +234 -11
  61. package/lib/public/modules/session-search.js +1 -0
  62. package/lib/public/modules/sidebar-mobile.js +0 -1
  63. package/lib/public/modules/sidebar-projects.js +19 -0
  64. package/lib/public/modules/sidebar-sessions.js +1 -0
  65. package/lib/public/modules/sidebar-users.js +3 -3
  66. package/lib/public/modules/store.js +26 -4
  67. package/lib/public/modules/theme.js +9 -9
  68. package/lib/public/modules/tools.js +2 -1
  69. package/lib/public/modules/user-settings.js +1 -1
  70. package/lib/public/style.css +1 -0
  71. package/lib/public/sw.js +10 -2
  72. package/lib/push.js +2 -1
  73. package/lib/sdk-bridge.js +1 -0
  74. package/lib/sdk-message-processor.js +11 -0
  75. package/lib/sdk-worker.js +1 -0
  76. package/lib/server-auth.js +2 -2
  77. package/lib/server-dm.js +1 -0
  78. package/lib/server-palette.js +1 -0
  79. package/lib/server-settings.js +26 -25
  80. package/lib/server-skills.js +1 -1
  81. package/lib/server.js +28 -4
  82. package/lib/session-search.js +1 -0
  83. package/lib/sessions.js +4 -1
  84. package/lib/smtp.js +7 -7
  85. package/lib/users-auth.js +30 -5
  86. package/lib/users-preferences.js +1 -0
  87. package/lib/users.js +2 -0
  88. package/lib/ws-schema.js +1 -0
  89. package/lib/yoke/adapters/claude-worker.js +1 -0
  90. package/lib/yoke/adapters/claude.js +1 -0
  91. package/lib/yoke/adapters/codex.js +1 -1
  92. package/lib/yoke/mcp-bridge-server.js +1 -0
  93. package/package.json +3 -3
@@ -1,38 +1,31 @@
1
- // project-switcher.js — macOS Cmd+Tab-style quick switcher.
1
+ // project-switcher.js — macOS Cmd+Tab-style quick switcher for projects.
2
2
  //
3
- // Two modes share the same overlay:
4
- // Cmd/Ctrl+E → projects only (non-Mate), activates via switchProject
5
- // Cmd/Ctrl+M → Mates only, activates via openDm
3
+ // Cmd/Ctrl+E activates the project switcher overlay. While the modifier is
4
+ // still held, repeating the shortcut cycles forward and Shift cycles back.
5
+ // Releasing the modifier commits — matching Cmd+Tab semantics.
6
+ // Enter commits explicitly; Escape cancels.
6
7
  //
7
- // While the modifier is still held, repeating the same shortcut cycles
8
- // forward and Shift cycles back. Releasing the modifier commits —
9
- // matching Cmd+Tab semantics. Enter commits explicitly; Escape cancels.
10
- //
11
- // Each mode has its own in-memory MRU list so the ordering stays
12
- // mode-specific (visiting projects shouldn't reorder the mate list,
13
- // and vice versa). No persistence — MRU is a transient hint and
14
- // project rule forbids localStorage for preferences.
8
+ // Project mode maintains an in-memory MRU list so the ordering stays
9
+ // transient (no persistence — MRU is a hint only, and project rule forbids
10
+ // localStorage for preferences).
15
11
 
16
12
  import { store } from './store.js';
17
13
  import { refreshIcons } from './icons.js';
18
14
  import { getCachedProjects, switchProject } from './app-projects.js';
19
- import { openDm } from './app-dm.js';
20
15
  import { parseEmojis } from './markdown.js';
21
16
 
22
17
  var _projectMru = []; // project slugs, most recent first
23
- var _mateMru = []; // mate ids (mate_XXX), most recent first
24
18
  var _overlay = null;
25
19
  var _list = null;
26
20
  var _headerEl = null;
27
21
  var _open = false;
28
- var _mode = 'project'; // 'project' | 'mate'
29
22
  var _highlightedIndex = 0;
30
23
  var _entries = [];
31
24
 
32
25
  export function openSwitcherForMode(mode) {
33
- if (mode !== 'project' && mode !== 'mate') return;
26
+ if (mode !== 'project') return;
34
27
  if (_open) closeSwitcher(false);
35
- openSwitcher(mode);
28
+ openSwitcher();
36
29
  }
37
30
 
38
31
  export function initProjectSwitcher() {
@@ -40,19 +33,16 @@ export function initProjectSwitcher() {
40
33
  _list = _overlay.querySelector('.cmd-palette-results');
41
34
  _headerEl = _overlay.querySelector('.project-switcher-header');
42
35
 
43
- // Seed MRUs from current state.
36
+ // Seed MRU from current state.
44
37
  var seedSlug = store.get('currentSlug');
45
38
  if (seedSlug) _projectMru = [seedSlug];
46
39
 
47
- // Track MRUs by watching the store for navigation changes.
48
- store.subscribe(function (state, prev) {
40
+ // Track MRU by watching the store for navigation changes.
41
+ store.subscribe(['currentSlug'], function (state, prev) {
49
42
  if (state.currentSlug && state.currentSlug !== prev.currentSlug) {
50
43
  bumpMru(_projectMru, state.currentSlug);
51
44
  _projectMru = _projectMru; // (keep reference; bumpMru mutates via reassignment)
52
45
  }
53
- var curMate = mateIdFrom(state.dmTargetUser);
54
- var prevMate = mateIdFrom(prev.dmTargetUser);
55
- if (curMate && curMate !== prevMate) bumpMru(_mateMru, curMate);
56
46
  });
57
47
 
58
48
  var backdrop = _overlay.querySelector('.cmd-palette-backdrop');
@@ -62,34 +52,23 @@ export function initProjectSwitcher() {
62
52
  document.addEventListener('keyup', handleKeyUp, true);
63
53
  window.addEventListener('blur', function () { if (_open) closeSwitcher(false); });
64
54
 
65
- // Wire hotkey hint pills next to the icon strip so the keybinding is
66
- // discoverable in the same surface users use for clicking. Clicking
67
- // the pill is equivalent to pressing the shortcut itself.
55
+ // Wire hotkey hint pill next to the icon strip so the keybinding is
56
+ // discoverable in the same surface users use for clicking.
68
57
  var isMac = /Mac|iPhone|iPod|iPad/i.test(navigator.platform);
69
- var projectHintLabel = isMac ? '\u2318E' : 'Ctrl+E';
70
- var mateHintLabel = isMac ? '\u2318M' : 'Ctrl+M';
58
+ var projectHintLabel = isMac ? '⌘E' : 'Ctrl+E';
71
59
  var projectHint = document.getElementById('icon-strip-hint-project');
72
- var mateHint = document.getElementById('icon-strip-hint-mate');
73
60
  if (projectHint) {
74
61
  projectHint.textContent = projectHintLabel;
75
62
  projectHint.title = 'Switch project (' + projectHintLabel + ')';
76
63
  projectHint.addEventListener('click', function () { openSwitcherForMode('project'); });
77
64
  }
78
- if (mateHint) {
79
- mateHint.textContent = mateHintLabel;
80
- mateHint.title = 'Switch mate (' + mateHintLabel + ')';
81
- mateHint.addEventListener('click', function () { openSwitcherForMode('mate'); });
82
- }
83
-
84
- // Mate hint: always hidden since mates feature is removed
85
- if (mateHint) mateHint.classList.add('hidden');
86
65
  }
87
66
 
88
67
  function buildOverlayIfMissing() {
89
68
  _overlay = document.getElementById('project-switcher');
90
69
  if (_overlay) return;
91
70
  var isMac = /Mac|iPhone|iPod|iPad/i.test(navigator.platform);
92
- var modKbd = isMac ? '<kbd>\u2318</kbd>' : '<kbd>Ctrl</kbd>';
71
+ var modKbd = isMac ? '<kbd>⌘</kbd>' : '<kbd>Ctrl</kbd>';
93
72
  _overlay = document.createElement('div');
94
73
  _overlay.id = 'project-switcher';
95
74
  _overlay.className = 'cmd-palette hidden project-switcher';
@@ -99,16 +78,12 @@ function buildOverlayIfMissing() {
99
78
  '<div class="project-switcher-header">Switch project</div>' +
100
79
  '<div class="cmd-palette-results"></div>' +
101
80
  '<div class="cmd-palette-footer project-switcher-footer">' +
102
- '<span class="project-switcher-shortcuts">' + modKbd + '<kbd class="proj-next-key">E</kbd> next \u00b7 <kbd>\u21E7</kbd>' + modKbd + '<kbd class="proj-prev-key">E</kbd> prev \u00b7 <kbd>\u23CE</kbd> select \u00b7 <kbd>Esc</kbd> cancel</span>' +
81
+ '<span class="project-switcher-shortcuts">' + modKbd + '<kbd class="proj-next-key">E</kbd> next · <kbd>⇧</kbd>' + modKbd + '<kbd class="proj-prev-key">E</kbd> prev · <kbd>⏎</kbd> select · <kbd>Esc</kbd> cancel</span>' +
103
82
  '</div>' +
104
83
  '</div>';
105
84
  document.body.appendChild(_overlay);
106
85
  }
107
86
 
108
- function mateIdFrom(target) {
109
- return null;
110
- }
111
-
112
87
  function bumpMru(list, key) {
113
88
  // Mutate the original array to preserve the module-level reference
114
89
  // so subscribers / future reads see the update without a reassign.
@@ -122,18 +97,12 @@ function handleKeyDown(e) {
122
97
  var isMod = (e.metaKey || e.ctrlKey) && !e.altKey;
123
98
  var k = e.key.toLowerCase();
124
99
 
125
- // Mode shortcuts: Cmd/Ctrl+E (projects) and Cmd/Ctrl+M (mates).
126
- // Pressing the other shortcut while open switches mode; pressing the
127
- // same shortcut cycles.
128
- if (isMod && (k === 'e' || k === 'm')) {
129
- var requestedMode = k === 'e' ? 'project' : 'mate';
100
+ // Mode shortcut: Cmd/Ctrl+E opens the project switcher.
101
+ if (isMod && k === 'e') {
130
102
  e.preventDefault();
131
103
  e.stopPropagation();
132
104
  if (!_open) {
133
- openSwitcher(requestedMode);
134
- } else if (_mode !== requestedMode) {
135
- // Switched modes mid-flight. Rebuild the list for the new mode.
136
- openSwitcher(requestedMode);
105
+ openSwitcher();
137
106
  } else if (e.shiftKey) {
138
107
  cycle(-1);
139
108
  } else {
@@ -167,18 +136,16 @@ function handleKeyUp(e) {
167
136
  }
168
137
  }
169
138
 
170
- function openSwitcher(mode) {
171
- _mode = mode;
172
- _entries = buildEntries(mode);
139
+ function openSwitcher() {
140
+ _entries = buildProjectEntries();
173
141
  if (_entries.length === 0) {
174
142
  // Nothing to switch to; don't show an empty modal.
175
143
  if (_open) closeSwitcher(false);
176
144
  return;
177
145
  }
178
146
  if (_headerEl) {
179
- _headerEl.textContent = mode === 'mate' ? 'Switch mate' : 'Switch project';
147
+ _headerEl.textContent = 'Switch project';
180
148
  }
181
- updateFooterShortcut(mode);
182
149
  renderEntries();
183
150
  _highlightedIndex = pickInitialIndex();
184
151
  paintHighlight();
@@ -192,24 +159,15 @@ function openSwitcher(mode) {
192
159
  parseEmojis(_list);
193
160
  }
194
161
 
195
- function updateFooterShortcut(mode) {
196
- var nextKey = _overlay.querySelector('.proj-next-key');
197
- var prevKey = _overlay.querySelector('.proj-prev-key');
198
- var letter = mode === 'mate' ? 'M' : 'E';
199
- if (nextKey) nextKey.textContent = letter;
200
- if (prevKey) prevKey.textContent = letter;
201
- }
202
-
203
162
  function pickInitialIndex() {
204
163
  // Highlight the "previous" selectable entry (Cmd+Tab semantics),
205
164
  // while keeping the list in a stable natural order. Uses MRU to
206
- // find which project/mate was visited before the current one, then
165
+ // find which project was visited before the current one, then
207
166
  // locates its position in _entries.
208
167
  if (_entries.length === 0) return 0;
209
- var mru = _mode === 'mate' ? _mateMru : _projectMru;
210
- var currentKey = currentActiveKey();
211
- for (var m = 0; m < mru.length; m++) {
212
- var key = mru[m];
168
+ var currentKey = store.get('currentSlug');
169
+ for (var m = 0; m < _projectMru.length; m++) {
170
+ var key = _projectMru[m];
213
171
  if (key === currentKey) continue;
214
172
  for (var i = 0; i < _entries.length; i++) {
215
173
  if (_entries[i].key === key && !_entries[i].disabled) return i;
@@ -225,18 +183,6 @@ function pickInitialIndex() {
225
183
  return 0;
226
184
  }
227
185
 
228
- function currentActiveKey() {
229
- if (_mode === 'mate') {
230
- return mateIdFrom(store.get('dmTargetUser'));
231
- }
232
- return store.get('currentSlug');
233
- }
234
-
235
- function buildEntries(mode) {
236
- if (mode === 'mate') return buildMateEntries();
237
- return buildProjectEntries();
238
- }
239
-
240
186
  function buildProjectEntries() {
241
187
  var projects = getCachedProjects() || [];
242
188
  // Keep natural (server-provided) order so the list looks the same
@@ -258,10 +204,6 @@ function buildProjectEntries() {
258
204
  });
259
205
  }
260
206
 
261
- function buildMateEntries() {
262
- return [];
263
- }
264
-
265
207
  function closeSwitcher(commit) {
266
208
  if (!_open) return;
267
209
  _open = false;
@@ -269,11 +211,7 @@ function closeSwitcher(commit) {
269
211
  if (!commit) return;
270
212
  var entry = _entries[_highlightedIndex];
271
213
  if (!entry || entry.disabled) return;
272
- if (_mode === 'mate') {
273
- if (entry.key !== currentActiveKey()) openDm(entry.key);
274
- } else {
275
- if (entry.key !== store.get('currentSlug')) switchProject(entry.key);
276
- }
214
+ if (entry.key !== store.get('currentSlug')) switchProject(entry.key);
277
215
  }
278
216
 
279
217
  function cycle(delta) {
@@ -14,6 +14,29 @@ var navItems = null;
14
14
  var sections = null;
15
15
  var statsTimer = null;
16
16
 
17
+ // Section data for command palette
18
+ var SETTINGS_SECTIONS = [
19
+ { section: 'overview', label: 'Status', group: 'General', icon: 'shield', danger: false },
20
+ { section: 'notifications', label: 'Notifications', group: 'General', icon: 'bell', danger: false },
21
+ { section: 'security', label: 'Security', group: 'General', icon: 'lock', danger: false },
22
+ { section: 'models', label: 'Model', group: 'Defaults', icon: 'cpu', danger: false },
23
+ { section: 'claudemd', label: 'Instructions', group: 'Config', icon: 'file-text', danger: false },
24
+ { section: 'environment', label: 'Environment', group: 'Config', icon: 'terminal', danger: false },
25
+ { section: 'storage', label: 'Storage', group: 'Config', icon: 'database', danger: false },
26
+ { section: 'admin-users', label: 'Users', group: 'Admin', icon: 'users', danger: false, adminOnly: true },
27
+ { section: 'admin-invites', label: 'Invites', group: 'Admin', icon: 'mail', danger: false, adminOnly: true },
28
+ { section: 'admin-projects', label: 'Projects', group: 'Admin', icon: 'folder', danger: false, adminOnly: true },
29
+ { section: 'admin-smtp', label: 'Email', group: 'Server', icon: 'send', danger: false, adminOnly: true },
30
+ { section: 'keep-awake', label: 'Keep Awake', group: 'Server', icon: 'zap', danger: false, conditionalId: 'settings-keep-awake-nav' },
31
+ { section: 'restart', label: 'Restart', group: 'Server', icon: 'refresh-cw', danger: false },
32
+ { section: 'shutdown', label: 'Shutdown', group: 'Server', icon: 'power', danger: true },
33
+ ];
34
+
35
+ var currentSection = 'overview';
36
+ var paletteOpen = false;
37
+ var paletteHighlight = -1;
38
+ var isAdminUser = false;
39
+
17
40
  export function initServerSettings(appCtx) {
18
41
  ctx = appCtx;
19
42
  settingsEl = document.getElementById("server-settings");
@@ -38,7 +61,25 @@ export function initServerSettings(appCtx) {
38
61
  // ESC to close
39
62
  document.addEventListener("keydown", function (e) {
40
63
  if (e.key === "Escape" && !settingsEl.classList.contains("hidden")) {
41
- closeSettings();
64
+ if (paletteOpen) {
65
+ closeSettingsPalette();
66
+ } else {
67
+ closeSettings();
68
+ }
69
+ }
70
+ });
71
+
72
+ // Global keyboard: Cmd+K / Ctrl+K inside settings, Esc to close palette
73
+ document.addEventListener("keydown", function (e) {
74
+ if (settingsEl && !settingsEl.classList.contains("hidden")) {
75
+ if ((e.metaKey || e.ctrlKey) && e.key === "k") {
76
+ e.preventDefault();
77
+ if (paletteOpen) {
78
+ closeSettingsPalette();
79
+ } else {
80
+ openSettingsPalette();
81
+ }
82
+ }
42
83
  }
43
84
  });
44
85
 
@@ -50,11 +91,33 @@ export function initServerSettings(appCtx) {
50
91
  });
51
92
  }
52
93
 
53
- // Mobile dropdown nav
54
- var navDropdown = document.getElementById("settings-nav-dropdown");
55
- if (navDropdown) {
56
- navDropdown.addEventListener("change", function () {
57
- switchSection(this.value);
94
+ // Mobile command palette pill
95
+ var navPill = document.getElementById("settings-nav-pill");
96
+ if (navPill) {
97
+ navPill.addEventListener("click", function () {
98
+ openSettingsPalette();
99
+ });
100
+ }
101
+
102
+ // Palette backdrop click to close
103
+ var paletteEl = document.getElementById("settings-palette");
104
+ if (paletteEl) {
105
+ var backdrop = paletteEl.querySelector(".settings-palette-backdrop");
106
+ if (backdrop) {
107
+ backdrop.addEventListener("click", function () {
108
+ closeSettingsPalette();
109
+ });
110
+ }
111
+ }
112
+
113
+ // Palette input events
114
+ var paletteInput = document.getElementById("settings-palette-input");
115
+ if (paletteInput) {
116
+ paletteInput.addEventListener("input", function () {
117
+ renderPaletteResults(this.value);
118
+ });
119
+ paletteInput.addEventListener("keydown", function (e) {
120
+ handlePaletteKey(e);
58
121
  });
59
122
  }
60
123
 
@@ -227,16 +290,175 @@ export function initServerSettings(appCtx) {
227
290
  }
228
291
  }
229
292
 
293
+ function openSettingsPalette() {
294
+ var paletteEl = document.getElementById("settings-palette");
295
+ var paletteInput = document.getElementById("settings-palette-input");
296
+ var pill = document.getElementById("settings-nav-pill");
297
+ if (!paletteEl) return;
298
+ paletteEl.classList.remove("hidden");
299
+ paletteOpen = true;
300
+ paletteHighlight = -1;
301
+ if (pill) pill.setAttribute("aria-expanded", "true");
302
+ renderPaletteResults("");
303
+ if (paletteInput) {
304
+ paletteInput.value = "";
305
+ // Only autofocus on non-touch devices — on mobile, focus triggers the soft keyboard
306
+ // which pushes the viewport and obscures the palette
307
+ if (window.matchMedia("(pointer: fine)").matches) {
308
+ paletteInput.focus();
309
+ }
310
+ }
311
+ // Prevent body scroll on iOS
312
+ document.body.style.overflow = "hidden";
313
+ refreshIcons(paletteEl);
314
+ }
315
+
316
+ function closeSettingsPalette() {
317
+ var paletteEl = document.getElementById("settings-palette");
318
+ var pill = document.getElementById("settings-nav-pill");
319
+ if (!paletteEl) return;
320
+ paletteEl.classList.add("hidden");
321
+ paletteOpen = false;
322
+ if (pill) {
323
+ pill.setAttribute("aria-expanded", "false");
324
+ if (window.matchMedia("(pointer: fine)").matches) {
325
+ pill.focus();
326
+ }
327
+ }
328
+ document.body.style.overflow = "";
329
+ }
330
+
331
+ function getVisibleSections() {
332
+ var result = [];
333
+ for (var i = 0; i < SETTINGS_SECTIONS.length; i++) {
334
+ var s = SETTINGS_SECTIONS[i];
335
+ // Skip admin-only if not admin
336
+ if (s.adminOnly && !isAdminUser) continue;
337
+ // Skip conditional sections that are hidden
338
+ if (s.conditionalId) {
339
+ var el = document.getElementById(s.conditionalId);
340
+ if (!el || el.classList.contains("hidden")) continue;
341
+ }
342
+ result.push(s);
343
+ }
344
+ return result;
345
+ }
346
+
347
+ function renderPaletteResults(query) {
348
+ var resultsEl = document.getElementById("settings-palette-results");
349
+ if (!resultsEl) return;
350
+ var q = query.toLowerCase();
351
+ var visible = getVisibleSections();
352
+ var filtered = [];
353
+ for (var i = 0; i < visible.length; i++) {
354
+ var s = visible[i];
355
+ if (!q || s.label.toLowerCase().indexOf(q) !== -1 || s.group.toLowerCase().indexOf(q) !== -1) {
356
+ filtered.push(s);
357
+ }
358
+ }
359
+ if (filtered.length === 0) {
360
+ resultsEl.innerHTML = '<div class="settings-palette-empty">No matches for "' + escapeHtmlPalette(query) + '"</div>';
361
+ paletteHighlight = -1;
362
+ return;
363
+ }
364
+ // Group results
365
+ var groups = {};
366
+ var groupOrder = [];
367
+ for (var j = 0; j < filtered.length; j++) {
368
+ var g = filtered[j].group;
369
+ if (!groups[g]) { groups[g] = []; groupOrder.push(g); }
370
+ groups[g].push(filtered[j]);
371
+ }
372
+ var html = "";
373
+ var itemIndex = 0;
374
+ for (var gi = 0; gi < groupOrder.length; gi++) {
375
+ var gName = groupOrder[gi];
376
+ html += '<div class="settings-palette-group-header">' + escapeHtmlPalette(gName) + '</div>';
377
+ var items = groups[gName];
378
+ for (var ii = 0; ii < items.length; ii++) {
379
+ var item = items[ii];
380
+ var isCurrent = item.section === currentSection;
381
+ var cls = "settings-palette-item";
382
+ if (isCurrent) cls += " current";
383
+ if (item.danger) cls += " danger";
384
+ if (itemIndex === paletteHighlight) cls += " highlighted";
385
+ html += '<button class="' + cls + '" data-section="' + item.section + '" data-index="' + itemIndex + '">' +
386
+ '<i data-lucide="' + item.icon + '" class="settings-palette-item-icon"></i>' +
387
+ '<span class="settings-palette-item-label">' + escapeHtmlPalette(item.label) + '</span>' +
388
+ (isCurrent ? '<i data-lucide="check" class="settings-palette-item-check"></i>' : '') +
389
+ '</button>';
390
+ itemIndex++;
391
+ }
392
+ }
393
+ resultsEl.innerHTML = html;
394
+ refreshIcons(resultsEl);
395
+ // Bind clicks
396
+ var buttons = resultsEl.querySelectorAll(".settings-palette-item");
397
+ for (var bi = 0; bi < buttons.length; bi++) {
398
+ buttons[bi].addEventListener("click", function () {
399
+ var sec = this.dataset.section;
400
+ closeSettingsPalette();
401
+ switchSection(sec);
402
+ });
403
+ }
404
+ paletteHighlight = -1;
405
+ }
406
+
407
+ function handlePaletteKey(e) {
408
+ var resultsEl = document.getElementById("settings-palette-results");
409
+ if (!resultsEl) return;
410
+ var buttons = resultsEl.querySelectorAll(".settings-palette-item");
411
+ if (e.key === "ArrowDown" || (e.key === "Tab" && !e.shiftKey)) {
412
+ e.preventDefault();
413
+ paletteHighlight = Math.min(paletteHighlight + 1, buttons.length - 1);
414
+ updatePaletteHighlight(buttons);
415
+ } else if (e.key === "ArrowUp" || (e.key === "Tab" && e.shiftKey)) {
416
+ e.preventDefault();
417
+ paletteHighlight = Math.max(paletteHighlight - 1, 0);
418
+ updatePaletteHighlight(buttons);
419
+ } else if (e.key === "Enter") {
420
+ if (paletteHighlight >= 0 && paletteHighlight < buttons.length) {
421
+ var sec = buttons[paletteHighlight].dataset.section;
422
+ closeSettingsPalette();
423
+ switchSection(sec);
424
+ }
425
+ }
426
+ }
427
+
428
+ function updatePaletteHighlight(buttons) {
429
+ for (var i = 0; i < buttons.length; i++) {
430
+ buttons[i].classList.toggle("highlighted", i === paletteHighlight);
431
+ if (i === paletteHighlight) {
432
+ buttons[i].scrollIntoView({ block: "nearest" });
433
+ }
434
+ }
435
+ }
436
+
437
+ function escapeHtmlPalette(str) {
438
+ return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
439
+ }
440
+
441
+ function updateNavPill(sectionName) {
442
+ var pill = document.getElementById("settings-nav-pill");
443
+ if (!pill) return;
444
+ var groupEl = document.getElementById("settings-nav-pill-group");
445
+ var labelEl = document.getElementById("settings-nav-pill-label");
446
+ for (var i = 0; i < SETTINGS_SECTIONS.length; i++) {
447
+ if (SETTINGS_SECTIONS[i].section === sectionName) {
448
+ if (groupEl) groupEl.textContent = SETTINGS_SECTIONS[i].group;
449
+ if (labelEl) labelEl.textContent = SETTINGS_SECTIONS[i].label;
450
+ break;
451
+ }
452
+ }
453
+ }
454
+
230
455
  function switchSection(sectionName) {
456
+ currentSection = sectionName;
457
+ updateNavPill(sectionName);
231
458
  for (var i = 0; i < navItems.length; i++) {
232
459
  var isActive = navItems[i].dataset.section === sectionName;
233
460
  navItems[i].classList.toggle("active", isActive);
234
461
  }
235
- // Sync mobile dropdown
236
- var navDropdown = document.getElementById("settings-nav-dropdown");
237
- if (navDropdown && navDropdown.value !== sectionName) {
238
- navDropdown.value = sectionName;
239
- }
240
462
  for (var j = 0; j < sections.length; j++) {
241
463
  var isActive2 = sections[j].dataset.section === sectionName;
242
464
  sections[j].classList.toggle("active", isActive2);
@@ -263,6 +485,7 @@ function openSettings() {
263
485
 
264
486
  // Show/hide admin sections based on role
265
487
  checkAdminAccess().then(function (isAdmin) {
488
+ isAdminUser = isAdmin;
266
489
  var adminEls = settingsEl.querySelectorAll(".settings-admin-only");
267
490
  for (var ai = 0; ai < adminEls.length; ai++) {
268
491
  adminEls[ai].style.display = isAdmin ? "" : "none";
@@ -454,3 +454,4 @@ function goToPrevMatch() {
454
454
  }
455
455
 
456
456
  export { initSessionSearch, openSearch, closeSearch, toggleSearch, isSearchOpen, handleFindInSessionResults, onHistoryPrepended };
457
+
@@ -1008,7 +1008,6 @@ function renderSheetMateProfile(listEl) {
1008
1008
 
1009
1009
  // Action buttons
1010
1010
  var actions = [
1011
- { icon: "sticky-note", label: "Sticky Notes", btnId: "sticky-notes-sidebar-btn", countId: "sticky-notes-sidebar-count" },
1012
1011
  { icon: "puzzle", label: "Skills", btnId: "skills-btn" },
1013
1012
  { icon: "calendar", label: "Scheduled Tasks", btnId: "scheduler-btn" }
1014
1013
  ];
@@ -355,6 +355,24 @@ function showIconCtxMenu(anchorEl, slug, name) {
355
355
  showWorktreeModal(slug, name || slug);
356
356
  });
357
357
  menu.appendChild(wtItem);
358
+
359
+ if (!store.get('permissions') || store.get('permissions').deleteProject !== false) {
360
+ var sep = document.createElement("div");
361
+ sep.className = "project-ctx-separator";
362
+ menu.appendChild(sep);
363
+
364
+ var deleteItem = document.createElement("button");
365
+ deleteItem.className = "project-ctx-item project-ctx-delete";
366
+ deleteItem.innerHTML = iconHtml("trash-2") + " <span>Remove Project</span>";
367
+ deleteItem.addEventListener("click", function (e) {
368
+ e.stopPropagation();
369
+ closeProjectCtxMenu();
370
+ if (getWs() && store.get('connected')) {
371
+ getWs().send(JSON.stringify({ type: "remove_project_check", slug: slug, name: name || slug }));
372
+ }
373
+ });
374
+ menu.appendChild(deleteItem);
375
+ }
358
376
  }
359
377
 
360
378
  document.body.appendChild(menu);
@@ -2020,3 +2038,4 @@ export function updateProjectBadge(slug, count) {
2020
2038
  badge.classList.remove("has-unread");
2021
2039
  }
2022
2040
  }
2041
+
@@ -1546,3 +1546,4 @@ export function populateCliSessionList(sessions) {
1546
1546
  pickerList.appendChild(item);
1547
1547
  }
1548
1548
  }
1549
+
@@ -1,6 +1,6 @@
1
1
  // sidebar-users.js - Human user strip, DM picker, context menus, tooltips, presence
2
- // Replacement for sidebar-mates.js after mates removal (lr-316f).
3
- // Contains only human-user functionality; all mate-specific rendering is gone.
2
+ // Human-user sidebar (replaces former mates sidebar after lr-316f removal).
3
+ // Contains only human-user functionality; all mate-specific rendering is removed.
4
4
 
5
5
  import { userAvatarUrl } from './avatar.js';
6
6
  import { escapeHtml } from './utils.js';
@@ -42,7 +42,7 @@ var userCtxMenu = null;
42
42
 
43
43
  export function initSidebarUsers() {
44
44
  // Reactive UI sync for user strip
45
- store.subscribe(function (state, prev) {
45
+ store.subscribe(['cachedAllUsers', 'cachedOnlineIds', 'cachedDmFavorites', 'cachedDmConversations', 'dmUnread', 'dmRemovedUsers', 'myUserId'], function (state, prev) {
46
46
  if (state.cachedAllUsers !== prev.cachedAllUsers ||
47
47
  state.cachedOnlineIds !== prev.cachedOnlineIds ||
48
48
  state.cachedDmFavorites !== prev.cachedDmFavorites ||
@@ -18,15 +18,37 @@ var store = {
18
18
  set: function (partial) {
19
19
  var prev = _state;
20
20
  _state = Object.assign({}, _state, partial);
21
- for (var i = 0; i < _listeners.length; i++) _listeners[i](_state, prev);
21
+ for (var i = 0; i < _listeners.length; i++) {
22
+ var entry = _listeners[i];
23
+ if (entry.keys) {
24
+ // Key-filtered subscriber: only fire if one of its declared keys changed
25
+ var changed = false;
26
+ for (var k = 0; k < entry.keys.length; k++) {
27
+ if (_state[entry.keys[k]] !== prev[entry.keys[k]]) { changed = true; break; }
28
+ }
29
+ if (!changed) continue;
30
+ }
31
+ entry.fn(_state, prev);
32
+ }
22
33
  },
23
34
  // Keep legacy aliases for gradual migration
24
35
  getState: function () { return _state; },
25
36
  setState: function (partial) { store.set(partial); },
26
- subscribe: function (listener) {
27
- _listeners.push(listener);
37
+ // subscribe(cb) — fires on every store.set (legacy, unfiltered)
38
+ // subscribe(keys, cb) — fires only when one of the listed keys changes
39
+ subscribe: function (keysOrFn, maybeFn) {
40
+ var keys = null;
41
+ var fn;
42
+ if (typeof keysOrFn === 'function') {
43
+ fn = keysOrFn;
44
+ } else {
45
+ keys = keysOrFn;
46
+ fn = maybeFn;
47
+ }
48
+ var entry = { keys: keys, fn: fn };
49
+ _listeners.push(entry);
28
50
  return function () {
29
- _listeners = _listeners.filter(function (l) { return l !== listener; });
51
+ _listeners = _listeners.filter(function (l) { return l !== entry; });
30
52
  };
31
53
  }
32
54
  };