clay-server 2.36.2-beta.1 → 2.36.2-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/project-sessions.js
CHANGED
|
@@ -330,10 +330,11 @@ function attachSessions(ctx) {
|
|
|
330
330
|
var targetVendor = switchTargetSess.vendor || sm.defaultVendor || null;
|
|
331
331
|
var tvModels = (targetVendor && sm.modelsByVendor && sm.modelsByVendor[targetVendor]) || [];
|
|
332
332
|
var found = false;
|
|
333
|
+
var _curLc = sm.currentModel.toLowerCase();
|
|
333
334
|
for (var tvi = 0; tvi < tvModels.length; tvi++) {
|
|
334
335
|
var tvEntry = tvModels[tvi];
|
|
335
336
|
var tvVal = typeof tvEntry === "string" ? tvEntry : (tvEntry && (tvEntry.value || tvEntry.id)) || "";
|
|
336
|
-
if (tvVal === sm.currentModel) { found = true; break; }
|
|
337
|
+
if (tvVal === sm.currentModel || (tvVal && (tvVal.toLowerCase().indexOf(_curLc) !== -1 || _curLc.indexOf(tvVal.toLowerCase()) !== -1))) { found = true; break; }
|
|
337
338
|
}
|
|
338
339
|
if (tvModels.length > 0 && !found) {
|
|
339
340
|
sm.currentModel = "";
|
|
@@ -296,12 +296,12 @@ export function showForceChangePinOverlay() {
|
|
|
296
296
|
'<h2 style="margin:0 0 8px;color:var(--text,#fff);font-size:22px">Set your new PIN</h2>' +
|
|
297
297
|
'<p style="margin:0 0 24px;color:var(--text-secondary,#aaa);font-size:14px">Your temporary PIN has expired. Please set a new 6-digit PIN to continue.</p>' +
|
|
298
298
|
'<div style="display:flex;gap:8px;justify-content:center;margin-bottom:16px" id="fcp-boxes">' +
|
|
299
|
-
'<input class="fcp-digit" type="
|
|
300
|
-
'<input class="fcp-digit" type="
|
|
301
|
-
'<input class="fcp-digit" type="
|
|
302
|
-
'<input class="fcp-digit" type="
|
|
303
|
-
'<input class="fcp-digit" type="
|
|
304
|
-
'<input class="fcp-digit" type="
|
|
299
|
+
'<input class="fcp-digit" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]*" autocomplete="one-time-code" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none;caret-color:var(--accent,#7c3aed)">' +
|
|
300
|
+
'<input class="fcp-digit" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]*" autocomplete="one-time-code" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none;caret-color:var(--accent,#7c3aed)">' +
|
|
301
|
+
'<input class="fcp-digit" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]*" autocomplete="one-time-code" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none;caret-color:var(--accent,#7c3aed)">' +
|
|
302
|
+
'<input class="fcp-digit" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]*" autocomplete="one-time-code" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none;caret-color:var(--accent,#7c3aed)">' +
|
|
303
|
+
'<input class="fcp-digit" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]*" autocomplete="one-time-code" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none;caret-color:var(--accent,#7c3aed)">' +
|
|
304
|
+
'<input class="fcp-digit" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]*" autocomplete="one-time-code" style="width:44px;height:52px;text-align:center;font-size:22px;font-weight:600;border:2px solid var(--border,#333);border-radius:10px;background:var(--bg-alt,#f5f5f5);color:var(--text,#fff);outline:none;caret-color:var(--accent,#7c3aed)">' +
|
|
305
305
|
'</div>' +
|
|
306
306
|
'<button id="fcp-save" disabled style="width:100%;padding:12px;border:none;border-radius:10px;background:var(--accent,#7c3aed);color:#fff;font-size:15px;font-weight:600;cursor:pointer;opacity:0.5">Save PIN</button>' +
|
|
307
307
|
'<div id="fcp-err" style="margin-top:12px;color:#ef4444;font-size:13px"></div>' +
|
|
@@ -311,45 +311,55 @@ export function showForceChangePinOverlay() {
|
|
|
311
311
|
var boxes = ov.querySelectorAll(".fcp-digit");
|
|
312
312
|
var saveBtn = ov.querySelector("#fcp-save");
|
|
313
313
|
var errEl = ov.querySelector("#fcp-err");
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
314
|
+
|
|
315
|
+
// Inject focus styling. Without this the inputs use outline:none with no
|
|
316
|
+
// replacement, so users cannot tell which box is focused. Caret is also
|
|
317
|
+
// forced via caret-color on the input style.
|
|
318
|
+
if (!document.getElementById("fcp-style")) {
|
|
319
|
+
var st = document.createElement("style");
|
|
320
|
+
st.id = "fcp-style";
|
|
321
|
+
st.textContent =
|
|
322
|
+
".fcp-digit:focus{border-color:var(--accent,#7c3aed)!important;box-shadow:0 0 0 3px rgba(124,58,237,0.25)}" +
|
|
323
|
+
".fcp-digit.filled{border-color:var(--accent,#7c3aed)}";
|
|
324
|
+
document.head.appendChild(st);
|
|
323
325
|
}
|
|
324
326
|
|
|
325
327
|
function getPin() {
|
|
326
|
-
|
|
328
|
+
var pin = "";
|
|
329
|
+
for (var i = 0; i < boxes.length; i++) pin += boxes[i].value;
|
|
330
|
+
return pin;
|
|
327
331
|
}
|
|
328
332
|
|
|
329
333
|
function updateBtn() {
|
|
330
|
-
var
|
|
334
|
+
var pin = getPin();
|
|
335
|
+
var ready = pin.length === 6 && /^[0-9]{6}$/.test(pin);
|
|
331
336
|
saveBtn.disabled = !ready;
|
|
332
337
|
saveBtn.style.opacity = ready ? "1" : "0.5";
|
|
333
338
|
}
|
|
334
339
|
|
|
340
|
+
function refreshFilled(idx) {
|
|
341
|
+
boxes[idx].classList.toggle("filled", boxes[idx].value.length > 0);
|
|
342
|
+
}
|
|
343
|
+
|
|
335
344
|
for (var i = 0; i < boxes.length; i++) {
|
|
336
345
|
(function (idx) {
|
|
337
346
|
boxes[idx].addEventListener("input", function () {
|
|
338
|
-
|
|
347
|
+
// Coerce to a single digit. If user types non-numeric, drop it.
|
|
339
348
|
var raw = this.value.replace(/[^0-9]/g, "");
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
if (v && idx < 5) boxes[idx + 1].focus();
|
|
349
|
+
this.value = raw.length > 0 ? raw.charAt(raw.length - 1) : "";
|
|
350
|
+
refreshFilled(idx);
|
|
351
|
+
if (this.value && idx < 5) boxes[idx + 1].focus();
|
|
344
352
|
updateBtn();
|
|
345
353
|
});
|
|
346
354
|
boxes[idx].addEventListener("keydown", function (e) {
|
|
347
355
|
if (e.key === "Backspace") {
|
|
348
|
-
if (!
|
|
349
|
-
|
|
356
|
+
if (!boxes[idx].value && idx > 0) {
|
|
357
|
+
boxes[idx - 1].value = "";
|
|
358
|
+
refreshFilled(idx - 1);
|
|
350
359
|
boxes[idx - 1].focus();
|
|
351
360
|
} else {
|
|
352
|
-
|
|
361
|
+
boxes[idx].value = "";
|
|
362
|
+
refreshFilled(idx);
|
|
353
363
|
}
|
|
354
364
|
updateBtn();
|
|
355
365
|
}
|
|
@@ -364,7 +374,8 @@ export function showForceChangePinOverlay() {
|
|
|
364
374
|
e.preventDefault();
|
|
365
375
|
var text = (e.clipboardData || window.clipboardData).getData("text").replace(/[^0-9]/g, "").substring(0, 6);
|
|
366
376
|
for (var j = 0; j < text.length && (idx + j) < 6; j++) {
|
|
367
|
-
|
|
377
|
+
boxes[idx + j].value = text.charAt(j);
|
|
378
|
+
refreshFilled(idx + j);
|
|
368
379
|
}
|
|
369
380
|
if (text.length > 0) {
|
|
370
381
|
var focusIdx = Math.min(idx + text.length, 5);
|
|
@@ -749,8 +749,9 @@ export function toggleStatusPanel() {
|
|
|
749
749
|
// --- Context panel ---
|
|
750
750
|
|
|
751
751
|
export function resolveContextWindow(model, sdkValue) {
|
|
752
|
-
if (sdkValue) return sdkValue;
|
|
753
752
|
var lc = (model || "").toLowerCase();
|
|
753
|
+
if (lc.includes("[1m]")) return 1000000;
|
|
754
|
+
if (sdkValue) return sdkValue;
|
|
754
755
|
for (var key in KNOWN_CONTEXT_WINDOWS) {
|
|
755
756
|
if (lc.includes(key)) return KNOWN_CONTEXT_WINDOWS[key];
|
|
756
757
|
}
|
|
@@ -851,8 +852,11 @@ export function accumulateContext(cost, usage, modelUsage, lastStreamInputTokens
|
|
|
851
852
|
if (models.length > 0) {
|
|
852
853
|
var m = models[0];
|
|
853
854
|
var mu = modelUsage[m];
|
|
854
|
-
|
|
855
|
-
|
|
855
|
+
// Prefer the user-configured model name over the API-reported one
|
|
856
|
+
// (e.g. CLI reports "claude-sonnet-4-6" even when running as opus[1m])
|
|
857
|
+
var displayModel = store.get('currentModel') || m;
|
|
858
|
+
contextData.model = displayModel;
|
|
859
|
+
contextData.contextWindow = resolveContextWindow(displayModel, mu.contextWindow);
|
|
856
860
|
if (mu.maxOutputTokens) contextData.maxOutputTokens = mu.maxOutputTokens;
|
|
857
861
|
}
|
|
858
862
|
}
|
package/lib/sdk-bridge.js
CHANGED
|
@@ -198,6 +198,24 @@ function createSDKBridge(opts) {
|
|
|
198
198
|
return false;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
// Resolve a shorthand model name (e.g. "opus[1m]") to its full ID
|
|
202
|
+
// in the vendor model list (e.g. "claude-opus-4.6[1m]").
|
|
203
|
+
function resolveModelInList(list, modelId) {
|
|
204
|
+
if (!list || !modelId) return null;
|
|
205
|
+
var lc = modelId.toLowerCase();
|
|
206
|
+
for (var mi = 0; mi < list.length; mi++) {
|
|
207
|
+
var val = modelEntryValue(list[mi]);
|
|
208
|
+
if (val === modelId) return val;
|
|
209
|
+
}
|
|
210
|
+
for (var mi = 0; mi < list.length; mi++) {
|
|
211
|
+
var val = modelEntryValue(list[mi]);
|
|
212
|
+
if (!val || val === "default") continue;
|
|
213
|
+
var vlc = val.toLowerCase();
|
|
214
|
+
if (vlc.indexOf(lc) !== -1 || lc.indexOf(vlc) !== -1) return val;
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
|
|
201
219
|
function sendModelInfoForVendor(vendor, model) {
|
|
202
220
|
send({
|
|
203
221
|
type: "model_info",
|
|
@@ -1234,12 +1252,13 @@ function createSDKBridge(opts) {
|
|
|
1234
1252
|
// Claude would reject the unknown model. We validate against the
|
|
1235
1253
|
// session vendor's model list regardless of which vendor happens to be
|
|
1236
1254
|
// the project's default adapter.
|
|
1237
|
-
var queryModel = ls.model || sm.currentModel || undefined;
|
|
1255
|
+
var queryModel = (ls.model && ls.model !== "default" ? ls.model : null) || sm.currentModel || undefined;
|
|
1238
1256
|
var sessionVendor = session.vendor || (adapter && adapter.vendor) || null;
|
|
1239
1257
|
if (sessionVendor) {
|
|
1240
1258
|
var vendorModels = (sm.modelsByVendor && sm.modelsByVendor[sessionVendor]) || [];
|
|
1241
1259
|
if (vendorModels.length > 0 && queryModel && !modelListContains(vendorModels, queryModel)) {
|
|
1242
|
-
|
|
1260
|
+
var resolved = resolveModelInList(vendorModels, queryModel);
|
|
1261
|
+
queryModel = resolved || modelEntryValue(vendorModels[0]);
|
|
1243
1262
|
}
|
|
1244
1263
|
}
|
|
1245
1264
|
// Guard against anything upstream having set queryModel to an object
|
package/package.json
CHANGED