sandboxedjs 0.1.40 → 0.1.42

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/agent.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as Container } from './container-Bg_BuaAv.cjs';
1
+ import { C as Container } from './container-CZn9USBQ.cjs';
2
2
 
3
3
  /**
4
4
  * Structural copies of the LangChain Deep Agents backend contract.
package/dist/agent.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as Container } from './container-Bg_BuaAv.js';
1
+ import { C as Container } from './container-CZn9USBQ.js';
2
2
 
3
3
  /**
4
4
  * Structural copies of the LangChain Deep Agents backend contract.
@@ -447,6 +447,21 @@ declare class Pipe implements InputStream, OutputStream {
447
447
  * every character appears twice.
448
448
  */
449
449
  private raw;
450
+ /**
451
+ * Translate carriage returns on the way in, the way `ICRNL` does.
452
+ *
453
+ * A terminal sends CR when Enter is pressed — xterm and every browser
454
+ * terminal emulator do — while everything that reads a line looks for LF.
455
+ * A real tty reconciles the two in its line discipline, which is on by
456
+ * default; without it `read name` waits forever on input the user already
457
+ * typed, and the only visible symptom is a hang.
458
+ *
459
+ * Deliberately opt-in rather than implied by `isTTY`, because stdout is a
460
+ * tty too and a bare CR there is how every progress bar and menu redraw
461
+ * returns to the start of the line. Translating those would corrupt exactly
462
+ * the output this runtime exists to render faithfully.
463
+ */
464
+ icrnl: boolean;
450
465
  onRawMode?: (enabled: boolean) => void;
451
466
  get rawMode(): boolean;
452
467
  set rawMode(enabled: boolean);
@@ -447,6 +447,21 @@ declare class Pipe implements InputStream, OutputStream {
447
447
  * every character appears twice.
448
448
  */
449
449
  private raw;
450
+ /**
451
+ * Translate carriage returns on the way in, the way `ICRNL` does.
452
+ *
453
+ * A terminal sends CR when Enter is pressed — xterm and every browser
454
+ * terminal emulator do — while everything that reads a line looks for LF.
455
+ * A real tty reconciles the two in its line discipline, which is on by
456
+ * default; without it `read name` waits forever on input the user already
457
+ * typed, and the only visible symptom is a hang.
458
+ *
459
+ * Deliberately opt-in rather than implied by `isTTY`, because stdout is a
460
+ * tty too and a bare CR there is how every progress bar and menu redraw
461
+ * returns to the start of the line. Translating those would corrupt exactly
462
+ * the output this runtime exists to render faithfully.
463
+ */
464
+ icrnl: boolean;
450
465
  onRawMode?: (enabled: boolean) => void;
451
466
  get rawMode(): boolean;
452
467
  set rawMode(enabled: boolean);
package/dist/index.cjs CHANGED
@@ -4768,6 +4768,8 @@ init_path();
4768
4768
  init_errno();
4769
4769
  var encoder2 = new TextEncoder();
4770
4770
  var decoder2 = new TextDecoder();
4771
+ var CR = 13;
4772
+ var LF = 10;
4771
4773
  function toBytes(data) {
4772
4774
  return typeof data === "string" ? encoder2.encode(data) : data;
4773
4775
  }
@@ -4800,6 +4802,21 @@ var Pipe = class _Pipe {
4800
4802
  * every character appears twice.
4801
4803
  */
4802
4804
  raw = false;
4805
+ /**
4806
+ * Translate carriage returns on the way in, the way `ICRNL` does.
4807
+ *
4808
+ * A terminal sends CR when Enter is pressed — xterm and every browser
4809
+ * terminal emulator do — while everything that reads a line looks for LF.
4810
+ * A real tty reconciles the two in its line discipline, which is on by
4811
+ * default; without it `read name` waits forever on input the user already
4812
+ * typed, and the only visible symptom is a hang.
4813
+ *
4814
+ * Deliberately opt-in rather than implied by `isTTY`, because stdout is a
4815
+ * tty too and a bare CR there is how every progress bar and menu redraw
4816
+ * returns to the start of the line. Translating those would corrupt exactly
4817
+ * the output this runtime exists to render faithfully.
4818
+ */
4819
+ icrnl = false;
4803
4820
  onRawMode;
4804
4821
  get rawMode() {
4805
4822
  return this.raw;
@@ -4822,7 +4839,7 @@ var Pipe = class _Pipe {
4822
4839
  write(data) {
4823
4840
  if (this.readerClosed) throw new exports.SysError("EPIPE", "write");
4824
4841
  if (this.writerClosed) return;
4825
- const bytes2 = toBytes(data);
4842
+ const bytes2 = this.icrnl && !this.raw ? translateCarriageReturns(toBytes(data)) : toBytes(data);
4826
4843
  if (bytes2.length === 0) return;
4827
4844
  this.chunks.push(bytes2);
4828
4845
  this.buffered += bytes2.length;
@@ -4915,6 +4932,21 @@ var Pipe = class _Pipe {
4915
4932
  return p;
4916
4933
  }
4917
4934
  };
4935
+ function translateCarriageReturns(bytes2) {
4936
+ if (!bytes2.includes(CR)) return bytes2;
4937
+ const out = new Uint8Array(bytes2.length);
4938
+ let length = 0;
4939
+ for (let index = 0; index < bytes2.length; index += 1) {
4940
+ const byte = bytes2[index];
4941
+ if (byte === CR) {
4942
+ out[length++] = LF;
4943
+ if (bytes2[index + 1] === LF) index += 1;
4944
+ } else {
4945
+ out[length++] = byte;
4946
+ }
4947
+ }
4948
+ return out.subarray(0, length);
4949
+ }
4918
4950
  var NullOutput = class {
4919
4951
  closed = false;
4920
4952
  isTTY = false;
@@ -28009,6 +28041,7 @@ var Container = class _Container {
28009
28041
  const stderr = new Pipe();
28010
28042
  if (opts.tty) {
28011
28043
  stdin.isTTY = true;
28044
+ stdin.icrnl = true;
28012
28045
  stdout.isTTY = true;
28013
28046
  stderr.isTTY = true;
28014
28047
  stdout.columns = opts.columns ?? 80;