clay-server 3.4.0-beta.5 → 3.4.0-beta.6
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-connection.js +19 -4
- package/lib/sdk-bridge.js +9 -13
- package/package.json +1 -1
|
@@ -22,6 +22,17 @@ function dispatchMessageSafely(handleMessage, sendTo, slug, ws, msg) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function buildInitialModelInfo(sm, initialVendor, initialModel, initialModels) {
|
|
26
|
+
return {
|
|
27
|
+
type: "model_info",
|
|
28
|
+
model: initialModel || "",
|
|
29
|
+
models: initialModels || [],
|
|
30
|
+
vendor: initialVendor,
|
|
31
|
+
availableVendors: sm.availableVendors || [],
|
|
32
|
+
installedVendors: sm.installedVendors || [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
/**
|
|
26
37
|
* Attach connection/disconnection handlers to a project context.
|
|
27
38
|
*
|
|
@@ -167,9 +178,9 @@ function attachConnection(ctx) {
|
|
|
167
178
|
sendTo(ws, { type: "slash_commands", commands: sm.slashCommands });
|
|
168
179
|
}
|
|
169
180
|
var initialModel = (restoredActive && restoredActive.model) || sm.currentModel || "";
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
181
|
+
// Vendor installation state is needed even before a new project has a
|
|
182
|
+
// model. Always send it so reconnects cannot fall back to "Not installed."
|
|
183
|
+
sendTo(ws, buildInitialModelInfo(sm, initialVendor, initialModel, initialModels));
|
|
173
184
|
sendTo(ws, { type: "config_state", model: initialModel, mode: sm.currentPermissionMode || "default", effort: initialEffort || "medium", betas: sm.currentBetas || [], thinking: sm.currentThinking || "adaptive", thinkingBudget: sm.currentThinkingBudget || 10000 });
|
|
174
185
|
sendTo(ws, { type: "last_vendor", vendor: sm.lastVendor || "" });
|
|
175
186
|
sendTo(ws, Object.assign({ type: "codex_config" }, getCodexConfig(sm)));
|
|
@@ -333,4 +344,8 @@ function attachConnection(ctx) {
|
|
|
333
344
|
};
|
|
334
345
|
}
|
|
335
346
|
|
|
336
|
-
module.exports = {
|
|
347
|
+
module.exports = {
|
|
348
|
+
attachConnection: attachConnection,
|
|
349
|
+
buildInitialModelInfo: buildInitialModelInfo,
|
|
350
|
+
dispatchMessageSafely: dispatchMessageSafely,
|
|
351
|
+
};
|
package/lib/sdk-bridge.js
CHANGED
|
@@ -1859,6 +1859,13 @@ function createSDKBridge(opts) {
|
|
|
1859
1859
|
var defaultVendor = adapter ? adapter.vendor : "claude";
|
|
1860
1860
|
sm.defaultVendor = defaultVendor;
|
|
1861
1861
|
|
|
1862
|
+
// Installation detection is independent of adapter initialization. Publish
|
|
1863
|
+
// it before warmup so a new project does not render the initial empty state
|
|
1864
|
+
// as if every CLI were missing while the default adapter starts up.
|
|
1865
|
+
sm.installedVendors = detectInstalledVendors(linuxUser);
|
|
1866
|
+
sm.availableVendors = getAvailableVendors(linuxUser);
|
|
1867
|
+
sendModelInfoForVendor(defaultVendor, sm.currentModel || "");
|
|
1868
|
+
|
|
1862
1869
|
// Initialize default adapter first (provides skills, slash commands, etc.)
|
|
1863
1870
|
if (adapter) {
|
|
1864
1871
|
try {
|
|
@@ -1910,19 +1917,8 @@ function createSDKBridge(opts) {
|
|
|
1910
1917
|
// actually issues a query with it.
|
|
1911
1918
|
sm.modelsByVendor = sm.modelsByVendor || {};
|
|
1912
1919
|
|
|
1913
|
-
//
|
|
1914
|
-
sm.
|
|
1915
|
-
sm.availableVendors = getAvailableVendors(linuxUser);
|
|
1916
|
-
|
|
1917
|
-
// Send initial state to client
|
|
1918
|
-
send({
|
|
1919
|
-
type: "model_info",
|
|
1920
|
-
model: sm.currentModel || "",
|
|
1921
|
-
models: getModelsForVendor(defaultVendor),
|
|
1922
|
-
vendor: defaultVendor,
|
|
1923
|
-
availableVendors: sm.availableVendors,
|
|
1924
|
-
installedVendors: sm.installedVendors,
|
|
1925
|
-
});
|
|
1920
|
+
// Send the fully initialized state to the client.
|
|
1921
|
+
sendModelInfoForVendor(defaultVendor, sm.currentModel || "");
|
|
1926
1922
|
}
|
|
1927
1923
|
|
|
1928
1924
|
async function setModel(session, model) {
|
package/package.json
CHANGED