@clawchatsai/connector 0.0.70 → 0.0.72

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 CHANGED
@@ -612,8 +612,14 @@ function processAuthenticatedMessage(dc, connectionId, msg, ctx) {
612
612
  }
613
613
  break;
614
614
  }
615
+ case 'ping':
616
+ dc.send(JSON.stringify({ type: 'pong' }));
617
+ break;
615
618
  default:
616
- dc.send(JSON.stringify({ type: 'error', message: 'unknown message type' }));
619
+ // Unknown message type ignore silently.
620
+ // (Sending an error response would break heartbeat backward-compat
621
+ // on future clients that probe for new capabilities.)
622
+ break;
617
623
  }
618
624
  }
619
625
  async function handleRpcMessage(dc, msg, ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.0.70",
3
+ "version": "0.0.72",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",
package/server.js CHANGED
@@ -903,9 +903,6 @@ function handleDeleteWorkspace(req, res, params) {
903
903
  if (Object.keys(ws.workspaces).length <= 1) {
904
904
  return sendError(res, 400, 'Cannot delete the only workspace');
905
905
  }
906
- if (ws.active === params.name) {
907
- return sendError(res, 400, 'Cannot delete the active workspace');
908
- }
909
906
  // Close and remove DB
910
907
  closeDb(params.name);
911
908
  const dbPath = path.join(DATA_DIR, `${params.name}.db`);
@@ -921,6 +918,12 @@ function handleDeleteWorkspace(req, res, params) {
921
918
  }
922
919
 
923
920
  delete ws.workspaces[params.name];
921
+
922
+ // If this was the active workspace, switch active to the first remaining one
923
+ if (ws.active === params.name) {
924
+ ws.active = Object.keys(ws.workspaces)[0] || null;
925
+ }
926
+
924
927
  setWorkspaces(ws);
925
928
  send(res, 200, { ok: true });
926
929
  }
@@ -3667,7 +3670,6 @@ export function createApp(config = {}) {
3667
3670
  const ws = _getWorkspaces();
3668
3671
  if (!ws.workspaces[params.name]) return sendError(res, 404, 'Workspace not found');
3669
3672
  if (Object.keys(ws.workspaces).length <= 1) return sendError(res, 400, 'Cannot delete the only workspace');
3670
- if (ws.active === params.name) return sendError(res, 400, 'Cannot delete the active workspace');
3671
3673
  _closeDb(params.name);
3672
3674
  const dbPath = path.join(_DATA_DIR, `${params.name}.db`);
3673
3675
  try { fs.unlinkSync(dbPath); } catch { /* ok */ }
@@ -3677,6 +3679,7 @@ export function createApp(config = {}) {
3677
3679
  const cleaned = cleanGatewaySessionsByPrefix(`agent:${wsAgentForDelete}:${params.name}:chat:`);
3678
3680
  if (cleaned > 0) console.log(`Cleaned ${cleaned} gateway sessions for workspace: ${params.name}`);
3679
3681
  delete ws.workspaces[params.name];
3682
+ if (ws.active === params.name) ws.active = Object.keys(ws.workspaces)[0] || null;
3680
3683
  _setWorkspaces(ws);
3681
3684
  send(res, 200, { ok: true });
3682
3685
  }