@clagentic/console 1.2.0-beta.2 → 1.2.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.
- package/lib/daemon.js +22 -34
- package/lib/project-filesystem.js +9 -0
- package/lib/project-memory.js +2 -3
- package/lib/project.js +19 -1
- package/lib/public/emoji-data.json +1 -1
- package/lib/public/modules/app-messages.js +22 -16
- package/lib/public/modules/app-rendering.js +13 -3
- package/lib/public/modules/app-skills-install.js +1 -5
- package/lib/public/modules/emoji-picker.js +1 -0
- package/lib/public/modules/mention.js +1 -1
- package/lib/sessions.js +30 -6
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { getWs } from './ws-ref.js';
|
|
|
8
8
|
// --- Leaf module imports ---
|
|
9
9
|
import { showToast } from './utils.js';
|
|
10
10
|
import { refreshIcons, iconHtml } from './icons.js';
|
|
11
|
-
import { renderMarkdown, highlightCodeBlocks, renderMermaidBlocks } from './markdown.js';
|
|
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
14
|
import { updateDmBadge, renderSidebarPresence, setMentionActive, renderUserStrip } from './sidebar-users.js';
|
|
@@ -88,29 +88,35 @@ export function processMessage(msg) {
|
|
|
88
88
|
var nav = getPendingNavigate();
|
|
89
89
|
var hasNavTarget = nav && (nav.toolId || nav.assistantUuid);
|
|
90
90
|
if (!hasNavTarget) {
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
//
|
|
91
|
+
// Scale the quiet window with history depth. A 20-item threshold
|
|
92
|
+
// (old code) gave identical 2000ms to sessions with 21 and 1000
|
|
93
|
+
// items. The scaled formula gives fast disarm for small sessions
|
|
94
|
+
// and up to 3000ms for very large ones (≥500 events), without
|
|
95
|
+
// a hard ceiling that cuts off still-settling content on mobile.
|
|
94
96
|
var historyLen = store.get('historyTotal') || 0;
|
|
95
|
-
var quietMs = historyLen
|
|
97
|
+
var quietMs = Math.min(Math.max(500, Math.round(historyLen * 2.5)), 3000);
|
|
96
98
|
armStickyBottom(quietMs, true); // force: history replay must scroll to bottom
|
|
97
99
|
}
|
|
98
100
|
// Batched syntax highlight + mermaid pass for the entire replayed
|
|
99
101
|
// transcript. Per-message highlights are skipped during replay
|
|
100
|
-
// (see markdown.js)
|
|
101
|
-
//
|
|
102
|
+
// (see markdown.js). Uses requestIdleCallback batching to avoid
|
|
103
|
+
// blocking the main thread — the old synchronous highlightCodeBlocks()
|
|
104
|
+
// fired hljs on every code block at once, each triggering a
|
|
105
|
+
// ResizeObserver callback that reset the sticky-bottom quiet timer,
|
|
106
|
+
// keeping the scroll pinned and the UI unresponsive for several
|
|
107
|
+
// seconds on large sessions (especially on mobile). The completion
|
|
108
|
+
// callback re-arms once after all blocks are done.
|
|
102
109
|
if (messagesEl) {
|
|
103
|
-
|
|
104
|
-
renderMermaidBlocks(messagesEl);
|
|
105
|
-
// Re-arm after highlight batch completes — Highlight.js defers work
|
|
106
|
-
// via requestAnimationFrame, so the actual DOM updates may happen
|
|
107
|
-
// after the synchronous call returns. This re-arm catches the deferred
|
|
108
|
-
// work on slow browsers.
|
|
109
|
-
setTimeout(function () {
|
|
110
|
+
highlightCodeBlocksBatched(messagesEl, function () {
|
|
110
111
|
if (!store.get('processing')) {
|
|
111
|
-
armStickyBottom(500, true); // force:
|
|
112
|
+
armStickyBottom(500, true); // force: re-pin after all blocks settle
|
|
112
113
|
}
|
|
113
|
-
}
|
|
114
|
+
});
|
|
115
|
+
renderMermaidBlocks(messagesEl);
|
|
116
|
+
// NOTE: The old 300ms setTimeout re-arm is removed. The batched
|
|
117
|
+
// highlight completion callback above replaces it. The 300ms timer
|
|
118
|
+
// was a workaround for Highlight.js deferred work that no longer
|
|
119
|
+
// applies with the idle-callback batching path.
|
|
114
120
|
}
|
|
115
121
|
// Compact dead-session todo widgets (unfinished items will never
|
|
116
122
|
// resolve — the agent isn't coming back) so they don't anchor
|
|
@@ -423,6 +423,11 @@ export function finalizeAssistantBlock() {
|
|
|
423
423
|
flushStreamBuffer();
|
|
424
424
|
var msgEl = store.get('currentMsgEl');
|
|
425
425
|
var textToRender = currentFullTextLocal;
|
|
426
|
+
// Capture replay state synchronously before any async work — by the time
|
|
427
|
+
// the async callback fires, replayingHistory may have already been cleared
|
|
428
|
+
// by history_done. wasReplaying lets the callback know not to arm
|
|
429
|
+
// sticky-bottom (history_done owns that arm during replay).
|
|
430
|
+
var wasReplaying = store.get('replayingHistory');
|
|
426
431
|
|
|
427
432
|
// Clear state before async work — subsequent messages must not inherit
|
|
428
433
|
// this block's el or text.
|
|
@@ -441,9 +446,14 @@ export function finalizeAssistantBlock() {
|
|
|
441
446
|
contentEl.innerHTML = html;
|
|
442
447
|
highlightCodeBlocks(contentEl);
|
|
443
448
|
renderMermaidBlocks(contentEl);
|
|
444
|
-
//
|
|
445
|
-
//
|
|
446
|
-
|
|
449
|
+
// Only re-arm sticky-bottom for live turns. During replay,
|
|
450
|
+
// history_done owns the sticky-bottom arm. Per-turn arms from
|
|
451
|
+
// replayed finalizeAssistantBlock callbacks keep extending the
|
|
452
|
+
// quiet window after history is done, leaving the user scroll-
|
|
453
|
+
// pinned for several extra seconds on large sessions.
|
|
454
|
+
if (!wasReplaying) {
|
|
455
|
+
armStickyBottom(500);
|
|
456
|
+
}
|
|
447
457
|
}
|
|
448
458
|
}, 0);
|
|
449
459
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// app-skills-install.js - Skill install dialog, requireSkills
|
|
1
|
+
// app-skills-install.js - Skill install dialog, requireSkills
|
|
2
2
|
// Extracted from app.js (PR-33)
|
|
3
3
|
|
|
4
4
|
import { refreshIcons, iconHtml } from './icons.js';
|
|
@@ -279,7 +279,3 @@ export function requireSkills(opts, cb) {
|
|
|
279
279
|
})
|
|
280
280
|
.catch(function () { cb(); });
|
|
281
281
|
}
|
|
282
|
-
|
|
283
|
-
export function requireClayMateInterview(cb) {
|
|
284
|
-
if (cb) cb();
|
|
285
|
-
}
|
|
@@ -6,6 +6,7 @@ import { parseEmojis } from './markdown.js';
|
|
|
6
6
|
// Group metadata matching emojibase-data group numbers
|
|
7
7
|
var GROUP_META = [
|
|
8
8
|
{ g: 0, icon: "😀", label: "Smileys & Emotion" },
|
|
9
|
+
{ g: 1, icon: "🧑", label: "People & Body" },
|
|
9
10
|
{ g: 3, icon: "🐻", label: "Animals & Nature" },
|
|
10
11
|
{ g: 4, icon: "🍔", label: "Food & Drink" },
|
|
11
12
|
{ g: 5, icon: "🚗", label: "Travel & Places" },
|
|
@@ -143,7 +143,7 @@ function buildMentionCandidates() {
|
|
|
143
143
|
|
|
144
144
|
var candidates = [];
|
|
145
145
|
|
|
146
|
-
// Plain vendor mentions (always available
|
|
146
|
+
// Plain vendor mentions (always available).
|
|
147
147
|
// Hide the plain entry that matches the current session's vendor: there is
|
|
148
148
|
// no point asking Claude for a second opinion while you are already in a
|
|
149
149
|
// Claude session, and likewise for Codex.
|
package/lib/sessions.js
CHANGED
|
@@ -460,11 +460,32 @@ function createSessionManager(opts) {
|
|
|
460
460
|
// scroll-up via the existing pagination path.
|
|
461
461
|
var HISTORY_PAGE_SIZE = 100;
|
|
462
462
|
|
|
463
|
+
// Scan backward from the END of history (hard-capped at HISTORY_PAGE_SIZE) to
|
|
464
|
+
// find the most recent user_message. This ensures the initial replay window
|
|
465
|
+
// always starts at a clean turn boundary rather than mid-stream, regardless of
|
|
466
|
+
// how large the most recent turn is. For a session whose last user_message is
|
|
467
|
+
// at index N near the end, this returns N → typically ~10-100 events replayed
|
|
468
|
+
// instead of thousands.
|
|
469
|
+
function findLastTurnStart(history) {
|
|
470
|
+
var searchFloor = Math.max(0, history.length - HISTORY_PAGE_SIZE);
|
|
471
|
+
for (var i = history.length - 1; i >= searchFloor; i--) {
|
|
472
|
+
if (history[i] && history[i].type === "user_message") return i;
|
|
473
|
+
}
|
|
474
|
+
// No turn boundary found within the window — hard-cap at searchFloor.
|
|
475
|
+
return searchFloor;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// Scan backward from targetIndex (capped at HISTORY_PAGE_SIZE below it) to find
|
|
479
|
+
// the nearest user_message turn boundary. Used by load_more_history scroll-up
|
|
480
|
+
// pagination to align the prepended page to a clean turn start. Falls back to
|
|
481
|
+
// targetIndex if no boundary is found within the window — a partial turn at
|
|
482
|
+
// the top is preferable to an unbounded backward scan.
|
|
463
483
|
function findTurnBoundary(history, targetIndex) {
|
|
464
|
-
|
|
484
|
+
var searchFloor = Math.max(0, targetIndex - HISTORY_PAGE_SIZE);
|
|
485
|
+
for (var i = targetIndex; i >= searchFloor; i--) {
|
|
465
486
|
if (history[i] && history[i].type === "user_message") return i;
|
|
466
487
|
}
|
|
467
|
-
return
|
|
488
|
+
return targetIndex;
|
|
468
489
|
}
|
|
469
490
|
|
|
470
491
|
function replayHistory(session, fromIndex, targetWs, transform) {
|
|
@@ -477,7 +498,12 @@ function createSessionManager(opts) {
|
|
|
477
498
|
if (total <= HISTORY_PAGE_SIZE) {
|
|
478
499
|
fromIndex = 0;
|
|
479
500
|
} else {
|
|
480
|
-
|
|
501
|
+
// Start from the most recent complete turn within the PAGE_SIZE window.
|
|
502
|
+
// max() ensures we never go past the hard floor even if the last turn
|
|
503
|
+
// start somehow lands below it.
|
|
504
|
+
var hardFloor = Math.max(0, total - HISTORY_PAGE_SIZE);
|
|
505
|
+
var lastTurn = findLastTurnStart(session.history);
|
|
506
|
+
fromIndex = Math.max(hardFloor, lastTurn);
|
|
481
507
|
}
|
|
482
508
|
}
|
|
483
509
|
|
|
@@ -487,9 +513,6 @@ function createSessionManager(opts) {
|
|
|
487
513
|
var _item = session.history[i];
|
|
488
514
|
// Skip internal bookkeeping entries not meant for the UI
|
|
489
515
|
if (_item && _item.type === "digest_checkpoint") continue;
|
|
490
|
-
if (_item && (_item.type === "mention_user" || _item.type === "mention_response")) {
|
|
491
|
-
console.log("[DEBUG replayHistory] sending mention at index=" + i + " from=" + fromIndex + " total=" + total + " type=" + _item.type + " mate=" + (_item.mateName || ""));
|
|
492
|
-
}
|
|
493
516
|
_send(transform ? transform(_item) : _item);
|
|
494
517
|
}
|
|
495
518
|
|
|
@@ -1087,6 +1110,7 @@ function createSessionManager(opts) {
|
|
|
1087
1110
|
sendAndRecord: doSendAndRecord,
|
|
1088
1111
|
sendToSession: doSendToSession,
|
|
1089
1112
|
findTurnBoundary: findTurnBoundary,
|
|
1113
|
+
findLastTurnStart: findLastTurnStart,
|
|
1090
1114
|
replayHistory: replayHistory,
|
|
1091
1115
|
searchSessions: searchSessions,
|
|
1092
1116
|
searchSessionContent: searchSessionContent,
|
package/package.json
CHANGED