accrete-kit 0.1.0 → 0.2.0

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 (69) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +9 -2
  3. package/dist/scaffold/assets/generated/release.json +1 -1
  4. package/dist/scaffold/manifest.json +2 -2
  5. package/dist/ui/LICENSE +21 -0
  6. package/dist/ui/THIRD-PARTY-NOTICES +212 -0
  7. package/dist/ui/bin/accrete-ui.mjs +46 -0
  8. package/dist/ui/page/app.js +49 -0
  9. package/dist/ui/page/index.html +17 -0
  10. package/dist/ui/page/panels/activity.css +80 -0
  11. package/dist/ui/page/panels/activity.js +85 -0
  12. package/dist/ui/page/panels/agents.css +61 -0
  13. package/dist/ui/page/panels/agents.js +173 -0
  14. package/dist/ui/page/panels/objects.css +155 -0
  15. package/dist/ui/page/panels/objects.js +309 -0
  16. package/dist/ui/page/panels/running.css +35 -0
  17. package/dist/ui/page/panels/running.js +159 -0
  18. package/dist/ui/page/style.css +86 -0
  19. package/dist/ui/page/terminal.js +88 -0
  20. package/dist/ui/server/agent-sessions.mjs +600 -0
  21. package/dist/ui/server/auth.mjs +29 -0
  22. package/dist/ui/server/deps.mjs +12 -0
  23. package/dist/ui/server/documents.mjs +285 -0
  24. package/dist/ui/server/events.mjs +18 -0
  25. package/dist/ui/server/processes.mjs +110 -0
  26. package/dist/ui/server/readers/activity.mjs +134 -0
  27. package/dist/ui/server/readers/agents.mjs +45 -0
  28. package/dist/ui/server/readers/objects.mjs +261 -0
  29. package/dist/ui/server/readers/running.mjs +245 -0
  30. package/dist/ui/server/scope.mjs +36 -0
  31. package/dist/ui/server/server.mjs +156 -0
  32. package/dist/ui/server/terminal.mjs +134 -0
  33. package/dist/ui/server/workspace.mjs +26 -0
  34. package/dist/ui/ui.json +3 -0
  35. package/dist/ui/vendor/@xterm/addon-fit/lib/addon-fit.mjs +18 -0
  36. package/dist/ui/vendor/@xterm/addon-unicode11/lib/addon-unicode11.mjs +44 -0
  37. package/dist/ui/vendor/@xterm/addon-webgl/lib/addon-webgl.mjs +101 -0
  38. package/dist/ui/vendor/@xterm/xterm/css/xterm.css +285 -0
  39. package/dist/ui/vendor/@xterm/xterm/lib/xterm.mjs +53 -0
  40. package/dist/ui/vendor/node-pty/lib/eventEmitter2.js +47 -0
  41. package/dist/ui/vendor/node-pty/lib/index.js +52 -0
  42. package/dist/ui/vendor/node-pty/lib/interfaces.js +7 -0
  43. package/dist/ui/vendor/node-pty/lib/terminal.js +190 -0
  44. package/dist/ui/vendor/node-pty/lib/types.js +7 -0
  45. package/dist/ui/vendor/node-pty/lib/unixTerminal.js +346 -0
  46. package/dist/ui/vendor/node-pty/lib/utils.js +39 -0
  47. package/dist/ui/vendor/node-pty/package.json +64 -0
  48. package/dist/ui/vendor/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  49. package/dist/ui/vendor/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  50. package/dist/ui/vendor/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  51. package/dist/ui/vendor/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  52. package/dist/ui/vendor/ws/index.js +22 -0
  53. package/dist/ui/vendor/ws/lib/buffer-util.js +142 -0
  54. package/dist/ui/vendor/ws/lib/constants.js +19 -0
  55. package/dist/ui/vendor/ws/lib/event-target.js +292 -0
  56. package/dist/ui/vendor/ws/lib/extension.js +203 -0
  57. package/dist/ui/vendor/ws/lib/limiter.js +55 -0
  58. package/dist/ui/vendor/ws/lib/permessage-deflate.js +530 -0
  59. package/dist/ui/vendor/ws/lib/receiver.js +743 -0
  60. package/dist/ui/vendor/ws/lib/sender.js +610 -0
  61. package/dist/ui/vendor/ws/lib/stream.js +161 -0
  62. package/dist/ui/vendor/ws/lib/subprotocol.js +62 -0
  63. package/dist/ui/vendor/ws/lib/validation.js +152 -0
  64. package/dist/ui/vendor/ws/lib/websocket-server.js +562 -0
  65. package/dist/ui/vendor/ws/lib/websocket.js +1426 -0
  66. package/dist/ui/vendor/ws/package.json +74 -0
  67. package/lib/cli.mjs +22 -4
  68. package/lib/ui.mjs +24 -0
  69. package/package.json +5 -5
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "node-pty",
3
+ "description": "Fork pseudoterminals in Node.JS",
4
+ "author": {
5
+ "name": "Microsoft Corporation"
6
+ },
7
+ "version": "1.1.0",
8
+ "license": "MIT",
9
+ "main": "./lib/index.js",
10
+ "types": "./typings/node-pty.d.ts",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git://github.com/microsoft/node-pty.git"
14
+ },
15
+ "files": [
16
+ "binding.gyp",
17
+ "lib/",
18
+ "scripts/",
19
+ "src/",
20
+ "deps/",
21
+ "prebuilds/",
22
+ "third_party/",
23
+ "typings/"
24
+ ],
25
+ "homepage": "https://github.com/microsoft/node-pty",
26
+ "bugs": {
27
+ "url": "https://github.com/microsoft/node-pty/issues"
28
+ },
29
+ "keywords": [
30
+ "pty",
31
+ "tty",
32
+ "terminal",
33
+ "pseudoterminal",
34
+ "forkpty",
35
+ "openpty"
36
+ ],
37
+ "scripts": {
38
+ "build": "tsc -b ./src/tsconfig.json",
39
+ "watch": "tsc -b -w ./src/tsconfig.json",
40
+ "lint": "eslint -c .eslintrc.js --ext .ts src/",
41
+ "install": "node scripts/prebuild.js || node-gyp rebuild",
42
+ "postinstall": "node scripts/post-install.js",
43
+ "compileCommands": "node scripts/gen-compile-commands.js",
44
+ "test": "cross-env NODE_ENV=test mocha -R spec --exit lib/*.test.js",
45
+ "posttest": "npm run lint",
46
+ "prepare": "npm run build",
47
+ "prepublishOnly": "npm run build"
48
+ },
49
+ "dependencies": {
50
+ "node-addon-api": "^7.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@types/mocha": "^7.0.2",
54
+ "@types/node": "12",
55
+ "@typescript-eslint/eslint-plugin": "^2.27.0",
56
+ "@typescript-eslint/parser": "^2.27.0",
57
+ "cross-env": "^5.1.4",
58
+ "eslint": "^6.8.0",
59
+ "mocha": "10",
60
+ "node-gyp": "^11.4.2",
61
+ "ps-list": "^6.0.0",
62
+ "typescript": "^3.8.3"
63
+ }
64
+ }
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const createWebSocketStream = require('./lib/stream');
4
+ const extension = require('./lib/extension');
5
+ const PerMessageDeflate = require('./lib/permessage-deflate');
6
+ const Receiver = require('./lib/receiver');
7
+ const Sender = require('./lib/sender');
8
+ const subprotocol = require('./lib/subprotocol');
9
+ const WebSocket = require('./lib/websocket');
10
+ const WebSocketServer = require('./lib/websocket-server');
11
+
12
+ WebSocket.createWebSocketStream = createWebSocketStream;
13
+ WebSocket.extension = extension;
14
+ WebSocket.PerMessageDeflate = PerMessageDeflate;
15
+ WebSocket.Receiver = Receiver;
16
+ WebSocket.Sender = Sender;
17
+ WebSocket.Server = WebSocketServer;
18
+ WebSocket.subprotocol = subprotocol;
19
+ WebSocket.WebSocket = WebSocket;
20
+ WebSocket.WebSocketServer = WebSocketServer;
21
+
22
+ module.exports = WebSocket;
@@ -0,0 +1,142 @@
1
+ 'use strict';
2
+
3
+ const { websocketMask, websocketUnmask } = require('http');
4
+
5
+ const { EMPTY_BUFFER } = require('./constants');
6
+
7
+ const FastBuffer = Buffer[Symbol.species];
8
+
9
+ /**
10
+ * Merges an array of buffers into a new buffer.
11
+ *
12
+ * @param {Buffer[]} list The array of buffers to concat
13
+ * @param {Number} totalLength The total length of buffers in the list
14
+ * @return {Buffer} The resulting buffer
15
+ * @public
16
+ */
17
+ function concat(list, totalLength) {
18
+ if (list.length === 0) return EMPTY_BUFFER;
19
+ if (list.length === 1) return list[0];
20
+
21
+ const target = Buffer.allocUnsafe(totalLength);
22
+ let offset = 0;
23
+
24
+ for (let i = 0; i < list.length; i++) {
25
+ const buf = list[i];
26
+ target.set(buf, offset);
27
+ offset += buf.length;
28
+ }
29
+
30
+ if (offset < totalLength) {
31
+ return new FastBuffer(target.buffer, target.byteOffset, offset);
32
+ }
33
+
34
+ return target;
35
+ }
36
+
37
+ /**
38
+ * Masks a buffer using the given mask.
39
+ *
40
+ * @param {Buffer} source The buffer to mask
41
+ * @param {Buffer} mask The mask to use
42
+ * @param {Buffer} output The buffer where to store the result
43
+ * @param {Number} offset The offset at which to start writing
44
+ * @param {Number} length The number of bytes to mask.
45
+ * @public
46
+ */
47
+ function _mask(source, mask, output, offset, length) {
48
+ for (let i = 0; i < length; i++) {
49
+ output[offset + i] = source[i] ^ mask[i & 3];
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Unmasks a buffer using the given mask.
55
+ *
56
+ * @param {Buffer} buffer The buffer to unmask
57
+ * @param {Buffer} mask The mask to use
58
+ * @public
59
+ */
60
+ function _unmask(buffer, mask) {
61
+ for (let i = 0; i < buffer.length; i++) {
62
+ buffer[i] ^= mask[i & 3];
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Converts a buffer to an `ArrayBuffer`.
68
+ *
69
+ * @param {Buffer} buf The buffer to convert
70
+ * @return {ArrayBuffer} Converted buffer
71
+ * @public
72
+ */
73
+ function toArrayBuffer(buf) {
74
+ if (buf.length === buf.buffer.byteLength) {
75
+ return buf.buffer;
76
+ }
77
+
78
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
79
+ }
80
+
81
+ /**
82
+ * Converts `data` to a `Buffer`.
83
+ *
84
+ * @param {*} data The data to convert
85
+ * @return {Buffer} The buffer
86
+ * @throws {TypeError}
87
+ * @public
88
+ */
89
+ function toBuffer(data) {
90
+ toBuffer.readOnly = true;
91
+
92
+ if (Buffer.isBuffer(data)) return data;
93
+
94
+ let buf;
95
+
96
+ if (data instanceof ArrayBuffer) {
97
+ buf = new FastBuffer(data);
98
+ } else if (ArrayBuffer.isView(data)) {
99
+ buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
100
+ } else {
101
+ buf = Buffer.from(data);
102
+ toBuffer.readOnly = false;
103
+ }
104
+
105
+ return buf;
106
+ }
107
+
108
+ module.exports = {
109
+ concat,
110
+ mask: _mask,
111
+ toArrayBuffer,
112
+ toBuffer,
113
+ unmask: _unmask
114
+ };
115
+
116
+ if (websocketMask) {
117
+ module.exports.mask = function (source, mask, output, offset, length) {
118
+ if (length < 24) _mask(source, mask, output, offset, length);
119
+ else websocketMask(source, mask, output, offset, length);
120
+ };
121
+
122
+ module.exports.unmask = function (buffer, mask) {
123
+ if (buffer.length < 24) _unmask(buffer, mask);
124
+ else websocketUnmask(buffer, mask);
125
+ };
126
+ } /* istanbul ignore else */ else if (!process.env.WS_NO_BUFFER_UTIL) {
127
+ try {
128
+ const bufferUtil = require('bufferutil');
129
+
130
+ module.exports.mask = function (source, mask, output, offset, length) {
131
+ if (length < 48) _mask(source, mask, output, offset, length);
132
+ else bufferUtil.mask(source, mask, output, offset, length);
133
+ };
134
+
135
+ module.exports.unmask = function (buffer, mask) {
136
+ if (buffer.length < 32) _unmask(buffer, mask);
137
+ else bufferUtil.unmask(buffer, mask);
138
+ };
139
+ } catch (e) {
140
+ // Continue regardless of the error.
141
+ }
142
+ }
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const BINARY_TYPES = ['nodebuffer', 'arraybuffer', 'fragments'];
4
+ const hasBlob = typeof Blob !== 'undefined';
5
+
6
+ if (hasBlob) BINARY_TYPES.push('blob');
7
+
8
+ module.exports = {
9
+ BINARY_TYPES,
10
+ CLOSE_TIMEOUT: 30000,
11
+ EMPTY_BUFFER: Buffer.alloc(0),
12
+ GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
13
+ hasBlob,
14
+ kForOnEventAttribute: Symbol('kIsForOnEventAttribute'),
15
+ kListener: Symbol('kListener'),
16
+ kStatusCode: Symbol('status-code'),
17
+ kWebSocket: Symbol('websocket'),
18
+ NOOP: () => {}
19
+ };
@@ -0,0 +1,292 @@
1
+ 'use strict';
2
+
3
+ const { kForOnEventAttribute, kListener } = require('./constants');
4
+
5
+ const kCode = Symbol('kCode');
6
+ const kData = Symbol('kData');
7
+ const kError = Symbol('kError');
8
+ const kMessage = Symbol('kMessage');
9
+ const kReason = Symbol('kReason');
10
+ const kTarget = Symbol('kTarget');
11
+ const kType = Symbol('kType');
12
+ const kWasClean = Symbol('kWasClean');
13
+
14
+ /**
15
+ * Class representing an event.
16
+ */
17
+ class Event {
18
+ /**
19
+ * Create a new `Event`.
20
+ *
21
+ * @param {String} type The name of the event
22
+ * @throws {TypeError} If the `type` argument is not specified
23
+ */
24
+ constructor(type) {
25
+ this[kTarget] = null;
26
+ this[kType] = type;
27
+ }
28
+
29
+ /**
30
+ * @type {*}
31
+ */
32
+ get target() {
33
+ return this[kTarget];
34
+ }
35
+
36
+ /**
37
+ * @type {String}
38
+ */
39
+ get type() {
40
+ return this[kType];
41
+ }
42
+ }
43
+
44
+ Object.defineProperty(Event.prototype, 'target', { enumerable: true });
45
+ Object.defineProperty(Event.prototype, 'type', { enumerable: true });
46
+
47
+ /**
48
+ * Class representing a close event.
49
+ *
50
+ * @extends Event
51
+ */
52
+ class CloseEvent extends Event {
53
+ /**
54
+ * Create a new `CloseEvent`.
55
+ *
56
+ * @param {String} type The name of the event
57
+ * @param {Object} [options] A dictionary object that allows for setting
58
+ * attributes via object members of the same name
59
+ * @param {Number} [options.code=0] The status code explaining why the
60
+ * connection was closed
61
+ * @param {String} [options.reason=''] A human-readable string explaining why
62
+ * the connection was closed
63
+ * @param {Boolean} [options.wasClean=false] Indicates whether or not the
64
+ * connection was cleanly closed
65
+ */
66
+ constructor(type, options = {}) {
67
+ super(type);
68
+
69
+ this[kCode] = options.code === undefined ? 0 : options.code;
70
+ this[kReason] = options.reason === undefined ? '' : options.reason;
71
+ this[kWasClean] = options.wasClean === undefined ? false : options.wasClean;
72
+ }
73
+
74
+ /**
75
+ * @type {Number}
76
+ */
77
+ get code() {
78
+ return this[kCode];
79
+ }
80
+
81
+ /**
82
+ * @type {String}
83
+ */
84
+ get reason() {
85
+ return this[kReason];
86
+ }
87
+
88
+ /**
89
+ * @type {Boolean}
90
+ */
91
+ get wasClean() {
92
+ return this[kWasClean];
93
+ }
94
+ }
95
+
96
+ Object.defineProperty(CloseEvent.prototype, 'code', { enumerable: true });
97
+ Object.defineProperty(CloseEvent.prototype, 'reason', { enumerable: true });
98
+ Object.defineProperty(CloseEvent.prototype, 'wasClean', { enumerable: true });
99
+
100
+ /**
101
+ * Class representing an error event.
102
+ *
103
+ * @extends Event
104
+ */
105
+ class ErrorEvent extends Event {
106
+ /**
107
+ * Create a new `ErrorEvent`.
108
+ *
109
+ * @param {String} type The name of the event
110
+ * @param {Object} [options] A dictionary object that allows for setting
111
+ * attributes via object members of the same name
112
+ * @param {*} [options.error=null] The error that generated this event
113
+ * @param {String} [options.message=''] The error message
114
+ */
115
+ constructor(type, options = {}) {
116
+ super(type);
117
+
118
+ this[kError] = options.error === undefined ? null : options.error;
119
+ this[kMessage] = options.message === undefined ? '' : options.message;
120
+ }
121
+
122
+ /**
123
+ * @type {*}
124
+ */
125
+ get error() {
126
+ return this[kError];
127
+ }
128
+
129
+ /**
130
+ * @type {String}
131
+ */
132
+ get message() {
133
+ return this[kMessage];
134
+ }
135
+ }
136
+
137
+ Object.defineProperty(ErrorEvent.prototype, 'error', { enumerable: true });
138
+ Object.defineProperty(ErrorEvent.prototype, 'message', { enumerable: true });
139
+
140
+ /**
141
+ * Class representing a message event.
142
+ *
143
+ * @extends Event
144
+ */
145
+ class MessageEvent extends Event {
146
+ /**
147
+ * Create a new `MessageEvent`.
148
+ *
149
+ * @param {String} type The name of the event
150
+ * @param {Object} [options] A dictionary object that allows for setting
151
+ * attributes via object members of the same name
152
+ * @param {*} [options.data=null] The message content
153
+ */
154
+ constructor(type, options = {}) {
155
+ super(type);
156
+
157
+ this[kData] = options.data === undefined ? null : options.data;
158
+ }
159
+
160
+ /**
161
+ * @type {*}
162
+ */
163
+ get data() {
164
+ return this[kData];
165
+ }
166
+ }
167
+
168
+ Object.defineProperty(MessageEvent.prototype, 'data', { enumerable: true });
169
+
170
+ /**
171
+ * This provides methods for emulating the `EventTarget` interface. It's not
172
+ * meant to be used directly.
173
+ *
174
+ * @mixin
175
+ */
176
+ const EventTarget = {
177
+ /**
178
+ * Register an event listener.
179
+ *
180
+ * @param {String} type A string representing the event type to listen for
181
+ * @param {(Function|Object)} handler The listener to add
182
+ * @param {Object} [options] An options object specifies characteristics about
183
+ * the event listener
184
+ * @param {Boolean} [options.once=false] A `Boolean` indicating that the
185
+ * listener should be invoked at most once after being added. If `true`,
186
+ * the listener would be automatically removed when invoked.
187
+ * @public
188
+ */
189
+ addEventListener(type, handler, options = {}) {
190
+ for (const listener of this.listeners(type)) {
191
+ if (
192
+ !options[kForOnEventAttribute] &&
193
+ listener[kListener] === handler &&
194
+ !listener[kForOnEventAttribute]
195
+ ) {
196
+ return;
197
+ }
198
+ }
199
+
200
+ let wrapper;
201
+
202
+ if (type === 'message') {
203
+ wrapper = function onMessage(data, isBinary) {
204
+ const event = new MessageEvent('message', {
205
+ data: isBinary ? data : data.toString()
206
+ });
207
+
208
+ event[kTarget] = this;
209
+ callListener(handler, this, event);
210
+ };
211
+ } else if (type === 'close') {
212
+ wrapper = function onClose(code, message) {
213
+ const event = new CloseEvent('close', {
214
+ code,
215
+ reason: message.toString(),
216
+ wasClean: this._closeFrameReceived && this._closeFrameSent
217
+ });
218
+
219
+ event[kTarget] = this;
220
+ callListener(handler, this, event);
221
+ };
222
+ } else if (type === 'error') {
223
+ wrapper = function onError(error) {
224
+ const event = new ErrorEvent('error', {
225
+ error,
226
+ message: error.message
227
+ });
228
+
229
+ event[kTarget] = this;
230
+ callListener(handler, this, event);
231
+ };
232
+ } else if (type === 'open') {
233
+ wrapper = function onOpen() {
234
+ const event = new Event('open');
235
+
236
+ event[kTarget] = this;
237
+ callListener(handler, this, event);
238
+ };
239
+ } else {
240
+ return;
241
+ }
242
+
243
+ wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
244
+ wrapper[kListener] = handler;
245
+
246
+ if (options.once) {
247
+ this.once(type, wrapper);
248
+ } else {
249
+ this.on(type, wrapper);
250
+ }
251
+ },
252
+
253
+ /**
254
+ * Remove an event listener.
255
+ *
256
+ * @param {String} type A string representing the event type to remove
257
+ * @param {(Function|Object)} handler The listener to remove
258
+ * @public
259
+ */
260
+ removeEventListener(type, handler) {
261
+ for (const listener of this.listeners(type)) {
262
+ if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
263
+ this.removeListener(type, listener);
264
+ break;
265
+ }
266
+ }
267
+ }
268
+ };
269
+
270
+ module.exports = {
271
+ CloseEvent,
272
+ ErrorEvent,
273
+ Event,
274
+ EventTarget,
275
+ MessageEvent
276
+ };
277
+
278
+ /**
279
+ * Call an event listener
280
+ *
281
+ * @param {(Function|Object)} listener The listener to call
282
+ * @param {*} thisArg The value to use as `this`` when calling the listener
283
+ * @param {Event} event The event to pass to the listener
284
+ * @private
285
+ */
286
+ function callListener(listener, thisArg, event) {
287
+ if (typeof listener === 'object' && listener.handleEvent) {
288
+ listener.handleEvent.call(listener, event);
289
+ } else {
290
+ listener.call(thisArg, event);
291
+ }
292
+ }