@ordewell/core 0.4.18 → 0.4.19

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.mjs CHANGED
@@ -6281,19 +6281,29 @@ var VerdictEngine = class {
6281
6281
  for (const l of this.idleListeners) l(taskId, null);
6282
6282
  }
6283
6283
  }
6284
+ /**
6285
+ * Submit a synchronized resume token to the paused session. An interactive
6286
+ * TUI only accepts the Enter keystroke (`\r`) — a `\n` types the token into
6287
+ * its composer without sending it, leaving the agent paused until a human
6288
+ * presses Enter. A line-oriented piped session has no composer; it reads a
6289
+ * `\n`-terminated line, and the leading newline flushes a partial line.
6290
+ */
6291
+ resumeToken(session, line) {
6292
+ return session.interactive ? `${line}\r` : `
6293
+ ${line}
6294
+ `;
6295
+ }
6284
6296
  approveCheckpoint(taskId) {
6285
6297
  const session = this.pausedSessions.get(taskId);
6286
6298
  if (session) {
6287
- session.write("\nORDEWELL_CONTINUE\n");
6299
+ session.write(this.resumeToken(session, "ORDEWELL_CONTINUE"));
6288
6300
  this.pausedSessions.delete(taskId);
6289
6301
  }
6290
6302
  }
6291
6303
  rejectCheckpoint(taskId, reason) {
6292
6304
  const session = this.pausedSessions.get(taskId);
6293
6305
  if (session) {
6294
- session.write(`
6295
- ORDEWELL_REJECT: ${reason}
6296
- `);
6306
+ session.write(this.resumeToken(session, `ORDEWELL_REJECT: ${reason}`));
6297
6307
  this.pausedSessions.delete(taskId);
6298
6308
  }
6299
6309
  }
@@ -12684,11 +12694,13 @@ function defaultHasScriptCmd() {
12684
12694
  }
12685
12695
  }
12686
12696
  var HeadlessSession = class extends AbstractTerminalSession {
12687
- constructor(id, taskId, spawnImpl) {
12697
+ constructor(id, taskId, spawnImpl, interactive = false) {
12688
12698
  super(id, taskId);
12689
12699
  this.spawnImpl = spawnImpl;
12700
+ this.interactive = interactive;
12690
12701
  }
12691
12702
  spawnImpl;
12703
+ interactive;
12692
12704
  process = null;
12693
12705
  outputBuffer = "";
12694
12706
  controlStream = null;
@@ -12770,7 +12782,7 @@ var HeadlessRunner = class extends AbstractRunner {
12770
12782
  this.launchDeps = { resolvePath: this.resolvePath, ...deps.launchDeps };
12771
12783
  }
12772
12784
  createSession(id, taskId) {
12773
- return new HeadlessSession(id, taskId, this.spawnImpl);
12785
+ return new HeadlessSession(id, taskId, this.spawnImpl, this.defaultInteractive);
12774
12786
  }
12775
12787
  /** Everything up to, but not including, spawning — so a surface that owns its own child reaches the same decisions. */
12776
12788
  async prepareLaunch(opts, ptyOptions) {
@@ -12887,6 +12899,8 @@ var TmuxSession = class extends AbstractTerminalSession {
12887
12899
  pollIntervalMs;
12888
12900
  logPath;
12889
12901
  socket;
12902
+ /** A tmux window is a real TTY running the agent's TUI, so it submits on Enter. */
12903
+ interactive = true;
12890
12904
  outputBuffer = "";
12891
12905
  offset = 0;
12892
12906
  timer = null;