@clagentic/console 1.9.0-beta.1 → 1.9.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 (61) hide show
  1. package/bin/cli.js +23 -1
  2. package/lib/agents.js +13 -3
  3. package/lib/build-sha.json +2 -2
  4. package/lib/cli/ipc-subcommands.js +84 -4
  5. package/lib/daemon.js +111 -7
  6. package/lib/effective-protocol.js +82 -0
  7. package/lib/project-connection.js +21 -8
  8. package/lib/project-filesystem.js +4 -4
  9. package/lib/project-http.js +4 -4
  10. package/lib/project-loop.js +49 -5
  11. package/lib/project-sessions.js +166 -68
  12. package/lib/project-user-mention.js +7 -7
  13. package/lib/project-user-message.js +81 -14
  14. package/lib/project.js +28 -22
  15. package/lib/public/app.js +18 -4
  16. package/lib/public/css/base.css +14 -0
  17. package/lib/public/css/filebrowser.css +6 -0
  18. package/lib/public/css/home-hub.css +28 -8
  19. package/lib/public/css/icon-strip.css +17 -0
  20. package/lib/public/css/messages.css +11 -0
  21. package/lib/public/css/mobile-nav.css +22 -0
  22. package/lib/public/css/server-settings.css +9 -0
  23. package/lib/public/css/sidebar.css +15 -0
  24. package/lib/public/css/title-bar.css +10 -1
  25. package/lib/public/index.html +9 -2
  26. package/lib/public/modules/activity-latch.js +45 -0
  27. package/lib/public/modules/activity-state.js +195 -0
  28. package/lib/public/modules/app-connection.js +31 -6
  29. package/lib/public/modules/app-favicon.js +75 -1
  30. package/lib/public/modules/app-home-hub.js +14 -11
  31. package/lib/public/modules/app-loop-ui.js +86 -2
  32. package/lib/public/modules/app-messages.js +178 -54
  33. package/lib/public/modules/app-panels.js +91 -32
  34. package/lib/public/modules/app-projects.js +46 -9
  35. package/lib/public/modules/app-rate-limit.js +13 -1
  36. package/lib/public/modules/server-settings.js +256 -21
  37. package/lib/public/modules/sidebar-mobile.js +32 -22
  38. package/lib/public/modules/sidebar-projects.js +42 -14
  39. package/lib/public/modules/sidebar-sessions.js +168 -48
  40. package/lib/public/modules/theme.js +2 -2
  41. package/lib/public/modules/tools.js +11 -39
  42. package/lib/sdk-bridge.js +375 -33
  43. package/lib/sdk-message-processor.js +98 -15
  44. package/lib/sdk-skill-discovery.js +46 -6
  45. package/lib/sdk-slash-enrichment.js +5 -2
  46. package/lib/server-dm.js +5 -5
  47. package/lib/server-hub-sessions.js +70 -0
  48. package/lib/server.js +78 -43
  49. package/lib/session-activity.js +9 -2
  50. package/lib/sessions.js +64 -18
  51. package/lib/smtp.js +10 -1
  52. package/lib/terminal-manager.js +6 -6
  53. package/lib/ws-schema.js +16 -0
  54. package/lib/yoke/adapters/claude.js +7 -1
  55. package/lib/yoke/adapters/codex.js +219 -31
  56. package/package.json +2 -2
  57. package/scripts/check-test-count.js +397 -0
  58. package/scripts/test-file-completion-reporter.js +43 -0
  59. package/scripts/verify-installed-build.js +242 -15
  60. package/lib/model-context-windows.js +0 -74
  61. package/lib/public/modules/model-context-windows.js +0 -71
@@ -25,6 +25,57 @@ var fs = require("fs");
25
25
  * digestDmTurn,
26
26
  * adapter - YOKE adapter instance
27
27
  */
