@devness/useai 0.4.2 → 0.4.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/dist/index.js +12 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -111,7 +111,7 @@ var VERSION;
|
|
|
111
111
|
var init_version = __esm({
|
|
112
112
|
"../shared/dist/constants/version.js"() {
|
|
113
113
|
"use strict";
|
|
114
|
-
VERSION = "0.4.
|
|
114
|
+
VERSION = "0.4.3";
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
@@ -2099,6 +2099,13 @@ async function startDaemon(port) {
|
|
|
2099
2099
|
if (sid && sessions.has(sid)) {
|
|
2100
2100
|
resetIdleTimer(sid);
|
|
2101
2101
|
await sessions.get(sid).transport.handleRequest(req, res, body);
|
|
2102
|
+
} else if (sid && !sessions.has(sid)) {
|
|
2103
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
2104
|
+
res.end(JSON.stringify({
|
|
2105
|
+
jsonrpc: "2.0",
|
|
2106
|
+
error: { code: -32e3, message: "Session not found" },
|
|
2107
|
+
id: null
|
|
2108
|
+
}));
|
|
2102
2109
|
} else if (!sid && isInitializeRequest(body)) {
|
|
2103
2110
|
const sessionState = new SessionState();
|
|
2104
2111
|
try {
|
|
@@ -2146,8 +2153,8 @@ async function startDaemon(port) {
|
|
|
2146
2153
|
} else if (req.method === "GET") {
|
|
2147
2154
|
const sid = req.headers["mcp-session-id"];
|
|
2148
2155
|
if (!sid || !sessions.has(sid)) {
|
|
2149
|
-
res.writeHead(400, { "Content-Type": "application/json" });
|
|
2150
|
-
res.end(JSON.stringify({ error: "
|
|
2156
|
+
res.writeHead(sid ? 404 : 400, { "Content-Type": "application/json" });
|
|
2157
|
+
res.end(JSON.stringify({ error: sid ? "Session not found" : "Missing session ID" }));
|
|
2151
2158
|
return;
|
|
2152
2159
|
}
|
|
2153
2160
|
resetIdleTimer(sid);
|
|
@@ -2155,8 +2162,8 @@ async function startDaemon(port) {
|
|
|
2155
2162
|
} else if (req.method === "DELETE") {
|
|
2156
2163
|
const sid = req.headers["mcp-session-id"];
|
|
2157
2164
|
if (!sid || !sessions.has(sid)) {
|
|
2158
|
-
res.writeHead(400, { "Content-Type": "application/json" });
|
|
2159
|
-
res.end(JSON.stringify({ error: "
|
|
2165
|
+
res.writeHead(sid ? 404 : 400, { "Content-Type": "application/json" });
|
|
2166
|
+
res.end(JSON.stringify({ error: sid ? "Session not found" : "Missing session ID" }));
|
|
2160
2167
|
return;
|
|
2161
2168
|
}
|
|
2162
2169
|
await sessions.get(sid).transport.handleRequest(req, res);
|