@boxes-dev/dvb 1.0.97 → 1.0.98

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/bin/dvb.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5309eb3b-ad7d-544a-ac38-27de2de7afe5")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e4952253-6b01-5464-8cec-44fa0b046c22")}catch(e){}}();
4
4
 
5
5
  var __create = Object.create;
6
6
  var __defProp = Object.defineProperty;
@@ -88688,8 +88688,8 @@ var init_otel = __esm({
88688
88688
  return trimmed && trimmed.length > 0 ? trimmed : void 0;
88689
88689
  };
88690
88690
  readBuildMetadata = () => {
88691
- const rawPackageVersion = "1.0.97";
88692
- const rawGitSha = "b188da7d76b5932bf0ca74e33fb9fa4982436b1f";
88691
+ const rawPackageVersion = "1.0.98";
88692
+ const rawGitSha = "e205a3b6f0be3a8d153bbc904250d65d3f3a340b";
88693
88693
  const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
88694
88694
  const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
88695
88695
  return { packageVersion, gitSha };
@@ -120679,9 +120679,9 @@ var init_sentry = __esm({
120679
120679
  sentryEnabled = false;
120680
120680
  uncaughtExceptionMonitorInstalled = false;
120681
120681
  readBuildMetadata2 = () => {
120682
- const rawPackageVersion = "1.0.97";
120683
- const rawGitSha = "b188da7d76b5932bf0ca74e33fb9fa4982436b1f";
120684
- const rawSentryRelease = "boxes-dev-dvb@1.0.97+b188da7d76b5932bf0ca74e33fb9fa4982436b1f";
120682
+ const rawPackageVersion = "1.0.98";
120683
+ const rawGitSha = "e205a3b6f0be3a8d153bbc904250d65d3f3a340b";
120684
+ const rawSentryRelease = "boxes-dev-dvb@1.0.98+e205a3b6f0be3a8d153bbc904250d65d3f3a340b";
120685
120685
  const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
120686
120686
  const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
120687
120687
  const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
@@ -138191,7 +138191,7 @@ var init_osc = __esm({
138191
138191
  });
138192
138192
 
138193
138193
  // src/devbox/terminal/sessionProtocol.ts
138194
- var HEARTBEAT_INTERVAL_MS, INPUT_PROBE_TIMEOUT_MS, STREAM_STALL_PROBE_MISS_THRESHOLD, CONNECT_OPEN_TIMEOUT_MS, WS_OPEN_STATE, MODAL_DISCONNECT_FILTER_CHUNKS, createScrollbackEraseFilter, createInitialAttachClearFilter, createModalTtyOutputFilter, stripModalDisconnectArtifacts, streamExecSession;
138194
+ var HEARTBEAT_INTERVAL_MS, INPUT_PROBE_TIMEOUT_MS, STREAM_STALL_PROBE_MISS_THRESHOLD, CONNECT_OPEN_TIMEOUT_MS, WS_OPEN_STATE, streamExecSession;
138195
138195
  var init_sessionProtocol = __esm({
138196
138196
  "src/devbox/terminal/sessionProtocol.ts"() {
138197
138197
  "use strict";
@@ -138202,306 +138202,6 @@ var init_sessionProtocol = __esm({
138202
138202
  STREAM_STALL_PROBE_MISS_THRESHOLD = 2;
138203
138203
  CONNECT_OPEN_TIMEOUT_MS = 2e4;
138204
138204
  WS_OPEN_STATE = 1;
138205
- MODAL_DISCONNECT_FILTER_CHUNKS = 8;
138206
- createScrollbackEraseFilter = () => {
138207
- let state = 0;
138208
- const flushPending = (output) => {
138209
- if (state === 1) {
138210
- output.push(27);
138211
- } else if (state === 2) {
138212
- output.push(27, 91);
138213
- } else if (state === 3) {
138214
- output.push(27, 91, 51);
138215
- } else if (state === 10) {
138216
- output.push(155);
138217
- } else if (state === 11) {
138218
- output.push(155, 51);
138219
- }
138220
- state = 0;
138221
- };
138222
- const pushByte = (output, byte) => {
138223
- if (state === 0) {
138224
- if (byte === 27) {
138225
- state = 1;
138226
- return;
138227
- }
138228
- if (byte === 155) {
138229
- state = 10;
138230
- return;
138231
- }
138232
- output.push(byte);
138233
- return;
138234
- }
138235
- if (state === 1) {
138236
- if (byte === 91) {
138237
- state = 2;
138238
- return;
138239
- }
138240
- output.push(27);
138241
- state = 0;
138242
- pushByte(output, byte);
138243
- return;
138244
- }
138245
- if (state === 2) {
138246
- if (byte === 51) {
138247
- state = 3;
138248
- return;
138249
- }
138250
- output.push(27, 91);
138251
- state = 0;
138252
- pushByte(output, byte);
138253
- return;
138254
- }
138255
- if (state === 3) {
138256
- if (byte === 74) {
138257
- state = 0;
138258
- return;
138259
- }
138260
- output.push(27, 91, 51);
138261
- state = 0;
138262
- pushByte(output, byte);
138263
- return;
138264
- }
138265
- if (state === 10) {
138266
- if (byte === 51) {
138267
- state = 11;
138268
- return;
138269
- }
138270
- output.push(155);
138271
- state = 0;
138272
- pushByte(output, byte);
138273
- return;
138274
- }
138275
- if (state === 11) {
138276
- if (byte === 74) {
138277
- state = 0;
138278
- return;
138279
- }
138280
- output.push(155, 51);
138281
- state = 0;
138282
- pushByte(output, byte);
138283
- }
138284
- };
138285
- return {
138286
- reset() {
138287
- state = 0;
138288
- },
138289
- transform(chunk) {
138290
- const bytes = Buffer.from(chunk ?? Buffer.alloc(0));
138291
- if (bytes.length === 0) {
138292
- return bytes;
138293
- }
138294
- const output = [];
138295
- for (const byte of bytes) {
138296
- pushByte(output, byte);
138297
- }
138298
- return output.length === 0 ? Buffer.alloc(0) : Buffer.from(output);
138299
- },
138300
- flush() {
138301
- const output = [];
138302
- flushPending(output);
138303
- return output.length === 0 ? Buffer.alloc(0) : Buffer.from(output);
138304
- }
138305
- };
138306
- };
138307
- createInitialAttachClearFilter = () => {
138308
- const patterns = [
138309
- Buffer.from("\x1B[H\x1B[J", "latin1"),
138310
- Buffer.from("\x1B[H\x1B[2J", "latin1"),
138311
- Buffer.from("\x1B[2J\x1B[H", "latin1"),
138312
- Buffer.from("\x1B[H", "latin1"),
138313
- Buffer.from("\x1B[2J", "latin1"),
138314
- Buffer.from("\x1B[J", "latin1"),
138315
- Buffer.from("\x1B[?1049h", "latin1"),
138316
- Buffer.from("\x1B[?1048h", "latin1"),
138317
- Buffer.from("\x1B[?1047h", "latin1"),
138318
- Buffer.from("\x1B[?47h", "latin1"),
138319
- Buffer.from("\x1B[?1h", "latin1"),
138320
- Buffer.from("\x1B=", "latin1"),
138321
- Buffer.from("\x9BH", "latin1"),
138322
- Buffer.from("\x9B2J", "latin1"),
138323
- Buffer.from("\x9BJ", "latin1"),
138324
- Buffer.from("\x9B?1049h", "latin1"),
138325
- Buffer.from("\x9B?1048h", "latin1"),
138326
- Buffer.from("\x9B?1047h", "latin1"),
138327
- Buffer.from("\x9B?47h", "latin1"),
138328
- Buffer.from("\x9B?1h", "latin1")
138329
- ];
138330
- const maxPatternLength = patterns.reduce(
138331
- (max, pattern) => Math.max(max, pattern.length),
138332
- 0
138333
- );
138334
- const STARTUP_FILTER_CHUNKS = 6;
138335
- let enabled = true;
138336
- let pending = Buffer.alloc(0);
138337
- let chunksRemaining = STARTUP_FILTER_CHUNKS;
138338
- const startsWithPatternPrefix = (bytes) => patterns.some((pattern) => {
138339
- if (bytes.length > pattern.length) {
138340
- return false;
138341
- }
138342
- return pattern.subarray(0, bytes.length).equals(bytes);
138343
- });
138344
- const stripLeadingPatterns = (bytes) => {
138345
- let remaining = bytes;
138346
- let removed = true;
138347
- while (removed && remaining.length > 0) {
138348
- removed = false;
138349
- for (const pattern of patterns) {
138350
- if (remaining.length >= pattern.length) {
138351
- const candidate = remaining.subarray(0, pattern.length);
138352
- if (candidate.equals(pattern)) {
138353
- remaining = remaining.subarray(pattern.length);
138354
- removed = true;
138355
- break;
138356
- }
138357
- }
138358
- }
138359
- }
138360
- return remaining;
138361
- };
138362
- const stripInlineArtifacts = (bytes) => {
138363
- if (bytes.length === 0) return bytes;
138364
- let text = bytes.toString("latin1");
138365
- text = text.replace(/\x1b\[[0-9;]*H/g, "\r");
138366
- text = text.replace(/\x9b[0-9;]*H/g, "\r");
138367
- text = text.replace(
138368
- /\x1b\]([^\x07\x1b]*)(\x07|\x1b\\)/g,
138369
- (match2, payload) => payload.startsWith(BROWSER_OPEN_OSC_PREFIX) ? match2 : ""
138370
- );
138371
- const artifactPatterns = [
138372
- /\x01/g,
138373
- /\x1b\[\?1049h/g,
138374
- /\x1b\[\?1048h/g,
138375
- /\x1b\[\?1047h/g,
138376
- /\x1b\[\?47h/g,
138377
- /\x1b\[\?1h/g,
138378
- /\x1b\[\?2004h/g,
138379
- /\x1b=/g,
138380
- /\x9b\?1049h/g,
138381
- /\x9b\?1048h/g,
138382
- /\x9b\?1047h/g,
138383
- /\x9b\?47h/g,
138384
- /\x9b\?1h/g,
138385
- /\x9b\?2004h/g,
138386
- /\x1b\[[0-9;?]*J/g,
138387
- /\x9b[0-9;?]*J/g
138388
- ];
138389
- for (const pattern of artifactPatterns) {
138390
- text = text.replace(pattern, "");
138391
- }
138392
- text = text.replace(/\r{2,}/g, "\r");
138393
- if (/^\r+$/.test(text)) {
138394
- return Buffer.alloc(0);
138395
- }
138396
- return Buffer.from(text, "latin1");
138397
- };
138398
- return {
138399
- reset() {
138400
- enabled = true;
138401
- pending = Buffer.alloc(0);
138402
- chunksRemaining = STARTUP_FILTER_CHUNKS;
138403
- },
138404
- transform(chunk) {
138405
- const bytes = Buffer.from(chunk ?? Buffer.alloc(0));
138406
- if (bytes.length === 0) {
138407
- return bytes;
138408
- }
138409
- if (!enabled) {
138410
- return bytes;
138411
- }
138412
- let work = pending.length > 0 ? Buffer.concat([pending, bytes]) : Buffer.from(bytes);
138413
- pending = Buffer.alloc(0);
138414
- work = stripLeadingPatterns(work);
138415
- work = stripInlineArtifacts(work);
138416
- chunksRemaining = Math.max(0, chunksRemaining - 1);
138417
- if (work.length === 0) {
138418
- if (chunksRemaining === 0) {
138419
- enabled = false;
138420
- }
138421
- return Buffer.alloc(0);
138422
- }
138423
- const holdBytes = Math.min(
138424
- work.length,
138425
- Math.max(1, maxPatternLength - 1)
138426
- );
138427
- if (holdBytes > 0) {
138428
- const prefix = work.subarray(0, holdBytes);
138429
- if (prefix.length === work.length && startsWithPatternPrefix(prefix)) {
138430
- pending = Buffer.from(prefix);
138431
- return Buffer.alloc(0);
138432
- }
138433
- }
138434
- if (chunksRemaining === 0) {
138435
- enabled = false;
138436
- }
138437
- return work;
138438
- },
138439
- flush() {
138440
- const out = pending;
138441
- pending = Buffer.alloc(0);
138442
- enabled = false;
138443
- chunksRemaining = 0;
138444
- return out;
138445
- }
138446
- };
138447
- };
138448
- createModalTtyOutputFilter = () => {
138449
- const initialAttachClearFilter = createInitialAttachClearFilter();
138450
- const scrollbackEraseFilter = createScrollbackEraseFilter();
138451
- return {
138452
- reset() {
138453
- initialAttachClearFilter.reset?.();
138454
- scrollbackEraseFilter.reset?.();
138455
- },
138456
- transform(chunk) {
138457
- const initialFiltered = initialAttachClearFilter.transform(chunk);
138458
- if (initialFiltered.length === 0) {
138459
- return Buffer.alloc(0);
138460
- }
138461
- return scrollbackEraseFilter.transform(initialFiltered);
138462
- },
138463
- flush() {
138464
- const pendingInitial = initialAttachClearFilter.flush();
138465
- const pendingFiltered = pendingInitial.length > 0 ? scrollbackEraseFilter.transform(pendingInitial) : Buffer.alloc(0);
138466
- const pendingScrollback = scrollbackEraseFilter.flush();
138467
- if (pendingFiltered.length === 0) {
138468
- return pendingScrollback;
138469
- }
138470
- if (pendingScrollback.length === 0) {
138471
- return pendingFiltered;
138472
- }
138473
- return Buffer.concat([pendingFiltered, pendingScrollback]);
138474
- }
138475
- };
138476
- };
138477
- stripModalDisconnectArtifacts = (chunk) => {
138478
- if (chunk.length === 0) return chunk;
138479
- let text = chunk.toString("latin1");
138480
- const artifactPatterns = [
138481
- /\x01/g,
138482
- /\x03\x00/g,
138483
- /\x1b\[\?1000l/g,
138484
- /\x1b\[\?1002l/g,
138485
- /\x1b\[\?1003l/g,
138486
- /\x1b\[\?1004l/g,
138487
- /\x1b\[\?1005l/g,
138488
- /\x1b\[\?1006l/g,
138489
- /\x1b\[\?2004l/g,
138490
- /\x1b\[\?1049l/g,
138491
- /\x1b\[\?1048l/g,
138492
- /\x1b\[\?1047l/g,
138493
- /\x1b\[\?47l/g,
138494
- /\x1b\[\?25h/g,
138495
- /\x1b\[<u/g,
138496
- /\x1b\[>4;0m/g,
138497
- /\x1b\[\?1l/g,
138498
- /\x1b>/g
138499
- ];
138500
- for (const pattern of artifactPatterns) {
138501
- text = text.replace(pattern, "");
138502
- }
138503
- return Buffer.from(text, "latin1");
138504
- };
138505
138205
  streamExecSession = async (ws, options) => new Promise((resolve2, reject) => {
138506
138206
  let exitCode = null;
138507
138207
  let resolved = false;
@@ -138525,21 +138225,6 @@ var init_sessionProtocol = __esm({
138525
138225
  const stderr = process.stderr;
138526
138226
  const latency = options.latency;
138527
138227
  const oscMonitor = createOscMonitor();
138528
- const ttyOutputFilter = options.ttyOutputFilter;
138529
- let disconnectFilterChunksRemaining = 0;
138530
- const armDisconnectFilter = () => {
138531
- if (!options.stripDisconnectArtifacts) return;
138532
- disconnectFilterChunksRemaining = Math.max(
138533
- disconnectFilterChunksRemaining,
138534
- MODAL_DISCONNECT_FILTER_CHUNKS
138535
- );
138536
- };
138537
- const applyDisconnectFilter = (chunk) => {
138538
- if (!options.stripDisconnectArtifacts) return chunk;
138539
- if (disconnectFilterChunksRemaining <= 0) return chunk;
138540
- disconnectFilterChunksRemaining -= 1;
138541
- return stripModalDisconnectArtifacts(chunk);
138542
- };
138543
138228
  const initialInput = typeof options.initialInput === "string" ? Buffer.from(options.initialInput, "utf8") : options.initialInput;
138544
138229
  const supportsResizeControlMessages = options.supportsResizeControlMessages ?? true;
138545
138230
  if (options.stdin && initialInput && initialInput.length > 0) {
@@ -138601,8 +138286,7 @@ var init_sessionProtocol = __esm({
138601
138286
  const rawBuffer = Buffer.from(buffer);
138602
138287
  options.onOutputChunk?.(rawBuffer);
138603
138288
  options.onOutput?.();
138604
- const filteredBuffer = ttyOutputFilter ? ttyOutputFilter.transform(rawBuffer) : rawBuffer;
138605
- writeTtyOutput(applyDisconnectFilter(filteredBuffer));
138289
+ writeTtyOutput(rawBuffer);
138606
138290
  return;
138607
138291
  }
138608
138292
  const streamId = buffer[0];
@@ -138622,7 +138306,6 @@ var init_sessionProtocol = __esm({
138622
138306
  stderr.write(Buffer.from(payload));
138623
138307
  }
138624
138308
  if (streamId === 3 && payload.length > 0) {
138625
- armDisconnectFilter();
138626
138309
  exitCode = payload[0] ?? 0;
138627
138310
  ws.close();
138628
138311
  }
@@ -138659,9 +138342,6 @@ var init_sessionProtocol = __esm({
138659
138342
  return;
138660
138343
  }
138661
138344
  if (payload.type === "tty_replay_done") {
138662
- if (options.tty && ttyOutputFilter) {
138663
- writeTtyOutput(applyDisconnectFilter(ttyOutputFilter.flush()));
138664
- }
138665
138345
  options.onReplayDone?.();
138666
138346
  return;
138667
138347
  }
@@ -138672,12 +138352,7 @@ var init_sessionProtocol = __esm({
138672
138352
  }
138673
138353
  options.onOutput?.();
138674
138354
  if (options.tty) {
138675
- if (data.includes("logout")) {
138676
- armDisconnectFilter();
138677
- }
138678
- const dataBuffer = Buffer.from(data, "utf8");
138679
- const filtered = ttyOutputFilter ? ttyOutputFilter.transform(dataBuffer) : dataBuffer;
138680
- writeTtyOutput(applyDisconnectFilter(filtered));
138355
+ writeTtyOutput(Buffer.from(data, "utf8"));
138681
138356
  } else {
138682
138357
  stdout.write(data);
138683
138358
  }
@@ -138764,9 +138439,6 @@ var init_sessionProtocol = __esm({
138764
138439
  finishDetach();
138765
138440
  return;
138766
138441
  }
138767
- if (options.tty && chunk.length === 1 && chunk[0] === 4) {
138768
- armDisconnectFilter();
138769
- }
138770
138442
  if (typeof ws.readyState === "number" && ws.readyState !== WS_OPEN_STATE) {
138771
138443
  logger8.warn("connect_stdin_socket_not_open", {
138772
138444
  readyState: ws.readyState,
@@ -138949,9 +138621,6 @@ var init_sessionProtocol = __esm({
138949
138621
  }
138950
138622
  };
138951
138623
  const cleanup = () => {
138952
- if (options.tty && ttyOutputFilter) {
138953
- writeTtyOutput(ttyOutputFilter.flush());
138954
- }
138955
138624
  ws.removeEventListener("message", onMessage);
138956
138625
  ws.removeEventListener("close", onClose);
138957
138626
  ws.removeEventListener("error", onError);
@@ -200242,9 +199911,14 @@ var init_modalRuntime = __esm({
200242
199911
  return;
200243
199912
  }
200244
199913
  if (type === "tty_data") {
200245
- const stream = message.stream === "stderr" ? 2 : 1;
200246
199914
  const bytes = decodeBase642(message.data);
200247
- if (bytes.length > 0) {
199915
+ if (bytes.length === 0) {
199916
+ return;
199917
+ }
199918
+ if (this.options.tty) {
199919
+ this.emit("message", { data: bytes });
199920
+ } else {
199921
+ const stream = message.stream === "stderr" ? 2 : 1;
200248
199922
  this.emitMessagePayload(stream, bytes);
200249
199923
  }
200250
199924
  return;
@@ -200252,7 +199926,13 @@ var init_modalRuntime = __esm({
200252
199926
  if (type === "tty_exit") {
200253
199927
  const rawCode = typeof message.code === "number" ? message.code : Number.parseInt(String(message.code ?? "0"), 10);
200254
199928
  const codeByte = Number.isFinite(rawCode) ? Math.max(0, Math.min(255, rawCode)) : 0;
200255
- this.emitMessagePayload(3, Uint8Array.of(codeByte));
199929
+ if (this.options.tty) {
199930
+ this.emit("message", {
199931
+ data: JSON.stringify({ type: "exit", exit_code: codeByte })
199932
+ });
199933
+ } else {
199934
+ this.emitMessagePayload(3, Uint8Array.of(codeByte));
199935
+ }
200256
199936
  this.close();
200257
199937
  return;
200258
199938
  }
@@ -202727,13 +202407,6 @@ var init_connect2 = __esm({
202727
202407
  resolveTtySize,
202728
202408
  openBrowser: openBrowser2,
202729
202409
  isRawCtrlCChunk,
202730
- ...computeProvider === "modal" && isTty ? (() => {
202731
- const ttyOutputFilter = createModalTtyOutputFilter();
202732
- return {
202733
- ttyOutputFilter,
202734
- stripDisconnectArtifacts: true
202735
- };
202736
- })() : {},
202737
202410
  ...latency ? { latency } : {},
202738
202411
  onSessionInfo: (id) => {
202739
202412
  if (supportsAttachExecSession) {
@@ -202910,13 +202583,6 @@ ${message}\r
202910
202583
  resolveTtySize,
202911
202584
  openBrowser: openBrowser2,
202912
202585
  isRawCtrlCChunk,
202913
- ...computeProvider === "modal" && isTty ? (() => {
202914
- const ttyOutputFilter = createModalTtyOutputFilter();
202915
- return {
202916
- ttyOutputFilter,
202917
- stripDisconnectArtifacts: true
202918
- };
202919
- })() : {},
202920
202586
  ...latency ? { latency } : {},
202921
202587
  openTimeoutMs: CONNECT_OPEN_TIMEOUT_MS2,
202922
202588
  onOutput: noteOutput,
@@ -220369,4 +220035,4 @@ smol-toml/dist/index.js:
220369
220035
  */
220370
220036
  //# sourceMappingURL=dvb.cjs.map
220371
220037
 
220372
- //# debugId=5309eb3b-ad7d-544a-ac38-27de2de7afe5
220038
+ //# debugId=e4952253-6b01-5464-8cec-44fa0b046c22