@adhdev/daemon-core 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
@@ -3972,8 +3972,10 @@ var init_provider_cli_adapter = __esm({
3972
3972
  if (buttonIndex in this.approvalKeys) {
3973
3973
  this.ptyProcess.write(this.approvalKeys[buttonIndex]);
3974
3974
  } else {
3975
+ const buttonCount = Array.isArray(modal?.buttons) ? modal.buttons.length : 0;
3976
+ const clampedIndex = buttonCount > 0 ? Math.min(Math.max(0, buttonIndex), buttonCount - 1) : Math.max(0, buttonIndex);
3975
3977
  const DOWN = "\x1B[B";
3976
- const keys = DOWN.repeat(Math.max(0, buttonIndex)) + "\r";
3978
+ const keys = DOWN.repeat(clampedIndex) + "\r";
3977
3979
  this.ptyProcess.write(keys);
3978
3980
  }
3979
3981
  }
@@ -26325,8 +26327,8 @@ var SessionHostRuntimeTransport = class {
26325
26327
  }
26326
26328
  try {
26327
26329
  await this.client.close();
26328
- } catch {
26329
- if (destroy) throw new Error(`Failed to close session host client: ${this.options.runtimeId}`);
26330
+ } catch (err) {
26331
+ if (destroy) throw err instanceof Error ? err : new Error(`Failed to close session host client: ${this.options.runtimeId}`);
26330
26332
  }
26331
26333
  }
26332
26334
  };