@chrysb/alphaclaw 0.9.0-beta.3 → 0.9.0-beta.5

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.
@@ -29,6 +29,7 @@ const resolveGatewayWsUrl = ({ openclawDir, gatewayPort }) => {
29
29
  const sessions = new Map();
30
30
  let activeTransport = null;
31
31
  const kSessionGraceMs = 15_000;
32
+ const kSseKeepAliveMs = 15_000;
32
33
 
33
34
  const closeSession = (sessionId) => {
34
35
  const t = sessions.get(sessionId);
@@ -140,7 +141,12 @@ const registerMcpRoutes = ({
140
141
 
141
142
  if (req.method === "GET") {
142
143
  res.setHeader("X-Accel-Buffering", "no");
143
- res.flushHeaders?.();
144
+ const keepAliveId = setInterval(() => {
145
+ if (res.headersSent && !res.writableEnded) {
146
+ res.write(": keepalive\n\n");
147
+ }
148
+ }, kSseKeepAliveMs);
149
+ res.on("close", () => clearInterval(keepAliveId));
144
150
  }
145
151
 
146
152
  const sessionId = req.headers["mcp-session-id"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrysb/alphaclaw",
3
- "version": "0.9.0-beta.3",
3
+ "version": "0.9.0-beta.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },