@cldmv/droidsock 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -24
- package/dist/api/auth.mjs +2 -17
- package/dist/api/config.mjs +2 -17
- package/dist/api/connection.mjs +2 -17
- package/dist/api/device.mjs +2 -17
- package/dist/api/devices.mjs +2 -17
- package/dist/api/discover.mjs +2 -17
- package/dist/api/files.mjs +2 -17
- package/dist/api/forward.mjs +2 -17
- package/dist/api/install.mjs +2 -17
- package/dist/api/log.mjs +2 -17
- package/dist/api/pairing.mjs +2 -17
- package/dist/api/reboot.mjs +2 -17
- package/dist/api/reverse.mjs +2 -17
- package/dist/api/shell.mjs +2 -17
- package/dist/api/stream.mjs +2 -17
- package/dist/api/utils.mjs +5 -17
- package/dist/droidsock.mjs +2 -17
- package/dist/index.cjs +50 -0
- package/dist/index.mjs +2 -0
- package/dist/main.mjs +2 -0
- package/package.json +58 -42
- package/types/src/api/auth.d.mts +34 -0
- package/types/src/api/auth.d.mts.map +1 -0
- package/types/src/api/config.d.mts +50 -0
- package/types/src/api/config.d.mts.map +1 -0
- package/types/src/api/connection.d.mts +16 -0
- package/types/src/api/connection.d.mts.map +1 -0
- package/types/src/api/device.d.mts +41 -0
- package/types/src/api/device.d.mts.map +1 -0
- package/types/src/api/devices.d.mts +41 -0
- package/types/src/api/devices.d.mts.map +1 -0
- package/types/src/api/discover.d.mts +65 -0
- package/types/src/api/discover.d.mts.map +1 -0
- package/types/src/api/files.d.mts +228 -0
- package/types/src/api/files.d.mts.map +1 -0
- package/types/src/api/forward.d.mts +27 -0
- package/types/src/api/forward.d.mts.map +1 -0
- package/types/src/api/install.d.mts +54 -0
- package/types/src/api/install.d.mts.map +1 -0
- package/types/src/api/log.d.mts +37 -0
- package/types/src/api/log.d.mts.map +1 -0
- package/types/src/api/pairing.d.mts +30 -0
- package/types/src/api/pairing.d.mts.map +1 -0
- package/types/src/api/reboot.d.mts +33 -0
- package/types/src/api/reboot.d.mts.map +1 -0
- package/types/src/api/reverse.d.mts +26 -0
- package/types/src/api/reverse.d.mts.map +1 -0
- package/types/src/api/shell.d.mts +63 -0
- package/types/src/api/shell.d.mts.map +1 -0
- package/types/src/api/stream.d.mts +7 -0
- package/types/src/api/stream.d.mts.map +1 -0
- package/types/src/api/utils.d.mts +161 -0
- package/types/src/api/utils.d.mts.map +1 -0
- package/types/src/droidsock.d.mts +14 -0
- package/types/src/droidsock.d.mts.map +1 -0
- package/types/src/index.d.mts +2 -0
- package/types/src/index.d.mts.map +1 -0
- package/types/src/main.d.mts +3 -0
- package/types/src/main.d.mts.map +1 -0
- package/index.cjs +0 -46
- package/index.mjs +0 -44
- package/types/dist/api/auth.d.mts +0 -14
- package/types/dist/api/auth.d.mts.map +0 -1
- package/types/dist/api/config.d.mts +0 -52
- package/types/dist/api/config.d.mts.map +0 -1
- package/types/dist/api/connection.d.mts +0 -2
- package/types/dist/api/connection.d.mts.map +0 -1
- package/types/dist/api/device.d.mts +0 -4
- package/types/dist/api/device.d.mts.map +0 -1
- package/types/dist/api/devices.d.mts +0 -5
- package/types/dist/api/devices.d.mts.map +0 -1
- package/types/dist/api/discover.d.mts +0 -6
- package/types/dist/api/discover.d.mts.map +0 -1
- package/types/dist/api/files.d.mts +0 -85
- package/types/dist/api/files.d.mts.map +0 -1
- package/types/dist/api/forward.d.mts +0 -5
- package/types/dist/api/forward.d.mts.map +0 -1
- package/types/dist/api/install.d.mts +0 -3
- package/types/dist/api/install.d.mts.map +0 -1
- package/types/dist/api/log.d.mts +0 -21
- package/types/dist/api/log.d.mts.map +0 -1
- package/types/dist/api/pairing.d.mts +0 -2
- package/types/dist/api/pairing.d.mts.map +0 -1
- package/types/dist/api/reboot.d.mts +0 -2
- package/types/dist/api/reboot.d.mts.map +0 -1
- package/types/dist/api/reverse.d.mts +0 -6
- package/types/dist/api/reverse.d.mts.map +0 -1
- package/types/dist/api/shell.d.mts +0 -29
- package/types/dist/api/shell.d.mts.map +0 -1
- package/types/dist/api/stream.d.mts +0 -11
- package/types/dist/api/stream.d.mts.map +0 -1
- package/types/dist/api/utils.d.mts +0 -32
- package/types/dist/api/utils.d.mts.map +0 -1
- package/types/dist/droidsock.d.mts +0 -3
- package/types/dist/droidsock.d.mts.map +0 -1
- package/types/index.d.mts +0 -11
- package/types/index.d.mts.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connects to an ADB device. Registers the connection as a real leaf at
|
|
3
|
+
* self.devices[key] (see the module doc comment above) and returns that
|
|
4
|
+
* same leaf. Calling this again for a host:port that's already mounted
|
|
5
|
+
* reuses the SAME leaf - reconnecting it in place if it had disconnected,
|
|
6
|
+
* so a caller holding a prior reference (or resolving one later via
|
|
7
|
+
* devices.get()) never has to re-supply host/port/options.
|
|
8
|
+
* @param {string} host - Device host/IP address
|
|
9
|
+
* @param {number} [port=5555] - Device port
|
|
10
|
+
* @param {Object} [options={}] - Connection options
|
|
11
|
+
* @param {string} [options.keyDir] - Directory for RSA keys (default: ~/.adb)
|
|
12
|
+
* @param {boolean|Object} [options.heartbeat=false] - Probe the connection periodically with a trivial shell command and treat a failed or timed-out probe as a dropped connection (see resolveHeartbeatPolicy for the object form).
|
|
13
|
+
* @param {boolean|Object} [options.autoReconnect=false] - Reconnect automatically, with exponential backoff, when the connection drops (see resolveReconnectPolicy for the object form). An explicit disconnect()/remove() never triggers it.
|
|
14
|
+
* @returns {Promise<Object>} The device leaf (also reachable at api.devices.<sanitized host_port>)
|
|
15
|
+
*/
|
|
16
|
+
export function connect(host: string, port?: number, options?: {
|
|
17
|
+
keyDir?: string | undefined;
|
|
18
|
+
heartbeat?: boolean | Object | undefined;
|
|
19
|
+
autoReconnect?: boolean | Object | undefined;
|
|
20
|
+
}): Promise<Object>;
|
|
21
|
+
/**
|
|
22
|
+
* Disconnects from a specific device without forgetting it - the leaf stays
|
|
23
|
+
* mounted at api.devices.<key> so a later connect(host, port) reconnects it
|
|
24
|
+
* in place. Synchronous: there's no api-tree work to await here (see
|
|
25
|
+
* remove() for that).
|
|
26
|
+
* @param {string} host - Device host
|
|
27
|
+
* @param {number} [port=5555] - Device port
|
|
28
|
+
* @returns {boolean} True if a device was found and disconnected
|
|
29
|
+
*/
|
|
30
|
+
export function disconnect(host: string, port?: number): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Forgets a specific device entirely - disconnects it if still connected,
|
|
33
|
+
* then unmounts its leaf from api.devices. Use disconnect() instead if you
|
|
34
|
+
* only want to tear down the connection while keeping the ability to
|
|
35
|
+
* reconnect later without re-supplying host/port/options.
|
|
36
|
+
* @param {string} host - Device host
|
|
37
|
+
* @param {number} [port=5555] - Device port
|
|
38
|
+
* @returns {Promise<boolean>} True if a device was found and removed
|
|
39
|
+
*/
|
|
40
|
+
export function remove(host: string, port?: number): Promise<boolean>;
|
|
41
|
+
//# sourceMappingURL=device.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.d.mts","sourceRoot":"","sources":["../../../src/api/device.mjs"],"names":[],"mappings":"AA6hBA;;;;;;;;;;;;;;GAcG;AACH,8BARW,MAAM,SACN,MAAM,YAEd;IAAyB,MAAM;IACE,SAAS;IACT,aAAa;CAC9C,GAAU,OAAO,CAAC,MAAM,CAAC,CAsB3B;AAED;;;;;;;;GAQG;AACH,iCAJW,MAAM,SACN,MAAM,GACJ,OAAO,CAUnB;AAED;;;;;;;;GAQG;AACH,6BAJW,MAAM,SACN,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAU5B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists all currently-connected devices. A device that's known but currently
|
|
3
|
+
* disconnected (still mounted, reconnectable via device.connect()) is NOT
|
|
4
|
+
* included here - use get()/deviceEntries-style enumeration if you need
|
|
5
|
+
* every known device regardless of connection state.
|
|
6
|
+
* @returns {Array<Object>} Connected device leaves
|
|
7
|
+
*/
|
|
8
|
+
export function list(): Array<Object>;
|
|
9
|
+
/**
|
|
10
|
+
* Looks up a device leaf - connected or currently disconnected - by
|
|
11
|
+
* "host:port" string or by the leaf object itself (as returned by
|
|
12
|
+
* device.connect()). Since disconnect() no longer unmounts a leaf, this
|
|
13
|
+
* reliably re-resolves the SAME object across a disconnect/reconnect cycle;
|
|
14
|
+
* it only returns undefined for a device that was never connected or has
|
|
15
|
+
* since been forgotten via remove().
|
|
16
|
+
* @param {string|Object} idOrLeaf - "host:port" (bracket the host for IPv6,
|
|
17
|
+
* e.g. "[2001:db8::1]:5555"), a bare host with the default port applied, or
|
|
18
|
+
* a device leaf object.
|
|
19
|
+
* @returns {Object|undefined} The device leaf, or undefined if not mounted.
|
|
20
|
+
*/
|
|
21
|
+
export function get(idOrLeaf: string | Object): Object | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Disconnects every known device (connected or not - a no-op for one
|
|
24
|
+
* that's already disconnected), keeping every leaf mounted for later
|
|
25
|
+
* reconnection. Takes no arguments - the module boundary already means
|
|
26
|
+
* "all"; use `api.device.disconnect(host, port)` to disconnect one.
|
|
27
|
+
* Rejecting any argument here (rather than silently ignoring it) catches a
|
|
28
|
+
* caller who confuses this with the single-target op before it disconnects
|
|
29
|
+
* everything by accident. Synchronous - see device.mjs's disconnect() for why.
|
|
30
|
+
* @returns {number} Number of devices disconnected
|
|
31
|
+
*/
|
|
32
|
+
export function disconnect(...args: any[]): number;
|
|
33
|
+
/**
|
|
34
|
+
* Forgets every known device - disconnects each one (if still connected)
|
|
35
|
+
* and unmounts its leaf. Takes no arguments, same reasoning as
|
|
36
|
+
* disconnect(); use `api.device.remove(host, port)` to forget just one.
|
|
37
|
+
* Async - this is the operation that does real api-tree surgery.
|
|
38
|
+
* @returns {Promise<number>} Number of devices removed
|
|
39
|
+
*/
|
|
40
|
+
export function remove(...args: any[]): Promise<number>;
|
|
41
|
+
//# sourceMappingURL=devices.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devices.d.mts","sourceRoot":"","sources":["../../../src/api/devices.mjs"],"names":[],"mappings":"AA8CA;;;;;;GAMG;AACH,wBAFa,KAAK,CAAC,MAAM,CAAC,CAIzB;AAED;;;;;;;;;;;GAWG;AACH,8BALW,MAAM,GAAC,MAAM,GAGX,MAAM,GAAC,SAAS,CAW5B;AAED;;;;;;;;;GASG;AACH,4CAFa,MAAM,CAmBlB;AAED;;;;;;GAMG;AACH,wCAFa,OAAO,CAAC,MAAM,CAAC,CAa3B"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovers classic fixed-port ADB devices by sweeping a CIDR block with raw
|
|
3
|
+
* TCP connect attempts on a configurable port - the `adb devices`-equivalent
|
|
4
|
+
* mechanism for devices that don't advertise over mDNS. Accepts an IPv4 or
|
|
5
|
+
* IPv6 CIDR (e.g. "192.168.1.0/24" or "2001:db8::/120") - IPv6 sweeps its
|
|
6
|
+
* full range (no network/broadcast exclusion, see parseCidr), so `maxHosts`
|
|
7
|
+
* is what keeps a `/64`-or-larger sweep from being attempted at all.
|
|
8
|
+
*
|
|
9
|
+
* Note: sweeping a range that includes the IPv4 "any" address (0.0.0.0) or
|
|
10
|
+
* its IPv6 equivalent (::) will report it reachable whenever ANYTHING on the
|
|
11
|
+
* local machine listens on the probed port, regardless of the actual remote
|
|
12
|
+
* network - the same hazard either family has for its own "any" address.
|
|
13
|
+
* @param {string} cidr - CIDR block to sweep, e.g. "192.168.1.0/24" or "2001:db8::/120".
|
|
14
|
+
* @param {number} [port=5555] - Port to probe on every candidate host.
|
|
15
|
+
* @param {Object} [options={}] - Sweep options.
|
|
16
|
+
* @param {number} [options.timeoutMs=500] - Per-host connect timeout in ms.
|
|
17
|
+
* @param {number} [options.concurrency=32] - Maximum in-flight connect attempts.
|
|
18
|
+
* @param {number} [options.maxHosts=1024] - Safety ceiling on the number of addresses a CIDR may sweep; throws rather than sweeping an unbounded range.
|
|
19
|
+
* @returns {Promise<Array<{host: string, port: number}>>} Reachable host:port pairs, sorted by host.
|
|
20
|
+
*/
|
|
21
|
+
export function subnet(cidr: string, port?: number, options?: {
|
|
22
|
+
timeoutMs?: number | undefined;
|
|
23
|
+
concurrency?: number | undefined;
|
|
24
|
+
maxHosts?: number | undefined;
|
|
25
|
+
}): Promise<Array<{
|
|
26
|
+
host: string;
|
|
27
|
+
port: number;
|
|
28
|
+
}>>;
|
|
29
|
+
/**
|
|
30
|
+
* Discovers wireless-debugging-advertised devices via mDNS - the
|
|
31
|
+
* `_adb-tls-connect._tcp` / `_adb-tls-pairing._tcp` services Android 11+
|
|
32
|
+
* devices advertise. Hand-written on `dgram` per project decision (see
|
|
33
|
+
* issue #5): sends one PTR query, collects responses for `timeoutMs`, and
|
|
34
|
+
* correlates PTR/SRV/TXT/A/AAAA records sharing a name into device entries.
|
|
35
|
+
*
|
|
36
|
+
* Dual-stack: an explicit literal `address` infers the family on its own
|
|
37
|
+
* (the common case needs no `family` at all); an explicit `family` cross-
|
|
38
|
+
* validates against a literal `address` if both are given. With neither, it
|
|
39
|
+
* defaults to IPv4 exactly as before (`224.0.0.251`/udp4) - `family: 6` with
|
|
40
|
+
* no `address` targets the IPv6 mDNS group `ff02::fb`/udp6 instead.
|
|
41
|
+
* `address`/`port` are always overridable so callers (and tests) can target
|
|
42
|
+
* a specific responder directly instead of joining the multicast group.
|
|
43
|
+
* @param {Object} [options={}] - Query options.
|
|
44
|
+
* @param {string} [options.serviceType="_adb-tls-connect._tcp.local"] - mDNS service to query.
|
|
45
|
+
* @param {string} [options.address] - Destination address for the query. Defaults to the real mDNS group for the resolved family.
|
|
46
|
+
* @param {4|6} [options.family] - IP family to query over. Inferred from a literal `address` if omitted; defaults to 4.
|
|
47
|
+
* @param {number} [options.port=5353] - Destination port for the query.
|
|
48
|
+
* @param {number} [options.timeoutMs=3000] - How long to collect responses before resolving.
|
|
49
|
+
* @param {string} [options.multicastInterface] - Interface to join the multicast group on (e.g. an interface address, or "::%eth0" for IPv6) - needed on a multi-homed or interface-less host, where joining/sending without one can fail with ENETUNREACH.
|
|
50
|
+
* @returns {Promise<Array<{name: string, host: string, port: number, txt: Object}>>} Discovered devices with a resolved host and port.
|
|
51
|
+
*/
|
|
52
|
+
export function mdns(options?: {
|
|
53
|
+
serviceType?: string | undefined;
|
|
54
|
+
address?: string | undefined;
|
|
55
|
+
family?: 4 | 6 | undefined;
|
|
56
|
+
port?: number | undefined;
|
|
57
|
+
timeoutMs?: number | undefined;
|
|
58
|
+
multicastInterface?: string | undefined;
|
|
59
|
+
}): Promise<Array<{
|
|
60
|
+
name: string;
|
|
61
|
+
host: string;
|
|
62
|
+
port: number;
|
|
63
|
+
txt: Object;
|
|
64
|
+
}>>;
|
|
65
|
+
//# sourceMappingURL=discover.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.mts","sourceRoot":"","sources":["../../../src/api/discover.mjs"],"names":[],"mappings":"AAgLA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,6BARW,MAAM,SACN,MAAM,YAEd;IAAyB,SAAS;IACT,WAAW;IACX,QAAQ;CACjC,GAAU,OAAO,CAAC,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC,CAAC,CAoCxD;AAoVD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,+BARG;IAAyB,WAAW;IACX,OAAO;IACV,MAAM;IACH,IAAI;IACJ,SAAS;IACT,kBAAkB;CAC3C,GAAU,OAAO,CAAC,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,CAAC,CAAC,CAuHnF"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pushes a file to the device via the ADB SYNC sub-protocol's SEND command.
|
|
3
|
+
* EXPERIMENTAL - implemented from spec, not yet validated against a real
|
|
4
|
+
* device. See #2.
|
|
5
|
+
* @param {Object} ___socket - ADB socket (unused - the sync stream is opened via streamManager)
|
|
6
|
+
* @param {Object} streamManager - Stream manager instance
|
|
7
|
+
* @param {string} localPath - Local file path
|
|
8
|
+
* @param {string} remotePath - Remote file path on device
|
|
9
|
+
* @param {Object} [options={}] - Transfer options
|
|
10
|
+
* @param {Function} [options.onProgress] - Progress callback, called with {bytesTransferred, totalBytes}
|
|
11
|
+
* @param {number} [options.mode=0o644] - File permissions
|
|
12
|
+
* @returns {Promise<void>}
|
|
13
|
+
*/
|
|
14
|
+
export function push(___socket: Object, streamManager: Object, localPath: string, remotePath: string, options?: {
|
|
15
|
+
onProgress?: Function | undefined;
|
|
16
|
+
mode?: number | undefined;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Pushes a file to the device via the ADB SYNC sub-protocol's 64-bit
|
|
20
|
+
* SEND_V2 command - see #8. Only usable against a device that advertised the
|
|
21
|
+
* "stat_v2"/"sendrecv_v2" CNXN feature (droidsock declares "sendrecv_v2" in
|
|
22
|
+
* its own outgoing banner, see connection.mjs). EXPERIMENTAL - implemented
|
|
23
|
+
* from spec (AOSP file_sync_protocol.h), not yet validated against a real
|
|
24
|
+
* device. See #2.
|
|
25
|
+
* @param {Object} ___socket - ADB socket (unused - the sync stream is opened via streamManager)
|
|
26
|
+
* @param {Object} streamManager - Stream manager instance
|
|
27
|
+
* @param {string} localPath - Local file path
|
|
28
|
+
* @param {string} remotePath - Remote file path on device
|
|
29
|
+
* @param {Object} [options={}] - Transfer options
|
|
30
|
+
* @param {Function} [options.onProgress] - Progress callback, called with {bytesTransferred, totalBytes} (counts uncompressed bytes read from the local file, regardless of `compression`)
|
|
31
|
+
* @param {number} [options.mode=0o644] - File permissions
|
|
32
|
+
* @param {"none"|"brotli"} [options.compression="none"] - Per-chunk compression, only if the device advertised the matching CNXN feature (`sendrecv_v2_brotli`) - droidsock declares support but doesn't enable it unless asked, since it hasn't been validated against a real device. `lz4`/`zstd` aren't implemented - see #8.
|
|
33
|
+
* @returns {Promise<void>}
|
|
34
|
+
*/
|
|
35
|
+
export function pushV2(___socket: Object, streamManager: Object, localPath: string, remotePath: string, options?: {
|
|
36
|
+
onProgress?: Function | undefined;
|
|
37
|
+
mode?: number | undefined;
|
|
38
|
+
compression?: "none" | "brotli" | undefined;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Pulls a file from the device via the ADB SYNC sub-protocol's RECV command.
|
|
42
|
+
* EXPERIMENTAL - implemented from spec, not yet validated against a real
|
|
43
|
+
* device. See #2.
|
|
44
|
+
* @param {Object} ___socket - ADB socket (unused - the sync stream is opened via streamManager)
|
|
45
|
+
* @param {Object} streamManager - Stream manager instance
|
|
46
|
+
* @param {string} remotePath - Remote file path on device
|
|
47
|
+
* @param {string} localPath - Local file path
|
|
48
|
+
* @param {Object} [options={}] - Transfer options
|
|
49
|
+
* @param {Function} [options.onProgress] - Progress callback, called with {bytesTransferred}
|
|
50
|
+
* @returns {Promise<void>}
|
|
51
|
+
*/
|
|
52
|
+
export function pull(___socket: Object, streamManager: Object, remotePath: string, localPath: string, options?: {
|
|
53
|
+
onProgress?: Function | undefined;
|
|
54
|
+
}): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Pulls a file from the device via the ADB SYNC sub-protocol's 64-bit
|
|
57
|
+
* RECV_V2 command - see #8. Only usable against a device that advertised the
|
|
58
|
+
* "sendrecv_v2" CNXN feature. EXPERIMENTAL - implemented from spec, not yet
|
|
59
|
+
* validated against a real device. See #2.
|
|
60
|
+
* @param {Object} ___socket - ADB socket (unused - the sync stream is opened via streamManager)
|
|
61
|
+
* @param {Object} streamManager - Stream manager instance
|
|
62
|
+
* @param {string} remotePath - Remote file path on device
|
|
63
|
+
* @param {string} localPath - Local file path
|
|
64
|
+
* @param {Object} [options={}] - Transfer options
|
|
65
|
+
* @param {Function} [options.onProgress] - Progress callback, called with {bytesTransferred} (counts bytes as received on the wire, i.e. compressed size when `compression` is set)
|
|
66
|
+
* @param {"none"|"brotli"} [options.compression="none"] - Requests per-chunk compression from the device, only if it advertised the matching CNXN feature (`sendrecv_v2_brotli`) - droidsock declares support but doesn't request it unless asked, since it hasn't been validated against a real device. `lz4`/`zstd` aren't implemented - see #8.
|
|
67
|
+
* @returns {Promise<void>}
|
|
68
|
+
*/
|
|
69
|
+
export function pullV2(___socket: Object, streamManager: Object, remotePath: string, localPath: string, options?: {
|
|
70
|
+
onProgress?: Function | undefined;
|
|
71
|
+
compression?: "none" | "brotli" | undefined;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Lists directory contents via the ADB SYNC sub-protocol's binary-safe LIST
|
|
75
|
+
* command. EXPERIMENTAL - implemented from spec, not yet validated against a
|
|
76
|
+
* real device. See #2. Unlike `ls -la` text parsing, this can't be confused
|
|
77
|
+
* by filenames containing shell-metacharacters, unusual whitespace, or
|
|
78
|
+
* newlines.
|
|
79
|
+
* @param {Object} ___socket - ADB socket (unused - the sync stream is opened via streamManager)
|
|
80
|
+
* @param {Object} streamManager - Stream manager instance
|
|
81
|
+
* @param {string} remotePath - Remote directory path
|
|
82
|
+
* @returns {Promise<Array<{name: string, size: number, mtime: number, mode: number, isDirectory: boolean, isFile: boolean, isSymlink: boolean}>>} Directory entries
|
|
83
|
+
*/
|
|
84
|
+
export function listSync(___socket: Object, streamManager: Object, remotePath: string): Promise<Array<{
|
|
85
|
+
name: string;
|
|
86
|
+
size: number;
|
|
87
|
+
mtime: number;
|
|
88
|
+
mode: number;
|
|
89
|
+
isDirectory: boolean;
|
|
90
|
+
isFile: boolean;
|
|
91
|
+
isSymlink: boolean;
|
|
92
|
+
}>>;
|
|
93
|
+
/**
|
|
94
|
+
* Lists directory contents via the ADB SYNC sub-protocol's 64-bit LIST_V2
|
|
95
|
+
* command - see #8. Entries carry the same fields as listSync()'s plus the
|
|
96
|
+
* additional 64-bit-struct fields (atime/ctime/uid/gid/nlink/dev/ino);
|
|
97
|
+
* size/atime/mtime/ctime/dev/ino are returned as BigInt since the whole
|
|
98
|
+
* point of V2 is representing values beyond Number.MAX_SAFE_INTEGER. Only
|
|
99
|
+
* usable against a device that advertised the "ls_v2" CNXN feature.
|
|
100
|
+
* EXPERIMENTAL - implemented from spec, not yet validated against a real
|
|
101
|
+
* device. See #2.
|
|
102
|
+
* @param {Object} ___socket - ADB socket (unused - the sync stream is opened via streamManager)
|
|
103
|
+
* @param {Object} streamManager - Stream manager instance
|
|
104
|
+
* @param {string} remotePath - Remote directory path
|
|
105
|
+
* @returns {Promise<Array<Object>>} Directory entries
|
|
106
|
+
*/
|
|
107
|
+
export function listV2(___socket: Object, streamManager: Object, remotePath: string): Promise<Array<Object>>;
|
|
108
|
+
/**
|
|
109
|
+
* Lists directory contents on device via `ls -la`, parsed into structured entries.
|
|
110
|
+
* @param {Object} socket - ADB socket
|
|
111
|
+
* @param {Object} streamManager - Stream manager instance
|
|
112
|
+
* @param {string} remotePath - Remote directory path
|
|
113
|
+
* @returns {Promise<Array>} Array of directory entries (see utils.parseListing)
|
|
114
|
+
*/
|
|
115
|
+
export function listShell(socket: Object, streamManager: Object, remotePath: string): Promise<any[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Lists directory contents, preferring the binary-safe SYNC LIST command and
|
|
118
|
+
* falling back to shell-based `ls -la` parsing for devices or connection
|
|
119
|
+
* states where the SYNC service isn't usable. Both paths return entries with
|
|
120
|
+
* at least `name`/`isDirectory`/`isFile`/`isSymlink`; the SYNC path also
|
|
121
|
+
* includes `mode`/`mtime`, while the shell path also includes
|
|
122
|
+
* `permissions`/`links`/`owner`/`group`/`dateTime` (see utils.parseListing).
|
|
123
|
+
*
|
|
124
|
+
* The fallback is narrow on purpose: it only triggers when the sync stream
|
|
125
|
+
* itself can't be opened. A real LIST failure (a FAIL frame, e.g. "No such
|
|
126
|
+
* file or directory", or a protocol error) is a genuine result and is
|
|
127
|
+
* rethrown rather than silently masked by a different-shaped shell result.
|
|
128
|
+
* @param {Object} socket - ADB socket
|
|
129
|
+
* @param {Object} streamManager - Stream manager instance
|
|
130
|
+
* @param {string} remotePath - Remote directory path
|
|
131
|
+
* @returns {Promise<Array>} Directory entries
|
|
132
|
+
*/
|
|
133
|
+
export function list(socket: Object, streamManager: Object, remotePath: string): Promise<any[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Gets file/directory stats on device via the shell `stat` command.
|
|
136
|
+
* @param {Object} socket - ADB socket
|
|
137
|
+
* @param {Object} streamManager - Stream manager instance
|
|
138
|
+
* @param {string} remotePath - Remote path
|
|
139
|
+
* @returns {Promise<string>} Raw `stat` command output
|
|
140
|
+
*/
|
|
141
|
+
export function stat(socket: Object, streamManager: Object, remotePath: string): Promise<string>;
|
|
142
|
+
/**
|
|
143
|
+
* Gets file/directory stats via the ADB SYNC sub-protocol's 64-bit STAT_V2
|
|
144
|
+
* command - see #8. Unlike stat() (shell `stat` text parsing), this is
|
|
145
|
+
* binary-safe and returns structured fields directly off the wire;
|
|
146
|
+
* size/atime/mtime/ctime/dev/ino are BigInt for the same reason as
|
|
147
|
+
* listV2(). Only usable against a device that advertised the "stat_v2" CNXN
|
|
148
|
+
* feature. Throws if the device reports a non-zero `error` (e.g. ENOENT) in
|
|
149
|
+
* the reply struct - STAT_V2 has no separate FAIL frame, the error is a
|
|
150
|
+
* field on the reply itself. EXPERIMENTAL - implemented from spec, not yet
|
|
151
|
+
* validated against a real device. See #2.
|
|
152
|
+
* @param {Object} ___socket - ADB socket (unused - the sync stream is opened via streamManager)
|
|
153
|
+
* @param {Object} streamManager - Stream manager instance
|
|
154
|
+
* @param {string} remotePath - Remote path
|
|
155
|
+
* @returns {Promise<Object>} Structured stat result
|
|
156
|
+
*/
|
|
157
|
+
export function statV2(___socket: Object, streamManager: Object, remotePath: string): Promise<Object>;
|
|
158
|
+
/**
|
|
159
|
+
* Creates a directory on device
|
|
160
|
+
* @param {Object} socket - ADB socket
|
|
161
|
+
* @param {Object} streamManager - Stream manager instance
|
|
162
|
+
* @param {string} remotePath - Remote directory path
|
|
163
|
+
* @param {number} [mode=0o755] - Directory permissions
|
|
164
|
+
* @returns {Promise<void>}
|
|
165
|
+
*/
|
|
166
|
+
export function mkdir(socket: Object, streamManager: Object, remotePath: string, mode?: number): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Removes a file or directory on device
|
|
169
|
+
* @param {Object} socket - ADB socket
|
|
170
|
+
* @param {Object} streamManager - Stream manager instance
|
|
171
|
+
* @param {string} remotePath - Remote path to remove
|
|
172
|
+
* @param {boolean} [recursive=false] - Remove recursively
|
|
173
|
+
* @returns {Promise<void>}
|
|
174
|
+
*/
|
|
175
|
+
export function remove(socket: Object, streamManager: Object, remotePath: string, recursive?: boolean): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Moves/renames a file or directory on device
|
|
178
|
+
* @param {Object} socket - ADB socket
|
|
179
|
+
* @param {Object} streamManager - Stream manager instance
|
|
180
|
+
* @param {string} sourcePath - Source path
|
|
181
|
+
* @param {string} destPath - Destination path
|
|
182
|
+
* @returns {Promise<void>}
|
|
183
|
+
*/
|
|
184
|
+
export function move(socket: Object, streamManager: Object, sourcePath: string, destPath: string): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Copies a file or directory on device
|
|
187
|
+
* @param {Object} socket - ADB socket
|
|
188
|
+
* @param {Object} streamManager - Stream manager instance
|
|
189
|
+
* @param {string} sourcePath - Source path
|
|
190
|
+
* @param {string} destPath - Destination path
|
|
191
|
+
* @param {boolean} [recursive=false] - Copy recursively
|
|
192
|
+
* @returns {Promise<void>}
|
|
193
|
+
*/
|
|
194
|
+
export function copy(socket: Object, streamManager: Object, sourcePath: string, destPath: string, recursive?: boolean): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Changes file permissions on device
|
|
197
|
+
* @param {Object} socket - ADB socket
|
|
198
|
+
* @param {Object} streamManager - Stream manager instance
|
|
199
|
+
* @param {string} remotePath - Remote path
|
|
200
|
+
* @param {number} mode - Permission mode (e.g., 0o644)
|
|
201
|
+
* @param {boolean} [recursive=false] - Apply recursively
|
|
202
|
+
* @returns {Promise<void>}
|
|
203
|
+
*/
|
|
204
|
+
export function chmod(socket: Object, streamManager: Object, remotePath: string, mode: number, recursive?: boolean): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Gets disk usage information
|
|
207
|
+
* @param {Object} socket - ADB socket
|
|
208
|
+
* @param {Object} streamManager - Stream manager instance
|
|
209
|
+
* @param {string} [path='/'] - Path to check
|
|
210
|
+
* @returns {Promise<string>} Disk usage output
|
|
211
|
+
*/
|
|
212
|
+
export function diskUsage(socket: Object, streamManager: Object, path?: string): Promise<string>;
|
|
213
|
+
/**
|
|
214
|
+
* Finds files matching a pattern
|
|
215
|
+
* @param {Object} socket - ADB socket
|
|
216
|
+
* @param {Object} streamManager - Stream manager instance
|
|
217
|
+
* @param {string} path - Starting path
|
|
218
|
+
* @param {string} pattern - File pattern (e.g., '*.txt')
|
|
219
|
+
* @param {Object} [options={}] - Find options
|
|
220
|
+
* @param {number} [options.maxDepth] - Maximum search depth (non-negative integer; 0 is valid and means the starting point only)
|
|
221
|
+
* @param {string} [options.type] - File type: one of b, c, d, p, f, l, s (see find(1))
|
|
222
|
+
* @returns {Promise<string>} Find results
|
|
223
|
+
*/
|
|
224
|
+
export function find(socket: Object, streamManager: Object, path: string, pattern: string, options?: {
|
|
225
|
+
maxDepth?: number | undefined;
|
|
226
|
+
type?: string | undefined;
|
|
227
|
+
}): Promise<string>;
|
|
228
|
+
//# sourceMappingURL=files.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../../../src/api/files.mjs"],"names":[],"mappings":"AAkeA;;;;;;;;;;;;GAYG;AACH,gCATW,MAAM,iBACN,MAAM,aACN,MAAM,cACN,MAAM,YAEd;IAA2B,UAAU;IACZ,IAAI;CAC7B,GAAU,OAAO,CAAC,IAAI,CAAC,CAgCzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,kCAVW,MAAM,iBACN,MAAM,aACN,MAAM,cACN,MAAM,YAEd;IAA2B,UAAU;IACZ,IAAI;IACK,WAAW;CAC7C,GAAU,OAAO,CAAC,IAAI,CAAC,CAgEzB;AAED;;;;;;;;;;;GAWG;AACH,gCARW,MAAM,iBACN,MAAM,cACN,MAAM,aACN,MAAM,YAEd;IAA2B,UAAU;CACrC,GAAU,OAAO,CAAC,IAAI,CAAC,CA8BzB;AAED;;;;;;;;;;;;;GAaG;AACH,kCATW,MAAM,iBACN,MAAM,cACN,MAAM,aACN,MAAM,YAEd;IAA2B,UAAU;IACH,WAAW;CAC7C,GAAU,OAAO,CAAC,IAAI,CAAC,CAuEzB;AA2CD;;;;;;;;;;GAUG;AACH,oCALW,MAAM,iBACN,MAAM,cACN,MAAM,GACJ,OAAO,CAAC,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC,CAAC,CAAC,CAKhJ;AAED;;;;;;;;;;;;;GAaG;AACH,kCALW,MAAM,iBACN,MAAM,cACN,MAAM,GACJ,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAsClC;AAED;;;;;;GAMG;AACH,kCALW,MAAM,iBACN,MAAM,cACN,MAAM,GACJ,OAAO,OAAO,CAK1B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,6BALW,MAAM,iBACN,MAAM,cACN,MAAM,GACJ,OAAO,OAAO,CAU1B;AAED;;;;;;GAMG;AACH,6BALW,MAAM,iBACN,MAAM,cACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAI3B;AAED;;;;;;;;;;;;;;GAcG;AACH,kCALW,MAAM,iBACN,MAAM,cACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAiC3B;AAED;;;;;;;GAOG;AACH,8BANW,MAAM,iBACN,MAAM,cACN,MAAM,SACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAOzB;AAED;;;;;;;GAOG;AACH,+BANW,MAAM,iBACN,MAAM,cACN,MAAM,cACN,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAMzB;AAED;;;;;;;GAOG;AACH,6BANW,MAAM,iBACN,MAAM,cACN,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKzB;AAED;;;;;;;;GAQG;AACH,6BAPW,MAAM,iBACN,MAAM,cACN,MAAM,YACN,MAAM,cACN,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAMzB;AAED;;;;;;;;GAQG;AACH,8BAPW,MAAM,iBACN,MAAM,cACN,MAAM,QACN,MAAM,cACN,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAOzB;AAED;;;;;;GAMG;AACH,kCALW,MAAM,iBACN,MAAM,SACN,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAK3B;AAED;;;;;;;;;;GAUG;AACH,6BATW,MAAM,iBACN,MAAM,QACN,MAAM,WACN,MAAM,YAEd;IAAyB,QAAQ;IACR,IAAI;CAC7B,GAAU,OAAO,CAAC,MAAM,CAAC,CAsB3B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starts forwarding a local TCP port to a port on the device - the
|
|
3
|
+
* `adb forward tcp:<localPort> tcp:<devicePort>` equivalent. Each connection
|
|
4
|
+
* accepted on the local port opens a new ADB stream to the device's
|
|
5
|
+
* `tcp:<devicePort>` service (the same client-initiated stream-open
|
|
6
|
+
* mechanism already used for `shell:`/`sync:`) and bridges bytes
|
|
7
|
+
* bidirectionally between the two until either side closes.
|
|
8
|
+
* EXPERIMENTAL - the `tcp:` stream mechanism is implemented from the ADB
|
|
9
|
+
* protocol spec, not yet validated against a real device. See #2.
|
|
10
|
+
* @param {Object} ___socket - ADB socket (unused - streams are opened via streamManager)
|
|
11
|
+
* @param {Object} streamManager - Stream manager instance
|
|
12
|
+
* @param {number} devicePort - Device port to forward to
|
|
13
|
+
* @param {Object} [options={}] - Options
|
|
14
|
+
* @param {number} [options.localPort=0] - Local TCP port to listen on (0 picks a free port)
|
|
15
|
+
* @param {string} [options.host="127.0.0.1"] - Local host to bind
|
|
16
|
+
* @param {Function} [options.onError] - Called with (error, localSocket) on a per-connection bridging error
|
|
17
|
+
* @returns {Promise<{localPort: number, close: () => Promise<void>}>} Control handle - `localPort` is the actual bound port, `close()` stops listening
|
|
18
|
+
*/
|
|
19
|
+
export function start(___socket: Object, streamManager: Object, devicePort: number, options?: {
|
|
20
|
+
localPort?: number | undefined;
|
|
21
|
+
host?: string | undefined;
|
|
22
|
+
onError?: Function | undefined;
|
|
23
|
+
}): Promise<{
|
|
24
|
+
localPort: number;
|
|
25
|
+
close: () => Promise<void>;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=forward.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forward.d.mts","sourceRoot":"","sources":["../../../src/api/forward.mjs"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;;;;;;GAiBG;AACH,iCATW,MAAM,iBACN,MAAM,cACN,MAAM,YAEd;IAAyB,SAAS;IACT,IAAI;IACF,OAAO;CAClC,GAAU,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAC,CAAC,CAoEpE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installs a local APK using the classic push-then-install flow: pushes the
|
|
3
|
+
* file to a device temp directory via the existing SYNC-based push, runs
|
|
4
|
+
* `pm install` against it, then removes the pushed temp file regardless of
|
|
5
|
+
* whether the install succeeded. Pure composition of two already-implemented
|
|
6
|
+
* primitives (files.push, shell.commands.installApk) - no new protocol work.
|
|
7
|
+
* EXPERIMENTAL - depends on files.push(), which hasn't been validated
|
|
8
|
+
* against a real device yet. See #2.
|
|
9
|
+
* @param {Object} socket - ADB socket
|
|
10
|
+
* @param {Object} streamManager - Stream manager instance
|
|
11
|
+
* @param {string} localPath - Local APK file path
|
|
12
|
+
* @param {Object} [options={}] - Options
|
|
13
|
+
* @param {Array<string>} [options.flags=[]] - `pm install` flags (e.g. ["-r"] to reinstall)
|
|
14
|
+
* @param {string} [options.remoteDir="/data/local/tmp"] - Device directory to push the APK into
|
|
15
|
+
* @param {Function} [options.onProgress] - Push progress callback, see files.push
|
|
16
|
+
* @returns {Promise<string>} `pm install`'s output
|
|
17
|
+
*/
|
|
18
|
+
export function classic(socket: Object, streamManager: Object, localPath: string, options?: {
|
|
19
|
+
flags?: string[] | undefined;
|
|
20
|
+
remoteDir?: string | undefined;
|
|
21
|
+
onProgress?: Function | undefined;
|
|
22
|
+
}): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Installs a local APK using the modern streaming install service: opens an
|
|
25
|
+
* `exec:cmd package install -S <size>` stream and writes the raw APK bytes
|
|
26
|
+
* directly as the command's stdin over WRTE frames - no on-device file is
|
|
27
|
+
* ever written. The `-S <size>` flag tells `pm install` exactly how many
|
|
28
|
+
* stdin bytes to expect, which is what lets this work without any explicit
|
|
29
|
+
* stdin-close signal (ADB streams have no half-close). Reads the local file
|
|
30
|
+
* in EXEC_WRITE_CHUNK-sized pieces via a file handle rather than loading the
|
|
31
|
+
* whole APK into memory up front, so peak host memory stays bounded to one
|
|
32
|
+
* chunk regardless of APK size. The file is opened once and its size is read
|
|
33
|
+
* from that open handle (fileHandle.stat(), not fs.stat(localPath)) - a
|
|
34
|
+
* separate stat-then-open on the path would be a TOCTOU (CodeQL
|
|
35
|
+
* js/file-system-race): the file could be replaced between the two calls,
|
|
36
|
+
* making the declared `-S <size>` not match what's actually read. Once
|
|
37
|
+
* opened, the handle's descriptor refers to the file's inode regardless of
|
|
38
|
+
* what later happens to the path. EXPERIMENTAL - this is droidsock's first
|
|
39
|
+
* use of an `exec:` stream and its first case of writing raw binary data as
|
|
40
|
+
* a command's stdin; not yet validated against a real device, and requires
|
|
41
|
+
* the device to advertise the "cmd" feature. See #2.
|
|
42
|
+
* @param {Object} ___socket - ADB socket (unused - the exec stream is opened via streamManager)
|
|
43
|
+
* @param {Object} streamManager - Stream manager instance
|
|
44
|
+
* @param {string} localPath - Local APK file path
|
|
45
|
+
* @param {Object} [options={}] - Options
|
|
46
|
+
* @param {Array<string>} [options.flags=[]] - `cmd package install` flags (e.g. ["-r"] to reinstall)
|
|
47
|
+
* @param {Function} [options.onProgress] - Progress callback, called with {bytesTransferred, totalBytes}
|
|
48
|
+
* @returns {Promise<string>} `cmd package install`'s output
|
|
49
|
+
*/
|
|
50
|
+
export function streaming(___socket: Object, streamManager: Object, localPath: string, options?: {
|
|
51
|
+
flags?: string[] | undefined;
|
|
52
|
+
onProgress?: Function | undefined;
|
|
53
|
+
}): Promise<string>;
|
|
54
|
+
//# sourceMappingURL=install.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.mts","sourceRoot":"","sources":["../../../src/api/install.mjs"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;GAgBG;AACH,gCATW,MAAM,iBACN,MAAM,aACN,MAAM,YAEd;IAAgC,KAAK;IACZ,SAAS;IACP,UAAU;CACrC,GAAU,OAAO,CAAC,MAAM,CAAC,CAoB3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qCARW,MAAM,iBACN,MAAM,aACN,MAAM,YAEd;IAAgC,KAAK;IACV,UAAU;CACrC,GAAU,OAAO,CAAC,MAAM,CAAC,CA6F3B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log a debug message
|
|
3
|
+
* @param {...*} args - Arguments to log
|
|
4
|
+
*/
|
|
5
|
+
export function debug(...args: any[]): void;
|
|
6
|
+
/**
|
|
7
|
+
* Log a verbose message
|
|
8
|
+
* @param {...*} args - Arguments to log
|
|
9
|
+
*/
|
|
10
|
+
export function verbose(...args: any[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Log an info message
|
|
13
|
+
* @param {...*} args - Arguments to log
|
|
14
|
+
*/
|
|
15
|
+
export function info(...args: any[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Log a warning message
|
|
18
|
+
* @param {...*} args - Arguments to log
|
|
19
|
+
*/
|
|
20
|
+
export function warn(...args: any[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Log an error message
|
|
23
|
+
* @param {...*} args - Arguments to log
|
|
24
|
+
*/
|
|
25
|
+
export function error(...args: any[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Create a child logger with additional context
|
|
28
|
+
* @param {string} context - Additional context for the logger
|
|
29
|
+
* @returns {Object} Child logger functions
|
|
30
|
+
*/
|
|
31
|
+
export function child(context: string): Object;
|
|
32
|
+
/**
|
|
33
|
+
* Get the logger API
|
|
34
|
+
* @returns {Object} Logger API
|
|
35
|
+
*/
|
|
36
|
+
export function getApi(): Object;
|
|
37
|
+
//# sourceMappingURL=log.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.mts","sourceRoot":"","sources":["../../../src/api/log.mjs"],"names":[],"mappings":"AAsCA;;;GAGG;AACH,+BAFc,GAAC,EAAA,QAMd;AAED;;;GAGG;AACH,iCAFc,GAAC,EAAA,QAMd;AAED;;;GAGG;AACH,8BAFc,GAAC,EAAA,QAKd;AAED;;;GAGG;AACH,8BAFc,GAAC,EAAA,QAKd;AAED;;;GAGG;AACH,+BAFc,GAAC,EAAA,QAKd;AAED;;;;GAIG;AACH,+BAHW,MAAM,GACJ,MAAM,CAkClB;AAED;;;GAGG;AACH,0BAFa,MAAM,CAWlB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pairs with a device advertising ADB Wi-Fi pairing (`_adb-tls-pairing._tcp`
|
|
3
|
+
* over mDNS - see discover.mdns()) using the 6-digit pairing code shown on
|
|
4
|
+
* the device. The `adb pair host:port pairing-code` equivalent.
|
|
5
|
+
*
|
|
6
|
+
* On success, droidsock's RSA public key has been written into the
|
|
7
|
+
* device's `adb_keys` trust store - the same store the classic auth flow's
|
|
8
|
+
* on-device "Allow this computer?" tap populates - so a later
|
|
9
|
+
* `device.connect()` to the device's normal wireless-debugging port no
|
|
10
|
+
* longer needs manual authorization.
|
|
11
|
+
*
|
|
12
|
+
* EXPERIMENTAL - see this module's own top-of-file note for exactly which
|
|
13
|
+
* parts of the protocol are precisely confirmed against AOSP/BoringSSL
|
|
14
|
+
* source vs. best-effort placeholders. Not yet run against a real device.
|
|
15
|
+
* See #1.
|
|
16
|
+
* @param {string} host - Pairing service host/IP.
|
|
17
|
+
* @param {number} port - Pairing service port (from the mDNS TXT/SRV record - it's ephemeral per session, not a fixed port).
|
|
18
|
+
* @param {string} pairingCode - The 6-digit pairing code displayed on the device.
|
|
19
|
+
* @param {Object} [options={}] - Options.
|
|
20
|
+
* @param {string} [options.keyDir] - Directory for RSA keys/cert (default: ~/.adb, same as auth.getKeys()).
|
|
21
|
+
* @param {number} [options.timeoutMs=10000] - Timeout for the TLS connection and SPAKE2/PeerInfo exchange - the timer starts once the RSA keypair and pairing cert are already loaded/generated, so it does NOT bound that preflight key/cert I/O (typically fast, but can take longer on a first run with no existing keys to load).
|
|
22
|
+
* @returns {Promise<{success: boolean}>} Pairing result.
|
|
23
|
+
*/
|
|
24
|
+
export function pair(host: string, port: number, pairingCode: string, options?: {
|
|
25
|
+
keyDir?: string | undefined;
|
|
26
|
+
timeoutMs?: number | undefined;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
success: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=pairing.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairing.d.mts","sourceRoot":"","sources":["../../../src/api/pairing.mjs"],"names":[],"mappings":"AA6dA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,2BARW,MAAM,QACN,MAAM,eACN,MAAM,YAEd;IAAyB,MAAM;IACN,SAAS;CAClC,GAAU,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CAAC,CAsIvC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/droidsock
|
|
4
|
+
* @Filename: /src/api/reboot.mjs
|
|
5
|
+
* @Date: 2026-09-01T05:39:07-07:00 (1788266347)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-02T15:29:46-07:00 (1790980186)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Reboot service API module for DroidSock
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Reboots the device via the real ADB `reboot:` service - a distinct
|
|
20
|
+
* top-level service (like `shell:`/`sync:`), not a shell command. Supports
|
|
21
|
+
* the standard mode variants (`""` for a normal reboot, `"bootloader"`,
|
|
22
|
+
* `"recovery"`, `"sideload"`, `"sideload-auto-reboot"`) and passes any other
|
|
23
|
+
* string through as-is, since some devices support additional
|
|
24
|
+
* vendor-specific reboot targets.
|
|
25
|
+
* EXPERIMENTAL - implemented from the ADB protocol spec, not yet validated
|
|
26
|
+
* against a real device. See #2.
|
|
27
|
+
* @param {Object} ___socket - ADB socket (unused - the stream is opened via streamManager)
|
|
28
|
+
* @param {Object} streamManager - Stream manager instance
|
|
29
|
+
* @param {string} [mode=""] - Reboot mode/target
|
|
30
|
+
* @returns {Promise<void>}
|
|
31
|
+
*/
|
|
32
|
+
export function execute(___socket: Object, streamManager: Object, mode?: string): Promise<void>;
|
|
33
|
+
//# sourceMappingURL=reboot.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reboot.d.mts","sourceRoot":"","sources":["../../../src/api/reboot.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AACH,mCALW,MAAM,iBACN,MAAM,SACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAazB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starts reverse port forwarding - the `adb reverse tcp:<devicePort>
|
|
3
|
+
* tcp:<hostPort>` equivalent. Registers the tunnel with the device (a normal
|
|
4
|
+
* client-initiated `reverse:forward:` stream, acked the same way every ADB
|
|
5
|
+
* host-service is), then bridges every subsequent device-initiated
|
|
6
|
+
* connection tagged for this mapping to a fresh local TCP connection.
|
|
7
|
+
* EXPERIMENTAL - built from the ADB protocol spec, not yet validated against
|
|
8
|
+
* a real device. See #1.
|
|
9
|
+
* @param {Object} ___socket - ADB socket (unused - streams are opened via streamManager)
|
|
10
|
+
* @param {Object} streamManager - Stream manager instance
|
|
11
|
+
* @param {number} devicePort - Device port to register the reverse tunnel on
|
|
12
|
+
* @param {number} hostPort - Local port to connect to for each device-initiated connection
|
|
13
|
+
* @param {Object} [options={}] - Options
|
|
14
|
+
* @param {string} [options.host="127.0.0.1"] - Local host to connect to
|
|
15
|
+
* @param {Function} [options.onError] - Called with (error, deviceStream) on a per-connection bridging error
|
|
16
|
+
* @returns {Promise<{devicePort: number, hostPort: number, close: () => Promise<void>}>} Control handle - `close()` unregisters the tunnel and stops bridging
|
|
17
|
+
*/
|
|
18
|
+
export function start(___socket: Object, streamManager: Object, devicePort: number, hostPort: number, options?: {
|
|
19
|
+
host?: string | undefined;
|
|
20
|
+
onError?: Function | undefined;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
devicePort: number;
|
|
23
|
+
hostPort: number;
|
|
24
|
+
close: () => Promise<void>;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=reverse.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reverse.d.mts","sourceRoot":"","sources":["../../../src/api/reverse.mjs"],"names":[],"mappings":"AA4DA;;;;;;;;;;;;;;;;GAgBG;AACH,iCATW,MAAM,iBACN,MAAM,cACN,MAAM,YACN,MAAM,YAEd;IAAyB,IAAI;IACF,OAAO;CAClC,GAAU,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAC,CAAC,CAsJvF"}
|