episoda 0.2.49 → 0.2.50

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.
@@ -2277,21 +2277,36 @@ var require_websocket_client = __commonJS({
2277
2277
  }
2278
2278
  }
2279
2279
  }
2280
+ /**
2281
+ * EP1034: Remove all event handlers
2282
+ * Useful when completely resetting a client or when the daemon
2283
+ * disconnects a project and creates a fresh connection.
2284
+ * Note: Internal reconnection (scheduleReconnect) uses the same client instance,
2285
+ * so handlers persist across reconnects - this is by design.
2286
+ */
2287
+ clearAllHandlers() {
2288
+ this.eventHandlers.clear();
2289
+ }
2280
2290
  /**
2281
2291
  * Send a message to the server
2282
2292
  * @param message - Client message to send
2293
+ * @returns true if message was sent, false if not connected
2294
+ *
2295
+ * EP1034: Changed to return false instead of throwing when disconnected.
2296
+ * This prevents daemon crashes when async operations complete during reconnection.
2283
2297
  */
2284
2298
  async send(message) {
2285
2299
  if (!this.ws || !this.isConnected) {
2286
- throw new Error("WebSocket not connected");
2300
+ console.warn("[EpisodaClient] Cannot send - WebSocket not connected");
2301
+ return false;
2287
2302
  }
2288
- return new Promise((resolve3, reject) => {
2303
+ return new Promise((resolve3) => {
2289
2304
  this.ws.send(JSON.stringify(message), (error) => {
2290
2305
  if (error) {
2291
2306
  console.error("[EpisodaClient] Failed to send message:", error);
2292
- reject(error);
2307
+ resolve3(false);
2293
2308
  } else {
2294
- resolve3();
2309
+ resolve3(true);
2295
2310
  }
2296
2311
  });
2297
2312
  });
@@ -2703,7 +2718,7 @@ var require_package = __commonJS({
2703
2718
  "package.json"(exports2, module2) {
2704
2719
  module2.exports = {
2705
2720
  name: "episoda",
2706
- version: "0.2.49",
2721
+ version: "0.2.50",
2707
2722
  description: "CLI tool for Episoda local development workflow orchestration",
2708
2723
  main: "dist/index.js",
2709
2724
  types: "dist/index.d.ts",