@clagentic/console 1.5.0-beta.3 → 1.5.0-beta.4
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.
- package/README.md +18 -14
- package/lib/cli-sessions.js +71 -18
- package/lib/daemon.js +72 -24
- package/lib/pages.js +1 -42
- package/lib/project-connection.js +4 -8
- package/lib/project-loop.js +1 -1
- package/lib/project-notifications.js +3 -18
- package/lib/project-sessions.js +19 -26
- package/lib/project-user-message.js +5 -10
- package/lib/project.js +39 -52
- package/lib/public/app.js +5 -15
- package/lib/public/modules/admin.js +1 -52
- package/lib/public/modules/agent-picker.js +11 -3
- package/lib/public/modules/app-cursors.js +43 -47
- package/lib/public/modules/app-messages.js +5 -12
- package/lib/public/modules/app-rendering.js +1 -2
- package/lib/public/modules/sidebar-projects.js +1 -1
- package/lib/public/modules/sidebar-sessions.js +2 -2
- package/lib/public/modules/sidebar-users.js +2 -12
- package/lib/public/modules/user-settings.js +0 -3
- package/lib/sdk-bridge.js +47 -7
- package/lib/sdk-message-processor.js +3 -4
- package/lib/server-admin.js +1 -86
- package/lib/server-auth.js +13 -124
- package/lib/server-dm.js +2 -7
- package/lib/server-palette.js +9 -20
- package/lib/server-settings.js +41 -243
- package/lib/server-skills.js +11 -13
- package/lib/server.js +25 -60
- package/lib/sessions.js +16 -50
- package/lib/terminal-manager.js +13 -15
- package/lib/users-auth.js +0 -38
- package/lib/users.js +14 -11
- package/lib/yoke/adapters/claude.js +5 -0
- package/package.json +1 -1
package/lib/project.js
CHANGED
|
@@ -160,7 +160,7 @@ function createProjectContext(opts) {
|
|
|
160
160
|
// We hard-disable it when multi-user mode is active so the per-user permission
|
|
161
161
|
// model remains intact. Admins who want bypassPermissions must do so per-session.
|
|
162
162
|
var dangerouslySkipPermissionsConfigured = opts.dangerouslySkipPermissions || false;
|
|
163
|
-
var dangerouslySkipPermissions =
|
|
163
|
+
var dangerouslySkipPermissions = false;
|
|
164
164
|
var currentVersion = opts.currentVersion;
|
|
165
165
|
var lanHost = opts.lanHost || null;
|
|
166
166
|
var getProjectCount = opts.getProjectCount || function () { return 1; };
|
|
@@ -342,26 +342,24 @@ function createProjectContext(opts) {
|
|
|
342
342
|
|
|
343
343
|
function broadcastClientCount() {
|
|
344
344
|
var msg = { type: "client_count", count: clients.size };
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
msg.users = userList;
|
|
345
|
+
var seen = {};
|
|
346
|
+
var userList = [];
|
|
347
|
+
for (var c of clients) {
|
|
348
|
+
if (!c._clayUser) continue;
|
|
349
|
+
var u = c._clayUser;
|
|
350
|
+
if (seen[u.id]) continue;
|
|
351
|
+
seen[u.id] = true;
|
|
352
|
+
var p = u.profile || {};
|
|
353
|
+
userList.push({
|
|
354
|
+
id: u.id,
|
|
355
|
+
displayName: p.name || u.displayName || u.username,
|
|
356
|
+
username: u.username,
|
|
357
|
+
avatarStyle: p.avatarStyle || "thumbs",
|
|
358
|
+
avatarSeed: p.avatarSeed || u.username,
|
|
359
|
+
avatarCustom: p.avatarCustom || "",
|
|
360
|
+
});
|
|
364
361
|
}
|
|
362
|
+
msg.users = userList;
|
|
365
363
|
send(msg);
|
|
366
364
|
onPresenceChange();
|
|
367
365
|
}
|
|
@@ -422,7 +420,7 @@ function createProjectContext(opts) {
|
|
|
422
420
|
for (var ws of clients) {
|
|
423
421
|
var user = ws._clayUser;
|
|
424
422
|
var filterFn = null;
|
|
425
|
-
if (
|
|
423
|
+
if (user) {
|
|
426
424
|
filterFn = (function (u) {
|
|
427
425
|
return function (s) {
|
|
428
426
|
return usersModule.canAccessSession(u.id, s, { visibility: "public" });
|
|
@@ -583,15 +581,9 @@ function createProjectContext(opts) {
|
|
|
583
581
|
scheduleMessage(session, text, resetsAt);
|
|
584
582
|
},
|
|
585
583
|
getAutoContinueSetting: function (session) {
|
|
586
|
-
|
|
587
|
-
if (usersModule.isMultiUser() && session && session.ownerId) {
|
|
584
|
+
if (session && session.ownerId) {
|
|
588
585
|
return usersModule.getAutoContinue(session.ownerId);
|
|
589
586
|
}
|
|
590
|
-
// Single-user: fall back to daemon config
|
|
591
|
-
if (typeof opts.onGetDaemonConfig === "function") {
|
|
592
|
-
var dc = opts.onGetDaemonConfig();
|
|
593
|
-
return !!dc.autoContinueOnRateLimit;
|
|
594
|
-
}
|
|
595
587
|
return false;
|
|
596
588
|
},
|
|
597
589
|
// lr-2d91: Live config callback so sdk-bridge reads the current threshold on
|
|
@@ -634,8 +626,6 @@ function createProjectContext(opts) {
|
|
|
634
626
|
|
|
635
627
|
// --- Terminal manager ---
|
|
636
628
|
// broadcastTermList sends each connected client only the terminals they own.
|
|
637
|
-
// In single-user mode the terminal manager falls back to the bare send() broadcast,
|
|
638
|
-
// so this closure is only exercised when isMultiUser() is true at startup.
|
|
639
629
|
var tm;
|
|
640
630
|
function broadcastTermListToAll() {
|
|
641
631
|
for (var bws of clients) {
|
|
@@ -648,8 +638,8 @@ function createProjectContext(opts) {
|
|
|
648
638
|
cwd: cwd,
|
|
649
639
|
send: send,
|
|
650
640
|
sendTo: sendTo,
|
|
651
|
-
isMultiUser:
|
|
652
|
-
broadcastTermList:
|
|
641
|
+
isMultiUser: true,
|
|
642
|
+
broadcastTermList: broadcastTermListToAll,
|
|
653
643
|
});
|
|
654
644
|
var nm = createNotesManager({ cwd: cwd, send: send, sendTo: sendTo });
|
|
655
645
|
|
|
@@ -873,7 +863,6 @@ function createProjectContext(opts) {
|
|
|
873
863
|
|
|
874
864
|
// --- Session presence (who is viewing which session) ---
|
|
875
865
|
function broadcastPresence() {
|
|
876
|
-
if (!usersModule.isMultiUser()) return;
|
|
877
866
|
var presence = {};
|
|
878
867
|
for (var c of clients) {
|
|
879
868
|
if (!c._clayUser || !c._clayActiveSession) continue;
|
|
@@ -1279,26 +1268,24 @@ function createProjectContext(opts) {
|
|
|
1279
1268
|
status.branch = worktreeMeta.branch;
|
|
1280
1269
|
status.worktreeAccessible = worktreeMeta.accessible;
|
|
1281
1270
|
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
});
|
|
1299
|
-
}
|
|
1300
|
-
status.onlineUsers = onlineUsers;
|
|
1271
|
+
var seen = {};
|
|
1272
|
+
var onlineUsers = [];
|
|
1273
|
+
for (var c of clients) {
|
|
1274
|
+
if (!c._clayUser) continue;
|
|
1275
|
+
var u = c._clayUser;
|
|
1276
|
+
if (seen[u.id]) continue;
|
|
1277
|
+
seen[u.id] = true;
|
|
1278
|
+
var p = u.profile || {};
|
|
1279
|
+
onlineUsers.push({
|
|
1280
|
+
id: u.id,
|
|
1281
|
+
displayName: p.name || u.displayName || u.username,
|
|
1282
|
+
username: u.username,
|
|
1283
|
+
avatarStyle: p.avatarStyle || "thumbs",
|
|
1284
|
+
avatarSeed: p.avatarSeed || u.username,
|
|
1285
|
+
avatarCustom: p.avatarCustom || "",
|
|
1286
|
+
});
|
|
1301
1287
|
}
|
|
1288
|
+
status.onlineUsers = onlineUsers;
|
|
1302
1289
|
return status;
|
|
1303
1290
|
}
|
|
1304
1291
|
|
package/lib/public/app.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
renderIconStrip, updateProjectBadge
|
|
12
12
|
} from './modules/sidebar-projects.js';
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
closeDmUserPicker, setCurrentDmUser,
|
|
15
15
|
updateDmBadge, renderSidebarPresence, setMentionActive, clearAllMentionActive,
|
|
16
16
|
initSidebarUsers
|
|
17
17
|
} from './modules/sidebar-users.js';
|
|
@@ -269,7 +269,7 @@ import { initTeamPanel } from './modules/team-panel.js';
|
|
|
269
269
|
cachedDmFavorites: [],
|
|
270
270
|
pendingTermCommand: null,
|
|
271
271
|
myUserId: null,
|
|
272
|
-
isMultiUserMode:
|
|
272
|
+
isMultiUserMode: true,
|
|
273
273
|
dmUnread: {},
|
|
274
274
|
dmRemovedUsers: {},
|
|
275
275
|
cachedAllUsers: [],
|
|
@@ -745,21 +745,11 @@ import { initTeamPanel } from './modules/team-panel.js';
|
|
|
745
745
|
get projectList() { return getCachedProjects(); },
|
|
746
746
|
});
|
|
747
747
|
fetch("/api/me").then(function (r) { return r.json(); }).then(function (d) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
if (document.body) document.body.classList.add('is-multi-user');
|
|
751
|
-
}
|
|
748
|
+
store.set({ isMultiUserMode: true });
|
|
749
|
+
if (document.body) document.body.classList.add('is-multi-user');
|
|
752
750
|
if (d.user && d.user.id) { store.set({ myUserId: d.user.id }); }
|
|
753
751
|
if (d.permissions) store.set({ permissions: d.permissions });
|
|
754
752
|
if (d.mustChangePin) showForceChangePinOverlay();
|
|
755
|
-
// Single-user mode: clear user strip skeletons immediately (no presence message will arrive)
|
|
756
|
-
if (!store.get('isMultiUserMode')) {
|
|
757
|
-
var usersContainer = document.getElementById("icon-strip-users");
|
|
758
|
-
if (usersContainer) {
|
|
759
|
-
usersContainer.innerHTML = "";
|
|
760
|
-
usersContainer.classList.add("hidden");
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
753
|
initCursorToggle();
|
|
764
754
|
// Apply RBAC UI gating
|
|
765
755
|
var _perms = store.get('permissions');
|
|
@@ -790,7 +780,7 @@ import { initTeamPanel } from './modules/team-panel.js';
|
|
|
790
780
|
}).catch(function () {});
|
|
791
781
|
// Hide server settings and update controls for non-admin users in multi-user mode
|
|
792
782
|
checkAdminAccess().then(function (isAdmin) {
|
|
793
|
-
if (
|
|
783
|
+
if (!isAdmin) {
|
|
794
784
|
var settingsBtn = document.getElementById("server-settings-btn");
|
|
795
785
|
if (settingsBtn) settingsBtn.style.display = "none";
|
|
796
786
|
var updatePill = document.getElementById("update-pill-wrap");
|
|
@@ -85,7 +85,7 @@ export function initAdmin(appCtx) {
|
|
|
85
85
|
export function checkAdminAccess() {
|
|
86
86
|
return apiGet("/api/me").then(function (data) {
|
|
87
87
|
meInfo = data;
|
|
88
|
-
return data.
|
|
88
|
+
return data.user && data.user.role === "admin";
|
|
89
89
|
}).catch(function () { return false; });
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -103,39 +103,6 @@ export function loadAdminSection(section, body) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
}
|
|
106
|
-
// --- Migration from single-user to multi-user ---
|
|
107
|
-
function enableMultiUserMode() {
|
|
108
|
-
var modal = document.createElement("div");
|
|
109
|
-
modal.className = "admin-modal-overlay";
|
|
110
|
-
modal.innerHTML = '<div class="admin-modal">' +
|
|
111
|
-
'<div class="admin-modal-body" style="padding:20px 16px 16px">' +
|
|
112
|
-
'<p class="admin-modal-desc" style="margin:0;font-size:14px;color:var(--text)">Enable multi-user mode? You will be directed to set up the admin account. Your current PIN will become the admin PIN.</p>' +
|
|
113
|
-
'</div>' +
|
|
114
|
-
'<div class="admin-modal-footer">' +
|
|
115
|
-
'<button class="admin-modal-save" id="confirm-enable-multiuser">Enable</button>' +
|
|
116
|
-
'<button class="admin-modal-cancel">Cancel</button>' +
|
|
117
|
-
'</div></div>';
|
|
118
|
-
document.body.appendChild(modal);
|
|
119
|
-
refreshIcons(modal);
|
|
120
|
-
modal.querySelector(".admin-modal-cancel").addEventListener("click", function () { modal.remove(); });
|
|
121
|
-
modal.addEventListener("click", function (e) { if (e.target === modal) modal.remove(); });
|
|
122
|
-
modal.querySelector("#confirm-enable-multiuser").addEventListener("click", function () {
|
|
123
|
-
modal.remove();
|
|
124
|
-
apiPost("/api/settings/enable-multiuser").then(function (data) {
|
|
125
|
-
if (data.ok && data.setupCode) {
|
|
126
|
-
showToast("Multi-user mode enabled. Redirecting to setup...");
|
|
127
|
-
setTimeout(function () {
|
|
128
|
-
window.location.href = "/auth?setupCode=" + encodeURIComponent(data.setupCode);
|
|
129
|
-
}, 500);
|
|
130
|
-
} else {
|
|
131
|
-
showToast(data.error || "Failed to enable multi-user mode");
|
|
132
|
-
}
|
|
133
|
-
}).catch(function () {
|
|
134
|
-
showToast("Failed to enable multi-user mode");
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
106
|
// --- Users ---
|
|
140
107
|
function loadUsersTab(body) {
|
|
141
108
|
apiGet("/api/admin/users").then(function (data) {
|
|
@@ -148,16 +115,6 @@ function loadUsersTab(body) {
|
|
|
148
115
|
|
|
149
116
|
function renderUsersTab(body) {
|
|
150
117
|
var html = '';
|
|
151
|
-
|
|
152
|
-
// Show migration callout if single-user mode with PIN is active
|
|
153
|
-
if (meInfo && meInfo.singleUserMigrationAvailable && !meInfo.multiUser) {
|
|
154
|
-
html += '<div class="migration-callout">' +
|
|
155
|
-
'<strong>Migrate to multi-user mode</strong>' +
|
|
156
|
-
'<p>You\'re currently using single-user PIN mode. Multi-user mode lets you create named accounts with better security. Your existing PIN will continue to work during transition.</p>' +
|
|
157
|
-
'<button id="migrate-to-multiuser-btn" class="admin-action-btn">Set up multi-user mode</button>' +
|
|
158
|
-
'</div>';
|
|
159
|
-
}
|
|
160
|
-
|
|
161
118
|
html += '<div class="admin-section-header">' +
|
|
162
119
|
'<div class="admin-header-btns">' +
|
|
163
120
|
'<button class="admin-action-btn" id="admin-add-user">' + iconHtml("user-plus") + ' Add User</button>' +
|
|
@@ -194,14 +151,6 @@ function renderUsersTab(body) {
|
|
|
194
151
|
body.innerHTML = html;
|
|
195
152
|
refreshIcons(body);
|
|
196
153
|
|
|
197
|
-
// Bind migration button
|
|
198
|
-
var migrateBtn = body.querySelector("#migrate-to-multiuser-btn");
|
|
199
|
-
if (migrateBtn) {
|
|
200
|
-
migrateBtn.addEventListener("click", function () {
|
|
201
|
-
enableMultiUserMode();
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
154
|
// Bind add user button
|
|
206
155
|
var addUserBtn = body.querySelector("#admin-add-user");
|
|
207
156
|
if (addUserBtn) {
|
|
@@ -30,6 +30,7 @@ var allAgents = [];
|
|
|
30
30
|
var favorites = [];
|
|
31
31
|
var recents = [];
|
|
32
32
|
var activeTab = "favorites"; // "favorites" | "all"
|
|
33
|
+
var _catalogReceived = false; // true once at least one agents_list response has arrived
|
|
33
34
|
|
|
34
35
|
// Identity match: name is the sole key (lr-8e39, flat SDK catalog).
|
|
35
36
|
function sameAgent(a, b) {
|
|
@@ -58,6 +59,7 @@ export function openAgentPicker() {
|
|
|
58
59
|
// the surface from flickering open).
|
|
59
60
|
if (store.get('dmMode')) return;
|
|
60
61
|
_preferredTargetSlug = null;
|
|
62
|
+
_catalogReceived = false;
|
|
61
63
|
paletteEl.classList.remove("hidden");
|
|
62
64
|
inputEl.value = "";
|
|
63
65
|
activeIndex = -1;
|
|
@@ -79,6 +81,7 @@ export function openAgentPicker() {
|
|
|
79
81
|
export function openAgentPickerForPreferred(slug) {
|
|
80
82
|
if (!paletteEl || !slug) return;
|
|
81
83
|
_preferredTargetSlug = slug;
|
|
84
|
+
_catalogReceived = false;
|
|
82
85
|
paletteEl.classList.remove("hidden");
|
|
83
86
|
inputEl.value = "";
|
|
84
87
|
activeIndex = -1;
|
|
@@ -124,6 +127,7 @@ export function handleAgentsList(msg) {
|
|
|
124
127
|
allAgents = Array.isArray(msg.agents) ? msg.agents : [];
|
|
125
128
|
favorites = Array.isArray(msg.favorites) ? msg.favorites : [];
|
|
126
129
|
recents = Array.isArray(msg.recents) ? msg.recents : [];
|
|
130
|
+
_catalogReceived = true;
|
|
127
131
|
if (isAgentPickerOpen()) {
|
|
128
132
|
render();
|
|
129
133
|
}
|
|
@@ -295,9 +299,13 @@ function render() {
|
|
|
295
299
|
}
|
|
296
300
|
|
|
297
301
|
if (items.length === 0 && !html) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
302
|
+
if (!_catalogReceived) {
|
|
303
|
+
html = '<div class="cmd-palette-loading">Loading agents…</div>';
|
|
304
|
+
} else {
|
|
305
|
+
html = '<div class="agent-picker-empty">' +
|
|
306
|
+
(f ? 'No agents match "' + escapeHtml(f) + '".' : 'No agents discovered.') +
|
|
307
|
+
'</div>';
|
|
308
|
+
}
|
|
301
309
|
}
|
|
302
310
|
|
|
303
311
|
resultsEl.innerHTML = html;
|
|
@@ -200,7 +200,6 @@ function findClosestTurn(clientY) {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
function hasOtherSessionViewers() {
|
|
203
|
-
if (!store.get('isMultiUserMode')) return false;
|
|
204
203
|
var sessionId = store.get('activeSessionId');
|
|
205
204
|
if (!sessionId) return false;
|
|
206
205
|
var viewers = getSessionPresenceUsers(sessionId);
|
|
@@ -216,9 +215,8 @@ function shouldBroadcastCollab() {
|
|
|
216
215
|
return cursorSharingEnabled && hasOtherSessionViewers();
|
|
217
216
|
}
|
|
218
217
|
|
|
219
|
-
// Cursor sharing toggle button in user island
|
|
218
|
+
// Cursor sharing toggle button in user island
|
|
220
219
|
export function initCursorToggle() {
|
|
221
|
-
if (!store.get('isMultiUserMode')) return;
|
|
222
220
|
var actionsEl = document.querySelector(".user-island-actions");
|
|
223
221
|
if (!actionsEl) return;
|
|
224
222
|
if (document.getElementById("cursor-share-toggle")) return;
|
|
@@ -443,52 +441,50 @@ export function initCursors() {
|
|
|
443
441
|
});
|
|
444
442
|
|
|
445
443
|
// Track local text selection and send to server
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
sendWsQuiet({ type: "text_select", ranges: [] });
|
|
463
|
-
}
|
|
464
|
-
return;
|
|
444
|
+
document.addEventListener("selectionchange", function () {
|
|
445
|
+
if (!shouldBroadcastCollab()) return;
|
|
446
|
+
var ws = getWs();
|
|
447
|
+
if (!ws || ws.readyState !== 1) return;
|
|
448
|
+
if (selectionThrottleTimer) return;
|
|
449
|
+
selectionThrottleTimer = setTimeout(function () { selectionThrottleTimer = null; }, 100);
|
|
450
|
+
|
|
451
|
+
var activeEl = document.activeElement;
|
|
452
|
+
if (activeEl && activeEl.id === "input" && lastSelectionKey === "") return;
|
|
453
|
+
|
|
454
|
+
var sel = window.getSelection();
|
|
455
|
+
if (!sel || sel.rangeCount === 0 || sel.isCollapsed) {
|
|
456
|
+
// Selection cleared
|
|
457
|
+
if (lastSelectionKey !== "") {
|
|
458
|
+
lastSelectionKey = "";
|
|
459
|
+
sendWsQuiet({ type: "text_select", ranges: [] });
|
|
465
460
|
}
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
466
463
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
464
|
+
var ranges = [];
|
|
465
|
+
for (var i = 0; i < sel.rangeCount; i++) {
|
|
466
|
+
var range = sel.getRangeAt(i);
|
|
467
|
+
var startTurn = findParentTurn(range.startContainer);
|
|
468
|
+
var endTurn = findParentTurn(range.endContainer);
|
|
469
|
+
if (!startTurn || !endTurn) continue;
|
|
470
|
+
// Both must be inside messagesEl
|
|
471
|
+
if (!messagesEl.contains(startTurn)) continue;
|
|
472
|
+
|
|
473
|
+
var startCh = getCharOffset(startTurn, range.startContainer, range.startOffset);
|
|
474
|
+
var endCh = getCharOffset(endTurn, range.endContainer, range.endOffset);
|
|
475
|
+
|
|
476
|
+
ranges.push({
|
|
477
|
+
startTurn: parseInt(startTurn.dataset.turn, 10),
|
|
478
|
+
startCh: startCh,
|
|
479
|
+
endTurn: parseInt(endTurn.dataset.turn, 10),
|
|
480
|
+
endCh: endCh
|
|
481
|
+
});
|
|
482
|
+
}
|
|
486
483
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
484
|
+
var key = JSON.stringify(ranges);
|
|
485
|
+
if (key === lastSelectionKey) return;
|
|
486
|
+
lastSelectionKey = key;
|
|
490
487
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
488
|
+
sendWsQuiet({ type: "text_select", ranges: ranges });
|
|
489
|
+
});
|
|
494
490
|
}
|
|
@@ -11,7 +11,7 @@ import { refreshIcons, iconHtml } from './icons.js';
|
|
|
11
11
|
import { renderMarkdown, highlightCodeBlocks, highlightCodeBlocksBatched, renderMermaidBlocks } from './markdown.js';
|
|
12
12
|
import { updatePageTitle } from './sidebar.js';
|
|
13
13
|
import { renderSessionList, updateSessionPresence, populateCliSessionList, handleSearchResults, updateSessionBadge } from './sidebar-sessions.js';
|
|
14
|
-
import { updateDmBadge, renderSidebarPresence, setMentionActive
|
|
14
|
+
import { updateDmBadge, renderSidebarPresence, setMentionActive } from './sidebar-users.js';
|
|
15
15
|
import { refreshMobileChatSheet } from './sidebar-mobile.js';
|
|
16
16
|
import { handlePaletteSessionSwitch, setPaletteVersion } from './command-palette.js';
|
|
17
17
|
import { handleAgentsList, handleAgentFavoriteToggled } from './agent-picker.js';
|
|
@@ -227,7 +227,7 @@ export function processMessage(msg) {
|
|
|
227
227
|
// The server config has dangerouslySkipPermissions=true but it is disabled
|
|
228
228
|
// because multi-user mode is active. Warn admins so they know the config
|
|
229
229
|
// flag has no effect and remove it to avoid confusion.
|
|
230
|
-
if (store.get('
|
|
230
|
+
if (store.get('permissions') && store.get('permissions').projectSettings !== false) {
|
|
231
231
|
showToast("dangerouslySkipPermissions is set in config but is disabled in multi-user mode. All users have normal tool-approval rules.", "warn");
|
|
232
232
|
}
|
|
233
233
|
}
|
|
@@ -240,16 +240,11 @@ export function processMessage(msg) {
|
|
|
240
240
|
|
|
241
241
|
case "update_available":
|
|
242
242
|
// In multi-user mode, only show update UI to admins
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
if (!isAdmin) return;
|
|
246
|
-
showUpdateAvailable(msg);
|
|
247
|
-
showUpdateBanner(msg);
|
|
248
|
-
});
|
|
249
|
-
} else {
|
|
243
|
+
checkAdminAccess().then(function (isAdmin) {
|
|
244
|
+
if (!isAdmin) return;
|
|
250
245
|
showUpdateAvailable(msg);
|
|
251
246
|
showUpdateBanner(msg);
|
|
252
|
-
}
|
|
247
|
+
});
|
|
253
248
|
break;
|
|
254
249
|
|
|
255
250
|
case "up_to_date":
|
|
@@ -459,7 +454,6 @@ export function processMessage(msg) {
|
|
|
459
454
|
|
|
460
455
|
case "agents_list":
|
|
461
456
|
handleAgentsList(msg);
|
|
462
|
-
handleAgentsListTeam(msg);
|
|
463
457
|
break;
|
|
464
458
|
|
|
465
459
|
case "agent_favorite_toggled":
|
|
@@ -1222,7 +1216,6 @@ export function processMessage(msg) {
|
|
|
1222
1216
|
|
|
1223
1217
|
case "projects_updated":
|
|
1224
1218
|
updateProjectList(msg);
|
|
1225
|
-
renderUserStrip();
|
|
1226
1219
|
break;
|
|
1227
1220
|
|
|
1228
1221
|
case "project_owner_changed":
|
|
@@ -484,8 +484,7 @@ export function addUserMessage(text, images, pastes, fromUserId, fromUserName) {
|
|
|
484
484
|
// already known AND the message is from a different user. If myUserId is
|
|
485
485
|
// null (init race — /api/me hasn't returned yet), assume the message is
|
|
486
486
|
// from the local user to prevent avatar/name bleed-through in bubble view.
|
|
487
|
-
var
|
|
488
|
-
var isOtherUser = isMultiUser && myUserId && fromUserId && fromUserId !== myUserId;
|
|
487
|
+
var isOtherUser = myUserId && fromUserId && fromUserId !== myUserId;
|
|
489
488
|
var div = document.createElement("div");
|
|
490
489
|
div.className = "msg-user" + (isOtherUser ? " msg-user-other" : "");
|
|
491
490
|
div.dataset.turn = ++turnCounter;
|
|
@@ -474,7 +474,7 @@ function showProjectCtxMenu(anchorEl, slug, name, icon, position) {
|
|
|
474
474
|
menu.appendChild(shareItem);
|
|
475
475
|
|
|
476
476
|
// --- Manage Access ---
|
|
477
|
-
if (
|
|
477
|
+
if (slug.indexOf("--") === -1) {
|
|
478
478
|
var isProjectOwner = store.get('myUserId') && store.get('currentProjectOwnerId') && store.get('myUserId') === store.get('currentProjectOwnerId');
|
|
479
479
|
var isAdmin = store.get('permissions') && store.get('permissions').projectSettings !== false;
|
|
480
480
|
if (isProjectOwner || isAdmin) {
|
|
@@ -649,7 +649,7 @@ function showSessionCtxMenu(anchorBtn, sessionId, title, cliSid, sessionData) {
|
|
|
649
649
|
menu.appendChild(renameItem);
|
|
650
650
|
|
|
651
651
|
// Session visibility toggle (only the session owner can change)
|
|
652
|
-
if (
|
|
652
|
+
if (sessionData && sessionData.ownerId && sessionData.ownerId === store.get('myUserId')) {
|
|
653
653
|
var currentVis = (sessionData && sessionData.sessionVisibility) || "shared";
|
|
654
654
|
var isPrivate = currentVis === "private";
|
|
655
655
|
var visItem = document.createElement("button");
|
|
@@ -1141,7 +1141,7 @@ function renderSessionItem(s) {
|
|
|
1141
1141
|
if (s.isProcessing) {
|
|
1142
1142
|
textHtml += '<span class="session-processing"></span>';
|
|
1143
1143
|
}
|
|
1144
|
-
if (
|
|
1144
|
+
if (s.sessionVisibility === "private") {
|
|
1145
1145
|
textHtml += '<span class="session-private-icon" title="Private session">' + iconHtml("lock") + '</span>';
|
|
1146
1146
|
}
|
|
1147
1147
|
// lr-7db0 — agent badge for sessions cast as a named agent via the SDK `agent` option.
|
|
@@ -61,10 +61,6 @@ export function initSidebarUsers() {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
// handleAgentsList: no-op stub — agent-picker.js is the authoritative consumer.
|
|
65
|
-
// This export is kept because app-messages.js imports it as handleAgentsListTeam.
|
|
66
|
-
// TODO(lr-teams-icon-strip): remove this alias once app-messages.js import is cleaned up.
|
|
67
|
-
export function handleAgentsList(_msg) { /* no-op: agent-picker.js handles agents_list */ }
|
|
68
64
|
|
|
69
65
|
export function showIconTooltip(el, text) {
|
|
70
66
|
hideIconTooltip();
|
|
@@ -143,11 +139,6 @@ export function renderSidebarPresence(onlineUsers) {
|
|
|
143
139
|
}
|
|
144
140
|
}
|
|
145
141
|
|
|
146
|
-
// renderUserStrip: retained as a no-op export — callers in app-messages.js
|
|
147
|
-
// invoke this on projects_updated. The icon strip no longer shows per-user
|
|
148
|
-
// avatars; all that lives in the team panel (opened via #icon-strip-team-btn).
|
|
149
|
-
// TODO(lr-teams-icon-strip): remove call sites in app-messages.js once callers are updated.
|
|
150
|
-
export function renderUserStrip() { /* no-op: team panel replaced icon-strip avatars */ }
|
|
151
142
|
|
|
152
143
|
|
|
153
144
|
export function closeDmUserPicker() {
|
|
@@ -167,9 +158,8 @@ export function setCurrentDmUser(userId) {
|
|
|
167
158
|
// for use by the team panel and DM picker.
|
|
168
159
|
}
|
|
169
160
|
|
|
170
|
-
// updateDmBadge:
|
|
171
|
-
//
|
|
172
|
-
// TODO(lr-teams-icon-strip): wire to team panel badge once panel shows DM counts.
|
|
161
|
+
// updateDmBadge: no-op — DM unread counts are now shown only inside the team panel.
|
|
162
|
+
// Future: wire DM unread count to team panel badge. No-op until team panel supports per-user DM count display.
|
|
173
163
|
export function updateDmBadge(userId, count) { /* no-op: icon-strip user badges removed */ }
|
|
174
164
|
|
|
175
165
|
export function getCurrentDmUserId() {
|
|
@@ -380,9 +380,6 @@ function populateAccount() {
|
|
|
380
380
|
avatarFallback.classList.add('hidden');
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
|
-
// Hide account section in single-user mode (no username)
|
|
384
|
-
var accountNav = settingsEl.querySelector('[data-section="us-account"]');
|
|
385
|
-
if (accountNav) accountNav.style.display = data.username ? '' : 'none';
|
|
386
383
|
// Auto-continue toggle
|
|
387
384
|
var acToggle = document.getElementById('us-auto-continue');
|
|
388
385
|
if (acToggle) acToggle.checked = !!data.autoContinueOnRateLimit;
|