28
+ // lr-62157d: code-point-aware truncation to a max length. Plain
29
+ // String#substring/slice indexes by UTF-16 code unit, so a cut that lands
30
+ // inside a surrogate pair (e.g. most emoji, many CJK supplementary-plane
31
+ // characters) produces a lone unpaired surrogate — renders as a broken/
32
+ // replacement glyph. Array.from(str) iterates a string by Unicode code
33
+ // point (correctly reassembling surrogate pairs), so slicing the resulting
34
+ // array and rejoining never splits one. BOBBIE fnd (PR #406 review):
35
+ // pasted content is now a title source (see deriveProvisionalTitle below),
36
+ // and pasted text is far more likely to contain emoji/CJK than a typed
37
+ // first line, making this newly reachable in a way it wasn't before. No
38
+ // existing helper for this in the codebase (every other truncation call
39
+ // site uses plain substring — out of scope here, this is a minimal fix
40
+ // for the newly-reachable path only, not a codebase-wide truncation sweep).
41
+ function truncateCodePointSafe(str, maxLen) {
42
+ var codePoints = Array.from(str);
43
+ if (codePoints.length <= maxLen) return str;
44
+ return codePoints.slice(0, maxLen).join("");
45
+ }
46
+
47
+ // lr-62157d: pure helper — derives the FIRST-message provisional title
48
+ // (before any turn has completed / before autoGenerateTitle can run).
49
+ // Prefers real message text; falls back to the first paste when text is
50
+ // empty (a >=500-char paste is diverted server-side into msg.pastes[] with
51
+ // msg.text empty by the client's paste-chip handling — see input.js — so
52
+ // msg.text alone previously always fell through to the "Image" literal for
53
+ // a text paste, not just a genuine image-only message). "Image" is reserved
54
+ // for the case where neither text nor a paste is present. Whitespace is
55
+ // collapsed before truncating since pastes are commonly multi-line and an
56
+ // un-normalized 50-char slice renders as a broken sidebar entry.
57
+ // Exported as _test_deriveProvisionalTitle (see codex.js's
58
+ // _test_resolveTitleModel for the established convention) so this is
59
+ // directly unit-testable without constructing the full WS message handler.
60
+ function deriveProvisionalTitle(msg) {
61
+ var source = msg && msg.text;
62
+ if (!source && msg && msg.pastes && msg.pastes.length > 0) {
63
+ source = msg.pastes[0];
64
+ }
65
+ // PEACHES fnd-439007: msg is raw client-controlled WS JSON with no
66
+ // server-side schema validation (see project-connection.js's bare
67
+ // JSON.parse) — the bundled browser client only ever sends strings in
68
+ // pastes[] (input.js's paste handler pushes p.text, always a string), but
69
+ // nothing enforces that for an arbitrary WS client. A non-string entry
70
+ // (e.g. an object) must not reach .replace(), which only exists on
71
+ // strings — fall through to the "Image" literal instead, exactly the case
72
+ // it was originally written for.
73
+ var collapsed = typeof source === "string"
74
+ ? truncateCodePointSafe(source.replace(/\s+/g, " ").trim(), 50)
75
+ : "";
76
+ return collapsed || "Image";
77
+ }
78
+
28
79
  function attachUserMessage(ctx) {
29
80
  var cwd = ctx.cwd;
30
81
  var slug = ctx.slug;
@@ -133,8 +184,8 @@ function attachUserMessage(ctx) {
133
184
 
134
185
  // --- Web terminal ---
135
186
  if (msg.type === "term_create") {
136
- if (ws._clayUser) {
137
- var termPerms = usersModule.getEffectivePermissions(ws._clayUser, osUsers);
187
+ if (ws._clagenticUser) {
188
+ var termPerms = usersModule.getEffectivePermissions(ws._clagenticUser, osUsers);
138
189
  if (!termPerms.terminal) {
139
190
  sendTo(ws, { type: "term_error", error: "Terminal access is not permitted" });
140
191
  return true;
@@ -183,7 +234,7 @@ function attachUserMessage(ctx) {
183
234
  tm.close(msg.id, ws);
184
235
  broadcastTermList();
185
236
  // Remove closed terminal from context sources
186
- var _termSessionId = ws._clayActiveSession || null;
237
+ var _termSessionId = ws._clagenticActiveSession || null;
187
238
  var saved = loadContextSources(slug, _termSessionId);
188
239
  var termKey = "term:" + msg.id;
189
240
  var filtered = saved.filter(function(id) { return id !== termKey; });
@@ -214,7 +265,7 @@ function attachUserMessage(ctx) {
214
265
  var tid = parseInt(srcId.split(":")[1], 10);
215
266
  return tm.getScrollback(tid, ws) !== null;
216
267
  });
217
- var _saveSessionId = ws._clayActiveSession || null;
268
+ var _saveSessionId = ws._clagenticActiveSession || null;
218
269
  saveContextSources(slug, _saveSessionId, activeIds);
219
270
  return true;
220
271
  }
@@ -248,8 +299,8 @@ function attachUserMessage(ctx) {
248
299
  msg.type === "loop_registry_remove" || msg.type === "loop_registry_convert" ||
249
300
  msg.type === "loop_registry_toggle" || msg.type === "loop_registry_rerun" ||
250
301
  msg.type === "schedule_create" || msg.type === "schedule_move") {
251
- if (ws._clayUser) {
252
- var schPerms = usersModule.getEffectivePermissions(ws._clayUser, osUsers);
302
+ if (ws._clagenticUser) {
303
+ var schPerms = usersModule.getEffectivePermissions(ws._clagenticUser, osUsers);
253
304
  if (!schPerms.scheduledTasks) {
254
305
  sendTo(ws, { type: "error", text: "Scheduled tasks access is not permitted" });
255
306
  return true;
@@ -302,7 +353,19 @@ function attachUserMessage(ctx) {
302
353
  if (!msg.text && (!msg.images || msg.images.length === 0) && (!msg.pastes || msg.pastes.length === 0)) return true;
303
354
 
304
355
  var session = getSessionForWs(ws);
305
- if (!session) return true;
356
+ if (!session) {
357
+ // lr-5450ef: this used to be a bare `return true` — the message was
358
+ // silently swallowed with no feedback to the sender whatsoever (not
359
+ // even a server log line), the same silence-to-UI failure class as
360
+ // the pendingMessages buffering fixed alongside this in sdk-bridge.js.
361
+ // getSessionForWs returning null here means the client's websocket
362
+ // has no session bound to it (e.g. stale/detached client, session
363
+ // deleted from under it) — surface that instead of pretending the
364
+ // message was handled.
365
+ console.error("[project-user-message] Dropping user message: no session bound to this websocket (slug=" + slug + ")");
366
+ sendTo(ws, { type: "error", text: "Clagentic: Console couldn't find your session — try reloading." });
367
+ return true;
368
+ }
306
369
 
307
370
  // Bind vendor to session on first message (if not already set)
308
371
  if (!session.vendor && msg.vendor) {
@@ -312,8 +375,8 @@ function attachUserMessage(ctx) {
312
375
  }
313
376
 
314
377
  // Backfill ownerId for legacy sessions restored without one (multi-user only)
315
- if (!session.ownerId && ws._clayUser) {
316
- session.ownerId = ws._clayUser.id;
378
+ if (!session.ownerId && ws._clagenticUser) {
379
+ session.ownerId = ws._clagenticUser.id;
317
380
  sm.saveSessionFile(session);
318
381
  }
319
382
 
@@ -321,9 +384,9 @@ function attachUserMessage(ctx) {
321
384
 
322
385
  var userMsg2 = { type: "user_message", text: msg.text || "" };
323
386
  // Attach sender info for multi-user attribution (backward-compatible: old clients ignore these)
324
- if (ws._clayUser) {
325
- userMsg2.from = ws._clayUser.id;
326
- userMsg2.fromName = ws._clayUser.displayName || ws._clayUser.username || "";
387
+ if (ws._clagenticUser) {
388
+ userMsg2.from = ws._clagenticUser.id;
389
+ userMsg2.fromName = ws._clagenticUser.displayName || ws._clagenticUser.username || "";
327
390
  }
328
391
  var savedImagePaths = [];
329
392
  if (msg.images && msg.images.length > 0) {
@@ -353,7 +416,11 @@ function attachUserMessage(ctx) {
353
416
  sendToSessionOthers(ws, session.localId, hydrateImageRefs(userMsg2));
354
417
 
355
418
  if (!session.title) {
356
- session.title = (msg.text || "Image").substring(0, 50);
419
+ session.title = deriveProvisionalTitle(msg);
420
+ // This is only a provisional title — autoGenerateTitle (sdk-bridge.js)
421
+ // is allowed to overwrite it once a real LLM-generated title is ready,
422
+ // as long as the user hasn't manually renamed the session since.
423
+ session.titleProvisional = true;
357
424
  sm.saveSessionFile(session);
358
425
  sm.broadcastSessionList();
359
426
  // Sync auto-title to SDK
@@ -660,5 +727,5 @@ function attachUserMessage(ctx) {
660
727
  };
661
728
  }
662
729
 
663
- module.exports = { attachUserMessage: attachUserMessage };
730
+ module.exports = { attachUserMessage: attachUserMessage, _test_deriveProvisionalTitle: deriveProvisionalTitle };
664
731
 
package/lib/project.js CHANGED
@@ -2,7 +2,7 @@ var fs = require("fs");
2
2
  var path = require("path");
3
3
  var os = require("os");
4
4
  var crypto = require("crypto");
5
- var { createSessionManager } = require("./sessions");
5
+ var { createSessionManager, stampActivityLocalId } = require("./sessions");
6
6
  var { createSDKBridge, createMessageQueue } = require("./sdk-bridge");
7
7
  var { createTerminalManager } = require("./terminal-manager");
8
8
  var { createNotesManager } = require("./notes");
@@ -233,8 +233,8 @@ function createProjectContext(opts) {
233
233
 
234
234
  function getLinuxUserForWs(ws) {
235
235
  if (!osUsers) return null;
236
- if (!ws._clayUser || !ws._clayUser.linuxUser) return null;
237
- return ws._clayUser.linuxUser;
236
+ if (!ws._clagenticUser || !ws._clagenticUser.linuxUser) return null;
237
+ return ws._clagenticUser.linuxUser;
238
238
  }
239
239
 
240
240
  // Cache resolved OS user info to avoid repeated getent calls
@@ -255,8 +255,8 @@ function createProjectContext(opts) {
255
255
 
256
256
  function getOsUserInfoForReq(req) {
257
257
  if (!osUsers) return null;
258
- if (!req._clayUser || !req._clayUser.linuxUser) return null;
259
- var linuxUser = req._clayUser.linuxUser;
258
+ if (!req._clagenticUser || !req._clagenticUser.linuxUser) return null;
259
+ var linuxUser = req._clagenticUser.linuxUser;
260
260
  if (osUserInfoCache[linuxUser]) return osUserInfoCache[linuxUser];
261
261
  try {
262
262
  var info = resolveOsUserInfo(linuxUser);
@@ -345,7 +345,7 @@ function createProjectContext(opts) {
345
345
  function sendToAdmins(obj) {
346
346
  var data = JSON.stringify(obj);
347
347
  for (var ws of clients) {
348
- if (ws.readyState === 1 && ws._clayUser && ws._clayUser.role === "admin") ws.send(data);
348
+ if (ws.readyState === 1 && ws._clagenticUser && ws._clagenticUser.role === "admin") ws.send(data);
349
349
  }
350
350
  }
351
351
 
@@ -354,8 +354,8 @@ function createProjectContext(opts) {
354
354
  var seen = {};
355
355
  var userList = [];
356
356
  for (var c of clients) {
357
- if (!c._clayUser) continue;
358
- var u = c._clayUser;
357
+ if (!c._clagenticUser) continue;
358
+ var u = c._clagenticUser;
359
359
  if (seen[u.id]) continue;
360
360
  seen[u.id] = true;
361
361
  var p = u.profile || {};
@@ -381,18 +381,24 @@ function createProjectContext(opts) {
381
381
  }
382
382
 
383
383
  function sendToSession(sessionId, obj) {
384
+ // Stamp localId on status/done/auth_required so the client can
385
+ // session-scope the edge write instead of applying it blind to
386
+ // whichever session is currently focused — see sessions.js's
387
+ // stampActivityLocalId doc comment for the full rationale/type list.
388
+ stampActivityLocalId(sessionId, obj);
384
389
  var data = JSON.stringify(obj);
385
390
  for (var ws of clients) {
386
- if (ws.readyState === 1 && ws._clayActiveSession === sessionId) {
391
+ if (ws.readyState === 1 && ws._clagenticActiveSession === sessionId) {
387
392
  ws.send(data);
388
393
  }
389
394
  }
390
395
  }
391
396
 
392
397
  function sendToSessionOthers(sender, sessionId, obj) {
398
+ stampActivityLocalId(sessionId, obj);
393
399
  var data = JSON.stringify(obj);
394
400
  for (var ws of clients) {
395
- if (ws !== sender && ws.readyState === 1 && ws._clayActiveSession === sessionId) {
401
+ if (ws !== sender && ws.readyState === 1 && ws._clagenticActiveSession === sessionId) {
396
402
  ws.send(data);
397
403
  }
398
404
  }
@@ -427,7 +433,7 @@ function createProjectContext(opts) {
427
433
  sendTo: sendTo,
428
434
  sendEach: function (fn) {
429
435
  for (var ws of clients) {
430
- var user = ws._clayUser;
436
+ var user = ws._clagenticUser;
431
437
  var filterFn = null;
432
438
  if (user) {
433
439
  filterFn = (function (u) {
@@ -506,7 +512,7 @@ function createProjectContext(opts) {
506
512
  // Apply to all connected clients' active sessions
507
513
  for (var c of clients) {
508
514
  if (c.readyState !== 1) continue;
509
- var sid = c._clayActiveSession || null;
515
+ var sid = c._clagenticActiveSession || null;
510
516
  var active = loadContextSources(slug, sid);
511
517
  if (active.indexOf(key) === -1) {
512
518
  active.push(key);
@@ -520,7 +526,7 @@ function createProjectContext(opts) {
520
526
  var key = "tab:" + tabId;
521
527
  for (var c of clients) {
522
528
  if (c.readyState !== 1) continue;
523
- var sid = c._clayActiveSession || null;
529
+ var sid = c._clagenticActiveSession || null;
524
530
  var active = loadContextSources(slug, sid);
525
531
  var idx = active.indexOf(key);
526
532
  if (idx !== -1) {
@@ -671,7 +677,7 @@ function createProjectContext(opts) {
671
677
  _connection.handleConnection(ws, wsUser, handleMessage, handleDisconnection);
672
678
 
673
679
  // Initialize local MCP when a localhost client connects
674
- if (ws._clayLocal && _localMcp && !_localMcp.isReady()) {
680
+ if (ws._clagenticLocal && _localMcp && !_localMcp.isReady()) {
675
681
  _localMcp.initialize(function () {
676
682
  // Rebuild proxy servers and broadcast state when local servers are ready
677
683
  _mcp.rebuildAndBroadcast();
@@ -681,7 +687,7 @@ function createProjectContext(opts) {
681
687
 
682
688
  // --- WS message handler ---
683
689
  function getSessionForWs(ws) {
684
- return sm.sessions.get(ws._clayActiveSession) || null;
690
+ return sm.sessions.get(ws._clagenticActiveSession) || null;
685
691
  }
686
692
 
687
693
  // --- Schedule / cancel a message (used by WS handler and auto-continue) ---
@@ -866,10 +872,10 @@ function createProjectContext(opts) {
866
872
  function broadcastPresence() {
867
873
  var presence = {};
868
874
  for (var c of clients) {
869
- if (!c._clayUser || !c._clayActiveSession) continue;
870
- var sid = c._clayActiveSession;
875
+ if (!c._clagenticUser || !c._clagenticActiveSession) continue;
876
+ var sid = c._clagenticActiveSession;
871
877
  if (!presence[sid]) presence[sid] = [];
872
- var u = c._clayUser;
878
+ var u = c._clagenticUser;
873
879
  var p = u.profile || {};
874
880
  // Deduplicate: skip if this user is already listed for this session
875
881
  var dominated = false;
@@ -1279,8 +1285,8 @@ function createProjectContext(opts) {
1279
1285
  var seen = {};
1280
1286
  var onlineUsers = [];
1281
1287
  for (var c of clients) {
1282
- if (!c._clayUser) continue;
1283
- var u = c._clayUser;
1288
+ if (!c._clagenticUser) continue;
1289
+ var u = c._clagenticUser;
1284
1290
  if (seen[u.id]) continue;
1285
1291
  seen[u.id] = true;
1286
1292
  var p = u.profile || {};
@@ -1349,8 +1355,8 @@ function createProjectContext(opts) {
1349
1355
  var user = usersModule.findUserById(userId);
1350
1356
  if (!user) return;
1351
1357
  for (var ws of clients) {
1352
- if (ws._clayUser && ws._clayUser.id === userId) {
1353
- ws._clayUser = user;
1358
+ if (ws._clagenticUser && ws._clagenticUser.id === userId) {
1359
+ ws._clagenticUser = user;
1354
1360
  }
1355
1361
  }
1356
1362
  broadcastClientCount();
package/lib/public/app.js CHANGED
@@ -52,7 +52,7 @@ import { getWs as _getWsRef, setWs as _setWsRef } from './modules/ws-ref.js';
52
52
  import { initHomeHub, showHomeHub as _hubShowHomeHub, hideHomeHub as _hubHideHomeHub, handleHubSchedules as _hubHandleHubSchedules, renderHomeHub as _hubRenderHomeHub, isHomeHubVisible } from './modules/app-home-hub.js';
53
53
  import { initRateLimit, handleRateLimitEvent as _rlHandleRateLimitEvent, updateRateLimitUsage as _rlUpdateRateLimitUsage, addScheduledMessageBubble as _rlAddScheduledMessageBubble, removeScheduledMessageBubble as _rlRemoveScheduledMessageBubble, handleFastModeState as _rlHandleFastModeState, getScheduledMsgEl, resetRateLimitState } from './modules/app-rate-limit.js';
54
54
  import { initCursors, handleRemoteCursorMove as _curHandleRemoteCursorMove, handleRemoteCursorLeave as _curHandleRemoteCursorLeave, handleRemoteSelection as _curHandleRemoteSelection, clearRemoteCursors as _curClearRemoteCursors, initCursorToggle } from './modules/app-cursors.js';
55
- import { initFavicon, updateFavicon as _favUpdateFavicon, setSendBtnMode as _favSetSendBtnMode, blinkIO as _favBlinkIO, blinkSessionDot as _favBlinkSessionDot, updateCrossProjectBlink as _favUpdateCrossProjectBlink, startUrgentBlink as _favStartUrgentBlink, stopUrgentBlink as _favStopUrgentBlink, setActivity as _favSetActivity, drawFaviconAnimFrame as _favDrawFaviconAnimFrame } from './modules/app-favicon.js';
55
+ import { initFavicon, initActivityFooter, updateFavicon as _favUpdateFavicon, setSendBtnMode as _favSetSendBtnMode, blinkIO as _favBlinkIO, blinkSessionDot as _favBlinkSessionDot, updateCrossProjectBlink as _favUpdateCrossProjectBlink, startUrgentBlink as _favStartUrgentBlink, stopUrgentBlink as _favStopUrgentBlink, setActivity as _favSetActivity, drawFaviconAnimFrame as _favDrawFaviconAnimFrame } from './modules/app-favicon.js';
56
56
  import { initHeader, closeSessionInfoPopover as _hdrCloseSessionInfoPopover, updateHistorySentinel as _hdrUpdateHistorySentinel, requestMoreHistory as _hdrRequestMoreHistory, prependOlderHistory as _hdrPrependOlderHistory } from './modules/app-header.js';
57
57
  import { initMisc, flushPendingExtMessages, showImageModal as _miscShowImageModal, closeImageModal as _miscCloseImageModal, showPasteModal as _miscShowPasteModal, closePasteModal as _miscClosePasteModal, showConfirm as _miscShowConfirm, hideConfirm as _miscHideConfirm, showForceChangePinOverlay as _miscShowForceChangePinOverlay, sendExtensionCommand as _miscSendExtensionCommand, handleExtensionResult as _miscHandleExtensionResult } from './modules/app-misc.js';
58
58
  import { initSkillInstall, requireSkills as _siRequireSkills, handleSkillInstallWs as _siHandleSkillInstallWs } from './modules/app-skills-install.js';
@@ -60,7 +60,7 @@ import { initLoopUi, updateLoopInputVisibility as _loopUpdateLoopInputVisibility
60
60
  import { initLoopWizard, openRalphWizard as _loopOpenRalphWizard, closeRalphWizard as _loopCloseRalphWizard, getWizardSource as _loopGetWizardSource } from './modules/app-loop-wizard.js';
61
61
  import { initAppNotifications, handleNotificationsState as _notifHandleState, handleNotificationCreated as _notifHandleCreated, handleNotificationDismissed as _notifHandleDismissed, handleNotificationDismissedAll as _notifHandleDismissedAll } from './modules/app-notifications.js';
62
62
  import { createStore, store } from './modules/store.js';
63
- import { initPanels, updateConfigChip as _panUpdateConfigChip, getModelEffortLevels as _panGetModelEffortLevels, accumulateUsage as _panAccumulateUsage, updateUsagePanel as _panUpdateUsagePanel, resetUsage as _panResetUsage, toggleUsagePanel as _panToggleUsagePanel, formatTokens as _panFormatTokens, updateStatusPanel as _panUpdateStatusPanel, requestProcessStats as _panRequestProcessStats, toggleStatusPanel as _panToggleStatusPanel, accumulateContext as _panAccumulateContext, updateContextPanel as _panUpdateContextPanel, resetContext as _panResetContext, resetContextData as _panResetContextData, minimizeContext as _panMinimizeContext, expandContext as _panExpandContext, toggleContextPanel as _panToggleContextPanel, getContextView as _panGetContextView, renderCtxPopover as _panRenderCtxPopover, hideCtxPopover as _panHideCtxPopover, formatBytes as _panFormatBytes, formatUptime as _panFormatUptime, getModelSupportsEffort as _panGetModelSupportsEffort, getSessionUsage, setSessionUsage, getContextData, setContextData, setContextView as _panSetContextView, applyContextView as _panApplyContextView } from './modules/app-panels.js';
63
+ import { initPanels, updateConfigChip as _panUpdateConfigChip, getModelEffortLevels as _panGetModelEffortLevels, accumulateUsage as _panAccumulateUsage, updateUsagePanel as _panUpdateUsagePanel, resetUsage as _panResetUsage, toggleUsagePanel as _panToggleUsagePanel, formatTokens as _panFormatTokens, updateStatusPanel as _panUpdateStatusPanel, requestProcessStats as _panRequestProcessStats, toggleStatusPanel as _panToggleStatusPanel, accumulateContext as _panAccumulateContext, updateContextPanel as _panUpdateContextPanel, resetContext as _panResetContext, resetContextData as _panResetContextData, minimizeContext as _panMinimizeContext, expandContext as _panExpandContext, toggleContextPanel as _panToggleContextPanel, getContextView as _panGetContextView, renderCtxPopover as _panRenderCtxPopover, hideCtxPopover as _panHideCtxPopover, formatBytes as _panFormatBytes, formatUptime as _panFormatUptime, getModelSupportsEffort as _panGetModelSupportsEffort, getSessionUsage, setSessionUsage, setContextData, setContextView as _panSetContextView, applyContextView as _panApplyContextView, getEffectiveContextFill as _panGetEffectiveContextFill } from './modules/app-panels.js';
64
64
  import { initProjects, onProjectListUpdated, onResetClientState, updateProjectList as _projUpdateProjectList, renderProjectList as _projRenderProjectList, renderTopbarPresence as _projRenderTopbarPresence, switchProject as _projSwitchProject, resetClientState as _projResetClientState, confirmRemoveProject as _projConfirmRemoveProject, handleRemoveProjectCheckResult as _projHandleRemoveProjectCheckResult, handleRemoveProjectResult as _projHandleRemoveProjectResult, openAddProjectModal as _projOpenAddProjectModal, closeAddProjectModal as _projCloseAddProjectModal, handleBrowseDirResult as _projHandleBrowseDirResult, handleAddProjectResult as _projHandleAddProjectResult, handleCloneProgress as _projHandleCloneProgress, showUpdateAvailable as _projShowUpdateAvailable, getCachedProjects, setCachedProjects, getCachedProjectCount, getCachedRemovedProjects, setCachedRemovedProjects } from './modules/app-projects.js';
65
65
  import { initRendering, addToMessages as _renAddToMessages, scrollToBottom as _renScrollToBottom, forceScrollToBottom as _renForceScrollToBottom, addUserMessage as _renAddUserMessage, getMsgTime as _renGetMsgTime, shouldGroupMessage as _renShouldGroupMessage, ensureAssistantBlock as _renEnsureAssistantBlock, addCopyHandler as _renAddCopyHandler, appendDelta as _renAppendDelta, flushStreamBuffer as _renFlushStreamBuffer, finalizeAssistantBlock as _renFinalizeAssistantBlock, addSystemMessage as _renAddSystemMessage, addConflictMessage as _renAddConflictMessage, addContextOverflowMessage as _renAddContextOverflowMessage, showClaudePreThinking as _renShowClaudePreThinking, showSuggestionChips as _renShowSuggestionChips, hideSuggestionChips as _renHideSuggestionChips, getGhostSuggestion as _renGetGhostSuggestion, getTurnCounter, setTurnCounter, getPrependAnchor, setPrependAnchor, getActivityEl, setActivityEl, getIsUserScrolledUp, setIsUserScrolledUp, getStickyBottom, armStickyBottom, disarmStickyBottom } from './modules/app-rendering.js';
66
66
  import { initDm, openDm as _dmOpenDm, enterDmMode as _dmEnterDmMode, exitDmMode as _dmExitDmMode, appendDmMessage as _dmAppendDmMessage, showDmTypingIndicator as _dmShowDmTypingIndicator, handleDmSend as _dmHandleDmSend } from './modules/app-dm.js';
@@ -540,6 +540,7 @@ import { initDiagnostics } from './modules/diagnostics.js';
540
540
 
541
541
  // --- Favicon module ---
542
542
  initFavicon();
543
+ initActivityFooter();
543
544
 
544
545
  // --- Header module (rename, info popover, history) ---
545
546
  initHeader();
@@ -574,8 +575,10 @@ import { initDiagnostics } from './modules/diagnostics.js';
574
575
  stopUrgentBlink: function() { stopUrgentBlink(); },
575
576
  showImageModal: showImageModal,
576
577
  getContextPercent: function() {
577
- var cd = getContextData();
578
- return cd.contextWindow > 0 ? Math.round((cd.input / cd.contextWindow) * 100) : 0;
578
+ // lr-3af675: route through the same (used, win) pair the header bar
579
+ // and popover render from, so this label can never disagree with them.
580
+ var fill = _panGetEffectiveContextFill();
581
+ return fill.win > 0 ? Math.round((fill.used / fill.win) * 100) : 0;
579
582
  },
580
583
  getClaudeAvatar: function () { return CLAUDE_CODE_AVATAR; },
581
584
  });
@@ -1031,6 +1034,17 @@ import { initDiagnostics } from './modules/diagnostics.js';
1031
1034
  // --- Diagnostics panel (lr-8294, epic lr-1a52) ---
1032
1035
  initDiagnostics();
1033
1036
 
1037
+ // lr-5edd64: the lr-58c813 client-side activity-edge accept/reject ledger
1038
+ // (window.__clagenticActivityLedger(), activity-latch.js) is removed along
1039
+ // with the client-local 'processing' latch it existed to observe —
1040
+ // 'processing' is a pure projection of server-authoritative per-session
1041
+ // state now (see app-messages.js's session_list/session_switched
1042
+ // handlers), so there is no edge-accept/reject decision left to ledger.
1043
+ // The SEPARATE server-side lr-58c813 divergence probe (lib/sdk-bridge.js,
1044
+ // session.isProcessing vs the token registry) is untouched by this
1045
+ // removal — it is reachable via `clagentic-console --activity-diagnostics`
1046
+ // (lr-8b476f), not this devtools hook.
1047
+
1034
1048
  // --- Messages module (uses direct imports, no ctx injection needed) ---
1035
1049
 
1036
1050
  // --- Connection module ---
@@ -57,6 +57,20 @@ img.emoji {
57
57
  --error: #FF4D6A;
58
58
  --success: #29D9A8;
59
59
  --warning: #4A7FE8;
60
+ /* lr-66c118: --danger was referenced with two DISAGREEING fallbacks
61
+ (#F24822 at sidebar.css:1713, #e74c3c at icon-strip.css/mention.css)
62
+ but never defined here. Defining it settles both call sites on one
63
+ color; #e74c3c matches the existing unread/alert red already used
64
+ throughout (session-unread-badge, hub-recent-dot.alert, etc). */
65
+ --danger: #e74c3c;
66
+ /* lr-66c118: multi-user activity tone — a THIRD color, distinct from
67
+ --success (own activity, green) and --danger (alert, red). Violet is
68
+ maximally hue-separated from both and from --accent (cyan) /
69
+ --accent2/--warning (blue), which already carry meaning. Hue alone is
70
+ not sufficient at 6-8px (deuteranopia/protanopia; violet/blue
71
+ confusion) — render sites must pair this with a shape difference
72
+ (ring vs filled disc), never ship on hue alone. */
73
+ --activity-other: #B77BF3;
60
74
  --accent-8: rgba(0, 207, 255, 0.08);
61
75
  --accent-12: rgba(0, 207, 255, 0.12);
62
76
  --accent-15: rgba(0, 207, 255, 0.15);
@@ -745,6 +745,12 @@
745
745
  color: var(--text-dimmer);
746
746
  }
747
747
 
748
+ /* lr-93e3c8: visible error state for save-status spans (e.g. Advanced >
749
+ Memory), matching the same class other save-status spans already use. */
750
+ .ps-save-status-error {
751
+ color: var(--error, #f38ba8);
752
+ }
753
+
748
754
  /* Environment notice */
749
755
  .ps-env-notice {
750
756
  display: flex;
@@ -297,6 +297,12 @@
297
297
  background: var(--success);
298
298
  box-shadow: 0 0 6px rgba(80, 250, 123, 0.4);
299
299
  }
300
+ /* Multi-user tone (lr-66c118): ring shape, see .hub-recent-dot.other */
301
+ .hub-project-dot.other {
302
+ background: transparent;
303
+ border: 1.5px solid var(--activity-other, #B77BF3);
304
+ box-shadow: 0 0 4px rgba(183, 123, 243, 0.4);
305
+ }
300
306
  .hub-project-icon {
301
307
  font-size: 14px;
302
308
  width: 20px;
@@ -491,18 +497,32 @@
491
497
  opacity: 1;
492
498
  box-shadow: 0 0 6px rgba(80, 250, 123, 0.4);
493
499
  }
494
- /* Alert state — color precedence LOCKED (andy, lr-0aa7b6):
495
- alert(red) > processing(green) > live(green) > idle(grey). This class is
496
- applied instead of .processing when the row's session is notifying, so
497
- red always wins visually even if the session is also active. Same red
498
- used by .icon-strip-project-badge (unread badge). Formerly a SEPARATE
499
- right-side dot (.hub-recent-alert-dot, removed) — now just another color
500
- state of the single left dot. */
500
+ /* Alert state — color precedence LOCKED (andy, lr-0aa7b6), promoted into
501
+ activity-state.js's indicatorClass() as the canonical derivation for
502
+ every surface (lr-66c118): alert(red) > processing(green) > idle(grey).
503
+ ("live" never existed as a separate CSS class from "processing" anywhere
504
+ in the codebase — the old 4-state comment here was aspirational, not
505
+ real; reconciled to the 3 states actually shipped.) This class is applied
506
+ instead of .processing when the row's session is notifying, so red always
507
+ wins visually even if the session is also active. Same red used by
508
+ .icon-strip-project-badge (unread badge), now tokenized as --danger.
509
+ Formerly a SEPARATE right-side dot (.hub-recent-alert-dot, removed) — now
510
+ just another color state of the single left dot. */
501
511
  .hub-recent-dot.alert {
502
- background: #e74c3c;
512
+ background: var(--danger, #e74c3c);
503
513
  opacity: 1;
504
514
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.5);
505
515
  }
516
+ /* Multi-user tone (lr-66c118): another user's activity — distinct violet
517
+ hue AND a ring shape (transparent center, colored border) instead of a
518
+ filled disc, so the state is distinguishable at 7px even under a
519
+ red/green color-vision deficiency (hue alone must not ship alone). */
520
+ .hub-recent-dot.other {
521
+ background: transparent;
522
+ opacity: 1;
523
+ border: 1.5px solid var(--activity-other, #B77BF3);
524
+ box-shadow: 0 0 4px rgba(183, 123, 243, 0.4);
525
+ }
506
526
  .hub-recent-project-icon {
507
527
  font-size: 14px;
508
528
  width: 20px;
@@ -237,6 +237,23 @@
237
237
  background: var(--success);
238
238
  }
239
239
 
240
+ /* Multi-user tone (lr-66c118): ring shape (transparent center, colored
241
+ border) instead of a filled disc, plus a distinct violet hue — hue alone
242
+ is not sufficient to distinguish "another user active" from "I'm active"
243
+ at 10px under a red/green color-vision deficiency. */
244
+ .icon-strip-status.other {
245
+ opacity: 1;
246
+ background: transparent;
247
+ border-width: 2px;
248
+ border-color: var(--activity-other, #B77BF3);
249
+ }
250
+
251
+ /* Alert tone (lr-66c118): unread activity wins over processing green. */
252
+ .icon-strip-status.alert {
253
+ opacity: 1;
254
+ background: var(--danger, #e74c3c);
255
+ }
256
+
240
257
  /* IO blink = HDD LED flash */
241
258
  .icon-strip-status.io {
242
259
  opacity: 1;
@@ -632,6 +632,17 @@ pre.mermaid-error {
632
632
 
633
633
  .thinking-item.done .thinking-spinner { display: none; }
634
634
 
635
+ /* lr-6e20f7: bubble layout (body:not(.wide-view)) has its own
636
+ bottom-of-transcript presence indicator (.activity-inline, driven by
637
+ activity-state.js via app-favicon.js's initActivityFooter). The thinking
638
+ block owns DETAIL (the expandable content), not presence — showing this
639
+ spinner too duplicated the footer dots (this task's SYMPTOM B: one
640
+ indicator here, one at the bottom, simultaneously). Channel layout has no
641
+ such duplicate (its footer, .channel-pre-thinking, is always removed by
642
+ removePreThinking() before a real thinking block ever renders), so this
643
+ is scoped to bubble layout only. */
644
+ body:not(.wide-view) .thinking-spinner { display: none; }
645
+
635
646
  .thinking-content {
636
647
  display: none;
637
648
  padding: 8px 14px;
@@ -217,6 +217,17 @@
217
217
  flex-shrink: 0;
218
218
  }
219
219
 
220
+ /* Multi-user tone (lr-66c118): ring shape, distinct violet hue. */
221
+ .mobile-project-processing.other {
222
+ background: transparent;
223
+ border: 1.5px solid var(--activity-other, #B77BF3);
224
+ box-sizing: border-box;
225
+ }
226
+ /* Alert tone (lr-66c118): unread wins over processing green. */
227
+ .mobile-project-processing.alert {
228
+ background: var(--danger, #e74c3c);
229
+ }
230
+
220
231
  .mobile-project-unread {
221
232
  min-width: 18px;
222
233
  height: 18px;
@@ -865,6 +876,17 @@
865
876
  box-shadow: 0 0 4px var(--success);
866
877
  }
867
878
 
879
+ /* Multi-user tone (lr-66c118): ring shape, distinct violet hue. */
880
+ .mobile-session-processing.other {
881
+ background: transparent;
882
+ border: 1.5px solid var(--activity-other, #B77BF3);
883
+ box-sizing: border-box;
884
+ }
885
+ /* Alert tone (lr-66c118): unread wins over processing green. */
886
+ .mobile-session-processing.alert {
887
+ background: var(--danger, #e74c3c);
888
+ }
889
+
868
890
  /* Date group header inside sheet */
869
891
  .mobile-sheet-group {
870
892
  padding: 14px 12px 6px;
@@ -696,6 +696,15 @@
696
696
  color: #3fb950;
697
697
  }
698
698
 
699
+ /* --- Badge variant: proxy-terminated HTTPS (lr-20e71c) ---
700
+ Distinct from settings-badge-green: TLS is genuinely active, but a
701
+ reverse proxy terminates it rather than the daemon itself. Reuses the
702
+ existing --warning semantic token rather than introducing a new color. */
703
+ .settings-badge.settings-badge-proxy {
704
+ background: var(--warning-bg);
705
+ color: var(--warning);
706
+ }
707
+
699
708
  /* --- Nav danger item (Shutdown) --- */
700
709
  .settings-nav-item.settings-nav-danger {
701
710
  color: var(--error);
@@ -892,6 +892,21 @@
892
892
  box-shadow: 0 0 4px var(--success);
893
893
  }
894
894
 
895
+ /* Multi-user tone (lr-66c118): another user's activity — ring shape (not a
896
+ filled disc) plus a distinct violet hue, so hue alone never carries the
897
+ distinction at 6px. */
898
+ .session-item .session-processing.other,
899
+ .mate-session-item .session-processing.other {
900
+ background: transparent;
901
+ border: 1.5px solid var(--activity-other, #B77BF3);
902
+ box-sizing: border-box;
903
+ }
904
+ /* Alert tone (lr-66c118): unread activity wins over processing green. */
905
+ .session-item .session-processing.alert,
906
+ .mate-session-item .session-processing.alert {
907
+ background: var(--danger, #e74c3c);
908
+ }
909
+
895
910
  /* Session unread badge */
896
911
  .session-unread-badge {
897
912
  position: absolute;
@@ -580,6 +580,14 @@
580
580
  line-height: 1;
581
581
  }
582
582
 
583
+ /* lr-872f94: vendor-reported rate-limit usedPercent, shown in the pill
584
+ itself alongside the label (previously only in the transient popover). */
585
+ .header-pill-pct {
586
+ line-height: 1;
587
+ font-weight: 700;
588
+ opacity: 0.75;
589
+ }
590
+
583
591
  /* Rate limit wrapper for popover positioning */
584
592
  .header-rate-limit-wrap {
585
593
  position: relative;
@@ -666,7 +674,8 @@
666
674
 
667
675
  /* Hide pills on very narrow screens */
668
676
  @media (max-width: 400px) {
669
- .header-pill-text { display: none; }
677
+ .header-pill-text,
678
+ .header-pill-pct { display: none; }
670
679
  .header-rate-limit,
671
680
  .header-fast-mode { padding: 3px; }
672
681
  .rate-limit-popover { font-size: 11px; padding: 6px 10px; }
@@ -373,6 +373,7 @@
373
373
  <div class="usage-row"><span class="usage-label">Used</span><span id="context-used" class="usage-value">-</span></div>
374
374
  <div class="usage-row"><span class="usage-label">Window</span><span id="context-window" class="usage-value">-</span></div>
375
375
  <div class="usage-row"><span class="usage-label">Max output</span><span id="context-max-output" class="usage-value">-</span></div>
376
+ <div class="usage-row hidden"><span class="usage-label">Reasoning</span><span id="context-reasoning" class="usage-value">-</span></div>
376
377
  <div class="usage-divider"></div>
377
378
  <div class="usage-section-label">Model</div>
378
379
  <div class="usage-row"><span class="usage-label">Name</span><span id="context-model" class="usage-value">-</span></div>
@@ -1420,11 +1421,17 @@
1420
1421
  <label class="settings-label" for="settings-mem-available-min">Min available memory (MB)</label>
1421
1422
  <div class="settings-hint">Minimum system memory required to start a new session. Increase if you experience OOM restarts.</div>
1422
1423
  <input type="number" id="settings-mem-available-min" class="settings-budget-input" min="0" max="65536" step="128" value="1024" style="margin-top: 8px; width: 120px;">
1424
+ <div class="settings-hint" id="settings-mem-available-min-default-note" style="margin-top: 4px;"></div>
1423
1425
  </div>
1424
1426
  <div class="settings-field" style="margin-top: 16px;">
1425
1427
  <label class="settings-label" for="settings-tokens-per-mb-headroom">Context tokens per MB headroom</label>
1426
- <div class="settings-hint">Controls how large a session's context can grow relative to available cgroup memory. Lower = more conservative. Default (67) is calibrated for claude-opus-4 at 1M context.</div>
1427
- <input type="number" id="settings-tokens-per-mb-headroom" class="settings-budget-input" min="10" max="500" step="1" value="67" style="margin-top: 8px; width: 120px;">
1428
+ <div class="settings-hint">Controls how large a session's context can grow relative to available cgroup memory. Lower = more conservative. Default (240) is derived from this daemon's own observed cgroup memory.peak against a confirmed large-session token count (lr-93e3c8) -- not a fixed model assumption.</div>
1429
+ <input type="number" id="settings-tokens-per-mb-headroom" class="settings-budget-input" min="10" max="500" step="1" value="240" style="margin-top: 8px; width: 120px;">
1430
+ <div class="settings-hint" id="settings-tokens-per-mb-headroom-default-note" style="margin-top: 4px;"></div>
1431
+ </div>
1432
+ <div class="ps-textarea-actions" style="margin-top: 8px;">
1433
+ <button class="settings-btn-sm" id="ss-memory-save-btn">Save</button>
1434
+ <span class="ps-save-status" id="ss-memory-save-status"></span>
1428
1435
  </div>
1429
1436
  </div>
1430
1437
  </div>