pty-manager 1.2.10 → 1.2.12

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.d.mts CHANGED
@@ -442,6 +442,11 @@ declare class PTYSession extends EventEmitter {
442
442
  writeRaw(data: string): void;
443
443
  /**
444
444
  * Send a task/message to the session
445
+ *
446
+ * Text and Enter are sent as separate writes with a small delay.
447
+ * This is required for TUI-based CLIs (Gemini CLI, ink/React-based tools)
448
+ * which drop the trailing \r if it arrives in the same write buffer
449
+ * during a render cycle.
445
450
  */
446
451
  send(message: string): SessionMessage;
447
452
  /**
package/dist/index.d.ts CHANGED
@@ -442,6 +442,11 @@ declare class PTYSession extends EventEmitter {
442
442
  writeRaw(data: string): void;
443
443
  /**
444
444
  * Send a task/message to the session
445
+ *
446
+ * Text and Enter are sent as separate writes with a small delay.
447
+ * This is required for TUI-based CLIs (Gemini CLI, ink/React-based tools)
448
+ * which drop the trailing \r if it arrives in the same write buffer
449
+ * during a render cycle.
445
450
  */
446
451
  send(message: string): SessionMessage;
447
452
  /**
package/dist/index.js CHANGED
@@ -465,14 +465,16 @@ var PTYSession = class extends import_events.EventEmitter {
465
465
  if ((this._status === "starting" || this._status === "authenticating") && this.adapter.detectReady(this.outputBuffer)) {
466
466
  this._status = "ready";
467
467
  this._lastBlockingPromptHash = null;
468
+ this.outputBuffer = "";
468
469
  this.emit("ready");
469
470
  this.logger.info({ sessionId: this.id }, "Session ready");
471
+ return;
470
472
  }
471
- if (this._status !== "ready") {
472
- const blockingPrompt = this.detectAndHandleBlockingPrompt();
473
- if (blockingPrompt) {
474
- return;
475
- }
473
+ const blockingPrompt = this.detectAndHandleBlockingPrompt();
474
+ if (blockingPrompt) {
475
+ return;
476
+ }
477
+ if (this._status !== "ready" && this._status !== "busy") {
476
478
  const loginDetection = this.adapter.detectLogin(this.outputBuffer);
477
479
  if (loginDetection.required && this._status !== "authenticating") {
478
480
  this._status = "authenticating";
@@ -654,6 +656,11 @@ var PTYSession = class extends import_events.EventEmitter {
654
656
  }
655
657
  /**
656
658
  * Send a task/message to the session
659
+ *
660
+ * Text and Enter are sent as separate writes with a small delay.
661
+ * This is required for TUI-based CLIs (Gemini CLI, ink/React-based tools)
662
+ * which drop the trailing \r if it arrives in the same write buffer
663
+ * during a render cycle.
657
664
  */
658
665
  send(message) {
659
666
  this._status = "busy";
@@ -665,7 +672,10 @@ var PTYSession = class extends import_events.EventEmitter {
665
672
  content: message,
666
673
  timestamp: /* @__PURE__ */ new Date()
667
674
  };
668
- this.write(message);
675
+ const formatted = this.adapter.formatInput(message);
676
+ this.writeRaw(formatted);
677
+ setTimeout(() => this.sendKeys("enter"), 50);
678
+ this.logger.debug({ sessionId: this.id, input: message }, "Sent input to session");
669
679
  return msg;
670
680
  }
671
681
  /**