@suveren/gateway 0.20.0 → 0.20.2

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.
@@ -7767,6 +7767,7 @@ app.post("/internal/stop-all-running", internalOnly, async (_req, res) => {
7767
7767
  }
7768
7768
  });
7769
7769
  var sseSessions = /* @__PURE__ */ new Map();
7770
+ var SESSION_NOT_FOUND = { jsonrpc: "2.0", error: { code: -32001, message: "Session not found" }, id: null };
7770
7771
  var guardAgent = agentAccess(
7771
7772
  agentToken,
7772
7773
  (req) => req.path === "/sse" && req.method === "GET" || req.path === "/mcp" && req.method === "POST" && !req.headers["mcp-session-id"]
@@ -7790,7 +7791,7 @@ app.post("/messages", guardAgent, async (req, res) => {
7790
7791
  const sessionId = req.query.sessionId;
7791
7792
  const transport = sseSessions.get(sessionId);
7792
7793
  if (!transport) {
7793
- res.status(400).json({ error: "Unknown session" });
7794
+ res.status(404).json(SESSION_NOT_FOUND);
7794
7795
  return;
7795
7796
  }
7796
7797
  await transport.handlePostMessage(req, res, req.body);
@@ -7826,6 +7827,10 @@ app.all("/mcp", guardAgent, async (req, res) => {
7826
7827
  }
7827
7828
  return;
7828
7829
  }
7830
+ if (sessionId) {
7831
+ res.status(404).json(SESSION_NOT_FOUND);
7832
+ return;
7833
+ }
7829
7834
  res.status(400).json({ error: "Bad request \u2014 missing or invalid session" });
7830
7835
  } else {
7831
7836
  res.status(405).json({ error: "Method not allowed" });