episoda 0.2.68 → 0.2.69

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.
@@ -2337,12 +2337,18 @@ var require_websocket_client = __commonJS({
2337
2337
  /**
2338
2338
  * EP701: Emit a client-side event to registered handlers
2339
2339
  * Used for events like 'disconnected' that originate from the client, not server
2340
+ * EP1095: Fixed to handle async handlers - catches both sync errors and promise rejections
2340
2341
  */
2341
2342
  emit(event) {
2342
2343
  const handlers = this.eventHandlers.get(event.type) || [];
2343
2344
  handlers.forEach((handler) => {
2344
2345
  try {
2345
- handler(event);
2346
+ const result = handler(event);
2347
+ if (result && typeof result === "object" && "catch" in result && typeof result.catch === "function") {
2348
+ result.catch((error) => {
2349
+ console.error(`[EpisodaClient] Async handler error for ${event.type}:`, error);
2350
+ });
2351
+ }
2346
2352
  } catch (error) {
2347
2353
  console.error(`[EpisodaClient] Handler error for ${event.type}:`, error);
2348
2354
  }
@@ -2730,7 +2736,7 @@ var require_package = __commonJS({
2730
2736
  "package.json"(exports2, module2) {
2731
2737
  module2.exports = {
2732
2738
  name: "episoda",
2733
- version: "0.2.68",
2739
+ version: "0.2.69",
2734
2740
  description: "CLI tool for Episoda local development workflow orchestration",
2735
2741
  main: "dist/index.js",
2736
2742
  types: "dist/index.d.ts",
@@ -8903,20 +8909,24 @@ var Daemon = class _Daemon {
8903
8909
  client.updateToken(tokenMsg.accessToken);
8904
8910
  });
8905
8911
  client.on("machine_uuid_update", async (message) => {
8906
- const uuidMsg = message;
8907
- if (uuidMsg.machineUuid) {
8908
- this.machineUuid = uuidMsg.machineUuid;
8909
- console.log(`[Daemon] EP1095: Machine UUID updated: ${this.machineUuid}`);
8910
- await this.cacheMachineUuid(uuidMsg.machineUuid);
8911
- this.syncMachineProjectPath(projectId, projectPath).catch((err) => {
8912
- console.warn("[Daemon] EP1095: Deferred project path sync failed:", err.message);
8913
- });
8914
- const connection2 = this.connections.get(projectPath);
8915
- if (connection2) {
8916
- this.reconcileWorktrees(projectId, projectPath, connection2.client).catch((err) => {
8917
- console.warn("[Daemon] EP1095: Deferred reconciliation failed:", err.message);
8912
+ try {
8913
+ const uuidMsg = message;
8914
+ if (uuidMsg.machineUuid) {
8915
+ this.machineUuid = uuidMsg.machineUuid;
8916
+ console.log(`[Daemon] EP1095: Machine UUID updated: ${this.machineUuid}`);
8917
+ await this.cacheMachineUuid(uuidMsg.machineUuid);
8918
+ this.syncMachineProjectPath(projectId, projectPath).catch((err) => {
8919
+ console.warn("[Daemon] EP1095: Deferred project path sync failed:", err.message);
8918
8920
  });
8921
+ const connection2 = this.connections.get(projectPath);
8922
+ if (connection2) {
8923
+ this.reconcileWorktrees(projectId, projectPath, connection2.client).catch((err) => {
8924
+ console.warn("[Daemon] EP1095: Deferred reconciliation failed:", err.message);
8925
+ });
8926
+ }
8919
8927
  }
8928
+ } catch (error) {
8929
+ console.error("[Daemon] EP1095: Error handling machine_uuid_update:", error instanceof Error ? error.message : error);
8920
8930
  }
8921
8931
  });
8922
8932
  client.on("disconnected", (event) => {