denchclaw 2.1.3 → 2.1.5

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.
Files changed (116) hide show
  1. package/README.md +3 -1
  2. package/apps/web/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  3. package/apps/web/.next/standalone/apps/web/.next/app-build-manifest.json +155 -155
  4. package/apps/web/.next/standalone/apps/web/.next/app-path-routes-manifest.json +26 -26
  5. package/apps/web/.next/standalone/apps/web/.next/build-manifest.json +5 -5
  6. package/apps/web/.next/standalone/apps/web/.next/react-loadable-manifest.json +8 -0
  7. package/apps/web/.next/standalone/apps/web/.next/required-server-files.json +4 -2
  8. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/active/route_client-reference-manifest.js +1 -1
  10. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route_client-reference-manifest.js +1 -1
  11. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route_client-reference-manifest.js +1 -1
  12. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stream/route_client-reference-manifest.js +1 -1
  13. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/subagents/route_client-reference-manifest.js +1 -1
  14. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/[jobId]/runs/route_client-reference-manifest.js +1 -1
  15. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/route_client-reference-manifest.js +1 -1
  16. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/[sessionId]/route_client-reference-manifest.js +1 -1
  17. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/search-transcript/route_client-reference-manifest.js +1 -1
  18. package/apps/web/.next/standalone/apps/web/.next/server/app/api/feedback/route_client-reference-manifest.js +1 -1
  19. package/apps/web/.next/standalone/apps/web/.next/server/app/api/memories/route_client-reference-manifest.js +1 -1
  20. package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/route_client-reference-manifest.js +1 -1
  21. package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/switch/route_client-reference-manifest.js +1 -1
  22. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/[sessionId]/route_client-reference-manifest.js +1 -1
  23. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  24. package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  25. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/messages/route_client-reference-manifest.js +1 -1
  26. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/route_client-reference-manifest.js +1 -1
  27. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route_client-reference-manifest.js +1 -1
  28. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/assets/[...path]/route_client-reference-manifest.js +1 -1
  29. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse/route_client-reference-manifest.js +1 -1
  30. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse-file/route_client-reference-manifest.js +1 -1
  31. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/context/route_client-reference-manifest.js +1 -1
  32. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/copy/route_client-reference-manifest.js +1 -1
  33. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/introspect/route_client-reference-manifest.js +1 -1
  34. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/query/route_client-reference-manifest.js +1 -1
  35. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route_client-reference-manifest.js +1 -1
  36. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/file/route_client-reference-manifest.js +1 -1
  37. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route_client-reference-manifest.js +1 -1
  38. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/list/route_client-reference-manifest.js +1 -1
  39. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/mkdir/route_client-reference-manifest.js +1 -1
  40. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/move/route_client-reference-manifest.js +1 -1
  41. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/display-field/route_client-reference-manifest.js +1 -1
  42. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/[id]/route_client-reference-manifest.js +1 -1
  43. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/bulk-delete/route_client-reference-manifest.js +1 -1
  44. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/options/route_client-reference-manifest.js +1 -1
  45. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route_client-reference-manifest.js +1 -1
  46. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/enum-rename/route_client-reference-manifest.js +1 -1
  47. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/route_client-reference-manifest.js +1 -1
  48. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/reorder/route_client-reference-manifest.js +1 -1
  49. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/route_client-reference-manifest.js +1 -1
  50. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/views/route_client-reference-manifest.js +1 -1
  51. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/open-file/route_client-reference-manifest.js +1 -1
  52. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/path-info/route_client-reference-manifest.js +1 -1
  53. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/query/route_client-reference-manifest.js +1 -1
  54. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/raw-file/route_client-reference-manifest.js +1 -1
  55. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/rename/route_client-reference-manifest.js +1 -1
  56. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route_client-reference-manifest.js +1 -1
  57. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/search-index/route_client-reference-manifest.js +1 -1
  58. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/suggest-files/route_client-reference-manifest.js +1 -1
  59. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route_client-reference-manifest.js +1 -1
  60. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/thumbnail/route_client-reference-manifest.js +1 -1
  61. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/tree/route_client-reference-manifest.js +1 -1
  62. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route_client-reference-manifest.js +1 -1
  63. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/virtual-file/route_client-reference-manifest.js +1 -1
  64. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/watch/route_client-reference-manifest.js +1 -1
  65. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/write-binary/route_client-reference-manifest.js +1 -1
  66. package/apps/web/.next/standalone/apps/web/.next/server/app/page.js +5 -5
  67. package/apps/web/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  68. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
  69. package/apps/web/.next/standalone/apps/web/.next/server/app-paths-manifest.json +26 -26
  70. package/apps/web/.next/standalone/apps/web/.next/server/chunks/6426.js +4 -4
  71. package/apps/web/.next/standalone/apps/web/.next/server/chunks/8899.js +1 -0
  72. package/apps/web/.next/standalone/apps/web/.next/server/functions-config-manifest.json +18 -18
  73. package/apps/web/.next/standalone/apps/web/.next/server/instrumentation.js +1 -0
  74. package/apps/web/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +1 -1
  75. package/apps/web/.next/standalone/apps/web/.next/server/middleware-react-loadable-manifest.js +1 -1
  76. package/apps/web/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  77. package/apps/web/.next/standalone/apps/web/.next/server/pages-manifest.json +1 -1
  78. package/apps/web/.next/standalone/apps/web/.next/static/chunks/1d2d5650.bf15d84c356fe97b.js +18 -0
  79. package/apps/web/.next/standalone/apps/web/.next/static/chunks/7858.23355da272f8e460.js +1 -0
  80. package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/page-6aedb9b64e7e6f61.js +1 -0
  81. package/apps/web/.next/standalone/apps/web/.next/static/chunks/webpack-945a4e45d52e1e6a.js +1 -0
  82. package/apps/web/.next/standalone/apps/web/.next/static/css/19e44f7dae05fed3.css +1 -0
  83. package/apps/web/.next/standalone/apps/web/.next/static/css/659eccb5db697b76.css +1 -0
  84. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/eventEmitter2.js +47 -0
  85. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/index.js +52 -0
  86. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/shared/conout.js +11 -0
  87. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/terminal.js +190 -0
  88. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/unixTerminal.js +346 -0
  89. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/utils.js +39 -0
  90. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
  91. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/windowsPtyAgent.js +320 -0
  92. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/lib/windowsTerminal.js +199 -0
  93. package/apps/web/.next/standalone/apps/web/node_modules/node-pty/package.json +64 -0
  94. package/apps/web/.next/standalone/apps/web/package.json +3 -0
  95. package/apps/web/.next/standalone/apps/web/server.js +1 -1
  96. package/apps/web/.next/standalone/package.json +1 -1
  97. package/apps/web/.next/static/chunks/1d2d5650.bf15d84c356fe97b.js +18 -0
  98. package/apps/web/.next/static/chunks/7858.23355da272f8e460.js +1 -0
  99. package/apps/web/.next/static/chunks/app/page-6aedb9b64e7e6f61.js +1 -0
  100. package/apps/web/.next/static/chunks/webpack-945a4e45d52e1e6a.js +1 -0
  101. package/apps/web/.next/static/css/19e44f7dae05fed3.css +1 -0
  102. package/apps/web/.next/static/css/659eccb5db697b76.css +1 -0
  103. package/dist/entry.js +1 -1
  104. package/dist/{program-Ctezu4M_.js → program-B44Xn_sp.js} +22 -0
  105. package/dist/{run-main-CoqVjynv.js → run-main-CesqAppu.js} +1 -1
  106. package/package.json +1 -1
  107. package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/page-a050908a5e555ee8.js +0 -1
  108. package/apps/web/.next/standalone/apps/web/.next/static/chunks/webpack-f4003099d25f0299.js +0 -1
  109. package/apps/web/.next/standalone/apps/web/.next/static/css/5f21e02e203472d6.css +0 -1
  110. package/apps/web/.next/static/chunks/app/page-a050908a5e555ee8.js +0 -1
  111. package/apps/web/.next/static/chunks/webpack-f4003099d25f0299.js +0 -1
  112. package/apps/web/.next/static/css/5f21e02e203472d6.css +0 -1
  113. /package/apps/web/.next/standalone/apps/web/.next/static/{f6BQtAfnkaWmLOerLKNPa → U8Gz2tAK8eb1pRoI_V0Zv}/_buildManifest.js +0 -0
  114. /package/apps/web/.next/standalone/apps/web/.next/static/{f6BQtAfnkaWmLOerLKNPa → U8Gz2tAK8eb1pRoI_V0Zv}/_ssgManifest.js +0 -0
  115. /package/apps/web/.next/static/{f6BQtAfnkaWmLOerLKNPa → U8Gz2tAK8eb1pRoI_V0Zv}/_buildManifest.js +0 -0
  116. /package/apps/web/.next/static/{f6BQtAfnkaWmLOerLKNPa → U8Gz2tAK8eb1pRoI_V0Zv}/_ssgManifest.js +0 -0
