clay-server 2.14.0-beta.1 → 2.14.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/lib/public/app.js +30 -0
- package/lib/public/css/mates.css +41 -17
- package/lib/public/modules/input.js +5 -0
- package/lib/public/modules/tools.js +15 -4
- package/package.json +1 -1
package/lib/public/app.js
CHANGED
|
@@ -1804,6 +1804,32 @@ import { initCommandPalette, handlePaletteSessionSwitch, setPaletteVersion } fro
|
|
|
1804
1804
|
}
|
|
1805
1805
|
}
|
|
1806
1806
|
|
|
1807
|
+
// --- Mate pre-thinking (instant dots before server responds) ---
|
|
1808
|
+
var matePreThinkingEl = null;
|
|
1809
|
+
function showMatePreThinking() {
|
|
1810
|
+
removeMatePreThinking();
|
|
1811
|
+
var mateName = dmTargetUser ? (dmTargetUser.displayName || "Mate") : "Mate";
|
|
1812
|
+
var mateAvatar = document.body.dataset.mateAvatarUrl || "";
|
|
1813
|
+
matePreThinkingEl = document.createElement("div");
|
|
1814
|
+
matePreThinkingEl.className = "thinking-item mate-thinking mate-pre-thinking";
|
|
1815
|
+
matePreThinkingEl.innerHTML =
|
|
1816
|
+
'<div class="mate-thinking-row" style="display:flex">' +
|
|
1817
|
+
'<img class="mate-thinking-avatar" src="' + escapeHtml(mateAvatar) + '" alt="">' +
|
|
1818
|
+
'<div class="mate-thinking-body">' +
|
|
1819
|
+
'<span class="mate-thinking-name">' + escapeHtml(mateName) + '</span>' +
|
|
1820
|
+
'<span class="mate-thinking-dots"><span></span><span></span><span></span></span>' +
|
|
1821
|
+
'</div>' +
|
|
1822
|
+
'</div>';
|
|
1823
|
+
addToMessages(matePreThinkingEl);
|
|
1824
|
+
scrollToBottom();
|
|
1825
|
+
}
|
|
1826
|
+
function removeMatePreThinking() {
|
|
1827
|
+
if (matePreThinkingEl) {
|
|
1828
|
+
matePreThinkingEl.remove();
|
|
1829
|
+
matePreThinkingEl = null;
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1807
1833
|
// --- Config chip (model + mode + effort) ---
|
|
1808
1834
|
var configChipWrap = $("config-chip-wrap");
|
|
1809
1835
|
var configChip = $("config-chip");
|
|
@@ -3691,6 +3717,7 @@ import { initCommandPalette, handlePaletteSessionSwitch, setPaletteVersion } fro
|
|
|
3691
3717
|
break;
|
|
3692
3718
|
|
|
3693
3719
|
case "thinking_start":
|
|
3720
|
+
removeMatePreThinking();
|
|
3694
3721
|
startThinking();
|
|
3695
3722
|
break;
|
|
3696
3723
|
|
|
@@ -3705,6 +3732,7 @@ import { initCommandPalette, handlePaletteSessionSwitch, setPaletteVersion } fro
|
|
|
3705
3732
|
|
|
3706
3733
|
case "delta":
|
|
3707
3734
|
if (typeof msg.text !== "string") break;
|
|
3735
|
+
removeMatePreThinking();
|
|
3708
3736
|
stopThinking();
|
|
3709
3737
|
resetThinkingGroup();
|
|
3710
3738
|
setActivity(null);
|
|
@@ -3712,6 +3740,7 @@ import { initCommandPalette, handlePaletteSessionSwitch, setPaletteVersion } fro
|
|
|
3712
3740
|
break;
|
|
3713
3741
|
|
|
3714
3742
|
case "tool_start":
|
|
3743
|
+
removeMatePreThinking();
|
|
3715
3744
|
stopThinking();
|
|
3716
3745
|
markAllToolsDone();
|
|
3717
3746
|
if (msg.name === "EnterPlanMode") {
|
|
@@ -4531,6 +4560,7 @@ import { initCommandPalette, handlePaletteSessionSwitch, setPaletteVersion } fro
|
|
|
4531
4560
|
isMateDm: function () { return dmMode && dmTargetUser && dmTargetUser.isMate; },
|
|
4532
4561
|
getMateName: function () { return dmTargetUser ? (dmTargetUser.displayName || "Mate") : "Mate"; },
|
|
4533
4562
|
getMateAvatarUrl: function () { return document.body.dataset.mateAvatarUrl || ""; },
|
|
4563
|
+
showMatePreThinking: function () { showMatePreThinking(); },
|
|
4534
4564
|
});
|
|
4535
4565
|
|
|
4536
4566
|
// --- STT module (voice input via Web Speech API) ---
|
package/lib/public/css/mates.css
CHANGED
|
@@ -1376,15 +1376,51 @@ body.mate-dm-active .mate-thinking:not(.done) .mate-thinking-row {
|
|
|
1376
1376
|
30% { transform: translateY(-4px); opacity: 1; }
|
|
1377
1377
|
}
|
|
1378
1378
|
|
|
1379
|
-
/* When done, hide mate row (JS does this too), show
|
|
1379
|
+
/* When done, hide mate row (JS does this too), show compact expandable header */
|
|
1380
1380
|
body.mate-dm-active .mate-thinking.done .mate-thinking-row {
|
|
1381
1381
|
display: none;
|
|
1382
1382
|
}
|
|
1383
1383
|
body.mate-dm-active .mate-thinking.done .thinking-header {
|
|
1384
1384
|
display: inline-flex !important;
|
|
1385
|
+
font-size: 12px;
|
|
1386
|
+
padding: 4px 10px;
|
|
1387
|
+
background: rgba(var(--overlay-rgb), 0.04);
|
|
1388
|
+
border-radius: 6px;
|
|
1389
|
+
opacity: 0.7;
|
|
1390
|
+
transition: opacity 0.15s;
|
|
1391
|
+
}
|
|
1392
|
+
body.mate-dm-active .mate-thinking.done .thinking-header:hover {
|
|
1393
|
+
opacity: 1;
|
|
1394
|
+
background: rgba(var(--overlay-rgb), 0.08);
|
|
1395
|
+
}
|
|
1396
|
+
body.mate-dm-active .mate-thinking .thinking-content {
|
|
1397
|
+
max-height: 0;
|
|
1398
|
+
overflow: hidden;
|
|
1399
|
+
transition: max-height 0.25s ease;
|
|
1400
|
+
}
|
|
1401
|
+
body.mate-dm-active .mate-thinking.expanded .thinking-content {
|
|
1402
|
+
max-height: 2000px;
|
|
1385
1403
|
}
|
|
1386
1404
|
|
|
1387
|
-
/* --- Mate Tool Group:
|
|
1405
|
+
/* --- Mate Tool Group: compact, always collapsed with summary header --- */
|
|
1406
|
+
body.mate-dm-active .mate-tool-group {
|
|
1407
|
+
margin: 2px 0;
|
|
1408
|
+
}
|
|
1409
|
+
body.mate-dm-active .mate-tool-group .tool-group-header {
|
|
1410
|
+
font-size: 12px;
|
|
1411
|
+
padding: 4px 10px;
|
|
1412
|
+
background: rgba(var(--overlay-rgb), 0.04);
|
|
1413
|
+
border-radius: 6px;
|
|
1414
|
+
opacity: 0.7;
|
|
1415
|
+
transition: opacity 0.15s;
|
|
1416
|
+
}
|
|
1417
|
+
body.mate-dm-active .mate-tool-group .tool-group-header:hover {
|
|
1418
|
+
opacity: 1;
|
|
1419
|
+
background: rgba(var(--overlay-rgb), 0.08);
|
|
1420
|
+
}
|
|
1421
|
+
body.mate-dm-active .mate-tool-group .tool-group-label {
|
|
1422
|
+
font-size: 12px;
|
|
1423
|
+
}
|
|
1388
1424
|
body.mate-dm-active .mate-tool-group .tool-item {
|
|
1389
1425
|
border: none;
|
|
1390
1426
|
background: none;
|
|
@@ -1423,21 +1459,9 @@ body.mate-dm-active .mate-permission .permission-actions {
|
|
|
1423
1459
|
gap: 6px;
|
|
1424
1460
|
}
|
|
1425
1461
|
|
|
1426
|
-
/* --- Mate Activity: avatar + text --- */
|
|
1427
|
-
body.mate-dm-active .
|
|
1428
|
-
display:
|
|
1429
|
-
align-items: center;
|
|
1430
|
-
gap: 8px;
|
|
1431
|
-
}
|
|
1432
|
-
.mate-activity-avatar {
|
|
1433
|
-
width: 20px;
|
|
1434
|
-
height: 20px;
|
|
1435
|
-
border-radius: 4px;
|
|
1436
|
-
flex-shrink: 0;
|
|
1437
|
-
}
|
|
1438
|
-
body.mate-dm-active .mate-activity .activity-text {
|
|
1439
|
-
font-size: 13px;
|
|
1440
|
-
color: var(--text-muted);
|
|
1462
|
+
/* --- Mate Activity: avatar + text (hidden, dots row is enough) --- */
|
|
1463
|
+
body.mate-dm-active .activity-inline {
|
|
1464
|
+
display: none;
|
|
1441
1465
|
}
|
|
1442
1466
|
|
|
1443
1467
|
/* --- Interstitial elements: indent to align with message content (16px pad + 36px avatar + 8px gap = 60px) --- */
|
|
@@ -105,6 +105,11 @@ export function sendMessage() {
|
|
|
105
105
|
}
|
|
106
106
|
ctx.ws.send(JSON.stringify(payload));
|
|
107
107
|
|
|
108
|
+
// Mate DM: show pre-thinking dots immediately (before server responds)
|
|
109
|
+
if (ctx.isMateDm && ctx.isMateDm()) {
|
|
110
|
+
ctx.showMatePreThinking();
|
|
111
|
+
}
|
|
112
|
+
|
|
108
113
|
ctx.inputEl.value = "";
|
|
109
114
|
sendInputSync();
|
|
110
115
|
clearPendingImages();
|
|
@@ -112,9 +112,16 @@ function updateToolGroupHeader(group) {
|
|
|
112
112
|
refreshIcons();
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
// Show group header only when 2+ visible tools
|
|
115
|
+
// Show group header only when 2+ visible tools (or always in mate DM)
|
|
116
116
|
var header = group.el.querySelector(".tool-group-header");
|
|
117
|
-
|
|
117
|
+
var isMate = group.el.classList.contains("mate-tool-group");
|
|
118
|
+
if (isMate) {
|
|
119
|
+
// Mate DM: always show header and collapse
|
|
120
|
+
header.style.display = "";
|
|
121
|
+
if (!group.userToggled) {
|
|
122
|
+
group.el.classList.add("collapsed");
|
|
123
|
+
}
|
|
124
|
+
} else if (group.toolCount >= 2) {
|
|
118
125
|
header.style.display = "";
|
|
119
126
|
// When 2+ tools, ensure collapsed by default (unless user already toggled)
|
|
120
127
|
if (!group.userToggled && !group.el.classList.contains("expanded-by-user")) {
|
|
@@ -1252,12 +1259,15 @@ export function stopThinking(duration) {
|
|
|
1252
1259
|
} else {
|
|
1253
1260
|
currentThinking.el.querySelector(".thinking-duration").textContent = " " + secs.toFixed(1) + "s";
|
|
1254
1261
|
}
|
|
1255
|
-
// In mate mode: hide dots, show expandable thinking header
|
|
1262
|
+
// In mate mode: hide dots, show compact expandable thinking header
|
|
1256
1263
|
if (currentThinking.el.classList.contains("mate-thinking")) {
|
|
1257
1264
|
var dotsRow = currentThinking.el.querySelector(".mate-thinking-row");
|
|
1258
1265
|
if (dotsRow) dotsRow.style.display = "none";
|
|
1259
1266
|
var header = currentThinking.el.querySelector(".thinking-header");
|
|
1260
|
-
if (header)
|
|
1267
|
+
if (header) {
|
|
1268
|
+
header.style.display = "";
|
|
1269
|
+
header.style.cursor = "pointer";
|
|
1270
|
+
}
|
|
1261
1271
|
}
|
|
1262
1272
|
currentThinking = null;
|
|
1263
1273
|
}
|
|
@@ -1289,6 +1299,7 @@ export function createToolItem(id, name) {
|
|
|
1289
1299
|
|
|
1290
1300
|
groupEl.querySelector(".tool-group-header").addEventListener("click", function () {
|
|
1291
1301
|
groupEl.classList.toggle("collapsed");
|
|
1302
|
+
if (currentToolGroup) currentToolGroup.userToggled = true;
|
|
1292
1303
|
});
|
|
1293
1304
|
|
|
1294
1305
|
ctx.addToMessages(groupEl);
|