clay-server 2.36.1-beta.2 → 2.36.1-beta.4
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/modules/input.js +17 -4
- package/lib/sdk-bridge.js +4 -3
- package/package.json +1 -1
|
@@ -1078,6 +1078,13 @@ export function initInput(_ctx) {
|
|
|
1078
1078
|
return;
|
|
1079
1079
|
}
|
|
1080
1080
|
e.preventDefault();
|
|
1081
|
+
// While Claude is processing and the user has nothing queued, Enter
|
|
1082
|
+
// must not adopt a ghost suggestion — pressing Enter while waiting
|
|
1083
|
+
// should be a no-op, not a send of a stale suggestion the user never
|
|
1084
|
+
// typed.
|
|
1085
|
+
if (ctx.processing && !hasSendableContent()) {
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1081
1088
|
// If input has no sendable content but ghost suggestion is showing, adopt it.
|
|
1082
1089
|
// Use hasSendableContent() instead of checking inputEl.value alone so that
|
|
1083
1090
|
// pending images, pastes, or files block the ghost-text adoption — otherwise
|
|
@@ -1097,8 +1104,17 @@ export function initInput(_ctx) {
|
|
|
1097
1104
|
ctx.inputEl.setAttribute("enterkeyhint", "enter");
|
|
1098
1105
|
}
|
|
1099
1106
|
|
|
1100
|
-
// Send/Stop button —
|
|
1107
|
+
// Send/Stop button — gate stop vs send on live state. If Claude is
|
|
1108
|
+
// processing and the user has nothing queued, the click is a Stop and
|
|
1109
|
+
// must not adopt a ghost suggestion. Otherwise it's a send.
|
|
1110
|
+
// (regression after #337 / 0753833)
|
|
1101
1111
|
ctx.sendBtn.addEventListener("click", function () {
|
|
1112
|
+
if (ctx.processing && !hasSendableContent()) {
|
|
1113
|
+
if (ctx.connected) {
|
|
1114
|
+
ctx.ws.send(JSON.stringify({ type: "stop" }));
|
|
1115
|
+
}
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1102
1118
|
// Adopt ghost suggestion if input is empty
|
|
1103
1119
|
var ghost = ctx.getGhostSuggestion ? ctx.getGhostSuggestion() : "";
|
|
1104
1120
|
if (!hasSendableContent() && ghost) {
|
|
@@ -1111,9 +1127,6 @@ export function initInput(_ctx) {
|
|
|
1111
1127
|
sendMessage();
|
|
1112
1128
|
return;
|
|
1113
1129
|
}
|
|
1114
|
-
if (ctx.processing && ctx.connected) {
|
|
1115
|
-
ctx.ws.send(JSON.stringify({ type: "stop" }));
|
|
1116
|
-
}
|
|
1117
1130
|
});
|
|
1118
1131
|
ctx.sendBtn.addEventListener("dblclick", function (e) { e.preventDefault(); });
|
|
1119
1132
|
}
|
package/lib/sdk-bridge.js
CHANGED
|
@@ -270,8 +270,9 @@ function createSDKBridge(opts) {
|
|
|
270
270
|
// Auto-generate a session title via YOKE adapter.generateTitle().
|
|
271
271
|
// Triggered by sdk-message-processor after AUTO_TITLE_TURN_THRESHOLD turns.
|
|
272
272
|
function autoGenerateTitle(session) {
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
var sessionAdapter = getAdapterForSession(session);
|
|
274
|
+
if (typeof sessionAdapter.generateTitle !== "function") {
|
|
275
|
+
console.log("[auto-title] adapter.generateTitle not available for vendor=" + sessionAdapter.vendor);
|
|
275
276
|
return;
|
|
276
277
|
}
|
|
277
278
|
var userMessages = [];
|
|
@@ -288,7 +289,7 @@ function createSDKBridge(opts) {
|
|
|
288
289
|
}
|
|
289
290
|
console.log("[auto-title] Calling adapter.generateTitle with " + userMessages.length + " messages for session " + session.localId);
|
|
290
291
|
|
|
291
|
-
|
|
292
|
+
sessionAdapter.generateTitle(userMessages, { cwd: cwd }).then(function(title) {
|
|
292
293
|
if (!title || title.length < 2) return;
|
|
293
294
|
title = title.substring(0, 100);
|
|
294
295
|
if (!session.titleManuallySet) {
|
package/package.json
CHANGED