@arenahito/droid-webscr 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var __export = (target, all) => {
7
7
  // src/server/create-fastify-app.ts
8
8
  import websocket from "@fastify/websocket";
9
9
 
10
- // ../../packages/shared/dist/index.js
10
+ // ../../packages/shared/src/index.ts
11
11
  var AppError = class extends Error {
12
12
  code;
13
13
  constructor(code, message) {
@@ -14537,7 +14537,7 @@ function date4(params) {
14537
14537
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
14538
14538
  config(en_default());
14539
14539
 
14540
- // ../../packages/config/dist/schema.js
14540
+ // ../../packages/config/src/schema.ts
14541
14541
  var ConfigError = class extends AppError {
14542
14542
  };
14543
14543
  var schema = external_exports.object({
@@ -14554,7 +14554,9 @@ function validateAgentConfig(input) {
14554
14554
  return err(new ConfigError("CONFIG_INVALID", parsed.error.message));
14555
14555
  }
14556
14556
  if (!isLocalBind(parsed.data.bindHost) && !parsed.data.authToken) {
14557
- return err(new ConfigError("CONFIG_UNSAFE_BIND", "Non-local bind addresses require authToken."));
14557
+ return err(
14558
+ new ConfigError("CONFIG_UNSAFE_BIND", "Non-local bind addresses require authToken.")
14559
+ );
14558
14560
  }
14559
14561
  return ok(parsed.data);
14560
14562
  }
@@ -14562,33 +14564,26 @@ function isLocalBind(host) {
14562
14564
  return host === "127.0.0.1" || host === "localhost" || host === "::1";
14563
14565
  }
14564
14566
 
14565
- // ../../packages/protocol/dist/streams.js
14566
- var StreamId;
14567
- (function(StreamId2) {
14567
+ // ../../packages/protocol/src/streams.ts
14568
+ var StreamId = /* @__PURE__ */ ((StreamId2) => {
14568
14569
  StreamId2[StreamId2["Session"] = 1] = "Session";
14569
14570
  StreamId2[StreamId2["Device"] = 2] = "Device";
14570
14571
  StreamId2[StreamId2["Video"] = 3] = "Video";
14571
14572
  StreamId2[StreamId2["Control"] = 4] = "Control";
14572
14573
  StreamId2[StreamId2["Log"] = 5] = "Log";
14573
- })(StreamId || (StreamId = {}));
14574
- var knownStreams = new Set(Object.values(StreamId).filter((value) => typeof value === "number"));
14574
+ return StreamId2;
14575
+ })(StreamId || {});
14576
+ var knownStreams = new Set(
14577
+ Object.values(StreamId).filter((value) => typeof value === "number")
14578
+ );
14575
14579
 
14576
- // ../../packages/protocol/dist/frame.js
14580
+ // ../../packages/protocol/src/frame.ts
14577
14581
  var FRAME_MAGIC = 1146573635;
14578
14582
  var FRAME_HEADER_LENGTH = 40;
14579
14583
  var WIRE_VERSION = 1;
14580
14584
  var DEFAULT_MAX_PAYLOAD_LENGTH = 16 * 1024 * 1024;
14581
14585
 
14582
- // ../../packages/protocol/dist/errors.js
14583
- var ProtocolErrorCode;
14584
- (function(ProtocolErrorCode2) {
14585
- ProtocolErrorCode2["FrameTooShort"] = "FRAME_TOO_SHORT";
14586
- ProtocolErrorCode2["InvalidMagic"] = "INVALID_MAGIC";
14587
- ProtocolErrorCode2["UnsupportedVersion"] = "UNSUPPORTED_VERSION";
14588
- ProtocolErrorCode2["UnsupportedHeaderLength"] = "UNSUPPORTED_HEADER_LENGTH";
14589
- ProtocolErrorCode2["PayloadLengthMismatch"] = "PAYLOAD_LENGTH_MISMATCH";
14590
- ProtocolErrorCode2["PayloadTooLarge"] = "PAYLOAD_TOO_LARGE";
14591
- })(ProtocolErrorCode || (ProtocolErrorCode = {}));
14586
+ // ../../packages/protocol/src/errors.ts
14592
14587
  var ProtocolError = class extends Error {
14593
14588
  code;
14594
14589
  constructor(code, message) {
@@ -14598,7 +14593,7 @@ var ProtocolError = class extends Error {
14598
14593
  }
14599
14594
  };
14600
14595
 
14601
- // ../../packages/protocol/dist/codec.js
14596
+ // ../../packages/protocol/src/codec.ts
14602
14597
  function encodeFrame(frame) {
14603
14598
  const payloadLength = frame.payload.byteLength;
14604
14599
  const output = new Uint8Array(FRAME_HEADER_LENGTH + payloadLength);
@@ -14619,28 +14614,37 @@ function encodeFrame(frame) {
14619
14614
  function decodeFrame(bytes, options = {}) {
14620
14615
  const maxPayloadLength = options.maxPayloadLength ?? DEFAULT_MAX_PAYLOAD_LENGTH;
14621
14616
  if (bytes.byteLength < FRAME_HEADER_LENGTH) {
14622
- return failure(ProtocolErrorCode.FrameTooShort, "Frame is shorter than the protocol header.");
14617
+ return failure("FRAME_TOO_SHORT" /* FrameTooShort */, "Frame is shorter than the protocol header.");
14623
14618
  }
14624
14619
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
14625
14620
  const magic = view.getUint32(0, false);
14626
14621
  if (magic !== FRAME_MAGIC) {
14627
- return failure(ProtocolErrorCode.InvalidMagic, "Frame magic does not match DWSC.");
14622
+ return failure("INVALID_MAGIC" /* InvalidMagic */, "Frame magic does not match DWSC.");
14628
14623
  }
14629
14624
  const version2 = view.getUint16(4, false);
14630
14625
  if (version2 !== WIRE_VERSION) {
14631
- return failure(ProtocolErrorCode.UnsupportedVersion, `Unsupported wire version: ${version2}.`);
14626
+ return failure("UNSUPPORTED_VERSION" /* UnsupportedVersion */, `Unsupported wire version: ${version2}.`);
14632
14627
  }
14633
14628
  const headerLength = view.getUint16(6, false);
14634
14629
  if (headerLength !== FRAME_HEADER_LENGTH) {
14635
- return failure(ProtocolErrorCode.UnsupportedHeaderLength, `Unsupported header length: ${headerLength}.`);
14630
+ return failure(
14631
+ "UNSUPPORTED_HEADER_LENGTH" /* UnsupportedHeaderLength */,
14632
+ `Unsupported header length: ${headerLength}.`
14633
+ );
14636
14634
  }
14637
14635
  const payloadLength = view.getUint32(16, false);
14638
14636
  if (payloadLength > maxPayloadLength) {
14639
- return failure(ProtocolErrorCode.PayloadTooLarge, `Payload length ${payloadLength} exceeds limit ${maxPayloadLength}.`);
14637
+ return failure(
14638
+ "PAYLOAD_TOO_LARGE" /* PayloadTooLarge */,
14639
+ `Payload length ${payloadLength} exceeds limit ${maxPayloadLength}.`
14640
+ );
14640
14641
  }
14641
14642
  const expectedLength = FRAME_HEADER_LENGTH + payloadLength;
14642
14643
  if (bytes.byteLength !== expectedLength) {
14643
- return failure(ProtocolErrorCode.PayloadLengthMismatch, `Frame length ${bytes.byteLength} does not match declared length ${expectedLength}.`);
14644
+ return failure(
14645
+ "PAYLOAD_LENGTH_MISMATCH" /* PayloadLengthMismatch */,
14646
+ `Frame length ${bytes.byteLength} does not match declared length ${expectedLength}.`
14647
+ );
14644
14648
  }
14645
14649
  return {
14646
14650
  ok: true,
@@ -14668,9 +14672,8 @@ function failure(code, message) {
14668
14672
  };
14669
14673
  }
14670
14674
 
14671
- // ../../packages/protocol/dist/messages.js
14672
- var MessageType;
14673
- (function(MessageType2) {
14675
+ // ../../packages/protocol/src/messages.ts
14676
+ var MessageType = /* @__PURE__ */ ((MessageType2) => {
14674
14677
  MessageType2[MessageType2["SessionHello"] = 1] = "SessionHello";
14675
14678
  MessageType2[MessageType2["SessionHelloAck"] = 2] = "SessionHelloAck";
14676
14679
  MessageType2[MessageType2["SessionStart"] = 3] = "SessionStart";
@@ -14687,10 +14690,13 @@ var MessageType;
14687
14690
  MessageType2[MessageType2["ControlSystem"] = 772] = "ControlSystem";
14688
14691
  MessageType2[MessageType2["ControlClipboard"] = 773] = "ControlClipboard";
14689
14692
  MessageType2[MessageType2["LogRecord"] = 1025] = "LogRecord";
14690
- })(MessageType || (MessageType = {}));
14691
- var knownMessageTypes = new Set(Object.values(MessageType).filter((value) => typeof value === "number"));
14693
+ return MessageType2;
14694
+ })(MessageType || {});
14695
+ var knownMessageTypes = new Set(
14696
+ Object.values(MessageType).filter((value) => typeof value === "number")
14697
+ );
14692
14698
 
14693
- // ../../packages/transport/dist/stream.js
14699
+ // ../../packages/transport/src/stream.ts
14694
14700
  var DEFAULT_MAX_BUFFERED_BYTES = 16 * 1024 * 1024;
14695
14701
  var FrameAssembler = class {
14696
14702
  buffer = new Uint8Array();
@@ -14759,7 +14765,7 @@ function readPayloadLength(bytes) {
14759
14765
  return view.getUint32(16, false);
14760
14766
  }
14761
14767
 
14762
- // ../../packages/transport/dist/backpressure.js
14768
+ // ../../packages/transport/src/backpressure.ts
14763
14769
  var VIDEO_KEYFRAME_FLAG = 1 << 0;
14764
14770
 
14765
14771
  // src/server/create-fastify-app.ts
@@ -15016,25 +15022,13 @@ function extractPort(host) {
15016
15022
  return parts.length === 2 ? parts[1] ?? "" : "";
15017
15023
  }
15018
15024
 
15019
- // ../../packages/adb/dist/provider.js
15025
+ // ../../packages/adb/src/provider.ts
15020
15026
  import { Readable } from "stream";
15021
- var AdbAuthorizationState;
15022
- (function(AdbAuthorizationState2) {
15023
- AdbAuthorizationState2["Authorized"] = "authorized";
15024
- AdbAuthorizationState2["Offline"] = "offline";
15025
- AdbAuthorizationState2["Unauthorized"] = "unauthorized";
15026
- })(AdbAuthorizationState || (AdbAuthorizationState = {}));
15027
- var AdbTransportKind;
15028
- (function(AdbTransportKind2) {
15029
- AdbTransportKind2["Emulator"] = "emulator";
15030
- AdbTransportKind2["Network"] = "network";
15031
- AdbTransportKind2["Usb"] = "usb";
15032
- })(AdbTransportKind || (AdbTransportKind = {}));
15033
15027
  function isUsableDevice(device) {
15034
- return device.authorizationState === AdbAuthorizationState.Authorized && device.serial.length > 0;
15028
+ return device.authorizationState === "authorized" /* Authorized */ && device.serial.length > 0;
15035
15029
  }
15036
15030
 
15037
- // ../../packages/adb/dist/system-adb-provider.js
15031
+ // ../../packages/adb/src/system-adb-provider.ts
15038
15032
  import { spawn } from "child_process";
15039
15033
  import { createConnection, Server } from "net";
15040
15034
  import { Readable as Readable2 } from "stream";