@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.
- package/bin/cli.js +23 -1
- package/lib/agents.js +13 -3
- package/lib/build-sha.json +2 -2
- package/lib/cli/ipc-subcommands.js +84 -4
- package/lib/daemon.js +111 -7
- package/lib/effective-protocol.js +82 -0
- package/lib/project-connection.js +21 -8
- package/lib/project-filesystem.js +4 -4
- package/lib/project-http.js +4 -4
- package/lib/project-loop.js +49 -5
- package/lib/project-sessions.js +166 -68
- package/lib/project-user-mention.js +7 -7
- package/lib/project-user-message.js +81 -14
- package/lib/project.js +28 -22
- package/lib/public/app.js +18 -4
- package/lib/public/css/base.css +14 -0
- package/lib/public/css/filebrowser.css +6 -0
- package/lib/public/css/home-hub.css +28 -8
- package/lib/public/css/icon-strip.css +17 -0
- package/lib/public/css/messages.css +11 -0
- package/lib/public/css/mobile-nav.css +22 -0
- package/lib/public/css/server-settings.css +9 -0
- package/lib/public/css/sidebar.css +15 -0
- package/lib/public/css/title-bar.css +10 -1
- package/lib/public/index.html +9 -2
- package/lib/public/modules/activity-latch.js +45 -0
- package/lib/public/modules/activity-state.js +195 -0
- package/lib/public/modules/app-connection.js +31 -6
- package/lib/public/modules/app-favicon.js +75 -1
- package/lib/public/modules/app-home-hub.js +14 -11
- package/lib/public/modules/app-loop-ui.js +86 -2
- package/lib/public/modules/app-messages.js +178 -54
- package/lib/public/modules/app-panels.js +91 -32
- package/lib/public/modules/app-projects.js +46 -9
- package/lib/public/modules/app-rate-limit.js +13 -1
- package/lib/public/modules/server-settings.js +256 -21
- package/lib/public/modules/sidebar-mobile.js +32 -22
- package/lib/public/modules/sidebar-projects.js +42 -14
- package/lib/public/modules/sidebar-sessions.js +168 -48
- package/lib/public/modules/theme.js +2 -2
- package/lib/public/modules/tools.js +11 -39
- package/lib/sdk-bridge.js +375 -33
- package/lib/sdk-message-processor.js +98 -15
- package/lib/sdk-skill-discovery.js +46 -6
- package/lib/sdk-slash-enrichment.js +5 -2
- package/lib/server-dm.js +5 -5
- package/lib/server-hub-sessions.js +70 -0
- package/lib/server.js +78 -43
- package/lib/session-activity.js +9 -2
- package/lib/sessions.js +64 -18
- package/lib/smtp.js +10 -1
- package/lib/terminal-manager.js +6 -6
- package/lib/ws-schema.js +16 -0
- package/lib/yoke/adapters/claude.js +7 -1
- package/lib/yoke/adapters/codex.js +219 -31
- package/package.json +2 -2
- package/scripts/check-test-count.js +397 -0
- package/scripts/test-file-completion-reporter.js +43 -0
- package/scripts/verify-installed-build.js +242 -15
- package/lib/model-context-windows.js +0 -74
- package/lib/public/modules/model-context-windows.js +0 -71
|
@@ -16,6 +16,7 @@ import { showIconTooltip, hideIconTooltip, closeUserCtxMenu, getCurrentDmUserId
|
|
|
16
16
|
import { switchProject, openAddProjectModal, getCachedProjects } from './app-projects.js';
|
|
17
17
|
import { openAgentPickerForPreferred } from './agent-picker.js';
|
|
18
18
|
import { showHomeHub } from './app-home-hub.js';
|
|
19
|
+
import { sessionActivity, rollupActivity, indicatorClass } from './activity-state.js';
|
|
19
20
|
|
|
20
21
|
// --- Project state ---
|
|
21
22
|
var cachedProjectList = [];
|
|
@@ -1316,7 +1317,14 @@ function generateFolderName(existingFolderNames) {
|
|
|
1316
1317
|
|
|
1317
1318
|
// --- Icon item creation ---
|
|
1318
1319
|
|
|
1319
|
-
|
|
1320
|
+
// activityOverride (optional): a raw project/rollup-shaped object to derive
|
|
1321
|
+
// the dot from INSTEAD of p itself, without mutating p — see
|
|
1322
|
+
// renderWorktreeGroup, which used to fold worktree processing state directly
|
|
1323
|
+
// onto the shared project object in place (lr-66c118; same disease as the
|
|
1324
|
+
// July phantom-badge bug, engram 7574673: a later read of p could no longer
|
|
1325
|
+
// distinguish "this project is processing" from "some worktree was
|
|
1326
|
+
// processing at last render").
|
|
1327
|
+
function createIconItem(p, currentSlug, activityOverride) {
|
|
1320
1328
|
var currentDmUserId = getCurrentDmUserId ? getCurrentDmUserId() : null;
|
|
1321
1329
|
var el = document.createElement("a");
|
|
1322
1330
|
var isActive = p.slug === currentSlug && !currentDmUserId;
|
|
@@ -1339,7 +1347,12 @@ function createIconItem(p, currentSlug) {
|
|
|
1339
1347
|
|
|
1340
1348
|
var statusDot = document.createElement("span");
|
|
1341
1349
|
statusDot.className = "icon-strip-status";
|
|
1342
|
-
|
|
1350
|
+
// lr-66c118: project-level dot — only ever a processing/idle signal, never
|
|
1351
|
+
// alert (the project unread badge below owns that affordance) — ignoreUnread
|
|
1352
|
+
// so sessionActivity never derives an 'alert' tone here even though p (or
|
|
1353
|
+
// activityOverride) carries .unread for the badge above/below.
|
|
1354
|
+
var pActivityCls = indicatorClass(sessionActivity(activityOverride || p, null, { ignoreUnread: true }));
|
|
1355
|
+
if (pActivityCls) statusDot.classList.add(pActivityCls);
|
|
1343
1356
|
el.appendChild(statusDot);
|
|
1344
1357
|
|
|
1345
1358
|
var projectBadge = document.createElement("span");
|
|
@@ -1616,21 +1629,26 @@ function renderUserFolder(unit, wtByParent, currentSlug, currentDmUserId) {
|
|
|
1616
1629
|
|
|
1617
1630
|
// Aggregate state: unread sum, processing, active
|
|
1618
1631
|
var totalUnread = 0;
|
|
1619
|
-
var
|
|
1632
|
+
var folderActivityItems = [];
|
|
1620
1633
|
var containsActive = false;
|
|
1621
1634
|
for (var fi = 0; fi < folderProjects.length; fi++) {
|
|
1622
1635
|
var fp = folderProjects[fi];
|
|
1623
1636
|
totalUnread += fp.unread || 0;
|
|
1624
|
-
|
|
1637
|
+
folderActivityItems.push(fp);
|
|
1625
1638
|
if (fp.slug === currentSlug) containsActive = true;
|
|
1626
1639
|
// Also check worktrees
|
|
1627
1640
|
var fwt = wtByParent[fp.slug] || [];
|
|
1628
1641
|
for (var fwi = 0; fwi < fwt.length; fwi++) {
|
|
1629
1642
|
totalUnread += fwt[fwi].unread || 0;
|
|
1630
|
-
|
|
1643
|
+
folderActivityItems.push(fwt[fwi]);
|
|
1631
1644
|
if (fwt[fwi].slug === currentSlug) containsActive = true;
|
|
1632
1645
|
}
|
|
1633
1646
|
}
|
|
1647
|
+
// lr-66c118: replaces the open-coded anyProcessing OR-loop above. Project
|
|
1648
|
+
// dots never carry alert tone (see createIconItem) — ignoreUnread so this
|
|
1649
|
+
// stays isProcessing-only, matching, even though the raw items carry
|
|
1650
|
+
// .unread for totalUnread above.
|
|
1651
|
+
var folderActivityCls = indicatorClass(rollupActivity(folderActivityItems, null, { ignoreUnread: true }));
|
|
1634
1652
|
|
|
1635
1653
|
var folderEl = document.createElement("div");
|
|
1636
1654
|
folderEl.className = "icon-strip-folder" + (isCollapsed ? " collapsed" : "") + (containsActive && isCollapsed ? " contains-active" : "");
|
|
@@ -1668,7 +1686,7 @@ function renderUserFolder(unit, wtByParent, currentSlug, currentDmUserId) {
|
|
|
1668
1686
|
// Processing dot
|
|
1669
1687
|
var fStatusDot = document.createElement("span");
|
|
1670
1688
|
fStatusDot.className = "icon-strip-status";
|
|
1671
|
-
if (
|
|
1689
|
+
if (folderActivityCls) fStatusDot.classList.add(folderActivityCls);
|
|
1672
1690
|
headerEl.appendChild(fStatusDot);
|
|
1673
1691
|
|
|
1674
1692
|
// Unread badge
|
|
@@ -1822,13 +1840,21 @@ function renderWorktreeGroup(p, worktrees, currentSlug, currentDmUserId) {
|
|
|
1822
1840
|
folder.dataset.parentSlug = p.slug;
|
|
1823
1841
|
if (wtCollapsed[p.slug]) folder.classList.add("collapsed");
|
|
1824
1842
|
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1843
|
+
// lr-66c118: replaces the prior in-place mutation of the shared project
|
|
1844
|
+
// object's processing flag (see createIconItem's activityOverride doc
|
|
1845
|
+
// comment for why that was wrong). activityOverride carries whichever raw
|
|
1846
|
+
// item (parent or a worktree) is the rollup's own winner, so
|
|
1847
|
+
// createIconItem's own sessionActivity() call still does the real
|
|
1848
|
+
// derivation — no double-derivation, no raw property read here.
|
|
1849
|
+
var worktreeGroupItems = [p].concat(worktrees);
|
|
1850
|
+
var worktreeWinner = worktreeGroupItems[0];
|
|
1851
|
+
for (var wpi = 1; wpi < worktreeGroupItems.length; wpi++) {
|
|
1852
|
+
if (sessionActivity(worktreeGroupItems[wpi], null, { ignoreUnread: true }).active) {
|
|
1853
|
+
worktreeWinner = worktreeGroupItems[wpi];
|
|
1854
|
+
break;
|
|
1828
1855
|
}
|
|
1829
1856
|
}
|
|
1830
|
-
|
|
1831
|
-
var header = createIconItem(p, currentSlug);
|
|
1857
|
+
var header = createIconItem(p, currentSlug, worktreeWinner);
|
|
1832
1858
|
header.classList.add("folder-header");
|
|
1833
1859
|
(function (slug, name, elem) {
|
|
1834
1860
|
elem.addEventListener("contextmenu", function (e) {
|
|
@@ -1884,7 +1910,8 @@ function renderWorktreeGroup(p, worktrees, currentSlug, currentDmUserId) {
|
|
|
1884
1910
|
|
|
1885
1911
|
var wtStatus = document.createElement("span");
|
|
1886
1912
|
wtStatus.className = "icon-strip-status";
|
|
1887
|
-
|
|
1913
|
+
var wtActivityCls = indicatorClass(sessionActivity(wt, null, { ignoreUnread: true }));
|
|
1914
|
+
if (wtActivityCls) wtStatus.classList.add(wtActivityCls);
|
|
1888
1915
|
wtEl.appendChild(wtStatus);
|
|
1889
1916
|
|
|
1890
1917
|
var tooltipText = wt.name;
|
|
@@ -2020,9 +2047,10 @@ function createMobileProjectItem(p, currentSlug, isWorktree) {
|
|
|
2020
2047
|
name.textContent = p.name;
|
|
2021
2048
|
el.appendChild(name);
|
|
2022
2049
|
|
|
2023
|
-
|
|
2050
|
+
var mProjActivityCls = indicatorClass(sessionActivity(p, null, { ignoreUnread: true }));
|
|
2051
|
+
if (mProjActivityCls) {
|
|
2024
2052
|
var dot = document.createElement("span");
|
|
2025
|
-
dot.className = "mobile-project-processing";
|
|
2053
|
+
dot.className = "mobile-project-processing " + mProjActivityCls;
|
|
2026
2054
|
el.appendChild(dot);
|
|
2027
2055
|
}
|
|
2028
2056
|
|
|
@@ -15,6 +15,7 @@ import { refreshMobileChatSheet } from './sidebar-mobile.js';
|
|
|
15
15
|
import { openAgentPicker, openAgentPickerForPreferred } from './agent-picker.js';
|
|
16
16
|
import { getCachedProjects } from './app-projects.js';
|
|
17
17
|
import { positionPopover } from './popover-position.js';
|
|
18
|
+
import { sessionActivity, rollupActivity, indicatorClass } from './activity-state.js';
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
// --- Session state ---
|
|
@@ -52,12 +53,23 @@ var armedDeleteTimer = null;
|
|
|
52
53
|
|
|
53
54
|
// Active inline-rename tracking (session or loop). A full session-list
|
|
54
55
|
// rebuild (innerHTML = "") detaches the rename <input> from the DOM without
|
|
55
|
-
// firing a real user "blur" — the browser
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
|
|
56
|
+
// firing a real user "blur" — but the browser DOES synthesize a blur event
|
|
57
|
+
// on detach, and the input's own blur listener is still attached at that
|
|
58
|
+
// instant. Committing on every rebuild (the original design here) turned
|
|
59
|
+
// out to be wrong: an actively-streaming session broadcasts session_list
|
|
60
|
+
// many times per turn, so the rename committed within a keystroke or two,
|
|
61
|
+
// sending a partial title as a real rename_session (durable write +
|
|
62
|
+
// permanent titleManuallySet=true — see lr-16b88d). `suspend()` captures
|
|
63
|
+
// the in-progress edit (value + caret) AND settles it as suspended (same
|
|
64
|
+
// short-circuit `settled` flag commit/cancel use) — no commit, no cancel,
|
|
65
|
+
// no WS send — so the detach-induced synthetic blur that fires the instant
|
|
66
|
+
// the rebuild's innerHTML="" runs is a no-op on the old input. renderSessionList
|
|
67
|
+
// then reassigns activeRename to null and, if a real rebuild ran, re-opens
|
|
68
|
+
// the rename afterward with the captured snapshot (see the suspendedRename
|
|
69
|
+
// re-open block at the end of renderSessionList). Precedent: scheduler.js's
|
|
70
|
+
// `cancelled` short-circuit flag / detach-as-blur handling (lr-fb49-E/F
|
|
71
|
+
// family) — suspend() is that same pattern applied to preserve-not-drop.
|
|
72
|
+
var activeRename = null; // { type, id, currentTitle, commit, cancel, suspend } or null
|
|
61
73
|
|
|
62
74
|
export function openResumePicker() {
|
|
63
75
|
openResumePickerModal();
|
|
@@ -746,40 +758,61 @@ function showLoopCtxMenu(anchorBtn, loopId, loopName, childCount) {
|
|
|
746
758
|
|
|
747
759
|
// --- Inline rename ---
|
|
748
760
|
|
|
749
|
-
|
|
761
|
+
// resume: optional { value, selectionStart, selectionEnd } captured by a
|
|
762
|
+
// prior suspend() — restores the in-progress edit instead of starting fresh
|
|
763
|
+
// from currentTitle. Passed by renderSessionList() when re-opening a rename
|
|
764
|
+
// after a real rebuild tore the previous <input> down.
|
|
765
|
+
//
|
|
766
|
+
// LIFECYCLE GUARD (lr-16b88d PEACHES finding): `settled` alone is not
|
|
767
|
+
// enough once suspend() exists. A rebuild's innerHTML="" detaches this
|
|
768
|
+
// <input> without a real user blur, but the browser still SYNTHESIZES a
|
|
769
|
+
// blur event on detach — and that listener (registered below) is still
|
|
770
|
+
// attached at that moment. Without a guard, that synthetic blur fires
|
|
771
|
+
// commitRename() and ships the suspended partial edit as a real
|
|
772
|
+
// rename_session, exactly the bug this task exists to fix. suspend() must
|
|
773
|
+
// therefore flip `settled` itself (same short-circuit commit/cancel use),
|
|
774
|
+
// so the detach-induced blur that fires immediately afterward is a no-op —
|
|
775
|
+
// mirrors scheduler.js:609-621's `cancelled` short-circuit / detach-as-blur
|
|
776
|
+
// precedent.
|
|
777
|
+
function startInlineRename(sessionId, currentTitle, resume) {
|
|
750
778
|
var el = getSessionListEl().querySelector('.session-item[data-session-id="' + sessionId + '"]');
|
|
751
779
|
if (!el) return;
|
|
752
780
|
var textSpan = el.querySelector(".session-item-text");
|
|
753
781
|
if (!textSpan) return;
|
|
754
782
|
|
|
755
783
|
// Settle (not silently drop) any rename already in progress elsewhere in
|
|
756
|
-
// the list before starting a new one.
|
|
784
|
+
// the list before starting a new one. This is a real user-driven "start a
|
|
785
|
+
// different rename" action, not a rebuild-induced detach — commit here is
|
|
786
|
+
// correct (matches existing blur-to-commit semantics for switching target).
|
|
757
787
|
if (activeRename) activeRename.commit();
|
|
758
788
|
|
|
759
789
|
var input = document.createElement("input");
|
|
760
790
|
input.type = "text";
|
|
761
791
|
input.className = "session-rename-input";
|
|
762
|
-
input.value = currentTitle || "New Session";
|
|
792
|
+
input.value = resume ? resume.value : (currentTitle || "New Session");
|
|
763
793
|
|
|
764
794
|
var originalHtml = textSpan.innerHTML;
|
|
765
795
|
textSpan.innerHTML = "";
|
|
766
796
|
textSpan.appendChild(input);
|
|
767
797
|
input.focus();
|
|
768
|
-
|
|
798
|
+
if (resume) {
|
|
799
|
+
input.setSelectionRange(resume.selectionStart, resume.selectionEnd);
|
|
800
|
+
} else {
|
|
801
|
+
input.select();
|
|
802
|
+
}
|
|
769
803
|
|
|
770
804
|
var settled = false;
|
|
771
805
|
|
|
772
806
|
function commitRename() {
|
|
773
807
|
if (settled) return;
|
|
774
808
|
settled = true;
|
|
775
|
-
activeRename = null;
|
|
809
|
+
if (activeRename && activeRename.commit === commitRename) activeRename = null;
|
|
776
810
|
var newTitle = input.value.trim();
|
|
777
811
|
if (newTitle && newTitle !== currentTitle && getWs() && store.get('connected')) {
|
|
778
812
|
getWs().send(JSON.stringify({ type: "rename_session", id: sessionId, title: newTitle }));
|
|
779
813
|
}
|
|
780
814
|
// Restore text (server will send updated session_list). Guard against the
|
|
781
|
-
// textSpan already having been detached/replaced by a rebuild
|
|
782
|
-
// this same settle path via activeRename.commit() at its top.
|
|
815
|
+
// textSpan already having been detached/replaced by a rebuild.
|
|
783
816
|
if (getSessionListEl().contains(textSpan)) {
|
|
784
817
|
textSpan.innerHTML = originalHtml;
|
|
785
818
|
if (newTitle && newTitle !== currentTitle) {
|
|
@@ -791,10 +824,23 @@ function startInlineRename(sessionId, currentTitle) {
|
|
|
791
824
|
function cancelRename() {
|
|
792
825
|
if (settled) return;
|
|
793
826
|
settled = true;
|
|
794
|
-
activeRename = null;
|
|
827
|
+
if (activeRename && activeRename.commit === commitRename) activeRename = null;
|
|
795
828
|
if (getSessionListEl().contains(textSpan)) textSpan.innerHTML = originalHtml;
|
|
796
829
|
}
|
|
797
830
|
|
|
831
|
+
// Capture the live edit AND settle it as suspended — no commit, no cancel,
|
|
832
|
+
// no WS send, but `settled` flips to true so the synthetic blur the
|
|
833
|
+
// upcoming innerHTML="" teardown fires against this exact input becomes a
|
|
834
|
+
// no-op (see the LIFECYCLE GUARD comment above). Does not clear
|
|
835
|
+
// module-level `activeRename` itself — the caller (renderSessionList)
|
|
836
|
+
// owns reassigning that slot once it knows whether a real rebuild ran and,
|
|
837
|
+
// if so, once the re-opened rename has installed its own activeRename.
|
|
838
|
+
function suspendRename() {
|
|
839
|
+
if (settled) return null;
|
|
840
|
+
settled = true;
|
|
841
|
+
return { value: input.value, selectionStart: input.selectionStart, selectionEnd: input.selectionEnd };
|
|
842
|
+
}
|
|
843
|
+
|
|
798
844
|
input.addEventListener("keydown", function (e) {
|
|
799
845
|
if (e.key === "Enter") { e.preventDefault(); commitRename(); }
|
|
800
846
|
if (e.key === "Escape") { e.preventDefault(); cancelRename(); }
|
|
@@ -802,10 +848,19 @@ function startInlineRename(sessionId, currentTitle) {
|
|
|
802
848
|
input.addEventListener("blur", commitRename);
|
|
803
849
|
input.addEventListener("click", function (e) { e.stopPropagation(); });
|
|
804
850
|
|
|
805
|
-
activeRename = {
|
|
851
|
+
activeRename = {
|
|
852
|
+
type: "session",
|
|
853
|
+
id: sessionId,
|
|
854
|
+
currentTitle: currentTitle,
|
|
855
|
+
commit: commitRename,
|
|
856
|
+
cancel: cancelRename,
|
|
857
|
+
suspend: suspendRename,
|
|
858
|
+
};
|
|
806
859
|
}
|
|
807
860
|
|
|
808
|
-
|
|
861
|
+
// resume: see startInlineRename's matching parameter. See startInlineRename's
|
|
862
|
+
// LIFECYCLE GUARD comment — identical reasoning applies here.
|
|
863
|
+
function startLoopInlineRename(loopId, currentName, resume) {
|
|
809
864
|
var el = getSessionListEl().querySelector('.session-loop-group[data-loop-id="' + loopId + '"]');
|
|
810
865
|
if (!el) return;
|
|
811
866
|
var textSpan = el.querySelector(".session-item-text");
|
|
@@ -816,20 +871,24 @@ function startLoopInlineRename(loopId, currentName) {
|
|
|
816
871
|
var input = document.createElement("input");
|
|
817
872
|
input.type = "text";
|
|
818
873
|
input.className = "session-rename-input";
|
|
819
|
-
input.value = currentName || "Loop";
|
|
874
|
+
input.value = resume ? resume.value : (currentName || "Loop");
|
|
820
875
|
|
|
821
876
|
var originalHtml = textSpan.innerHTML;
|
|
822
877
|
textSpan.innerHTML = "";
|
|
823
878
|
textSpan.appendChild(input);
|
|
824
879
|
input.focus();
|
|
825
|
-
|
|
880
|
+
if (resume) {
|
|
881
|
+
input.setSelectionRange(resume.selectionStart, resume.selectionEnd);
|
|
882
|
+
} else {
|
|
883
|
+
input.select();
|
|
884
|
+
}
|
|
826
885
|
|
|
827
886
|
var settled = false;
|
|
828
887
|
|
|
829
888
|
function commitRename() {
|
|
830
889
|
if (settled) return;
|
|
831
890
|
settled = true;
|
|
832
|
-
activeRename = null;
|
|
891
|
+
if (activeRename && activeRename.commit === commitRename) activeRename = null;
|
|
833
892
|
var newName = input.value.trim();
|
|
834
893
|
if (newName && newName !== currentName && getWs() && store.get('connected')) {
|
|
835
894
|
getWs().send(JSON.stringify({ type: "loop_registry_rename", id: loopId, name: newName }));
|
|
@@ -847,10 +906,17 @@ function startLoopInlineRename(loopId, currentName) {
|
|
|
847
906
|
function cancelRename() {
|
|
848
907
|
if (settled) return;
|
|
849
908
|
settled = true;
|
|
850
|
-
activeRename = null;
|
|
909
|
+
if (activeRename && activeRename.commit === commitRename) activeRename = null;
|
|
851
910
|
if (getSessionListEl().contains(textSpan)) textSpan.innerHTML = originalHtml;
|
|
852
911
|
}
|
|
853
912
|
|
|
913
|
+
// See startInlineRename's suspendRename — same settle-without-committing.
|
|
914
|
+
function suspendRename() {
|
|
915
|
+
if (settled) return null;
|
|
916
|
+
settled = true;
|
|
917
|
+
return { value: input.value, selectionStart: input.selectionStart, selectionEnd: input.selectionEnd };
|
|
918
|
+
}
|
|
919
|
+
|
|
854
920
|
input.addEventListener("keydown", function (e) {
|
|
855
921
|
if (e.key === "Enter") { e.preventDefault(); commitRename(); }
|
|
856
922
|
if (e.key === "Escape") { e.preventDefault(); cancelRename(); }
|
|
@@ -858,7 +924,14 @@ function startLoopInlineRename(loopId, currentName) {
|
|
|
858
924
|
input.addEventListener("blur", commitRename);
|
|
859
925
|
input.addEventListener("click", function (e) { e.stopPropagation(); });
|
|
860
926
|
|
|
861
|
-
activeRename = {
|
|
927
|
+
activeRename = {
|
|
928
|
+
type: "loop",
|
|
929
|
+
id: loopId,
|
|
930
|
+
currentTitle: currentName,
|
|
931
|
+
commit: commitRename,
|
|
932
|
+
cancel: cancelRename,
|
|
933
|
+
suspend: suspendRename,
|
|
934
|
+
};
|
|
862
935
|
}
|
|
863
936
|
|
|
864
937
|
// --- Date grouping / highlighting ---
|
|
@@ -903,8 +976,10 @@ function renderLoopChild(s) {
|
|
|
903
976
|
var textSpan = document.createElement("span");
|
|
904
977
|
textSpan.className = "session-item-text";
|
|
905
978
|
var textHtml = "";
|
|
906
|
-
|
|
907
|
-
|
|
979
|
+
var childActivityState = sessionActivity(s, store.get('myUserId'));
|
|
980
|
+
var childActivityCls = indicatorClass(childActivityState);
|
|
981
|
+
if (childActivityCls) {
|
|
982
|
+
textHtml += '<span class="session-processing ' + childActivityCls + '" title="' + escapeHtml(childActivityState.label) + '"></span>';
|
|
908
983
|
}
|
|
909
984
|
if (s.loop) {
|
|
910
985
|
var isRalphChild = s.loop.source === "ralph";
|
|
@@ -972,15 +1047,15 @@ function renderLoopGroup(loopId, children, groupKey) {
|
|
|
972
1047
|
|
|
973
1048
|
var expanded = expandedLoopGroups.has(gk);
|
|
974
1049
|
var hasActive = false;
|
|
975
|
-
var anyProcessing = false;
|
|
976
1050
|
var latestSession = visibleChildren[0];
|
|
977
1051
|
for (var ci = 0; ci < visibleChildren.length; ci++) {
|
|
978
1052
|
if (visibleChildren[ci].active) hasActive = true;
|
|
979
|
-
if (visibleChildren[ci].isProcessing) anyProcessing = true;
|
|
980
1053
|
if ((visibleChildren[ci].lastActivity || 0) > (latestSession.lastActivity || 0)) {
|
|
981
1054
|
latestSession = visibleChildren[ci];
|
|
982
1055
|
}
|
|
983
1056
|
}
|
|
1057
|
+
// lr-66c118: replaces the open-coded anyProcessing OR-loop above.
|
|
1058
|
+
var groupActivityCls = indicatorClass(rollupActivity(visibleChildren, store.get('myUserId')));
|
|
984
1059
|
|
|
985
1060
|
var loopName = (visibleChildren[0].loop && visibleChildren[0].loop.name) || "Loop";
|
|
986
1061
|
var isRalph = visibleChildren[0].loop && visibleChildren[0].loop.source === "ralph";
|
|
@@ -1020,8 +1095,8 @@ function renderLoopGroup(loopId, children, groupKey) {
|
|
|
1020
1095
|
var textSpan = document.createElement("span");
|
|
1021
1096
|
textSpan.className = "session-item-text";
|
|
1022
1097
|
var textHtml = "";
|
|
1023
|
-
if (
|
|
1024
|
-
textHtml += '<span class="session-processing"></span>';
|
|
1098
|
+
if (groupActivityCls) {
|
|
1099
|
+
textHtml += '<span class="session-processing ' + groupActivityCls + '"></span>';
|
|
1025
1100
|
}
|
|
1026
1101
|
var groupIcon = isRalph ? "repeat" : "calendar-clock";
|
|
1027
1102
|
var iconClass = isRalph ? "" : " scheduled";
|
|
@@ -1094,15 +1169,15 @@ function renderLoopRun(parentGk, startedAtKey, sessions, isRalph) {
|
|
|
1094
1169
|
var timeLabel = startedAt ? new Date(startedAt).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : "Unknown";
|
|
1095
1170
|
|
|
1096
1171
|
var hasActive = false;
|
|
1097
|
-
var anyProcessing = false;
|
|
1098
1172
|
var latestSession = sessions[0];
|
|
1099
1173
|
for (var i = 0; i < sessions.length; i++) {
|
|
1100
1174
|
if (sessions[i].active) hasActive = true;
|
|
1101
|
-
if (sessions[i].isProcessing) anyProcessing = true;
|
|
1102
1175
|
if ((sessions[i].lastActivity || 0) > (latestSession.lastActivity || 0)) {
|
|
1103
1176
|
latestSession = sessions[i];
|
|
1104
1177
|
}
|
|
1105
1178
|
}
|
|
1179
|
+
// lr-66c118: replaces the open-coded anyProcessing OR-loop above.
|
|
1180
|
+
var runActivityCls = indicatorClass(rollupActivity(sessions, store.get('myUserId')));
|
|
1106
1181
|
|
|
1107
1182
|
var wrapper = document.createElement("div");
|
|
1108
1183
|
wrapper.className = "session-loop-run-wrapper";
|
|
@@ -1129,8 +1204,8 @@ function renderLoopRun(parentGk, startedAtKey, sessions, isRalph) {
|
|
|
1129
1204
|
var textSpan = document.createElement("span");
|
|
1130
1205
|
textSpan.className = "session-item-text";
|
|
1131
1206
|
var textHtml = "";
|
|
1132
|
-
if (
|
|
1133
|
-
textHtml += '<span class="session-processing"></span>';
|
|
1207
|
+
if (runActivityCls) {
|
|
1208
|
+
textHtml += '<span class="session-processing ' + runActivityCls + '"></span>';
|
|
1134
1209
|
}
|
|
1135
1210
|
textHtml += '<span class="session-loop-run-time">' + escapeHtml(timeLabel) + '</span>';
|
|
1136
1211
|
textHtml += '<span class="session-loop-count' + (isRalph ? "" : " scheduled") + '">' + sessions.length + '</span>';
|
|
@@ -1173,8 +1248,10 @@ function renderSessionItem(s) {
|
|
|
1173
1248
|
var textSpan = document.createElement("span");
|
|
1174
1249
|
textSpan.className = "session-item-text";
|
|
1175
1250
|
var textHtml = "";
|
|
1176
|
-
|
|
1177
|
-
|
|
1251
|
+
var itemActivityState = sessionActivity(s, store.get('myUserId'));
|
|
1252
|
+
var itemActivityCls = indicatorClass(itemActivityState);
|
|
1253
|
+
if (itemActivityCls) {
|
|
1254
|
+
textHtml += '<span class="session-processing ' + itemActivityCls + '" title="' + escapeHtml(itemActivityState.label) + '"></span>';
|
|
1178
1255
|
}
|
|
1179
1256
|
if (s.sessionVisibility === "private") {
|
|
1180
1257
|
textHtml += '<span class="session-private-icon" title="Private session">' + iconHtml("lock") + '</span>';
|
|
@@ -1234,7 +1311,11 @@ function renderSessionItem(s) {
|
|
|
1234
1311
|
|
|
1235
1312
|
// --- Main session list ---
|
|
1236
1313
|
|
|
1314
|
+
// lr-66c118: the activity field below is the derived class (indicatorClass/
|
|
1315
|
+
// sessionActivity), not a raw processing-flag read — also captures an
|
|
1316
|
+
// ownerId-driven tone change a boolean would have missed.
|
|
1237
1317
|
function _fingerprintSessions(list, expanded, expandedRuns) {
|
|
1318
|
+
var myUserId = store.get('myUserId');
|
|
1238
1319
|
var parts = [];
|
|
1239
1320
|
for (var i = 0; i < list.length; i++) {
|
|
1240
1321
|
var s = list[i];
|
|
@@ -1242,7 +1323,7 @@ function _fingerprintSessions(list, expanded, expandedRuns) {
|
|
|
1242
1323
|
s.id + "," +
|
|
1243
1324
|
(s.title || "") + "," +
|
|
1244
1325
|
(s.active ? "1" : "0") + "," +
|
|
1245
|
-
(s
|
|
1326
|
+
indicatorClass(sessionActivity(s, myUserId)) + "," +
|
|
1246
1327
|
(s.bookmarked ? "1" : "0") + "," +
|
|
1247
1328
|
// favoriteOrder drives sort order within the favorites section
|
|
1248
1329
|
// (compareSessionListItems) and unread drives the badge — both must be
|
|
@@ -1266,23 +1347,21 @@ function _fingerprintSessions(list, expanded, expandedRuns) {
|
|
|
1266
1347
|
export function renderSessionList(sessions) {
|
|
1267
1348
|
if (sessions) cachedSessions = sessions;
|
|
1268
1349
|
|
|
1269
|
-
//
|
|
1270
|
-
//
|
|
1271
|
-
//
|
|
1272
|
-
//
|
|
1273
|
-
//
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
//
|
|
1278
|
-
// re-broadcasts session_list after unrelated events (session switches,
|
|
1279
|
-
// WS reconnects, presence updates). Each rebuild does innerHTML="" on the
|
|
1280
|
-
// entire sidebar list + re-creates all elements + calls refreshIcons().
|
|
1281
|
-
// Include search state so filter changes always trigger a rebuild.
|
|
1350
|
+
// Compute the fingerprint FIRST, before touching activeRename at all.
|
|
1351
|
+
// suspend() settles the rename's input (see its LIFECYCLE GUARD comment) —
|
|
1352
|
+
// it must only be called when a real rebuild is about to tear that input
|
|
1353
|
+
// down. Calling it unconditionally (including on a no-op render, where the
|
|
1354
|
+
// input stays live in the DOM untouched) would settle an edit that was
|
|
1355
|
+
// never actually interrupted, silently disabling its real blur/Enter/
|
|
1356
|
+
// Escape handling. This ordering is the fix for the lr-16b88d PEACHES
|
|
1357
|
+
// finding that the original version suspended before knowing whether a
|
|
1358
|
+
// rebuild would run.
|
|
1282
1359
|
var fp = _fingerprintSessions(cachedSessions, expandedLoopGroups, expandedLoopRuns) +
|
|
1283
1360
|
"|sq:" + searchQuery + "|sm:" + (searchMatchIds ? searchMatchIds.size : "null");
|
|
1284
1361
|
if (fp === _sessionListFingerprint) {
|
|
1285
|
-
//
|
|
1362
|
+
// No-op render: nothing is going to be torn down, so the active rename's
|
|
1363
|
+
// input stays live in the DOM untouched — leave activeRename alone.
|
|
1364
|
+
// Still need to refresh mobile sheet and search UI on null calls.
|
|
1286
1365
|
if (refreshMobileChatSheet) refreshMobileChatSheet();
|
|
1287
1366
|
syncHeaderSearchUi();
|
|
1288
1367
|
if (updatePageTitle) updatePageTitle();
|
|
@@ -1290,6 +1369,33 @@ export function renderSessionList(sessions) {
|
|
|
1290
1369
|
}
|
|
1291
1370
|
_sessionListFingerprint = fp;
|
|
1292
1371
|
|
|
1372
|
+
// A real rebuild below (innerHTML = "") detaches the in-progress rename
|
|
1373
|
+
// <input> from the DOM without a real user action. Force-committing it
|
|
1374
|
+
// here (the original design) sent a partial title as a real rename_session
|
|
1375
|
+
// on nearly every broadcast from an actively-streaming session — see
|
|
1376
|
+
// lr-16b88d. Instead, capture the in-progress edit via suspend(), which
|
|
1377
|
+
// both snapshots {value, selectionStart, selectionEnd} AND settles the
|
|
1378
|
+
// rename as suspended (no commit, no cancel, no WS send) so the detach-
|
|
1379
|
+
// induced synthetic blur that fires the instant innerHTML="" runs below is
|
|
1380
|
+
// a no-op on the OLD input. Clear the module-level activeRename slot
|
|
1381
|
+
// immediately after: this rebuild is the only owner of the decision to
|
|
1382
|
+
// re-open it, and no code between here and the re-open below may treat a
|
|
1383
|
+
// stale reference to the just-torn-down rename as still committable.
|
|
1384
|
+
var suspendedRename = null;
|
|
1385
|
+
if (activeRename) {
|
|
1386
|
+
var snapshot = activeRename.suspend();
|
|
1387
|
+
if (snapshot) {
|
|
1388
|
+
suspendedRename = {
|
|
1389
|
+
type: activeRename.type,
|
|
1390
|
+
id: activeRename.id,
|
|
1391
|
+
currentTitle: activeRename.currentTitle,
|
|
1392
|
+
snapshot: snapshot,
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
activeRename = null;
|
|
1396
|
+
}
|
|
1397
|
+
clearArmedSessionDelete();
|
|
1398
|
+
|
|
1293
1399
|
// If mobile chat sheet is open, refresh it
|
|
1294
1400
|
if (refreshMobileChatSheet) refreshMobileChatSheet();
|
|
1295
1401
|
|
|
@@ -1414,6 +1520,20 @@ export function renderSessionList(sessions) {
|
|
|
1414
1520
|
// no-op when schedules are outside the 3-minute window or the timer is
|
|
1415
1521
|
// already running, so calling it here is safe and low-cost.
|
|
1416
1522
|
startCountdownTimer();
|
|
1523
|
+
|
|
1524
|
+
// Re-open the in-progress rename this rebuild just tore down, restoring
|
|
1525
|
+
// the typed value + caret (lr-16b88d). If the target session/loop no
|
|
1526
|
+
// longer exists post-rebuild (deleted, or filtered out by a new search),
|
|
1527
|
+
// startInlineRename()/startLoopInlineRename() find no matching element and
|
|
1528
|
+
// no-op, and activeRename is left null — the edit is silently dropped in
|
|
1529
|
+
// that case, but it was already unaddressable, not force-committed.
|
|
1530
|
+
if (suspendedRename) {
|
|
1531
|
+
if (suspendedRename.type === "loop") {
|
|
1532
|
+
startLoopInlineRename(suspendedRename.id, suspendedRename.currentTitle, suspendedRename.snapshot);
|
|
1533
|
+
} else {
|
|
1534
|
+
startInlineRename(suspendedRename.id, suspendedRename.currentTitle, suspendedRename.snapshot);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1417
1537
|
}
|
|
1418
1538
|
|
|
1419
1539
|
// --- Search results ---
|
|
@@ -787,8 +787,8 @@ export function initTheme() {
|
|
|
787
787
|
updateToggleIcon();
|
|
788
788
|
|
|
789
789
|
var islandToggle = document.getElementById("user-theme-toggle-btn");
|
|
790
|
-
if (islandToggle && !islandToggle.
|
|
791
|
-
islandToggle.
|
|
790
|
+
if (islandToggle && !islandToggle._clagenticThemeBound) {
|
|
791
|
+
islandToggle._clagenticThemeBound = true;
|
|
792
792
|
islandToggle.addEventListener("click", function () {
|
|
793
793
|
toggleDarkMode();
|
|
794
794
|
});
|