clay-server 3.4.0-beta.6 → 3.4.0-beta.7
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 +1 -0
- package/lib/public/modules/app-messages.js +12 -4
- package/lib/public/modules/app-panels.js +1 -1
- package/lib/public/modules/app-rendering.js +1 -1
- package/lib/public/modules/sidebar-sessions.js +3 -5
- package/lib/public/modules/vendor-priority.js +9 -0
- package/lib/public/modules/vendor-selection.js +20 -0
- package/package.json +1 -1
package/lib/public/app.js
CHANGED
|
@@ -295,6 +295,7 @@ import { initDebate, handleDebatePreparing, handleDebateStarted, handleDebateRes
|
|
|
295
295
|
slashCommands: [],
|
|
296
296
|
processing: false,
|
|
297
297
|
activeSessionId: null,
|
|
298
|
+
sessionVendorBound: false,
|
|
298
299
|
cliSessionId: null,
|
|
299
300
|
isHeadlessMode: false,
|
|
300
301
|
savedMainSlug: null,
|
|
@@ -52,6 +52,7 @@ import { setStatus } from './app-connection.js';
|
|
|
52
52
|
import { handleWhatsNewState, handleWhatsNewSeenResult, setKnownEntries as setWhatsNewKnownEntries } from './whats-new.js';
|
|
53
53
|
import { closeArticle as closeWhatsNewArticle } from './whats-new-article.js';
|
|
54
54
|
import { resolvePaneSession, resolveSwitchedVendor } from './pane-session.js';
|
|
55
|
+
import { selectDefaultVendorForBlankSession } from './vendor-selection.js';
|
|
55
56
|
import { getModelEffortLevels, accumulateUsage, updateUsagePanel, accumulateContext, updateContextPanel, renderCtxPopover, updateStatusPanel } from './app-panels.js';
|
|
56
57
|
import { updateProjectList, resetClientState, showUpdateAvailable, handleRemoveProjectCheckResult, handleRemoveProjectResult, handleBrowseDirResult, handleAddProjectResult, handleCloneProgress } from './app-projects.js';
|
|
57
58
|
import { updateHistorySentinel, prependOlderHistory } from './app-header.js';
|
|
@@ -414,6 +415,15 @@ export function processMessage(msg) {
|
|
|
414
415
|
break;
|
|
415
416
|
|
|
416
417
|
case "model_info": {
|
|
418
|
+
// Installation state applies across vendors. Keep it even when the
|
|
419
|
+
// model payload itself is stale for the active session.
|
|
420
|
+
var _vendorState = {};
|
|
421
|
+
if (msg.availableVendors) _vendorState.availableVendors = msg.availableVendors;
|
|
422
|
+
if (msg.installedVendors) _vendorState.installedVendors = msg.installedVendors;
|
|
423
|
+
if (Object.keys(_vendorState).length > 0) {
|
|
424
|
+
store.set(_vendorState);
|
|
425
|
+
selectDefaultVendorForBlankSession();
|
|
426
|
+
}
|
|
417
427
|
// Drop stale model_info from a vendor that doesn't match the active
|
|
418
428
|
// session's vendor. On high-latency connections, the server's default-
|
|
419
429
|
// adapter model_info can arrive after session_switched has already
|
|
@@ -447,8 +457,6 @@ export function processMessage(msg) {
|
|
|
447
457
|
_miUpdate.currentModel = store.get('currentModel');
|
|
448
458
|
}
|
|
449
459
|
if (msg.vendor && !store.get('vendorSelectionLocked')) _miUpdate.currentVendor = msg.vendor;
|
|
450
|
-
if (msg.availableVendors) _miUpdate.availableVendors = msg.availableVendors;
|
|
451
|
-
if (msg.installedVendors) _miUpdate.installedVendors = msg.installedVendors;
|
|
452
460
|
if (msg.capabilities) _miUpdate.vendorCapabilities = msg.capabilities;
|
|
453
461
|
store.set(_miUpdate);
|
|
454
462
|
updateSettingsModels(_modelVal, msg.models || []);
|
|
@@ -661,7 +669,7 @@ export function processMessage(msg) {
|
|
|
661
669
|
var _effectiveTerminalId = (typeof msg.runtimeTerminalId === "number")
|
|
662
670
|
? msg.runtimeTerminalId
|
|
663
671
|
: (typeof msg.terminalId === "number" ? msg.terminalId : null);
|
|
664
|
-
store.set({ activeSessionId: msg.id, cliSessionId: msg.cliSessionId || null, currentModel: msg.model || store.get('currentModel'), currentEffort: msg.effort || store.get('currentEffort'), vendorCapabilities: msg.capabilities || {}, sessionIsProcessing: !!msg.isProcessing, activeSessionMode: _effectiveMode, activeTerminalId: _effectiveTerminalId, sessionHasHistory: !!msg.hasHistory, sessionFullAccess: msg.permissionMode === "bypassPermissions", currentMode: msg.permissionMode || store.get('currentMode') });
|
|
672
|
+
store.set({ activeSessionId: msg.id, cliSessionId: msg.cliSessionId || null, currentModel: msg.model || store.get('currentModel'), currentEffort: msg.effort || store.get('currentEffort'), vendorCapabilities: msg.capabilities || {}, sessionIsProcessing: !!msg.isProcessing, activeSessionMode: _effectiveMode, activeTerminalId: _effectiveTerminalId, sessionHasHistory: !!msg.hasHistory, sessionVendorBound: !!msg.vendor || !!msg.hasHistory, sessionFullAccess: msg.permissionMode === "bypassPermissions", currentMode: msg.permissionMode || store.get('currentMode') });
|
|
665
673
|
// TUI sessions swap the chat UI for an embedded xterm running
|
|
666
674
|
// `claude` inside a real PTY. Mount or tear down before the rest of
|
|
667
675
|
// the chat-side bookkeeping runs so we don't waste work on hidden DOM.
|
|
@@ -706,7 +714,7 @@ export function processMessage(msg) {
|
|
|
706
714
|
}
|
|
707
715
|
}
|
|
708
716
|
if (!msg.hasHistory && !msg.vendor) {
|
|
709
|
-
|
|
717
|
+
selectDefaultVendorForBlankSession();
|
|
710
718
|
}
|
|
711
719
|
// Vendor toggle visibility + active-vendor indicator next to the
|
|
712
720
|
// model chip.
|
|
@@ -474,7 +474,7 @@ export function initPanels() {
|
|
|
474
474
|
if (vendor === (store.get('currentVendor') || "claude")) return;
|
|
475
475
|
var installed = store.get('installedVendors') || [];
|
|
476
476
|
if (installed.indexOf(vendor) === -1) return;
|
|
477
|
-
store.set({ currentVendor: vendor, currentModel: "", currentModels: [], vendorSelectionLocked: true });
|
|
477
|
+
store.set({ currentVendor: vendor, currentModel: "", currentModels: [], vendorSelectionLocked: true, sessionVendorBound: true });
|
|
478
478
|
var ws = getWs();
|
|
479
479
|
if (ws) ws.send(JSON.stringify({ type: "set_vendor", vendor: vendor }));
|
|
480
480
|
}
|
|
@@ -13,6 +13,7 @@ import { showImageModal, showPasteModal } from './app-misc.js';
|
|
|
13
13
|
import { sendMessage, hasSendableContent } from './input.js';
|
|
14
14
|
import { getChatLayout } from './theme.js';
|
|
15
15
|
import { getScheduledMsgEl } from './app-rate-limit.js';
|
|
16
|
+
export { VENDOR_ORDER } from './vendor-priority.js';
|
|
16
17
|
|
|
17
18
|
// Keep these client constants aligned with lib/yoke/vendor-registry.js. The
|
|
18
19
|
// browser cannot import the server's CommonJS registry directly.
|
|
@@ -33,7 +34,6 @@ export var VENDOR_NAMES = {
|
|
|
33
34
|
// Display order for every vendor Clay knows about, installed or not. Pickers
|
|
34
35
|
// render the full list so a missing CLI reads as "not installed yet" rather
|
|
35
36
|
// than "Clay doesn't support it".
|
|
36
|
-
export var VENDOR_ORDER = ["claude", "codex", "antigravity", "opencode", "kiro"];
|
|
37
37
|
// Where to send the user when they pick a vendor whose CLI isn't installed.
|
|
38
38
|
export var VENDOR_HOMEPAGES = {
|
|
39
39
|
claude: "https://claude.com/product/claude-code",
|
|
@@ -299,13 +299,10 @@ function appendSessionCloseButton(el, session) {
|
|
|
299
299
|
el.appendChild(closeBtn);
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
// Resolve the vendor the "New session" button should launch
|
|
303
|
-
//
|
|
304
|
-
// vendor, else Claude (so the button always has a sane label to render).
|
|
302
|
+
// Resolve the vendor the "New session" button should launch from the stable
|
|
303
|
+
// installed-vendor priority (Claude, then Codex, then the remaining vendors).
|
|
305
304
|
export function resolveDefaultVendor() {
|
|
306
305
|
var installed = store.get('installedVendors') || [];
|
|
307
|
-
var last = store.get('lastVendor') || "";
|
|
308
|
-
if (last && installed.indexOf(last) !== -1) return last;
|
|
309
306
|
for (var i = 0; i < VENDOR_ORDER.length; i++) {
|
|
310
307
|
if (installed.indexOf(VENDOR_ORDER[i]) !== -1) return VENDOR_ORDER[i];
|
|
311
308
|
}
|
|
@@ -330,6 +327,7 @@ export function startNewSession(vendor, extra) {
|
|
|
330
327
|
currentModel: "",
|
|
331
328
|
currentModels: [],
|
|
332
329
|
vendorSelectionLocked: true,
|
|
330
|
+
sessionVendorBound: true,
|
|
333
331
|
});
|
|
334
332
|
}
|
|
335
333
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var VENDOR_ORDER = ["claude", "codex", "antigravity", "opencode", "kiro"];
|
|
2
|
+
|
|
3
|
+
export function firstInstalledVendor(installedVendors) {
|
|
4
|
+
var installed = Array.isArray(installedVendors) ? installedVendors : [];
|
|
5
|
+
for (var i = 0; i < VENDOR_ORDER.length; i++) {
|
|
6
|
+
if (installed.indexOf(VENDOR_ORDER[i]) !== -1) return VENDOR_ORDER[i];
|
|
7
|
+
}
|
|
8
|
+
return "";
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { store } from './store.js';
|
|
2
|
+
import { firstInstalledVendor } from './vendor-priority.js';
|
|
3
|
+
|
|
4
|
+
export function selectDefaultVendorForBlankSession() {
|
|
5
|
+
var state = store.snap();
|
|
6
|
+
if (!state.activeSessionId || state.sessionHasHistory || state.sessionVendorBound || state.dmMode) return "";
|
|
7
|
+
var vendor = firstInstalledVendor(state.installedVendors);
|
|
8
|
+
if (!vendor) return "";
|
|
9
|
+
if (vendor === state.currentVendor) {
|
|
10
|
+
if (state.vendorSelectionLocked) store.set({ vendorSelectionLocked: false });
|
|
11
|
+
return vendor;
|
|
12
|
+
}
|
|
13
|
+
store.set({
|
|
14
|
+
currentVendor: vendor,
|
|
15
|
+
currentModel: "",
|
|
16
|
+
currentModels: [],
|
|
17
|
+
vendorSelectionLocked: false,
|
|
18
|
+
});
|
|
19
|
+
return vendor;
|
|
20
|
+
}
|
package/package.json
CHANGED