@tapflowio/ios-agent 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +32 -0
- package/bin/keyboard-helper +0 -0
- package/bin/rotation-helper +0 -0
- package/bin/screencapture-helper +0 -0
- package/bin/touch-helper +0 -0
- package/dist/DeviceChromeLoader.d.ts +49 -0
- package/dist/DeviceChromeLoader.d.ts.map +1 -0
- package/dist/DeviceChromeLoader.js +680 -0
- package/dist/DeviceChromeLoader.js.map +1 -0
- package/dist/IOSAgent.d.ts +46 -0
- package/dist/IOSAgent.d.ts.map +1 -0
- package/dist/IOSAgent.js +478 -0
- package/dist/IOSAgent.js.map +1 -0
- package/dist/KeyCodeMap.d.ts +3 -0
- package/dist/KeyCodeMap.d.ts.map +1 -0
- package/dist/KeyCodeMap.js +42 -0
- package/dist/KeyCodeMap.js.map +1 -0
- package/dist/KeyboardHelperDaemon.d.ts +13 -0
- package/dist/KeyboardHelperDaemon.d.ts.map +1 -0
- package/dist/KeyboardHelperDaemon.js +96 -0
- package/dist/KeyboardHelperDaemon.js.map +1 -0
- package/dist/MjpegStreamer.d.ts +10 -0
- package/dist/MjpegStreamer.d.ts.map +1 -0
- package/dist/MjpegStreamer.js +40 -0
- package/dist/MjpegStreamer.js.map +1 -0
- package/dist/ScreenCaptureStreamer.d.ts +7 -0
- package/dist/ScreenCaptureStreamer.d.ts.map +1 -0
- package/dist/ScreenCaptureStreamer.js +92 -0
- package/dist/ScreenCaptureStreamer.js.map +1 -0
- package/dist/SimctlWrapper.d.ts +21 -0
- package/dist/SimctlWrapper.d.ts.map +1 -0
- package/dist/SimctlWrapper.js +154 -0
- package/dist/SimctlWrapper.js.map +1 -0
- package/dist/TouchHelper.d.ts +21 -0
- package/dist/TouchHelper.d.ts.map +1 -0
- package/dist/TouchHelper.js +110 -0
- package/dist/TouchHelper.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/simctl.d.ts +6 -0
- package/dist/simctl.d.ts.map +1 -0
- package/dist/simctl.js +64 -0
- package/dist/simctl.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { createLogger } from '@tapflowio/agent-core';
|
|
4
|
+
const logger = createLogger('ios-agent:touch-helper');
|
|
5
|
+
const BINARY = join(import.meta.dirname, '..', 'bin', 'touch-helper');
|
|
6
|
+
export class TouchHelper {
|
|
7
|
+
udid;
|
|
8
|
+
proc = null;
|
|
9
|
+
lastX = 0;
|
|
10
|
+
lastY = 0;
|
|
11
|
+
constructor(udid) {
|
|
12
|
+
this.udid = udid;
|
|
13
|
+
}
|
|
14
|
+
start() {
|
|
15
|
+
const bin = BINARY;
|
|
16
|
+
this.proc = spawn(bin, [this.udid], { stdio: ['pipe', 'ignore', 'pipe'] });
|
|
17
|
+
this.proc.stderr?.on('data', (d) => {
|
|
18
|
+
const msg = d.toString().trim();
|
|
19
|
+
// print all lines, even debug: lines, until we're confident it's working
|
|
20
|
+
logger.error(msg);
|
|
21
|
+
});
|
|
22
|
+
this.proc.on('exit', (code) => {
|
|
23
|
+
logger.error(`exited with code ${code ?? 'null'}`);
|
|
24
|
+
});
|
|
25
|
+
this.proc.on('error', (e) => {
|
|
26
|
+
logger.error(`spawn error: ${e.message}`);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
stop() {
|
|
30
|
+
this.proc?.kill();
|
|
31
|
+
this.proc = null;
|
|
32
|
+
}
|
|
33
|
+
touchStart(x, y) {
|
|
34
|
+
this.lastX = x;
|
|
35
|
+
this.lastY = y;
|
|
36
|
+
this.write(1, x, y);
|
|
37
|
+
}
|
|
38
|
+
touchMove(x, y) {
|
|
39
|
+
this.lastX = x;
|
|
40
|
+
this.lastY = y;
|
|
41
|
+
this.write(2, x, y);
|
|
42
|
+
}
|
|
43
|
+
touchEnd() {
|
|
44
|
+
this.write(3, this.lastX, this.lastY);
|
|
45
|
+
}
|
|
46
|
+
pressButton(usagePage, usage) {
|
|
47
|
+
if (!this.proc?.stdin?.writable)
|
|
48
|
+
return;
|
|
49
|
+
const buf = Buffer.allocUnsafe(9);
|
|
50
|
+
buf.writeUInt8(4, 0);
|
|
51
|
+
buf.writeUInt32BE(usagePage, 1);
|
|
52
|
+
buf.writeUInt32BE(usage, 5);
|
|
53
|
+
this.proc.stdin.write(buf);
|
|
54
|
+
}
|
|
55
|
+
// Legacy path for home (code=0) and lock (code=1) buttons
|
|
56
|
+
pressLegacyButton(code) {
|
|
57
|
+
if (!this.proc?.stdin?.writable)
|
|
58
|
+
return;
|
|
59
|
+
const buf = Buffer.allocUnsafe(9);
|
|
60
|
+
buf.writeUInt8(5, 0);
|
|
61
|
+
buf.writeUInt32BE(code, 1);
|
|
62
|
+
buf.writeUInt32BE(0, 5);
|
|
63
|
+
this.proc.stdin.write(buf);
|
|
64
|
+
}
|
|
65
|
+
pinchStart(x1, y1, x2, y2) {
|
|
66
|
+
this.writeTwoFinger(6, x1, y1, x2, y2);
|
|
67
|
+
}
|
|
68
|
+
pinchMove(x1, y1, x2, y2) {
|
|
69
|
+
this.writeTwoFinger(7, x1, y1, x2, y2);
|
|
70
|
+
}
|
|
71
|
+
pinchEnd() {
|
|
72
|
+
this.writeTwoFinger(8, 0, 0, 0, 0);
|
|
73
|
+
}
|
|
74
|
+
// HID keyboard — type 9 frame: [9][modifiers][pad x3][usage:u32BE]
|
|
75
|
+
// modifiers: USB HID modifier bitmap (0x01=LeftCtrl, 0x02=LeftShift, 0x04=LeftAlt, 0x08=LeftMeta, …)
|
|
76
|
+
// usage: keyboard usage code from HID Keyboard/Keypad page (0x07)
|
|
77
|
+
sendKey(usage, modifiers = 0) {
|
|
78
|
+
if (!this.proc?.stdin?.writable)
|
|
79
|
+
return;
|
|
80
|
+
const buf = Buffer.allocUnsafe(9);
|
|
81
|
+
buf.writeUInt8(9, 0);
|
|
82
|
+
buf.writeUInt8(modifiers, 1);
|
|
83
|
+
buf.writeUInt8(0, 2);
|
|
84
|
+
buf.writeUInt8(0, 3);
|
|
85
|
+
buf.writeUInt8(0, 4);
|
|
86
|
+
buf.writeUInt32BE(usage, 5);
|
|
87
|
+
this.proc.stdin.write(buf);
|
|
88
|
+
}
|
|
89
|
+
writeTwoFinger(type, x1, y1, x2, y2) {
|
|
90
|
+
if (!this.proc?.stdin?.writable)
|
|
91
|
+
return;
|
|
92
|
+
const buf = Buffer.allocUnsafe(17);
|
|
93
|
+
buf.writeUInt8(type, 0);
|
|
94
|
+
buf.writeFloatBE(x1, 1);
|
|
95
|
+
buf.writeFloatBE(y1, 5);
|
|
96
|
+
buf.writeFloatBE(x2, 9);
|
|
97
|
+
buf.writeFloatBE(y2, 13);
|
|
98
|
+
this.proc.stdin.write(buf);
|
|
99
|
+
}
|
|
100
|
+
write(type, x, y) {
|
|
101
|
+
if (!this.proc?.stdin?.writable)
|
|
102
|
+
return;
|
|
103
|
+
const buf = Buffer.allocUnsafe(9);
|
|
104
|
+
buf.writeUInt8(type, 0);
|
|
105
|
+
buf.writeFloatBE(x, 1);
|
|
106
|
+
buf.writeFloatBE(y, 5);
|
|
107
|
+
this.proc.stdin.write(buf);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=TouchHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TouchHelper.js","sourceRoot":"","sources":["../src/TouchHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,MAAM,GAAG,YAAY,CAAC,wBAAwB,CAAC,CAAA;AAErD,MAAM,MAAM,GAA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2
|
+
export type { IOSAgentOptions } from './IOSAgent.js';
|
|
3
|
+
export { SimctlWrapper } from './SimctlWrapper.js';
|
|
4
|
+
export { MjpegStreamer } from './MjpegStreamer.js';
|
|
5
|
+
export { KEY_CODE_MAP, MODIFIER_BITS } from './KeyCodeMap.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/simctl.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simctl.d.ts","sourceRoot":"","sources":["../src/simctl.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACxC,UAAU,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAC/C;AAaD,eAAO,MAAM,aAAa,EAAE,YAiC3B,CAAA"}
|
package/dist/simctl.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { execFile } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { createLogger } from '@tapflowio/agent-core';
|
|
4
|
+
const logger = createLogger('ios-agent:simctl');
|
|
5
|
+
const execFileAsync = promisify(execFile);
|
|
6
|
+
function isCoreSimulatorVersionMismatch(err) {
|
|
7
|
+
const msg = err.stderr
|
|
8
|
+
?? err.message ?? '';
|
|
9
|
+
return msg.includes('CoreSimulator.framework was changed') ||
|
|
10
|
+
msg.includes('Service version') && msg.includes('does not match expected service version');
|
|
11
|
+
}
|
|
12
|
+
async function restartCoreSimulatorService() {
|
|
13
|
+
// SIGKILL (-9) guarantees the process dies even if it ignores SIGTERM
|
|
14
|
+
await execFileAsync('killall', ['-9', 'com.apple.CoreSimulator.CoreSimulatorService']).catch(() => { });
|
|
15
|
+
await new Promise((r) => setTimeout(r, 3000));
|
|
16
|
+
}
|
|
17
|
+
const CORE_SIM_DOCS_URL = 'https://tapflow.dev/guide/troubleshooting#ios-simulator-service-version-mismatch';
|
|
18
|
+
function coreSimServiceError() {
|
|
19
|
+
return new Error('CoreSimulatorService version mismatch — the service could not be recovered automatically.\n' +
|
|
20
|
+
'Run the following command and try again:\n\n' +
|
|
21
|
+
' killall -9 com.apple.CoreSimulator.CoreSimulatorService\n\n' +
|
|
22
|
+
`See ${CORE_SIM_DOCS_URL}`);
|
|
23
|
+
}
|
|
24
|
+
export const defaultRunner = {
|
|
25
|
+
async exec(...args) {
|
|
26
|
+
try {
|
|
27
|
+
const { stdout } = await execFileAsync('xcrun', ['simctl', ...args]);
|
|
28
|
+
return stdout;
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
if (!isCoreSimulatorVersionMismatch(err))
|
|
32
|
+
throw err;
|
|
33
|
+
logger.warn('CoreSimulatorService version mismatch — restarting service and retrying');
|
|
34
|
+
await restartCoreSimulatorService();
|
|
35
|
+
try {
|
|
36
|
+
const { stdout } = await execFileAsync('xcrun', ['simctl', ...args]);
|
|
37
|
+
return stdout;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
throw coreSimServiceError();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
async execBinary(...args) {
|
|
45
|
+
try {
|
|
46
|
+
const { stdout } = await execFileAsync('xcrun', ['simctl', ...args], { encoding: 'buffer' });
|
|
47
|
+
return stdout;
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
if (!isCoreSimulatorVersionMismatch(err))
|
|
51
|
+
throw err;
|
|
52
|
+
logger.warn('CoreSimulatorService version mismatch — restarting service and retrying');
|
|
53
|
+
await restartCoreSimulatorService();
|
|
54
|
+
try {
|
|
55
|
+
const { stdout } = await execFileAsync('xcrun', ['simctl', ...args], { encoding: 'buffer' });
|
|
56
|
+
return stdout;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
throw coreSimServiceError();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=simctl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simctl.js","sourceRoot":"","sources":["../src/simctl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,MAAM,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAA;AAE/C,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAEzC,SAAS,8BAA8B,CAAC,GAAY;IAClD,MAAM,GAAG,GAAI,GAA6C,CAAC,MAAM;WAC3D,GAA4B,CAAC,OAAO,IAAI,EAAE,CAAA;I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YAAC,MAAM,CAAC;gBACP,MAAM,mBAAmB,EAAE,CAAA;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,GAAG,IAAc;QAChC,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;YAC5F,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC;gBAAE,MAAM,GAAG,CAAA;YACnD,MAAM,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAA;YACtF,MAAM,2BAA2B,EAAE,CAAA;YACnC,IAAI,CAAC;gBACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;gBAC5F,OAAO,MAAM,CAAA;YACf,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,mBAAmB,EAAE,CAAA;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tapflowio/ios-agent",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "iOS simulator agent for tapflow — xcrun simctl control and screen streaming",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"tapflow",
|
|
7
|
+
"ios",
|
|
8
|
+
"simulator",
|
|
9
|
+
"xcrun",
|
|
10
|
+
"simctl",
|
|
11
|
+
"streaming",
|
|
12
|
+
"qa"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/jo-duchan/tapflow",
|
|
15
|
+
"bugs": "https://github.com/jo-duchan/tapflow/issues",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/jo-duchan/tapflow.git",
|
|
19
|
+
"directory": "packages/ios-agent"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "tapflow contributors",
|
|
23
|
+
"os": [
|
|
24
|
+
"darwin"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "dist/index.js",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"source": "./src/index.ts",
|
|
32
|
+
"tsx": "./src/index.ts",
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"bin",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=20"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"ws": "^8.0.0",
|
|
51
|
+
"@tapflowio/agent-core": "0.1.0-alpha.1"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^20.0.0",
|
|
55
|
+
"@types/ws": "^8.0.0",
|
|
56
|
+
"typescript": "^5.0.0",
|
|
57
|
+
"vitest": "^2.0.0",
|
|
58
|
+
"@tapflowio/relay": "0.1.0-alpha.1"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsc",
|
|
62
|
+
"typecheck": "tsc --noEmit",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"lint": "eslint src"
|
|
65
|
+
}
|
|
66
|
+
}
|