@boxes-dev/dvb 1.0.97 → 1.0.99
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 +66 -388
- package/dist/bin/dvb.cjs.map +1 -1
- package/dist/bin/dvbd.cjs +5 -5
- package/dist/devbox/commands/connect.d.ts +4 -3
- package/dist/devbox/commands/connect.d.ts.map +1 -1
- package/dist/devbox/commands/connect.js +6 -22
- package/dist/devbox/commands/connect.js.map +1 -1
- package/dist/devbox/commands/provider/modalRuntime.d.ts.map +1 -1
- package/dist/devbox/commands/provider/modalRuntime.js +5 -44
- package/dist/devbox/commands/provider/modalRuntime.js.map +1 -1
- package/dist/devbox/terminal/sessionProtocol.d.ts +1 -12
- package/dist/devbox/terminal/sessionProtocol.d.ts.map +1 -1
- package/dist/devbox/terminal/sessionProtocol.js +50 -341
- package/dist/devbox/terminal/sessionProtocol.js.map +1 -1
- package/package.json +1 -1
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]="
|
|
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]="c89c7337-d26d-5d0e-9378-e2535af1df44")}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.
|
|
88692
|
-
const rawGitSha = "
|
|
88691
|
+
const rawPackageVersion = "1.0.99";
|
|
88692
|
+
const rawGitSha = "6e1d4cbe7aabab2526d50776d8007a85d5800b43";
|
|
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.
|
|
120683
|
-
const rawGitSha = "
|
|
120684
|
-
const rawSentryRelease = "boxes-dev-dvb@1.0.
|
|
120682
|
+
const rawPackageVersion = "1.0.99";
|
|
120683
|
+
const rawGitSha = "6e1d4cbe7aabab2526d50776d8007a85d5800b43";
|
|
120684
|
+
const rawSentryRelease = "boxes-dev-dvb@1.0.99+6e1d4cbe7aabab2526d50776d8007a85d5800b43";
|
|
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,
|
|
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,305 +138202,23 @@ 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
|
-
|
|
138206
|
-
|
|
138207
|
-
|
|
138208
|
-
|
|
138209
|
-
|
|
138210
|
-
|
|
138211
|
-
|
|
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
|
-
};
|
|
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
|
+
}
|
|
138447
138212
|
};
|
|
138448
|
-
|
|
138449
|
-
|
|
138450
|
-
|
|
138451
|
-
|
|
138452
|
-
|
|
138453
|
-
|
|
138454
|
-
|
|
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, "");
|
|
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;
|
|
138502
138220
|
}
|
|
138503
|
-
return
|
|
138221
|
+
return Math.max(0, Math.min(255, parsed));
|
|
138504
138222
|
};
|
|
138505
138223
|
streamExecSession = async (ws, options) => new Promise((resolve2, reject) => {
|
|
138506
138224
|
let exitCode = null;
|
|
@@ -138525,21 +138243,6 @@ var init_sessionProtocol = __esm({
|
|
|
138525
138243
|
const stderr = process.stderr;
|
|
138526
138244
|
const latency = options.latency;
|
|
138527
138245
|
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
138246
|
const initialInput = typeof options.initialInput === "string" ? Buffer.from(options.initialInput, "utf8") : options.initialInput;
|
|
138544
138247
|
const supportsResizeControlMessages = options.supportsResizeControlMessages ?? true;
|
|
138545
138248
|
if (options.stdin && initialInput && initialInput.length > 0) {
|
|
@@ -138601,8 +138304,7 @@ var init_sessionProtocol = __esm({
|
|
|
138601
138304
|
const rawBuffer = Buffer.from(buffer);
|
|
138602
138305
|
options.onOutputChunk?.(rawBuffer);
|
|
138603
138306
|
options.onOutput?.();
|
|
138604
|
-
|
|
138605
|
-
writeTtyOutput(applyDisconnectFilter(filteredBuffer));
|
|
138307
|
+
writeTtyOutput(rawBuffer);
|
|
138606
138308
|
return;
|
|
138607
138309
|
}
|
|
138608
138310
|
const streamId = buffer[0];
|
|
@@ -138622,7 +138324,6 @@ var init_sessionProtocol = __esm({
|
|
|
138622
138324
|
stderr.write(Buffer.from(payload));
|
|
138623
138325
|
}
|
|
138624
138326
|
if (streamId === 3 && payload.length > 0) {
|
|
138625
|
-
armDisconnectFilter();
|
|
138626
138327
|
exitCode = payload[0] ?? 0;
|
|
138627
138328
|
ws.close();
|
|
138628
138329
|
}
|
|
@@ -138637,6 +138338,36 @@ var init_sessionProtocol = __esm({
|
|
|
138637
138338
|
}
|
|
138638
138339
|
return;
|
|
138639
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
|
+
}
|
|
138640
138371
|
if (payload.type === "exit" && typeof payload.exit_code === "number") {
|
|
138641
138372
|
exitCode = payload.exit_code;
|
|
138642
138373
|
ws.close();
|
|
@@ -138659,9 +138390,6 @@ var init_sessionProtocol = __esm({
|
|
|
138659
138390
|
return;
|
|
138660
138391
|
}
|
|
138661
138392
|
if (payload.type === "tty_replay_done") {
|
|
138662
|
-
if (options.tty && ttyOutputFilter) {
|
|
138663
|
-
writeTtyOutput(applyDisconnectFilter(ttyOutputFilter.flush()));
|
|
138664
|
-
}
|
|
138665
138393
|
options.onReplayDone?.();
|
|
138666
138394
|
return;
|
|
138667
138395
|
}
|
|
@@ -138672,12 +138400,7 @@ var init_sessionProtocol = __esm({
|
|
|
138672
138400
|
}
|
|
138673
138401
|
options.onOutput?.();
|
|
138674
138402
|
if (options.tty) {
|
|
138675
|
-
|
|
138676
|
-
armDisconnectFilter();
|
|
138677
|
-
}
|
|
138678
|
-
const dataBuffer = Buffer.from(data, "utf8");
|
|
138679
|
-
const filtered = ttyOutputFilter ? ttyOutputFilter.transform(dataBuffer) : dataBuffer;
|
|
138680
|
-
writeTtyOutput(applyDisconnectFilter(filtered));
|
|
138403
|
+
writeTtyOutput(Buffer.from(data, "utf8"));
|
|
138681
138404
|
} else {
|
|
138682
138405
|
stdout.write(data);
|
|
138683
138406
|
}
|
|
@@ -138764,9 +138487,6 @@ var init_sessionProtocol = __esm({
|
|
|
138764
138487
|
finishDetach();
|
|
138765
138488
|
return;
|
|
138766
138489
|
}
|
|
138767
|
-
if (options.tty && chunk.length === 1 && chunk[0] === 4) {
|
|
138768
|
-
armDisconnectFilter();
|
|
138769
|
-
}
|
|
138770
138490
|
if (typeof ws.readyState === "number" && ws.readyState !== WS_OPEN_STATE) {
|
|
138771
138491
|
logger8.warn("connect_stdin_socket_not_open", {
|
|
138772
138492
|
readyState: ws.readyState,
|
|
@@ -138949,9 +138669,6 @@ var init_sessionProtocol = __esm({
|
|
|
138949
138669
|
}
|
|
138950
138670
|
};
|
|
138951
138671
|
const cleanup = () => {
|
|
138952
|
-
if (options.tty && ttyOutputFilter) {
|
|
138953
|
-
writeTtyOutput(ttyOutputFilter.flush());
|
|
138954
|
-
}
|
|
138955
138672
|
ws.removeEventListener("message", onMessage);
|
|
138956
138673
|
ws.removeEventListener("close", onClose);
|
|
138957
138674
|
ws.removeEventListener("error", onError);
|
|
@@ -199995,7 +199712,7 @@ var init_modalLifecycle = __esm({
|
|
|
199995
199712
|
});
|
|
199996
199713
|
|
|
199997
199714
|
// src/devbox/commands/provider/modalRuntime.ts
|
|
199998
|
-
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,
|
|
199715
|
+
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;
|
|
199999
199716
|
var init_modalRuntime = __esm({
|
|
200000
199717
|
"src/devbox/commands/provider/modalRuntime.ts"() {
|
|
200001
199718
|
"use strict";
|
|
@@ -200028,14 +199745,6 @@ var init_modalRuntime = __esm({
|
|
|
200028
199745
|
}
|
|
200029
199746
|
return import_node_path15.default.posix.normalize(readPath);
|
|
200030
199747
|
};
|
|
200031
|
-
decodeBase642 = (value) => {
|
|
200032
|
-
if (typeof value !== "string") return Buffer.alloc(0);
|
|
200033
|
-
try {
|
|
200034
|
-
return Buffer.from(value, "base64");
|
|
200035
|
-
} catch {
|
|
200036
|
-
return Buffer.alloc(0);
|
|
200037
|
-
}
|
|
200038
|
-
};
|
|
200039
199748
|
parseJsonRecord2 = (raw) => {
|
|
200040
199749
|
let text = "";
|
|
200041
199750
|
if (typeof raw === "string") {
|
|
@@ -200167,13 +199876,6 @@ var init_modalRuntime = __esm({
|
|
|
200167
199876
|
}, MODAL_DAEMON_TTY_HANDSHAKE_TIMEOUT_MS);
|
|
200168
199877
|
this.handshakeTimer.unref();
|
|
200169
199878
|
}
|
|
200170
|
-
emitMessagePayload(streamId, payload) {
|
|
200171
|
-
if (this.closed) return;
|
|
200172
|
-
const framed = new Uint8Array(payload.length + 1);
|
|
200173
|
-
framed[0] = streamId;
|
|
200174
|
-
framed.set(payload, 1);
|
|
200175
|
-
this.emit("message", { data: framed });
|
|
200176
|
-
}
|
|
200177
199879
|
sendJson(payload) {
|
|
200178
199880
|
if (!this.ws || this.ws.readyState !== import_ws4.default.OPEN) {
|
|
200179
199881
|
throw new Error("Modal daemon socket is not open.");
|
|
@@ -200212,47 +199914,34 @@ var init_modalRuntime = __esm({
|
|
|
200212
199914
|
handleDaemonMessage(message) {
|
|
200213
199915
|
const type = typeof message.type === "string" ? message.type : "";
|
|
200214
199916
|
if (type === "tty_ready") {
|
|
200215
|
-
const sessionId = typeof message.sessionId === "string" ? message.sessionId : typeof message.session_id === "string" ? message.session_id : "";
|
|
200216
199917
|
this.clearHandshakeTimer();
|
|
200217
199918
|
this.readyState = 1;
|
|
200218
199919
|
this.emit("open");
|
|
200219
199920
|
queueMicrotask(() => {
|
|
200220
199921
|
if (this.closed) return;
|
|
200221
|
-
this.emit("message", {
|
|
200222
|
-
data: JSON.stringify({ type: "session_info", session_id: sessionId })
|
|
200223
|
-
});
|
|
199922
|
+
this.emit("message", { data: JSON.stringify(message) });
|
|
200224
199923
|
});
|
|
200225
199924
|
return;
|
|
200226
199925
|
}
|
|
200227
199926
|
if (type === "tty_replay_start") {
|
|
200228
199927
|
this.replayInProgress = true;
|
|
200229
199928
|
this.markReplayActivity();
|
|
200230
|
-
this.emit("message", {
|
|
200231
|
-
data: JSON.stringify({ type: "tty_replay_start" })
|
|
200232
|
-
});
|
|
199929
|
+
this.emit("message", { data: JSON.stringify(message) });
|
|
200233
199930
|
return;
|
|
200234
199931
|
}
|
|
200235
199932
|
if (type === "tty_replay_done") {
|
|
200236
199933
|
this.replayInProgress = false;
|
|
200237
199934
|
this.markReplayActivity();
|
|
200238
199935
|
this.flushReplayBufferedOutbound();
|
|
200239
|
-
this.emit("message", {
|
|
200240
|
-
data: JSON.stringify({ type: "tty_replay_done" })
|
|
200241
|
-
});
|
|
199936
|
+
this.emit("message", { data: JSON.stringify(message) });
|
|
200242
199937
|
return;
|
|
200243
199938
|
}
|
|
200244
199939
|
if (type === "tty_data") {
|
|
200245
|
-
|
|
200246
|
-
const bytes = decodeBase642(message.data);
|
|
200247
|
-
if (bytes.length > 0) {
|
|
200248
|
-
this.emitMessagePayload(stream, bytes);
|
|
200249
|
-
}
|
|
199940
|
+
this.emit("message", { data: JSON.stringify(message) });
|
|
200250
199941
|
return;
|
|
200251
199942
|
}
|
|
200252
199943
|
if (type === "tty_exit") {
|
|
200253
|
-
|
|
200254
|
-
const codeByte = Number.isFinite(rawCode) ? Math.max(0, Math.min(255, rawCode)) : 0;
|
|
200255
|
-
this.emitMessagePayload(3, Uint8Array.of(codeByte));
|
|
199944
|
+
this.emit("message", { data: JSON.stringify(message) });
|
|
200256
199945
|
this.close();
|
|
200257
199946
|
return;
|
|
200258
199947
|
}
|
|
@@ -201785,7 +201474,10 @@ var init_connect2 = __esm({
|
|
|
201785
201474
|
return env2;
|
|
201786
201475
|
};
|
|
201787
201476
|
formatEnvExports = (env2) => Object.entries(env2).map(([key, value]) => `export ${key}=${shellQuote2(value)}`).join("; ");
|
|
201788
|
-
buildModalInteractiveCommand = (
|
|
201477
|
+
buildModalInteractiveCommand = ({ tty: tty2 }) => {
|
|
201478
|
+
const nonCanonicalPrelude = tty2 ? "stty -icanon min 1 time 0 -echoctl; " : "";
|
|
201479
|
+
return `${nonCanonicalPrelude}exec bash -il || exec sh -i`;
|
|
201480
|
+
};
|
|
201789
201481
|
parseEnvSize = (value) => {
|
|
201790
201482
|
if (!value) return void 0;
|
|
201791
201483
|
const parsed = Number(value);
|
|
@@ -202672,7 +202364,7 @@ var init_connect2 = __esm({
|
|
|
202672
202364
|
return [connectShell, "-lc", `${envCommandPrefix}${parsed.command}`];
|
|
202673
202365
|
}
|
|
202674
202366
|
if (computeProvider === "modal") {
|
|
202675
|
-
const interactiveCommand = buildModalInteractiveCommand();
|
|
202367
|
+
const interactiveCommand = buildModalInteractiveCommand({ tty: isTty });
|
|
202676
202368
|
if (projectWorkdir) {
|
|
202677
202369
|
return [
|
|
202678
202370
|
"/bin/sh",
|
|
@@ -202727,13 +202419,6 @@ var init_connect2 = __esm({
|
|
|
202727
202419
|
resolveTtySize,
|
|
202728
202420
|
openBrowser: openBrowser2,
|
|
202729
202421
|
isRawCtrlCChunk,
|
|
202730
|
-
...computeProvider === "modal" && isTty ? (() => {
|
|
202731
|
-
const ttyOutputFilter = createModalTtyOutputFilter();
|
|
202732
|
-
return {
|
|
202733
|
-
ttyOutputFilter,
|
|
202734
|
-
stripDisconnectArtifacts: true
|
|
202735
|
-
};
|
|
202736
|
-
})() : {},
|
|
202737
202422
|
...latency ? { latency } : {},
|
|
202738
202423
|
onSessionInfo: (id) => {
|
|
202739
202424
|
if (supportsAttachExecSession) {
|
|
@@ -202910,13 +202595,6 @@ ${message}\r
|
|
|
202910
202595
|
resolveTtySize,
|
|
202911
202596
|
openBrowser: openBrowser2,
|
|
202912
202597
|
isRawCtrlCChunk,
|
|
202913
|
-
...computeProvider === "modal" && isTty ? (() => {
|
|
202914
|
-
const ttyOutputFilter = createModalTtyOutputFilter();
|
|
202915
|
-
return {
|
|
202916
|
-
ttyOutputFilter,
|
|
202917
|
-
stripDisconnectArtifacts: true
|
|
202918
|
-
};
|
|
202919
|
-
})() : {},
|
|
202920
202598
|
...latency ? { latency } : {},
|
|
202921
202599
|
openTimeoutMs: CONNECT_OPEN_TIMEOUT_MS2,
|
|
202922
202600
|
onOutput: noteOutput,
|
|
@@ -220369,4 +220047,4 @@ smol-toml/dist/index.js:
|
|
|
220369
220047
|
*/
|
|
220370
220048
|
//# sourceMappingURL=dvb.cjs.map
|
|
220371
220049
|
|
|
220372
|
-
//# debugId=
|
|
220050
|
+
//# debugId=c89c7337-d26d-5d0e-9378-e2535af1df44
|