@yume-chan/adb 0.0.18 → 0.0.20
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/CHANGELOG.json +54 -0
- package/CHANGELOG.md +25 -1
- package/README.md +220 -103
- package/esm/adb.d.ts +43 -60
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +68 -249
- package/esm/adb.js.map +1 -1
- package/esm/banner.d.ts +17 -0
- package/esm/banner.d.ts.map +1 -0
- package/esm/banner.js +67 -0
- package/esm/banner.js.map +1 -0
- package/esm/commands/base.d.ts +6 -6
- package/esm/commands/base.d.ts.map +1 -1
- package/esm/commands/base.js +8 -8
- package/esm/commands/framebuffer.d.ts +53 -53
- package/esm/commands/framebuffer.d.ts.map +1 -1
- package/esm/commands/framebuffer.js +46 -46
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +7 -8
- package/esm/commands/index.d.ts.map +1 -1
- package/esm/commands/index.js +7 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/power.d.ts +22 -22
- package/esm/commands/power.js +48 -48
- package/esm/commands/reverse.d.ts +40 -28
- package/esm/commands/reverse.d.ts.map +1 -1
- package/esm/commands/reverse.js +130 -100
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/command.d.ts +57 -51
- package/esm/commands/subprocess/command.d.ts.map +1 -1
- package/esm/commands/subprocess/command.js +86 -80
- package/esm/commands/subprocess/command.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +3 -3
- package/esm/commands/subprocess/index.js +3 -3
- package/esm/commands/subprocess/protocols/index.d.ts +3 -3
- package/esm/commands/subprocess/protocols/index.js +3 -3
- package/esm/commands/subprocess/protocols/none.d.ts +30 -35
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/none.js +65 -55
- package/esm/commands/subprocess/protocols/none.js.map +1 -1
- package/esm/commands/subprocess/protocols/shell.d.ts +33 -38
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/shell.js +172 -162
- package/esm/commands/subprocess/protocols/shell.js.map +1 -1
- package/esm/commands/subprocess/protocols/types.d.ts +48 -49
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/types.js +1 -1
- package/esm/commands/subprocess/utils.d.ts +1 -1
- package/esm/commands/subprocess/utils.js +18 -18
- package/esm/commands/sync/index.d.ts +8 -7
- package/esm/commands/sync/index.d.ts.map +1 -1
- package/esm/commands/sync/index.js +8 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/esm/commands/sync/list.d.ts +42 -40
- package/esm/commands/sync/list.d.ts.map +1 -1
- package/esm/commands/sync/list.js +67 -47
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +13 -11
- package/esm/commands/sync/pull.d.ts.map +1 -1
- package/esm/commands/sync/pull.js +35 -37
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +57 -7
- package/esm/commands/sync/push.d.ts.map +1 -1
- package/esm/commands/sync/push.js +89 -22
- package/esm/commands/sync/push.js.map +1 -1
- package/esm/commands/sync/request.d.ts +26 -23
- package/esm/commands/sync/request.d.ts.map +1 -1
- package/esm/commands/sync/request.js +40 -42
- package/esm/commands/sync/request.js.map +1 -1
- package/esm/commands/sync/response.d.ts +19 -19
- package/esm/commands/sync/response.d.ts.map +1 -1
- package/esm/commands/sync/response.js +54 -54
- package/esm/commands/sync/response.js.map +1 -1
- package/esm/commands/sync/socket.d.ts +22 -0
- package/esm/commands/sync/socket.d.ts.map +1 -0
- package/esm/commands/sync/socket.js +69 -0
- package/esm/commands/sync/socket.js.map +1 -0
- package/esm/commands/sync/stat.d.ts +72 -72
- package/esm/commands/sync/stat.d.ts.map +1 -1
- package/esm/commands/sync/stat.js +116 -104
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +65 -60
- package/esm/commands/sync/sync.d.ts.map +1 -1
- package/esm/commands/sync/sync.js +123 -149
- package/esm/commands/sync/sync.js.map +1 -1
- package/esm/commands/tcpip.d.ts +5 -5
- package/esm/commands/tcpip.d.ts.map +1 -1
- package/esm/commands/tcpip.js +20 -18
- package/esm/commands/tcpip.js.map +1 -1
- package/esm/{auth.d.ts → daemon/auth.d.ts} +50 -51
- package/esm/daemon/auth.d.ts.map +1 -0
- package/esm/{auth.js → daemon/auth.js} +95 -96
- package/esm/daemon/auth.js.map +1 -0
- package/esm/daemon/connection.d.ts +11 -0
- package/esm/daemon/connection.d.ts.map +1 -0
- package/esm/daemon/connection.js +2 -0
- package/esm/daemon/connection.js.map +1 -0
- package/esm/{crypto.d.ts → daemon/crypto.d.ts} +36 -36
- package/esm/daemon/crypto.d.ts.map +1 -0
- package/esm/{crypto.js → daemon/crypto.js} +244 -248
- package/esm/daemon/crypto.js.map +1 -0
- package/esm/daemon/device.d.ts +9 -0
- package/esm/daemon/device.d.ts.map +1 -0
- package/esm/daemon/device.js +2 -0
- package/esm/daemon/device.js.map +1 -0
- package/esm/daemon/dispatcher.d.ts +42 -0
- package/esm/daemon/dispatcher.d.ts.map +1 -0
- package/esm/{socket → daemon}/dispatcher.js +225 -234
- package/esm/daemon/dispatcher.js.map +1 -0
- package/esm/daemon/index.d.ts +8 -0
- package/esm/daemon/index.d.ts.map +1 -0
- package/esm/daemon/index.js +8 -0
- package/esm/daemon/index.js.map +1 -0
- package/esm/{packet.d.ts → daemon/packet.d.ts} +45 -46
- package/esm/daemon/packet.d.ts.map +1 -0
- package/esm/{packet.js → daemon/packet.js} +43 -48
- package/esm/daemon/packet.js.map +1 -0
- package/esm/daemon/socket.d.ts +58 -0
- package/esm/daemon/socket.d.ts.map +1 -0
- package/esm/{socket → daemon}/socket.js +121 -118
- package/esm/daemon/socket.js.map +1 -0
- package/esm/daemon/transport.d.ts +45 -0
- package/esm/daemon/transport.d.ts.map +1 -0
- package/esm/daemon/transport.js +184 -0
- package/esm/daemon/transport.js.map +1 -0
- package/esm/features.d.ts +10 -7
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +13 -10
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +7 -9
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +7 -9
- package/esm/index.js.map +1 -1
- package/esm/server/client.d.ts +78 -0
- package/esm/server/client.d.ts.map +1 -0
- package/esm/server/client.js +329 -0
- package/esm/server/client.js.map +1 -0
- package/esm/server/index.d.ts +3 -0
- package/esm/server/index.d.ts.map +1 -0
- package/esm/server/index.js +3 -0
- package/esm/server/index.js.map +1 -0
- package/esm/server/transport.d.ts +19 -0
- package/esm/server/transport.d.ts.map +1 -0
- package/esm/server/transport.js +44 -0
- package/esm/server/transport.js.map +1 -0
- package/esm/utils/auto-reset-event.d.ts +8 -9
- package/esm/utils/auto-reset-event.d.ts.map +1 -1
- package/esm/utils/auto-reset-event.js +33 -33
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +27 -27
- package/esm/utils/base64.js +246 -246
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/conditional-variable.d.ts +8 -0
- package/esm/utils/conditional-variable.d.ts.map +1 -0
- package/esm/utils/conditional-variable.js +34 -0
- package/esm/utils/conditional-variable.js.map +1 -0
- package/esm/utils/hex.d.ts +3 -0
- package/esm/utils/hex.d.ts.map +1 -0
- package/esm/utils/hex.js +55 -0
- package/esm/utils/hex.js.map +1 -0
- package/esm/utils/index.d.ts +6 -3
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +6 -3
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/no-op.d.ts +7 -0
- package/esm/utils/no-op.d.ts.map +1 -0
- package/esm/utils/no-op.js +12 -0
- package/esm/utils/no-op.js.map +1 -0
- package/package.json +14 -12
- package/src/adb.ts +47 -248
- package/src/banner.ts +82 -0
- package/src/commands/base.ts +1 -1
- package/src/commands/framebuffer.ts +4 -4
- package/src/commands/index.ts +7 -8
- package/src/commands/power.ts +2 -2
- package/src/commands/reverse.ts +90 -70
- package/src/commands/subprocess/command.ts +12 -4
- package/src/commands/subprocess/index.ts +3 -3
- package/src/commands/subprocess/protocols/index.ts +3 -3
- package/src/commands/subprocess/protocols/none.ts +36 -23
- package/src/commands/subprocess/protocols/shell.ts +94 -74
- package/src/commands/subprocess/protocols/types.ts +7 -7
- package/src/commands/subprocess/utils.ts +1 -1
- package/src/commands/sync/index.ts +8 -7
- package/src/commands/sync/list.ts +44 -25
- package/src/commands/sync/pull.ts +40 -45
- package/src/commands/sync/push.ts +158 -39
- package/src/commands/sync/request.ts +21 -16
- package/src/commands/sync/response.ts +10 -9
- package/src/commands/sync/socket.ts +99 -0
- package/src/commands/sync/stat.ts +47 -42
- package/src/commands/sync/sync.ts +73 -116
- package/src/commands/tcpip.ts +9 -7
- package/src/{auth.ts → daemon/auth.ts} +24 -23
- package/src/{crypto.ts → daemon/crypto.ts} +25 -33
- package/src/daemon/device.ts +14 -0
- package/src/{socket → daemon}/dispatcher.ts +95 -117
- package/src/daemon/index.ts +7 -0
- package/src/daemon/packet.ts +75 -0
- package/src/{socket → daemon}/socket.ts +71 -56
- package/src/daemon/transport.ts +269 -0
- package/src/features.ts +9 -6
- package/src/index.ts +3 -5
- package/src/server/client.ts +476 -0
- package/src/server/index.ts +2 -0
- package/src/server/transport.ts +77 -0
- package/src/utils/auto-reset-event.ts +14 -15
- package/src/utils/conditional-variable.ts +45 -0
- package/src/utils/hex.ts +58 -0
- package/src/utils/index.ts +6 -3
- package/src/utils/no-op.ts +12 -0
- package/tsconfig.build.json +12 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/auth.d.ts.map +0 -1
- package/esm/auth.js.map +0 -1
- package/esm/backend.d.ts +0 -9
- package/esm/backend.d.ts.map +0 -1
- package/esm/backend.js +0 -2
- package/esm/backend.js.map +0 -1
- package/esm/commands/install.d.ts +0 -4
- package/esm/commands/install.d.ts.map +0 -1
- package/esm/commands/install.js +0 -29
- package/esm/commands/install.js.map +0 -1
- package/esm/crypto.d.ts.map +0 -1
- package/esm/crypto.js.map +0 -1
- package/esm/packet.d.ts.map +0 -1
- package/esm/packet.js.map +0 -1
- package/esm/socket/dispatcher.d.ts +0 -60
- package/esm/socket/dispatcher.d.ts.map +0 -1
- package/esm/socket/dispatcher.js.map +0 -1
- package/esm/socket/index.d.ts +0 -3
- package/esm/socket/index.d.ts.map +0 -1
- package/esm/socket/index.js +0 -3
- package/esm/socket/index.js.map +0 -1
- package/esm/socket/socket.d.ts +0 -60
- package/esm/socket/socket.d.ts.map +0 -1
- package/esm/socket/socket.js.map +0 -1
- package/src/backend.ts +0 -14
- package/src/commands/install.ts +0 -40
- package/src/packet.ts +0 -90
- package/src/socket/index.ts +0 -2
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
export declare enum AdbShellProtocolId {
|
|
6
|
-
Stdin = 0,
|
|
7
|
-
Stdout = 1,
|
|
8
|
-
Stderr = 2,
|
|
9
|
-
Exit = 3,
|
|
10
|
-
CloseStdin = 4,
|
|
11
|
-
WindowSizeChange = 5
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Shell v2 a.k.a Shell Protocol
|
|
15
|
-
*
|
|
16
|
-
* Features:
|
|
17
|
-
* * `stderr`: Yes
|
|
18
|
-
* * `exit` exit code: Yes
|
|
19
|
-
* * `resize`: Yes
|
|
20
|
-
*/
|
|
21
|
-
export declare class AdbSubprocessShellProtocol implements AdbSubprocessProtocol {
|
|
22
|
-
|
|
23
|
-
static
|
|
24
|
-
static
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
get
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
get exit(): Promise<number>;
|
|
35
|
-
constructor(socket: AdbSocket);
|
|
36
|
-
resize(rows: number, cols: number): Promise<void>;
|
|
37
|
-
kill(): Promise<void>;
|
|
38
|
-
}
|
|
1
|
+
import type { Consumable, ReadableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import { WritableStream } from "@yume-chan/stream-extra";
|
|
3
|
+
import type { Adb, AdbSocket } from "../../../adb.js";
|
|
4
|
+
import type { AdbSubprocessProtocol } from "./types.js";
|
|
5
|
+
export declare enum AdbShellProtocolId {
|
|
6
|
+
Stdin = 0,
|
|
7
|
+
Stdout = 1,
|
|
8
|
+
Stderr = 2,
|
|
9
|
+
Exit = 3,
|
|
10
|
+
CloseStdin = 4,
|
|
11
|
+
WindowSizeChange = 5
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Shell v2 a.k.a Shell Protocol
|
|
15
|
+
*
|
|
16
|
+
* Features:
|
|
17
|
+
* * `stderr`: Yes
|
|
18
|
+
* * `exit` exit code: Yes
|
|
19
|
+
* * `resize`: Yes
|
|
20
|
+
*/
|
|
21
|
+
export declare class AdbSubprocessShellProtocol implements AdbSubprocessProtocol {
|
|
22
|
+
#private;
|
|
23
|
+
static isSupported(adb: Adb): boolean;
|
|
24
|
+
static pty(adb: Adb, command: string): Promise<AdbSubprocessShellProtocol>;
|
|
25
|
+
static raw(adb: Adb, command: string): Promise<AdbSubprocessShellProtocol>;
|
|
26
|
+
get stdin(): WritableStream<Consumable<Uint8Array>>;
|
|
27
|
+
get stdout(): ReadableStream<Uint8Array>;
|
|
28
|
+
get stderr(): ReadableStream<Uint8Array>;
|
|
29
|
+
get exit(): Promise<number>;
|
|
30
|
+
constructor(socket: AdbSocket);
|
|
31
|
+
resize(rows: number, cols: number): Promise<void>;
|
|
32
|
+
kill(): import("@yume-chan/struct").ValueOrPromise<void>;
|
|
33
|
+
}
|
|
39
34
|
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/shell.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/shell.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,UAAU,EAEV,cAAc,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAKH,cAAc,EAEjB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAItD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,oBAAY,kBAAkB;IAC1B,KAAK,IAAA;IACL,MAAM,IAAA;IACN,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,UAAU,IAAA;IACV,gBAAgB,IAAA;CACnB;AAsED;;;;;;;GAOG;AACH,qBAAa,0BAA2B,YAAW,qBAAqB;;WACtD,WAAW,CAAC,GAAG,EAAE,GAAG;WAId,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;WAO7B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;IAYjD,IAAW,KAAK,2CAEf;IAGD,IAAW,MAAM,+BAEhB;IAGD,IAAW,MAAM,+BAEhB;IAGD,IAAW,IAAI,oBAEd;gBAEkB,MAAM,EAAE,SAAS;IA2EvB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAYvC,IAAI;CAGd"}
|
|
@@ -1,163 +1,173 @@
|
|
|
1
|
-
import { PromiseResolver } from
|
|
2
|
-
import {
|
|
3
|
-
import Struct, { placeholder } from
|
|
4
|
-
import {
|
|
5
|
-
import { encodeUtf8 } from
|
|
6
|
-
export var AdbShellProtocolId;
|
|
7
|
-
(function (AdbShellProtocolId) {
|
|
8
|
-
AdbShellProtocolId[AdbShellProtocolId["Stdin"] = 0] = "Stdin";
|
|
9
|
-
AdbShellProtocolId[AdbShellProtocolId["Stdout"] = 1] = "Stdout";
|
|
10
|
-
AdbShellProtocolId[AdbShellProtocolId["Stderr"] = 2] = "Stderr";
|
|
11
|
-
AdbShellProtocolId[AdbShellProtocolId["Exit"] = 3] = "Exit";
|
|
12
|
-
AdbShellProtocolId[AdbShellProtocolId["CloseStdin"] = 4] = "CloseStdin";
|
|
13
|
-
AdbShellProtocolId[AdbShellProtocolId["WindowSizeChange"] = 5] = "WindowSizeChange";
|
|
14
|
-
})(AdbShellProtocolId = AdbShellProtocolId || (AdbShellProtocolId = {}));
|
|
15
|
-
// This packet format is used in both direction.
|
|
16
|
-
const AdbShellProtocolPacket = new Struct({ littleEndian: true })
|
|
17
|
-
.uint8(
|
|
18
|
-
.uint32(
|
|
19
|
-
.uint8Array(
|
|
20
|
-
class StdinSerializeStream extends
|
|
21
|
-
constructor() {
|
|
22
|
-
super({
|
|
23
|
-
transform(chunk, controller) {
|
|
24
|
-
controller.enqueue({
|
|
25
|
-
id: AdbShellProtocolId.Stdin,
|
|
26
|
-
data: chunk,
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
flush() {
|
|
30
|
-
// TODO: AdbShellSubprocessProtocol: support closing stdin
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
class
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
1
|
+
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
+
import { ConsumableTransformStream, ConsumableWritableStream, PushReadableStream, StructDeserializeStream, WritableStream, pipeFrom, } from "@yume-chan/stream-extra";
|
|
3
|
+
import Struct, { placeholder } from "@yume-chan/struct";
|
|
4
|
+
import { AdbFeature } from "../../../features.js";
|
|
5
|
+
import { encodeUtf8 } from "../../../utils/index.js";
|
|
6
|
+
export var AdbShellProtocolId;
|
|
7
|
+
(function (AdbShellProtocolId) {
|
|
8
|
+
AdbShellProtocolId[AdbShellProtocolId["Stdin"] = 0] = "Stdin";
|
|
9
|
+
AdbShellProtocolId[AdbShellProtocolId["Stdout"] = 1] = "Stdout";
|
|
10
|
+
AdbShellProtocolId[AdbShellProtocolId["Stderr"] = 2] = "Stderr";
|
|
11
|
+
AdbShellProtocolId[AdbShellProtocolId["Exit"] = 3] = "Exit";
|
|
12
|
+
AdbShellProtocolId[AdbShellProtocolId["CloseStdin"] = 4] = "CloseStdin";
|
|
13
|
+
AdbShellProtocolId[AdbShellProtocolId["WindowSizeChange"] = 5] = "WindowSizeChange";
|
|
14
|
+
})(AdbShellProtocolId = AdbShellProtocolId || (AdbShellProtocolId = {}));
|
|
15
|
+
// This packet format is used in both direction.
|
|
16
|
+
const AdbShellProtocolPacket = new Struct({ littleEndian: true })
|
|
17
|
+
.uint8("id", placeholder())
|
|
18
|
+
.uint32("length")
|
|
19
|
+
.uint8Array("data", { lengthField: "length" });
|
|
20
|
+
class StdinSerializeStream extends ConsumableTransformStream {
|
|
21
|
+
constructor() {
|
|
22
|
+
super({
|
|
23
|
+
async transform(chunk, controller) {
|
|
24
|
+
await controller.enqueue({
|
|
25
|
+
id: AdbShellProtocolId.Stdin,
|
|
26
|
+
data: chunk,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
flush() {
|
|
30
|
+
// TODO: AdbShellSubprocessProtocol: support closing stdin
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class MultiplexStream {
|
|
36
|
+
_readable;
|
|
37
|
+
_readableController;
|
|
38
|
+
get readable() {
|
|
39
|
+
return this._readable;
|
|
40
|
+
}
|
|
41
|
+
_activeCount = 0;
|
|
42
|
+
constructor() {
|
|
43
|
+
this._readable = new PushReadableStream((controller) => {
|
|
44
|
+
this._readableController = controller;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
createWriteable() {
|
|
48
|
+
return new WritableStream({
|
|
49
|
+
start: () => {
|
|
50
|
+
this._activeCount += 1;
|
|
51
|
+
},
|
|
52
|
+
write: async (chunk) => {
|
|
53
|
+
await this._readableController.enqueue(chunk);
|
|
54
|
+
},
|
|
55
|
+
abort: () => {
|
|
56
|
+
this._activeCount -= 1;
|
|
57
|
+
if (this._activeCount === 0) {
|
|
58
|
+
this._readableController.close();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
close: () => {
|
|
62
|
+
this._activeCount -= 1;
|
|
63
|
+
if (this._activeCount === 0) {
|
|
64
|
+
this._readableController.close();
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Shell v2 a.k.a Shell Protocol
|
|
72
|
+
*
|
|
73
|
+
* Features:
|
|
74
|
+
* * `stderr`: Yes
|
|
75
|
+
* * `exit` exit code: Yes
|
|
76
|
+
* * `resize`: Yes
|
|
77
|
+
*/
|
|
78
|
+
export class AdbSubprocessShellProtocol {
|
|
79
|
+
static isSupported(adb) {
|
|
80
|
+
return adb.supportsFeature(AdbFeature.ShellV2);
|
|
81
|
+
}
|
|
82
|
+
static async pty(adb, command) {
|
|
83
|
+
// TODO: AdbShellSubprocessProtocol: Support setting `XTERM` environment variable
|
|
84
|
+
return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,pty:${command}`));
|
|
85
|
+
}
|
|
86
|
+
static async raw(adb, command) {
|
|
87
|
+
return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,raw:${command}`));
|
|
88
|
+
}
|
|
89
|
+
#socket;
|
|
90
|
+
#socketWriter;
|
|
91
|
+
#stdin;
|
|
92
|
+
get stdin() {
|
|
93
|
+
return this.#stdin;
|
|
94
|
+
}
|
|
95
|
+
#stdout;
|
|
96
|
+
get stdout() {
|
|
97
|
+
return this.#stdout;
|
|
98
|
+
}
|
|
99
|
+
#stderr;
|
|
100
|
+
get stderr() {
|
|
101
|
+
return this.#stderr;
|
|
102
|
+
}
|
|
103
|
+
#exit = new PromiseResolver();
|
|
104
|
+
get exit() {
|
|
105
|
+
return this.#exit.promise;
|
|
106
|
+
}
|
|
107
|
+
constructor(socket) {
|
|
108
|
+
this.#socket = socket;
|
|
109
|
+
// Check this image to help you understand the stream graph
|
|
110
|
+
// cspell: disable-next-line
|
|
111
|
+
// https://www.plantuml.com/plantuml/png/bL91QiCm4Bpx5SAdv90lb1JISmiw5XzaQKf5PIkiLZIqzEyLSg8ks13gYtOykpFhiOw93N6UGjVDqK7rZsxKqNw0U_NTgVAy4empOy2mm4_olC0VEVEE47GUpnGjKdgXoD76q4GIEpyFhOwP_m28hW0NNzxNUig1_JdW0bA7muFIJDco1daJ_1SAX9bgvoPJPyIkSekhNYctvIGXrCH6tIsPL5fs-s6J5yc9BpWXhKtNdF2LgVYPGM_6GlMwfhWUsIt4lbScANrwlgVVUifPSVi__t44qStnwPvZwobdSmHHlL57p2vFuHS0
|
|
112
|
+
let stdoutController;
|
|
113
|
+
let stderrController;
|
|
114
|
+
this.#stdout = new PushReadableStream((controller) => {
|
|
115
|
+
stdoutController = controller;
|
|
116
|
+
});
|
|
117
|
+
this.#stderr = new PushReadableStream((controller) => {
|
|
118
|
+
stderrController = controller;
|
|
119
|
+
});
|
|
120
|
+
socket.readable
|
|
121
|
+
.pipeThrough(new StructDeserializeStream(AdbShellProtocolPacket))
|
|
122
|
+
.pipeTo(new WritableStream({
|
|
123
|
+
write: async (chunk) => {
|
|
124
|
+
switch (chunk.id) {
|
|
125
|
+
case AdbShellProtocolId.Exit:
|
|
126
|
+
this.#exit.resolve(chunk.data[0]);
|
|
127
|
+
break;
|
|
128
|
+
case AdbShellProtocolId.Stdout:
|
|
129
|
+
await stdoutController.enqueue(chunk.data);
|
|
130
|
+
break;
|
|
131
|
+
case AdbShellProtocolId.Stderr:
|
|
132
|
+
await stderrController.enqueue(chunk.data);
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
}))
|
|
137
|
+
.then(() => {
|
|
138
|
+
stdoutController.close();
|
|
139
|
+
stderrController.close();
|
|
140
|
+
// If `#exit` has already resolved, this will be a no-op
|
|
141
|
+
this.#exit.reject(new Error("Socket ended without exit message"));
|
|
142
|
+
}, (e) => {
|
|
143
|
+
stdoutController.error(e);
|
|
144
|
+
stderrController.error(e);
|
|
145
|
+
// If `#exit` has already resolved, this will be a no-op
|
|
146
|
+
this.#exit.reject(e);
|
|
147
|
+
});
|
|
148
|
+
const multiplexer = new MultiplexStream();
|
|
149
|
+
void multiplexer.readable
|
|
150
|
+
.pipeThrough(new ConsumableTransformStream({
|
|
151
|
+
async transform(chunk, controller) {
|
|
152
|
+
await controller.enqueue(AdbShellProtocolPacket.serialize(chunk));
|
|
153
|
+
},
|
|
154
|
+
}))
|
|
155
|
+
.pipeTo(socket.writable);
|
|
156
|
+
this.#stdin = pipeFrom(multiplexer.createWriteable(), new StdinSerializeStream());
|
|
157
|
+
this.#socketWriter = multiplexer.createWriteable().getWriter();
|
|
158
|
+
}
|
|
159
|
+
async resize(rows, cols) {
|
|
160
|
+
await ConsumableWritableStream.write(this.#socketWriter, {
|
|
161
|
+
id: AdbShellProtocolId.WindowSizeChange,
|
|
162
|
+
data: encodeUtf8(
|
|
163
|
+
// The "correct" format is `${rows}x${cols},${x_pixels}x${y_pixels}`
|
|
164
|
+
// However, according to https://linux.die.net/man/4/tty_ioctl
|
|
165
|
+
// `x_pixels` and `y_pixels` are unused, so always sending `0` should be fine.
|
|
166
|
+
`${rows}x${cols},0x0\0`),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
kill() {
|
|
170
|
+
return this.#socket.close();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
163
173
|
//# sourceMappingURL=shell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOnD,OAAO,EACH,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,QAAQ,GACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC1B,6DAAK,CAAA;IACL,+DAAM,CAAA;IACN,+DAAM,CAAA;IACN,2DAAI,CAAA;IACJ,uEAAU,CAAA;IACV,mFAAgB,CAAA;AACpB,CAAC,EAPW,kBAAkB,GAAlB,kBAAkB,KAAlB,kBAAkB,QAO7B;AAED,gDAAgD;AAChD,MAAM,sBAAsB,GAAG,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KAC5D,KAAK,CAAC,IAAI,EAAE,WAAW,EAAsB,CAAC;KAC9C,MAAM,CAAC,QAAQ,CAAC;KAChB,UAAU,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;AAMnD,MAAM,oBAAqB,SAAQ,yBAGlC;IACG;QACI,KAAK,CAAC;YACF,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU;gBAC7B,MAAM,UAAU,CAAC,OAAO,CAAC;oBACrB,EAA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
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
1
|
+
import type { Consumable, ReadableStream, WritableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import type { ValueOrPromise } from "@yume-chan/struct";
|
|
3
|
+
import type { Adb, AdbSocket } from "../../../adb.js";
|
|
4
|
+
export interface AdbSubprocessProtocol {
|
|
5
|
+
/**
|
|
6
|
+
* A WritableStream that writes to the `stdin` stream.
|
|
7
|
+
*/
|
|
8
|
+
readonly stdin: WritableStream<Consumable<Uint8Array>>;
|
|
9
|
+
/**
|
|
10
|
+
* The `stdout` stream of the process.
|
|
11
|
+
*/
|
|
12
|
+
readonly stdout: ReadableStream<Uint8Array>;
|
|
13
|
+
/**
|
|
14
|
+
* The `stderr` stream of the process.
|
|
15
|
+
*
|
|
16
|
+
* Note: Some `AdbSubprocessProtocol` doesn't separate `stdout` and `stderr`,
|
|
17
|
+
* All output will be sent to `stdout`.
|
|
18
|
+
*/
|
|
19
|
+
readonly stderr: ReadableStream<Uint8Array>;
|
|
20
|
+
/**
|
|
21
|
+
* A `Promise` that resolves to the exit code of the process.
|
|
22
|
+
*
|
|
23
|
+
* Note: Some `AdbSubprocessProtocol` doesn't support exit code,
|
|
24
|
+
* They will always resolve it with `0`.
|
|
25
|
+
*/
|
|
26
|
+
readonly exit: Promise<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Resizes the current shell.
|
|
29
|
+
*
|
|
30
|
+
* Some `AdbSubprocessProtocol`s may not support resizing
|
|
31
|
+
* and will ignore calls to this method.
|
|
32
|
+
*/
|
|
33
|
+
resize(rows: number, cols: number): ValueOrPromise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Kills the current process.
|
|
36
|
+
*/
|
|
37
|
+
kill(): ValueOrPromise<void>;
|
|
38
|
+
}
|
|
39
|
+
export interface AdbSubprocessProtocolConstructor {
|
|
40
|
+
/** Returns `true` if the `adb` instance supports this shell */
|
|
41
|
+
isSupported(adb: Adb): ValueOrPromise<boolean>;
|
|
42
|
+
/** Spawns an executable in PTY (interactive) mode. */
|
|
43
|
+
pty(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
|
|
44
|
+
/** Spawns an executable and pipe the output. */
|
|
45
|
+
raw(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
|
|
46
|
+
/** Creates a new `AdbShell` by attaching to an exist `AdbSocket` */
|
|
47
|
+
new (socket: AdbSocket): AdbSubprocessProtocol;
|
|
48
|
+
}
|
|
50
49
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/types.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,UAAU,EACV,cAAc,EACd,cAAc,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAEvD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/B;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,IAAI,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,gCAAgC;IAC7C,+DAA+D;IAC/D,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE/C,sDAAsD;IACtD,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAEtE,gDAAgD;IAChD,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAEtE,oEAAoE;IACpE,KAAK,MAAM,EAAE,SAAS,GAAG,qBAAqB,CAAC;CAClD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function escapeArg(s: string): string;
|
|
1
|
+
export declare function escapeArg(s: string): string;
|
|
2
2
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export function escapeArg(s) {
|
|
2
|
-
let result =
|
|
3
|
-
result += `'`;
|
|
4
|
-
let base = 0;
|
|
5
|
-
while (true) {
|
|
6
|
-
const found = s.indexOf(`'`, base);
|
|
7
|
-
if (found === -1) {
|
|
8
|
-
result += s.substring(base);
|
|
9
|
-
break;
|
|
10
|
-
}
|
|
11
|
-
result += s.substring(base, found);
|
|
12
|
-
// a'b becomes a'\'b
|
|
13
|
-
result += String.raw `'\''`;
|
|
14
|
-
base = found + 1;
|
|
15
|
-
}
|
|
16
|
-
result += `'`;
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
1
|
+
export function escapeArg(s) {
|
|
2
|
+
let result = "";
|
|
3
|
+
result += `'`;
|
|
4
|
+
let base = 0;
|
|
5
|
+
while (true) {
|
|
6
|
+
const found = s.indexOf(`'`, base);
|
|
7
|
+
if (found === -1) {
|
|
8
|
+
result += s.substring(base);
|
|
9
|
+
break;
|
|
10
|
+
}
|
|
11
|
+
result += s.substring(base, found);
|
|
12
|
+
// a'b becomes a'\'b
|
|
13
|
+
result += String.raw `'\''`;
|
|
14
|
+
base = found + 1;
|
|
15
|
+
}
|
|
16
|
+
result += `'`;
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
19
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
1
|
+
export * from "./list.js";
|
|
2
|
+
export * from "./pull.js";
|
|
3
|
+
export * from "./push.js";
|
|
4
|
+
export * from "./request.js";
|
|
5
|
+
export * from "./response.js";
|
|
6
|
+
export * from "./socket.js";
|
|
7
|
+
export * from "./stat.js";
|
|
8
|
+
export * from "./sync.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|