@@ -0,0 +1,346 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.UnixTerminal = void 0;
17
+ /**
18
+ * Copyright (c) 2012-2015, Christopher Jeffrey (MIT License)
19
+ * Copyright (c) 2016, Daniel Imms (MIT License).
20
+ * Copyright (c) 2018, Microsoft Corporation (MIT License).
21
+ */
22
+ var fs = require("fs");
23
+ var path = require("path");
24
+ var tty = require("tty");
25
+ var terminal_1 = require("./terminal");
26
+ var utils_1 = require("./utils");
27
+ var native = utils_1.loadNativeModule('pty');
28
+ var pty = native.module;
29
+ var helperPath = native.dir + '/spawn-helper';
30
+ helperPath = path.resolve(__dirname, helperPath);
31
+ helperPath = helperPath.replace('app.asar', 'app.asar.unpacked');
32
+ helperPath = helperPath.replace('node_modules.asar', 'node_modules.asar.unpacked');
33
+ var DEFAULT_FILE = 'sh';
34
+ var DEFAULT_NAME = 'xterm';
35
+ var DESTROY_SOCKET_TIMEOUT_MS = 200;
36
+ var UnixTerminal = /** @class */ (function (_super) {
37
+ __extends(UnixTerminal, _super);
38
+ function UnixTerminal(file, args, opt) {
39
+ var _a, _b;
40
+ var _this = _super.call(this, opt) || this;
41
+ _this._boundClose = false;
42
+ _this._emittedClose = false;
43
+ if (typeof args === 'string') {
44
+ throw new Error('args as a string is not supported on unix.');
45
+ }
46
+ // Initialize arguments
47
+ args = args || [];
48
+ file = file || DEFAULT_FILE;
49
+ opt = opt || {};
50
+ opt.env = opt.env || process.env;
51
+ _this._cols = opt.cols || terminal_1.DEFAULT_COLS;
52
+ _this._rows = opt.rows || terminal_1.DEFAULT_ROWS;
53
+ var uid = (_a = opt.uid) !== null && _a !== void 0 ? _a : -1;
54
+ var gid = (_b = opt.gid) !== null && _b !== void 0 ? _b : -1;
55
+ var env = utils_1.assign({}, opt.env);
56
+ if (opt.env === process.env) {
57
+ _this._sanitizeEnv(env);
58
+ }
59
+ var cwd = opt.cwd || process.cwd();
60
+ env.PWD = cwd;
61
+ var name = opt.name || env.TERM || DEFAULT_NAME;
62
+ env.TERM = name;
63
+ var parsedEnv = _this._parseEnv(env);
64
+ var encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding);
65
+ var onexit = function (code, signal) {
66
+ // XXX Sometimes a data event is emitted after exit. Wait til socket is
67
+ // destroyed.
68
+ if (!_this._emittedClose) {
69
+ if (_this._boundClose) {
70
+ return;
71
+ }
72
+ _this._boundClose = true;
73
+ // From macOS High Sierra 10.13.2 sometimes the socket never gets
74
+ // closed. A timeout is applied here to avoid the terminal never being
75
+ // destroyed when this occurs.
76
+ var timeout_1 = setTimeout(function () {
77
+ timeout_1 = null;
78
+ // Destroying the socket now will cause the close event to fire
79
+ _this._socket.destroy();
80
+ }, DESTROY_SOCKET_TIMEOUT_MS);
81
+ _this.once('close', function () {
82
+ if (timeout_1 !== null) {
83
+ clearTimeout(timeout_1);
84
+ }
85
+ _this.emit('exit', code, signal);
86
+ });
87
+ return;
88
+ }
89
+ _this.emit('exit', code, signal);
90
+ };
91
+ // fork
92
+ var term = pty.fork(file, args, parsedEnv, cwd, _this._cols, _this._rows, uid, gid, (encoding === 'utf8'), helperPath, onexit);
93
+ _this._socket = new tty.ReadStream(term.fd);
94
+ if (encoding !== null) {
95
+ _this._socket.setEncoding(encoding);
96
+ }
97
+ _this._writeStream = new CustomWriteStream(term.fd, (encoding || undefined));
98
+ // setup
99
+ _this._socket.on('error', function (err) {
100
+ // NOTE: fs.ReadStream gets EAGAIN twice at first:
101
+ if (err.code) {
102
+ if (~err.code.indexOf('EAGAIN')) {
103
+ return;
104
+ }
105
+ }
106
+ // close
107
+ _this._close();
108
+ // EIO on exit from fs.ReadStream:
109
+ if (!_this._emittedClose) {
110
+ _this._emittedClose = true;
111
+ _this.emit('close');
112
+ }
113
+ // EIO, happens when someone closes our child process: the only process in
114
+ // the terminal.
115
+ // node < 0.6.14: errno 5
116
+ // node >= 0.6.14: read EIO
117
+ if (err.code) {
118
+ if (~err.code.indexOf('errno 5') || ~err.code.indexOf('EIO')) {
119
+ return;
120
+ }
121
+ }
122
+ // throw anything else
123
+ if (_this.listeners('error').length < 2) {
124
+ throw err;
125
+ }
126
+ });
127
+ _this._pid = term.pid;
128
+ _this._fd = term.fd;
129
+ _this._pty = term.pty;
130
+ _this._file = file;
131
+ _this._name = name;
132
+ _this._readable = true;
133
+ _this._writable = true;
134
+ _this._socket.on('close', function () {
135
+ if (_this._emittedClose) {
136
+ return;
137
+ }
138
+ _this._emittedClose = true;
139
+ _this._close();
140
+ _this.emit('close');
141
+ });
142
+ _this._forwardEvents();
143
+ return _this;
144
+ }
145
+ Object.defineProperty(UnixTerminal.prototype, "master", {
146
+ get: function () { return this._master; },
147
+ enumerable: false,
148
+ configurable: true
149
+ });
150
+ Object.defineProperty(UnixTerminal.prototype, "slave", {
151
+ get: function () { return this._slave; },
152
+ enumerable: false,
153
+ configurable: true
154
+ });
155
+ UnixTerminal.prototype._write = function (data) {
156
+ this._writeStream.write(data);
157
+ };
158
+ Object.defineProperty(UnixTerminal.prototype, "fd", {
159
+ /* Accessors */
160
+ get: function () { return this._fd; },
161
+ enumerable: false,
162
+ configurable: true
163
+ });
164
+ Object.defineProperty(UnixTerminal.prototype, "ptsName", {
165
+ get: function () { return this._pty; },
166
+ enumerable: false,
167
+ configurable: true
168
+ });
169
+ /**
170
+ * openpty
171
+ */
172
+ UnixTerminal.open = function (opt) {
173
+ var self = Object.create(UnixTerminal.prototype);
174
+ opt = opt || {};
175
+ if (arguments.length > 1) {
176
+ opt = {
177
+ cols: arguments[1],
178
+ rows: arguments[2]
179
+ };
180
+ }
181
+ var cols = opt.cols || terminal_1.DEFAULT_COLS;
182
+ var rows = opt.rows || terminal_1.DEFAULT_ROWS;
183
+ var encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding);
184
+ // open
185
+ var term = pty.open(cols, rows);
186
+ self._master = new tty.ReadStream(term.master);
187
+ if (encoding !== null) {
188
+ self._master.setEncoding(encoding);
189
+ }
190
+ self._master.resume();
191
+ self._slave = new tty.ReadStream(term.slave);
192
+ if (encoding !== null) {
193
+ self._slave.setEncoding(encoding);
194
+ }
195
+ self._slave.resume();
196
+ self._socket = self._master;
197
+ self._pid = -1;
198
+ self._fd = term.master;
199
+ self._pty = term.pty;
200
+ self._file = process.argv[0] || 'node';
201
+ self._name = process.env.TERM || '';
202
+ self._readable = true;
203
+ self._writable = true;
204
+ self._socket.on('error', function (err) {
205
+ self._close();
206
+ if (self.listeners('error').length < 2) {
207
+ throw err;
208
+ }
209
+ });
210
+ self._socket.on('close', function () {
211
+ self._close();
212
+ });
213
+ return self;
214
+ };
215
+ UnixTerminal.prototype.destroy = function () {
216
+ var _this = this;
217
+ this._close();
218
+ // Need to close the read stream so node stops reading a dead file
219
+ // descriptor. Then we can safely SIGHUP the shell.
220
+ this._socket.once('close', function () {
221
+ _this.kill('SIGHUP');
222
+ });
223
+ this._socket.destroy();
224
+ this._writeStream.dispose();
225
+ };
226
+ UnixTerminal.prototype.kill = function (signal) {
227
+ try {
228
+ process.kill(this.pid, signal || 'SIGHUP');
229
+ }
230
+ catch (e) { /* swallow */ }
231
+ };
232
+ Object.defineProperty(UnixTerminal.prototype, "process", {
233
+ /**
234
+ * Gets the name of the process.
235
+ */
236
+ get: function () {
237
+ if (process.platform === 'darwin') {
238
+ var title = pty.process(this._fd);
239
+ return (title !== 'kernel_task') ? title : this._file;
240
+ }
241
+ return pty.process(this._fd, this._pty) || this._file;
242
+ },
243
+ enumerable: false,
244
+ configurable: true
245
+ });
246
+ /**
247
+ * TTY
248
+ */
249
+ UnixTerminal.prototype.resize = function (cols, rows) {
250
+ if (cols <= 0 || rows <= 0 || isNaN(cols) || isNaN(rows) || cols === Infinity || rows === Infinity) {
251
+ throw new Error('resizing must be done using positive cols and rows');
252
+ }
253
+ pty.resize(this._fd, cols, rows);
254
+ this._cols = cols;
255
+ this._rows = rows;
256
+ };
257
+ UnixTerminal.prototype.clear = function () {
258
+ };
259
+ UnixTerminal.prototype._sanitizeEnv = function (env) {
260
+ // Make sure we didn't start our server from inside tmux.
261
+ delete env['TMUX'];
262
+ delete env['TMUX_PANE'];
263
+ // Make sure we didn't start our server from inside screen.
264
+ // http://web.mit.edu/gnu/doc/html/screen_20.html
265
+ delete env['STY'];
266
+ delete env['WINDOW'];
267
+ // Delete some variables that might confuse our terminal.
268
+ delete env['WINDOWID'];
269
+ delete env['TERMCAP'];
270
+ delete env['COLUMNS'];
271
+ delete env['LINES'];
272
+ };
273
+ return UnixTerminal;
274
+ }(terminal_1.Terminal));
275
+ exports.UnixTerminal = UnixTerminal;
276
+ /**
277
+ * A custom write stream that writes directly to a file descriptor with proper
278
+ * handling of backpressure and errors. This avoids some event loop exhaustion
279
+ * issues that can occur when using the standard APIs in Node.
280
+ */
281
+ var CustomWriteStream = /** @class */ (function () {
282
+ function CustomWriteStream(_fd, _encoding) {
283
+ this._fd = _fd;
284
+ this._encoding = _encoding;
285
+ this._writeQueue = [];
286
+ }
287
+ CustomWriteStream.prototype.dispose = function () {
288
+ clearImmediate(this._writeImmediate);
289
+ this._writeImmediate = undefined;
290
+ };
291
+ CustomWriteStream.prototype.write = function (data) {
292
+ // Writes are put in a queue and processed asynchronously in order to handle
293
+ // backpressure from the kernel buffer.
294
+ var buffer = typeof data === 'string'
295
+ ? Buffer.from(data, this._encoding)
296
+ : Buffer.from(data);
297
+ if (buffer.byteLength !== 0) {
298
+ this._writeQueue.push({ buffer: buffer, offset: 0 });
299
+ if (this._writeQueue.length === 1) {
300
+ this._processWriteQueue();
301
+ }
302
+ }
303
+ };
304
+ CustomWriteStream.prototype._processWriteQueue = function () {
305
+ var _this = this;
306
+ this._writeImmediate = undefined;
307
+ if (this._writeQueue.length === 0) {
308
+ return;
309
+ }
310
+ var task = this._writeQueue[0];
311
+ // Write to the underlying file descriptor and handle it directly, rather
312
+ // than using the `net.Socket`/`tty.WriteStream` wrappers which swallow and
313
+ // mask errors like EAGAIN and can cause the thread to block indefinitely.
314
+ fs.write(this._fd, task.buffer, task.offset, function (err, written) {
315
+ if (err) {
316
+ if ('code' in err && err.code === 'EAGAIN') {
317
+ // `setImmediate` is used to yield to the event loop and re-attempt
318
+ // the write later.
319
+ _this._writeImmediate = setImmediate(function () { return _this._processWriteQueue(); });
320
+ }
321
+ else {
322
+ // Stop processing immediately on unexpected error and log
323
+ _this._writeQueue.length = 0;
324
+ console.error('Unhandled pty write error', err);
325
+ }
326
+ return;
327
+ }
328
+ task.offset += written;
329
+ if (task.offset >= task.buffer.byteLength) {
330
+ _this._writeQueue.shift();
331
+ }
332
+ // Since there is more room in the kernel buffer, we can continue to write
333
+ // until we hit EAGAIN or exhaust the queue.
334
+ //
335
+ // Note that old versions of bash, like v3.2 which ships in macOS, appears
336
+ // to have a bug in its readline implementation that causes data
337
+ // corruption when writes to the pty happens too quickly. Instead of
338
+ // trying to workaround that we just accept it so that large pastes are as
339
+ // fast as possible.
340
+ // Context: https://github.com/microsoft/node-pty/issues/833
341
+ _this._processWriteQueue();
342
+ });
343
+ };
344
+ return CustomWriteStream;
345
+ }());
346
+ //# sourceMappingURL=unixTerminal.js.map
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2017, Daniel Imms (MIT License).
4
+ * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.loadNativeModule = exports.assign = void 0;
8
+ function assign(target) {
9
+ var sources = [];
10
+ for (var _i = 1; _i < arguments.length; _i++) {
11
+ sources[_i - 1] = arguments[_i];
12
+ }
13
+ sources.forEach(function (source) { return Object.keys(source).forEach(function (key) { return target[key] = source[key]; }); });
14
+ return target;
15
+ }
16
+ exports.assign = assign;
17
+ function loadNativeModule(name) {
18
+ // Check build, debug, and then prebuilds.
19
+ var dirs = ['build/Release', 'build/Debug', "prebuilds/" + process.platform + "-" + process.arch];
20
+ // Check relative to the parent dir for unbundled and then the current dir for bundled
21
+ var relative = ['..', '.'];
22
+ var lastError;
23
+ for (var _i = 0, dirs_1 = dirs; _i < dirs_1.length; _i++) {
24
+ var d = dirs_1[_i];
25
+ for (var _a = 0, relative_1 = relative; _a < relative_1.length; _a++) {
26
+ var r = relative_1[_a];
27
+ var dir = r + "/" + d + "/";
28
+ try {
29
+ return { dir: dir, module: require(dir + "/" + name + ".node") };
30
+ }
31
+ catch (e) {
32
+ lastError = e;
33
+ }
34
+ }
35
+ }
36
+ throw new Error("Failed to load native module: " + name + ".node, checked: " + dirs.join(', ') + ": " + lastError);
37
+ }
38
+ exports.loadNativeModule = loadNativeModule;
39
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2020, Microsoft Corporation (MIT License).
4
+ */
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ var __generator = (this && this.__generator) || function (thisArg, body) {
15
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
16
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
17
+ function verb(n) { return function (v) { return step([n, v]); }; }
18
+ function step(op) {
19
+ if (f) throw new TypeError("Generator is already executing.");
20
+ while (_) try {
21
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
22
+ if (y = 0, t) op = [op[0] & 2, t.value];
23
+ switch (op[0]) {
24
+ case 0: case 1: t = op; break;
25
+ case 4: _.label++; return { value: op[1], done: false };
26
+ case 5: _.label++; y = op[1]; op = [0]; continue;
27
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
28
+ default:
29
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
30
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
31
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
32
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
33
+ if (t[2]) _.ops.pop();
34
+ _.trys.pop(); continue;
35
+ }
36
+ op = body.call(thisArg, _);
37
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
38
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
39
+ }
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.ConoutConnection = void 0;
43
+ var worker_threads_1 = require("worker_threads");
44
+ var conout_1 = require("./shared/conout");
45
+ var path_1 = require("path");
46
+ var eventEmitter2_1 = require("./eventEmitter2");
47
+ /**
48
+ * The amount of time to wait for additional data after the conpty shell process has exited before
49
+ * shutting down the worker and sockets. The timer will be reset if a new data event comes in after
50
+ * the timer has started.
51
+ */
52
+ var FLUSH_DATA_INTERVAL = 1000;
53
+ /**
54
+ * Connects to and manages the lifecycle of the conout socket. This socket must be drained on
55
+ * another thread in order to avoid deadlocks where Conpty waits for the out socket to drain
56
+ * when `ClosePseudoConsole` is called. This happens when data is being written to the terminal when
57
+ * the pty is closed.
58
+ *
59
+ * See also:
60
+ * - https://github.com/microsoft/node-pty/issues/375
61
+ * - https://github.com/microsoft/vscode/issues/76548
62
+ * - https://github.com/microsoft/terminal/issues/1810
63
+ * - https://docs.microsoft.com/en-us/windows/console/closepseudoconsole
64
+ */
65
+ var ConoutConnection = /** @class */ (function () {
66
+ function ConoutConnection(_conoutPipeName, _useConptyDll) {
67
+ var _this = this;
68
+ this._conoutPipeName = _conoutPipeName;
69
+ this._useConptyDll = _useConptyDll;
70
+ this._isDisposed = false;
71
+ this._onReady = new eventEmitter2_1.EventEmitter2();
72
+ var workerData = {
73
+ conoutPipeName: _conoutPipeName
74
+ };
75
+ var scriptPath = __dirname.replace('node_modules.asar', 'node_modules.asar.unpacked');
76
+ this._worker = new worker_threads_1.Worker(path_1.join(scriptPath, 'worker/conoutSocketWorker.js'), { workerData: workerData });
77
+ this._worker.on('message', function (message) {
78
+ switch (message) {
79
+ case 1 /* READY */:
80
+ _this._onReady.fire();
81
+ return;
82
+ default:
83
+ console.warn('Unexpected ConoutWorkerMessage', message);
84
+ }
85
+ });
86
+ }
87
+ Object.defineProperty(ConoutConnection.prototype, "onReady", {
88
+ get: function () { return this._onReady.event; },
89
+ enumerable: false,
90
+ configurable: true
91
+ });
92
+ ConoutConnection.prototype.dispose = function () {
93
+ if (!this._useConptyDll && this._isDisposed) {
94
+ return;
95
+ }
96
+ this._isDisposed = true;
97
+ // Drain all data from the socket before closing
98
+ this._drainDataAndClose();
99
+ };
100
+ ConoutConnection.prototype.connectSocket = function (socket) {
101
+ socket.connect(conout_1.getWorkerPipeName(this._conoutPipeName));
102
+ };
103
+ ConoutConnection.prototype._drainDataAndClose = function () {
104
+ var _this = this;
105
+ if (this._drainTimeout) {
106
+ clearTimeout(this._drainTimeout);
107
+ }
108
+ this._drainTimeout = setTimeout(function () { return _this._destroySocket(); }, FLUSH_DATA_INTERVAL);
109
+ };
110
+ ConoutConnection.prototype._destroySocket = function () {
111
+ return __awaiter(this, void 0, void 0, function () {
112
+ return __generator(this, function (_a) {
113
+ switch (_a.label) {
114
+ case 0: return [4 /*yield*/, this._worker.terminate()];
115
+ case 1:
116
+ _a.sent();
117
+ return [2 /*return*/];
118
+ }
119
+ });
120
+ });
121
+ };
122
+ return ConoutConnection;
123
+ }());
124
+ exports.ConoutConnection = ConoutConnection;
125
+ //# sourceMappingURL=windowsConoutConnection.js.map