clay-server 2.18.0-beta.8 → 2.18.0-beta.9
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 +29 -2
- package/lib/sdk-bridge.js +4 -4
- package/package.json +1 -1
package/lib/public/app.js
CHANGED
|
@@ -908,6 +908,13 @@ import { initDebate, handleDebateStarted, handleDebateTurn, handleDebateActivity
|
|
|
908
908
|
var mateSessionDot = document.querySelector(".mate-session-item.active .session-processing");
|
|
909
909
|
if (mateSessionDot) mateSessionDot.style.display = "none";
|
|
910
910
|
}
|
|
911
|
+
// Handle skill_installed in mate DM context (for skill install modal)
|
|
912
|
+
if (msg.type === "skill_installed") {
|
|
913
|
+
handleSkillInstalled(msg);
|
|
914
|
+
if (msg.success) knownInstalledSkills[msg.skill] = true;
|
|
915
|
+
handleSkillInstallWs(msg);
|
|
916
|
+
}
|
|
917
|
+
|
|
911
918
|
// Intercept session_list for mate sidebar
|
|
912
919
|
if (msg.type === "init" && msg.sessions) {
|
|
913
920
|
renderMateSessionList(msg.sessions);
|
|
@@ -3685,6 +3692,14 @@ import { initDebate, handleDebateStarted, handleDebateTurn, handleDebateActivity
|
|
|
3685
3692
|
ws.send(JSON.stringify({ type: "mate_list" }));
|
|
3686
3693
|
} catch(e) {}
|
|
3687
3694
|
|
|
3695
|
+
// Restore the last active session for this project (overrides server global)
|
|
3696
|
+
try {
|
|
3697
|
+
var savedSessionId = localStorage.getItem("clay_active_session_" + basePath);
|
|
3698
|
+
if (savedSessionId) {
|
|
3699
|
+
ws.send(JSON.stringify({ type: "switch_session", id: parseInt(savedSessionId, 10) }));
|
|
3700
|
+
}
|
|
3701
|
+
} catch(e) {}
|
|
3702
|
+
|
|
3688
3703
|
// Restore mate DM after hard refresh or server restart
|
|
3689
3704
|
try {
|
|
3690
3705
|
var savedMateDm = localStorage.getItem("clay_active_mate_dm");
|
|
@@ -3737,8 +3752,18 @@ import { initDebate, handleDebateStarted, handleDebateTurn, handleDebateActivity
|
|
|
3737
3752
|
};
|
|
3738
3753
|
|
|
3739
3754
|
ws.onmessage = function (event) {
|
|
3740
|
-
// If this WS is stashed while in mate DM,
|
|
3741
|
-
if (savedMainWs === this)
|
|
3755
|
+
// If this WS is stashed while in mate DM, only allow skill_installed through
|
|
3756
|
+
if (savedMainWs === this) {
|
|
3757
|
+
try {
|
|
3758
|
+
var stashedMsg = JSON.parse(event.data);
|
|
3759
|
+
if (stashedMsg.type === "skill_installed") {
|
|
3760
|
+
handleSkillInstalled(stashedMsg);
|
|
3761
|
+
if (stashedMsg.success) knownInstalledSkills[stashedMsg.skill] = true;
|
|
3762
|
+
handleSkillInstallWs(stashedMsg);
|
|
3763
|
+
}
|
|
3764
|
+
} catch (e) {}
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3742
3767
|
|
|
3743
3768
|
// Backup: if we're receiving messages, we're connected
|
|
3744
3769
|
if (!connected) {
|
|
@@ -4056,6 +4081,8 @@ import { initDebate, handleDebateStarted, handleDebateTurn, handleDebateActivity
|
|
|
4056
4081
|
}
|
|
4057
4082
|
activeSessionId = msg.id;
|
|
4058
4083
|
cliSessionId = msg.cliSessionId || null;
|
|
4084
|
+
// Persist active session per project so reconnect restores it
|
|
4085
|
+
try { localStorage.setItem("clay_active_session_" + basePath, String(msg.id)); } catch(e) {}
|
|
4059
4086
|
clearRemoteCursors();
|
|
4060
4087
|
resetClientState();
|
|
4061
4088
|
updateRalphBars();
|
package/lib/sdk-bridge.js
CHANGED
|
@@ -1116,10 +1116,10 @@ function createSDKBridge(opts) {
|
|
|
1116
1116
|
return Promise.resolve({ behavior: "allow", updatedInput: input });
|
|
1117
1117
|
}
|
|
1118
1118
|
|
|
1119
|
-
// Mate sessions (DM): auto-approve read
|
|
1119
|
+
// Mate sessions (DM, debate, mention): auto-approve read + fetch tools
|
|
1120
1120
|
if (isMate || mateDisplayName) {
|
|
1121
|
-
var
|
|
1122
|
-
if (
|
|
1121
|
+
var mateAutoTools = { Read: true, Glob: true, Grep: true, WebFetch: true, WebSearch: true };
|
|
1122
|
+
if (mateAutoTools[toolName]) {
|
|
1123
1123
|
return Promise.resolve({ behavior: "allow", updatedInput: input });
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
@@ -1775,7 +1775,7 @@ function createSDKBridge(opts) {
|
|
|
1775
1775
|
includePartialMessages: true,
|
|
1776
1776
|
abortController: abortController,
|
|
1777
1777
|
canUseTool: opts.canUseTool || function (toolName, input) {
|
|
1778
|
-
var allowed = { Read: true, Glob: true, Grep: true, WebFetch: true };
|
|
1778
|
+
var allowed = { Read: true, Glob: true, Grep: true, WebFetch: true, WebSearch: true };
|
|
1779
1779
|
if (allowed[toolName]) {
|
|
1780
1780
|
return Promise.resolve({ behavior: "allow", updatedInput: input });
|
|
1781
1781
|
}
|