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.
@@ -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="tel" maxlength="1" inputmode="numeric" autocomplete="off" 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">' +
300
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" 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">' +
301
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" 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">' +
302
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" 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">' +
303
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" 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">' +
304
- '<input class="fcp-digit" type="tel" maxlength="1" inputmode="numeric" autocomplete="off" 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">' +
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
- var pinValues = ["", "", "", "", "", ""];
315
- var _settingDigit = false;
316
-
317
- function setDigit(idx, v) {
318
- pinValues[idx] = v;
319
- _settingDigit = true;
320
- boxes[idx].value = v ? "\u2022" : "";
321
- _settingDigit = false;
322
- boxes[idx].classList.toggle("filled", v.length > 0);
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
- return pinValues.join("");
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 ready = getPin().length === 6;
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
- if (_settingDigit) return;
347
+ // Coerce to a single digit. If user types non-numeric, drop it.
339
348
  var raw = this.value.replace(/[^0-9]/g, "");
340
- if (!raw) { setDigit(idx, ""); updateBtn(); return; }
341
- var v = raw.charAt(raw.length - 1);
342
- setDigit(idx, v);
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 (!pinValues[idx] && idx > 0) {
349
- setDigit(idx - 1, "");
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
- setDigit(idx, "");
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
- setDigit(idx + j, text.charAt(j));
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
- contextData.model = m;
855
- contextData.contextWindow = resolveContextWindow(m, mu.contextWindow);
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
- queryModel = modelEntryValue(vendorModels[0]);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "2.36.2-beta.1",
3
+ "version": "2.36.2-beta.3",
4
4
  "description": "Self-hosted team workspace for Claude Code and Codex. Multi-user, browser-based, with persistent AI mates.",
5
5
  "bin": {
6
6
  "clay-server": "./bin/cli.js",