@adhdev/daemon-standalone 0.9.23 → 0.9.24

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
@@ -31839,8 +31839,10 @@ var require_dist2 = __commonJS({
31839
31839
  if (buttonIndex in this.approvalKeys) {
31840
31840
  this.ptyProcess.write(this.approvalKeys[buttonIndex]);
31841
31841
  } else {
31842
+ const buttonCount = Array.isArray(modal?.buttons) ? modal.buttons.length : 0;
31843
+ const clampedIndex = buttonCount > 0 ? Math.min(Math.max(0, buttonIndex), buttonCount - 1) : Math.max(0, buttonIndex);
31842
31844
  const DOWN = "\x1B[B";
31843
- const keys = DOWN.repeat(Math.max(0, buttonIndex)) + "\r";
31845
+ const keys = DOWN.repeat(clampedIndex) + "\r";
31844
31846
  this.ptyProcess.write(keys);
31845
31847
  }
31846
31848
  }
@@ -54014,8 +54016,8 @@ data: ${JSON.stringify(msg.data)}
54014
54016
  }
54015
54017
  try {
54016
54018
  await this.client.close();
54017
- } catch {
54018
- if (destroy) throw new Error(`Failed to close session host client: ${this.options.runtimeId}`);
54019
+ } catch (err) {
54020
+ if (destroy) throw err instanceof Error ? err : new Error(`Failed to close session host client: ${this.options.runtimeId}`);
54019
54021
  }
54020
54022
  }
54021
54023
  };