@godscene/shared 1.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +9 -0
  2. package/dist/es/baseDB.mjs +109 -0
  3. package/dist/es/cli/cli-args.mjs +95 -0
  4. package/dist/es/cli/cli-error.mjs +24 -0
  5. package/dist/es/cli/cli-runner.mjs +122 -0
  6. package/dist/es/cli/index.mjs +4 -0
  7. package/dist/es/common.mjs +37 -0
  8. package/dist/es/constants/example-code.mjs +227 -0
  9. package/dist/es/constants/index.mjs +124 -0
  10. package/dist/es/env/basic.mjs +6 -0
  11. package/dist/es/env/constants.mjs +110 -0
  12. package/dist/es/env/global-config-manager.mjs +94 -0
  13. package/dist/es/env/helper.mjs +43 -0
  14. package/dist/es/env/index.mjs +5 -0
  15. package/dist/es/env/init-debug.mjs +18 -0
  16. package/dist/es/env/model-config-manager.mjs +79 -0
  17. package/dist/es/env/parse-model-config.mjs +165 -0
  18. package/dist/es/env/types.mjs +232 -0
  19. package/dist/es/env/utils.mjs +18 -0
  20. package/dist/es/extractor/constants.mjs +2 -0
  21. package/dist/es/extractor/cs_postmessage.mjs +61 -0
  22. package/dist/es/extractor/customLocator.mjs +641 -0
  23. package/dist/es/extractor/debug.mjs +6 -0
  24. package/dist/es/extractor/dom-util.mjs +96 -0
  25. package/dist/es/extractor/index.mjs +5 -0
  26. package/dist/es/extractor/locator.mjs +250 -0
  27. package/dist/es/extractor/tree.mjs +78 -0
  28. package/dist/es/extractor/util.mjs +245 -0
  29. package/dist/es/extractor/web-extractor.mjs +393 -0
  30. package/dist/es/img/box-select.mjs +824 -0
  31. package/dist/es/img/canvas-fallback.mjs +238 -0
  32. package/dist/es/img/get-photon.mjs +45 -0
  33. package/dist/es/img/get-sharp.mjs +11 -0
  34. package/dist/es/img/index.mjs +4 -0
  35. package/dist/es/img/info.mjs +35 -0
  36. package/dist/es/img/transform.mjs +275 -0
  37. package/dist/es/index.mjs +2 -0
  38. package/dist/es/key-alias-utils.mjs +19 -0
  39. package/dist/es/logger.mjs +64 -0
  40. package/dist/es/mcp/base-server.mjs +282 -0
  41. package/dist/es/mcp/base-tools.mjs +159 -0
  42. package/dist/es/mcp/chrome-path.mjs +35 -0
  43. package/dist/es/mcp/cli-report-session.mjs +78 -0
  44. package/dist/es/mcp/error-formatter.mjs +19 -0
  45. package/dist/es/mcp/index.mjs +9 -0
  46. package/dist/es/mcp/init-arg-utils.mjs +38 -0
  47. package/dist/es/mcp/inject-report-html-plugin.mjs +53 -0
  48. package/dist/es/mcp/launcher-helper.mjs +52 -0
  49. package/dist/es/mcp/tool-generator.mjs +419 -0
  50. package/dist/es/mcp/types.mjs +3 -0
  51. package/dist/es/node/fs.mjs +44 -0
  52. package/dist/es/node/index.mjs +2 -0
  53. package/dist/es/node/port.mjs +24 -0
  54. package/dist/es/polyfills/async-hooks.mjs +2 -0
  55. package/dist/es/polyfills/index.mjs +1 -0
  56. package/dist/es/types/index.mjs +3 -0
  57. package/dist/es/us-keyboard-layout.mjs +1414 -0
  58. package/dist/es/us-keyboard-layout.mjs.LICENSE.txt +5 -0
  59. package/dist/es/utils.mjs +72 -0
  60. package/dist/es/zod-schema-utils.mjs +54 -0
  61. package/dist/lib/baseDB.js +149 -0
  62. package/dist/lib/cli/cli-args.js +138 -0
  63. package/dist/lib/cli/cli-error.js +61 -0
  64. package/dist/lib/cli/cli-runner.js +181 -0
  65. package/dist/lib/cli/index.js +53 -0
  66. package/dist/lib/common.js +93 -0
  67. package/dist/lib/constants/example-code.js +264 -0
  68. package/dist/lib/constants/index.js +221 -0
  69. package/dist/lib/env/basic.js +40 -0
  70. package/dist/lib/env/constants.js +153 -0
  71. package/dist/lib/env/global-config-manager.js +128 -0
  72. package/dist/lib/env/helper.js +80 -0
  73. package/dist/lib/env/index.js +90 -0
  74. package/dist/lib/env/init-debug.js +52 -0
  75. package/dist/lib/env/model-config-manager.js +113 -0
  76. package/dist/lib/env/parse-model-config.js +211 -0
  77. package/dist/lib/env/types.js +572 -0
  78. package/dist/lib/env/utils.js +61 -0
  79. package/dist/lib/extractor/constants.js +42 -0
  80. package/dist/lib/extractor/cs_postmessage.js +98 -0
  81. package/dist/lib/extractor/customLocator.js +693 -0
  82. package/dist/lib/extractor/debug.js +12 -0
  83. package/dist/lib/extractor/dom-util.js +157 -0
  84. package/dist/lib/extractor/index.js +87 -0
  85. package/dist/lib/extractor/locator.js +296 -0
  86. package/dist/lib/extractor/tree.js +124 -0
  87. package/dist/lib/extractor/util.js +336 -0
  88. package/dist/lib/extractor/web-extractor.js +442 -0
  89. package/dist/lib/img/box-select.js +875 -0
  90. package/dist/lib/img/canvas-fallback.js +305 -0
  91. package/dist/lib/img/get-photon.js +82 -0
  92. package/dist/lib/img/get-sharp.js +45 -0
  93. package/dist/lib/img/index.js +95 -0
  94. package/dist/lib/img/info.js +92 -0
  95. package/dist/lib/img/transform.js +364 -0
  96. package/dist/lib/index.js +36 -0
  97. package/dist/lib/key-alias-utils.js +62 -0
  98. package/dist/lib/logger.js +114 -0
  99. package/dist/lib/mcp/base-server.js +332 -0
  100. package/dist/lib/mcp/base-tools.js +193 -0
  101. package/dist/lib/mcp/chrome-path.js +72 -0
  102. package/dist/lib/mcp/cli-report-session.js +121 -0
  103. package/dist/lib/mcp/error-formatter.js +53 -0
  104. package/dist/lib/mcp/index.js +114 -0
  105. package/dist/lib/mcp/init-arg-utils.js +78 -0
  106. package/dist/lib/mcp/inject-report-html-plugin.js +98 -0
  107. package/dist/lib/mcp/launcher-helper.js +86 -0
  108. package/dist/lib/mcp/tool-generator.js +456 -0
  109. package/dist/lib/mcp/types.js +40 -0
  110. package/dist/lib/node/fs.js +97 -0
  111. package/dist/lib/node/index.js +65 -0
  112. package/dist/lib/node/port.js +61 -0
  113. package/dist/lib/polyfills/async-hooks.js +36 -0
  114. package/dist/lib/polyfills/index.js +58 -0
  115. package/dist/lib/types/index.js +37 -0
  116. package/dist/lib/us-keyboard-layout.js +1457 -0
  117. package/dist/lib/us-keyboard-layout.js.LICENSE.txt +5 -0
  118. package/dist/lib/utils.js +148 -0
  119. package/dist/lib/zod-schema-utils.js +97 -0
  120. package/dist/types/baseDB.d.ts +25 -0
  121. package/dist/types/cli/cli-args.d.ts +8 -0
  122. package/dist/types/cli/cli-error.d.ts +5 -0
  123. package/dist/types/cli/cli-runner.d.ts +19 -0
  124. package/dist/types/cli/index.d.ts +4 -0
  125. package/dist/types/common.d.ts +12 -0
  126. package/dist/types/constants/example-code.d.ts +2 -0
  127. package/dist/types/constants/index.d.ts +61 -0
  128. package/dist/types/env/basic.d.ts +6 -0
  129. package/dist/types/env/constants.d.ts +50 -0
  130. package/dist/types/env/global-config-manager.d.ts +32 -0
  131. package/dist/types/env/helper.d.ts +4 -0
  132. package/dist/types/env/index.d.ts +4 -0
  133. package/dist/types/env/init-debug.d.ts +1 -0
  134. package/dist/types/env/model-config-manager.d.ts +25 -0
  135. package/dist/types/env/parse-model-config.d.ts +31 -0
  136. package/dist/types/env/types.d.ts +339 -0
  137. package/dist/types/env/utils.d.ts +7 -0
  138. package/dist/types/extractor/constants.d.ts +1 -0
  139. package/dist/types/extractor/cs_postmessage.d.ts +2 -0
  140. package/dist/types/extractor/customLocator.d.ts +69 -0
  141. package/dist/types/extractor/debug.d.ts +1 -0
  142. package/dist/types/extractor/dom-util.d.ts +57 -0
  143. package/dist/types/extractor/index.d.ts +33 -0
  144. package/dist/types/extractor/locator.d.ts +9 -0
  145. package/dist/types/extractor/tree.d.ts +6 -0
  146. package/dist/types/extractor/util.d.ts +47 -0
  147. package/dist/types/extractor/web-extractor.d.ts +24 -0
  148. package/dist/types/img/box-select.d.ts +26 -0
  149. package/dist/types/img/canvas-fallback.d.ts +105 -0
  150. package/dist/types/img/get-photon.d.ts +19 -0
  151. package/dist/types/img/get-sharp.d.ts +3 -0
  152. package/dist/types/img/index.d.ts +3 -0
  153. package/dist/types/img/info.d.ts +34 -0
  154. package/dist/types/img/transform.d.ts +98 -0
  155. package/dist/types/index.d.ts +2 -0
  156. package/dist/types/key-alias-utils.d.ts +9 -0
  157. package/dist/types/logger.d.ts +5 -0
  158. package/dist/types/mcp/base-server.d.ts +93 -0
  159. package/dist/types/mcp/base-tools.d.ts +148 -0
  160. package/dist/types/mcp/chrome-path.d.ts +2 -0
  161. package/dist/types/mcp/cli-report-session.d.ts +12 -0
  162. package/dist/types/mcp/error-formatter.d.ts +12 -0
  163. package/dist/types/mcp/index.d.ts +9 -0
  164. package/dist/types/mcp/init-arg-utils.d.ts +13 -0
  165. package/dist/types/mcp/inject-report-html-plugin.d.ts +18 -0
  166. package/dist/types/mcp/launcher-helper.d.ts +94 -0
  167. package/dist/types/mcp/tool-generator.d.ts +10 -0
  168. package/dist/types/mcp/types.d.ts +113 -0
  169. package/dist/types/node/fs.d.ts +15 -0
  170. package/dist/types/node/index.d.ts +2 -0
  171. package/dist/types/node/port.d.ts +8 -0
  172. package/dist/types/polyfills/async-hooks.d.ts +6 -0
  173. package/dist/types/polyfills/index.d.ts +4 -0
  174. package/dist/types/types/index.d.ts +36 -0
  175. package/dist/types/us-keyboard-layout.d.ts +32 -0
  176. package/dist/types/utils.d.ts +34 -0
  177. package/dist/types/zod-schema-utils.d.ts +23 -0
  178. package/package.json +125 -0
  179. package/src/baseDB.ts +158 -0
  180. package/src/cli/cli-args.ts +173 -0
  181. package/src/cli/cli-error.ts +24 -0
  182. package/src/cli/cli-runner.ts +230 -0
  183. package/src/cli/index.ts +4 -0
  184. package/src/common.ts +67 -0
  185. package/src/constants/example-code.ts +227 -0
  186. package/src/constants/index.ts +139 -0
  187. package/src/env/basic.ts +12 -0
  188. package/src/env/constants.ts +303 -0
  189. package/src/env/global-config-manager.ts +191 -0
  190. package/src/env/helper.ts +58 -0
  191. package/src/env/index.ts +4 -0
  192. package/src/env/init-debug.ts +34 -0
  193. package/src/env/model-config-manager.ts +149 -0
  194. package/src/env/parse-model-config.ts +357 -0
  195. package/src/env/types.ts +583 -0
  196. package/src/env/utils.ts +39 -0
  197. package/src/extractor/constants.ts +5 -0
  198. package/src/extractor/cs_postmessage.ts +136 -0
  199. package/src/extractor/customLocator.ts +1245 -0
  200. package/src/extractor/debug.ts +10 -0
  201. package/src/extractor/dom-util.ts +231 -0
  202. package/src/extractor/index.ts +50 -0
  203. package/src/extractor/locator.ts +469 -0
  204. package/src/extractor/tree.ts +179 -0
  205. package/src/extractor/util.ts +482 -0
  206. package/src/extractor/web-extractor.ts +617 -0
  207. package/src/img/box-select.ts +588 -0
  208. package/src/img/canvas-fallback.ts +393 -0
  209. package/src/img/get-photon.ts +108 -0
  210. package/src/img/get-sharp.ts +18 -0
  211. package/src/img/index.ts +27 -0
  212. package/src/img/info.ts +102 -0
  213. package/src/img/transform.ts +553 -0
  214. package/src/index.ts +1 -0
  215. package/src/key-alias-utils.ts +23 -0
  216. package/src/logger.ts +96 -0
  217. package/src/mcp/base-server.ts +500 -0
  218. package/src/mcp/base-tools.ts +391 -0
  219. package/src/mcp/chrome-path.ts +48 -0
  220. package/src/mcp/cli-report-session.ts +130 -0
  221. package/src/mcp/error-formatter.ts +52 -0
  222. package/src/mcp/index.ts +9 -0
  223. package/src/mcp/init-arg-utils.ts +105 -0
  224. package/src/mcp/inject-report-html-plugin.ts +119 -0
  225. package/src/mcp/launcher-helper.ts +200 -0
  226. package/src/mcp/tool-generator.ts +658 -0
  227. package/src/mcp/types.ts +131 -0
  228. package/src/node/fs.ts +84 -0
  229. package/src/node/index.ts +2 -0
  230. package/src/node/port.ts +37 -0
  231. package/src/polyfills/async-hooks.ts +6 -0
  232. package/src/polyfills/index.ts +4 -0
  233. package/src/types/index.ts +54 -0
  234. package/src/us-keyboard-layout.ts +723 -0
  235. package/src/utils.ts +149 -0
  236. package/src/zod-schema-utils.ts +133 -0
