@boxes-dev/dvb 1.0.98 → 1.0.100

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]="e4952253-6b01-5464-8cec-44fa0b046c22")}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]="3032ad99-df35-5df0-aa43-020b2e186764")}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.98";
88692
- const rawGitSha = "e205a3b6f0be3a8d153bbc904250d65d3f3a340b";
88691
+ const rawPackageVersion = "1.0.100";
88692
+ const rawGitSha = "2ea78dd0419073d76378dc3e8303b62d25cb54c8";
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.98";
120683
- const rawGitSha = "e205a3b6f0be3a8d153bbc904250d65d3f3a340b";
120684
- const rawSentryRelease = "boxes-dev-dvb@1.0.98+e205a3b6f0be3a8d153bbc904250d65d3f3a340b";
120682
+ const rawPackageVersion = "1.0.100";
120683
+ const rawGitSha = "2ea78dd0419073d76378dc3e8303b62d25cb54c8";
120684
+ const rawSentryRelease = "boxes-dev-dvb@1.0.100+2ea78dd0419073d76378dc3e8303b62d25cb54c8";
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, streamExecSession;
138194
+ var HEARTBEAT_INTERVAL_MS, INPUT_PROBE_TIMEOUT_MS, STREAM_STALL_PROBE_MISS_THRESHOLD, CONNECT_OPEN_TIMEOUT_MS, WS_OPEN_STATE, decodeBase642, parseExitCode, streamExecSession;
138195
138195
  var init_sessionProtocol = __esm({
138196
138196
  "src/devbox/terminal/sessionProtocol.ts"() {
138197
138197
  "use strict";
@@ -138202,6 +138202,24 @@ 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
+ decodeBase642 = (value) => {
138206
+ if (typeof value !== "string") return Buffer.alloc(0);
138207
+ try {
138208
+ return Buffer.from(value, "base64");
138209
+ } catch {
138210
+ return Buffer.alloc(0);
138211
+ }
138212
+ };
138213
+ parseExitCode = (value) => {
138214
+ if (typeof value === "number" && Number.isFinite(value)) {
138215
+ return Math.max(0, Math.min(255, Math.floor(value)));
138216
+ }
138217
+ const parsed = Number.parseInt(String(value ?? "0"), 10);
138218
+ if (!Number.isFinite(parsed)) {
138219
+ return 0;
138220
+ }
138221
+ return Math.max(0, Math.min(255, parsed));
138222
+ };
138205
138223
  streamExecSession = async (ws, options) => new Promise((resolve2, reject) => {
138206
138224
  let exitCode = null;
138207
138225
  let resolved = false;
@@ -138320,6 +138338,36 @@ var init_sessionProtocol = __esm({
138320
138338
  }
138321
138339
  return;
138322
138340
  }
138341
+ if (payload.type === "tty_ready") {
138342
+ const rawId = payload.sessionId ?? payload.session_id ?? payload.id;
138343
+ if (rawId !== void 0) {
138344
+ options.onSessionInfo?.(String(rawId));
138345
+ }
138346
+ return;
138347
+ }
138348
+ if (payload.type === "tty_data") {
138349
+ const bytes = decodeBase642(payload.data);
138350
+ if (bytes.length === 0) {
138351
+ return;
138352
+ }
138353
+ options.onOutputChunk?.(bytes);
138354
+ options.onOutput?.();
138355
+ if (options.tty) {
138356
+ writeTtyOutput(bytes);
138357
+ return;
138358
+ }
138359
+ if (payload.stream === "stderr") {
138360
+ stderr.write(bytes);
138361
+ return;
138362
+ }
138363
+ stdout.write(bytes);
138364
+ return;
138365
+ }
138366
+ if (payload.type === "tty_exit") {
138367
+ exitCode = parseExitCode(payload.code ?? payload.exit_code);
138368
+ ws.close();
138369
+ return;
138370
+ }
138323
138371
  if (payload.type === "exit" && typeof payload.exit_code === "number") {
138324
138372
  exitCode = payload.exit_code;
138325
138373
  ws.close();
@@ -199098,6 +199146,9 @@ var init_modalLifecycle = __esm({
199098
199146
  "-lc",
199099
199147
  [
199100
199148
  "set -u",
199149
+ // PID 1 in Modal should ignore common termination signals so accidental
199150
+ // `kill 1` does not terminate the sandbox.
199151
+ "trap '' HUP INT QUIT TERM USR1 USR2 PIPE",
199101
199152
  `wrapper=${JSON.stringify(MODAL_DAEMON_WRAPPER_PATH)}`,
199102
199153
  'until [ -x "$wrapper" ]; do sleep 0.25; done',
199103
199154
  "while true; do",
@@ -199664,7 +199715,7 @@ var init_modalLifecycle = __esm({
199664
199715
  });
199665
199716
 
199666
199717
  // src/devbox/commands/provider/modalRuntime.ts
199667
- var import_node_path15, import_node_net3, import_ws4, SERVICE_NAME_PATTERN, CORE_SERVICE_NAMES2, MODAL_DAEMON_REQUEST_TIMEOUT_MS, MODAL_DAEMON_TTY_HANDSHAKE_TIMEOUT_MS, MODAL_SANDBOX_RESOLVE_TIMEOUT_MS, MODAL_DAEMON_CONTROL_HTTP_TIMEOUT_MS, MODAL_DAEMON_TTY_WS_PATH, validateServiceName, isSandboxNotFoundError, resolveReadPath, decodeBase642, parseJsonRecord2, withTimeout3, parseControlError, mapControlSessionRecord, normalizeServiceScope, normalizeServiceRestartPolicy, normalizeServiceStatus2, ModalDaemonExecSocket, createModalRuntimeClient;
199718
+ var import_node_path15, import_node_net3, import_ws4, SERVICE_NAME_PATTERN, CORE_SERVICE_NAMES2, MODAL_DAEMON_REQUEST_TIMEOUT_MS, MODAL_DAEMON_TTY_HANDSHAKE_TIMEOUT_MS, MODAL_SANDBOX_RESOLVE_TIMEOUT_MS, MODAL_DAEMON_CONTROL_HTTP_TIMEOUT_MS, MODAL_DAEMON_TTY_WS_PATH, validateServiceName, isSandboxNotFoundError, resolveReadPath, parseJsonRecord2, withTimeout3, parseControlError, mapControlSessionRecord, normalizeServiceScope, normalizeServiceRestartPolicy, normalizeServiceStatus2, ModalDaemonExecSocket, createModalRuntimeClient;
199668
199719
  var init_modalRuntime = __esm({
199669
199720
  "src/devbox/commands/provider/modalRuntime.ts"() {
199670
199721
  "use strict";
@@ -199697,14 +199748,6 @@ var init_modalRuntime = __esm({
199697
199748
  }
199698
199749
  return import_node_path15.default.posix.normalize(readPath);
199699
199750
  };
199700
- decodeBase642 = (value) => {
199701
- if (typeof value !== "string") return Buffer.alloc(0);
199702
- try {
199703
- return Buffer.from(value, "base64");
199704
- } catch {
199705
- return Buffer.alloc(0);
199706
- }
199707
- };
199708
199751
  parseJsonRecord2 = (raw) => {
199709
199752
  let text = "";
199710
199753
  if (typeof raw === "string") {
@@ -199836,13 +199879,6 @@ var init_modalRuntime = __esm({
199836
199879
  }, MODAL_DAEMON_TTY_HANDSHAKE_TIMEOUT_MS);
199837
199880
  this.handshakeTimer.unref();
199838
199881
  }
199839
- emitMessagePayload(streamId, payload) {
199840
- if (this.closed) return;
199841
- const framed = new Uint8Array(payload.length + 1);
199842
- framed[0] = streamId;
199843
- framed.set(payload, 1);
199844
- this.emit("message", { data: framed });
199845
- }
199846
199882
  sendJson(payload) {
199847
199883
  if (!this.ws || this.ws.readyState !== import_ws4.default.OPEN) {
199848
199884
  throw new Error("Modal daemon socket is not open.");
@@ -199881,58 +199917,34 @@ var init_modalRuntime = __esm({
199881
199917
  handleDaemonMessage(message) {
199882
199918
  const type = typeof message.type === "string" ? message.type : "";
199883
199919
  if (type === "tty_ready") {
199884
- const sessionId = typeof message.sessionId === "string" ? message.sessionId : typeof message.session_id === "string" ? message.session_id : "";
199885
199920
  this.clearHandshakeTimer();
199886
199921
  this.readyState = 1;
199887
199922
  this.emit("open");
199888
199923
  queueMicrotask(() => {
199889
199924
  if (this.closed) return;
199890
- this.emit("message", {
199891
- data: JSON.stringify({ type: "session_info", session_id: sessionId })
199892
- });
199925
+ this.emit("message", { data: JSON.stringify(message) });
199893
199926
  });
199894
199927
  return;
199895
199928
  }
199896
199929
  if (type === "tty_replay_start") {
199897
199930
  this.replayInProgress = true;
199898
199931
  this.markReplayActivity();
199899
- this.emit("message", {
199900
- data: JSON.stringify({ type: "tty_replay_start" })
199901
- });
199932
+ this.emit("message", { data: JSON.stringify(message) });
199902
199933
  return;
199903
199934
  }
199904
199935
  if (type === "tty_replay_done") {
199905
199936
  this.replayInProgress = false;
199906
199937
  this.markReplayActivity();
199907
199938
  this.flushReplayBufferedOutbound();
199908
- this.emit("message", {
199909
- data: JSON.stringify({ type: "tty_replay_done" })
199910
- });
199939
+ this.emit("message", { data: JSON.stringify(message) });
199911
199940
  return;
199912
199941
  }
199913
199942
  if (type === "tty_data") {
199914
- const bytes = decodeBase642(message.data);
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;
199922
- this.emitMessagePayload(stream, bytes);
199923
- }
199943
+ this.emit("message", { data: JSON.stringify(message) });
199924
199944
  return;
199925
199945
  }
199926
199946
  if (type === "tty_exit") {
199927
- const rawCode = typeof message.code === "number" ? message.code : Number.parseInt(String(message.code ?? "0"), 10);
199928
- const codeByte = Number.isFinite(rawCode) ? Math.max(0, Math.min(255, rawCode)) : 0;
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
- }
199947
+ this.emit("message", { data: JSON.stringify(message) });
199936
199948
  this.close();
199937
199949
  return;
199938
199950
  }
@@ -201465,7 +201477,10 @@ var init_connect2 = __esm({
201465
201477
  return env2;
201466
201478
  };
201467
201479
  formatEnvExports = (env2) => Object.entries(env2).map(([key, value]) => `export ${key}=${shellQuote2(value)}`).join("; ");
201468
- buildModalInteractiveCommand = () => "exec bash -il || exec sh -i";
201480
+ buildModalInteractiveCommand = ({ tty: tty2 }) => {
201481
+ const nonCanonicalPrelude = tty2 ? "stty -icanon min 1 time 0 -echoctl; " : "";
201482
+ return `${nonCanonicalPrelude}exec bash -il || exec sh -i`;
201483
+ };
201469
201484
  parseEnvSize = (value) => {
201470
201485
  if (!value) return void 0;
201471
201486
  const parsed = Number(value);
@@ -202352,7 +202367,7 @@ var init_connect2 = __esm({
202352
202367
  return [connectShell, "-lc", `${envCommandPrefix}${parsed.command}`];
202353
202368
  }
202354
202369
  if (computeProvider === "modal") {
202355
- const interactiveCommand = buildModalInteractiveCommand();
202370
+ const interactiveCommand = buildModalInteractiveCommand({ tty: isTty });
202356
202371
  if (projectWorkdir) {
202357
202372
  return [
202358
202373
  "/bin/sh",
@@ -220035,4 +220050,4 @@ smol-toml/dist/index.js:
220035
220050
  */
220036
220051
  //# sourceMappingURL=dvb.cjs.map
220037
220052
 
220038
- //# debugId=e4952253-6b01-5464-8cec-44fa0b046c22
220053
+ //# debugId=3032ad99-df35-5df0-aa43-020b2e186764