commanderclaw 1.1.15 → 1.1.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgWH,QAAA,MAAM,MAAM;;;;;kBAKI,GAAG;CAQlB,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgXH,QAAA,MAAM,MAAM;;;;;kBAKI,GAAG;CAQlB,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -138,6 +138,12 @@ class CommanderClawClient {
138
138
  this.emit("chat", { type: "chat", data: msg });
139
139
  break;
140
140
  }
141
+ case "SESSION_SWITCH": {
142
+ const payload = msg.payload;
143
+ console.log(`[CommanderClawClient] SESSION_SWITCH: sessionId=${payload.sessionId}, action=${payload.action || "legacy"}`);
144
+ this.emit("session_switch", { type: "session_switch", data: payload });
145
+ break;
146
+ }
141
147
  default: {
142
148
  console.log(`[CommanderClawClient] Unknown message type: ${msg.type}`);
143
149
  const handler = this.messageHandlers.get(msg.type);
@@ -4281,6 +4287,7 @@ const { setRuntime, getRuntime } = createPluginRuntimeStore("CommanderClaw runti
4281
4287
  let client = null;
4282
4288
  let pluginConfig = null;
4283
4289
  let currentLog = null;
4290
+ let currentSessionKey = null;
4284
4291
  const DEFAULT_CONFIG = {
4285
4292
  deviceName: "OpenClaw Agent",
4286
4293
  autoConnect: true,
@@ -4421,6 +4428,16 @@ function initializeClient(config, log) {
4421
4428
  client.on("chat", (event) => {
4422
4429
  handleChatMessage(event.data);
4423
4430
  });
4431
+ client.on("session_switch", async (event) => {
4432
+ const payload = event.data;
4433
+ log.info("SESSION_SWITCH received", {
4434
+ sessionId: payload.sessionId,
4435
+ action: payload.action || "legacy",
4436
+ sessionKey: payload.sessionKey,
4437
+ });
4438
+ currentSessionKey = payload.sessionKey;
4439
+ log.info("Session key updated", { sessionKey: currentSessionKey });
4440
+ });
4424
4441
  client.connect().catch((error) => {
4425
4442
  log.error("Failed to connect to CommanderClaw server", {
4426
4443
  error: error.message,