@@ -0,0 +1,131 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { z } from 'zod';
3
+
4
+ // Avoid circular dependency: don't import from @godscene/core
5
+ // Instead, use generic types that will be provided by implementation
6
+
7
+ /**
8
+ * Default timeout constants for app loading verification
9
+ */
10
+ export const defaultAppLoadingTimeoutMs = 10000;
11
+ export const defaultAppLoadingCheckIntervalMs = 2000;
12
+
13
+ /**
14
+ * Content item types for tool results (MCP compatible)
15
+ */
16
+ export type ToolResultContent =
17
+ | { type: 'text'; text: string }
18
+ | { type: 'image'; data: string; mimeType: string }
19
+ | { type: 'audio'; data: string; mimeType: string }
20
+ | {
21
+ type: 'resource';
22
+ resource:
23
+ | { text: string; uri: string; mimeType?: string }
24
+ | { uri: string; blob: string; mimeType?: string };
25
+ };
26
+
27
+ /**
28
+ * Result type for tool execution (MCP compatible)
29
+ */
30
+ export interface ToolResult {
31
+ [x: string]: unknown;
32
+ content: ToolResultContent[];
33
+ isError?: boolean;
34
+ _meta?: Record<string, unknown>;
35
+ }
36
+
37
+ /**
38
+ * Tool handler function type
39
+ * Takes parsed arguments and returns a tool result
40
+ */
41
+ export type ToolHandler<T = Record<string, unknown>> = (
42
+ args: T,
43
+ ) => Promise<ToolResult>;
44
+
45
+ /**
46
+ * Tool schema type using Zod
47
+ */
48
+ export type ToolSchema = Record<string, z.ZodTypeAny>;
49
+
50
+ export interface ToolCliOption {
51
+ preferredName?: string;
52
+ aliases?: string[];
53
+ }
54
+
55
+ export interface ToolCliMetadata {
56
+ options?: Record<string, ToolCliOption>;
57
+ }
58
+
59
+ /**
60
+ * Tool definition for MCP server
61
+ */
62
+ export interface ToolDefinition<T = Record<string, unknown>> {
63
+ name: string;
64
+ description: string;
65
+ schema: ToolSchema;
66
+ handler: ToolHandler<T>;
67
+ cli?: ToolCliMetadata;
68
+ }
69
+
70
+ /**
71
+ * Tool type for mcpKitForAgent return value
72
+ */
73
+ export type Tool = ToolDefinition;
74
+
75
+ /**
76
+ * Action space item definition
77
+ * Note: Intentionally no index signature to maintain compatibility with DeviceAction
78
+ */
79
+ export interface ActionSpaceItem {
80
+ name: string;
81
+ description?: string;
82
+ args?: Record<string, unknown>;
83
+ paramSchema?: z.ZodTypeAny;
84
+ }
85
+
86
+ /**
87
+ * Base agent interface
88
+ * Represents a platform-specific agent (Android, iOS, Web)
89
+ * Note: Return types use `unknown` for compatibility with platform-specific implementations
90
+ */
91
+ export interface BaseAgent {
92
+ getActionSpace(): Promise<ActionSpaceItem[]>;
93
+ destroy?(): Promise<void>;
94
+ page?: {
95
+ screenshotBase64(): Promise<string>;
96
+ };
97
+ callActionInActionSpace?: (
98
+ actionName: string,
99
+ params?: unknown,
100
+ ) => Promise<unknown>;
101
+ aiAction?: (
102
+ description: string,
103
+ params?: Record<string, unknown>,
104
+ ) => Promise<unknown>;
105
+ aiWaitFor?: (
106
+ assertion: string,
107
+ options: Record<string, unknown>,
108
+ ) => Promise<unknown>;
109
+ aiAssert?: (
110
+ assertion: string,
111
+ msg?: string,
112
+ options?: Record<string, unknown>,
113
+ ) => Promise<unknown>;
114
+ }
115
+
116
+ /**
117
+ * Base device interface for temporary device instances
118
+ */
119
+ export interface BaseDevice {
120
+ actionSpace(): ActionSpaceItem[];
121
+ destroy?(): Promise<void>;
122
+ }
123
+
124
+ /**
125
+ * Interface for platform-specific MCP tools manager
126
+ */
127
+ export interface IMidsceneTools {
128
+ attachToServer(server: McpServer): void;
129
+ initTools(): Promise<void>;
130
+ destroy?(): Promise<void>;
131
+ }
package/src/node/fs.ts ADDED
@@ -0,0 +1,84 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { ifInBrowser, ifInWorker } from '../utils';
4
+
5
+ declare const __HTML_ELEMENT_SCRIPT__: string;
6
+
7
+ interface PkgInfo {
8
+ name: string;
9
+ version: string;
10
+ dir: string;
11
+ }
12
+
13
+ const pkgCacheMap: Record<string, PkgInfo> = {};
14
+
15
+ export function getRunningPkgInfo(dir?: string): PkgInfo | null {
16
+ if (ifInBrowser || ifInWorker) {
17
+ return null;
18
+ }
19
+ const dirToCheck = dir || process.cwd();
20
+ if (pkgCacheMap[dirToCheck]) {
21
+ return pkgCacheMap[dirToCheck];
22
+ }
23
+
24
+ const pkgDir = findNearestPackageJson(dirToCheck);
25
+ const pkgJsonFile = pkgDir ? join(pkgDir, 'package.json') : null;
26
+
27
+ if (pkgDir && pkgJsonFile) {
28
+ const { name, version } = JSON.parse(readFileSync(pkgJsonFile, 'utf-8'));
29
+ pkgCacheMap[dirToCheck] = {
30
+ name: name || 'midscene-unknown-package-name',
31
+ version: version || '0.0.0',
32
+ dir: pkgDir,
33
+ };
34
+ return pkgCacheMap[dirToCheck];
35
+ }
36
+ return {
37
+ name: 'midscene-unknown-package-name',
38
+ version: '0.0.0',
39
+ dir: dirToCheck,
40
+ };
41
+ }
42
+
43
+ /**
44
+ * Find the nearest package.json file recursively
45
+ * @param {string} dir - Home directory
46
+ * @returns {string|null} - The most recent package.json file path or null
47
+ */
48
+ export function findNearestPackageJson(dir: string): string | null {
49
+ const packageJsonPath = join(dir, 'package.json');
50
+ if (existsSync(packageJsonPath)) {
51
+ return dir;
52
+ }
53
+
54
+ const parentDir = dirname(dir);
55
+
56
+ // Return null if the root directory has been reached
57
+ if (parentDir === dir) {
58
+ return null;
59
+ }
60
+
61
+ return findNearestPackageJson(parentDir);
62
+ }
63
+
64
+ export function getElementInfosScriptContent() {
65
+ const htmlElementScript = __HTML_ELEMENT_SCRIPT__;
66
+
67
+ if (!htmlElementScript) {
68
+ throw new Error('HTML_ELEMENT_SCRIPT inject failed.');
69
+ }
70
+ return htmlElementScript;
71
+ }
72
+
73
+ export async function getExtraReturnLogic(tree = false) {
74
+ if (ifInBrowser || ifInWorker) {
75
+ return null;
76
+ }
77
+
78
+ const elementInfosScriptContent = `${getElementInfosScriptContent()};`;
79
+
80
+ if (tree) {
81
+ return `${elementInfosScriptContent}midscene_element_inspector.webExtractNodeTree()`;
82
+ }
83
+ return `${elementInfosScriptContent}midscene_element_inspector.webExtractTextWithPosition()`;
84
+ }
@@ -0,0 +1,2 @@
1
+ export * from './fs';
2
+ export * from './port';
@@ -0,0 +1,37 @@
1
+ import { createServer } from 'node:net';
2
+
3
+ /**
4
+ * Check if a port is available
5
+ */
6
+ export async function isPortAvailable(port: number): Promise<boolean> {
7
+ return new Promise((resolve) => {
8
+ const server = createServer();
9
+ server.on('error', () => resolve(false));
10
+ server.listen(port, () => {
11
+ server.close(() => resolve(true));
12
+ });
13
+ });
14
+ }
15
+
16
+ /**
17
+ * Find an available port starting from the given port
18
+ */
19
+ export async function findAvailablePort(
20
+ startPort: number,
21
+ maxAttempts = 15,
22
+ ): Promise<number> {
23
+ let port = startPort;
24
+ let attempts = 0;
25
+
26
+ while (!(await isPortAvailable(port))) {
27
+ attempts++;
28
+ if (attempts >= maxAttempts) {
29
+ console.error(
30
+ `❌ Unable to find available port after ${maxAttempts} attempts starting from ${startPort}`,
31
+ );
32
+ process.exit(1);
33
+ }
34
+ port++;
35
+ }
36
+ return port;
37
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Browser polyfill for Node.js async_hooks module
3
+ * Provides empty implementation for browser environments where async_hooks is not available
4
+ */
5
+ const AsyncLocalStorage = {};
6
+ export { AsyncLocalStorage };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Polyfills for Node.js modules in browser environments
3
+ */
4
+ export * from './async-hooks';
@@ -0,0 +1,54 @@
1
+ import type { NodeType } from '../constants';
2
+ import type { ElementInfo } from '../extractor';
3
+
4
+ export interface Point {
5
+ left: number;
6
+ top: number;
7
+ }
8
+
9
+ export interface Size {
10
+ width: number; // The image sent to AI model will be resized to this width, also the coordinates in the action space will be scaled to the range [0, width]. Usually you should set it to the logical pixel size
11
+ height: number; // The image sent to AI model will be resized to this height, also the coordinates in the action space will be scaled to the range [0, height]. Usually you should set it to the logical pixel size
12
+ }
13
+
14
+ export type Rect = Point & Size;
15
+
16
+ export abstract class BaseElement {
17
+ abstract id: string;
18
+
19
+ // abstract indexId?: number; // markerId for web
20
+
21
+ abstract attributes: {
22
+ nodeType: NodeType;
23
+ [key: string]: string;
24
+ };
25
+
26
+ abstract content: string;
27
+
28
+ abstract rect: Rect;
29
+
30
+ abstract center: [number, number];
31
+
32
+ // abstract xpaths?: string[];
33
+
34
+ abstract isVisible: boolean;
35
+ }
36
+
37
+ export interface ElementTreeNode<
38
+ ElementType extends BaseElement = BaseElement,
39
+ > {
40
+ node: ElementType | null;
41
+ children: ElementTreeNode<ElementType>[];
42
+ }
43
+
44
+ export interface WebElementInfo extends ElementInfo {
45
+ zoom: number;
46
+ }
47
+
48
+ export type LocateResultElement = {
49
+ description: string; // the description of the element
50
+ center: [number, number];
51
+ rect: Rect;
52
+ allPaths?: any[],
53
+ containerPaths?: any[]
54
+ };