codeam-cli 2.14.0 → 2.15.1

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.js CHANGED
@@ -30,1309 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
- // ../../node_modules/node-pty/lib/utils.js
34
- var require_utils = __commonJS({
35
- "../../node_modules/node-pty/lib/utils.js"(exports2) {
36
- "use strict";
37
- Object.defineProperty(exports2, "__esModule", { value: true });
38
- exports2.loadNativeModule = exports2.assign = void 0;
39
- function assign(target) {
40
- var sources = [];
41
- for (var _i = 1; _i < arguments.length; _i++) {
42
- sources[_i - 1] = arguments[_i];
43
- }
44
- sources.forEach(function(source) {
45
- return Object.keys(source).forEach(function(key) {
46
- return target[key] = source[key];
47
- });
48
- });
49
- return target;
50
- }
51
- exports2.assign = assign;
52
- function loadNativeModule(name) {
53
- var dirs = ["build/Release", "build/Debug", "prebuilds/" + process.platform + "-" + process.arch];
54
- var relative3 = ["..", "."];
55
- var lastError;
56
- for (var _i = 0, dirs_1 = dirs; _i < dirs_1.length; _i++) {
57
- var d3 = dirs_1[_i];
58
- for (var _a = 0, relative_1 = relative3; _a < relative_1.length; _a++) {
59
- var r = relative_1[_a];
60
- var dir = r + "/" + d3 + "/";
61
- try {
62
- return { dir, module: require(dir + "/" + name + ".node") };
63
- } catch (e) {
64
- lastError = e;
65
- }
66
- }
67
- }
68
- throw new Error("Failed to load native module: " + name + ".node, checked: " + dirs.join(", ") + ": " + lastError);
69
- }
70
- exports2.loadNativeModule = loadNativeModule;
71
- }
72
- });
73
-
74
- // ../../node_modules/node-pty/lib/eventEmitter2.js
75
- var require_eventEmitter2 = __commonJS({
76
- "../../node_modules/node-pty/lib/eventEmitter2.js"(exports2) {
77
- "use strict";
78
- Object.defineProperty(exports2, "__esModule", { value: true });
79
- exports2.EventEmitter2 = void 0;
80
- var EventEmitter2 = (
81
- /** @class */
82
- (function() {
83
- function EventEmitter22() {
84
- this._listeners = [];
85
- }
86
- Object.defineProperty(EventEmitter22.prototype, "event", {
87
- get: function() {
88
- var _this = this;
89
- if (!this._event) {
90
- this._event = function(listener) {
91
- _this._listeners.push(listener);
92
- var disposable = {
93
- dispose: function() {
94
- for (var i = 0; i < _this._listeners.length; i++) {
95
- if (_this._listeners[i] === listener) {
96
- _this._listeners.splice(i, 1);
97
- return;
98
- }
99
- }
100
- }
101
- };
102
- return disposable;
103
- };
104
- }
105
- return this._event;
106
- },
107
- enumerable: false,
108
- configurable: true
109
- });
110
- EventEmitter22.prototype.fire = function(data) {
111
- var queue = [];
112
- for (var i = 0; i < this._listeners.length; i++) {
113
- queue.push(this._listeners[i]);
114
- }
115
- for (var i = 0; i < queue.length; i++) {
116
- queue[i].call(void 0, data);
117
- }
118
- };
119
- return EventEmitter22;
120
- })()
121
- );
122
- exports2.EventEmitter2 = EventEmitter2;
123
- }
124
- });
125
-
126
- // ../../node_modules/node-pty/lib/terminal.js
127
- var require_terminal = __commonJS({
128
- "../../node_modules/node-pty/lib/terminal.js"(exports2) {
129
- "use strict";
130
- Object.defineProperty(exports2, "__esModule", { value: true });
131
- exports2.Terminal = exports2.DEFAULT_ROWS = exports2.DEFAULT_COLS = void 0;
132
- var events_1 = require("events");
133
- var eventEmitter2_1 = require_eventEmitter2();
134
- exports2.DEFAULT_COLS = 80;
135
- exports2.DEFAULT_ROWS = 24;
136
- var FLOW_CONTROL_PAUSE = "";
137
- var FLOW_CONTROL_RESUME = "";
138
- var Terminal = (
139
- /** @class */
140
- (function() {
141
- function Terminal2(opt) {
142
- this._pid = 0;
143
- this._fd = 0;
144
- this._cols = 0;
145
- this._rows = 0;
146
- this._readable = false;
147
- this._writable = false;
148
- this._onData = new eventEmitter2_1.EventEmitter2();
149
- this._onExit = new eventEmitter2_1.EventEmitter2();
150
- this._internalee = new events_1.EventEmitter();
151
- this.handleFlowControl = !!(opt === null || opt === void 0 ? void 0 : opt.handleFlowControl);
152
- this._flowControlPause = (opt === null || opt === void 0 ? void 0 : opt.flowControlPause) || FLOW_CONTROL_PAUSE;
153
- this._flowControlResume = (opt === null || opt === void 0 ? void 0 : opt.flowControlResume) || FLOW_CONTROL_RESUME;
154
- if (!opt) {
155
- return;
156
- }
157
- this._checkType("name", opt.name ? opt.name : void 0, "string");
158
- this._checkType("cols", opt.cols ? opt.cols : void 0, "number");
159
- this._checkType("rows", opt.rows ? opt.rows : void 0, "number");
160
- this._checkType("cwd", opt.cwd ? opt.cwd : void 0, "string");
161
- this._checkType("env", opt.env ? opt.env : void 0, "object");
162
- this._checkType("uid", opt.uid ? opt.uid : void 0, "number");
163
- this._checkType("gid", opt.gid ? opt.gid : void 0, "number");
164
- this._checkType("encoding", opt.encoding ? opt.encoding : void 0, "string");
165
- }
166
- Object.defineProperty(Terminal2.prototype, "onData", {
167
- get: function() {
168
- return this._onData.event;
169
- },
170
- enumerable: false,
171
- configurable: true
172
- });
173
- Object.defineProperty(Terminal2.prototype, "onExit", {
174
- get: function() {
175
- return this._onExit.event;
176
- },
177
- enumerable: false,
178
- configurable: true
179
- });
180
- Object.defineProperty(Terminal2.prototype, "pid", {
181
- get: function() {
182
- return this._pid;
183
- },
184
- enumerable: false,
185
- configurable: true
186
- });
187
- Object.defineProperty(Terminal2.prototype, "cols", {
188
- get: function() {
189
- return this._cols;
190
- },
191
- enumerable: false,
192
- configurable: true
193
- });
194
- Object.defineProperty(Terminal2.prototype, "rows", {
195
- get: function() {
196
- return this._rows;
197
- },
198
- enumerable: false,
199
- configurable: true
200
- });
201
- Terminal2.prototype.write = function(data) {
202
- if (this.handleFlowControl) {
203
- if (data === this._flowControlPause) {
204
- this.pause();
205
- return;
206
- }
207
- if (data === this._flowControlResume) {
208
- this.resume();
209
- return;
210
- }
211
- }
212
- this._write(data);
213
- };
214
- Terminal2.prototype._forwardEvents = function() {
215
- var _this = this;
216
- this.on("data", function(e) {
217
- return _this._onData.fire(e);
218
- });
219
- this.on("exit", function(exitCode, signal) {
220
- return _this._onExit.fire({ exitCode, signal });
221
- });
222
- };
223
- Terminal2.prototype._checkType = function(name, value, type, allowArray) {
224
- if (allowArray === void 0) {
225
- allowArray = false;
226
- }
227
- if (value === void 0) {
228
- return;
229
- }
230
- if (allowArray) {
231
- if (Array.isArray(value)) {
232
- value.forEach(function(v, i) {
233
- if (typeof v !== type) {
234
- throw new Error(name + "[" + i + "] must be a " + type + " (not a " + typeof v[i] + ")");
235
- }
236
- });
237
- return;
238
- }
239
- }
240
- if (typeof value !== type) {
241
- throw new Error(name + " must be a " + type + " (not a " + typeof value + ")");
242
- }
243
- };
244
- Terminal2.prototype.end = function(data) {
245
- this._socket.end(data);
246
- };
247
- Terminal2.prototype.pipe = function(dest, options) {
248
- return this._socket.pipe(dest, options);
249
- };
250
- Terminal2.prototype.pause = function() {
251
- return this._socket.pause();
252
- };
253
- Terminal2.prototype.resume = function() {
254
- return this._socket.resume();
255
- };
256
- Terminal2.prototype.setEncoding = function(encoding) {
257
- if (this._socket._decoder) {
258
- delete this._socket._decoder;
259
- }
260
- if (encoding) {
261
- this._socket.setEncoding(encoding);
262
- }
263
- };
264
- Terminal2.prototype.addListener = function(eventName, listener) {
265
- this.on(eventName, listener);
266
- };
267
- Terminal2.prototype.on = function(eventName, listener) {
268
- if (eventName === "close") {
269
- this._internalee.on("close", listener);
270
- return;
271
- }
272
- this._socket.on(eventName, listener);
273
- };
274
- Terminal2.prototype.emit = function(eventName) {
275
- var args2 = [];
276
- for (var _i = 1; _i < arguments.length; _i++) {
277
- args2[_i - 1] = arguments[_i];
278
- }
279
- if (eventName === "close") {
280
- return this._internalee.emit.apply(this._internalee, arguments);
281
- }
282
- return this._socket.emit.apply(this._socket, arguments);
283
- };
284
- Terminal2.prototype.listeners = function(eventName) {
285
- return this._socket.listeners(eventName);
286
- };
287
- Terminal2.prototype.removeListener = function(eventName, listener) {
288
- this._socket.removeListener(eventName, listener);
289
- };
290
- Terminal2.prototype.removeAllListeners = function(eventName) {
291
- this._socket.removeAllListeners(eventName);
292
- };
293
- Terminal2.prototype.once = function(eventName, listener) {
294
- this._socket.once(eventName, listener);
295
- };
296
- Terminal2.prototype._close = function() {
297
- this._socket.readable = false;
298
- this.write = function() {
299
- };
300
- this.end = function() {
301
- };
302
- this._writable = false;
303
- this._readable = false;
304
- };
305
- Terminal2.prototype._parseEnv = function(env) {
306
- var keys = Object.keys(env || {});
307
- var pairs = [];
308
- for (var i = 0; i < keys.length; i++) {
309
- if (keys[i] === void 0) {
310
- continue;
311
- }
312
- pairs.push(keys[i] + "=" + env[keys[i]]);
313
- }
314
- return pairs;
315
- };
316
- return Terminal2;
317
- })()
318
- );
319
- exports2.Terminal = Terminal;
320
- }
321
- });
322
-
323
- // ../../node_modules/node-pty/lib/shared/conout.js
324
- var require_conout = __commonJS({
325
- "../../node_modules/node-pty/lib/shared/conout.js"(exports2) {
326
- "use strict";
327
- Object.defineProperty(exports2, "__esModule", { value: true });
328
- exports2.getWorkerPipeName = void 0;
329
- function getWorkerPipeName(conoutPipeName) {
330
- return conoutPipeName + "-worker";
331
- }
332
- exports2.getWorkerPipeName = getWorkerPipeName;
333
- }
334
- });
335
-
336
- // ../../node_modules/node-pty/lib/windowsConoutConnection.js
337
- var require_windowsConoutConnection = __commonJS({
338
- "../../node_modules/node-pty/lib/windowsConoutConnection.js"(exports2) {
339
- "use strict";
340
- var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P3, generator) {
341
- function adopt(value) {
342
- return value instanceof P3 ? value : new P3(function(resolve2) {
343
- resolve2(value);
344
- });
345
- }
346
- return new (P3 || (P3 = Promise))(function(resolve2, reject) {
347
- function fulfilled(value) {
348
- try {
349
- step(generator.next(value));
350
- } catch (e) {
351
- reject(e);
352
- }
353
- }
354
- function rejected(value) {
355
- try {
356
- step(generator["throw"](value));
357
- } catch (e) {
358
- reject(e);
359
- }
360
- }
361
- function step(result) {
362
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
363
- }
364
- step((generator = generator.apply(thisArg, _arguments || [])).next());
365
- });
366
- };
367
- var __generator = exports2 && exports2.__generator || function(thisArg, body) {
368
- var _2 = { label: 0, sent: function() {
369
- if (t2[0] & 1) throw t2[1];
370
- return t2[1];
371
- }, trys: [], ops: [] }, f, y2, t2, g;
372
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
373
- return this;
374
- }), g;
375
- function verb(n) {
376
- return function(v) {
377
- return step([n, v]);
378
- };
379
- }
380
- function step(op) {
381
- if (f) throw new TypeError("Generator is already executing.");
382
- while (_2) try {
383
- if (f = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2;
384
- if (y2 = 0, t2) op = [op[0] & 2, t2.value];
385
- switch (op[0]) {
386
- case 0:
387
- case 1:
388
- t2 = op;
389
- break;
390
- case 4:
391
- _2.label++;
392
- return { value: op[1], done: false };
393
- case 5:
394
- _2.label++;
395
- y2 = op[1];
396
- op = [0];
397
- continue;
398
- case 7:
399
- op = _2.ops.pop();
400
- _2.trys.pop();
401
- continue;
402
- default:
403
- if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
404
- _2 = 0;
405
- continue;
406
- }
407
- if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
408
- _2.label = op[1];
409
- break;
410
- }
411
- if (op[0] === 6 && _2.label < t2[1]) {
412
- _2.label = t2[1];
413
- t2 = op;
414
- break;
415
- }
416
- if (t2 && _2.label < t2[2]) {
417
- _2.label = t2[2];
418
- _2.ops.push(op);
419
- break;
420
- }
421
- if (t2[2]) _2.ops.pop();
422
- _2.trys.pop();
423
- continue;
424
- }
425
- op = body.call(thisArg, _2);
426
- } catch (e) {
427
- op = [6, e];
428
- y2 = 0;
429
- } finally {
430
- f = t2 = 0;
431
- }
432
- if (op[0] & 5) throw op[1];
433
- return { value: op[0] ? op[1] : void 0, done: true };
434
- }
435
- };
436
- Object.defineProperty(exports2, "__esModule", { value: true });
437
- exports2.ConoutConnection = void 0;
438
- var worker_threads_1 = require("worker_threads");
439
- var conout_1 = require_conout();
440
- var path_1 = require("path");
441
- var eventEmitter2_1 = require_eventEmitter2();
442
- var FLUSH_DATA_INTERVAL = 1e3;
443
- var ConoutConnection = (
444
- /** @class */
445
- (function() {
446
- function ConoutConnection2(_conoutPipeName, _useConptyDll) {
447
- var _this = this;
448
- this._conoutPipeName = _conoutPipeName;
449
- this._useConptyDll = _useConptyDll;
450
- this._isDisposed = false;
451
- this._onReady = new eventEmitter2_1.EventEmitter2();
452
- var workerData = {
453
- conoutPipeName: _conoutPipeName
454
- };
455
- var scriptPath = __dirname.replace("node_modules.asar", "node_modules.asar.unpacked");
456
- this._worker = new worker_threads_1.Worker(path_1.join(scriptPath, "worker/conoutSocketWorker.js"), { workerData });
457
- this._worker.on("message", function(message) {
458
- switch (message) {
459
- case 1:
460
- _this._onReady.fire();
461
- return;
462
- default:
463
- console.warn("Unexpected ConoutWorkerMessage", message);
464
- }
465
- });
466
- }
467
- Object.defineProperty(ConoutConnection2.prototype, "onReady", {
468
- get: function() {
469
- return this._onReady.event;
470
- },
471
- enumerable: false,
472
- configurable: true
473
- });
474
- ConoutConnection2.prototype.dispose = function() {
475
- if (!this._useConptyDll && this._isDisposed) {
476
- return;
477
- }
478
- this._isDisposed = true;
479
- this._drainDataAndClose();
480
- };
481
- ConoutConnection2.prototype.connectSocket = function(socket) {
482
- socket.connect(conout_1.getWorkerPipeName(this._conoutPipeName));
483
- };
484
- ConoutConnection2.prototype._drainDataAndClose = function() {
485
- var _this = this;
486
- if (this._drainTimeout) {
487
- clearTimeout(this._drainTimeout);
488
- }
489
- this._drainTimeout = setTimeout(function() {
490
- return _this._destroySocket();
491
- }, FLUSH_DATA_INTERVAL);
492
- };
493
- ConoutConnection2.prototype._destroySocket = function() {
494
- return __awaiter(this, void 0, void 0, function() {
495
- return __generator(this, function(_a) {
496
- switch (_a.label) {
497
- case 0:
498
- return [4, this._worker.terminate()];
499
- case 1:
500
- _a.sent();
501
- return [
502
- 2
503
- /*return*/
504
- ];
505
- }
506
- });
507
- });
508
- };
509
- return ConoutConnection2;
510
- })()
511
- );
512
- exports2.ConoutConnection = ConoutConnection;
513
- }
514
- });
515
-
516
- // ../../node_modules/node-pty/lib/windowsPtyAgent.js
517
- var require_windowsPtyAgent = __commonJS({
518
- "../../node_modules/node-pty/lib/windowsPtyAgent.js"(exports2) {
519
- "use strict";
520
- Object.defineProperty(exports2, "__esModule", { value: true });
521
- exports2.argsToCommandLine = exports2.WindowsPtyAgent = void 0;
522
- var fs17 = require("fs");
523
- var os16 = require("os");
524
- var path23 = require("path");
525
- var child_process_1 = require("child_process");
526
- var net_1 = require("net");
527
- var windowsConoutConnection_1 = require_windowsConoutConnection();
528
- var utils_1 = require_utils();
529
- var conptyNative;
530
- var winptyNative;
531
- var FLUSH_DATA_INTERVAL = 1e3;
532
- var WindowsPtyAgent = (
533
- /** @class */
534
- (function() {
535
- function WindowsPtyAgent2(file, args2, env, cwd, cols, rows, debug, _useConpty, _useConptyDll, conptyInheritCursor) {
536
- var _this = this;
537
- if (_useConptyDll === void 0) {
538
- _useConptyDll = false;
539
- }
540
- if (conptyInheritCursor === void 0) {
541
- conptyInheritCursor = false;
542
- }
543
- this._useConpty = _useConpty;
544
- this._useConptyDll = _useConptyDll;
545
- this._pid = 0;
546
- this._innerPid = 0;
547
- if (this._useConpty === void 0 || this._useConpty === true) {
548
- this._useConpty = this._getWindowsBuildNumber() >= 18309;
549
- }
550
- if (this._useConpty) {
551
- if (!conptyNative) {
552
- conptyNative = utils_1.loadNativeModule("conpty").module;
553
- }
554
- } else {
555
- if (!winptyNative) {
556
- winptyNative = utils_1.loadNativeModule("pty").module;
557
- }
558
- }
559
- this._ptyNative = this._useConpty ? conptyNative : winptyNative;
560
- cwd = path23.resolve(cwd);
561
- var commandLine = argsToCommandLine(file, args2);
562
- var term;
563
- if (this._useConpty) {
564
- term = this._ptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor, this._useConptyDll);
565
- } else {
566
- term = this._ptyNative.startProcess(file, commandLine, env, cwd, cols, rows, debug);
567
- this._pid = term.pid;
568
- this._innerPid = term.innerPid;
569
- }
570
- this._fd = term.fd;
571
- this._pty = term.pty;
572
- this._outSocket = new net_1.Socket();
573
- this._outSocket.setEncoding("utf8");
574
- this._conoutSocketWorker = new windowsConoutConnection_1.ConoutConnection(term.conout, this._useConptyDll);
575
- this._conoutSocketWorker.onReady(function() {
576
- _this._conoutSocketWorker.connectSocket(_this._outSocket);
577
- });
578
- this._outSocket.on("connect", function() {
579
- _this._outSocket.emit("ready_datapipe");
580
- });
581
- var inSocketFD = fs17.openSync(term.conin, "w");
582
- this._inSocket = new net_1.Socket({
583
- fd: inSocketFD,
584
- readable: false,
585
- writable: true
586
- });
587
- this._inSocket.setEncoding("utf8");
588
- if (this._useConpty) {
589
- var connect = this._ptyNative.connect(this._pty, commandLine, cwd, env, this._useConptyDll, function(c2) {
590
- return _this._$onProcessExit(c2);
591
- });
592
- this._innerPid = connect.pid;
593
- }
594
- }
595
- Object.defineProperty(WindowsPtyAgent2.prototype, "inSocket", {
596
- get: function() {
597
- return this._inSocket;
598
- },
599
- enumerable: false,
600
- configurable: true
601
- });
602
- Object.defineProperty(WindowsPtyAgent2.prototype, "outSocket", {
603
- get: function() {
604
- return this._outSocket;
605
- },
606
- enumerable: false,
607
- configurable: true
608
- });
609
- Object.defineProperty(WindowsPtyAgent2.prototype, "fd", {
610
- get: function() {
611
- return this._fd;
612
- },
613
- enumerable: false,
614
- configurable: true
615
- });
616
- Object.defineProperty(WindowsPtyAgent2.prototype, "innerPid", {
617
- get: function() {
618
- return this._innerPid;
619
- },
620
- enumerable: false,
621
- configurable: true
622
- });
623
- Object.defineProperty(WindowsPtyAgent2.prototype, "pty", {
624
- get: function() {
625
- return this._pty;
626
- },
627
- enumerable: false,
628
- configurable: true
629
- });
630
- WindowsPtyAgent2.prototype.resize = function(cols, rows) {
631
- if (this._useConpty) {
632
- if (this._exitCode !== void 0) {
633
- throw new Error("Cannot resize a pty that has already exited");
634
- }
635
- this._ptyNative.resize(this._pty, cols, rows, this._useConptyDll);
636
- return;
637
- }
638
- this._ptyNative.resize(this._pid, cols, rows);
639
- };
640
- WindowsPtyAgent2.prototype.clear = function() {
641
- if (this._useConpty) {
642
- this._ptyNative.clear(this._pty, this._useConptyDll);
643
- }
644
- };
645
- WindowsPtyAgent2.prototype.kill = function() {
646
- var _this = this;
647
- if (this._useConpty) {
648
- if (!this._useConptyDll) {
649
- this._inSocket.readable = false;
650
- this._outSocket.readable = false;
651
- this._getConsoleProcessList().then(function(consoleProcessList) {
652
- consoleProcessList.forEach(function(pid) {
653
- try {
654
- process.kill(pid);
655
- } catch (e) {
656
- }
657
- });
658
- });
659
- this._ptyNative.kill(this._pty, this._useConptyDll);
660
- this._conoutSocketWorker.dispose();
661
- } else {
662
- this._inSocket.destroy();
663
- this._ptyNative.kill(this._pty, this._useConptyDll);
664
- this._outSocket.on("data", function() {
665
- _this._conoutSocketWorker.dispose();
666
- });
667
- }
668
- } else {
669
- var processList = this._ptyNative.getProcessList(this._pid);
670
- this._ptyNative.kill(this._pid, this._innerPid);
671
- processList.forEach(function(pid) {
672
- try {
673
- process.kill(pid);
674
- } catch (e) {
675
- }
676
- });
677
- }
678
- };
679
- WindowsPtyAgent2.prototype._getConsoleProcessList = function() {
680
- var _this = this;
681
- return new Promise(function(resolve2) {
682
- var agent = child_process_1.fork(path23.join(__dirname, "conpty_console_list_agent"), [_this._innerPid.toString()]);
683
- agent.on("message", function(message) {
684
- clearTimeout(timeout);
685
- resolve2(message.consoleProcessList);
686
- });
687
- var timeout = setTimeout(function() {
688
- agent.kill();
689
- resolve2([_this._innerPid]);
690
- }, 5e3);
691
- });
692
- };
693
- Object.defineProperty(WindowsPtyAgent2.prototype, "exitCode", {
694
- get: function() {
695
- if (this._useConpty) {
696
- return this._exitCode;
697
- }
698
- var winptyExitCode = this._ptyNative.getExitCode(this._innerPid);
699
- return winptyExitCode === -1 ? void 0 : winptyExitCode;
700
- },
701
- enumerable: false,
702
- configurable: true
703
- });
704
- WindowsPtyAgent2.prototype._getWindowsBuildNumber = function() {
705
- var osVersion = /(\d+)\.(\d+)\.(\d+)/g.exec(os16.release());
706
- var buildNumber = 0;
707
- if (osVersion && osVersion.length === 4) {
708
- buildNumber = parseInt(osVersion[3]);
709
- }
710
- return buildNumber;
711
- };
712
- WindowsPtyAgent2.prototype._generatePipeName = function() {
713
- return "conpty-" + Math.random() * 1e7;
714
- };
715
- WindowsPtyAgent2.prototype._$onProcessExit = function(exitCode) {
716
- var _this = this;
717
- this._exitCode = exitCode;
718
- if (!this._useConptyDll) {
719
- this._flushDataAndCleanUp();
720
- this._outSocket.on("data", function() {
721
- return _this._flushDataAndCleanUp();
722
- });
723
- }
724
- };
725
- WindowsPtyAgent2.prototype._flushDataAndCleanUp = function() {
726
- var _this = this;
727
- if (this._useConptyDll) {
728
- return;
729
- }
730
- if (this._closeTimeout) {
731
- clearTimeout(this._closeTimeout);
732
- }
733
- this._closeTimeout = setTimeout(function() {
734
- return _this._cleanUpProcess();
735
- }, FLUSH_DATA_INTERVAL);
736
- };
737
- WindowsPtyAgent2.prototype._cleanUpProcess = function() {
738
- if (this._useConptyDll) {
739
- return;
740
- }
741
- this._inSocket.readable = false;
742
- this._outSocket.readable = false;
743
- this._outSocket.destroy();
744
- };
745
- return WindowsPtyAgent2;
746
- })()
747
- );
748
- exports2.WindowsPtyAgent = WindowsPtyAgent;
749
- function argsToCommandLine(file, args2) {
750
- if (isCommandLine(args2)) {
751
- if (args2.length === 0) {
752
- return file;
753
- }
754
- return argsToCommandLine(file, []) + " " + args2;
755
- }
756
- var argv = [file];
757
- Array.prototype.push.apply(argv, args2);
758
- var result = "";
759
- for (var argIndex = 0; argIndex < argv.length; argIndex++) {
760
- if (argIndex > 0) {
761
- result += " ";
762
- }
763
- var arg = argv[argIndex];
764
- var hasLopsidedEnclosingQuote = xOr(arg[0] !== '"', arg[arg.length - 1] !== '"');
765
- var hasNoEnclosingQuotes = arg[0] !== '"' && arg[arg.length - 1] !== '"';
766
- var quote = arg === "" || (arg.indexOf(" ") !== -1 || arg.indexOf(" ") !== -1) && (arg.length > 1 && (hasLopsidedEnclosingQuote || hasNoEnclosingQuotes));
767
- if (quote) {
768
- result += '"';
769
- }
770
- var bsCount = 0;
771
- for (var i = 0; i < arg.length; i++) {
772
- var p2 = arg[i];
773
- if (p2 === "\\") {
774
- bsCount++;
775
- } else if (p2 === '"') {
776
- result += repeatText("\\", bsCount * 2 + 1);
777
- result += '"';
778
- bsCount = 0;
779
- } else {
780
- result += repeatText("\\", bsCount);
781
- bsCount = 0;
782
- result += p2;
783
- }
784
- }
785
- if (quote) {
786
- result += repeatText("\\", bsCount * 2);
787
- result += '"';
788
- } else {
789
- result += repeatText("\\", bsCount);
790
- }
791
- }
792
- return result;
793
- }
794
- exports2.argsToCommandLine = argsToCommandLine;
795
- function isCommandLine(args2) {
796
- return typeof args2 === "string";
797
- }
798
- function repeatText(text, count) {
799
- var result = "";
800
- for (var i = 0; i < count; i++) {
801
- result += text;
802
- }
803
- return result;
804
- }
805
- function xOr(arg1, arg2) {
806
- return arg1 && !arg2 || !arg1 && arg2;
807
- }
808
- }
809
- });
810
-
811
- // ../../node_modules/node-pty/lib/windowsTerminal.js
812
- var require_windowsTerminal = __commonJS({
813
- "../../node_modules/node-pty/lib/windowsTerminal.js"(exports2) {
814
- "use strict";
815
- var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
816
- var extendStatics = function(d3, b) {
817
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b2) {
818
- d4.__proto__ = b2;
819
- } || function(d4, b2) {
820
- for (var p2 in b2) if (b2.hasOwnProperty(p2)) d4[p2] = b2[p2];
821
- };
822
- return extendStatics(d3, b);
823
- };
824
- return function(d3, b) {
825
- extendStatics(d3, b);
826
- function __() {
827
- this.constructor = d3;
828
- }
829
- d3.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
830
- };
831
- })();
832
- Object.defineProperty(exports2, "__esModule", { value: true });
833
- exports2.WindowsTerminal = void 0;
834
- var terminal_1 = require_terminal();
835
- var windowsPtyAgent_1 = require_windowsPtyAgent();
836
- var utils_1 = require_utils();
837
- var DEFAULT_FILE = "cmd.exe";
838
- var DEFAULT_NAME = "Windows Shell";
839
- var WindowsTerminal = (
840
- /** @class */
841
- (function(_super) {
842
- __extends(WindowsTerminal2, _super);
843
- function WindowsTerminal2(file, args2, opt) {
844
- var _this = _super.call(this, opt) || this;
845
- _this._checkType("args", args2, "string", true);
846
- args2 = args2 || [];
847
- file = file || DEFAULT_FILE;
848
- opt = opt || {};
849
- opt.env = opt.env || process.env;
850
- if (opt.encoding) {
851
- console.warn("Setting encoding on Windows is not supported");
852
- }
853
- var env = utils_1.assign({}, opt.env);
854
- _this._cols = opt.cols || terminal_1.DEFAULT_COLS;
855
- _this._rows = opt.rows || terminal_1.DEFAULT_ROWS;
856
- var cwd = opt.cwd || process.cwd();
857
- var name = opt.name || env.TERM || DEFAULT_NAME;
858
- var parsedEnv = _this._parseEnv(env);
859
- _this._isReady = false;
860
- _this._deferreds = [];
861
- _this._agent = new windowsPtyAgent_1.WindowsPtyAgent(file, args2, parsedEnv, cwd, _this._cols, _this._rows, false, opt.useConpty, opt.useConptyDll, opt.conptyInheritCursor);
862
- _this._socket = _this._agent.outSocket;
863
- _this._pid = _this._agent.innerPid;
864
- _this._fd = _this._agent.fd;
865
- _this._pty = _this._agent.pty;
866
- _this._socket.on("ready_datapipe", function() {
867
- _this._socket.once("data", function() {
868
- if (!_this._isReady) {
869
- _this._isReady = true;
870
- _this._deferreds.forEach(function(fn) {
871
- fn.run();
872
- });
873
- _this._deferreds = [];
874
- }
875
- });
876
- _this._socket.on("error", function(err) {
877
- _this._close();
878
- if (err.code) {
879
- if (~err.code.indexOf("errno 5") || ~err.code.indexOf("EIO"))
880
- return;
881
- }
882
- if (_this.listeners("error").length < 2) {
883
- throw err;
884
- }
885
- });
886
- _this._socket.on("close", function() {
887
- _this.emit("exit", _this._agent.exitCode);
888
- _this._close();
889
- });
890
- });
891
- _this._file = file;
892
- _this._name = name;
893
- _this._readable = true;
894
- _this._writable = true;
895
- _this._forwardEvents();
896
- return _this;
897
- }
898
- WindowsTerminal2.prototype._write = function(data) {
899
- this._defer(this._doWrite, data);
900
- };
901
- WindowsTerminal2.prototype._doWrite = function(data) {
902
- this._agent.inSocket.write(data);
903
- };
904
- WindowsTerminal2.open = function(options) {
905
- throw new Error("open() not supported on windows, use Fork() instead.");
906
- };
907
- WindowsTerminal2.prototype.resize = function(cols, rows) {
908
- var _this = this;
909
- if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
910
- throw new Error("resizing must be done using positive cols and rows");
911
- }
912
- this._deferNoArgs(function() {
913
- _this._agent.resize(cols, rows);
914
- _this._cols = cols;
915
- _this._rows = rows;
916
- });
917
- };
918
- WindowsTerminal2.prototype.clear = function() {
919
- var _this = this;
920
- this._deferNoArgs(function() {
921
- _this._agent.clear();
922
- });
923
- };
924
- WindowsTerminal2.prototype.destroy = function() {
925
- var _this = this;
926
- this._deferNoArgs(function() {
927
- _this.kill();
928
- });
929
- };
930
- WindowsTerminal2.prototype.kill = function(signal) {
931
- var _this = this;
932
- this._deferNoArgs(function() {
933
- if (signal) {
934
- throw new Error("Signals not supported on windows.");
935
- }
936
- _this._close();
937
- _this._agent.kill();
938
- });
939
- };
940
- WindowsTerminal2.prototype._deferNoArgs = function(deferredFn) {
941
- var _this = this;
942
- if (this._isReady) {
943
- deferredFn.call(this);
944
- return;
945
- }
946
- this._deferreds.push({
947
- run: function() {
948
- return deferredFn.call(_this);
949
- }
950
- });
951
- };
952
- WindowsTerminal2.prototype._defer = function(deferredFn, arg) {
953
- var _this = this;
954
- if (this._isReady) {
955
- deferredFn.call(this, arg);
956
- return;
957
- }
958
- this._deferreds.push({
959
- run: function() {
960
- return deferredFn.call(_this, arg);
961
- }
962
- });
963
- };
964
- Object.defineProperty(WindowsTerminal2.prototype, "process", {
965
- get: function() {
966
- return this._name;
967
- },
968
- enumerable: false,
969
- configurable: true
970
- });
971
- Object.defineProperty(WindowsTerminal2.prototype, "master", {
972
- get: function() {
973
- throw new Error("master is not supported on Windows");
974
- },
975
- enumerable: false,
976
- configurable: true
977
- });
978
- Object.defineProperty(WindowsTerminal2.prototype, "slave", {
979
- get: function() {
980
- throw new Error("slave is not supported on Windows");
981
- },
982
- enumerable: false,
983
- configurable: true
984
- });
985
- return WindowsTerminal2;
986
- })(terminal_1.Terminal)
987
- );
988
- exports2.WindowsTerminal = WindowsTerminal;
989
- }
990
- });
991
-
992
- // ../../node_modules/node-pty/lib/unixTerminal.js
993
- var require_unixTerminal = __commonJS({
994
- "../../node_modules/node-pty/lib/unixTerminal.js"(exports2) {
995
- "use strict";
996
- var __extends = exports2 && exports2.__extends || /* @__PURE__ */ (function() {
997
- var extendStatics = function(d3, b) {
998
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b2) {
999
- d4.__proto__ = b2;
1000
- } || function(d4, b2) {
1001
- for (var p2 in b2) if (b2.hasOwnProperty(p2)) d4[p2] = b2[p2];
1002
- };
1003
- return extendStatics(d3, b);
1004
- };
1005
- return function(d3, b) {
1006
- extendStatics(d3, b);
1007
- function __() {
1008
- this.constructor = d3;
1009
- }
1010
- d3.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1011
- };
1012
- })();
1013
- Object.defineProperty(exports2, "__esModule", { value: true });
1014
- exports2.UnixTerminal = void 0;
1015
- var fs17 = require("fs");
1016
- var path23 = require("path");
1017
- var tty = require("tty");
1018
- var terminal_1 = require_terminal();
1019
- var utils_1 = require_utils();
1020
- var native = utils_1.loadNativeModule("pty");
1021
- var pty2 = native.module;
1022
- var helperPath = native.dir + "/spawn-helper";
1023
- helperPath = path23.resolve(__dirname, helperPath);
1024
- helperPath = helperPath.replace("app.asar", "app.asar.unpacked");
1025
- helperPath = helperPath.replace("node_modules.asar", "node_modules.asar.unpacked");
1026
- var DEFAULT_FILE = "sh";
1027
- var DEFAULT_NAME = "xterm";
1028
- var DESTROY_SOCKET_TIMEOUT_MS = 200;
1029
- var UnixTerminal = (
1030
- /** @class */
1031
- (function(_super) {
1032
- __extends(UnixTerminal2, _super);
1033
- function UnixTerminal2(file, args2, opt) {
1034
- var _a, _b;
1035
- var _this = _super.call(this, opt) || this;
1036
- _this._boundClose = false;
1037
- _this._emittedClose = false;
1038
- if (typeof args2 === "string") {
1039
- throw new Error("args as a string is not supported on unix.");
1040
- }
1041
- args2 = args2 || [];
1042
- file = file || DEFAULT_FILE;
1043
- opt = opt || {};
1044
- opt.env = opt.env || process.env;
1045
- _this._cols = opt.cols || terminal_1.DEFAULT_COLS;
1046
- _this._rows = opt.rows || terminal_1.DEFAULT_ROWS;
1047
- var uid = (_a = opt.uid) !== null && _a !== void 0 ? _a : -1;
1048
- var gid = (_b = opt.gid) !== null && _b !== void 0 ? _b : -1;
1049
- var env = utils_1.assign({}, opt.env);
1050
- if (opt.env === process.env) {
1051
- _this._sanitizeEnv(env);
1052
- }
1053
- var cwd = opt.cwd || process.cwd();
1054
- env.PWD = cwd;
1055
- var name = opt.name || env.TERM || DEFAULT_NAME;
1056
- env.TERM = name;
1057
- var parsedEnv = _this._parseEnv(env);
1058
- var encoding = opt.encoding === void 0 ? "utf8" : opt.encoding;
1059
- var onexit = function(code, signal) {
1060
- if (!_this._emittedClose) {
1061
- if (_this._boundClose) {
1062
- return;
1063
- }
1064
- _this._boundClose = true;
1065
- var timeout_1 = setTimeout(function() {
1066
- timeout_1 = null;
1067
- _this._socket.destroy();
1068
- }, DESTROY_SOCKET_TIMEOUT_MS);
1069
- _this.once("close", function() {
1070
- if (timeout_1 !== null) {
1071
- clearTimeout(timeout_1);
1072
- }
1073
- _this.emit("exit", code, signal);
1074
- });
1075
- return;
1076
- }
1077
- _this.emit("exit", code, signal);
1078
- };
1079
- var term = pty2.fork(file, args2, parsedEnv, cwd, _this._cols, _this._rows, uid, gid, encoding === "utf8", helperPath, onexit);
1080
- _this._socket = new tty.ReadStream(term.fd);
1081
- if (encoding !== null) {
1082
- _this._socket.setEncoding(encoding);
1083
- }
1084
- _this._writeStream = new CustomWriteStream(term.fd, encoding || void 0);
1085
- _this._socket.on("error", function(err) {
1086
- if (err.code) {
1087
- if (~err.code.indexOf("EAGAIN")) {
1088
- return;
1089
- }
1090
- }
1091
- _this._close();
1092
- if (!_this._emittedClose) {
1093
- _this._emittedClose = true;
1094
- _this.emit("close");
1095
- }
1096
- if (err.code) {
1097
- if (~err.code.indexOf("errno 5") || ~err.code.indexOf("EIO")) {
1098
- return;
1099
- }
1100
- }
1101
- if (_this.listeners("error").length < 2) {
1102
- throw err;
1103
- }
1104
- });
1105
- _this._pid = term.pid;
1106
- _this._fd = term.fd;
1107
- _this._pty = term.pty;
1108
- _this._file = file;
1109
- _this._name = name;
1110
- _this._readable = true;
1111
- _this._writable = true;
1112
- _this._socket.on("close", function() {
1113
- if (_this._emittedClose) {
1114
- return;
1115
- }
1116
- _this._emittedClose = true;
1117
- _this._close();
1118
- _this.emit("close");
1119
- });
1120
- _this._forwardEvents();
1121
- return _this;
1122
- }
1123
- Object.defineProperty(UnixTerminal2.prototype, "master", {
1124
- get: function() {
1125
- return this._master;
1126
- },
1127
- enumerable: false,
1128
- configurable: true
1129
- });
1130
- Object.defineProperty(UnixTerminal2.prototype, "slave", {
1131
- get: function() {
1132
- return this._slave;
1133
- },
1134
- enumerable: false,
1135
- configurable: true
1136
- });
1137
- UnixTerminal2.prototype._write = function(data) {
1138
- this._writeStream.write(data);
1139
- };
1140
- Object.defineProperty(UnixTerminal2.prototype, "fd", {
1141
- /* Accessors */
1142
- get: function() {
1143
- return this._fd;
1144
- },
1145
- enumerable: false,
1146
- configurable: true
1147
- });
1148
- Object.defineProperty(UnixTerminal2.prototype, "ptsName", {
1149
- get: function() {
1150
- return this._pty;
1151
- },
1152
- enumerable: false,
1153
- configurable: true
1154
- });
1155
- UnixTerminal2.open = function(opt) {
1156
- var self = Object.create(UnixTerminal2.prototype);
1157
- opt = opt || {};
1158
- if (arguments.length > 1) {
1159
- opt = {
1160
- cols: arguments[1],
1161
- rows: arguments[2]
1162
- };
1163
- }
1164
- var cols = opt.cols || terminal_1.DEFAULT_COLS;
1165
- var rows = opt.rows || terminal_1.DEFAULT_ROWS;
1166
- var encoding = opt.encoding === void 0 ? "utf8" : opt.encoding;
1167
- var term = pty2.open(cols, rows);
1168
- self._master = new tty.ReadStream(term.master);
1169
- if (encoding !== null) {
1170
- self._master.setEncoding(encoding);
1171
- }
1172
- self._master.resume();
1173
- self._slave = new tty.ReadStream(term.slave);
1174
- if (encoding !== null) {
1175
- self._slave.setEncoding(encoding);
1176
- }
1177
- self._slave.resume();
1178
- self._socket = self._master;
1179
- self._pid = -1;
1180
- self._fd = term.master;
1181
- self._pty = term.pty;
1182
- self._file = process.argv[0] || "node";
1183
- self._name = process.env.TERM || "";
1184
- self._readable = true;
1185
- self._writable = true;
1186
- self._socket.on("error", function(err) {
1187
- self._close();
1188
- if (self.listeners("error").length < 2) {
1189
- throw err;
1190
- }
1191
- });
1192
- self._socket.on("close", function() {
1193
- self._close();
1194
- });
1195
- return self;
1196
- };
1197
- UnixTerminal2.prototype.destroy = function() {
1198
- var _this = this;
1199
- this._close();
1200
- this._socket.once("close", function() {
1201
- _this.kill("SIGHUP");
1202
- });
1203
- this._socket.destroy();
1204
- this._writeStream.dispose();
1205
- };
1206
- UnixTerminal2.prototype.kill = function(signal) {
1207
- try {
1208
- process.kill(this.pid, signal || "SIGHUP");
1209
- } catch (e) {
1210
- }
1211
- };
1212
- Object.defineProperty(UnixTerminal2.prototype, "process", {
1213
- /**
1214
- * Gets the name of the process.
1215
- */
1216
- get: function() {
1217
- if (process.platform === "darwin") {
1218
- var title = pty2.process(this._fd);
1219
- return title !== "kernel_task" ? title : this._file;
1220
- }
1221
- return pty2.process(this._fd, this._pty) || this._file;
1222
- },
1223
- enumerable: false,
1224
- configurable: true
1225
- });
1226
- UnixTerminal2.prototype.resize = function(cols, rows) {
1227
- if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
1228
- throw new Error("resizing must be done using positive cols and rows");
1229
- }
1230
- pty2.resize(this._fd, cols, rows);
1231
- this._cols = cols;
1232
- this._rows = rows;
1233
- };
1234
- UnixTerminal2.prototype.clear = function() {
1235
- };
1236
- UnixTerminal2.prototype._sanitizeEnv = function(env) {
1237
- delete env["TMUX"];
1238
- delete env["TMUX_PANE"];
1239
- delete env["STY"];
1240
- delete env["WINDOW"];
1241
- delete env["WINDOWID"];
1242
- delete env["TERMCAP"];
1243
- delete env["COLUMNS"];
1244
- delete env["LINES"];
1245
- };
1246
- return UnixTerminal2;
1247
- })(terminal_1.Terminal)
1248
- );
1249
- exports2.UnixTerminal = UnixTerminal;
1250
- var CustomWriteStream = (
1251
- /** @class */
1252
- (function() {
1253
- function CustomWriteStream2(_fd, _encoding) {
1254
- this._fd = _fd;
1255
- this._encoding = _encoding;
1256
- this._writeQueue = [];
1257
- }
1258
- CustomWriteStream2.prototype.dispose = function() {
1259
- clearImmediate(this._writeImmediate);
1260
- this._writeImmediate = void 0;
1261
- };
1262
- CustomWriteStream2.prototype.write = function(data) {
1263
- var buffer = typeof data === "string" ? Buffer.from(data, this._encoding) : Buffer.from(data);
1264
- if (buffer.byteLength !== 0) {
1265
- this._writeQueue.push({ buffer, offset: 0 });
1266
- if (this._writeQueue.length === 1) {
1267
- this._processWriteQueue();
1268
- }
1269
- }
1270
- };
1271
- CustomWriteStream2.prototype._processWriteQueue = function() {
1272
- var _this = this;
1273
- this._writeImmediate = void 0;
1274
- if (this._writeQueue.length === 0) {
1275
- return;
1276
- }
1277
- var task = this._writeQueue[0];
1278
- fs17.write(this._fd, task.buffer, task.offset, function(err, written) {
1279
- if (err) {
1280
- if ("code" in err && err.code === "EAGAIN") {
1281
- _this._writeImmediate = setImmediate(function() {
1282
- return _this._processWriteQueue();
1283
- });
1284
- } else {
1285
- _this._writeQueue.length = 0;
1286
- console.error("Unhandled pty write error", err);
1287
- }
1288
- return;
1289
- }
1290
- task.offset += written;
1291
- if (task.offset >= task.buffer.byteLength) {
1292
- _this._writeQueue.shift();
1293
- }
1294
- _this._processWriteQueue();
1295
- });
1296
- };
1297
- return CustomWriteStream2;
1298
- })()
1299
- );
1300
- }
1301
- });
1302
-
1303
- // ../../node_modules/node-pty/lib/index.js
1304
- var require_lib = __commonJS({
1305
- "../../node_modules/node-pty/lib/index.js"(exports2) {
1306
- "use strict";
1307
- Object.defineProperty(exports2, "__esModule", { value: true });
1308
- exports2.native = exports2.open = exports2.createTerminal = exports2.fork = exports2.spawn = void 0;
1309
- var utils_1 = require_utils();
1310
- var terminalCtor;
1311
- if (process.platform === "win32") {
1312
- terminalCtor = require_windowsTerminal().WindowsTerminal;
1313
- } else {
1314
- terminalCtor = require_unixTerminal().UnixTerminal;
1315
- }
1316
- function spawn12(file, args2, opt) {
1317
- return new terminalCtor(file, args2, opt);
1318
- }
1319
- exports2.spawn = spawn12;
1320
- function fork(file, args2, opt) {
1321
- return new terminalCtor(file, args2, opt);
1322
- }
1323
- exports2.fork = fork;
1324
- function createTerminal(file, args2, opt) {
1325
- return new terminalCtor(file, args2, opt);
1326
- }
1327
- exports2.createTerminal = createTerminal;
1328
- function open(options) {
1329
- return terminalCtor.open(options);
1330
- }
1331
- exports2.open = open;
1332
- exports2.native = process.platform !== "win32" ? utils_1.loadNativeModule("pty").module : null;
1333
- }
1334
- });
1335
-
1336
33
  // ../../node_modules/sisteransi/src/index.js
