nextclaw 0.19.26 → 0.19.28

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 (32) hide show
  1. package/dist/cli/app/index.js +2 -0
  2. package/dist/cli/app/index.js.map +1 -0
  3. package/dist/cli/launcher/index.js +2 -0
  4. package/dist/cli/launcher/index.js.map +1 -0
  5. package/dist/nextclaw-distribution.utils-BJZhAnGk.js +2 -0
  6. package/dist/nextclaw-distribution.utils-BJZhAnGk.js.map +1 -0
  7. package/package.json +18 -18
  8. package/resources/USAGE.md +54 -3
  9. package/resources/usage/http-webhook-ingress.md +145 -0
  10. package/ui-dist/assets/{channels-list-page-CE_9jne_.js → channels-list-page-ZWYqfcCe.js} +1 -1
  11. package/ui-dist/assets/{chat-page-BMJLtk3O.js → chat-page-ACm58eUO.js} +1 -1
  12. package/ui-dist/assets/desktop-C-cDRCBY.js +3 -0
  13. package/ui-dist/assets/doc-browser-D2pq4IHR.js +1 -0
  14. package/ui-dist/assets/doc-browser-DhIkcy0-.js +1 -0
  15. package/ui-dist/assets/{doc-browser-CDBYvb8A.js → doc-browser-fLs0TcdS.js} +1 -1
  16. package/ui-dist/assets/{index-BEn7o-oH.js → index-Db9Cufsy.js} +22 -22
  17. package/ui-dist/assets/{marketplace-page-B3Q_uKOZ.js → marketplace-page-CAp_gpNe.js} +1 -1
  18. package/ui-dist/assets/marketplace-page-PPY5uMHK.js +1 -0
  19. package/ui-dist/assets/mcp-marketplace-page-87__92b1.js +1 -0
  20. package/ui-dist/assets/{mcp-marketplace-page-D9maE_Sf.js → mcp-marketplace-page-C6HENB6V.js} +1 -1
  21. package/ui-dist/assets/{model-config-BsEQYJvz.js → model-config-CK3a8DWH.js} +1 -1
  22. package/ui-dist/assets/{providers-list-5mA-2zno.js → providers-list-BTPjqNdK.js} +1 -1
  23. package/ui-dist/assets/{runtime-config-page-BSoKMvCh.js → runtime-config-page-Bb9he7t8.js} +1 -1
  24. package/ui-dist/assets/{search-config-DxWm2GrK.js → search-config-BkbSXa9d.js} +1 -1
  25. package/ui-dist/assets/{secrets-config-qutTAlFx.js → secrets-config-DFbHCb9n.js} +1 -1
  26. package/ui-dist/assets/{use-infinite-scroll-loader-CyNa4Vj6.js → use-infinite-scroll-loader-DXhw9W4l.js} +1 -1
  27. package/ui-dist/index.html +7 -7
  28. package/ui-dist/assets/desktop-DJpQzxsz.js +0 -3
  29. package/ui-dist/assets/doc-browser-B19cYGxa.js +0 -1
  30. package/ui-dist/assets/doc-browser-IRh6LCzu.js +0 -1
  31. package/ui-dist/assets/marketplace-page-CCq1bFb1.js +0 -1
  32. package/ui-dist/assets/mcp-marketplace-page-O5AQzBYl.js +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["EventEmitter","http","URL","createHash","Duplex"],"sources":["../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/constants.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/buffer-util.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/limiter.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/permessage-deflate.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/validation.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/receiver.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/sender.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/event-target.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/extension.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/stream.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/subprotocol.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket-server.js","../../../../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/wrapper.mjs","../../../../nextclaw-remote/dist/index.js","../../../src/cli/app/register-agents-commands.ts","../../../src/cli/app/register-learning-loop-commands.ts","../../../src/cli/app/register-skills-commands.ts","../../../src/cli/app/service-command-registration.utils.ts","../../../src/cli/app/index.ts"],"sourcesContent":["'use strict';\n\nconst BINARY_TYPES = ['nodebuffer', 'arraybuffer', 'fragments'];\nconst hasBlob = typeof Blob !== 'undefined';\n\nif (hasBlob) BINARY_TYPES.push('blob');\n\nmodule.exports = {\n BINARY_TYPES,\n CLOSE_TIMEOUT: 30000,\n EMPTY_BUFFER: Buffer.alloc(0),\n GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',\n hasBlob,\n kForOnEventAttribute: Symbol('kIsForOnEventAttribute'),\n kListener: Symbol('kListener'),\n kStatusCode: Symbol('status-code'),\n kWebSocket: Symbol('websocket'),\n NOOP: () => {}\n};\n","'use strict';\n\nconst { EMPTY_BUFFER } = require('./constants');\n\nconst FastBuffer = Buffer[Symbol.species];\n\n/**\n * Merges an array of buffers into a new buffer.\n *\n * @param {Buffer[]} list The array of buffers to concat\n * @param {Number} totalLength The total length of buffers in the list\n * @return {Buffer} The resulting buffer\n * @public\n */\nfunction concat(list, totalLength) {\n if (list.length === 0) return EMPTY_BUFFER;\n if (list.length === 1) return list[0];\n\n const target = Buffer.allocUnsafe(totalLength);\n let offset = 0;\n\n for (let i = 0; i < list.length; i++) {\n const buf = list[i];\n target.set(buf, offset);\n offset += buf.length;\n }\n\n if (offset < totalLength) {\n return new FastBuffer(target.buffer, target.byteOffset, offset);\n }\n\n return target;\n}\n\n/**\n * Masks a buffer using the given mask.\n *\n * @param {Buffer} source The buffer to mask\n * @param {Buffer} mask The mask to use\n * @param {Buffer} output The buffer where to store the result\n * @param {Number} offset The offset at which to start writing\n * @param {Number} length The number of bytes to mask.\n * @public\n */\nfunction _mask(source, mask, output, offset, length) {\n for (let i = 0; i < length; i++) {\n output[offset + i] = source[i] ^ mask[i & 3];\n }\n}\n\n/**\n * Unmasks a buffer using the given mask.\n *\n * @param {Buffer} buffer The buffer to unmask\n * @param {Buffer} mask The mask to use\n * @public\n */\nfunction _unmask(buffer, mask) {\n for (let i = 0; i < buffer.length; i++) {\n buffer[i] ^= mask[i & 3];\n }\n}\n\n/**\n * Converts a buffer to an `ArrayBuffer`.\n *\n * @param {Buffer} buf The buffer to convert\n * @return {ArrayBuffer} Converted buffer\n * @public\n */\nfunction toArrayBuffer(buf) {\n if (buf.length === buf.buffer.byteLength) {\n return buf.buffer;\n }\n\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);\n}\n\n/**\n * Converts `data` to a `Buffer`.\n *\n * @param {*} data The data to convert\n * @return {Buffer} The buffer\n * @throws {TypeError}\n * @public\n */\nfunction toBuffer(data) {\n toBuffer.readOnly = true;\n\n if (Buffer.isBuffer(data)) return data;\n\n let buf;\n\n if (data instanceof ArrayBuffer) {\n buf = new FastBuffer(data);\n } else if (ArrayBuffer.isView(data)) {\n buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);\n } else {\n buf = Buffer.from(data);\n toBuffer.readOnly = false;\n }\n\n return buf;\n}\n\nmodule.exports = {\n concat,\n mask: _mask,\n toArrayBuffer,\n toBuffer,\n unmask: _unmask\n};\n\n/* istanbul ignore else */\nif (!process.env.WS_NO_BUFFER_UTIL) {\n try {\n const bufferUtil = require('bufferutil');\n\n module.exports.mask = function (source, mask, output, offset, length) {\n if (length < 48) _mask(source, mask, output, offset, length);\n else bufferUtil.mask(source, mask, output, offset, length);\n };\n\n module.exports.unmask = function (buffer, mask) {\n if (buffer.length < 32) _unmask(buffer, mask);\n else bufferUtil.unmask(buffer, mask);\n };\n } catch (e) {\n // Continue regardless of the error.\n }\n}\n","'use strict';\n\nconst kDone = Symbol('kDone');\nconst kRun = Symbol('kRun');\n\n/**\n * A very simple job queue with adjustable concurrency. Adapted from\n * https://github.com/STRML/async-limiter\n */\nclass Limiter {\n /**\n * Creates a new `Limiter`.\n *\n * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed\n * to run concurrently\n */\n constructor(concurrency) {\n this[kDone] = () => {\n this.pending--;\n this[kRun]();\n };\n this.concurrency = concurrency || Infinity;\n this.jobs = [];\n this.pending = 0;\n }\n\n /**\n * Adds a job to the queue.\n *\n * @param {Function} job The job to run\n * @public\n */\n add(job) {\n this.jobs.push(job);\n this[kRun]();\n }\n\n /**\n * Removes a job from the queue and runs it if possible.\n *\n * @private\n */\n [kRun]() {\n if (this.pending === this.concurrency) return;\n\n if (this.jobs.length) {\n const job = this.jobs.shift();\n\n this.pending++;\n job(this[kDone]);\n }\n }\n}\n\nmodule.exports = Limiter;\n","'use strict';\n\nconst zlib = require('zlib');\n\nconst bufferUtil = require('./buffer-util');\nconst Limiter = require('./limiter');\nconst { kStatusCode } = require('./constants');\n\nconst FastBuffer = Buffer[Symbol.species];\nconst TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]);\nconst kPerMessageDeflate = Symbol('permessage-deflate');\nconst kTotalLength = Symbol('total-length');\nconst kCallback = Symbol('callback');\nconst kBuffers = Symbol('buffers');\nconst kError = Symbol('error');\n\n//\n// We limit zlib concurrency, which prevents severe memory fragmentation\n// as documented in https://github.com/nodejs/node/issues/8871#issuecomment-250915913\n// and https://github.com/websockets/ws/issues/1202\n//\n// Intentionally global; it's the global thread pool that's an issue.\n//\nlet zlibLimiter;\n\n/**\n * permessage-deflate implementation.\n */\nclass PerMessageDeflate {\n /**\n * Creates a PerMessageDeflate instance.\n *\n * @param {Object} [options] Configuration options\n * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support\n * for, or request, a custom client window size\n * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/\n * acknowledge disabling of client context takeover\n * @param {Number} [options.concurrencyLimit=10] The number of concurrent\n * calls to zlib\n * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the\n * use of a custom server window size\n * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept\n * disabling of server context takeover\n * @param {Number} [options.threshold=1024] Size (in bytes) below which\n * messages should not be compressed if context takeover is disabled\n * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on\n * deflate\n * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on\n * inflate\n * @param {Boolean} [isServer=false] Create the instance in either server or\n * client mode\n * @param {Number} [maxPayload=0] The maximum allowed message length\n */\n constructor(options, isServer, maxPayload) {\n this._maxPayload = maxPayload | 0;\n this._options = options || {};\n this._threshold =\n this._options.threshold !== undefined ? this._options.threshold : 1024;\n this._isServer = !!isServer;\n this._deflate = null;\n this._inflate = null;\n\n this.params = null;\n\n if (!zlibLimiter) {\n const concurrency =\n this._options.concurrencyLimit !== undefined\n ? this._options.concurrencyLimit\n : 10;\n zlibLimiter = new Limiter(concurrency);\n }\n }\n\n /**\n * @type {String}\n */\n static get extensionName() {\n return 'permessage-deflate';\n }\n\n /**\n * Create an extension negotiation offer.\n *\n * @return {Object} Extension parameters\n * @public\n */\n offer() {\n const params = {};\n\n if (this._options.serverNoContextTakeover) {\n params.server_no_context_takeover = true;\n }\n if (this._options.clientNoContextTakeover) {\n params.client_no_context_takeover = true;\n }\n if (this._options.serverMaxWindowBits) {\n params.server_max_window_bits = this._options.serverMaxWindowBits;\n }\n if (this._options.clientMaxWindowBits) {\n params.client_max_window_bits = this._options.clientMaxWindowBits;\n } else if (this._options.clientMaxWindowBits == null) {\n params.client_max_window_bits = true;\n }\n\n return params;\n }\n\n /**\n * Accept an extension negotiation offer/response.\n *\n * @param {Array} configurations The extension negotiation offers/reponse\n * @return {Object} Accepted configuration\n * @public\n */\n accept(configurations) {\n configurations = this.normalizeParams(configurations);\n\n this.params = this._isServer\n ? this.acceptAsServer(configurations)\n : this.acceptAsClient(configurations);\n\n return this.params;\n }\n\n /**\n * Releases all resources used by the extension.\n *\n * @public\n */\n cleanup() {\n if (this._inflate) {\n this._inflate.close();\n this._inflate = null;\n }\n\n if (this._deflate) {\n const callback = this._deflate[kCallback];\n\n this._deflate.close();\n this._deflate = null;\n\n if (callback) {\n callback(\n new Error(\n 'The deflate stream was closed while data was being processed'\n )\n );\n }\n }\n }\n\n /**\n * Accept an extension negotiation offer.\n *\n * @param {Array} offers The extension negotiation offers\n * @return {Object} Accepted configuration\n * @private\n */\n acceptAsServer(offers) {\n const opts = this._options;\n const accepted = offers.find((params) => {\n if (\n (opts.serverNoContextTakeover === false &&\n params.server_no_context_takeover) ||\n (params.server_max_window_bits &&\n (opts.serverMaxWindowBits === false ||\n (typeof opts.serverMaxWindowBits === 'number' &&\n opts.serverMaxWindowBits > params.server_max_window_bits))) ||\n (typeof opts.clientMaxWindowBits === 'number' &&\n !params.client_max_window_bits)\n ) {\n return false;\n }\n\n return true;\n });\n\n if (!accepted) {\n throw new Error('None of the extension offers can be accepted');\n }\n\n if (opts.serverNoContextTakeover) {\n accepted.server_no_context_takeover = true;\n }\n if (opts.clientNoContextTakeover) {\n accepted.client_no_context_takeover = true;\n }\n if (typeof opts.serverMaxWindowBits === 'number') {\n accepted.server_max_window_bits = opts.serverMaxWindowBits;\n }\n if (typeof opts.clientMaxWindowBits === 'number') {\n accepted.client_max_window_bits = opts.clientMaxWindowBits;\n } else if (\n accepted.client_max_window_bits === true ||\n opts.clientMaxWindowBits === false\n ) {\n delete accepted.client_max_window_bits;\n }\n\n return accepted;\n }\n\n /**\n * Accept the extension negotiation response.\n *\n * @param {Array} response The extension negotiation response\n * @return {Object} Accepted configuration\n * @private\n */\n acceptAsClient(response) {\n const params = response[0];\n\n if (\n this._options.clientNoContextTakeover === false &&\n params.client_no_context_takeover\n ) {\n throw new Error('Unexpected parameter \"client_no_context_takeover\"');\n }\n\n if (!params.client_max_window_bits) {\n if (typeof this._options.clientMaxWindowBits === 'number') {\n params.client_max_window_bits = this._options.clientMaxWindowBits;\n }\n } else if (\n this._options.clientMaxWindowBits === false ||\n (typeof this._options.clientMaxWindowBits === 'number' &&\n params.client_max_window_bits > this._options.clientMaxWindowBits)\n ) {\n throw new Error(\n 'Unexpected or invalid parameter \"client_max_window_bits\"'\n );\n }\n\n return params;\n }\n\n /**\n * Normalize parameters.\n *\n * @param {Array} configurations The extension negotiation offers/reponse\n * @return {Array} The offers/response with normalized parameters\n * @private\n */\n normalizeParams(configurations) {\n configurations.forEach((params) => {\n Object.keys(params).forEach((key) => {\n let value = params[key];\n\n if (value.length > 1) {\n throw new Error(`Parameter \"${key}\" must have only a single value`);\n }\n\n value = value[0];\n\n if (key === 'client_max_window_bits') {\n if (value !== true) {\n const num = +value;\n if (!Number.isInteger(num) || num < 8 || num > 15) {\n throw new TypeError(\n `Invalid value for parameter \"${key}\": ${value}`\n );\n }\n value = num;\n } else if (!this._isServer) {\n throw new TypeError(\n `Invalid value for parameter \"${key}\": ${value}`\n );\n }\n } else if (key === 'server_max_window_bits') {\n const num = +value;\n if (!Number.isInteger(num) || num < 8 || num > 15) {\n throw new TypeError(\n `Invalid value for parameter \"${key}\": ${value}`\n );\n }\n value = num;\n } else if (\n key === 'client_no_context_takeover' ||\n key === 'server_no_context_takeover'\n ) {\n if (value !== true) {\n throw new TypeError(\n `Invalid value for parameter \"${key}\": ${value}`\n );\n }\n } else {\n throw new Error(`Unknown parameter \"${key}\"`);\n }\n\n params[key] = value;\n });\n });\n\n return configurations;\n }\n\n /**\n * Decompress data. Concurrency limited.\n *\n * @param {Buffer} data Compressed data\n * @param {Boolean} fin Specifies whether or not this is the last fragment\n * @param {Function} callback Callback\n * @public\n */\n decompress(data, fin, callback) {\n zlibLimiter.add((done) => {\n this._decompress(data, fin, (err, result) => {\n done();\n callback(err, result);\n });\n });\n }\n\n /**\n * Compress data. Concurrency limited.\n *\n * @param {(Buffer|String)} data Data to compress\n * @param {Boolean} fin Specifies whether or not this is the last fragment\n * @param {Function} callback Callback\n * @public\n */\n compress(data, fin, callback) {\n zlibLimiter.add((done) => {\n this._compress(data, fin, (err, result) => {\n done();\n callback(err, result);\n });\n });\n }\n\n /**\n * Decompress data.\n *\n * @param {Buffer} data Compressed data\n * @param {Boolean} fin Specifies whether or not this is the last fragment\n * @param {Function} callback Callback\n * @private\n */\n _decompress(data, fin, callback) {\n const endpoint = this._isServer ? 'client' : 'server';\n\n if (!this._inflate) {\n const key = `${endpoint}_max_window_bits`;\n const windowBits =\n typeof this.params[key] !== 'number'\n ? zlib.Z_DEFAULT_WINDOWBITS\n : this.params[key];\n\n this._inflate = zlib.createInflateRaw({\n ...this._options.zlibInflateOptions,\n windowBits\n });\n this._inflate[kPerMessageDeflate] = this;\n this._inflate[kTotalLength] = 0;\n this._inflate[kBuffers] = [];\n this._inflate.on('error', inflateOnError);\n this._inflate.on('data', inflateOnData);\n }\n\n this._inflate[kCallback] = callback;\n\n this._inflate.write(data);\n if (fin) this._inflate.write(TRAILER);\n\n this._inflate.flush(() => {\n const err = this._inflate[kError];\n\n if (err) {\n this._inflate.close();\n this._inflate = null;\n callback(err);\n return;\n }\n\n const data = bufferUtil.concat(\n this._inflate[kBuffers],\n this._inflate[kTotalLength]\n );\n\n if (this._inflate._readableState.endEmitted) {\n this._inflate.close();\n this._inflate = null;\n } else {\n this._inflate[kTotalLength] = 0;\n this._inflate[kBuffers] = [];\n\n if (fin && this.params[`${endpoint}_no_context_takeover`]) {\n this._inflate.reset();\n }\n }\n\n callback(null, data);\n });\n }\n\n /**\n * Compress data.\n *\n * @param {(Buffer|String)} data Data to compress\n * @param {Boolean} fin Specifies whether or not this is the last fragment\n * @param {Function} callback Callback\n * @private\n */\n _compress(data, fin, callback) {\n const endpoint = this._isServer ? 'server' : 'client';\n\n if (!this._deflate) {\n const key = `${endpoint}_max_window_bits`;\n const windowBits =\n typeof this.params[key] !== 'number'\n ? zlib.Z_DEFAULT_WINDOWBITS\n : this.params[key];\n\n this._deflate = zlib.createDeflateRaw({\n ...this._options.zlibDeflateOptions,\n windowBits\n });\n\n this._deflate[kTotalLength] = 0;\n this._deflate[kBuffers] = [];\n\n this._deflate.on('data', deflateOnData);\n }\n\n this._deflate[kCallback] = callback;\n\n this._deflate.write(data);\n this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {\n if (!this._deflate) {\n //\n // The deflate stream was closed while data was being processed.\n //\n return;\n }\n\n let data = bufferUtil.concat(\n this._deflate[kBuffers],\n this._deflate[kTotalLength]\n );\n\n if (fin) {\n data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4);\n }\n\n //\n // Ensure that the callback will not be called again in\n // `PerMessageDeflate#cleanup()`.\n //\n this._deflate[kCallback] = null;\n\n this._deflate[kTotalLength] = 0;\n this._deflate[kBuffers] = [];\n\n if (fin && this.params[`${endpoint}_no_context_takeover`]) {\n this._deflate.reset();\n }\n\n callback(null, data);\n });\n }\n}\n\nmodule.exports = PerMessageDeflate;\n\n/**\n * The listener of the `zlib.DeflateRaw` stream `'data'` event.\n *\n * @param {Buffer} chunk A chunk of data\n * @private\n */\nfunction deflateOnData(chunk) {\n this[kBuffers].push(chunk);\n this[kTotalLength] += chunk.length;\n}\n\n/**\n * The listener of the `zlib.InflateRaw` stream `'data'` event.\n *\n * @param {Buffer} chunk A chunk of data\n * @private\n */\nfunction inflateOnData(chunk) {\n this[kTotalLength] += chunk.length;\n\n if (\n this[kPerMessageDeflate]._maxPayload < 1 ||\n this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload\n ) {\n this[kBuffers].push(chunk);\n return;\n }\n\n this[kError] = new RangeError('Max payload size exceeded');\n this[kError].code = 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH';\n this[kError][kStatusCode] = 1009;\n this.removeListener('data', inflateOnData);\n\n //\n // The choice to employ `zlib.reset()` over `zlib.close()` is dictated by the\n // fact that in Node.js versions prior to 13.10.0, the callback for\n // `zlib.flush()` is not called if `zlib.close()` is used. Utilizing\n // `zlib.reset()` ensures that either the callback is invoked or an error is\n // emitted.\n //\n this.reset();\n}\n\n/**\n * The listener of the `zlib.InflateRaw` stream `'error'` event.\n *\n * @param {Error} err The emitted error\n * @private\n */\nfunction inflateOnError(err) {\n //\n // There is no need to call `Zlib#close()` as the handle is automatically\n // closed when an error is emitted.\n //\n this[kPerMessageDeflate]._inflate = null;\n\n if (this[kError]) {\n this[kCallback](this[kError]);\n return;\n }\n\n err[kStatusCode] = 1007;\n this[kCallback](err);\n}\n","'use strict';\n\nconst { isUtf8 } = require('buffer');\n\nconst { hasBlob } = require('./constants');\n\n//\n// Allowed token characters:\n//\n// '!', '#', '$', '%', '&', ''', '*', '+', '-',\n// '.', 0-9, A-Z, '^', '_', '`', a-z, '|', '~'\n//\n// tokenChars[32] === 0 // ' '\n// tokenChars[33] === 1 // '!'\n// tokenChars[34] === 0 // '\"'\n// ...\n//\n// prettier-ignore\nconst tokenChars = [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31\n 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, // 32 - 47\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63\n 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, // 80 - 95\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111\n 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0 // 112 - 127\n];\n\n/**\n * Checks if a status code is allowed in a close frame.\n *\n * @param {Number} code The status code\n * @return {Boolean} `true` if the status code is valid, else `false`\n * @public\n */\nfunction isValidStatusCode(code) {\n return (\n (code >= 1000 &&\n code <= 1014 &&\n code !== 1004 &&\n code !== 1005 &&\n code !== 1006) ||\n (code >= 3000 && code <= 4999)\n );\n}\n\n/**\n * Checks if a given buffer contains only correct UTF-8.\n * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by\n * Markus Kuhn.\n *\n * @param {Buffer} buf The buffer to check\n * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`\n * @public\n */\nfunction _isValidUTF8(buf) {\n const len = buf.length;\n let i = 0;\n\n while (i < len) {\n if ((buf[i] & 0x80) === 0) {\n // 0xxxxxxx\n i++;\n } else if ((buf[i] & 0xe0) === 0xc0) {\n // 110xxxxx 10xxxxxx\n if (\n i + 1 === len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i] & 0xfe) === 0xc0 // Overlong\n ) {\n return false;\n }\n\n i += 2;\n } else if ((buf[i] & 0xf0) === 0xe0) {\n // 1110xxxx 10xxxxxx 10xxxxxx\n if (\n i + 2 >= len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i + 2] & 0xc0) !== 0x80 ||\n (buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80) || // Overlong\n (buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0) // Surrogate (U+D800 - U+DFFF)\n ) {\n return false;\n }\n\n i += 3;\n } else if ((buf[i] & 0xf8) === 0xf0) {\n // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n if (\n i + 3 >= len ||\n (buf[i + 1] & 0xc0) !== 0x80 ||\n (buf[i + 2] & 0xc0) !== 0x80 ||\n (buf[i + 3] & 0xc0) !== 0x80 ||\n (buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80) || // Overlong\n (buf[i] === 0xf4 && buf[i + 1] > 0x8f) ||\n buf[i] > 0xf4 // > U+10FFFF\n ) {\n return false;\n }\n\n i += 4;\n } else {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Determines whether a value is a `Blob`.\n *\n * @param {*} value The value to be tested\n * @return {Boolean} `true` if `value` is a `Blob`, else `false`\n * @private\n */\nfunction isBlob(value) {\n return (\n hasBlob &&\n typeof value === 'object' &&\n typeof value.arrayBuffer === 'function' &&\n typeof value.type === 'string' &&\n typeof value.stream === 'function' &&\n (value[Symbol.toStringTag] === 'Blob' ||\n value[Symbol.toStringTag] === 'File')\n );\n}\n\nmodule.exports = {\n isBlob,\n isValidStatusCode,\n isValidUTF8: _isValidUTF8,\n tokenChars\n};\n\nif (isUtf8) {\n module.exports.isValidUTF8 = function (buf) {\n return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);\n };\n} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) {\n try {\n const isValidUTF8 = require('utf-8-validate');\n\n module.exports.isValidUTF8 = function (buf) {\n return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);\n };\n } catch (e) {\n // Continue regardless of the error.\n }\n}\n","'use strict';\n\nconst { Writable } = require('stream');\n\nconst PerMessageDeflate = require('./permessage-deflate');\nconst {\n BINARY_TYPES,\n EMPTY_BUFFER,\n kStatusCode,\n kWebSocket\n} = require('./constants');\nconst { concat, toArrayBuffer, unmask } = require('./buffer-util');\nconst { isValidStatusCode, isValidUTF8 } = require('./validation');\n\nconst FastBuffer = Buffer[Symbol.species];\n\nconst GET_INFO = 0;\nconst GET_PAYLOAD_LENGTH_16 = 1;\nconst GET_PAYLOAD_LENGTH_64 = 2;\nconst GET_MASK = 3;\nconst GET_DATA = 4;\nconst INFLATING = 5;\nconst DEFER_EVENT = 6;\n\n/**\n * HyBi Receiver implementation.\n *\n * @extends Writable\n */\nclass Receiver extends Writable {\n /**\n * Creates a Receiver instance.\n *\n * @param {Object} [options] Options object\n * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether\n * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted\n * multiple times in the same tick\n * @param {String} [options.binaryType=nodebuffer] The type for binary data\n * @param {Object} [options.extensions] An object containing the negotiated\n * extensions\n * @param {Boolean} [options.isServer=false] Specifies whether to operate in\n * client or server mode\n * @param {Number} [options.maxPayload=0] The maximum allowed message length\n * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or\n * not to skip UTF-8 validation for text and close messages\n */\n constructor(options = {}) {\n super();\n\n this._allowSynchronousEvents =\n options.allowSynchronousEvents !== undefined\n ? options.allowSynchronousEvents\n : true;\n this._binaryType = options.binaryType || BINARY_TYPES[0];\n this._extensions = options.extensions || {};\n this._isServer = !!options.isServer;\n this._maxPayload = options.maxPayload | 0;\n this._skipUTF8Validation = !!options.skipUTF8Validation;\n this[kWebSocket] = undefined;\n\n this._bufferedBytes = 0;\n this._buffers = [];\n\n this._compressed = false;\n this._payloadLength = 0;\n this._mask = undefined;\n this._fragmented = 0;\n this._masked = false;\n this._fin = false;\n this._opcode = 0;\n\n this._totalPayloadLength = 0;\n this._messageLength = 0;\n this._fragments = [];\n\n this._errored = false;\n this._loop = false;\n this._state = GET_INFO;\n }\n\n /**\n * Implements `Writable.prototype._write()`.\n *\n * @param {Buffer} chunk The chunk of data to write\n * @param {String} encoding The character encoding of `chunk`\n * @param {Function} cb Callback\n * @private\n */\n _write(chunk, encoding, cb) {\n if (this._opcode === 0x08 && this._state == GET_INFO) return cb();\n\n this._bufferedBytes += chunk.length;\n this._buffers.push(chunk);\n this.startLoop(cb);\n }\n\n /**\n * Consumes `n` bytes from the buffered data.\n *\n * @param {Number} n The number of bytes to consume\n * @return {Buffer} The consumed bytes\n * @private\n */\n consume(n) {\n this._bufferedBytes -= n;\n\n if (n === this._buffers[0].length) return this._buffers.shift();\n\n if (n < this._buffers[0].length) {\n const buf = this._buffers[0];\n this._buffers[0] = new FastBuffer(\n buf.buffer,\n buf.byteOffset + n,\n buf.length - n\n );\n\n return new FastBuffer(buf.buffer, buf.byteOffset, n);\n }\n\n const dst = Buffer.allocUnsafe(n);\n\n do {\n const buf = this._buffers[0];\n const offset = dst.length - n;\n\n if (n >= buf.length) {\n dst.set(this._buffers.shift(), offset);\n } else {\n dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);\n this._buffers[0] = new FastBuffer(\n buf.buffer,\n buf.byteOffset + n,\n buf.length - n\n );\n }\n\n n -= buf.length;\n } while (n > 0);\n\n return dst;\n }\n\n /**\n * Starts the parsing loop.\n *\n * @param {Function} cb Callback\n * @private\n */\n startLoop(cb) {\n this._loop = true;\n\n do {\n switch (this._state) {\n case GET_INFO:\n this.getInfo(cb);\n break;\n case GET_PAYLOAD_LENGTH_16:\n this.getPayloadLength16(cb);\n break;\n case GET_PAYLOAD_LENGTH_64:\n this.getPayloadLength64(cb);\n break;\n case GET_MASK:\n this.getMask();\n break;\n case GET_DATA:\n this.getData(cb);\n break;\n case INFLATING:\n case DEFER_EVENT:\n this._loop = false;\n return;\n }\n } while (this._loop);\n\n if (!this._errored) cb();\n }\n\n /**\n * Reads the first two bytes of a frame.\n *\n * @param {Function} cb Callback\n * @private\n */\n getInfo(cb) {\n if (this._bufferedBytes < 2) {\n this._loop = false;\n return;\n }\n\n const buf = this.consume(2);\n\n if ((buf[0] & 0x30) !== 0x00) {\n const error = this.createError(\n RangeError,\n 'RSV2 and RSV3 must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_RSV_2_3'\n );\n\n cb(error);\n return;\n }\n\n const compressed = (buf[0] & 0x40) === 0x40;\n\n if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {\n const error = this.createError(\n RangeError,\n 'RSV1 must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_RSV_1'\n );\n\n cb(error);\n return;\n }\n\n this._fin = (buf[0] & 0x80) === 0x80;\n this._opcode = buf[0] & 0x0f;\n this._payloadLength = buf[1] & 0x7f;\n\n if (this._opcode === 0x00) {\n if (compressed) {\n const error = this.createError(\n RangeError,\n 'RSV1 must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_RSV_1'\n );\n\n cb(error);\n return;\n }\n\n if (!this._fragmented) {\n const error = this.createError(\n RangeError,\n 'invalid opcode 0',\n true,\n 1002,\n 'WS_ERR_INVALID_OPCODE'\n );\n\n cb(error);\n return;\n }\n\n this._opcode = this._fragmented;\n } else if (this._opcode === 0x01 || this._opcode === 0x02) {\n if (this._fragmented) {\n const error = this.createError(\n RangeError,\n `invalid opcode ${this._opcode}`,\n true,\n 1002,\n 'WS_ERR_INVALID_OPCODE'\n );\n\n cb(error);\n return;\n }\n\n this._compressed = compressed;\n } else if (this._opcode > 0x07 && this._opcode < 0x0b) {\n if (!this._fin) {\n const error = this.createError(\n RangeError,\n 'FIN must be set',\n true,\n 1002,\n 'WS_ERR_EXPECTED_FIN'\n );\n\n cb(error);\n return;\n }\n\n if (compressed) {\n const error = this.createError(\n RangeError,\n 'RSV1 must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_RSV_1'\n );\n\n cb(error);\n return;\n }\n\n if (\n this._payloadLength > 0x7d ||\n (this._opcode === 0x08 && this._payloadLength === 1)\n ) {\n const error = this.createError(\n RangeError,\n `invalid payload length ${this._payloadLength}`,\n true,\n 1002,\n 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'\n );\n\n cb(error);\n return;\n }\n } else {\n const error = this.createError(\n RangeError,\n `invalid opcode ${this._opcode}`,\n true,\n 1002,\n 'WS_ERR_INVALID_OPCODE'\n );\n\n cb(error);\n return;\n }\n\n if (!this._fin && !this._fragmented) this._fragmented = this._opcode;\n this._masked = (buf[1] & 0x80) === 0x80;\n\n if (this._isServer) {\n if (!this._masked) {\n const error = this.createError(\n RangeError,\n 'MASK must be set',\n true,\n 1002,\n 'WS_ERR_EXPECTED_MASK'\n );\n\n cb(error);\n return;\n }\n } else if (this._masked) {\n const error = this.createError(\n RangeError,\n 'MASK must be clear',\n true,\n 1002,\n 'WS_ERR_UNEXPECTED_MASK'\n );\n\n cb(error);\n return;\n }\n\n if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;\n else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;\n else this.haveLength(cb);\n }\n\n /**\n * Gets extended payload length (7+16).\n *\n * @param {Function} cb Callback\n * @private\n */\n getPayloadLength16(cb) {\n if (this._bufferedBytes < 2) {\n this._loop = false;\n return;\n }\n\n this._payloadLength = this.consume(2).readUInt16BE(0);\n this.haveLength(cb);\n }\n\n /**\n * Gets extended payload length (7+64).\n *\n * @param {Function} cb Callback\n * @private\n */\n getPayloadLength64(cb) {\n if (this._bufferedBytes < 8) {\n this._loop = false;\n return;\n }\n\n const buf = this.consume(8);\n const num = buf.readUInt32BE(0);\n\n //\n // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned\n // if payload length is greater than this number.\n //\n if (num > Math.pow(2, 53 - 32) - 1) {\n const error = this.createError(\n RangeError,\n 'Unsupported WebSocket frame: payload length > 2^53 - 1',\n false,\n 1009,\n 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH'\n );\n\n cb(error);\n return;\n }\n\n this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);\n this.haveLength(cb);\n }\n\n /**\n * Payload length has been read.\n *\n * @param {Function} cb Callback\n * @private\n */\n haveLength(cb) {\n if (this._payloadLength && this._opcode < 0x08) {\n this._totalPayloadLength += this._payloadLength;\n if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {\n const error = this.createError(\n RangeError,\n 'Max payload size exceeded',\n false,\n 1009,\n 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'\n );\n\n cb(error);\n return;\n }\n }\n\n if (this._masked) this._state = GET_MASK;\n else this._state = GET_DATA;\n }\n\n /**\n * Reads mask bytes.\n *\n * @private\n */\n getMask() {\n if (this._bufferedBytes < 4) {\n this._loop = false;\n return;\n }\n\n this._mask = this.consume(4);\n this._state = GET_DATA;\n }\n\n /**\n * Reads data bytes.\n *\n * @param {Function} cb Callback\n * @private\n */\n getData(cb) {\n let data = EMPTY_BUFFER;\n\n if (this._payloadLength) {\n if (this._bufferedBytes < this._payloadLength) {\n this._loop = false;\n return;\n }\n\n data = this.consume(this._payloadLength);\n\n if (\n this._masked &&\n (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0\n ) {\n unmask(data, this._mask);\n }\n }\n\n if (this._opcode > 0x07) {\n this.controlMessage(data, cb);\n return;\n }\n\n if (this._compressed) {\n this._state = INFLATING;\n this.decompress(data, cb);\n return;\n }\n\n if (data.length) {\n //\n // This message is not compressed so its length is the sum of the payload\n // length of all fragments.\n //\n this._messageLength = this._totalPayloadLength;\n this._fragments.push(data);\n }\n\n this.dataMessage(cb);\n }\n\n /**\n * Decompresses data.\n *\n * @param {Buffer} data Compressed data\n * @param {Function} cb Callback\n * @private\n */\n decompress(data, cb) {\n const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];\n\n perMessageDeflate.decompress(data, this._fin, (err, buf) => {\n if (err) return cb(err);\n\n if (buf.length) {\n this._messageLength += buf.length;\n if (this._messageLength > this._maxPayload && this._maxPayload > 0) {\n const error = this.createError(\n RangeError,\n 'Max payload size exceeded',\n false,\n 1009,\n 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'\n );\n\n cb(error);\n return;\n }\n\n this._fragments.push(buf);\n }\n\n this.dataMessage(cb);\n if (this._state === GET_INFO) this.startLoop(cb);\n });\n }\n\n /**\n * Handles a data message.\n *\n * @param {Function} cb Callback\n * @private\n */\n dataMessage(cb) {\n if (!this._fin) {\n this._state = GET_INFO;\n return;\n }\n\n const messageLength = this._messageLength;\n const fragments = this._fragments;\n\n this._totalPayloadLength = 0;\n this._messageLength = 0;\n this._fragmented = 0;\n this._fragments = [];\n\n if (this._opcode === 2) {\n let data;\n\n if (this._binaryType === 'nodebuffer') {\n data = concat(fragments, messageLength);\n } else if (this._binaryType === 'arraybuffer') {\n data = toArrayBuffer(concat(fragments, messageLength));\n } else if (this._binaryType === 'blob') {\n data = new Blob(fragments);\n } else {\n data = fragments;\n }\n\n if (this._allowSynchronousEvents) {\n this.emit('message', data, true);\n this._state = GET_INFO;\n } else {\n this._state = DEFER_EVENT;\n setImmediate(() => {\n this.emit('message', data, true);\n this._state = GET_INFO;\n this.startLoop(cb);\n });\n }\n } else {\n const buf = concat(fragments, messageLength);\n\n if (!this._skipUTF8Validation && !isValidUTF8(buf)) {\n const error = this.createError(\n Error,\n 'invalid UTF-8 sequence',\n true,\n 1007,\n 'WS_ERR_INVALID_UTF8'\n );\n\n cb(error);\n return;\n }\n\n if (this._state === INFLATING || this._allowSynchronousEvents) {\n this.emit('message', buf, false);\n this._state = GET_INFO;\n } else {\n this._state = DEFER_EVENT;\n setImmediate(() => {\n this.emit('message', buf, false);\n this._state = GET_INFO;\n this.startLoop(cb);\n });\n }\n }\n }\n\n /**\n * Handles a control message.\n *\n * @param {Buffer} data Data to handle\n * @return {(Error|RangeError|undefined)} A possible error\n * @private\n */\n controlMessage(data, cb) {\n if (this._opcode === 0x08) {\n if (data.length === 0) {\n this._loop = false;\n this.emit('conclude', 1005, EMPTY_BUFFER);\n this.end();\n } else {\n const code = data.readUInt16BE(0);\n\n if (!isValidStatusCode(code)) {\n const error = this.createError(\n RangeError,\n `invalid status code ${code}`,\n true,\n 1002,\n 'WS_ERR_INVALID_CLOSE_CODE'\n );\n\n cb(error);\n return;\n }\n\n const buf = new FastBuffer(\n data.buffer,\n data.byteOffset + 2,\n data.length - 2\n );\n\n if (!this._skipUTF8Validation && !isValidUTF8(buf)) {\n const error = this.createError(\n Error,\n 'invalid UTF-8 sequence',\n true,\n 1007,\n 'WS_ERR_INVALID_UTF8'\n );\n\n cb(error);\n return;\n }\n\n this._loop = false;\n this.emit('conclude', code, buf);\n this.end();\n }\n\n this._state = GET_INFO;\n return;\n }\n\n if (this._allowSynchronousEvents) {\n this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);\n this._state = GET_INFO;\n } else {\n this._state = DEFER_EVENT;\n setImmediate(() => {\n this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);\n this._state = GET_INFO;\n this.startLoop(cb);\n });\n }\n }\n\n /**\n * Builds an error object.\n *\n * @param {function(new:Error|RangeError)} ErrorCtor The error constructor\n * @param {String} message The error message\n * @param {Boolean} prefix Specifies whether or not to add a default prefix to\n * `message`\n * @param {Number} statusCode The status code\n * @param {String} errorCode The exposed error code\n * @return {(Error|RangeError)} The error\n * @private\n */\n createError(ErrorCtor, message, prefix, statusCode, errorCode) {\n this._loop = false;\n this._errored = true;\n\n const err = new ErrorCtor(\n prefix ? `Invalid WebSocket frame: ${message}` : message\n );\n\n Error.captureStackTrace(err, this.createError);\n err.code = errorCode;\n err[kStatusCode] = statusCode;\n return err;\n }\n}\n\nmodule.exports = Receiver;\n","/* eslint no-unused-vars: [\"error\", { \"varsIgnorePattern\": \"^Duplex\" }] */\n\n'use strict';\n\nconst { Duplex } = require('stream');\nconst { randomFillSync } = require('crypto');\n\nconst PerMessageDeflate = require('./permessage-deflate');\nconst { EMPTY_BUFFER, kWebSocket, NOOP } = require('./constants');\nconst { isBlob, isValidStatusCode } = require('./validation');\nconst { mask: applyMask, toBuffer } = require('./buffer-util');\n\nconst kByteLength = Symbol('kByteLength');\nconst maskBuffer = Buffer.alloc(4);\nconst RANDOM_POOL_SIZE = 8 * 1024;\nlet randomPool;\nlet randomPoolPointer = RANDOM_POOL_SIZE;\n\nconst DEFAULT = 0;\nconst DEFLATING = 1;\nconst GET_BLOB_DATA = 2;\n\n/**\n * HyBi Sender implementation.\n */\nclass Sender {\n /**\n * Creates a Sender instance.\n *\n * @param {Duplex} socket The connection socket\n * @param {Object} [extensions] An object containing the negotiated extensions\n * @param {Function} [generateMask] The function used to generate the masking\n * key\n */\n constructor(socket, extensions, generateMask) {\n this._extensions = extensions || {};\n\n if (generateMask) {\n this._generateMask = generateMask;\n this._maskBuffer = Buffer.alloc(4);\n }\n\n this._socket = socket;\n\n this._firstFragment = true;\n this._compress = false;\n\n this._bufferedBytes = 0;\n this._queue = [];\n this._state = DEFAULT;\n this.onerror = NOOP;\n this[kWebSocket] = undefined;\n }\n\n /**\n * Frames a piece of data according to the HyBi WebSocket protocol.\n *\n * @param {(Buffer|String)} data The data to frame\n * @param {Object} options Options object\n * @param {Boolean} [options.fin=false] Specifies whether or not to set the\n * FIN bit\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Boolean} [options.mask=false] Specifies whether or not to mask\n * `data`\n * @param {Buffer} [options.maskBuffer] The buffer used to store the masking\n * key\n * @param {Number} options.opcode The opcode\n * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be\n * modified\n * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the\n * RSV1 bit\n * @return {(Buffer|String)[]} The framed data\n * @public\n */\n static frame(data, options) {\n let mask;\n let merge = false;\n let offset = 2;\n let skipMasking = false;\n\n if (options.mask) {\n mask = options.maskBuffer || maskBuffer;\n\n if (options.generateMask) {\n options.generateMask(mask);\n } else {\n if (randomPoolPointer === RANDOM_POOL_SIZE) {\n /* istanbul ignore else */\n if (randomPool === undefined) {\n //\n // This is lazily initialized because server-sent frames must not\n // be masked so it may never be used.\n //\n randomPool = Buffer.alloc(RANDOM_POOL_SIZE);\n }\n\n randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);\n randomPoolPointer = 0;\n }\n\n mask[0] = randomPool[randomPoolPointer++];\n mask[1] = randomPool[randomPoolPointer++];\n mask[2] = randomPool[randomPoolPointer++];\n mask[3] = randomPool[randomPoolPointer++];\n }\n\n skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;\n offset = 6;\n }\n\n let dataLength;\n\n if (typeof data === 'string') {\n if (\n (!options.mask || skipMasking) &&\n options[kByteLength] !== undefined\n ) {\n dataLength = options[kByteLength];\n } else {\n data = Buffer.from(data);\n dataLength = data.length;\n }\n } else {\n dataLength = data.length;\n merge = options.mask && options.readOnly && !skipMasking;\n }\n\n let payloadLength = dataLength;\n\n if (dataLength >= 65536) {\n offset += 8;\n payloadLength = 127;\n } else if (dataLength > 125) {\n offset += 2;\n payloadLength = 126;\n }\n\n const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);\n\n target[0] = options.fin ? options.opcode | 0x80 : options.opcode;\n if (options.rsv1) target[0] |= 0x40;\n\n target[1] = payloadLength;\n\n if (payloadLength === 126) {\n target.writeUInt16BE(dataLength, 2);\n } else if (payloadLength === 127) {\n target[2] = target[3] = 0;\n target.writeUIntBE(dataLength, 4, 6);\n }\n\n if (!options.mask) return [target, data];\n\n target[1] |= 0x80;\n target[offset - 4] = mask[0];\n target[offset - 3] = mask[1];\n target[offset - 2] = mask[2];\n target[offset - 1] = mask[3];\n\n if (skipMasking) return [target, data];\n\n if (merge) {\n applyMask(data, mask, target, offset, dataLength);\n return [target];\n }\n\n applyMask(data, mask, data, 0, dataLength);\n return [target, data];\n }\n\n /**\n * Sends a close message to the other peer.\n *\n * @param {Number} [code] The status code component of the body\n * @param {(String|Buffer)} [data] The message component of the body\n * @param {Boolean} [mask=false] Specifies whether or not to mask the message\n * @param {Function} [cb] Callback\n * @public\n */\n close(code, data, mask, cb) {\n let buf;\n\n if (code === undefined) {\n buf = EMPTY_BUFFER;\n } else if (typeof code !== 'number' || !isValidStatusCode(code)) {\n throw new TypeError('First argument must be a valid error code number');\n } else if (data === undefined || !data.length) {\n buf = Buffer.allocUnsafe(2);\n buf.writeUInt16BE(code, 0);\n } else {\n const length = Buffer.byteLength(data);\n\n if (length > 123) {\n throw new RangeError('The message must not be greater than 123 bytes');\n }\n\n buf = Buffer.allocUnsafe(2 + length);\n buf.writeUInt16BE(code, 0);\n\n if (typeof data === 'string') {\n buf.write(data, 2);\n } else {\n buf.set(data, 2);\n }\n }\n\n const options = {\n [kByteLength]: buf.length,\n fin: true,\n generateMask: this._generateMask,\n mask,\n maskBuffer: this._maskBuffer,\n opcode: 0x08,\n readOnly: false,\n rsv1: false\n };\n\n if (this._state !== DEFAULT) {\n this.enqueue([this.dispatch, buf, false, options, cb]);\n } else {\n this.sendFrame(Sender.frame(buf, options), cb);\n }\n }\n\n /**\n * Sends a ping message to the other peer.\n *\n * @param {*} data The message to send\n * @param {Boolean} [mask=false] Specifies whether or not to mask `data`\n * @param {Function} [cb] Callback\n * @public\n */\n ping(data, mask, cb) {\n let byteLength;\n let readOnly;\n\n if (typeof data === 'string') {\n byteLength = Buffer.byteLength(data);\n readOnly = false;\n } else if (isBlob(data)) {\n byteLength = data.size;\n readOnly = false;\n } else {\n data = toBuffer(data);\n byteLength = data.length;\n readOnly = toBuffer.readOnly;\n }\n\n if (byteLength > 125) {\n throw new RangeError('The data size must not be greater than 125 bytes');\n }\n\n const options = {\n [kByteLength]: byteLength,\n fin: true,\n generateMask: this._generateMask,\n mask,\n maskBuffer: this._maskBuffer,\n opcode: 0x09,\n readOnly,\n rsv1: false\n };\n\n if (isBlob(data)) {\n if (this._state !== DEFAULT) {\n this.enqueue([this.getBlobData, data, false, options, cb]);\n } else {\n this.getBlobData(data, false, options, cb);\n }\n } else if (this._state !== DEFAULT) {\n this.enqueue([this.dispatch, data, false, options, cb]);\n } else {\n this.sendFrame(Sender.frame(data, options), cb);\n }\n }\n\n /**\n * Sends a pong message to the other peer.\n *\n * @param {*} data The message to send\n * @param {Boolean} [mask=false] Specifies whether or not to mask `data`\n * @param {Function} [cb] Callback\n * @public\n */\n pong(data, mask, cb) {\n let byteLength;\n let readOnly;\n\n if (typeof data === 'string') {\n byteLength = Buffer.byteLength(data);\n readOnly = false;\n } else if (isBlob(data)) {\n byteLength = data.size;\n readOnly = false;\n } else {\n data = toBuffer(data);\n byteLength = data.length;\n readOnly = toBuffer.readOnly;\n }\n\n if (byteLength > 125) {\n throw new RangeError('The data size must not be greater than 125 bytes');\n }\n\n const options = {\n [kByteLength]: byteLength,\n fin: true,\n generateMask: this._generateMask,\n mask,\n maskBuffer: this._maskBuffer,\n opcode: 0x0a,\n readOnly,\n rsv1: false\n };\n\n if (isBlob(data)) {\n if (this._state !== DEFAULT) {\n this.enqueue([this.getBlobData, data, false, options, cb]);\n } else {\n this.getBlobData(data, false, options, cb);\n }\n } else if (this._state !== DEFAULT) {\n this.enqueue([this.dispatch, data, false, options, cb]);\n } else {\n this.sendFrame(Sender.frame(data, options), cb);\n }\n }\n\n /**\n * Sends a data message to the other peer.\n *\n * @param {*} data The message to send\n * @param {Object} options Options object\n * @param {Boolean} [options.binary=false] Specifies whether `data` is binary\n * or text\n * @param {Boolean} [options.compress=false] Specifies whether or not to\n * compress `data`\n * @param {Boolean} [options.fin=false] Specifies whether the fragment is the\n * last one\n * @param {Boolean} [options.mask=false] Specifies whether or not to mask\n * `data`\n * @param {Function} [cb] Callback\n * @public\n */\n send(data, options, cb) {\n const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];\n let opcode = options.binary ? 2 : 1;\n let rsv1 = options.compress;\n\n let byteLength;\n let readOnly;\n\n if (typeof data === 'string') {\n byteLength = Buffer.byteLength(data);\n readOnly = false;\n } else if (isBlob(data)) {\n byteLength = data.size;\n readOnly = false;\n } else {\n data = toBuffer(data);\n byteLength = data.length;\n readOnly = toBuffer.readOnly;\n }\n\n if (this._firstFragment) {\n this._firstFragment = false;\n if (\n rsv1 &&\n perMessageDeflate &&\n perMessageDeflate.params[\n perMessageDeflate._isServer\n ? 'server_no_context_takeover'\n : 'client_no_context_takeover'\n ]\n ) {\n rsv1 = byteLength >= perMessageDeflate._threshold;\n }\n this._compress = rsv1;\n } else {\n rsv1 = false;\n opcode = 0;\n }\n\n if (options.fin) this._firstFragment = true;\n\n const opts = {\n [kByteLength]: byteLength,\n fin: options.fin,\n generateMask: this._generateMask,\n mask: options.mask,\n maskBuffer: this._maskBuffer,\n opcode,\n readOnly,\n rsv1\n };\n\n if (isBlob(data)) {\n if (this._state !== DEFAULT) {\n this.enqueue([this.getBlobData, data, this._compress, opts, cb]);\n } else {\n this.getBlobData(data, this._compress, opts, cb);\n }\n } else if (this._state !== DEFAULT) {\n this.enqueue([this.dispatch, data, this._compress, opts, cb]);\n } else {\n this.dispatch(data, this._compress, opts, cb);\n }\n }\n\n /**\n * Gets the contents of a blob as binary data.\n *\n * @param {Blob} blob The blob\n * @param {Boolean} [compress=false] Specifies whether or not to compress\n * the data\n * @param {Object} options Options object\n * @param {Boolean} [options.fin=false] Specifies whether or not to set the\n * FIN bit\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Boolean} [options.mask=false] Specifies whether or not to mask\n * `data`\n * @param {Buffer} [options.maskBuffer] The buffer used to store the masking\n * key\n * @param {Number} options.opcode The opcode\n * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be\n * modified\n * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the\n * RSV1 bit\n * @param {Function} [cb] Callback\n * @private\n */\n getBlobData(blob, compress, options, cb) {\n this._bufferedBytes += options[kByteLength];\n this._state = GET_BLOB_DATA;\n\n blob\n .arrayBuffer()\n .then((arrayBuffer) => {\n if (this._socket.destroyed) {\n const err = new Error(\n 'The socket was closed while the blob was being read'\n );\n\n //\n // `callCallbacks` is called in the next tick to ensure that errors\n // that might be thrown in the callbacks behave like errors thrown\n // outside the promise chain.\n //\n process.nextTick(callCallbacks, this, err, cb);\n return;\n }\n\n this._bufferedBytes -= options[kByteLength];\n const data = toBuffer(arrayBuffer);\n\n if (!compress) {\n this._state = DEFAULT;\n this.sendFrame(Sender.frame(data, options), cb);\n this.dequeue();\n } else {\n this.dispatch(data, compress, options, cb);\n }\n })\n .catch((err) => {\n //\n // `onError` is called in the next tick for the same reason that\n // `callCallbacks` above is.\n //\n process.nextTick(onError, this, err, cb);\n });\n }\n\n /**\n * Dispatches a message.\n *\n * @param {(Buffer|String)} data The message to send\n * @param {Boolean} [compress=false] Specifies whether or not to compress\n * `data`\n * @param {Object} options Options object\n * @param {Boolean} [options.fin=false] Specifies whether or not to set the\n * FIN bit\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Boolean} [options.mask=false] Specifies whether or not to mask\n * `data`\n * @param {Buffer} [options.maskBuffer] The buffer used to store the masking\n * key\n * @param {Number} options.opcode The opcode\n * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be\n * modified\n * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the\n * RSV1 bit\n * @param {Function} [cb] Callback\n * @private\n */\n dispatch(data, compress, options, cb) {\n if (!compress) {\n this.sendFrame(Sender.frame(data, options), cb);\n return;\n }\n\n const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];\n\n this._bufferedBytes += options[kByteLength];\n this._state = DEFLATING;\n perMessageDeflate.compress(data, options.fin, (_, buf) => {\n if (this._socket.destroyed) {\n const err = new Error(\n 'The socket was closed while data was being compressed'\n );\n\n callCallbacks(this, err, cb);\n return;\n }\n\n this._bufferedBytes -= options[kByteLength];\n this._state = DEFAULT;\n options.readOnly = false;\n this.sendFrame(Sender.frame(buf, options), cb);\n this.dequeue();\n });\n }\n\n /**\n * Executes queued send operations.\n *\n * @private\n */\n dequeue() {\n while (this._state === DEFAULT && this._queue.length) {\n const params = this._queue.shift();\n\n this._bufferedBytes -= params[3][kByteLength];\n Reflect.apply(params[0], this, params.slice(1));\n }\n }\n\n /**\n * Enqueues a send operation.\n *\n * @param {Array} params Send operation parameters.\n * @private\n */\n enqueue(params) {\n this._bufferedBytes += params[3][kByteLength];\n this._queue.push(params);\n }\n\n /**\n * Sends a frame.\n *\n * @param {(Buffer | String)[]} list The frame to send\n * @param {Function} [cb] Callback\n * @private\n */\n sendFrame(list, cb) {\n if (list.length === 2) {\n this._socket.cork();\n this._socket.write(list[0]);\n this._socket.write(list[1], cb);\n this._socket.uncork();\n } else {\n this._socket.write(list[0], cb);\n }\n }\n}\n\nmodule.exports = Sender;\n\n/**\n * Calls queued callbacks with an error.\n *\n * @param {Sender} sender The `Sender` instance\n * @param {Error} err The error to call the callbacks with\n * @param {Function} [cb] The first callback\n * @private\n */\nfunction callCallbacks(sender, err, cb) {\n if (typeof cb === 'function') cb(err);\n\n for (let i = 0; i < sender._queue.length; i++) {\n const params = sender._queue[i];\n const callback = params[params.length - 1];\n\n if (typeof callback === 'function') callback(err);\n }\n}\n\n/**\n * Handles a `Sender` error.\n *\n * @param {Sender} sender The `Sender` instance\n * @param {Error} err The error\n * @param {Function} [cb] The first pending callback\n * @private\n */\nfunction onError(sender, err, cb) {\n callCallbacks(sender, err, cb);\n sender.onerror(err);\n}\n","'use strict';\n\nconst { kForOnEventAttribute, kListener } = require('./constants');\n\nconst kCode = Symbol('kCode');\nconst kData = Symbol('kData');\nconst kError = Symbol('kError');\nconst kMessage = Symbol('kMessage');\nconst kReason = Symbol('kReason');\nconst kTarget = Symbol('kTarget');\nconst kType = Symbol('kType');\nconst kWasClean = Symbol('kWasClean');\n\n/**\n * Class representing an event.\n */\nclass Event {\n /**\n * Create a new `Event`.\n *\n * @param {String} type The name of the event\n * @throws {TypeError} If the `type` argument is not specified\n */\n constructor(type) {\n this[kTarget] = null;\n this[kType] = type;\n }\n\n /**\n * @type {*}\n */\n get target() {\n return this[kTarget];\n }\n\n /**\n * @type {String}\n */\n get type() {\n return this[kType];\n }\n}\n\nObject.defineProperty(Event.prototype, 'target', { enumerable: true });\nObject.defineProperty(Event.prototype, 'type', { enumerable: true });\n\n/**\n * Class representing a close event.\n *\n * @extends Event\n */\nclass CloseEvent extends Event {\n /**\n * Create a new `CloseEvent`.\n *\n * @param {String} type The name of the event\n * @param {Object} [options] A dictionary object that allows for setting\n * attributes via object members of the same name\n * @param {Number} [options.code=0] The status code explaining why the\n * connection was closed\n * @param {String} [options.reason=''] A human-readable string explaining why\n * the connection was closed\n * @param {Boolean} [options.wasClean=false] Indicates whether or not the\n * connection was cleanly closed\n */\n constructor(type, options = {}) {\n super(type);\n\n this[kCode] = options.code === undefined ? 0 : options.code;\n this[kReason] = options.reason === undefined ? '' : options.reason;\n this[kWasClean] = options.wasClean === undefined ? false : options.wasClean;\n }\n\n /**\n * @type {Number}\n */\n get code() {\n return this[kCode];\n }\n\n /**\n * @type {String}\n */\n get reason() {\n return this[kReason];\n }\n\n /**\n * @type {Boolean}\n */\n get wasClean() {\n return this[kWasClean];\n }\n}\n\nObject.defineProperty(CloseEvent.prototype, 'code', { enumerable: true });\nObject.defineProperty(CloseEvent.prototype, 'reason', { enumerable: true });\nObject.defineProperty(CloseEvent.prototype, 'wasClean', { enumerable: true });\n\n/**\n * Class representing an error event.\n *\n * @extends Event\n */\nclass ErrorEvent extends Event {\n /**\n * Create a new `ErrorEvent`.\n *\n * @param {String} type The name of the event\n * @param {Object} [options] A dictionary object that allows for setting\n * attributes via object members of the same name\n * @param {*} [options.error=null] The error that generated this event\n * @param {String} [options.message=''] The error message\n */\n constructor(type, options = {}) {\n super(type);\n\n this[kError] = options.error === undefined ? null : options.error;\n this[kMessage] = options.message === undefined ? '' : options.message;\n }\n\n /**\n * @type {*}\n */\n get error() {\n return this[kError];\n }\n\n /**\n * @type {String}\n */\n get message() {\n return this[kMessage];\n }\n}\n\nObject.defineProperty(ErrorEvent.prototype, 'error', { enumerable: true });\nObject.defineProperty(ErrorEvent.prototype, 'message', { enumerable: true });\n\n/**\n * Class representing a message event.\n *\n * @extends Event\n */\nclass MessageEvent extends Event {\n /**\n * Create a new `MessageEvent`.\n *\n * @param {String} type The name of the event\n * @param {Object} [options] A dictionary object that allows for setting\n * attributes via object members of the same name\n * @param {*} [options.data=null] The message content\n */\n constructor(type, options = {}) {\n super(type);\n\n this[kData] = options.data === undefined ? null : options.data;\n }\n\n /**\n * @type {*}\n */\n get data() {\n return this[kData];\n }\n}\n\nObject.defineProperty(MessageEvent.prototype, 'data', { enumerable: true });\n\n/**\n * This provides methods for emulating the `EventTarget` interface. It's not\n * meant to be used directly.\n *\n * @mixin\n */\nconst EventTarget = {\n /**\n * Register an event listener.\n *\n * @param {String} type A string representing the event type to listen for\n * @param {(Function|Object)} handler The listener to add\n * @param {Object} [options] An options object specifies characteristics about\n * the event listener\n * @param {Boolean} [options.once=false] A `Boolean` indicating that the\n * listener should be invoked at most once after being added. If `true`,\n * the listener would be automatically removed when invoked.\n * @public\n */\n addEventListener(type, handler, options = {}) {\n for (const listener of this.listeners(type)) {\n if (\n !options[kForOnEventAttribute] &&\n listener[kListener] === handler &&\n !listener[kForOnEventAttribute]\n ) {\n return;\n }\n }\n\n let wrapper;\n\n if (type === 'message') {\n wrapper = function onMessage(data, isBinary) {\n const event = new MessageEvent('message', {\n data: isBinary ? data : data.toString()\n });\n\n event[kTarget] = this;\n callListener(handler, this, event);\n };\n } else if (type === 'close') {\n wrapper = function onClose(code, message) {\n const event = new CloseEvent('close', {\n code,\n reason: message.toString(),\n wasClean: this._closeFrameReceived && this._closeFrameSent\n });\n\n event[kTarget] = this;\n callListener(handler, this, event);\n };\n } else if (type === 'error') {\n wrapper = function onError(error) {\n const event = new ErrorEvent('error', {\n error,\n message: error.message\n });\n\n event[kTarget] = this;\n callListener(handler, this, event);\n };\n } else if (type === 'open') {\n wrapper = function onOpen() {\n const event = new Event('open');\n\n event[kTarget] = this;\n callListener(handler, this, event);\n };\n } else {\n return;\n }\n\n wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];\n wrapper[kListener] = handler;\n\n if (options.once) {\n this.once(type, wrapper);\n } else {\n this.on(type, wrapper);\n }\n },\n\n /**\n * Remove an event listener.\n *\n * @param {String} type A string representing the event type to remove\n * @param {(Function|Object)} handler The listener to remove\n * @public\n */\n removeEventListener(type, handler) {\n for (const listener of this.listeners(type)) {\n if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {\n this.removeListener(type, listener);\n break;\n }\n }\n }\n};\n\nmodule.exports = {\n CloseEvent,\n ErrorEvent,\n Event,\n EventTarget,\n MessageEvent\n};\n\n/**\n * Call an event listener\n *\n * @param {(Function|Object)} listener The listener to call\n * @param {*} thisArg The value to use as `this`` when calling the listener\n * @param {Event} event The event to pass to the listener\n * @private\n */\nfunction callListener(listener, thisArg, event) {\n if (typeof listener === 'object' && listener.handleEvent) {\n listener.handleEvent.call(listener, event);\n } else {\n listener.call(thisArg, event);\n }\n}\n","'use strict';\n\nconst { tokenChars } = require('./validation');\n\n/**\n * Adds an offer to the map of extension offers or a parameter to the map of\n * parameters.\n *\n * @param {Object} dest The map of extension offers or parameters\n * @param {String} name The extension or parameter name\n * @param {(Object|Boolean|String)} elem The extension parameters or the\n * parameter value\n * @private\n */\nfunction push(dest, name, elem) {\n if (dest[name] === undefined) dest[name] = [elem];\n else dest[name].push(elem);\n}\n\n/**\n * Parses the `Sec-WebSocket-Extensions` header into an object.\n *\n * @param {String} header The field value of the header\n * @return {Object} The parsed object\n * @public\n */\nfunction parse(header) {\n const offers = Object.create(null);\n let params = Object.create(null);\n let mustUnescape = false;\n let isEscaping = false;\n let inQuotes = false;\n let extensionName;\n let paramName;\n let start = -1;\n let code = -1;\n let end = -1;\n let i = 0;\n\n for (; i < header.length; i++) {\n code = header.charCodeAt(i);\n\n if (extensionName === undefined) {\n if (end === -1 && tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (\n i !== 0 &&\n (code === 0x20 /* ' ' */ || code === 0x09) /* '\\t' */\n ) {\n if (end === -1 && start !== -1) end = i;\n } else if (code === 0x3b /* ';' */ || code === 0x2c /* ',' */) {\n if (start === -1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n\n if (end === -1) end = i;\n const name = header.slice(start, end);\n if (code === 0x2c) {\n push(offers, name, params);\n params = Object.create(null);\n } else {\n extensionName = name;\n }\n\n start = end = -1;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n } else if (paramName === undefined) {\n if (end === -1 && tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (code === 0x20 || code === 0x09) {\n if (end === -1 && start !== -1) end = i;\n } else if (code === 0x3b || code === 0x2c) {\n if (start === -1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n\n if (end === -1) end = i;\n push(params, header.slice(start, end), true);\n if (code === 0x2c) {\n push(offers, extensionName, params);\n params = Object.create(null);\n extensionName = undefined;\n }\n\n start = end = -1;\n } else if (code === 0x3d /* '=' */ && start !== -1 && end === -1) {\n paramName = header.slice(start, i);\n start = end = -1;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n } else {\n //\n // The value of a quoted-string after unescaping must conform to the\n // token ABNF, so only token characters are valid.\n // Ref: https://tools.ietf.org/html/rfc6455#section-9.1\n //\n if (isEscaping) {\n if (tokenChars[code] !== 1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n if (start === -1) start = i;\n else if (!mustUnescape) mustUnescape = true;\n isEscaping = false;\n } else if (inQuotes) {\n if (tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (code === 0x22 /* '\"' */ && start !== -1) {\n inQuotes = false;\n end = i;\n } else if (code === 0x5c /* '\\' */) {\n isEscaping = true;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n } else if (code === 0x22 && header.charCodeAt(i - 1) === 0x3d) {\n inQuotes = true;\n } else if (end === -1 && tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (start !== -1 && (code === 0x20 || code === 0x09)) {\n if (end === -1) end = i;\n } else if (code === 0x3b || code === 0x2c) {\n if (start === -1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n\n if (end === -1) end = i;\n let value = header.slice(start, end);\n if (mustUnescape) {\n value = value.replace(/\\\\/g, '');\n mustUnescape = false;\n }\n push(params, paramName, value);\n if (code === 0x2c) {\n push(offers, extensionName, params);\n params = Object.create(null);\n extensionName = undefined;\n }\n\n paramName = undefined;\n start = end = -1;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n }\n }\n\n if (start === -1 || inQuotes || code === 0x20 || code === 0x09) {\n throw new SyntaxError('Unexpected end of input');\n }\n\n if (end === -1) end = i;\n const token = header.slice(start, end);\n if (extensionName === undefined) {\n push(offers, token, params);\n } else {\n if (paramName === undefined) {\n push(params, token, true);\n } else if (mustUnescape) {\n push(params, paramName, token.replace(/\\\\/g, ''));\n } else {\n push(params, paramName, token);\n }\n push(offers, extensionName, params);\n }\n\n return offers;\n}\n\n/**\n * Builds the `Sec-WebSocket-Extensions` header field value.\n *\n * @param {Object} extensions The map of extensions and parameters to format\n * @return {String} A string representing the given object\n * @public\n */\nfunction format(extensions) {\n return Object.keys(extensions)\n .map((extension) => {\n let configurations = extensions[extension];\n if (!Array.isArray(configurations)) configurations = [configurations];\n return configurations\n .map((params) => {\n return [extension]\n .concat(\n Object.keys(params).map((k) => {\n let values = params[k];\n if (!Array.isArray(values)) values = [values];\n return values\n .map((v) => (v === true ? k : `${k}=${v}`))\n .join('; ');\n })\n )\n .join('; ');\n })\n .join(', ');\n })\n .join(', ');\n}\n\nmodule.exports = { format, parse };\n","/* eslint no-unused-vars: [\"error\", { \"varsIgnorePattern\": \"^Duplex|Readable$\", \"caughtErrors\": \"none\" }] */\n\n'use strict';\n\nconst EventEmitter = require('events');\nconst https = require('https');\nconst http = require('http');\nconst net = require('net');\nconst tls = require('tls');\nconst { randomBytes, createHash } = require('crypto');\nconst { Duplex, Readable } = require('stream');\nconst { URL } = require('url');\n\nconst PerMessageDeflate = require('./permessage-deflate');\nconst Receiver = require('./receiver');\nconst Sender = require('./sender');\nconst { isBlob } = require('./validation');\n\nconst {\n BINARY_TYPES,\n CLOSE_TIMEOUT,\n EMPTY_BUFFER,\n GUID,\n kForOnEventAttribute,\n kListener,\n kStatusCode,\n kWebSocket,\n NOOP\n} = require('./constants');\nconst {\n EventTarget: { addEventListener, removeEventListener }\n} = require('./event-target');\nconst { format, parse } = require('./extension');\nconst { toBuffer } = require('./buffer-util');\n\nconst kAborted = Symbol('kAborted');\nconst protocolVersions = [8, 13];\nconst readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];\nconst subprotocolRegex = /^[!#$%&'*+\\-.0-9A-Z^_`|a-z~]+$/;\n\n/**\n * Class representing a WebSocket.\n *\n * @extends EventEmitter\n */\nclass WebSocket extends EventEmitter {\n /**\n * Create a new `WebSocket`.\n *\n * @param {(String|URL)} address The URL to which to connect\n * @param {(String|String[])} [protocols] The subprotocols\n * @param {Object} [options] Connection options\n */\n constructor(address, protocols, options) {\n super();\n\n this._binaryType = BINARY_TYPES[0];\n this._closeCode = 1006;\n this._closeFrameReceived = false;\n this._closeFrameSent = false;\n this._closeMessage = EMPTY_BUFFER;\n this._closeTimer = null;\n this._errorEmitted = false;\n this._extensions = {};\n this._paused = false;\n this._protocol = '';\n this._readyState = WebSocket.CONNECTING;\n this._receiver = null;\n this._sender = null;\n this._socket = null;\n\n if (address !== null) {\n this._bufferedAmount = 0;\n this._isServer = false;\n this._redirects = 0;\n\n if (protocols === undefined) {\n protocols = [];\n } else if (!Array.isArray(protocols)) {\n if (typeof protocols === 'object' && protocols !== null) {\n options = protocols;\n protocols = [];\n } else {\n protocols = [protocols];\n }\n }\n\n initAsClient(this, address, protocols, options);\n } else {\n this._autoPong = options.autoPong;\n this._closeTimeout = options.closeTimeout;\n this._isServer = true;\n }\n }\n\n /**\n * For historical reasons, the custom \"nodebuffer\" type is used by the default\n * instead of \"blob\".\n *\n * @type {String}\n */\n get binaryType() {\n return this._binaryType;\n }\n\n set binaryType(type) {\n if (!BINARY_TYPES.includes(type)) return;\n\n this._binaryType = type;\n\n //\n // Allow to change `binaryType` on the fly.\n //\n if (this._receiver) this._receiver._binaryType = type;\n }\n\n /**\n * @type {Number}\n */\n get bufferedAmount() {\n if (!this._socket) return this._bufferedAmount;\n\n return this._socket._writableState.length + this._sender._bufferedBytes;\n }\n\n /**\n * @type {String}\n */\n get extensions() {\n return Object.keys(this._extensions).join();\n }\n\n /**\n * @type {Boolean}\n */\n get isPaused() {\n return this._paused;\n }\n\n /**\n * @type {Function}\n */\n /* istanbul ignore next */\n get onclose() {\n return null;\n }\n\n /**\n * @type {Function}\n */\n /* istanbul ignore next */\n get onerror() {\n return null;\n }\n\n /**\n * @type {Function}\n */\n /* istanbul ignore next */\n get onopen() {\n return null;\n }\n\n /**\n * @type {Function}\n */\n /* istanbul ignore next */\n get onmessage() {\n return null;\n }\n\n /**\n * @type {String}\n */\n get protocol() {\n return this._protocol;\n }\n\n /**\n * @type {Number}\n */\n get readyState() {\n return this._readyState;\n }\n\n /**\n * @type {String}\n */\n get url() {\n return this._url;\n }\n\n /**\n * Set up the socket and the internal resources.\n *\n * @param {Duplex} socket The network socket between the server and client\n * @param {Buffer} head The first packet of the upgraded stream\n * @param {Object} options Options object\n * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether\n * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted\n * multiple times in the same tick\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Number} [options.maxPayload=0] The maximum allowed message size\n * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or\n * not to skip UTF-8 validation for text and close messages\n * @private\n */\n setSocket(socket, head, options) {\n const receiver = new Receiver({\n allowSynchronousEvents: options.allowSynchronousEvents,\n binaryType: this.binaryType,\n extensions: this._extensions,\n isServer: this._isServer,\n maxPayload: options.maxPayload,\n skipUTF8Validation: options.skipUTF8Validation\n });\n\n const sender = new Sender(socket, this._extensions, options.generateMask);\n\n this._receiver = receiver;\n this._sender = sender;\n this._socket = socket;\n\n receiver[kWebSocket] = this;\n sender[kWebSocket] = this;\n socket[kWebSocket] = this;\n\n receiver.on('conclude', receiverOnConclude);\n receiver.on('drain', receiverOnDrain);\n receiver.on('error', receiverOnError);\n receiver.on('message', receiverOnMessage);\n receiver.on('ping', receiverOnPing);\n receiver.on('pong', receiverOnPong);\n\n sender.onerror = senderOnError;\n\n //\n // These methods may not be available if `socket` is just a `Duplex`.\n //\n if (socket.setTimeout) socket.setTimeout(0);\n if (socket.setNoDelay) socket.setNoDelay();\n\n if (head.length > 0) socket.unshift(head);\n\n socket.on('close', socketOnClose);\n socket.on('data', socketOnData);\n socket.on('end', socketOnEnd);\n socket.on('error', socketOnError);\n\n this._readyState = WebSocket.OPEN;\n this.emit('open');\n }\n\n /**\n * Emit the `'close'` event.\n *\n * @private\n */\n emitClose() {\n if (!this._socket) {\n this._readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n return;\n }\n\n if (this._extensions[PerMessageDeflate.extensionName]) {\n this._extensions[PerMessageDeflate.extensionName].cleanup();\n }\n\n this._receiver.removeAllListeners();\n this._readyState = WebSocket.CLOSED;\n this.emit('close', this._closeCode, this._closeMessage);\n }\n\n /**\n * Start a closing handshake.\n *\n * +----------+ +-----------+ +----------+\n * - - -|ws.close()|-->|close frame|-->|ws.close()|- - -\n * | +----------+ +-----------+ +----------+ |\n * +----------+ +-----------+ |\n * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING\n * +----------+ +-----------+ |\n * | | | +---+ |\n * +------------------------+-->|fin| - - - -\n * | +---+ | +---+\n * - - - - -|fin|<---------------------+\n * +---+\n *\n * @param {Number} [code] Status code explaining why the connection is closing\n * @param {(String|Buffer)} [data] The reason why the connection is\n * closing\n * @public\n */\n close(code, data) {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n abortHandshake(this, this._req, msg);\n return;\n }\n\n if (this.readyState === WebSocket.CLOSING) {\n if (\n this._closeFrameSent &&\n (this._closeFrameReceived || this._receiver._writableState.errorEmitted)\n ) {\n this._socket.end();\n }\n\n return;\n }\n\n this._readyState = WebSocket.CLOSING;\n this._sender.close(code, data, !this._isServer, (err) => {\n //\n // This error is handled by the `'error'` listener on the socket. We only\n // want to know if the close frame has been sent here.\n //\n if (err) return;\n\n this._closeFrameSent = true;\n\n if (\n this._closeFrameReceived ||\n this._receiver._writableState.errorEmitted\n ) {\n this._socket.end();\n }\n });\n\n setCloseTimer(this);\n }\n\n /**\n * Pause the socket.\n *\n * @public\n */\n pause() {\n if (\n this.readyState === WebSocket.CONNECTING ||\n this.readyState === WebSocket.CLOSED\n ) {\n return;\n }\n\n this._paused = true;\n this._socket.pause();\n }\n\n /**\n * Send a ping.\n *\n * @param {*} [data] The data to send\n * @param {Boolean} [mask] Indicates whether or not to mask `data`\n * @param {Function} [cb] Callback which is executed when the ping is sent\n * @public\n */\n ping(data, mask, cb) {\n if (this.readyState === WebSocket.CONNECTING) {\n throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');\n }\n\n if (typeof data === 'function') {\n cb = data;\n data = mask = undefined;\n } else if (typeof mask === 'function') {\n cb = mask;\n mask = undefined;\n }\n\n if (typeof data === 'number') data = data.toString();\n\n if (this.readyState !== WebSocket.OPEN) {\n sendAfterClose(this, data, cb);\n return;\n }\n\n if (mask === undefined) mask = !this._isServer;\n this._sender.ping(data || EMPTY_BUFFER, mask, cb);\n }\n\n /**\n * Send a pong.\n *\n * @param {*} [data] The data to send\n * @param {Boolean} [mask] Indicates whether or not to mask `data`\n * @param {Function} [cb] Callback which is executed when the pong is sent\n * @public\n */\n pong(data, mask, cb) {\n if (this.readyState === WebSocket.CONNECTING) {\n throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');\n }\n\n if (typeof data === 'function') {\n cb = data;\n data = mask = undefined;\n } else if (typeof mask === 'function') {\n cb = mask;\n mask = undefined;\n }\n\n if (typeof data === 'number') data = data.toString();\n\n if (this.readyState !== WebSocket.OPEN) {\n sendAfterClose(this, data, cb);\n return;\n }\n\n if (mask === undefined) mask = !this._isServer;\n this._sender.pong(data || EMPTY_BUFFER, mask, cb);\n }\n\n /**\n * Resume the socket.\n *\n * @public\n */\n resume() {\n if (\n this.readyState === WebSocket.CONNECTING ||\n this.readyState === WebSocket.CLOSED\n ) {\n return;\n }\n\n this._paused = false;\n if (!this._receiver._writableState.needDrain) this._socket.resume();\n }\n\n /**\n * Send a data message.\n *\n * @param {*} data The message to send\n * @param {Object} [options] Options object\n * @param {Boolean} [options.binary] Specifies whether `data` is binary or\n * text\n * @param {Boolean} [options.compress] Specifies whether or not to compress\n * `data`\n * @param {Boolean} [options.fin=true] Specifies whether the fragment is the\n * last one\n * @param {Boolean} [options.mask] Specifies whether or not to mask `data`\n * @param {Function} [cb] Callback which is executed when data is written out\n * @public\n */\n send(data, options, cb) {\n if (this.readyState === WebSocket.CONNECTING) {\n throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');\n }\n\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n if (typeof data === 'number') data = data.toString();\n\n if (this.readyState !== WebSocket.OPEN) {\n sendAfterClose(this, data, cb);\n return;\n }\n\n const opts = {\n binary: typeof data !== 'string',\n mask: !this._isServer,\n compress: true,\n fin: true,\n ...options\n };\n\n if (!this._extensions[PerMessageDeflate.extensionName]) {\n opts.compress = false;\n }\n\n this._sender.send(data || EMPTY_BUFFER, opts, cb);\n }\n\n /**\n * Forcibly close the connection.\n *\n * @public\n */\n terminate() {\n if (this.readyState === WebSocket.CLOSED) return;\n if (this.readyState === WebSocket.CONNECTING) {\n const msg = 'WebSocket was closed before the connection was established';\n abortHandshake(this, this._req, msg);\n return;\n }\n\n if (this._socket) {\n this._readyState = WebSocket.CLOSING;\n this._socket.destroy();\n }\n }\n}\n\n/**\n * @constant {Number} CONNECTING\n * @memberof WebSocket\n */\nObject.defineProperty(WebSocket, 'CONNECTING', {\n enumerable: true,\n value: readyStates.indexOf('CONNECTING')\n});\n\n/**\n * @constant {Number} CONNECTING\n * @memberof WebSocket.prototype\n */\nObject.defineProperty(WebSocket.prototype, 'CONNECTING', {\n enumerable: true,\n value: readyStates.indexOf('CONNECTING')\n});\n\n/**\n * @constant {Number} OPEN\n * @memberof WebSocket\n */\nObject.defineProperty(WebSocket, 'OPEN', {\n enumerable: true,\n value: readyStates.indexOf('OPEN')\n});\n\n/**\n * @constant {Number} OPEN\n * @memberof WebSocket.prototype\n */\nObject.defineProperty(WebSocket.prototype, 'OPEN', {\n enumerable: true,\n value: readyStates.indexOf('OPEN')\n});\n\n/**\n * @constant {Number} CLOSING\n * @memberof WebSocket\n */\nObject.defineProperty(WebSocket, 'CLOSING', {\n enumerable: true,\n value: readyStates.indexOf('CLOSING')\n});\n\n/**\n * @constant {Number} CLOSING\n * @memberof WebSocket.prototype\n */\nObject.defineProperty(WebSocket.prototype, 'CLOSING', {\n enumerable: true,\n value: readyStates.indexOf('CLOSING')\n});\n\n/**\n * @constant {Number} CLOSED\n * @memberof WebSocket\n */\nObject.defineProperty(WebSocket, 'CLOSED', {\n enumerable: true,\n value: readyStates.indexOf('CLOSED')\n});\n\n/**\n * @constant {Number} CLOSED\n * @memberof WebSocket.prototype\n */\nObject.defineProperty(WebSocket.prototype, 'CLOSED', {\n enumerable: true,\n value: readyStates.indexOf('CLOSED')\n});\n\n[\n 'binaryType',\n 'bufferedAmount',\n 'extensions',\n 'isPaused',\n 'protocol',\n 'readyState',\n 'url'\n].forEach((property) => {\n Object.defineProperty(WebSocket.prototype, property, { enumerable: true });\n});\n\n//\n// Add the `onopen`, `onerror`, `onclose`, and `onmessage` attributes.\n// See https://html.spec.whatwg.org/multipage/comms.html#the-websocket-interface\n//\n['open', 'error', 'close', 'message'].forEach((method) => {\n Object.defineProperty(WebSocket.prototype, `on${method}`, {\n enumerable: true,\n get() {\n for (const listener of this.listeners(method)) {\n if (listener[kForOnEventAttribute]) return listener[kListener];\n }\n\n return null;\n },\n set(handler) {\n for (const listener of this.listeners(method)) {\n if (listener[kForOnEventAttribute]) {\n this.removeListener(method, listener);\n break;\n }\n }\n\n if (typeof handler !== 'function') return;\n\n this.addEventListener(method, handler, {\n [kForOnEventAttribute]: true\n });\n }\n });\n});\n\nWebSocket.prototype.addEventListener = addEventListener;\nWebSocket.prototype.removeEventListener = removeEventListener;\n\nmodule.exports = WebSocket;\n\n/**\n * Initialize a WebSocket client.\n *\n * @param {WebSocket} websocket The client to initialize\n * @param {(String|URL)} address The URL to which to connect\n * @param {Array} protocols The subprotocols\n * @param {Object} [options] Connection options\n * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any\n * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple\n * times in the same tick\n * @param {Boolean} [options.autoPong=true] Specifies whether or not to\n * automatically send a pong in response to a ping\n * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait\n * for the closing handshake to finish after `websocket.close()` is called\n * @param {Function} [options.finishRequest] A function which can be used to\n * customize the headers of each http request before it is sent\n * @param {Boolean} [options.followRedirects=false] Whether or not to follow\n * redirects\n * @param {Function} [options.generateMask] The function used to generate the\n * masking key\n * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the\n * handshake request\n * @param {Number} [options.maxPayload=104857600] The maximum allowed message\n * size\n * @param {Number} [options.maxRedirects=10] The maximum number of redirects\n * allowed\n * @param {String} [options.origin] Value of the `Origin` or\n * `Sec-WebSocket-Origin` header\n * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable\n * permessage-deflate\n * @param {Number} [options.protocolVersion=13] Value of the\n * `Sec-WebSocket-Version` header\n * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or\n * not to skip UTF-8 validation for text and close messages\n * @private\n */\nfunction initAsClient(websocket, address, protocols, options) {\n const opts = {\n allowSynchronousEvents: true,\n autoPong: true,\n closeTimeout: CLOSE_TIMEOUT,\n protocolVersion: protocolVersions[1],\n maxPayload: 100 * 1024 * 1024,\n skipUTF8Validation: false,\n perMessageDeflate: true,\n followRedirects: false,\n maxRedirects: 10,\n ...options,\n socketPath: undefined,\n hostname: undefined,\n protocol: undefined,\n timeout: undefined,\n method: 'GET',\n host: undefined,\n path: undefined,\n port: undefined\n };\n\n websocket._autoPong = opts.autoPong;\n websocket._closeTimeout = opts.closeTimeout;\n\n if (!protocolVersions.includes(opts.protocolVersion)) {\n throw new RangeError(\n `Unsupported protocol version: ${opts.protocolVersion} ` +\n `(supported versions: ${protocolVersions.join(', ')})`\n );\n }\n\n let parsedUrl;\n\n if (address instanceof URL) {\n parsedUrl = address;\n } else {\n try {\n parsedUrl = new URL(address);\n } catch (e) {\n throw new SyntaxError(`Invalid URL: ${address}`);\n }\n }\n\n if (parsedUrl.protocol === 'http:') {\n parsedUrl.protocol = 'ws:';\n } else if (parsedUrl.protocol === 'https:') {\n parsedUrl.protocol = 'wss:';\n }\n\n websocket._url = parsedUrl.href;\n\n const isSecure = parsedUrl.protocol === 'wss:';\n const isIpcUrl = parsedUrl.protocol === 'ws+unix:';\n let invalidUrlMessage;\n\n if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {\n invalidUrlMessage =\n 'The URL\\'s protocol must be one of \"ws:\", \"wss:\", ' +\n '\"http:\", \"https:\", or \"ws+unix:\"';\n } else if (isIpcUrl && !parsedUrl.pathname) {\n invalidUrlMessage = \"The URL's pathname is empty\";\n } else if (parsedUrl.hash) {\n invalidUrlMessage = 'The URL contains a fragment identifier';\n }\n\n if (invalidUrlMessage) {\n const err = new SyntaxError(invalidUrlMessage);\n\n if (websocket._redirects === 0) {\n throw err;\n } else {\n emitErrorAndClose(websocket, err);\n return;\n }\n }\n\n const defaultPort = isSecure ? 443 : 80;\n const key = randomBytes(16).toString('base64');\n const request = isSecure ? https.request : http.request;\n const protocolSet = new Set();\n let perMessageDeflate;\n\n opts.createConnection =\n opts.createConnection || (isSecure ? tlsConnect : netConnect);\n opts.defaultPort = opts.defaultPort || defaultPort;\n opts.port = parsedUrl.port || defaultPort;\n opts.host = parsedUrl.hostname.startsWith('[')\n ? parsedUrl.hostname.slice(1, -1)\n : parsedUrl.hostname;\n opts.headers = {\n ...opts.headers,\n 'Sec-WebSocket-Version': opts.protocolVersion,\n 'Sec-WebSocket-Key': key,\n Connection: 'Upgrade',\n Upgrade: 'websocket'\n };\n opts.path = parsedUrl.pathname + parsedUrl.search;\n opts.timeout = opts.handshakeTimeout;\n\n if (opts.perMessageDeflate) {\n perMessageDeflate = new PerMessageDeflate(\n opts.perMessageDeflate !== true ? opts.perMessageDeflate : {},\n false,\n opts.maxPayload\n );\n opts.headers['Sec-WebSocket-Extensions'] = format({\n [PerMessageDeflate.extensionName]: perMessageDeflate.offer()\n });\n }\n if (protocols.length) {\n for (const protocol of protocols) {\n if (\n typeof protocol !== 'string' ||\n !subprotocolRegex.test(protocol) ||\n protocolSet.has(protocol)\n ) {\n throw new SyntaxError(\n 'An invalid or duplicated subprotocol was specified'\n );\n }\n\n protocolSet.add(protocol);\n }\n\n opts.headers['Sec-WebSocket-Protocol'] = protocols.join(',');\n }\n if (opts.origin) {\n if (opts.protocolVersion < 13) {\n opts.headers['Sec-WebSocket-Origin'] = opts.origin;\n } else {\n opts.headers.Origin = opts.origin;\n }\n }\n if (parsedUrl.username || parsedUrl.password) {\n opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;\n }\n\n if (isIpcUrl) {\n const parts = opts.path.split(':');\n\n opts.socketPath = parts[0];\n opts.path = parts[1];\n }\n\n let req;\n\n if (opts.followRedirects) {\n if (websocket._redirects === 0) {\n websocket._originalIpc = isIpcUrl;\n websocket._originalSecure = isSecure;\n websocket._originalHostOrSocketPath = isIpcUrl\n ? opts.socketPath\n : parsedUrl.host;\n\n const headers = options && options.headers;\n\n //\n // Shallow copy the user provided options so that headers can be changed\n // without mutating the original object.\n //\n options = { ...options, headers: {} };\n\n if (headers) {\n for (const [key, value] of Object.entries(headers)) {\n options.headers[key.toLowerCase()] = value;\n }\n }\n } else if (websocket.listenerCount('redirect') === 0) {\n const isSameHost = isIpcUrl\n ? websocket._originalIpc\n ? opts.socketPath === websocket._originalHostOrSocketPath\n : false\n : websocket._originalIpc\n ? false\n : parsedUrl.host === websocket._originalHostOrSocketPath;\n\n if (!isSameHost || (websocket._originalSecure && !isSecure)) {\n //\n // Match curl 7.77.0 behavior and drop the following headers. These\n // headers are also dropped when following a redirect to a subdomain.\n //\n delete opts.headers.authorization;\n delete opts.headers.cookie;\n\n if (!isSameHost) delete opts.headers.host;\n\n opts.auth = undefined;\n }\n }\n\n //\n // Match curl 7.77.0 behavior and make the first `Authorization` header win.\n // If the `Authorization` header is set, then there is nothing to do as it\n // will take precedence.\n //\n if (opts.auth && !options.headers.authorization) {\n options.headers.authorization =\n 'Basic ' + Buffer.from(opts.auth).toString('base64');\n }\n\n req = websocket._req = request(opts);\n\n if (websocket._redirects) {\n //\n // Unlike what is done for the `'upgrade'` event, no early exit is\n // triggered here if the user calls `websocket.close()` or\n // `websocket.terminate()` from a listener of the `'redirect'` event. This\n // is because the user can also call `request.destroy()` with an error\n // before calling `websocket.close()` or `websocket.terminate()` and this\n // would result in an error being emitted on the `request` object with no\n // `'error'` event listeners attached.\n //\n websocket.emit('redirect', websocket.url, req);\n }\n } else {\n req = websocket._req = request(opts);\n }\n\n if (opts.timeout) {\n req.on('timeout', () => {\n abortHandshake(websocket, req, 'Opening handshake has timed out');\n });\n }\n\n req.on('error', (err) => {\n if (req === null || req[kAborted]) return;\n\n req = websocket._req = null;\n emitErrorAndClose(websocket, err);\n });\n\n req.on('response', (res) => {\n const location = res.headers.location;\n const statusCode = res.statusCode;\n\n if (\n location &&\n opts.followRedirects &&\n statusCode >= 300 &&\n statusCode < 400\n ) {\n if (++websocket._redirects > opts.maxRedirects) {\n abortHandshake(websocket, req, 'Maximum redirects exceeded');\n return;\n }\n\n req.abort();\n\n let addr;\n\n try {\n addr = new URL(location, address);\n } catch (e) {\n const err = new SyntaxError(`Invalid URL: ${location}`);\n emitErrorAndClose(websocket, err);\n return;\n }\n\n initAsClient(websocket, addr, protocols, options);\n } else if (!websocket.emit('unexpected-response', req, res)) {\n abortHandshake(\n websocket,\n req,\n `Unexpected server response: ${res.statusCode}`\n );\n }\n });\n\n req.on('upgrade', (res, socket, head) => {\n websocket.emit('upgrade', res);\n\n //\n // The user may have closed the connection from a listener of the\n // `'upgrade'` event.\n //\n if (websocket.readyState !== WebSocket.CONNECTING) return;\n\n req = websocket._req = null;\n\n const upgrade = res.headers.upgrade;\n\n if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {\n abortHandshake(websocket, socket, 'Invalid Upgrade header');\n return;\n }\n\n const digest = createHash('sha1')\n .update(key + GUID)\n .digest('base64');\n\n if (res.headers['sec-websocket-accept'] !== digest) {\n abortHandshake(websocket, socket, 'Invalid Sec-WebSocket-Accept header');\n return;\n }\n\n const serverProt = res.headers['sec-websocket-protocol'];\n let protError;\n\n if (serverProt !== undefined) {\n if (!protocolSet.size) {\n protError = 'Server sent a subprotocol but none was requested';\n } else if (!protocolSet.has(serverProt)) {\n protError = 'Server sent an invalid subprotocol';\n }\n } else if (protocolSet.size) {\n protError = 'Server sent no subprotocol';\n }\n\n if (protError) {\n abortHandshake(websocket, socket, protError);\n return;\n }\n\n if (serverProt) websocket._protocol = serverProt;\n\n const secWebSocketExtensions = res.headers['sec-websocket-extensions'];\n\n if (secWebSocketExtensions !== undefined) {\n if (!perMessageDeflate) {\n const message =\n 'Server sent a Sec-WebSocket-Extensions header but no extension ' +\n 'was requested';\n abortHandshake(websocket, socket, message);\n return;\n }\n\n let extensions;\n\n try {\n extensions = parse(secWebSocketExtensions);\n } catch (err) {\n const message = 'Invalid Sec-WebSocket-Extensions header';\n abortHandshake(websocket, socket, message);\n return;\n }\n\n const extensionNames = Object.keys(extensions);\n\n if (\n extensionNames.length !== 1 ||\n extensionNames[0] !== PerMessageDeflate.extensionName\n ) {\n const message = 'Server indicated an extension that was not requested';\n abortHandshake(websocket, socket, message);\n return;\n }\n\n try {\n perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);\n } catch (err) {\n const message = 'Invalid Sec-WebSocket-Extensions header';\n abortHandshake(websocket, socket, message);\n return;\n }\n\n websocket._extensions[PerMessageDeflate.extensionName] =\n perMessageDeflate;\n }\n\n websocket.setSocket(socket, head, {\n allowSynchronousEvents: opts.allowSynchronousEvents,\n generateMask: opts.generateMask,\n maxPayload: opts.maxPayload,\n skipUTF8Validation: opts.skipUTF8Validation\n });\n });\n\n if (opts.finishRequest) {\n opts.finishRequest(req, websocket);\n } else {\n req.end();\n }\n}\n\n/**\n * Emit the `'error'` and `'close'` events.\n *\n * @param {WebSocket} websocket The WebSocket instance\n * @param {Error} The error to emit\n * @private\n */\nfunction emitErrorAndClose(websocket, err) {\n websocket._readyState = WebSocket.CLOSING;\n //\n // The following assignment is practically useless and is done only for\n // consistency.\n //\n websocket._errorEmitted = true;\n websocket.emit('error', err);\n websocket.emitClose();\n}\n\n/**\n * Create a `net.Socket` and initiate a connection.\n *\n * @param {Object} options Connection options\n * @return {net.Socket} The newly created socket used to start the connection\n * @private\n */\nfunction netConnect(options) {\n options.path = options.socketPath;\n return net.connect(options);\n}\n\n/**\n * Create a `tls.TLSSocket` and initiate a connection.\n *\n * @param {Object} options Connection options\n * @return {tls.TLSSocket} The newly created socket used to start the connection\n * @private\n */\nfunction tlsConnect(options) {\n options.path = undefined;\n\n if (!options.servername && options.servername !== '') {\n options.servername = net.isIP(options.host) ? '' : options.host;\n }\n\n return tls.connect(options);\n}\n\n/**\n * Abort the handshake and emit an error.\n *\n * @param {WebSocket} websocket The WebSocket instance\n * @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to\n * abort or the socket to destroy\n * @param {String} message The error message\n * @private\n */\nfunction abortHandshake(websocket, stream, message) {\n websocket._readyState = WebSocket.CLOSING;\n\n const err = new Error(message);\n Error.captureStackTrace(err, abortHandshake);\n\n if (stream.setHeader) {\n stream[kAborted] = true;\n stream.abort();\n\n if (stream.socket && !stream.socket.destroyed) {\n //\n // On Node.js >= 14.3.0 `request.abort()` does not destroy the socket if\n // called after the request completed. See\n // https://github.com/websockets/ws/issues/1869.\n //\n stream.socket.destroy();\n }\n\n process.nextTick(emitErrorAndClose, websocket, err);\n } else {\n stream.destroy(err);\n stream.once('error', websocket.emit.bind(websocket, 'error'));\n stream.once('close', websocket.emitClose.bind(websocket));\n }\n}\n\n/**\n * Handle cases where the `ping()`, `pong()`, or `send()` methods are called\n * when the `readyState` attribute is `CLOSING` or `CLOSED`.\n *\n * @param {WebSocket} websocket The WebSocket instance\n * @param {*} [data] The data to send\n * @param {Function} [cb] Callback\n * @private\n */\nfunction sendAfterClose(websocket, data, cb) {\n if (data) {\n const length = isBlob(data) ? data.size : toBuffer(data).length;\n\n //\n // The `_bufferedAmount` property is used only when the peer is a client and\n // the opening handshake fails. Under these circumstances, in fact, the\n // `setSocket()` method is not called, so the `_socket` and `_sender`\n // properties are set to `null`.\n //\n if (websocket._socket) websocket._sender._bufferedBytes += length;\n else websocket._bufferedAmount += length;\n }\n\n if (cb) {\n const err = new Error(\n `WebSocket is not open: readyState ${websocket.readyState} ` +\n `(${readyStates[websocket.readyState]})`\n );\n process.nextTick(cb, err);\n }\n}\n\n/**\n * The listener of the `Receiver` `'conclude'` event.\n *\n * @param {Number} code The status code\n * @param {Buffer} reason The reason for closing\n * @private\n */\nfunction receiverOnConclude(code, reason) {\n const websocket = this[kWebSocket];\n\n websocket._closeFrameReceived = true;\n websocket._closeMessage = reason;\n websocket._closeCode = code;\n\n if (websocket._socket[kWebSocket] === undefined) return;\n\n websocket._socket.removeListener('data', socketOnData);\n process.nextTick(resume, websocket._socket);\n\n if (code === 1005) websocket.close();\n else websocket.close(code, reason);\n}\n\n/**\n * The listener of the `Receiver` `'drain'` event.\n *\n * @private\n */\nfunction receiverOnDrain() {\n const websocket = this[kWebSocket];\n\n if (!websocket.isPaused) websocket._socket.resume();\n}\n\n/**\n * The listener of the `Receiver` `'error'` event.\n *\n * @param {(RangeError|Error)} err The emitted error\n * @private\n */\nfunction receiverOnError(err) {\n const websocket = this[kWebSocket];\n\n if (websocket._socket[kWebSocket] !== undefined) {\n websocket._socket.removeListener('data', socketOnData);\n\n //\n // On Node.js < 14.0.0 the `'error'` event is emitted synchronously. See\n // https://github.com/websockets/ws/issues/1940.\n //\n process.nextTick(resume, websocket._socket);\n\n websocket.close(err[kStatusCode]);\n }\n\n if (!websocket._errorEmitted) {\n websocket._errorEmitted = true;\n websocket.emit('error', err);\n }\n}\n\n/**\n * The listener of the `Receiver` `'finish'` event.\n *\n * @private\n */\nfunction receiverOnFinish() {\n this[kWebSocket].emitClose();\n}\n\n/**\n * The listener of the `Receiver` `'message'` event.\n *\n * @param {Buffer|ArrayBuffer|Buffer[])} data The message\n * @param {Boolean} isBinary Specifies whether the message is binary or not\n * @private\n */\nfunction receiverOnMessage(data, isBinary) {\n this[kWebSocket].emit('message', data, isBinary);\n}\n\n/**\n * The listener of the `Receiver` `'ping'` event.\n *\n * @param {Buffer} data The data included in the ping frame\n * @private\n */\nfunction receiverOnPing(data) {\n const websocket = this[kWebSocket];\n\n if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);\n websocket.emit('ping', data);\n}\n\n/**\n * The listener of the `Receiver` `'pong'` event.\n *\n * @param {Buffer} data The data included in the pong frame\n * @private\n */\nfunction receiverOnPong(data) {\n this[kWebSocket].emit('pong', data);\n}\n\n/**\n * Resume a readable stream\n *\n * @param {Readable} stream The readable stream\n * @private\n */\nfunction resume(stream) {\n stream.resume();\n}\n\n/**\n * The `Sender` error event handler.\n *\n * @param {Error} The error\n * @private\n */\nfunction senderOnError(err) {\n const websocket = this[kWebSocket];\n\n if (websocket.readyState === WebSocket.CLOSED) return;\n if (websocket.readyState === WebSocket.OPEN) {\n websocket._readyState = WebSocket.CLOSING;\n setCloseTimer(websocket);\n }\n\n //\n // `socket.end()` is used instead of `socket.destroy()` to allow the other\n // peer to finish sending queued data. There is no need to set a timer here\n // because `CLOSING` means that it is already set or not needed.\n //\n this._socket.end();\n\n if (!websocket._errorEmitted) {\n websocket._errorEmitted = true;\n websocket.emit('error', err);\n }\n}\n\n/**\n * Set a timer to destroy the underlying raw socket of a WebSocket.\n *\n * @param {WebSocket} websocket The WebSocket instance\n * @private\n */\nfunction setCloseTimer(websocket) {\n websocket._closeTimer = setTimeout(\n websocket._socket.destroy.bind(websocket._socket),\n websocket._closeTimeout\n );\n}\n\n/**\n * The listener of the socket `'close'` event.\n *\n * @private\n */\nfunction socketOnClose() {\n const websocket = this[kWebSocket];\n\n this.removeListener('close', socketOnClose);\n this.removeListener('data', socketOnData);\n this.removeListener('end', socketOnEnd);\n\n websocket._readyState = WebSocket.CLOSING;\n\n //\n // The close frame might not have been received or the `'end'` event emitted,\n // for example, if the socket was destroyed due to an error. Ensure that the\n // `receiver` stream is closed after writing any remaining buffered data to\n // it. If the readable side of the socket is in flowing mode then there is no\n // buffered data as everything has been already written. If instead, the\n // socket is paused, any possible buffered data will be read as a single\n // chunk.\n //\n if (\n !this._readableState.endEmitted &&\n !websocket._closeFrameReceived &&\n !websocket._receiver._writableState.errorEmitted &&\n this._readableState.length !== 0\n ) {\n const chunk = this.read(this._readableState.length);\n\n websocket._receiver.write(chunk);\n }\n\n websocket._receiver.end();\n\n this[kWebSocket] = undefined;\n\n clearTimeout(websocket._closeTimer);\n\n if (\n websocket._receiver._writableState.finished ||\n websocket._receiver._writableState.errorEmitted\n ) {\n websocket.emitClose();\n } else {\n websocket._receiver.on('error', receiverOnFinish);\n websocket._receiver.on('finish', receiverOnFinish);\n }\n}\n\n/**\n * The listener of the socket `'data'` event.\n *\n * @param {Buffer} chunk A chunk of data\n * @private\n */\nfunction socketOnData(chunk) {\n if (!this[kWebSocket]._receiver.write(chunk)) {\n this.pause();\n }\n}\n\n/**\n * The listener of the socket `'end'` event.\n *\n * @private\n */\nfunction socketOnEnd() {\n const websocket = this[kWebSocket];\n\n websocket._readyState = WebSocket.CLOSING;\n websocket._receiver.end();\n this.end();\n}\n\n/**\n * The listener of the socket `'error'` event.\n *\n * @private\n */\nfunction socketOnError() {\n const websocket = this[kWebSocket];\n\n this.removeListener('error', socketOnError);\n this.on('error', NOOP);\n\n if (websocket) {\n websocket._readyState = WebSocket.CLOSING;\n this.destroy();\n }\n}\n","/* eslint no-unused-vars: [\"error\", { \"varsIgnorePattern\": \"^WebSocket$\" }] */\n'use strict';\n\nconst WebSocket = require('./websocket');\nconst { Duplex } = require('stream');\n\n/**\n * Emits the `'close'` event on a stream.\n *\n * @param {Duplex} stream The stream.\n * @private\n */\nfunction emitClose(stream) {\n stream.emit('close');\n}\n\n/**\n * The listener of the `'end'` event.\n *\n * @private\n */\nfunction duplexOnEnd() {\n if (!this.destroyed && this._writableState.finished) {\n this.destroy();\n }\n}\n\n/**\n * The listener of the `'error'` event.\n *\n * @param {Error} err The error\n * @private\n */\nfunction duplexOnError(err) {\n this.removeListener('error', duplexOnError);\n this.destroy();\n if (this.listenerCount('error') === 0) {\n // Do not suppress the throwing behavior.\n this.emit('error', err);\n }\n}\n\n/**\n * Wraps a `WebSocket` in a duplex stream.\n *\n * @param {WebSocket} ws The `WebSocket` to wrap\n * @param {Object} [options] The options for the `Duplex` constructor\n * @return {Duplex} The duplex stream\n * @public\n */\nfunction createWebSocketStream(ws, options) {\n let terminateOnDestroy = true;\n\n const duplex = new Duplex({\n ...options,\n autoDestroy: false,\n emitClose: false,\n objectMode: false,\n writableObjectMode: false\n });\n\n ws.on('message', function message(msg, isBinary) {\n const data =\n !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;\n\n if (!duplex.push(data)) ws.pause();\n });\n\n ws.once('error', function error(err) {\n if (duplex.destroyed) return;\n\n // Prevent `ws.terminate()` from being called by `duplex._destroy()`.\n //\n // - If the `'error'` event is emitted before the `'open'` event, then\n // `ws.terminate()` is a noop as no socket is assigned.\n // - Otherwise, the error is re-emitted by the listener of the `'error'`\n // event of the `Receiver` object. The listener already closes the\n // connection by calling `ws.close()`. This allows a close frame to be\n // sent to the other peer. If `ws.terminate()` is called right after this,\n // then the close frame might not be sent.\n terminateOnDestroy = false;\n duplex.destroy(err);\n });\n\n ws.once('close', function close() {\n if (duplex.destroyed) return;\n\n duplex.push(null);\n });\n\n duplex._destroy = function (err, callback) {\n if (ws.readyState === ws.CLOSED) {\n callback(err);\n process.nextTick(emitClose, duplex);\n return;\n }\n\n let called = false;\n\n ws.once('error', function error(err) {\n called = true;\n callback(err);\n });\n\n ws.once('close', function close() {\n if (!called) callback(err);\n process.nextTick(emitClose, duplex);\n });\n\n if (terminateOnDestroy) ws.terminate();\n };\n\n duplex._final = function (callback) {\n if (ws.readyState === ws.CONNECTING) {\n ws.once('open', function open() {\n duplex._final(callback);\n });\n return;\n }\n\n // If the value of the `_socket` property is `null` it means that `ws` is a\n // client websocket and the handshake failed. In fact, when this happens, a\n // socket is never assigned to the websocket. Wait for the `'error'` event\n // that will be emitted by the websocket.\n if (ws._socket === null) return;\n\n if (ws._socket._writableState.finished) {\n callback();\n if (duplex._readableState.endEmitted) duplex.destroy();\n } else {\n ws._socket.once('finish', function finish() {\n // `duplex` is not destroyed here because the `'end'` event will be\n // emitted on `duplex` after this `'finish'` event. The EOF signaling\n // `null` chunk is, in fact, pushed when the websocket emits `'close'`.\n callback();\n });\n ws.close();\n }\n };\n\n duplex._read = function () {\n if (ws.isPaused) ws.resume();\n };\n\n duplex._write = function (chunk, encoding, callback) {\n if (ws.readyState === ws.CONNECTING) {\n ws.once('open', function open() {\n duplex._write(chunk, encoding, callback);\n });\n return;\n }\n\n ws.send(chunk, callback);\n };\n\n duplex.on('end', duplexOnEnd);\n duplex.on('error', duplexOnError);\n return duplex;\n}\n\nmodule.exports = createWebSocketStream;\n","'use strict';\n\nconst { tokenChars } = require('./validation');\n\n/**\n * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.\n *\n * @param {String} header The field value of the header\n * @return {Set} The subprotocol names\n * @public\n */\nfunction parse(header) {\n const protocols = new Set();\n let start = -1;\n let end = -1;\n let i = 0;\n\n for (i; i < header.length; i++) {\n const code = header.charCodeAt(i);\n\n if (end === -1 && tokenChars[code] === 1) {\n if (start === -1) start = i;\n } else if (\n i !== 0 &&\n (code === 0x20 /* ' ' */ || code === 0x09) /* '\\t' */\n ) {\n if (end === -1 && start !== -1) end = i;\n } else if (code === 0x2c /* ',' */) {\n if (start === -1) {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n\n if (end === -1) end = i;\n\n const protocol = header.slice(start, end);\n\n if (protocols.has(protocol)) {\n throw new SyntaxError(`The \"${protocol}\" subprotocol is duplicated`);\n }\n\n protocols.add(protocol);\n start = end = -1;\n } else {\n throw new SyntaxError(`Unexpected character at index ${i}`);\n }\n }\n\n if (start === -1 || end !== -1) {\n throw new SyntaxError('Unexpected end of input');\n }\n\n const protocol = header.slice(start, i);\n\n if (protocols.has(protocol)) {\n throw new SyntaxError(`The \"${protocol}\" subprotocol is duplicated`);\n }\n\n protocols.add(protocol);\n return protocols;\n}\n\nmodule.exports = { parse };\n","/* eslint no-unused-vars: [\"error\", { \"varsIgnorePattern\": \"^Duplex$\", \"caughtErrors\": \"none\" }] */\n\n'use strict';\n\nconst EventEmitter = require('events');\nconst http = require('http');\nconst { Duplex } = require('stream');\nconst { createHash } = require('crypto');\n\nconst extension = require('./extension');\nconst PerMessageDeflate = require('./permessage-deflate');\nconst subprotocol = require('./subprotocol');\nconst WebSocket = require('./websocket');\nconst { CLOSE_TIMEOUT, GUID, kWebSocket } = require('./constants');\n\nconst keyRegex = /^[+/0-9A-Za-z]{22}==$/;\n\nconst RUNNING = 0;\nconst CLOSING = 1;\nconst CLOSED = 2;\n\n/**\n * Class representing a WebSocket server.\n *\n * @extends EventEmitter\n */\nclass WebSocketServer extends EventEmitter {\n /**\n * Create a `WebSocketServer` instance.\n *\n * @param {Object} options Configuration options\n * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether\n * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted\n * multiple times in the same tick\n * @param {Boolean} [options.autoPong=true] Specifies whether or not to\n * automatically send a pong in response to a ping\n * @param {Number} [options.backlog=511] The maximum length of the queue of\n * pending connections\n * @param {Boolean} [options.clientTracking=true] Specifies whether or not to\n * track clients\n * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to\n * wait for the closing handshake to finish after `websocket.close()` is\n * called\n * @param {Function} [options.handleProtocols] A hook to handle protocols\n * @param {String} [options.host] The hostname where to bind the server\n * @param {Number} [options.maxPayload=104857600] The maximum allowed message\n * size\n * @param {Boolean} [options.noServer=false] Enable no server mode\n * @param {String} [options.path] Accept only connections matching this path\n * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable\n * permessage-deflate\n * @param {Number} [options.port] The port where to bind the server\n * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S\n * server to use\n * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or\n * not to skip UTF-8 validation for text and close messages\n * @param {Function} [options.verifyClient] A hook to reject connections\n * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket`\n * class to use. It must be the `WebSocket` class or class that extends it\n * @param {Function} [callback] A listener for the `listening` event\n */\n constructor(options, callback) {\n super();\n\n options = {\n allowSynchronousEvents: true,\n autoPong: true,\n maxPayload: 100 * 1024 * 1024,\n skipUTF8Validation: false,\n perMessageDeflate: false,\n handleProtocols: null,\n clientTracking: true,\n closeTimeout: CLOSE_TIMEOUT,\n verifyClient: null,\n noServer: false,\n backlog: null, // use default (511 as implemented in net.js)\n server: null,\n host: null,\n path: null,\n port: null,\n WebSocket,\n ...options\n };\n\n if (\n (options.port == null && !options.server && !options.noServer) ||\n (options.port != null && (options.server || options.noServer)) ||\n (options.server && options.noServer)\n ) {\n throw new TypeError(\n 'One and only one of the \"port\", \"server\", or \"noServer\" options ' +\n 'must be specified'\n );\n }\n\n if (options.port != null) {\n this._server = http.createServer((req, res) => {\n const body = http.STATUS_CODES[426];\n\n res.writeHead(426, {\n 'Content-Length': body.length,\n 'Content-Type': 'text/plain'\n });\n res.end(body);\n });\n this._server.listen(\n options.port,\n options.host,\n options.backlog,\n callback\n );\n } else if (options.server) {\n this._server = options.server;\n }\n\n if (this._server) {\n const emitConnection = this.emit.bind(this, 'connection');\n\n this._removeListeners = addListeners(this._server, {\n listening: this.emit.bind(this, 'listening'),\n error: this.emit.bind(this, 'error'),\n upgrade: (req, socket, head) => {\n this.handleUpgrade(req, socket, head, emitConnection);\n }\n });\n }\n\n if (options.perMessageDeflate === true) options.perMessageDeflate = {};\n if (options.clientTracking) {\n this.clients = new Set();\n this._shouldEmitClose = false;\n }\n\n this.options = options;\n this._state = RUNNING;\n }\n\n /**\n * Returns the bound address, the address family name, and port of the server\n * as reported by the operating system if listening on an IP socket.\n * If the server is listening on a pipe or UNIX domain socket, the name is\n * returned as a string.\n *\n * @return {(Object|String|null)} The address of the server\n * @public\n */\n address() {\n if (this.options.noServer) {\n throw new Error('The server is operating in \"noServer\" mode');\n }\n\n if (!this._server) return null;\n return this._server.address();\n }\n\n /**\n * Stop the server from accepting new connections and emit the `'close'` event\n * when all existing connections are closed.\n *\n * @param {Function} [cb] A one-time listener for the `'close'` event\n * @public\n */\n close(cb) {\n if (this._state === CLOSED) {\n if (cb) {\n this.once('close', () => {\n cb(new Error('The server is not running'));\n });\n }\n\n process.nextTick(emitClose, this);\n return;\n }\n\n if (cb) this.once('close', cb);\n\n if (this._state === CLOSING) return;\n this._state = CLOSING;\n\n if (this.options.noServer || this.options.server) {\n if (this._server) {\n this._removeListeners();\n this._removeListeners = this._server = null;\n }\n\n if (this.clients) {\n if (!this.clients.size) {\n process.nextTick(emitClose, this);\n } else {\n this._shouldEmitClose = true;\n }\n } else {\n process.nextTick(emitClose, this);\n }\n } else {\n const server = this._server;\n\n this._removeListeners();\n this._removeListeners = this._server = null;\n\n //\n // The HTTP/S server was created internally. Close it, and rely on its\n // `'close'` event.\n //\n server.close(() => {\n emitClose(this);\n });\n }\n }\n\n /**\n * See if a given request should be handled by this server instance.\n *\n * @param {http.IncomingMessage} req Request object to inspect\n * @return {Boolean} `true` if the request is valid, else `false`\n * @public\n */\n shouldHandle(req) {\n if (this.options.path) {\n const index = req.url.indexOf('?');\n const pathname = index !== -1 ? req.url.slice(0, index) : req.url;\n\n if (pathname !== this.options.path) return false;\n }\n\n return true;\n }\n\n /**\n * Handle a HTTP Upgrade request.\n *\n * @param {http.IncomingMessage} req The request object\n * @param {Duplex} socket The network socket between the server and client\n * @param {Buffer} head The first packet of the upgraded stream\n * @param {Function} cb Callback\n * @public\n */\n handleUpgrade(req, socket, head, cb) {\n socket.on('error', socketOnError);\n\n const key = req.headers['sec-websocket-key'];\n const upgrade = req.headers.upgrade;\n const version = +req.headers['sec-websocket-version'];\n\n if (req.method !== 'GET') {\n const message = 'Invalid HTTP method';\n abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);\n return;\n }\n\n if (upgrade === undefined || upgrade.toLowerCase() !== 'websocket') {\n const message = 'Invalid Upgrade header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);\n return;\n }\n\n if (key === undefined || !keyRegex.test(key)) {\n const message = 'Missing or invalid Sec-WebSocket-Key header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);\n return;\n }\n\n if (version !== 13 && version !== 8) {\n const message = 'Missing or invalid Sec-WebSocket-Version header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {\n 'Sec-WebSocket-Version': '13, 8'\n });\n return;\n }\n\n if (!this.shouldHandle(req)) {\n abortHandshake(socket, 400);\n return;\n }\n\n const secWebSocketProtocol = req.headers['sec-websocket-protocol'];\n let protocols = new Set();\n\n if (secWebSocketProtocol !== undefined) {\n try {\n protocols = subprotocol.parse(secWebSocketProtocol);\n } catch (err) {\n const message = 'Invalid Sec-WebSocket-Protocol header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);\n return;\n }\n }\n\n const secWebSocketExtensions = req.headers['sec-websocket-extensions'];\n const extensions = {};\n\n if (\n this.options.perMessageDeflate &&\n secWebSocketExtensions !== undefined\n ) {\n const perMessageDeflate = new PerMessageDeflate(\n this.options.perMessageDeflate,\n true,\n this.options.maxPayload\n );\n\n try {\n const offers = extension.parse(secWebSocketExtensions);\n\n if (offers[PerMessageDeflate.extensionName]) {\n perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);\n extensions[PerMessageDeflate.extensionName] = perMessageDeflate;\n }\n } catch (err) {\n const message =\n 'Invalid or unacceptable Sec-WebSocket-Extensions header';\n abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);\n return;\n }\n }\n\n //\n // Optionally call external client verification handler.\n //\n if (this.options.verifyClient) {\n const info = {\n origin:\n req.headers[`${version === 8 ? 'sec-websocket-origin' : 'origin'}`],\n secure: !!(req.socket.authorized || req.socket.encrypted),\n req\n };\n\n if (this.options.verifyClient.length === 2) {\n this.options.verifyClient(info, (verified, code, message, headers) => {\n if (!verified) {\n return abortHandshake(socket, code || 401, message, headers);\n }\n\n this.completeUpgrade(\n extensions,\n key,\n protocols,\n req,\n socket,\n head,\n cb\n );\n });\n return;\n }\n\n if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);\n }\n\n this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);\n }\n\n /**\n * Upgrade the connection to WebSocket.\n *\n * @param {Object} extensions The accepted extensions\n * @param {String} key The value of the `Sec-WebSocket-Key` header\n * @param {Set} protocols The subprotocols\n * @param {http.IncomingMessage} req The request object\n * @param {Duplex} socket The network socket between the server and client\n * @param {Buffer} head The first packet of the upgraded stream\n * @param {Function} cb Callback\n * @throws {Error} If called more than once with the same socket\n * @private\n */\n completeUpgrade(extensions, key, protocols, req, socket, head, cb) {\n //\n // Destroy the socket if the client has already sent a FIN packet.\n //\n if (!socket.readable || !socket.writable) return socket.destroy();\n\n if (socket[kWebSocket]) {\n throw new Error(\n 'server.handleUpgrade() was called more than once with the same ' +\n 'socket, possibly due to a misconfiguration'\n );\n }\n\n if (this._state > RUNNING) return abortHandshake(socket, 503);\n\n const digest = createHash('sha1')\n .update(key + GUID)\n .digest('base64');\n\n const headers = [\n 'HTTP/1.1 101 Switching Protocols',\n 'Upgrade: websocket',\n 'Connection: Upgrade',\n `Sec-WebSocket-Accept: ${digest}`\n ];\n\n const ws = new this.options.WebSocket(null, undefined, this.options);\n\n if (protocols.size) {\n //\n // Optionally call external protocol selection handler.\n //\n const protocol = this.options.handleProtocols\n ? this.options.handleProtocols(protocols, req)\n : protocols.values().next().value;\n\n if (protocol) {\n headers.push(`Sec-WebSocket-Protocol: ${protocol}`);\n ws._protocol = protocol;\n }\n }\n\n if (extensions[PerMessageDeflate.extensionName]) {\n const params = extensions[PerMessageDeflate.extensionName].params;\n const value = extension.format({\n [PerMessageDeflate.extensionName]: [params]\n });\n headers.push(`Sec-WebSocket-Extensions: ${value}`);\n ws._extensions = extensions;\n }\n\n //\n // Allow external modification/inspection of handshake headers.\n //\n this.emit('headers', headers, req);\n\n socket.write(headers.concat('\\r\\n').join('\\r\\n'));\n socket.removeListener('error', socketOnError);\n\n ws.setSocket(socket, head, {\n allowSynchronousEvents: this.options.allowSynchronousEvents,\n maxPayload: this.options.maxPayload,\n skipUTF8Validation: this.options.skipUTF8Validation\n });\n\n if (this.clients) {\n this.clients.add(ws);\n ws.on('close', () => {\n this.clients.delete(ws);\n\n if (this._shouldEmitClose && !this.clients.size) {\n process.nextTick(emitClose, this);\n }\n });\n }\n\n cb(ws, req);\n }\n}\n\nmodule.exports = WebSocketServer;\n\n/**\n * Add event listeners on an `EventEmitter` using a map of <event, listener>\n * pairs.\n *\n * @param {EventEmitter} server The event emitter\n * @param {Object.<String, Function>} map The listeners to add\n * @return {Function} A function that will remove the added listeners when\n * called\n * @private\n */\nfunction addListeners(server, map) {\n for (const event of Object.keys(map)) server.on(event, map[event]);\n\n return function removeListeners() {\n for (const event of Object.keys(map)) {\n server.removeListener(event, map[event]);\n }\n };\n}\n\n/**\n * Emit a `'close'` event on an `EventEmitter`.\n *\n * @param {EventEmitter} server The event emitter\n * @private\n */\nfunction emitClose(server) {\n server._state = CLOSED;\n server.emit('close');\n}\n\n/**\n * Handle socket errors.\n *\n * @private\n */\nfunction socketOnError() {\n this.destroy();\n}\n\n/**\n * Close the connection when preconditions are not fulfilled.\n *\n * @param {Duplex} socket The socket of the upgrade request\n * @param {Number} code The HTTP response status code\n * @param {String} [message] The HTTP response body\n * @param {Object} [headers] Additional HTTP response headers\n * @private\n */\nfunction abortHandshake(socket, code, message, headers) {\n //\n // The socket is writable unless the user destroyed or ended it before calling\n // `server.handleUpgrade()` or in the `verifyClient` function, which is a user\n // error. Handling this does not make much sense as the worst that can happen\n // is that some of the data written by the user might be discarded due to the\n // call to `socket.end()` below, which triggers an `'error'` event that in\n // turn causes the socket to be destroyed.\n //\n message = message || http.STATUS_CODES[code];\n headers = {\n Connection: 'close',\n 'Content-Type': 'text/html',\n 'Content-Length': Buffer.byteLength(message),\n ...headers\n };\n\n socket.once('finish', socket.destroy);\n\n socket.end(\n `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\\r\\n` +\n Object.keys(headers)\n .map((h) => `${h}: ${headers[h]}`)\n .join('\\r\\n') +\n '\\r\\n\\r\\n' +\n message\n );\n}\n\n/**\n * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least\n * one listener for it, otherwise call `abortHandshake()`.\n *\n * @param {WebSocketServer} server The WebSocket server\n * @param {http.IncomingMessage} req The request object\n * @param {Duplex} socket The socket of the upgrade request\n * @param {Number} code The HTTP response status code\n * @param {String} message The HTTP response body\n * @param {Object} [headers] The HTTP response headers\n * @private\n */\nfunction abortHandshakeOrEmitwsClientError(\n server,\n req,\n socket,\n code,\n message,\n headers\n) {\n if (server.listenerCount('wsClientError')) {\n const err = new Error(message);\n Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);\n\n server.emit('wsClientError', err, socket, req);\n } else {\n abortHandshake(socket, code, message, headers);\n }\n}\n","import createWebSocketStream from './lib/stream.js';\nimport Receiver from './lib/receiver.js';\nimport Sender from './lib/sender.js';\nimport WebSocket from './lib/websocket.js';\nimport WebSocketServer from './lib/websocket-server.js';\n\nexport { createWebSocketStream, Receiver, Sender, WebSocket, WebSocketServer };\nexport default WebSocket;\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { hostname, platform } from \"node:os\";\nimport { ensureUiBridgeSecret } from \"@nextclaw/server\";\nimport WebSocket$1 from \"ws\";\n//#region src/register-remote-commands.ts\nfunction registerRemoteCommands(program, runtime) {\n\tconst remote = program.command(\"remote\").description(\"Manage remote access\");\n\tremote.command(\"enable\").description(\"Enable service-managed remote access\").option(\"--api-base <url>\", \"Platform API base (supports /v1 suffix)\").option(\"--name <name>\", \"Device display name\").action(async (opts) => runtime.enable(opts));\n\tremote.command(\"disable\").description(\"Disable service-managed remote access\").action(async () => runtime.disable());\n\tremote.command(\"status\").description(\"Show remote access status\").option(\"--json\", \"Print JSON\").action(async (opts) => runtime.status(opts));\n\tremote.command(\"doctor\").description(\"Run remote access diagnostics\").option(\"--json\", \"Print JSON\").action(async (opts) => runtime.doctor(opts));\n\tremote.command(\"connect\").description(\"Foreground debug mode: register this machine and keep the connector online\").option(\"--api-base <url>\", \"Platform API base (supports /v1 suffix)\").option(\"--local-origin <url>\", \"Local NextClaw UI origin (default: active service or http://127.0.0.1:55667)\").option(\"--name <name>\", \"Device display name\").option(\"--once\", \"Connect once without auto-reconnect\", false).action(async (opts) => runtime.connect(opts));\n}\n//#endregion\n//#region src/remote-runtime-actions.ts\nvar RemoteRuntimeActions = class {\n\tconstructor(deps) {\n\t\tthis.deps = deps;\n\t}\n\tasync connect(opts = {}) {\n\t\tawait this.deps.remoteCommands.connect(opts);\n\t}\n\tasync enable(opts = {}) {\n\t\tawait this.deps.initAuto(\"remote enable\");\n\t\tconst result = this.deps.remoteCommands.enableConfig(opts);\n\t\tconsole.log(\"✓ Remote access enabled\");\n\t\tif (result.config.remote.deviceName.trim()) console.log(`Instance: ${result.config.remote.deviceName.trim()}`);\n\t\tif (result.config.remote.platformApiBase.trim()) console.log(`Platform: ${result.config.remote.platformApiBase.trim()}`);\n\t\tif (this.deps.hasRunningManagedService()) {\n\t\t\tawait this.deps.restartBackgroundService(\"remote configuration updated\");\n\t\t\tconsole.log(\"✓ Applied remote settings to running background service\");\n\t\t\treturn;\n\t\t}\n\t\tconsole.log(`Tip: Run \"${this.deps.appName} start\" to bring the managed remote connector online.`);\n\t}\n\tasync disable() {\n\t\tconst result = this.deps.remoteCommands.disableConfig();\n\t\tconsole.log(result.changed ? \"✓ Remote access disabled\" : \"Remote access was already disabled\");\n\t\tif (this.deps.hasRunningManagedService()) {\n\t\t\tawait this.deps.restartBackgroundService(\"remote access disabled\");\n\t\t\tconsole.log(\"✓ Running background service restarted without remote access\");\n\t\t}\n\t}\n\tasync status(opts = {}) {\n\t\tawait this.deps.remoteCommands.status(opts);\n\t}\n\tasync doctor(opts = {}) {\n\t\tawait this.deps.remoteCommands.doctor(opts);\n\t}\n};\n//#endregion\n//#region src/platform-session-token.ts\nfunction decodeBase64UrlSegment(segment) {\n\ttry {\n\t\treturn Buffer.from(segment, \"base64url\").toString(\"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction decodePlatformSessionTokenPayload(token) {\n\tconst segments = token.split(\".\");\n\tif (segments.length !== 3 || segments[0] !== \"nca\" || !segments[1]) return null;\n\tconst raw = decodeBase64UrlSegment(segments[1]);\n\tif (!raw) return null;\n\ttry {\n\t\tconst parsed = JSON.parse(raw);\n\t\treturn typeof parsed === \"object\" && parsed !== null ? parsed : null;\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction readPlatformSessionTokenState(token) {\n\tif (typeof token !== \"string\" || token.trim().length === 0) return {\n\t\tvalid: false,\n\t\treason: \"missing\",\n\t\tpayload: null\n\t};\n\tconst payload = decodePlatformSessionTokenPayload(token.trim());\n\tif (!payload) return {\n\t\tvalid: false,\n\t\treason: \"malformed\",\n\t\tpayload: null\n\t};\n\tconst exp = typeof payload.exp === \"number\" && Number.isFinite(payload.exp) ? payload.exp : NaN;\n\tconst now = Math.floor(Date.now() / 1e3);\n\tif (!Number.isFinite(exp) || exp <= now) return {\n\t\tvalid: false,\n\t\treason: \"expired\",\n\t\tpayload\n\t};\n\treturn {\n\t\tvalid: true,\n\t\treason: \"valid\",\n\t\tpayload\n\t};\n}\nfunction isValidPlatformSessionToken(token) {\n\treturn readPlatformSessionTokenState(token).valid;\n}\n//#endregion\n//#region src/remote-platform-client.ts\nfunction ensureDir(path) {\n\tmkdirSync(path, { recursive: true });\n}\nfunction readJsonFile(path) {\n\tif (!existsSync(path)) return null;\n\ttry {\n\t\treturn JSON.parse(readFileSync(path, \"utf-8\"));\n\t} catch {\n\t\treturn null;\n\t}\n}\nfunction writeJsonFile(path, value) {\n\tensureDir(dirname(path));\n\twriteFileSync(path, `${JSON.stringify(value, null, 2)}\\n`, \"utf-8\");\n}\nfunction maskToken(value) {\n\tif (value.length <= 12) return \"<redacted>\";\n\treturn `${value.slice(0, 6)}...${value.slice(-4)}`;\n}\nfunction normalizeOptionalString(value) {\n\tif (typeof value !== \"string\") return;\n\tconst trimmed = value.trim();\n\treturn trimmed.length > 0 ? trimmed : void 0;\n}\nfunction delay(ms, signal) {\n\treturn new Promise((resolveDelay, rejectDelay) => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\tresolveDelay();\n\t\t}, ms);\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timer);\n\t\t\trejectDelay(/* @__PURE__ */ new Error(\"Remote connector aborted.\"));\n\t\t};\n\t\tif (signal) signal.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n}\nfunction redactWsUrl(url) {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\tconst token = parsed.searchParams.get(\"token\");\n\t\tif (token) parsed.searchParams.set(\"token\", maskToken(token));\n\t\treturn parsed.toString();\n\t} catch {\n\t\treturn url;\n\t}\n}\nvar RemotePlatformClient = class {\n\tconstructor(deps) {\n\t\tthis.deps = deps;\n\t}\n\tget remoteDir() {\n\t\treturn join(this.deps.getDataDir(), \"remote\");\n\t}\n\tget devicePath() {\n\t\treturn join(this.remoteDir, \"device.json\");\n\t}\n\tresolveRunContext(opts) {\n\t\tconst { platformBase, token, config } = this.resolvePlatformAccess(opts);\n\t\treturn {\n\t\t\tconfig,\n\t\t\tplatformBase,\n\t\t\ttoken,\n\t\t\tlocalOrigin: this.resolveLocalOrigin(config, opts),\n\t\t\tdisplayName: this.resolveDisplayName(config, opts),\n\t\t\tdeviceInstallId: this.ensureDeviceInstallId(),\n\t\t\tautoReconnect: opts.once ? false : opts.autoReconnect ?? config.remote.autoReconnect\n\t\t};\n\t}\n\tasync registerDevice(params) {\n\t\tconst response = await fetch(`${params.platformBase}/platform/remote/instances/register`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"content-type\": \"application/json\",\n\t\t\t\tauthorization: `Bearer ${params.token}`\n\t\t\t},\n\t\t\tbody: JSON.stringify({\n\t\t\t\tdeviceInstallId: params.deviceInstallId,\n\t\t\t\tdisplayName: params.displayName,\n\t\t\t\tplatform: platform(),\n\t\t\t\tappVersion: this.deps.getPackageVersion(),\n\t\t\t\tlocalOrigin: params.localOrigin\n\t\t\t})\n\t\t});\n\t\tconst payload = await response.json();\n\t\tconst instance = payload.data?.instance;\n\t\tif (response.ok && payload.ok && instance) return {\n\t\t\tid: instance.id,\n\t\t\tdeviceInstallId: instance.instanceInstallId,\n\t\t\tdisplayName: instance.displayName,\n\t\t\tplatform: instance.platform,\n\t\t\tappVersion: instance.appVersion,\n\t\t\tlocalOrigin: instance.localOrigin,\n\t\t\tstatus: instance.status,\n\t\t\tlastSeenAt: instance.lastSeenAt,\n\t\t\tcreatedAt: instance.createdAt,\n\t\t\tupdatedAt: instance.updatedAt\n\t\t};\n\t\tif (!response.ok || !payload.ok || !payload.data?.device) throw new Error(payload.error?.message ?? `Failed to register remote instance (${response.status}).`);\n\t\treturn payload.data.device;\n\t}\n\tensureDeviceInstallId() {\n\t\tconst existing = readJsonFile(this.devicePath);\n\t\tif (existing?.deviceInstallId?.trim()) return existing.deviceInstallId.trim();\n\t\tconst deviceInstallId = crypto.randomUUID();\n\t\tensureDir(this.remoteDir);\n\t\twriteJsonFile(this.devicePath, { deviceInstallId });\n\t\treturn deviceInstallId;\n\t}\n\tresolvePlatformAccess(opts) {\n\t\tconst config = this.deps.loadConfig();\n\t\tconst nextclawProvider = config.providers.nextclaw;\n\t\tconst token = typeof nextclawProvider?.apiKey === \"string\" ? nextclawProvider.apiKey.trim() : \"\";\n\t\tconst tokenState = readPlatformSessionTokenState(token);\n\t\tif (tokenState.reason === \"missing\") throw new Error(\"NextClaw platform token is missing. Run \\\"nextclaw login\\\" first.\");\n\t\tif (tokenState.reason === \"expired\") throw new Error(\"NextClaw platform token expired. Run \\\"nextclaw login\\\" or browser sign-in again.\");\n\t\tif (tokenState.reason === \"malformed\") throw new Error(\"NextClaw platform token is invalid. Run \\\"nextclaw login\\\" again.\");\n\t\tconst configuredApiBase = normalizeOptionalString(config.remote.platformApiBase) ?? (typeof nextclawProvider?.apiBase === \"string\" ? nextclawProvider.apiBase.trim() : \"\");\n\t\tconst rawApiBase = normalizeOptionalString(opts.apiBase) ?? configuredApiBase;\n\t\tif (!rawApiBase) throw new Error(\"Platform API base is missing. Pass --api-base, run nextclaw login, or set remote.platformApiBase.\");\n\t\treturn {\n\t\t\tplatformBase: this.deps.resolvePlatformBase(rawApiBase),\n\t\t\ttoken: token.trim(),\n\t\t\tconfig\n\t\t};\n\t}\n\tresolveLocalOrigin(config, opts) {\n\t\tconst explicitOrigin = normalizeOptionalString(opts.localOrigin);\n\t\tif (explicitOrigin) return explicitOrigin.replace(/\\/$/, \"\");\n\t\tconst state = this.deps.readManagedServiceState?.();\n\t\tif (state && this.deps.isProcessRunning?.(state.pid) && Number.isFinite(state.uiPort)) return `http://127.0.0.1:${state.uiPort}`;\n\t\treturn `http://127.0.0.1:${typeof config.ui?.port === \"number\" && Number.isFinite(config.ui.port) ? config.ui.port : 55667}`;\n\t}\n\tresolveDisplayName(config, opts) {\n\t\treturn normalizeOptionalString(opts.name) ?? normalizeOptionalString(config.remote.deviceName) ?? hostname();\n\t}\n};\n//#endregion\n//#region src/remote-relay-bridge.ts\nfunction encodeBase64(bytes) {\n\treturn Buffer.from(bytes).toString(\"base64\");\n}\nfunction decodeBase64(base64) {\n\tif (!base64) return new Uint8Array();\n\treturn new Uint8Array(Buffer.from(base64, \"base64\"));\n}\nvar RemoteRelayBridge = class {\n\tconstructor(localOrigin) {\n\t\tthis.localOrigin = localOrigin;\n\t}\n\tasync ensureLocalUiHealthy() {\n\t\tif (!(await fetch(`${this.localOrigin}/api/health`)).ok) throw new Error(`Local UI is not healthy at ${this.localOrigin}. Start NextClaw first.`);\n\t}\n\tasync forward(frame, socket) {\n\t\tconst bridgeCookie = await this.requestBridgeCookie();\n\t\tconst url = new URL(frame.path, this.localOrigin);\n\t\tconst headers = this.createForwardHeaders(frame.headers, bridgeCookie);\n\t\tconst response = await fetch(url, {\n\t\t\tmethod: frame.method,\n\t\t\theaders,\n\t\t\tbody: frame.method === \"GET\" || frame.method === \"HEAD\" ? void 0 : decodeBase64(frame.bodyBase64)\n\t\t});\n\t\tconst responseHeaders = Array.from(response.headers.entries()).filter(([key]) => {\n\t\t\tconst lower = key.toLowerCase();\n\t\t\treturn ![\n\t\t\t\t\"content-length\",\n\t\t\t\t\"connection\",\n\t\t\t\t\"transfer-encoding\",\n\t\t\t\t\"set-cookie\"\n\t\t\t].includes(lower);\n\t\t});\n\t\tconst contentType = response.headers.get(\"content-type\")?.toLowerCase() ?? \"\";\n\t\tif (response.body && contentType.startsWith(\"text/event-stream\")) {\n\t\t\tawait this.sendStreamingResponse({\n\t\t\t\tframe,\n\t\t\t\tresponse,\n\t\t\t\tresponseHeaders,\n\t\t\t\tsocket\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst responseBody = response.body ? new Uint8Array(await response.arrayBuffer()) : new Uint8Array();\n\t\tsocket.send(JSON.stringify({\n\t\t\ttype: \"response\",\n\t\t\trequestId: frame.requestId,\n\t\t\tstatus: response.status,\n\t\t\theaders: responseHeaders,\n\t\t\tbodyBase64: encodeBase64(responseBody)\n\t\t}));\n\t}\n\tcreateForwardHeaders(headersList, bridgeCookie) {\n\t\tconst headers = new Headers();\n\t\tfor (const [key, value] of headersList) {\n\t\t\tconst lower = key.toLowerCase();\n\t\t\tif ([\n\t\t\t\t\"host\",\n\t\t\t\t\"connection\",\n\t\t\t\t\"content-length\",\n\t\t\t\t\"cookie\",\n\t\t\t\t\"x-forwarded-for\",\n\t\t\t\t\"x-forwarded-proto\",\n\t\t\t\t\"cf-connecting-ip\"\n\t\t\t].includes(lower)) continue;\n\t\t\theaders.set(key, value);\n\t\t}\n\t\tif (bridgeCookie) headers.set(\"cookie\", bridgeCookie);\n\t\treturn headers;\n\t}\n\tasync requestBridgeCookie() {\n\t\tconst response = await fetch(`${this.localOrigin}/api/auth/bridge`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { \"x-nextclaw-ui-bridge-secret\": ensureUiBridgeSecret() }\n\t\t});\n\t\tconst payload = await response.json();\n\t\tif (!response.ok || !payload.ok) throw new Error(payload.error?.message ?? `Failed to request local auth bridge (${response.status}).`);\n\t\treturn typeof payload.data?.cookie === \"string\" && payload.data.cookie.trim().length > 0 ? payload.data.cookie.trim() : null;\n\t}\n\tasync sendStreamingResponse(params) {\n\t\tparams.socket.send(JSON.stringify({\n\t\t\ttype: \"response.start\",\n\t\t\trequestId: params.frame.requestId,\n\t\t\tstatus: params.response.status,\n\t\t\theaders: params.responseHeaders\n\t\t}));\n\t\tconst reader = params.response.body?.getReader();\n\t\tif (!reader) {\n\t\t\tparams.socket.send(JSON.stringify({\n\t\t\t\ttype: \"response.end\",\n\t\t\t\trequestId: params.frame.requestId\n\t\t\t}));\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\twhile (true) {\n\t\t\t\tconst { value, done } = await reader.read();\n\t\t\t\tif (done) break;\n\t\t\t\tif (value && value.length > 0) params.socket.send(JSON.stringify({\n\t\t\t\t\ttype: \"response.chunk\",\n\t\t\t\t\trequestId: params.frame.requestId,\n\t\t\t\t\tbodyBase64: encodeBase64(value)\n\t\t\t\t}));\n\t\t\t}\n\t\t} finally {\n\t\t\treader.releaseLock();\n\t\t}\n\t\tparams.socket.send(JSON.stringify({\n\t\t\ttype: \"response.end\",\n\t\t\trequestId: params.frame.requestId\n\t\t}));\n\t}\n};\n//#endregion\n//#region src/remote-app-stream.ts\nfunction parseRemoteSseFrame(frame) {\n\tconst lines = frame.split(\"\\n\");\n\tlet event = \"\";\n\tconst dataLines = [];\n\tfor (const raw of lines) {\n\t\tconst line = raw.trimEnd();\n\t\tif (!line || line.startsWith(\":\")) continue;\n\t\tif (line.startsWith(\"event:\")) {\n\t\t\tevent = line.slice(6).trim();\n\t\t\tcontinue;\n\t\t}\n\t\tif (line.startsWith(\"data:\")) dataLines.push(line.slice(5).trimStart());\n\t}\n\tif (!event) return null;\n\tconst data = dataLines.join(\"\\n\");\n\tif (!data) return { event };\n\ttry {\n\t\treturn {\n\t\t\tevent,\n\t\t\tpayload: JSON.parse(data)\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tevent,\n\t\t\tpayload: data\n\t\t};\n\t}\n}\nfunction processRemoteStreamFrame(params) {\n\tconst frame = parseRemoteSseFrame(params.rawFrame);\n\tif (!frame) return;\n\tparams.onEvent(frame);\n}\nfunction flushRemoteStreamFrames(params) {\n\tlet boundary = params.bufferState.value.indexOf(\"\\n\\n\");\n\twhile (boundary !== -1) {\n\t\tprocessRemoteStreamFrame({\n\t\t\trawFrame: params.bufferState.value.slice(0, boundary),\n\t\t\tonEvent: params.onEvent\n\t\t});\n\t\tparams.bufferState.value = params.bufferState.value.slice(boundary + 2);\n\t\tboundary = params.bufferState.value.indexOf(\"\\n\\n\");\n\t}\n}\nasync function readRemoteAppStreamResult(params) {\n\tconst reader = params.response.body?.getReader();\n\tif (!reader) throw new Error(\"SSE response body unavailable.\");\n\tconst decoder = new TextDecoder();\n\tconst bufferState = { value: \"\" };\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { value, done } = await reader.read();\n\t\t\tif (done) break;\n\t\t\tbufferState.value += decoder.decode(value, { stream: true });\n\t\t\tflushRemoteStreamFrames({\n\t\t\t\tbufferState,\n\t\t\t\tonEvent: params.onEvent\n\t\t\t});\n\t\t}\n\t\tif (bufferState.value.trim()) processRemoteStreamFrame({\n\t\t\trawFrame: bufferState.value,\n\t\t\tonEvent: params.onEvent\n\t\t});\n\t} finally {\n\t\treader.releaseLock();\n\t}\n}\n//#endregion\n//#region src/remote-app.adapter.ts\nfunction toWebSocketUrl(origin, path) {\n\tconst normalizedOrigin = origin.replace(/\\/$/, \"\");\n\tif (normalizedOrigin.startsWith(\"https://\")) return `${normalizedOrigin.replace(/^https:/, \"wss:\")}${path}`;\n\tif (normalizedOrigin.startsWith(\"http://\")) return `${normalizedOrigin.replace(/^http:/, \"ws:\")}${path}`;\n\treturn `${normalizedOrigin}${path}`;\n}\nfunction readErrorMessage(body, fallback) {\n\tif (typeof body === \"object\" && body && \"error\" in body) {\n\t\tconst typed = body;\n\t\tif (typed.error?.message) return typed.error.message;\n\t}\n\tif (typeof body === \"string\" && body.trim()) return body.trim();\n\treturn fallback;\n}\nvar RemoteAppAdapter = class {\n\trelayBridge;\n\tactiveStreams = /* @__PURE__ */ new Map();\n\tlocalEventSocket = null;\n\teventReconnectTimer = null;\n\tshuttingDown = false;\n\tconstructor(localOrigin, platformSocket) {\n\t\tthis.localOrigin = localOrigin;\n\t\tthis.platformSocket = platformSocket;\n\t\tthis.relayBridge = new RemoteRelayBridge(localOrigin);\n\t}\n\tasync start() {\n\t\tawait this.ensureEventSocket();\n\t}\n\tstop() {\n\t\tthis.shuttingDown = true;\n\t\tif (this.eventReconnectTimer) {\n\t\t\tclearTimeout(this.eventReconnectTimer);\n\t\t\tthis.eventReconnectTimer = null;\n\t\t}\n\t\tthis.localEventSocket?.close();\n\t\tthis.localEventSocket = null;\n\t\tfor (const controller of this.activeStreams.values()) controller.abort();\n\t\tthis.activeStreams.clear();\n\t}\n\tasync handle(frame) {\n\t\tif (frame.type === \"client.request\") {\n\t\t\tawait this.handleRequest(frame);\n\t\t\treturn;\n\t\t}\n\t\tif (frame.type === \"client.stream.open\") {\n\t\t\tthis.handleStream(frame);\n\t\t\treturn;\n\t\t}\n\t\tif (frame.type === \"client.stream.cancel\") {\n\t\t\tthis.activeStreams.get(frame.streamId)?.abort();\n\t\t\tthis.activeStreams.delete(frame.streamId);\n\t\t}\n\t}\n\tasync handleRequest(frame) {\n\t\tconst bridgeCookie = await this.relayBridge.requestBridgeCookie();\n\t\tconst response = await fetch(new URL(frame.target.path, this.localOrigin), {\n\t\t\tmethod: frame.target.method,\n\t\t\theaders: this.createJsonHeaders(bridgeCookie),\n\t\t\tbody: this.buildRequestBody(frame.target)\n\t\t});\n\t\tconst body = await this.readResponseBody(response);\n\t\tthis.send({\n\t\t\ttype: \"client.response\",\n\t\t\tclientId: frame.clientId,\n\t\t\tid: frame.id,\n\t\t\tstatus: response.status,\n\t\t\tbody\n\t\t});\n\t}\n\tasync handleStream(frame) {\n\t\tconst controller = new AbortController();\n\t\tthis.activeStreams.set(frame.streamId, controller);\n\t\ttry {\n\t\t\tconst response = await this.openStreamResponse(frame, controller);\n\t\t\tif (!response) return;\n\t\t\tawait readRemoteAppStreamResult({\n\t\t\t\tresponse,\n\t\t\t\tonEvent: (event) => {\n\t\t\t\t\tthis.send({\n\t\t\t\t\t\ttype: \"client.stream.event\",\n\t\t\t\t\t\tclientId: frame.clientId,\n\t\t\t\t\t\tstreamId: frame.streamId,\n\t\t\t\t\t\tevent: event.event,\n\t\t\t\t\t\tpayload: event.payload\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.send({\n\t\t\t\ttype: \"client.stream.end\",\n\t\t\t\tclientId: frame.clientId,\n\t\t\t\tstreamId: frame.streamId\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (controller.signal.aborted) return;\n\t\t\tthis.send({\n\t\t\t\ttype: \"client.stream.error\",\n\t\t\t\tclientId: frame.clientId,\n\t\t\t\tstreamId: frame.streamId,\n\t\t\t\tmessage: error instanceof Error ? error.message : String(error)\n\t\t\t});\n\t\t} finally {\n\t\t\tthis.activeStreams.delete(frame.streamId);\n\t\t}\n\t}\n\tasync openStreamResponse(frame, controller) {\n\t\tconst bridgeCookie = await this.relayBridge.requestBridgeCookie();\n\t\tconst response = await fetch(new URL(frame.target.path, this.localOrigin), {\n\t\t\tmethod: frame.target.method,\n\t\t\theaders: this.createStreamHeaders(bridgeCookie),\n\t\t\tbody: this.buildRequestBody(frame.target),\n\t\t\tsignal: controller.signal\n\t\t});\n\t\tif (response.ok) return response;\n\t\tconst errorBody = await this.readResponseBody(response);\n\t\tthis.send({\n\t\t\ttype: \"client.stream.error\",\n\t\t\tclientId: frame.clientId,\n\t\t\tstreamId: frame.streamId,\n\t\t\tmessage: readErrorMessage(errorBody, `HTTP ${response.status}`)\n\t\t});\n\t\treturn null;\n\t}\n\tasync ensureEventSocket() {\n\t\tif (this.localEventSocket && this.localEventSocket.readyState === WebSocket$1.OPEN) return;\n\t\tconst bridgeCookie = await this.relayBridge.requestBridgeCookie();\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tconst socket = new WebSocket$1(toWebSocketUrl(this.localOrigin, \"/ws\"), { headers: bridgeCookie ? { Cookie: bridgeCookie } : void 0 });\n\t\t\tthis.localEventSocket = socket;\n\t\t\tsocket.on(\"open\", () => resolve());\n\t\t\tsocket.on(\"message\", (data) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst event = JSON.parse(String(data ?? \"\"));\n\t\t\t\t\tthis.send({\n\t\t\t\t\t\ttype: \"client.event\",\n\t\t\t\t\t\tevent\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(\"Failed to parse local ui event:\", error);\n\t\t\t\t}\n\t\t\t});\n\t\t\tsocket.on(\"close\", () => {\n\t\t\t\tthis.localEventSocket = null;\n\t\t\t\tif (!this.shuttingDown) this.scheduleEventReconnect();\n\t\t\t});\n\t\t\tsocket.on(\"error\", (error) => {\n\t\t\t\tif (!this.shuttingDown) reject(error instanceof Error ? error : new Error(String(error)));\n\t\t\t});\n\t\t});\n\t}\n\tscheduleEventReconnect() {\n\t\tif (this.eventReconnectTimer) return;\n\t\tthis.eventReconnectTimer = setTimeout(() => {\n\t\t\tthis.eventReconnectTimer = null;\n\t\t\tthis.ensureEventSocket().catch(() => void 0);\n\t\t}, 3e3);\n\t}\n\tbuildRequestBody(target) {\n\t\tif (target.method === \"GET\" || target.method === \"HEAD\") return;\n\t\tif (target.body === void 0) return;\n\t\treturn new TextEncoder().encode(JSON.stringify(target.body));\n\t}\n\tcreateJsonHeaders(bridgeCookie) {\n\t\tconst headers = new Headers({ \"Content-Type\": \"application/json\" });\n\t\tif (bridgeCookie) headers.set(\"cookie\", bridgeCookie);\n\t\treturn headers;\n\t}\n\tcreateStreamHeaders(bridgeCookie) {\n\t\tconst headers = this.createJsonHeaders(bridgeCookie);\n\t\theaders.set(\"Accept\", \"text/event-stream\");\n\t\treturn headers;\n\t}\n\tasync readResponseBody(response) {\n\t\tif ((response.headers.get(\"content-type\")?.toLowerCase() ?? \"\").includes(\"application/json\")) return await response.json();\n\t\treturn await response.text();\n\t}\n\tsend(frame) {\n\t\tif (this.platformSocket.readyState !== WebSocket$1.OPEN) return;\n\t\tthis.platformSocket.send(JSON.stringify(frame));\n\t}\n};\n//#endregion\n//#region src/remote-connector-error.ts\nconst TERMINAL_REMOTE_ERROR_PATTERNS = [\n\t/invalid or expired token/i,\n\t/missing bearer token/i,\n\t/token expired/i,\n\t/token is invalid/i,\n\t/run \"nextclaw login\"/i,\n\t/replaced by a newer connector session/i,\n\t/already owned by (?:running )?nextclaw service/i,\n\t/already owned by local nextclaw process/i,\n\t/unexpected server response:\\s*400/i,\n\t/unexpected server response:\\s*401/i,\n\t/unexpected server response:\\s*403/i,\n\t/unexpected server response:\\s*404/i,\n\t/invalid url/i,\n\t/unsupported protocol/i\n];\nfunction isTerminalRemoteConnectorError(error) {\n\tconst message = error instanceof Error ? error.message : String(error);\n\treturn TERMINAL_REMOTE_ERROR_PATTERNS.some((pattern) => pattern.test(message));\n}\nfunction describeUnexpectedRemoteConnectorClose(event) {\n\tconst code = typeof event.code === \"number\" && Number.isFinite(event.code) ? event.code : null;\n\tconst reason = typeof event.reason === \"string\" ? event.reason.trim() : \"\";\n\tconst wasClean = typeof event.wasClean === \"boolean\" ? event.wasClean : null;\n\tif ((code === null || code === 1e3) && !reason) return null;\n\tconst detailParts = [];\n\tif (code !== null) detailParts.push(`code ${code}`);\n\tif (wasClean !== null) detailParts.push(wasClean ? \"clean\" : \"unclean\");\n\tconst detail = detailParts.length > 0 ? ` (${detailParts.join(\", \")})` : \"\";\n\tif (reason) return `Remote connector websocket closed${detail}: ${reason}`;\n\treturn `Remote connector websocket closed${detail}.`;\n}\n//#endregion\n//#region src/remote-connector-retry.utils.ts\nconst BASE_RECONNECT_DELAY_MS = 3e3;\nconst MAX_RECONNECT_DELAY_MS = 30 * 6e4;\nconst RECONNECT_JITTER_RATIO = .2;\nfunction resolveReconnectDelayMs(attempt, random) {\n\tconst exponentialDelayMs = Math.min(BASE_RECONNECT_DELAY_MS * 2 ** Math.max(0, attempt - 1), MAX_RECONNECT_DELAY_MS);\n\tconst jitterRatio = (random() * 2 - 1) * RECONNECT_JITTER_RATIO;\n\treturn Math.max(BASE_RECONNECT_DELAY_MS, Math.round(exponentialDelayMs * (1 + jitterRatio)));\n}\nfunction formatReconnectDelay(delayMs) {\n\tconst seconds = delayMs / 1e3;\n\treturn Number.isInteger(seconds) ? `${seconds}s` : `${seconds.toFixed(1)}s`;\n}\n//#endregion\n//#region src/remote-connector-websocket-error.utils.ts\nfunction readRemoteConnectorSocketErrorMessage(event) {\n\tconst typedEvent = event;\n\tif (typeof typedEvent.message === \"string\") {\n\t\tconst directMessage = typedEvent.message.trim();\n\t\tif (directMessage.length > 0) return directMessage;\n\t}\n\tconst nestedError = typedEvent.error;\n\tif (nestedError instanceof Error && nestedError.message.trim().length > 0) return nestedError.message.trim();\n\tif (typeof nestedError === \"string\" && nestedError.trim().length > 0) return nestedError.trim();\n\tif (typeof nestedError === \"object\" && nestedError && typeof nestedError.message === \"string\") {\n\t\tconst nestedMessage = nestedError.message.trim();\n\t\tif (nestedMessage.length > 0) return nestedMessage;\n\t}\n\treturn \"Remote connector websocket failed.\";\n}\n//#endregion\n//#region src/remote-connector.ts\nconst CONNECTOR_KEEPALIVE_INTERVAL_MS = 25e3;\nconst CONNECTOR_KEEPALIVE_FRAME = JSON.stringify({ type: \"connector.ping\" });\nvar RemoteConnector = class {\n\tconstructor(deps) {\n\t\tthis.deps = deps;\n\t}\n\tget logger() {\n\t\treturn this.deps.logger ?? console;\n\t}\n\tget delayFn() {\n\t\treturn this.deps.delayFn ?? delay;\n\t}\n\tget random() {\n\t\treturn this.deps.random ?? Math.random;\n\t}\n\tcreateSocket(wsUrl) {\n\t\treturn this.deps.createSocket?.(wsUrl) ?? new WebSocket(wsUrl);\n\t}\n\tasync connectOnce(params) {\n\t\treturn await new Promise((resolve, reject) => {\n\t\t\tconst socket = this.createSocket(params.wsUrl);\n\t\t\tconst appAdapter = new RemoteAppAdapter(params.localOrigin, socket);\n\t\t\tlet keepaliveTimer = null;\n\t\t\tlet settled = false;\n\t\t\tlet aborted = false;\n\t\t\tconst cleanup = () => {\n\t\t\t\tif (keepaliveTimer) {\n\t\t\t\t\tclearInterval(keepaliveTimer);\n\t\t\t\t\tkeepaliveTimer = null;\n\t\t\t\t}\n\t\t\t\tparams.signal?.removeEventListener(\"abort\", onAbort);\n\t\t\t};\n\t\t\tconst finishResolve = (value) => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\tcleanup();\n\t\t\t\tresolve(value);\n\t\t\t};\n\t\t\tconst finishReject = (error) => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\tcleanup();\n\t\t\t\treject(error);\n\t\t\t};\n\t\t\tconst onAbort = () => {\n\t\t\t\taborted = true;\n\t\t\t\ttry {\n\t\t\t\t\tsocket.close(1e3, \"Remote connector aborted\");\n\t\t\t\t} catch {\n\t\t\t\t\tfinishResolve(\"aborted\");\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (params.signal) if (params.signal.aborted) onAbort();\n\t\t\telse params.signal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\tsocket.addEventListener(\"open\", () => {\n\t\t\t\tkeepaliveTimer = setInterval(() => {\n\t\t\t\t\tif (socket.readyState !== 1) return;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsocket.send(CONNECTOR_KEEPALIVE_FRAME);\n\t\t\t\t\t} catch {}\n\t\t\t\t}, CONNECTOR_KEEPALIVE_INTERVAL_MS);\n\t\t\t\tparams.statusStore?.write({\n\t\t\t\t\tenabled: true,\n\t\t\t\t\tstate: \"connected\",\n\t\t\t\t\tdeviceId: params.deviceId,\n\t\t\t\t\tdeviceName: params.displayName,\n\t\t\t\t\tplatformBase: params.platformBase,\n\t\t\t\t\tlocalOrigin: params.localOrigin,\n\t\t\t\t\tlastConnectedAt: (/* @__PURE__ */ new Date()).toISOString(),\n\t\t\t\t\tlastError: null\n\t\t\t\t});\n\t\t\t\tthis.logger.info(`✓ Remote connector connected: ${redactWsUrl(params.wsUrl)}`);\n\t\t\t\tappAdapter.start().catch((error) => {\n\t\t\t\t\tthis.logger.error(`Remote event bridge error: ${error instanceof Error ? error.message : String(error)}`);\n\t\t\t\t});\n\t\t\t});\n\t\t\tsocket.addEventListener(\"message\", (event) => {\n\t\t\t\tthis.handleSocketMessage({\n\t\t\t\t\tdata: event.data,\n\t\t\t\t\trelayBridge: params.relayBridge,\n\t\t\t\t\tappAdapter,\n\t\t\t\t\tsocket\n\t\t\t\t});\n\t\t\t});\n\t\t\tsocket.addEventListener(\"close\", (event) => {\n\t\t\t\tappAdapter.stop();\n\t\t\t\tconst closeMessage = describeUnexpectedRemoteConnectorClose(event ?? {});\n\t\t\t\tif (!aborted && closeMessage) {\n\t\t\t\t\tfinishReject(new Error(closeMessage));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfinishResolve(aborted ? \"aborted\" : \"closed\");\n\t\t\t});\n\t\t\tsocket.addEventListener(\"error\", (event) => {\n\t\t\t\tappAdapter.stop();\n\t\t\t\tif (aborted) {\n\t\t\t\t\tfinishResolve(\"aborted\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfinishReject(new Error(readRemoteConnectorSocketErrorMessage(event)));\n\t\t\t});\n\t\t});\n\t}\n\thandleSocketMessage(params) {\n\t\t(async () => {\n\t\t\tconst frame = this.parseRelayFrame(params.data);\n\t\t\tif (!frame) return;\n\t\t\ttry {\n\t\t\t\tif (frame.type === \"request\") {\n\t\t\t\t\tawait params.relayBridge.forward(frame, params.socket);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tawait params.appAdapter.handle(frame);\n\t\t\t} catch (error) {\n\t\t\t\tif (frame.type === \"request\") {\n\t\t\t\t\tparams.socket.send(JSON.stringify({\n\t\t\t\t\t\ttype: \"response.error\",\n\t\t\t\t\t\trequestId: frame.requestId,\n\t\t\t\t\t\tmessage: error instanceof Error ? error.message : String(error)\n\t\t\t\t\t}));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (frame.type === \"client.request\") {\n\t\t\t\t\tparams.socket.send(JSON.stringify({\n\t\t\t\t\t\ttype: \"client.request.error\",\n\t\t\t\t\t\tclientId: frame.clientId,\n\t\t\t\t\t\tid: frame.id,\n\t\t\t\t\t\tmessage: error instanceof Error ? error.message : String(error)\n\t\t\t\t\t}));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tparams.socket.send(JSON.stringify({\n\t\t\t\t\ttype: \"client.stream.error\",\n\t\t\t\t\tclientId: frame.clientId,\n\t\t\t\t\tstreamId: frame.streamId,\n\t\t\t\t\tmessage: error instanceof Error ? error.message : String(error)\n\t\t\t\t}));\n\t\t\t}\n\t\t})();\n\t}\n\tparseRelayFrame(data) {\n\t\ttry {\n\t\t\tconst frame = JSON.parse(String(data ?? \"\"));\n\t\t\tif (typeof frame !== \"object\" || !frame || typeof frame.type !== \"string\") return null;\n\t\t\tif (frame.type === \"request\") return frame;\n\t\t\tif (frame.type === \"client.request\" || frame.type === \"client.stream.open\" || frame.type === \"client.stream.cancel\") return frame;\n\t\t\treturn null;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\tasync ensureDevice(params) {\n\t\tif (params.device) return params.device;\n\t\tconst device = await this.deps.platformClient.registerDevice({\n\t\t\tplatformBase: params.context.platformBase,\n\t\t\ttoken: params.context.token,\n\t\t\tdeviceInstallId: params.context.deviceInstallId,\n\t\t\tdisplayName: params.context.displayName,\n\t\t\tlocalOrigin: params.context.localOrigin\n\t\t});\n\t\tthis.logger.info(`✓ Remote instance registered: ${device.displayName} (${device.id})`);\n\t\tthis.logger.info(`✓ Local origin: ${params.context.localOrigin}`);\n\t\tthis.logger.info(`✓ Platform: ${params.context.platformBase}`);\n\t\treturn device;\n\t}\n\twriteRemoteState(statusStore, next) {\n\t\tstatusStore?.write(next);\n\t}\n\tasync runCycle(params) {\n\t\tlet device = params.device;\n\t\ttry {\n\t\t\tthis.writeRemoteState(params.opts.statusStore, {\n\t\t\t\tenabled: true,\n\t\t\t\tstate: \"connecting\",\n\t\t\t\tdeviceId: params.device?.id,\n\t\t\t\tdeviceName: params.context.displayName,\n\t\t\t\tplatformBase: params.context.platformBase,\n\t\t\t\tlocalOrigin: params.context.localOrigin,\n\t\t\t\tlastError: null\n\t\t\t});\n\t\t\tdevice = await this.ensureDevice({\n\t\t\t\tdevice,\n\t\t\t\tcontext: params.context\n\t\t\t});\n\t\t\tconst wsUrl = `${params.context.platformBase.replace(/^http/i, \"ws\")}/platform/remote/connect?instanceId=${encodeURIComponent(device.id)}&token=${encodeURIComponent(params.context.token)}`;\n\t\t\tconst outcome = await this.connectOnce({\n\t\t\t\twsUrl,\n\t\t\t\trelayBridge: params.relayBridge,\n\t\t\t\tsignal: params.opts.signal,\n\t\t\t\tstatusStore: params.opts.statusStore,\n\t\t\t\tdisplayName: params.context.displayName,\n\t\t\t\tdeviceId: device.id,\n\t\t\t\tplatformBase: params.context.platformBase,\n\t\t\t\tlocalOrigin: params.context.localOrigin\n\t\t\t});\n\t\t\tif (outcome !== \"aborted\") this.writeRemoteState(params.opts.statusStore, {\n\t\t\t\tenabled: true,\n\t\t\t\tstate: \"disconnected\",\n\t\t\t\tdeviceId: device.id,\n\t\t\t\tdeviceName: params.context.displayName,\n\t\t\t\tplatformBase: params.context.platformBase,\n\t\t\t\tlocalOrigin: params.context.localOrigin,\n\t\t\t\tlastError: null\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdevice,\n\t\t\t\toutcome: outcome === \"aborted\" ? \"aborted\" : \"retry\",\n\t\t\t\tretryFailure: false,\n\t\t\t\tlastError: null\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tthis.writeRemoteState(params.opts.statusStore, {\n\t\t\t\tenabled: true,\n\t\t\t\tstate: \"error\",\n\t\t\t\tdeviceId: params.device?.id,\n\t\t\t\tdeviceName: params.context.displayName,\n\t\t\t\tplatformBase: params.context.platformBase,\n\t\t\t\tlocalOrigin: params.context.localOrigin,\n\t\t\t\tlastError: message\n\t\t\t});\n\t\t\tthis.logger.error(`Remote connector error: ${message}`);\n\t\t\treturn {\n\t\t\t\tdevice,\n\t\t\t\toutcome: isTerminalRemoteConnectorError(error) ? \"stop\" : \"retry\",\n\t\t\t\tretryFailure: true,\n\t\t\t\tlastError: message\n\t\t\t};\n\t\t}\n\t}\n\tasync run(opts = {}) {\n\t\tconst context = this.deps.platformClient.resolveRunContext(opts);\n\t\tconst relayBridge = (this.deps.relayBridgeFactory ?? ((localOrigin) => new RemoteRelayBridge(localOrigin)))(context.localOrigin);\n\t\tawait relayBridge.ensureLocalUiHealthy();\n\t\tlet device = null;\n\t\tlet preserveRuntimeError = false;\n\t\tlet consecutiveReconnectFailures = 0;\n\t\twhile (!opts.signal?.aborted) {\n\t\t\tconst cycle = await this.runCycle({\n\t\t\t\tdevice,\n\t\t\t\tcontext,\n\t\t\t\trelayBridge,\n\t\t\t\topts\n\t\t\t});\n\t\t\tdevice = cycle.device;\n\t\t\tconsecutiveReconnectFailures = cycle.retryFailure ? consecutiveReconnectFailures + 1 : 0;\n\t\t\tif (cycle.outcome === \"stop\") {\n\t\t\t\tpreserveRuntimeError = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (cycle.outcome === \"aborted\" || !context.autoReconnect || opts.signal?.aborted) break;\n\t\t\tconst reconnectDelayMs = resolveReconnectDelayMs(cycle.retryFailure ? consecutiveReconnectFailures : 1, this.random);\n\t\t\tthis.logger.warn(`Remote connector disconnected. Reconnecting in ${formatReconnectDelay(reconnectDelayMs)}...`);\n\t\t\ttry {\n\t\t\t\tawait this.delayFn(reconnectDelayMs, opts.signal);\n\t\t\t} catch {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (preserveRuntimeError) return;\n\t\tthis.writeRemoteState(opts.statusStore, {\n\t\t\tenabled: opts.mode === \"service\" ? true : Boolean(context.config.remote.enabled),\n\t\t\tstate: opts.signal?.aborted ? \"disconnected\" : \"disabled\",\n\t\t\tdeviceId: device?.id,\n\t\t\tdeviceName: context.displayName,\n\t\t\tplatformBase: context.platformBase,\n\t\t\tlocalOrigin: context.localOrigin,\n\t\t\tlastError: null\n\t\t});\n\t}\n};\n//#endregion\n//#region src/remote-status-store.ts\nfunction normalizeOptionalString$1(value) {\n\tif (typeof value !== \"string\") return;\n\tconst trimmed = value.trim();\n\treturn trimmed.length > 0 ? trimmed : void 0;\n}\nfunction buildConfiguredRemoteState(config) {\n\tconst remote = config.remote;\n\treturn {\n\t\tenabled: Boolean(remote.enabled),\n\t\tmode: \"service\",\n\t\tstate: remote.enabled ? \"disconnected\" : \"disabled\",\n\t\t...normalizeOptionalString$1(remote.deviceName) ? { deviceName: normalizeOptionalString$1(remote.deviceName) } : {},\n\t\t...normalizeOptionalString$1(remote.platformApiBase) ? { platformBase: normalizeOptionalString$1(remote.platformApiBase) } : {},\n\t\tupdatedAt: (/* @__PURE__ */ new Date()).toISOString()\n\t};\n}\nfunction resolveRemoteStatusSnapshot(params) {\n\tif (params.currentRemoteState) return {\n\t\tconfiguredEnabled: Boolean(params.config.remote.enabled),\n\t\truntime: params.currentRemoteState\n\t};\n\tif (params.config.remote.enabled) return {\n\t\tconfiguredEnabled: true,\n\t\truntime: {\n\t\t\t...buildConfiguredRemoteState(params.config),\n\t\t\tdeviceName: normalizeOptionalString$1(params.config.remote.deviceName) ?? normalizeOptionalString$1(params.fallbackDeviceName) ?? hostname()\n\t\t}\n\t};\n\treturn {\n\t\tconfiguredEnabled: false,\n\t\truntime: null\n\t};\n}\nvar RemoteStatusStore = class {\n\tconstructor(mode, deps) {\n\t\tthis.mode = mode;\n\t\tthis.deps = deps;\n\t}\n\twrite(next) {\n\t\tthis.deps.writeRemoteState({\n\t\t\t...next,\n\t\t\tmode: this.mode,\n\t\t\tupdatedAt: (/* @__PURE__ */ new Date()).toISOString()\n\t\t});\n\t}\n};\n//#endregion\n//#region src/remote-service-module.ts\nvar RemoteServiceModule = class {\n\tabortController = null;\n\trunTask = null;\n\treleaseOwnership = null;\n\tconstructor(deps) {\n\t\tthis.deps = deps;\n\t}\n\tstart() {\n\t\tif (this.runTask) return this.runTask;\n\t\tif (!this.deps.uiEnabled) return null;\n\t\tconst config = this.deps.loadConfig();\n\t\tif (!config.remote.enabled) {\n\t\t\tthis.deps.statusStore.write({\n\t\t\t\tenabled: false,\n\t\t\t\tstate: \"disabled\",\n\t\t\t\tdeviceName: void 0,\n\t\t\t\tdeviceId: void 0,\n\t\t\t\tplatformBase: void 0,\n\t\t\t\tlocalOrigin: this.deps.localOrigin,\n\t\t\t\tlastError: null,\n\t\t\t\tlastConnectedAt: null\n\t\t\t});\n\t\t\treturn null;\n\t\t}\n\t\tconst logger = this.deps.logger ?? {\n\t\t\tinfo: (message) => console.log(`[remote] ${message}`),\n\t\t\twarn: (message) => console.warn(`[remote] ${message}`),\n\t\t\terror: (message) => console.error(`[remote] ${message}`)\n\t\t};\n\t\tconst ownership = this.deps.claimOwnership?.();\n\t\tif (ownership && !ownership.ok) {\n\t\t\tthis.deps.statusStore.write({\n\t\t\t\tenabled: true,\n\t\t\t\tstate: \"error\",\n\t\t\t\tdeviceName: config.remote.deviceName || void 0,\n\t\t\t\tdeviceId: void 0,\n\t\t\t\tplatformBase: config.remote.platformApiBase || void 0,\n\t\t\t\tlocalOrigin: this.deps.localOrigin,\n\t\t\t\tlastError: ownership.error,\n\t\t\t\tlastConnectedAt: null\n\t\t\t});\n\t\t\tlogger.error(ownership.error);\n\t\t\treturn null;\n\t\t}\n\t\tthis.releaseOwnership = ownership?.release ?? null;\n\t\tthis.abortController = new AbortController();\n\t\tthis.runTask = this.deps.createConnector(logger).run({\n\t\t\tmode: \"service\",\n\t\t\tsignal: this.abortController.signal,\n\t\t\tautoReconnect: config.remote.autoReconnect,\n\t\t\tlocalOrigin: this.deps.localOrigin,\n\t\t\tstatusStore: this.deps.statusStore\n\t\t});\n\t\tthis.runTask.catch((error) => {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tconst latestConfig = this.deps.loadConfig();\n\t\t\tthis.deps.statusStore.write({\n\t\t\t\tenabled: true,\n\t\t\t\tstate: \"error\",\n\t\t\t\tdeviceName: latestConfig.remote.deviceName || void 0,\n\t\t\t\tdeviceId: void 0,\n\t\t\t\tplatformBase: latestConfig.remote.platformApiBase || void 0,\n\t\t\t\tlocalOrigin: this.deps.localOrigin,\n\t\t\t\tlastError: message\n\t\t\t});\n\t\t\tlogger.error(message);\n\t\t}).finally(() => {\n\t\t\tthis.releaseOwnership?.();\n\t\t\tthis.releaseOwnership = null;\n\t\t});\n\t\treturn this.runTask;\n\t}\n\tasync restart() {\n\t\tawait this.stop();\n\t\tthis.start();\n\t}\n\tasync stop() {\n\t\tthis.abortController?.abort();\n\t\ttry {\n\t\t\tawait this.runTask;\n\t\t} catch {} finally {\n\t\t\tthis.abortController = null;\n\t\t\tthis.runTask = null;\n\t\t\tthis.releaseOwnership?.();\n\t\t\tthis.releaseOwnership = null;\n\t\t}\n\t}\n};\n//#endregion\nexport { RemoteConnector, RemotePlatformClient, RemoteRelayBridge, RemoteRuntimeActions, RemoteServiceModule, RemoteStatusStore, buildConfiguredRemoteState, decodePlatformSessionTokenPayload, delay, isValidPlatformSessionToken, normalizeOptionalString, readPlatformSessionTokenState, redactWsUrl, registerRemoteCommands, resolveRemoteStatusSnapshot };\n\n//# sourceMappingURL=index.js.map","import type { Command } from \"commander\";\nimport type { NextclawServiceRuntime } from \"@nextclaw/service\";\n\nexport function registerAgentsCommands(program: Command, nextclaw: NextclawServiceRuntime): void {\n const agentsCommands = nextclaw.commands.agents;\n const agents = program.command(\"agents\").description(\"Manage agents\");\n\n agents\n .command(\"list\")\n .description(\"List available agents\")\n .option(\"--json\", \"Output JSON\", false)\n .action((opts) => agentsCommands.list(opts));\n\n agents\n .command(\"runtimes\")\n .description(\"List available agent runtimes\")\n .option(\"--probe\", \"Actively probe runtime readiness\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => agentsCommands.runtimes(opts));\n\n agents\n .command(\"new <agentId>\")\n .description(\"Create a new agent\")\n .option(\"--name <name>\", \"Agent display name\")\n .option(\"--description <description>\", \"Agent description\")\n .option(\"--avatar <avatar>\", \"Remote avatar URL or local image path\")\n .option(\"--home <path>\", \"Agent home directory\")\n .option(\"--runtime <runtime>\", \"Agent runtime kind, for example native or codex\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (agentId, opts) => agentsCommands.create(agentId, opts));\n\n agents\n .command(\"update <agentId>\")\n .description(\"Update an existing agent\")\n .option(\"--name <name>\", \"Agent display name\")\n .option(\"--description <description>\", \"Agent description\")\n .option(\"--avatar <avatar>\", \"Remote avatar URL or local image path\")\n .option(\"--runtime <runtime>\", \"Agent runtime kind, for example native or codex\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (agentId, opts) => agentsCommands.update(agentId, opts));\n\n agents\n .command(\"remove <agentId>\")\n .description(\"Remove an agent\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (agentId, opts) => agentsCommands.remove(agentId, opts));\n}\n","import { loadConfig } from \"@nextclaw/core\";\nimport type { Command } from \"commander\";\nimport { readLearningLoopRuntimeConfig, type NextclawServiceRuntime } from \"@nextclaw/service\";\n\nfunction readLearningLoopThresholdOrExit(value: string): number {\n const threshold = Number.parseInt(value, 10);\n if (!Number.isInteger(threshold) || threshold < 1) {\n console.error(\n `Invalid learning loop threshold: ${value}. Expected an integer >= 1.`,\n );\n process.exit(1);\n }\n return threshold;\n}\n\nexport function registerLearningLoopCommands(\n program: Command,\n nextclaw: NextclawServiceRuntime,\n): void {\n const configCommands = nextclaw.commands.config;\n const learningLoop = program\n .command(\"learning-loop\")\n .description(\"Manage the learning loop\");\n\n learningLoop\n .command(\"status\")\n .description(\"Show current learning loop settings\")\n .option(\"--json\", \"Output JSON\", false)\n .action((opts: { json?: boolean }) => {\n const status = readLearningLoopRuntimeConfig(loadConfig());\n if (opts.json) {\n console.log(JSON.stringify(status, null, 2));\n return;\n }\n console.log(\"Learning loop\");\n console.log(` enabled: ${status.enabled}`);\n console.log(` toolCallThreshold: ${status.toolCallThreshold}`);\n });\n\n learningLoop\n .command(\"enable\")\n .description(\"Enable the learning loop\")\n .action(async () => {\n await configCommands.set(\"agents.learningLoop.enabled\", \"true\", {\n json: true,\n });\n console.log(\"✓ Enabled learning loop.\");\n });\n\n learningLoop\n .command(\"disable\")\n .description(\"Disable the learning loop\")\n .action(async () => {\n await configCommands.set(\"agents.learningLoop.enabled\", \"false\", {\n json: true,\n });\n console.log(\"✓ Disabled learning loop.\");\n });\n\n learningLoop\n .command(\"threshold <count>\")\n .description(\"Set the tool-call threshold that triggers a learning-loop review\")\n .action(async (count: string) => {\n const threshold = readLearningLoopThresholdOrExit(count);\n await configCommands.set(\n \"agents.learningLoop.toolCallThreshold\",\n String(threshold),\n { json: true },\n );\n console.log(\n `✓ Updated learning loop tool-call threshold to ${threshold}.`,\n );\n });\n}\n","import type { Command } from \"commander\";\nimport type { NextclawServiceRuntime } from \"@nextclaw/service\";\n\nexport function registerSkillsCommands(program: Command, nextclaw: NextclawServiceRuntime): void {\n const skillsCommands = nextclaw.commands.skills;\n const skills = program.command(\"skills\").description(\"Manage skills\");\n skills\n .command(\"installed\")\n .description(\"List installed skills from the local runtime\")\n .option(\"--workdir <dir>\", \"Workspace directory to inspect\")\n .option(\"--scope <scope>\", \"Filter by scope: all|builtin|project|workspace\", \"all\")\n .option(\"-q, --query <text>\", \"Filter installed skills by query\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => await skillsCommands.installed(opts));\n\n skills\n .command(\"info <selector>\")\n .description(\"Show installed skill details from the local runtime\")\n .option(\"--workdir <dir>\", \"Workspace directory to inspect\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (selector, opts) => await skillsCommands.info(selector, opts));\n\n skills\n .command(\"install <slug>\")\n .description(\"Install a skill from NextClaw marketplace\")\n .option(\"--api-base <url>\", \"Marketplace API base URL\")\n .option(\"--workdir <dir>\", \"Workspace directory to install into\")\n .option(\"--dir <dir>\", \"Skills directory name (default: skills)\")\n .option(\"-f, --force\", \"Overwrite existing skill files\", false)\n .action(async (slug, opts) => await skillsCommands.install({ slug, ...opts, apiBaseUrl: opts.apiBase }));\n\n const withRepeatableTag = (value: string, previous: string[] = []) => [...previous, value];\n\n skills\n .command(\"publish <dir>\")\n .description(\"Upload or create a skill in marketplace\")\n .option(\"--meta <path>\", \"Marketplace metadata file (default: <dir>/marketplace.json)\")\n .option(\"--slug <slug>\", \"Skill name segment (default: directory name)\")\n .option(\"--package-name <name>\", \"Canonical package name, for example @alice/demo-skill\")\n .option(\"--scope <scope>\", \"Package scope, for example alice or nextclaw\")\n .option(\"--name <name>\", \"Skill display name\")\n .option(\"--summary <summary>\", \"Skill summary\")\n .option(\"--description <description>\", \"Skill description\")\n .option(\"--author <author>\", \"Skill author\")\n .option(\"--tag <tag>\", \"Skill tag (repeatable)\", withRepeatableTag, [])\n .option(\"--source-repo <url>\", \"Source repository URL\")\n .option(\"--homepage <url>\", \"Homepage URL\")\n .option(\"--published-at <datetime>\", \"Published time (ISO datetime)\")\n .option(\"--updated-at <datetime>\", \"Updated time (ISO datetime)\")\n .option(\"--api-base <url>\", \"Marketplace API base URL\")\n .option(\"--token <token>\", \"Marketplace admin token for official @nextclaw/* publishing\")\n .action(async (dir, opts) => await skillsCommands.publish({ dir, ...opts, apiBaseUrl: opts.apiBase }));\n\n skills\n .command(\"update <dir>\")\n .description(\"Update an existing skill in marketplace\")\n .option(\"--meta <path>\", \"Marketplace metadata file (default: <dir>/marketplace.json)\")\n .option(\"--slug <slug>\", \"Skill name segment (default: directory name)\")\n .option(\"--package-name <name>\", \"Canonical package name, for example @alice/demo-skill\")\n .option(\"--scope <scope>\", \"Package scope, for example alice or nextclaw\")\n .option(\"--name <name>\", \"Skill display name\")\n .option(\"--summary <summary>\", \"Skill summary\")\n .option(\"--description <description>\", \"Skill description\")\n .option(\"--author <author>\", \"Skill author\")\n .option(\"--tag <tag>\", \"Skill tag (repeatable)\", withRepeatableTag, [])\n .option(\"--source-repo <url>\", \"Source repository URL\")\n .option(\"--homepage <url>\", \"Homepage URL\")\n .option(\"--updated-at <datetime>\", \"Updated time (ISO datetime)\")\n .option(\"--api-base <url>\", \"Marketplace API base URL\")\n .option(\"--token <token>\", \"Marketplace admin token for official @nextclaw/* publishing\")\n .action(async (dir, opts) => await skillsCommands.update({ dir, ...opts, apiBaseUrl: opts.apiBase }));\n\n const marketplace = program.command(\"marketplace\").description(\"Browse and install marketplace items\");\n const marketplaceSkills = marketplace.command(\"skills\").description(\"Browse marketplace skill catalog\");\n\n marketplaceSkills\n .command(\"search\")\n .description(\"Search marketplace skills\")\n .option(\"--api-base <url>\", \"Marketplace API base URL\")\n .option(\"-q, --query <text>\", \"Search text\")\n .option(\"--tag <tag>\", \"Filter by tag\")\n .option(\"--sort <sort>\", \"Sort by relevance or updated\")\n .option(\"--page <n>\", \"Page number\")\n .option(\"--page-size <n>\", \"Page size\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => await skillsCommands.marketplaceSearch(opts));\n\n marketplaceSkills\n .command(\"info <slug>\")\n .description(\"Show marketplace skill details\")\n .option(\"--api-base <url>\", \"Marketplace API base URL\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (slug, opts) => await skillsCommands.marketplaceInfo(slug, opts));\n\n marketplaceSkills\n .command(\"recommend\")\n .description(\"List recommended marketplace skills\")\n .option(\"--api-base <url>\", \"Marketplace API base URL\")\n .option(\"--scene <scene>\", \"Recommendation scene\")\n .option(\"--limit <n>\", \"Maximum number of items\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => await skillsCommands.marketplaceRecommend(opts));\n\n marketplaceSkills\n .command(\"install <slug>\")\n .description(\"Install a skill from marketplace\")\n .option(\"--api-base <url>\", \"Marketplace API base URL\")\n .option(\"--workdir <dir>\", \"Workspace directory to install into\")\n .option(\"--dir <dir>\", \"Skills directory name (default: skills)\")\n .option(\"-f, --force\", \"Overwrite existing skill files\", false)\n .action(async (slug, opts) => await skillsCommands.install({ slug, ...opts, apiBaseUrl: opts.apiBase }));\n}\n","import type { Command } from \"commander\";\nimport type { NextclawServiceRuntime } from \"@nextclaw/service\";\n\ntype RegisterHostServiceControlsParams = {\n program: Command;\n nextclaw: NextclawServiceRuntime;\n};\n\nexport const registerHostServiceControls = ({\n program,\n nextclaw,\n}: RegisterHostServiceControlsParams): void => {\n const serviceCommands = nextclaw.commands.service;\n const service = program.command(\"service\").description(\"Manage host service integrations\");\n\n service\n .command(\"install-systemd\")\n .description(\"Install a managed Linux systemd service for NextClaw\")\n .option(\"--user\", \"Install a user-level systemd unit\", false)\n .option(\"--system\", \"Install a system-wide systemd unit\", false)\n .option(\"--dry-run\", \"Show what would be installed without making changes\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => serviceCommands.installSystemd(opts));\n\n service\n .command(\"uninstall-systemd\")\n .description(\"Remove a managed Linux systemd service for NextClaw\")\n .option(\"--user\", \"Remove a user-level systemd unit\", false)\n .option(\"--system\", \"Remove a system-wide systemd unit\", false)\n .option(\"--dry-run\", \"Show what would be removed without making changes\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => serviceCommands.uninstallSystemd(opts));\n\n service\n .command(\"install-launch-agent\")\n .description(\"Install a managed macOS LaunchAgent for NextClaw\")\n .option(\"--dry-run\", \"Show what would be installed without making changes\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => serviceCommands.installLaunchAgent(opts));\n\n service\n .command(\"uninstall-launch-agent\")\n .description(\"Remove a managed macOS LaunchAgent for NextClaw\")\n .option(\"--dry-run\", \"Show what would be removed without making changes\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => serviceCommands.uninstallLaunchAgent(opts));\n\n service\n .command(\"install-task\")\n .description(\"Install a managed Windows Scheduled Task for NextClaw\")\n .option(\"--dry-run\", \"Show what would be installed without making changes\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => serviceCommands.installWindowsTask(opts));\n\n service\n .command(\"uninstall-task\")\n .description(\"Remove a managed Windows Scheduled Task for NextClaw\")\n .option(\"--dry-run\", \"Show what would be removed without making changes\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => serviceCommands.uninstallWindowsTask(opts));\n\n const autostart = service.command(\"autostart\").description(\"Inspect host autostart status\");\n\n autostart\n .command(\"status\")\n .description(\"Show host autostart status\")\n .option(\"--user\", \"Inspect the user-level autostart owner\", false)\n .option(\"--system\", \"Inspect the system-level autostart owner\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => serviceCommands.autostartStatus(opts));\n\n autostart\n .command(\"doctor\")\n .description(\"Diagnose host autostart setup\")\n .option(\"--user\", \"Inspect the user-level autostart owner\", false)\n .option(\"--system\", \"Inspect the system-level autostart owner\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => serviceCommands.autostartDoctor(opts));\n};\n","#!/usr/bin/env node\nimport { Command } from \"commander\";\nimport { APP_NAME, APP_TAGLINE } from \"@nextclaw/core\";\nimport { registerRemoteCommands } from \"@nextclaw/remote\";\nimport { NextclawDistributionService, NextclawServiceRuntime } from \"@nextclaw/service\";\nimport { registerAgentsCommands } from \"./register-agents-commands.js\";\nimport { registerLearningLoopCommands } from \"./register-learning-loop-commands.js\";\nimport { registerSkillsCommands } from \"./register-skills-commands.js\";\nimport { registerHostServiceControls } from \"./service-command-registration.utils.js\";\nimport { createNextclawDistribution } from \"@nextclaw-cli/cli/shared/lib/distribution/index.js\";\n\nconst LOGO = \"🤖\";\n\nconst program = new Command();\nNextclawDistributionService.configure(createNextclawDistribution(import.meta.url));\nconst runtime = new NextclawServiceRuntime({\n logo: LOGO\n});\nconst withRepeatableTag = (value: string, previous: string[] = []) => [...previous, value];\nconst registerRemoteCommandGroup = (target: Command, nextclaw: typeof runtime): void => {\n registerRemoteCommands(target, nextclaw.commands.remote);\n};\n\nprogram\n .name(APP_NAME)\n .description(`${LOGO} ${APP_NAME} - ${APP_TAGLINE}`)\n .version(runtime.version, \"-v, --version\", \"show version\");\n\nprogram\n .command(\"onboard\")\n .description(`Initialize ${APP_NAME} configuration and workspace`)\n .action(async () => runtime.onboard());\n\nprogram\n .command(\"init\")\n .description(`Initialize ${APP_NAME} configuration and workspace`)\n .option(\"-f, --force\", \"Overwrite existing template files\")\n .action(async (opts) => runtime.init({ force: Boolean(opts.force) }));\n\nprogram\n .command(\"login\")\n .description(\"Sign in to NextClaw Platform and save the platform token locally (browser flow by default)\")\n .option(\"--api-base <url>\", \"Platform API base (supports /v1 suffix)\")\n .option(\"--email <email>\", \"Login email for direct password sign-in\")\n .option(\"--password <password>\", \"Login password for direct password sign-in\")\n .option(\"--no-open\", \"Do not open the browser automatically\")\n .action(async (opts) => runtime.login(opts));\n\nconst account = program.command(\"account\").description(\"Inspect and manage your NextClaw account\");\n\naccount\n .command(\"status\")\n .description(\"Show account status and personal marketplace publish readiness\")\n .option(\"--api-base <url>\", \"Platform API base (supports /v1 suffix)\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => runtime.account.status(opts));\n\naccount\n .command(\"set-username <username>\")\n .description(\"Set your NextClaw username for personal marketplace publishing\")\n .option(\"--api-base <url>\", \"Platform API base (supports /v1 suffix)\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (username, opts) => runtime.account.setUsername(username, opts));\n\nregisterRemoteCommandGroup(program, runtime);\n\nprogram\n .command(\"gateway\")\n .description(`Start the ${APP_NAME} gateway`)\n .option(\"-p, --port <port>\", \"Gateway port\", \"18790\")\n .option(\"-v, --verbose\", \"Verbose output\", false)\n .option(\"--ui\", \"Enable UI server\", false)\n .option(\"--ui-port <port>\", \"UI port\")\n .option(\"--ui-open\", \"Open browser when UI starts\", false)\n .action(async (opts) => runtime.commands.gateway.run(opts));\n\nprogram\n .command(\"ui\")\n .description(`Start the ${APP_NAME} UI with gateway`)\n .option(\"--port <port>\", \"UI port\")\n .option(\"--no-open\", \"Disable opening browser\")\n .action(async (opts) => runtime.commands.ui.run(opts));\n\nprogram\n .command(\"start\")\n .description(`Start the ${APP_NAME} gateway + UI in the background`)\n .option(\"--ui-port <port>\", \"UI port\")\n .option(\"--start-timeout <ms>\", \"Maximum wait time for startup readiness in milliseconds\")\n .option(\"--open\", \"Open browser after start\", false)\n .action(async (opts) => runtime.commands.start.run(opts));\n\nprogram\n .command(\"restart\")\n .description(`Restart the ${APP_NAME} background service`)\n .option(\"--ui-port <port>\", \"UI port\")\n .option(\"--start-timeout <ms>\", \"Maximum wait time for startup readiness in milliseconds\")\n .option(\"--open\", \"Open browser after restart\", false)\n .action(async (opts) => runtime.commands.restart.run(opts));\n\nprogram\n .command(\"serve\")\n .description(`Run the ${APP_NAME} gateway + UI in the foreground`)\n .option(\"--ui-port <port>\", \"UI port\")\n .option(\"--open\", \"Open browser after start\", false)\n .action(async (opts) => runtime.commands.serve.run(opts));\n\nprogram\n .command(\"stop\")\n .description(`Stop the ${APP_NAME} background service`)\n .action(async () => runtime.commands.stop.run());\n\nregisterHostServiceControls({\n program,\n nextclaw: runtime,\n});\n\nprogram\n .command(\"agent\")\n .description(\"Interact with the agent directly\")\n .option(\"-m, --message <message>\", \"Message to send to the agent\")\n .option(\"-s, --session <session>\", \"Session ID\", \"cli:default\")\n .option(\"--model <model>\", \"Session model override for this run\")\n .option(\"--no-markdown\", \"Disable Markdown rendering\")\n .action(async (opts) => runtime.agent(opts));\n\nprogram\n .command(\"update\")\n .description(`Update the ${APP_NAME} runtime`)\n .option(\"--check\", \"Only check for a runtime update\", false)\n .option(\"--download-only\", \"Download an available runtime update without applying it\", false)\n .option(\"--download\", \"Alias for --download-only\")\n .option(\"--apply\", \"Apply the downloaded runtime update\", false)\n .option(\"--channel <channel>\", \"Update channel (stable or beta)\")\n .option(\"--manifest-url <url>\", \"Explicit runtime update manifest URL\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (opts) => runtime.update(opts));\n\nregisterSkillsCommands(program, runtime);\n\nregisterAgentsCommands(program, runtime);\n\nconst plugins = program.command(\"plugins\").description(\"Manage OpenClaw-compatible plugins\");\n\nplugins\n .command(\"list\")\n .description(\"List discovered plugins\")\n .option(\"--json\", \"Print JSON\")\n .option(\"--enabled\", \"Only show enabled plugins\", false)\n .option(\"--verbose\", \"Show detailed entries\", false)\n .action((opts) => runtime.commands.plugins.list(opts));\n\nplugins\n .command(\"info <id>\")\n .description(\"Show plugin details\")\n .option(\"--json\", \"Print JSON\")\n .action((id, opts) => runtime.commands.plugins.info(id, opts));\n\nplugins\n .command(\"enable <id>\")\n .description(\"Enable a plugin in config\")\n .action((id) => runtime.commands.plugins.enable(id));\n\nplugins\n .command(\"disable <id>\")\n .description(\"Disable a plugin in config\")\n .action((id) => runtime.commands.plugins.disable(id));\n\nplugins\n .command(\"uninstall <id>\")\n .description(\"Uninstall a plugin\")\n .option(\"--keep-files\", \"Keep installed files on disk\", false)\n .option(\"--keep-config\", \"Deprecated alias for --keep-files\", false)\n .option(\"--force\", \"Skip confirmation prompt\", false)\n .option(\"--dry-run\", \"Show what would be removed without making changes\", false)\n .action(async (id, opts) => runtime.commands.plugins.uninstall(id, opts));\n\nplugins\n .command(\"install <path-or-spec>\")\n .description(\"Install a plugin (path, archive, or npm spec)\")\n .option(\"-l, --link\", \"Link a local path instead of copying\", false)\n .action(async (pathOrSpec, opts) => runtime.commands.plugins.install(pathOrSpec, opts));\n\nplugins\n .command(\"doctor\")\n .description(\"Report plugin load issues\")\n .action(() => runtime.commands.plugins.doctor());\n\nconst config = program.command(\"config\").description(\"Manage config values\");\n\nconfig\n .command(\"get <path>\")\n .description(\"Get a config value by dot path\")\n .option(\"--json\", \"Output JSON\", false)\n .action((path, opts) => runtime.commands.config.get(path, opts));\n\nconfig\n .command(\"set <path> <value>\")\n .description(\"Set a config value by dot path\")\n .option(\"--json\", \"Parse value as JSON\", false)\n .action((path, value, opts) => runtime.commands.config.set(path, value, opts));\n\nconfig\n .command(\"unset <path>\")\n .description(\"Remove a config value by dot path\")\n .action((path) => runtime.commands.config.unset(path));\n\nregisterLearningLoopCommands(program, runtime);\n\nconst mcp = program.command(\"mcp\").description(\"Manage MCP servers\");\n\nmcp\n .command(\"list\")\n .description(\"List configured MCP servers\")\n .option(\"--json\", \"Output JSON\", false)\n .action((opts) => runtime.commands.mcp.list(opts));\n\nmcp\n .command(\"add <name> [command...]\")\n .description(\"Add an MCP server (stdio by default, or use --transport http|sse)\")\n .allowUnknownOption(true)\n .option(\"--transport <type>\", \"Transport type: stdio|http|sse\", \"stdio\")\n .option(\"--url <url>\", \"HTTP/SSE endpoint URL\")\n .option(\"--header <key=value>\", \"Transport header (repeatable)\", withRepeatableTag, [])\n .option(\"--env <key=value>\", \"stdio env var (repeatable)\", withRepeatableTag, [])\n .option(\"--cwd <dir>\", \"stdio working directory\")\n .option(\"--timeout-ms <ms>\", \"HTTP/SSE timeout in milliseconds\")\n .option(\"--stderr <mode>\", \"stdio stderr handling: inherit|pipe|ignore\", \"pipe\")\n .option(\"--disabled\", \"Create the server in disabled state\", false)\n .option(\"--all-agents\", \"Expose this server to all agents\", false)\n .option(\"--agent <id>\", \"Expose to an agent id (repeatable)\", withRepeatableTag, [])\n .option(\"--insecure\", \"Disable TLS verification for HTTP/SSE\", false)\n .action(async (name, command, opts) => runtime.commands.mcp.add(name, command ?? [], opts));\n\nmcp\n .command(\"remove <name>\")\n .description(\"Remove an MCP server\")\n .action(async (name) => runtime.commands.mcp.remove(name));\n\nmcp\n .command(\"enable <name>\")\n .description(\"Enable an MCP server\")\n .action(async (name) => runtime.commands.mcp.enable(name));\n\nmcp\n .command(\"disable <name>\")\n .description(\"Disable an MCP server\")\n .action(async (name) => runtime.commands.mcp.disable(name));\n\nmcp\n .command(\"doctor [name]\")\n .description(\"Check MCP server connectivity and tool discovery\")\n .option(\"--json\", \"Output JSON\", false)\n .action(async (name, opts) => runtime.commands.mcp.doctor(name, opts));\n\nconst secrets = program.command(\"secrets\").description(\"Manage secrets refs/providers\");\n\nsecrets\n .command(\"audit\")\n .description(\"Audit secret refs resolution status\")\n .option(\"--json\", \"Output JSON\", false)\n .option(\"--strict\", \"Exit non-zero when unresolved refs exist\", false)\n .action((opts) => runtime.commands.secrets.audit(opts));\n\nsecrets\n .command(\"configure\")\n .description(\"Configure a secret provider alias\")\n .requiredOption(\"--provider <alias>\", \"Provider alias\")\n .option(\"--source <source>\", \"Provider source (env|file|exec)\")\n .option(\"--prefix <prefix>\", \"Env key prefix (env source)\")\n .option(\"--path <path>\", \"Secret JSON file path (file source)\")\n .option(\"--command <command>\", \"Command for exec source\")\n .option(\n \"--arg <value>\",\n \"Exec argument (repeatable)\",\n (value: string, previous: string[] = []) => [...previous, value],\n []\n )\n .option(\"--cwd <dir>\", \"Exec working directory\")\n .option(\"--timeout-ms <ms>\", \"Exec timeout in milliseconds\")\n .option(\"--set-default\", \"Set as default alias for this source\", false)\n .option(\"--remove\", \"Remove provider alias\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action((opts) => runtime.commands.secrets.configure(opts));\n\nsecrets\n .command(\"apply\")\n .description(\"Apply secret refs/providers/defaults patch\")\n .option(\"--file <path>\", \"Apply patch from JSON file\")\n .option(\"--path <config-path>\", \"Single ref target config path\")\n .option(\"--source <source>\", \"Single ref source (env|file|exec)\")\n .option(\"--id <secret-id>\", \"Single ref secret id\")\n .option(\"--provider <alias>\", \"Single ref provider alias\")\n .option(\"--remove\", \"Remove single ref (--path required)\", false)\n .option(\"--enable\", \"Enable secrets resolution\", false)\n .option(\"--disable\", \"Disable secrets resolution\", false)\n .option(\"--json\", \"Output JSON\", false)\n .action((opts) => runtime.commands.secrets.apply(opts));\n\nsecrets\n .command(\"reload\")\n .description(\"Trigger runtime secrets reload signal\")\n .option(\"--json\", \"Output JSON\", false)\n .action((opts) => runtime.commands.secrets.reload(opts));\n\nconst channels = program.command(\"channels\").description(\"Manage channels\");\n\nchannels\n .command(\"add\")\n .description(\"Configure a plugin channel (OpenClaw-compatible setup)\")\n .requiredOption(\"--channel <id>\", \"Plugin channel id\")\n .option(\"--code <code>\", \"Pairing code\")\n .option(\"--token <token>\", \"Connector token\")\n .option(\"--name <name>\", \"Display name\")\n .option(\"--url <url>\", \"API base URL\")\n .option(\"--http-url <url>\", \"Alias for --url\")\n .action((opts) => runtime.commands.channels.add(opts));\n\nchannels\n .command(\"list\")\n .description(\"List configured plugin channels\")\n .option(\"--json\", \"Output JSON\", false)\n .action((opts) => runtime.commands.channels.list(opts));\n\nchannels\n .command(\"status\")\n .description(\"Show channel status\")\n .action(() => runtime.commands.channels.status());\n\nchannels\n .command(\"login\")\n .description(\"Link device via QR code\")\n .option(\"--channel <id>\", \"Plugin channel id\")\n .option(\"--account <id>\", \"Channel account id\")\n .option(\"--url <url>\", \"Channel API base URL\")\n .option(\"--http-url <url>\", \"Alias for --url\")\n .option(\"-v, --verbose\", \"Verbose output\", false)\n .action(async (opts) => runtime.commands.channels.login(opts));\n\nconst cron = program.command(\"cron\").description(\"Manage scheduled tasks\");\n\ncron\n .command(\"list\")\n .option(\"--enabled-only\", \"Show only enabled jobs\", false)\n .option(\"-a, --all\", \"Deprecated: list all jobs (default behavior)\", false)\n .action(async (opts) => runtime.commands.cron.list({ enabledOnly: Boolean(opts.enabledOnly) }));\n\ncron\n .command(\"add\")\n .requiredOption(\"-n, --name <name>\", \"Job name\")\n .requiredOption(\"-m, --message <message>\", \"Message for agent\")\n .option(\"--agent <id>\", \"Target agent id\")\n .option(\"--session <id>\", \"Target NCP session id\")\n .option(\"-e, --every <seconds>\", \"Run every N seconds\")\n .option(\"-c, --cron <expr>\", \"Cron expression\")\n .option(\"--at <iso>\", \"Run once at time (ISO format)\")\n .option(\"-d, --deliver\", \"Deliver response to channel\")\n .option(\"--to <recipient>\", \"Recipient for delivery\")\n .option(\"--channel <channel>\", \"Channel for delivery\")\n .option(\"--account <id>\", \"Account id for channel delivery\")\n .action(async (opts) => runtime.commands.cron.add(opts));\n\ncron\n .command(\"remove <jobId>\")\n .action(async (jobId) => runtime.commands.cron.remove(jobId));\n\ncron\n .command(\"enable <jobId>\")\n .option(\"--disable\", \"Disable instead of enable\")\n .action(async (jobId, opts) => runtime.commands.cron.enable(jobId, opts));\n\ncron\n .command(\"disable <jobId>\")\n .action(async (jobId) => runtime.commands.cron.enable(jobId, { disable: true }));\n\ncron\n .command(\"run <jobId>\")\n .option(\"-f, --force\", \"Run even if disabled\")\n .action(async (jobId, opts) => runtime.commands.cron.run(jobId, opts));\n\nprogram.command(\"status\").description(`Show ${APP_NAME} status`).option(\"--json\", \"Output JSON\", false).option(\"--verbose\", \"Show extra diagnostics\", false).option(\"--fix\", \"Fix stale service state when safe\", false).action(async (opts) => runtime.commands.diagnostics.status(opts));\nprogram.command(\"doctor\").description(`Run ${APP_NAME} diagnostics`).option(\"--json\", \"Output JSON\", false).option(\"--verbose\", \"Show extra diagnostics\", false).option(\"--fix\", \"Fix stale service state when safe\", false).action(async (opts) => runtime.commands.diagnostics.doctor(opts));\nconst logs = program.command(\"logs\").description(\"Inspect local runtime logs\");\nlogs.command(\"path\").description(\"Show local log file paths\").action(() => runtime.commands.logs.path());\nlogs.command(\"tail\").description(\"Show recent local log entries\").option(\"--lines <n>\", \"Number of lines to show\", \"40\").option(\"--crash\", \"Tail crash.log instead of service.log\", false).action((opts) => runtime.commands.logs.tail(opts));\nprogram.command(\"usage\").description(\"Show observed LLM usage snapshots, history, and prompt cache stats\").option(\"--history\", \"Show recent usage history\", false).option(\"--stats\", \"Show aggregated usage stats from local history\", false).option(\"--limit <n>\", \"Maximum number of history records to show\", \"10\").option(\"--json\", \"Output JSON\", false).action(async (opts) => runtime.commands.usage.show(opts));\n\nawait program.parseAsync(process.argv);\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"mappings":";;;;;;;;;;;;;;CAEA,MAAM,eAAe;EAAC;EAAc;EAAe;EAAY;CAC/D,MAAM,UAAU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