@clagentic/console 1.6.0 → 1.7.0-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/bin/cli.js +20 -102
- package/deploy/clagentic-console.service +10 -1
- package/lib/agents-favorites.js +0 -1
- package/lib/agents.js +0 -10
- package/lib/cli-sessions.js +0 -12
- package/lib/codex-defaults.js +4 -1
- package/lib/config.js +0 -8
- package/lib/daemon.js +88 -9
- package/lib/dm.js +0 -1
- package/lib/ipc.js +129 -59
- package/lib/loop-handoff.js +5 -1
- package/lib/memory-limits.js +214 -36
- package/lib/memory-shed.js +207 -0
- package/lib/notes.js +0 -20
- package/lib/os-users.js +0 -3
- package/lib/project-connection.js +31 -5
- package/lib/project-external-trigger.js +2 -1
- package/lib/project-filesystem.js +18 -11
- package/lib/project-knowledge.js +0 -8
- package/lib/project-loop.js +162 -9
- package/lib/project-sessions.js +87 -21
- package/lib/project-user-mention.js +2 -1
- package/lib/project-user-message.js +16 -5
- package/lib/project.js +14 -25
- package/lib/public/app.js +1 -2
- package/lib/public/css/channel-layout.css +25 -158
- package/lib/public/css/diagnostics.css +17 -1
- package/lib/public/css/icon-strip.css +1 -32
- package/lib/public/css/input.css +0 -56
- package/lib/public/css/loop.css +94 -0
- package/lib/public/css/messages.css +23 -4
- package/lib/public/css/mobile-nav.css +0 -124
- package/lib/public/index.html +11 -11
- package/lib/public/modules/app-connection.js +2 -1
- package/lib/public/modules/app-favicon.js +1 -1
- package/lib/public/modules/app-loop-ui.js +140 -4
- package/lib/public/modules/app-messages.js +17 -11
- package/lib/public/modules/app-projects.js +1 -1
- package/lib/public/modules/custom-icons.js +15 -1
- package/lib/public/modules/dom-refs.js +1 -2
- package/lib/public/modules/emoji-picker.js +6 -1
- package/lib/public/modules/filebrowser.js +33 -9
- package/lib/public/modules/input.js +39 -0
- package/lib/public/modules/scheduler.js +20 -6
- package/lib/public/modules/sidebar-mobile.js +0 -64
- package/lib/public/modules/sidebar-projects.js +90 -25
- package/lib/public/modules/sidebar-sessions.js +80 -13
- package/lib/public/modules/stt.js +2 -6
- package/lib/public/modules/tool-palette.js +0 -1
- package/lib/public/modules/tools.js +2 -6
- package/lib/public/style.css +0 -1
- package/lib/scheduler.js +0 -1
- package/lib/sdk-bridge.js +126 -194
- package/lib/sdk-message-processor.js +24 -9
- package/lib/sdk-permission-ownership.js +51 -0
- package/lib/server-auth.js +25 -18
- package/lib/server-dm.js +1 -1
- package/lib/server-skills.js +9 -1
- package/lib/server.js +18 -3
- package/lib/session-search.js +4 -299
- package/lib/sessions.js +467 -82
- package/lib/smtp.js +0 -15
- package/lib/user-presence.js +0 -12
- package/lib/users-preferences.js +2 -2
- package/lib/users.js +0 -5
- package/lib/utils.js +56 -0
- package/lib/ws-schema.js +3 -14
- package/lib/yoke/adapters/codex.js +96 -10
- package/lib/yoke/codex-local-image.js +79 -0
- package/package.json +1 -1
- package/scripts/postinstall.js +16 -11
- package/lib/ask-user-mcp-server.js +0 -121
- package/lib/project-memory.js +0 -39
- package/lib/public/console-icon.png +0 -0
- package/lib/public/css/debate.css +0 -1610
- package/lib/public/favicon-banded-32.png +0 -0
- package/lib/public/favicon-dark.svg +0 -32
- package/lib/public/favicon.svg +0 -32
- package/lib/public/icon-banded-96.png +0 -0
- package/lib/public/icons/email/gmail.svg +0 -7
- package/lib/public/icons/email/outlook.svg +0 -35
- package/lib/public/icons/email/yahoo.svg +0 -1
- package/lib/public/modules/events.js +0 -21
- package/lib/public/modules/state.js +0 -3
- package/lib/sdk-worker.js +0 -730
|
@@ -606,7 +606,14 @@ function renderSidebar() {
|
|
|
606
606
|
input.focus();
|
|
607
607
|
input.select();
|
|
608
608
|
|
|
609
|
+
// Setting sidebarListEl.innerHTML during renderSidebar() detaches this
|
|
610
|
+
// <input> from the DOM, which the browser treats as a blur — the
|
|
611
|
+
// "blur" listener below still fires and would call finishEdit() and
|
|
612
|
+
// commit the rename even though the user pressed Escape to cancel.
|
|
613
|
+
// cancelled short-circuits that so Escape truly discards the edit.
|
|
614
|
+
var cancelled = false;
|
|
609
615
|
function finishEdit() {
|
|
616
|
+
if (cancelled) return;
|
|
610
617
|
var newName = input.value.trim();
|
|
611
618
|
if (newName && newName !== original) {
|
|
612
619
|
send({ type: "loop_registry_update", id: editId, data: { name: newName } });
|
|
@@ -615,7 +622,7 @@ function renderSidebar() {
|
|
|
615
622
|
}
|
|
616
623
|
input.addEventListener("keydown", function (ev) {
|
|
617
624
|
if (ev.key === "Enter") { ev.preventDefault(); finishEdit(); }
|
|
618
|
-
if (ev.key === "Escape") { ev.preventDefault(); renderSidebar(); }
|
|
625
|
+
if (ev.key === "Escape") { ev.preventDefault(); cancelled = true; renderSidebar(); }
|
|
619
626
|
});
|
|
620
627
|
input.addEventListener("blur", finishEdit);
|
|
621
628
|
});
|
|
@@ -950,7 +957,7 @@ function renderMonthView() {
|
|
|
950
957
|
var ev = events[e];
|
|
951
958
|
var evFullText = ev.timeStr + " " + ev.name;
|
|
952
959
|
html += '<div class="scheduler-event ' + (ev.enabled ? "enabled" : "disabled") + '" data-rec-id="' + ev.id + '" data-tip="' + esc(evFullText) + '">';
|
|
953
|
-
html += '<span class="scheduler-event-time">' + ev.timeStr + '</span> ' + esc(ev.name);
|
|
960
|
+
html += '<span class="scheduler-event-time">' + esc(ev.timeStr) + '</span> ' + esc(ev.name);
|
|
954
961
|
html += '</div>';
|
|
955
962
|
}
|
|
956
963
|
if (events.length > 3) {
|
|
@@ -1074,7 +1081,8 @@ function renderWeekView() {
|
|
|
1074
1081
|
var ev = events[e];
|
|
1075
1082
|
if (ev.intervalBadge) {
|
|
1076
1083
|
var badgeStyle = "";
|
|
1077
|
-
|
|
1084
|
+
var badgeColor = safeColor(ev.color);
|
|
1085
|
+
if (badgeColor) badgeStyle = "background:" + badgeColor;
|
|
1078
1086
|
var weekIntFullText = ev.timeStr + " " + ev.name;
|
|
1079
1087
|
html += '<div class="scheduler-week-event interval-badge ' + (ev.enabled ? "enabled" : "disabled") + '" data-rec-id="' + ev.id + '" data-tip="' + esc(weekIntFullText) + '" style="position:relative;top:0;left:0;width:85%;height:auto;' + badgeStyle + '">';
|
|
1080
1088
|
html += '<span class="scheduler-week-event-time">' + esc(ev.timeStr) + '</span>';
|
|
@@ -1083,7 +1091,7 @@ function renderWeekView() {
|
|
|
1083
1091
|
continue;
|
|
1084
1092
|
}
|
|
1085
1093
|
var topPct = ((ev.hour * 60 + ev.minute) / 1440) * 100;
|
|
1086
|
-
var evColor = ev.color || "";
|
|
1094
|
+
var evColor = safeColor(ev.color) || "";
|
|
1087
1095
|
var assign = colAssign[ev.id] || { col: 0, totalCols: 1 };
|
|
1088
1096
|
var rightMargin = 15; // percentage reserved for "add new" click area
|
|
1089
1097
|
var usableWidth = 100 - rightMargin;
|
|
@@ -1095,7 +1103,7 @@ function renderWeekView() {
|
|
|
1095
1103
|
var weekEvFullText = ev.timeStr + " " + ev.name;
|
|
1096
1104
|
html += '<div class="scheduler-week-event ' + (ev.enabled ? "enabled" : "disabled") + '" data-rec-id="' + ev.id + '" data-tip="' + esc(weekEvFullText) + '" style="' + evStyle + '">';
|
|
1097
1105
|
html += '<span class="scheduler-week-event-title">' + esc(ev.name) + '</span>';
|
|
1098
|
-
html += '<span class="scheduler-week-event-time">' + ev.timeStr + '</span>';
|
|
1106
|
+
html += '<span class="scheduler-week-event-time">' + esc(ev.timeStr) + '</span>';
|
|
1099
1107
|
html += '</div>';
|
|
1100
1108
|
}
|
|
1101
1109
|
html += '</div>';
|
|
@@ -1317,7 +1325,7 @@ function showPopover(recId, anchorEl) {
|
|
|
1317
1325
|
if (rec.lastRunResult) {
|
|
1318
1326
|
html += '<div class="schedule-popover-result ' + (rec.lastRunResult === "pass" ? "pass" : "fail") + '">' + rec.lastRunResult + '</div>';
|
|
1319
1327
|
}
|
|
1320
|
-
html += '<div class="schedule-popover-meta">' + cronToHuman(rec.cron) + '</div>';
|
|
1328
|
+
html += '<div class="schedule-popover-meta">' + esc(cronToHuman(rec.cron)) + '</div>';
|
|
1321
1329
|
html += '<div class="schedule-popover-actions">';
|
|
1322
1330
|
html += '<button class="schedule-popover-btn" data-action="edit" data-id="' + rec.id + '">Edit</button>';
|
|
1323
1331
|
html += '<button class="schedule-popover-btn" data-action="toggle" data-id="' + rec.id + '">' + (rec.enabled ? "Pause" : "Enable") + '</button>';
|
|
@@ -1643,6 +1651,12 @@ function getWeekStart(date) {
|
|
|
1643
1651
|
function pad(n) { return n < 10 ? "0" + n : String(n); }
|
|
1644
1652
|
function esc(s) { return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """); }
|
|
1645
1653
|
|
|
1654
|
+
// Server-controlled schedule color values are interpolated into string-built
|
|
1655
|
+
// style="" attributes. Only accept a strict hex color; anything else (e.g. an
|
|
1656
|
+
// injected attribute breakout) is dropped rather than rendered.
|
|
1657
|
+
var SAFE_HEX_COLOR_RE = /^#[0-9a-f]{3,8}$/i;
|
|
1658
|
+
function safeColor(c) { return c && SAFE_HEX_COLOR_RE.test(c) ? c : null; }
|
|
1659
|
+
|
|
1646
1660
|
function formatDateTime(d) {
|
|
1647
1661
|
return MONTH_NAMES[d.getMonth()].substring(0, 3) + " " + d.getDate() + ", " + pad(d.getHours()) + ":" + pad(d.getMinutes());
|
|
1648
1662
|
}
|
|
@@ -47,14 +47,9 @@ import { renderSheetTeam as renderTeamView } from './team-panel.js';
|
|
|
47
47
|
|
|
48
48
|
// --- Mobile state ---
|
|
49
49
|
var mobileChatSheetOpen = false;
|
|
50
|
-
var mobileSheetMateData = null;
|
|
51
50
|
var expandedMobileLoopGroups = new Set();
|
|
52
51
|
var expandedMobileLoopRuns = new Set();
|
|
53
52
|
|
|
54
|
-
export function setMobileSheetMateData(data) {
|
|
55
|
-
mobileSheetMateData = data;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
53
|
export function openMobileSheet(type) {
|
|
59
54
|
var sheet = document.getElementById("mobile-sheet");
|
|
60
55
|
if (!sheet) return;
|
|
@@ -997,65 +992,6 @@ export function refreshMobileChatSheet() {
|
|
|
997
992
|
refreshIcons();
|
|
998
993
|
}
|
|
999
994
|
|
|
1000
|
-
function renderSheetMateProfile(listEl) {
|
|
1001
|
-
if (!mobileSheetMateData) return;
|
|
1002
|
-
var data = mobileSheetMateData;
|
|
1003
|
-
|
|
1004
|
-
// Profile header
|
|
1005
|
-
var header = document.createElement("div");
|
|
1006
|
-
header.className = "mate-profile-header";
|
|
1007
|
-
|
|
1008
|
-
var avatar = document.createElement("img");
|
|
1009
|
-
avatar.className = "mate-profile-avatar";
|
|
1010
|
-
avatar.src = data.avatarUrl || "";
|
|
1011
|
-
avatar.alt = data.displayName || "";
|
|
1012
|
-
header.appendChild(avatar);
|
|
1013
|
-
|
|
1014
|
-
var info = document.createElement("div");
|
|
1015
|
-
info.className = "mate-profile-info";
|
|
1016
|
-
var nameEl = document.createElement("div");
|
|
1017
|
-
nameEl.className = "mate-profile-name";
|
|
1018
|
-
nameEl.textContent = data.displayName || "";
|
|
1019
|
-
info.appendChild(nameEl);
|
|
1020
|
-
if (data.description) {
|
|
1021
|
-
var descEl = document.createElement("div");
|
|
1022
|
-
descEl.className = "mate-profile-desc";
|
|
1023
|
-
descEl.textContent = data.description;
|
|
1024
|
-
info.appendChild(descEl);
|
|
1025
|
-
}
|
|
1026
|
-
header.appendChild(info);
|
|
1027
|
-
listEl.appendChild(header);
|
|
1028
|
-
|
|
1029
|
-
// Action buttons
|
|
1030
|
-
var actions = [
|
|
1031
|
-
{ icon: "puzzle", label: "Skills", btnId: "skills-btn" },
|
|
1032
|
-
{ icon: "calendar", label: "Scheduled Tasks", btnId: "scheduler-btn" }
|
|
1033
|
-
];
|
|
1034
|
-
|
|
1035
|
-
for (var i = 0; i < actions.length; i++) {
|
|
1036
|
-
(function (action) {
|
|
1037
|
-
var btn = document.createElement("button");
|
|
1038
|
-
btn.className = "mate-profile-action";
|
|
1039
|
-
var countHtml = "";
|
|
1040
|
-
if (action.countId) {
|
|
1041
|
-
var countEl = document.getElementById(action.countId);
|
|
1042
|
-
if (countEl && !countEl.classList.contains("hidden") && countEl.textContent) {
|
|
1043
|
-
countHtml = '<span class="mate-profile-action-count">' + escapeHtml(countEl.textContent) + '</span>';
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
btn.innerHTML = '<i data-lucide="' + action.icon + '"></i><span>' + action.label + '</span>' + countHtml;
|
|
1047
|
-
btn.addEventListener("click", function () {
|
|
1048
|
-
closeMobileSheet();
|
|
1049
|
-
var targetBtn = document.getElementById(action.btnId);
|
|
1050
|
-
if (targetBtn) {
|
|
1051
|
-
setTimeout(function () { targetBtn.click(); }, 250);
|
|
1052
|
-
}
|
|
1053
|
-
});
|
|
1054
|
-
listEl.appendChild(btn);
|
|
1055
|
-
})(actions[i]);
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
995
|
function renderSheetTeam(listEl) {
|
|
1060
996
|
renderTeamView(listEl);
|
|
1061
997
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// sidebar-projects.js - Project icon strip, context menus, emoji picker, drag-and-drop, worktree modal
|
|
2
2
|
// Extracted from sidebar.js (PR-36)
|
|
3
3
|
|
|
4
|
-
import { escapeHtml } from './utils.js';
|
|
4
|
+
import { escapeHtml, showToast } from './utils.js';
|
|
5
5
|
import { iconHtml, refreshIcons } from './icons.js';
|
|
6
6
|
import { openProjectSettings } from './project-settings.js';
|
|
7
7
|
import { triggerShare } from './qrcode.js';
|
|
@@ -269,14 +269,27 @@ function renderAccessPopover(popover, slug, access, allUsers) {
|
|
|
269
269
|
popover.querySelectorAll(".project-access-vis-btn").forEach(function (btn) {
|
|
270
270
|
btn.addEventListener("click", function () {
|
|
271
271
|
var newVis = btn.dataset.vis;
|
|
272
|
+
var prevVis = visibility;
|
|
273
|
+
var prevBtn = popover.querySelector(".project-access-vis-btn.active");
|
|
272
274
|
popover.querySelectorAll(".project-access-vis-btn").forEach(function (b) { b.classList.remove("active"); });
|
|
273
275
|
btn.classList.add("active");
|
|
276
|
+
visibility = newVis;
|
|
274
277
|
var usersSection = popover.querySelector(".project-access-users-section");
|
|
275
278
|
if (usersSection) usersSection.style.display = newVis === "private" ? "" : "none";
|
|
276
279
|
fetch("/api/admin/projects/" + encodeURIComponent(slug) + "/visibility", {
|
|
277
280
|
method: "PUT",
|
|
278
281
|
headers: { "Content-Type": "application/json" },
|
|
279
282
|
body: JSON.stringify({ visibility: newVis }),
|
|
283
|
+
}).then(function (res) {
|
|
284
|
+
if (!res.ok) throw new Error("Request failed: " + res.status);
|
|
285
|
+
}).catch(function () {
|
|
286
|
+
// Roll back the optimistic UI update so the popover reflects reality
|
|
287
|
+
// instead of showing a visibility that was never actually applied.
|
|
288
|
+
visibility = prevVis;
|
|
289
|
+
popover.querySelectorAll(".project-access-vis-btn").forEach(function (b) { b.classList.remove("active"); });
|
|
290
|
+
if (prevBtn) prevBtn.classList.add("active");
|
|
291
|
+
if (usersSection) usersSection.style.display = prevVis === "private" ? "" : "none";
|
|
292
|
+
showToast("Failed to update project visibility", "warn");
|
|
280
293
|
});
|
|
281
294
|
});
|
|
282
295
|
});
|
|
@@ -287,10 +300,20 @@ function renderAccessPopover(popover, slug, access, allUsers) {
|
|
|
287
300
|
popover.querySelectorAll('.project-access-user-item input[type="checkbox"]:checked').forEach(function (c) {
|
|
288
301
|
selected.push(c.dataset.uid);
|
|
289
302
|
});
|
|
303
|
+
// The browser already flipped this checkbox's checked state before
|
|
304
|
+
// "change" fires — capture that as the optimistic value so a failed
|
|
305
|
+
// request can be reverted below.
|
|
306
|
+
var thisCb = cb;
|
|
307
|
+
var wasChecked = !thisCb.checked;
|
|
290
308
|
fetch("/api/admin/projects/" + encodeURIComponent(slug) + "/users", {
|
|
291
309
|
method: "PUT",
|
|
292
310
|
headers: { "Content-Type": "application/json" },
|
|
293
311
|
body: JSON.stringify({ allowedUsers: selected }),
|
|
312
|
+
}).then(function (res) {
|
|
313
|
+
if (!res.ok) throw new Error("Request failed: " + res.status);
|
|
314
|
+
}).catch(function () {
|
|
315
|
+
thisCb.checked = wasChecked;
|
|
316
|
+
showToast("Failed to update allowed users", "warn");
|
|
294
317
|
});
|
|
295
318
|
});
|
|
296
319
|
});
|
|
@@ -1036,10 +1059,16 @@ function setupDragHandlers(el, slug) {
|
|
|
1036
1059
|
|
|
1037
1060
|
// Detect folder exit: dragged item is in a folder but target item is not
|
|
1038
1061
|
// (or is in a different folder). Strip the folder membership first.
|
|
1039
|
-
|
|
1062
|
+
// Named distinctly from the module-level `draggedFolderName` (set when a
|
|
1063
|
+
// whole folder is dragged) — a `var` here previously shared that name and
|
|
1064
|
+
// hoisted to the top of this same drop handler, so the whole-folder-drop
|
|
1065
|
+
// check earlier in this function (`if (draggedFolderName)`) always read
|
|
1066
|
+
// this local's initial `undefined`/`null` instead of the module state,
|
|
1067
|
+
// silently disabling folder drag-and-drop reorder onto a project item.
|
|
1068
|
+
var draggedItemFolderName = null;
|
|
1040
1069
|
for (var dfi = 0; dfi < cachedProjectList.length; dfi++) {
|
|
1041
1070
|
if (cachedProjectList[dfi].slug === draggedSlug) {
|
|
1042
|
-
|
|
1071
|
+
draggedItemFolderName = cachedProjectList[dfi].folderName || null;
|
|
1043
1072
|
break;
|
|
1044
1073
|
}
|
|
1045
1074
|
}
|
|
@@ -1051,12 +1080,12 @@ function setupDragHandlers(el, slug) {
|
|
|
1051
1080
|
}
|
|
1052
1081
|
}
|
|
1053
1082
|
var ws2 = getWs();
|
|
1054
|
-
if (
|
|
1083
|
+
if (draggedItemFolderName && draggedItemFolderName !== targetFolderName2) {
|
|
1055
1084
|
// Leaving a folder — clear folder membership before reordering
|
|
1056
1085
|
if (ws2 && store.get('connected')) {
|
|
1057
1086
|
ws2.send(JSON.stringify({ type: "set_project_folder", slug: draggedSlug, folderName: null }));
|
|
1058
1087
|
}
|
|
1059
|
-
} else if (!
|
|
1088
|
+
} else if (!draggedItemFolderName && targetFolderName2) {
|
|
1060
1089
|
// Entering a folder — add dragged item to the target's folder
|
|
1061
1090
|
if (ws2 && store.get('connected')) {
|
|
1062
1091
|
ws2.send(JSON.stringify({ type: "set_project_folder", slug: draggedSlug, folderName: targetFolderName2 }));
|
|
@@ -1425,7 +1454,26 @@ function showWorktreeModal(parentSlug, parentName) {
|
|
|
1425
1454
|
document.body.appendChild(container);
|
|
1426
1455
|
branchInput.focus();
|
|
1427
1456
|
|
|
1428
|
-
|
|
1457
|
+
// Tracks the message listener + timeout for the in-flight create_worktree
|
|
1458
|
+
// request, so a modal close (or a second create attempt) can tear down the
|
|
1459
|
+
// previous listener instead of leaking it. Without this, a stacked, never-
|
|
1460
|
+
// removed handler from an earlier attempt could still be listening when a
|
|
1461
|
+
// later, unrelated create_worktree_result arrives and fire a stale
|
|
1462
|
+
// switchProject() for a worktree the user is no longer creating.
|
|
1463
|
+
var pendingCreate = null; // { dirName, handler, timeoutId } or null
|
|
1464
|
+
|
|
1465
|
+
function clearPendingCreate() {
|
|
1466
|
+
if (!pendingCreate) return;
|
|
1467
|
+
var ws = getWs();
|
|
1468
|
+
if (ws) ws.removeEventListener("message", pendingCreate.handler);
|
|
1469
|
+
clearTimeout(pendingCreate.timeoutId);
|
|
1470
|
+
pendingCreate = null;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
function closeModal() {
|
|
1474
|
+
clearPendingCreate();
|
|
1475
|
+
container.remove();
|
|
1476
|
+
}
|
|
1429
1477
|
|
|
1430
1478
|
function doCreate() {
|
|
1431
1479
|
var branch = branchInput.value.trim();
|
|
@@ -1435,37 +1483,54 @@ function showWorktreeModal(parentSlug, parentName) {
|
|
|
1435
1483
|
errorDiv.classList.add("visible");
|
|
1436
1484
|
return;
|
|
1437
1485
|
}
|
|
1486
|
+
var ws = getWs();
|
|
1487
|
+
if (!ws || !store.get('connected')) {
|
|
1488
|
+
errorDiv.textContent = "Not connected — cannot create worktree";
|
|
1489
|
+
errorDiv.classList.add("visible");
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
// Discard any previous in-flight attempt before starting a new one.
|
|
1493
|
+
clearPendingCreate();
|
|
1494
|
+
|
|
1438
1495
|
var dirName = branch.replace(/\//g, "-");
|
|
1439
1496
|
createBtn.disabled = true;
|
|
1440
1497
|
createBtn.textContent = "Creating...";
|
|
1441
1498
|
errorDiv.classList.remove("visible");
|
|
1442
1499
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1500
|
+
ws.send(JSON.stringify({
|
|
1501
|
+
type: "create_worktree",
|
|
1502
|
+
branch: branch,
|
|
1503
|
+
dirName: dirName,
|
|
1504
|
+
baseBranch: base
|
|
1505
|
+
}));
|
|
1506
|
+
|
|
1507
|
+
function onFailure(message) {
|
|
1508
|
+
clearPendingCreate();
|
|
1509
|
+
createBtn.disabled = false;
|
|
1510
|
+
createBtn.textContent = "Create";
|
|
1511
|
+
errorDiv.textContent = message;
|
|
1512
|
+
errorDiv.classList.add("visible");
|
|
1450
1513
|
}
|
|
1451
1514
|
|
|
1452
1515
|
var handler = function (event) {
|
|
1453
1516
|
var msg;
|
|
1454
1517
|
try { msg = JSON.parse(event.data); } catch (e) { return; }
|
|
1455
|
-
if (msg.type
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
errorDiv.classList.add("visible");
|
|
1465
|
-
}
|
|
1518
|
+
if (msg.type !== "create_worktree_result") return;
|
|
1519
|
+
// Correlate on dirName — drop replies for a superseded request.
|
|
1520
|
+
if (msg.dirName && msg.dirName !== dirName) return;
|
|
1521
|
+
clearPendingCreate();
|
|
1522
|
+
if (msg.ok) {
|
|
1523
|
+
closeModal();
|
|
1524
|
+
if (msg.slug && switchProject) switchProject(msg.slug);
|
|
1525
|
+
} else {
|
|
1526
|
+
onFailure(msg.error || "Failed to create worktree");
|
|
1466
1527
|
}
|
|
1467
1528
|
};
|
|
1468
|
-
|
|
1529
|
+
var timeoutId = setTimeout(function () {
|
|
1530
|
+
onFailure("Timed out waiting for worktree creation");
|
|
1531
|
+
}, 30000);
|
|
1532
|
+
pendingCreate = { dirName: dirName, handler: handler, timeoutId: timeoutId };
|
|
1533
|
+
ws.addEventListener("message", handler);
|
|
1469
1534
|
}
|
|
1470
1535
|
|
|
1471
1536
|
overlay.addEventListener("click", closeModal);
|
|
@@ -50,6 +50,15 @@ var headerSearchOpen = false;
|
|
|
50
50
|
var armedDeleteSessionId = null;
|
|
51
51
|
var armedDeleteTimer = null;
|
|
52
52
|
|
|
53
|
+
// Active inline-rename tracking (session or loop). A full session-list
|
|
54
|
+
// rebuild (innerHTML = "") detaches the rename <input> from the DOM without
|
|
55
|
+
// firing a real user "blur" — the browser's synthetic blur-on-removal still
|
|
56
|
+
// invokes commitRename(), but it operates on a textSpan that renderSessionList
|
|
57
|
+
// is about to throw away, so the typed title is silently discarded. Tracking
|
|
58
|
+
// the active commit/cancel lets renderSessionList settle it cleanly (using the
|
|
59
|
+
// input's *current* value) before tearing the list down, instead of losing it.
|
|
60
|
+
var activeRename = null; // { commit, cancel } or null
|
|
61
|
+
|
|
53
62
|
export function openResumePicker() {
|
|
54
63
|
openResumePickerModal();
|
|
55
64
|
}
|
|
@@ -743,6 +752,10 @@ function startInlineRename(sessionId, currentTitle) {
|
|
|
743
752
|
var textSpan = el.querySelector(".session-item-text");
|
|
744
753
|
if (!textSpan) return;
|
|
745
754
|
|
|
755
|
+
// Settle (not silently drop) any rename already in progress elsewhere in
|
|
756
|
+
// the list before starting a new one.
|
|
757
|
+
if (activeRename) activeRename.commit();
|
|
758
|
+
|
|
746
759
|
var input = document.createElement("input");
|
|
747
760
|
input.type = "text";
|
|
748
761
|
input.className = "session-rename-input";
|
|
@@ -754,24 +767,42 @@ function startInlineRename(sessionId, currentTitle) {
|
|
|
754
767
|
input.focus();
|
|
755
768
|
input.select();
|
|
756
769
|
|
|
770
|
+
var settled = false;
|
|
771
|
+
|
|
757
772
|
function commitRename() {
|
|
773
|
+
if (settled) return;
|
|
774
|
+
settled = true;
|
|
775
|
+
activeRename = null;
|
|
758
776
|
var newTitle = input.value.trim();
|
|
759
777
|
if (newTitle && newTitle !== currentTitle && getWs() && store.get('connected')) {
|
|
760
778
|
getWs().send(JSON.stringify({ type: "rename_session", id: sessionId, title: newTitle }));
|
|
761
779
|
}
|
|
762
|
-
// Restore text (server will send updated session_list)
|
|
763
|
-
textSpan
|
|
764
|
-
|
|
765
|
-
|
|
780
|
+
// Restore text (server will send updated session_list). Guard against the
|
|
781
|
+
// textSpan already having been detached/replaced by a rebuild that ran
|
|
782
|
+
// this same settle path via activeRename.commit() at its top.
|
|
783
|
+
if (getSessionListEl().contains(textSpan)) {
|
|
784
|
+
textSpan.innerHTML = originalHtml;
|
|
785
|
+
if (newTitle && newTitle !== currentTitle) {
|
|
786
|
+
textSpan.textContent = newTitle;
|
|
787
|
+
}
|
|
766
788
|
}
|
|
767
789
|
}
|
|
768
790
|
|
|
791
|
+
function cancelRename() {
|
|
792
|
+
if (settled) return;
|
|
793
|
+
settled = true;
|
|
794
|
+
activeRename = null;
|
|
795
|
+
if (getSessionListEl().contains(textSpan)) textSpan.innerHTML = originalHtml;
|
|
796
|
+
}
|
|
797
|
+
|
|
769
798
|
input.addEventListener("keydown", function (e) {
|
|
770
799
|
if (e.key === "Enter") { e.preventDefault(); commitRename(); }
|
|
771
|
-
if (e.key === "Escape") { e.preventDefault();
|
|
800
|
+
if (e.key === "Escape") { e.preventDefault(); cancelRename(); }
|
|
772
801
|
});
|
|
773
802
|
input.addEventListener("blur", commitRename);
|
|
774
803
|
input.addEventListener("click", function (e) { e.stopPropagation(); });
|
|
804
|
+
|
|
805
|
+
activeRename = { commit: commitRename, cancel: cancelRename };
|
|
775
806
|
}
|
|
776
807
|
|
|
777
808
|
function startLoopInlineRename(loopId, currentName) {
|
|
@@ -780,6 +811,8 @@ function startLoopInlineRename(loopId, currentName) {
|
|
|
780
811
|
var textSpan = el.querySelector(".session-item-text");
|
|
781
812
|
if (!textSpan) return;
|
|
782
813
|
|
|
814
|
+
if (activeRename) activeRename.commit();
|
|
815
|
+
|
|
783
816
|
var input = document.createElement("input");
|
|
784
817
|
input.type = "text";
|
|
785
818
|
input.className = "session-rename-input";
|
|
@@ -791,25 +824,41 @@ function startLoopInlineRename(loopId, currentName) {
|
|
|
791
824
|
input.focus();
|
|
792
825
|
input.select();
|
|
793
826
|
|
|
827
|
+
var settled = false;
|
|
828
|
+
|
|
794
829
|
function commitRename() {
|
|
830
|
+
if (settled) return;
|
|
831
|
+
settled = true;
|
|
832
|
+
activeRename = null;
|
|
795
833
|
var newName = input.value.trim();
|
|
796
834
|
if (newName && newName !== currentName && getWs() && store.get('connected')) {
|
|
797
835
|
getWs().send(JSON.stringify({ type: "loop_registry_rename", id: loopId, name: newName }));
|
|
798
836
|
}
|
|
799
|
-
textSpan
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
837
|
+
if (getSessionListEl().contains(textSpan)) {
|
|
838
|
+
textSpan.innerHTML = originalHtml;
|
|
839
|
+
if (newName && newName !== currentName) {
|
|
840
|
+
// Update text inline immediately
|
|
841
|
+
var nameNode = textSpan.querySelector(".session-loop-name");
|
|
842
|
+
if (nameNode) nameNode.textContent = newName;
|
|
843
|
+
}
|
|
804
844
|
}
|
|
805
845
|
}
|
|
806
846
|
|
|
847
|
+
function cancelRename() {
|
|
848
|
+
if (settled) return;
|
|
849
|
+
settled = true;
|
|
850
|
+
activeRename = null;
|
|
851
|
+
if (getSessionListEl().contains(textSpan)) textSpan.innerHTML = originalHtml;
|
|
852
|
+
}
|
|
853
|
+
|
|
807
854
|
input.addEventListener("keydown", function (e) {
|
|
808
855
|
if (e.key === "Enter") { e.preventDefault(); commitRename(); }
|
|
809
|
-
if (e.key === "Escape") { e.preventDefault();
|
|
856
|
+
if (e.key === "Escape") { e.preventDefault(); cancelRename(); }
|
|
810
857
|
});
|
|
811
858
|
input.addEventListener("blur", commitRename);
|
|
812
859
|
input.addEventListener("click", function (e) { e.stopPropagation(); });
|
|
860
|
+
|
|
861
|
+
activeRename = { commit: commitRename, cancel: cancelRename };
|
|
813
862
|
}
|
|
814
863
|
|
|
815
864
|
// --- Date grouping / highlighting ---
|
|
@@ -1195,10 +1244,17 @@ function _fingerprintSessions(list, expanded, expandedRuns) {
|
|
|
1195
1244
|
(s.active ? "1" : "0") + "," +
|
|
1196
1245
|
(s.isProcessing ? "1" : "0") + "," +
|
|
1197
1246
|
(s.bookmarked ? "1" : "0") + "," +
|
|
1247
|
+
// favoriteOrder drives sort order within the favorites section
|
|
1248
|
+
// (compareSessionListItems) and unread drives the badge — both must be
|
|
1249
|
+
// in the fingerprint or a bookmark reorder / unread-count change with
|
|
1250
|
+
// no other field change would be skipped as a no-op render.
|
|
1251
|
+
(typeof s.favoriteOrder === "number" ? s.favoriteOrder : "") + "," +
|
|
1252
|
+
(s.unread || 0) + "," +
|
|
1198
1253
|
(s.lastActivity || 0) + "," +
|
|
1199
1254
|
(s.sessionVisibility || "") + "," +
|
|
1200
1255
|
(s.agentName || "") + "," +
|
|
1201
|
-
(s.loop ? (s.loop.loopId + ":" + s.loop.role + ":" + s.loop.source
|
|
1256
|
+
(s.loop ? (s.loop.loopId + ":" + s.loop.role + ":" + s.loop.source + ":" +
|
|
1257
|
+
(s.loop.name || "") + ":" + (s.loop.iteration || "") + ":" + (s.loop.startedAt || "")) : "")
|
|
1202
1258
|
);
|
|
1203
1259
|
}
|
|
1204
1260
|
// Include expanded state so chevron toggles still trigger a re-render
|
|
@@ -1210,6 +1266,14 @@ function _fingerprintSessions(list, expanded, expandedRuns) {
|
|
|
1210
1266
|
export function renderSessionList(sessions) {
|
|
1211
1267
|
if (sessions) cachedSessions = sessions;
|
|
1212
1268
|
|
|
1269
|
+
// A full rebuild below (innerHTML = "") detaches the in-progress rename
|
|
1270
|
+
// <input> / armed-delete "x" button without a real user action. Settle
|
|
1271
|
+
// both cleanly first: commit the rename using its current value (matching
|
|
1272
|
+
// existing blur-to-commit behavior) and clear the armed-delete affordance
|
|
1273
|
+
// so the rebuilt button doesn't silently delete on the next single click.
|
|
1274
|
+
if (activeRename) activeRename.commit();
|
|
1275
|
+
clearArmedSessionDelete();
|
|
1276
|
+
|
|
1213
1277
|
// Skip full rebuild when session data hasn't changed. Server often
|
|
1214
1278
|
// re-broadcasts session_list after unrelated events (session switches,
|
|
1215
1279
|
// WS reconnects, presence updates). Each rebuild does innerHTML="" on the
|
|
@@ -1492,7 +1556,10 @@ function updateCountdowns() {
|
|
|
1492
1556
|
var min = Math.floor(remaining / 60);
|
|
1493
1557
|
var sec = remaining % 60;
|
|
1494
1558
|
var timeStr = min + ":" + (sec < 10 ? "0" : "") + sec;
|
|
1495
|
-
|
|
1559
|
+
// u.color is server-controlled; only accept a strict hex color into the
|
|
1560
|
+
// string-built style="" attribute — anything else is dropped.
|
|
1561
|
+
var safeCountdownColor = u.color && /^#[0-9a-f]{3,8}$/i.test(u.color) ? u.color : null;
|
|
1562
|
+
var colorStyle = safeCountdownColor ? " style=\"border-left-color:" + safeCountdownColor + "\"" : "";
|
|
1496
1563
|
html += '<div class="session-countdown-item"' + colorStyle + '>';
|
|
1497
1564
|
html += '<span class="session-countdown-name">' + escapeHtml(u.name) + '</span>';
|
|
1498
1565
|
html += '<span class="session-countdown-badge">' + timeStr + '</span>';
|
|
@@ -239,12 +239,8 @@ function stopRecording() {
|
|
|
239
239
|
sttBtn.classList.remove('stt-active');
|
|
240
240
|
sttBtn.innerHTML = iconHtml('mic');
|
|
241
241
|
refreshIcons();
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
} else {
|
|
245
|
-
var _v = store.get('currentVendor') || "claude";
|
|
246
|
-
ctx.inputEl.setAttribute('placeholder', 'Message ' + (VENDOR_NAMES[_v] || VENDOR_NAMES.claude) + '...');
|
|
247
|
-
}
|
|
242
|
+
var _v = store.get('currentVendor') || "claude";
|
|
243
|
+
ctx.inputEl.setAttribute('placeholder', 'Message ' + (VENDOR_NAMES[_v] || VENDOR_NAMES.claude) + '...');
|
|
248
244
|
}
|
|
249
245
|
|
|
250
246
|
// --- External lang setter (used by profile module) ---
|
|
@@ -481,7 +481,6 @@ function loadPreferences() {
|
|
|
481
481
|
.then(function (data) {
|
|
482
482
|
if (!data) return;
|
|
483
483
|
applyPreferences('session', data.session || null);
|
|
484
|
-
applyPreferences('mate', data.mate || null);
|
|
485
484
|
})
|
|
486
485
|
.catch(function () { /* first-time users have no saved prefs; ignore */ });
|
|
487
486
|
}
|
|
@@ -356,12 +356,8 @@ export function disableMainInput() {
|
|
|
356
356
|
|
|
357
357
|
export function enableMainInput() {
|
|
358
358
|
ctx.inputEl.disabled = false;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
} else {
|
|
362
|
-
var _v = store.get('currentVendor') || "claude";
|
|
363
|
-
ctx.inputEl.placeholder = "Message " + (VENDOR_NAMES[_v] || VENDOR_NAMES.claude) + "...";
|
|
364
|
-
}
|
|
359
|
+
var _v = store.get('currentVendor') || "claude";
|
|
360
|
+
ctx.inputEl.placeholder = "Message " + (VENDOR_NAMES[_v] || VENDOR_NAMES.claude) + "...";
|
|
365
361
|
}
|
|
366
362
|
|
|
367
363
|
function submitAskUserAnswer(container, toolId, questions, answers, multiSelections) {
|
package/lib/public/style.css
CHANGED
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
@import url("css/agent-picker.css");
|
|
32
32
|
@import url("css/mention.css");
|
|
33
33
|
@import url("css/at-agents.css");
|
|
34
|
-
@import url("css/debate.css");
|
|
35
34
|
@import url("css/notifications-center.css");
|
|
36
35
|
@import url("css/team-panel.css");
|
|
37
36
|
@import url("css/diagnostics.css");
|