1337
34
  var require_src = __commonJS({
1338
35
  "../../node_modules/sisteransi/src/index.js"(exports2, module2) {
@@ -1689,7 +386,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
1689
386
  // package.json
1690
387
  var package_default = {
1691
388
  name: "codeam-cli",
1692
- version: "2.14.0",
389
+ version: "2.15.1",
1693
390
  description: "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands \u2014 from anywhere.",
1694
391
  type: "commonjs",
1695
392
  main: "dist/index.js",
@@ -2596,7 +1293,7 @@ function loadNodePty() {
2596
1293
  return require(vendoredPath);
2597
1294
  } catch (vendorErr) {
2598
1295
  try {
2599
- return require_lib();
1296
+ return require("node-pty");
2600
1297
  } catch {
2601
1298
  void vendorErr;
2602
1299
  return null;
@@ -7488,7 +6185,7 @@ function buildKeepAlive(ctx) {
7488
6185
  // src/commands/start/handlers.ts
7489
6186
  var fs14 = __toESM(require("fs"));
7490
6187
  var os13 = __toESM(require("os"));
7491
- var path17 = __toESM(require("path"));
6188
+ var path18 = __toESM(require("path"));
7492
6189
  var import_crypto2 = require("crypto");
7493
6190
  var import_child_process8 = require("child_process");
7494
6191
 
@@ -8039,8 +6736,25 @@ async function jsSearchFiles(opts, cwd, cap) {
8039
6736
 
8040
6737
  // src/services/terminal-ops.service.ts
8041
6738
  var import_crypto = require("crypto");
8042
- var pty = __toESM(require_lib());
6739
+ var import_path = __toESM(require("path"));
8043
6740
  var MAX_CONCURRENT_SESSIONS = 4;
6741
+ var nodePtyModule;
6742
+ function loadNodePty2() {
6743
+ if (nodePtyModule !== void 0) return nodePtyModule;
6744
+ const vendoredPath = import_path.default.join(__dirname, "vendor", "node-pty");
6745
+ try {
6746
+ nodePtyModule = require(vendoredPath);
6747
+ return nodePtyModule;
6748
+ } catch {
6749
+ try {
6750
+ nodePtyModule = require("node-pty");
6751
+ return nodePtyModule;
6752
+ } catch {
6753
+ nodePtyModule = null;
6754
+ return nodePtyModule;
6755
+ }
6756
+ }
6757
+ }
8044
6758
  var sessions = /* @__PURE__ */ new Map();
8045
6759
  var onDataHandler = null;
8046
6760
  var onExitHandler = null;
@@ -8066,8 +6780,14 @@ function openTerminal(opts) {
8066
6780
  COLORTERM: "truecolor"
8067
6781
  };
8068
6782
  env.FORCE_COLOR = "1";
6783
+ const ptyMod = loadNodePty2();
6784
+ if (!ptyMod) {
6785
+ return {
6786
+ error: `node-pty native module unavailable on ${process.platform}-${process.arch}; terminal feature disabled for this platform`
6787
+ };
6788
+ }
8069
6789
  try {
8070
- const term = pty.spawn(shell, [], {
6790
+ const term = ptyMod.spawn(shell, [], {
8071
6791
  name: "xterm-256color",
8072
6792
  cols: Math.max(1, Math.min(opts.cols ?? 80, 500)),
8073
6793
  rows: Math.max(1, Math.min(opts.rows ?? 24, 200)),
@@ -8129,7 +6849,7 @@ function closeTerminal(sessionId) {
8129
6849
  function saveFilesTemp(files) {
8130
6850
  return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
8131
6851
  const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
8132
- const tmpPath = path17.join(os13.tmpdir(), `codeam-${(0, import_crypto2.randomUUID)()}-${safeName}`);
6852
+ const tmpPath = path18.join(os13.tmpdir(), `codeam-${(0, import_crypto2.randomUUID)()}-${safeName}`);
8133
6853
  fs14.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
8134
6854
  return tmpPath;
8135
6855
  });
@@ -8701,12 +7421,12 @@ function readTokenFromArgs(args2) {
8701
7421
  }
8702
7422
  const fileFlag = args2.find((a) => a.startsWith("--token-file="));
8703
7423
  if (fileFlag) {
8704
- const path23 = fileFlag.slice("--token-file=".length);
7424
+ const path24 = fileFlag.slice("--token-file=".length);
8705
7425
  try {
8706
- const content = fs15.readFileSync(path23, "utf8").trim();
8707
- if (content.length === 0) fail(`--token-file ${path23} is empty`);
7426
+ const content = fs15.readFileSync(path24, "utf8").trim();
7427
+ if (content.length === 0) fail(`--token-file ${path24} is empty`);
8708
7428
  try {
8709
- fs15.unlinkSync(path23);
7429
+ fs15.unlinkSync(path24);
8710
7430
  } catch {
8711
7431
  }
8712
7432
  return content;
@@ -8876,7 +7596,7 @@ var import_picocolors9 = __toESM(require("picocolors"));
8876
7596
  var import_child_process9 = require("child_process");
8877
7597
  var import_util3 = require("util");
8878
7598
  var import_picocolors7 = __toESM(require("picocolors"));
8879
- var path18 = __toESM(require("path"));
7599
+ var path19 = __toESM(require("path"));
8880
7600
  var execFileP3 = (0, import_util3.promisify)(import_child_process9.execFile);
8881
7601
  var MAX_BUFFER = 8 * 1024 * 1024;
8882
7602
  function resetStdinForChild() {
@@ -9365,7 +8085,7 @@ var GitHubCodespacesProvider = class {
9365
8085
  });
9366
8086
  }
9367
8087
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
9368
- const remoteDir = path18.posix.dirname(remotePath);
8088
+ const remoteDir = path19.posix.dirname(remotePath);
9369
8089
  const parts = [
9370
8090
  `mkdir -p ${shellQuote(remoteDir)}`,
9371
8091
  `cat > ${shellQuote(remotePath)}`
@@ -9435,7 +8155,7 @@ function shellQuote(s) {
9435
8155
  // src/services/providers/gitpod.ts
9436
8156
  var import_child_process10 = require("child_process");
9437
8157
  var import_util4 = require("util");
9438
- var path19 = __toESM(require("path"));
8158
+ var path20 = __toESM(require("path"));
9439
8159
  var import_picocolors8 = __toESM(require("picocolors"));
9440
8160
  var execFileP4 = (0, import_util4.promisify)(import_child_process10.execFile);
9441
8161
  var MAX_BUFFER2 = 8 * 1024 * 1024;
@@ -9675,7 +8395,7 @@ var GitpodProvider = class {
9675
8395
  });
9676
8396
  }
9677
8397
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
9678
- const remoteDir = path19.posix.dirname(remotePath);
8398
+ const remoteDir = path20.posix.dirname(remotePath);
9679
8399
  const parts = [
9680
8400
  `mkdir -p ${shellQuote2(remoteDir)}`,
9681
8401
  `cat > ${shellQuote2(remotePath)}`
@@ -9711,7 +8431,7 @@ function shellQuote2(s) {
9711
8431
  // src/services/providers/gitlab-workspaces.ts
9712
8432
  var import_child_process11 = require("child_process");
9713
8433
  var import_util5 = require("util");
9714
- var path20 = __toESM(require("path"));
8434
+ var path21 = __toESM(require("path"));
9715
8435
  var execFileP5 = (0, import_util5.promisify)(import_child_process11.execFile);
9716
8436
  var MAX_BUFFER3 = 8 * 1024 * 1024;
9717
8437
  var GITLAB_API_BASE = process.env.CODEAM_GITLAB_API_URL ?? "https://gitlab.com/api/v4";
@@ -9971,7 +8691,7 @@ Docs: https://docs.gitlab.com/ee/user/workspace/configuration.html`
9971
8691
  }
9972
8692
  async uploadFile(workspaceId, remotePath, contents, options = {}) {
9973
8693
  const sshHost = process.env.CODEAM_GITLAB_SSH_HOST ?? "workspaces.gitlab.com";
9974
- const remoteDir = path20.posix.dirname(remotePath);
8694
+ const remoteDir = path21.posix.dirname(remotePath);
9975
8695
  const parts = [`mkdir -p ${shellQuote3(remoteDir)}`, `cat > ${shellQuote3(remotePath)}`];
9976
8696
  if (options.mode != null) {
9977
8697
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote3(remotePath)}`);
@@ -10039,7 +8759,7 @@ function shellQuote3(s) {
10039
8759
  // src/services/providers/railway.ts
10040
8760
  var import_child_process12 = require("child_process");
10041
8761
  var import_util6 = require("util");
10042
- var path21 = __toESM(require("path"));
8762
+ var path22 = __toESM(require("path"));
10043
8763
  var execFileP6 = (0, import_util6.promisify)(import_child_process12.execFile);
10044
8764
  var MAX_BUFFER4 = 8 * 1024 * 1024;
10045
8765
  function resetStdinForChild4() {
@@ -10275,7 +8995,7 @@ var RailwayProvider = class {
10275
8995
  if (!projectId || !serviceId) {
10276
8996
  throw new Error("Invalid Railway workspace id (expected projectId/serviceId).");
10277
8997
  }
10278
- const remoteDir = path21.posix.dirname(remotePath);
8998
+ const remoteDir = path22.posix.dirname(remotePath);
10279
8999
  const parts = [`mkdir -p ${shellQuote4(remoteDir)}`, `cat > ${shellQuote4(remotePath)}`];
10280
9000
  if (options.mode != null) {
10281
9001
  parts.push(`chmod ${options.mode.toString(8)} ${shellQuote4(remotePath)}`);
@@ -10817,7 +9537,7 @@ async function stopWorkspaceFromLocal(target) {
10817
9537
  // src/commands/version.ts
10818
9538
  var import_picocolors11 = __toESM(require("picocolors"));
10819
9539
  function version() {
10820
- const v = true ? "2.14.0" : "unknown";
9540
+ const v = true ? "2.15.1" : "unknown";
10821
9541
  console.log(`${import_picocolors11.default.bold("codeam-cli")} ${import_picocolors11.default.cyan(v)}`);
10822
9542
  }
10823
9543
 
@@ -10860,7 +9580,7 @@ function help() {
10860
9580
  // src/lib/updateNotifier.ts
10861
9581
  var fs16 = __toESM(require("fs"));
10862
9582
  var os15 = __toESM(require("os"));
10863
- var path22 = __toESM(require("path"));
9583
+ var path23 = __toESM(require("path"));
10864
9584
  var https5 = __toESM(require("https"));
10865
9585
  var import_picocolors13 = __toESM(require("picocolors"));
10866
9586
  var PKG_NAME = "codeam-cli";
@@ -10868,8 +9588,8 @@ var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
10868
9588
  var TTL_MS = 24 * 60 * 60 * 1e3;
10869
9589
  var REQUEST_TIMEOUT_MS = 1500;
10870
9590
  function cachePath() {
10871
- const dir = path22.join(os15.homedir(), ".codeam");
10872
- return path22.join(dir, "update-check.json");
9591
+ const dir = path23.join(os15.homedir(), ".codeam");
9592
+ return path23.join(dir, "update-check.json");
10873
9593
  }
10874
9594
  function readCache() {
10875
9595
  try {
@@ -10884,7 +9604,7 @@ function readCache() {
10884
9604
  function writeCache(cache) {
10885
9605
  try {
10886
9606
  const file = cachePath();
10887
- fs16.mkdirSync(path22.dirname(file), { recursive: true });
9607
+ fs16.mkdirSync(path23.dirname(file), { recursive: true });
10888
9608
  fs16.writeFileSync(file, JSON.stringify(cache));
10889
9609
  } catch {
10890
9610
  }
@@ -10956,7 +9676,7 @@ function checkForUpdates() {
10956
9676
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
10957
9677
  if (process.env.CI) return;
10958
9678
  if (!process.stdout.isTTY) return;
10959
- const current = true ? "2.14.0" : null;
9679
+ const current = true ? "2.15.1" : null;
10960
9680
  if (!current) return;
10961
9681
  const cache = readCache();
10962
9682
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;