appium-desktop-driver 1.7.2-preview.1 → 1.7.2

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 (111) hide show
  1. package/README.md +2 -0
  2. package/build/eslint.config.d.mts +3 -0
  3. package/build/eslint.config.d.mts.map +1 -0
  4. package/build/eslint.config.mjs +22 -0
  5. package/build/eslint.config.mjs.map +1 -0
  6. package/build/lib/commands/actions.d.ts +3 -5
  7. package/build/lib/commands/actions.d.ts.map +1 -1
  8. package/build/lib/commands/actions.js +91 -83
  9. package/build/lib/commands/actions.js.map +1 -1
  10. package/build/lib/commands/app.d.ts +1 -53
  11. package/build/lib/commands/app.d.ts.map +1 -1
  12. package/build/lib/commands/app.js +147 -415
  13. package/build/lib/commands/app.js.map +1 -1
  14. package/build/lib/commands/device.d.ts +8 -0
  15. package/build/lib/commands/device.d.ts.map +1 -1
  16. package/build/lib/commands/device.js +229 -4
  17. package/build/lib/commands/device.js.map +1 -1
  18. package/build/lib/commands/element.d.ts +3 -0
  19. package/build/lib/commands/element.d.ts.map +1 -1
  20. package/build/lib/commands/element.js +53 -102
  21. package/build/lib/commands/element.js.map +1 -1
  22. package/build/lib/commands/extension.d.ts +0 -2
  23. package/build/lib/commands/extension.d.ts.map +1 -1
  24. package/build/lib/commands/extension.js +184 -111
  25. package/build/lib/commands/extension.js.map +1 -1
  26. package/build/lib/commands/index.d.ts +17 -28
  27. package/build/lib/commands/index.d.ts.map +1 -1
  28. package/build/lib/commands/index.js +2 -4
  29. package/build/lib/commands/index.js.map +1 -1
  30. package/build/lib/commands/powershell.d.ts +6 -0
  31. package/build/lib/commands/powershell.d.ts.map +1 -0
  32. package/build/lib/commands/powershell.js +202 -0
  33. package/build/lib/commands/powershell.js.map +1 -0
  34. package/build/lib/commands/screen-recorder.d.ts +3 -3
  35. package/build/lib/commands/screen-recorder.d.ts.map +1 -1
  36. package/build/lib/commands/screen-recorder.js +24 -33
  37. package/build/lib/commands/screen-recorder.js.map +1 -1
  38. package/build/lib/constraints.d.ts +7 -26
  39. package/build/lib/constraints.d.ts.map +1 -1
  40. package/build/lib/constraints.js +6 -25
  41. package/build/lib/constraints.js.map +1 -1
  42. package/build/lib/driver.d.ts +13 -22
  43. package/build/lib/driver.d.ts.map +1 -1
  44. package/build/lib/driver.js +49 -130
  45. package/build/lib/driver.js.map +1 -1
  46. package/build/lib/mcp/tools/index.d.ts.map +1 -1
  47. package/build/lib/mcp/tools/index.js +0 -2
  48. package/build/lib/mcp/tools/index.js.map +1 -1
  49. package/build/lib/powershell/conditions.d.ts.map +1 -1
  50. package/build/lib/powershell/conditions.js +0 -7
  51. package/build/lib/powershell/conditions.js.map +1 -1
  52. package/build/lib/util.d.ts +1 -11
  53. package/build/lib/util.d.ts.map +1 -1
  54. package/build/lib/util.js +7 -158
  55. package/build/lib/util.js.map +1 -1
  56. package/build/lib/winapi/user32.d.ts +6 -5
  57. package/build/lib/winapi/user32.d.ts.map +1 -1
  58. package/build/lib/winapi/user32.js +88 -131
  59. package/build/lib/winapi/user32.js.map +1 -1
  60. package/build/lib/xpath/core.d.ts +4 -10
  61. package/build/lib/xpath/core.d.ts.map +1 -1
  62. package/build/lib/xpath/core.js +224 -205
  63. package/build/lib/xpath/core.js.map +1 -1
  64. package/build/lib/xpath/functions.d.ts +2 -7
  65. package/build/lib/xpath/functions.d.ts.map +1 -1
  66. package/build/lib/xpath/functions.js +25 -49
  67. package/build/lib/xpath/functions.js.map +1 -1
  68. package/build/tsconfig.tsbuildinfo +1 -0
  69. package/package.json +12 -18
  70. package/CHANGELOG.md +0 -249
  71. package/build/lib/commands/contexts.d.ts +0 -64
  72. package/build/lib/commands/contexts.d.ts.map +0 -1
  73. package/build/lib/commands/contexts.js +0 -166
  74. package/build/lib/commands/contexts.js.map +0 -1
  75. package/build/lib/commands/server-session.d.ts +0 -9
  76. package/build/lib/commands/server-session.d.ts.map +0 -1
  77. package/build/lib/commands/server-session.js +0 -158
  78. package/build/lib/commands/server-session.js.map +0 -1
  79. package/build/lib/log-file.d.ts +0 -10
  80. package/build/lib/log-file.d.ts.map +0 -1
  81. package/build/lib/log-file.js +0 -86
  82. package/build/lib/log-file.js.map +0 -1
  83. package/build/lib/mcp/tools/context.d.ts +0 -4
  84. package/build/lib/mcp/tools/context.d.ts.map +0 -1
  85. package/build/lib/mcp/tools/context.js +0 -49
  86. package/build/lib/mcp/tools/context.js.map +0 -1
  87. package/build/lib/server/client.d.ts +0 -15
  88. package/build/lib/server/client.d.ts.map +0 -1
  89. package/build/lib/server/client.js +0 -169
  90. package/build/lib/server/client.js.map +0 -1
  91. package/build/lib/server/conditions.d.ts +0 -13
  92. package/build/lib/server/conditions.d.ts.map +0 -1
  93. package/build/lib/server/conditions.js +0 -71
  94. package/build/lib/server/conditions.js.map +0 -1
  95. package/build/lib/server/converter-bridge.d.ts +0 -26
  96. package/build/lib/server/converter-bridge.d.ts.map +0 -1
  97. package/build/lib/server/converter-bridge.js +0 -171
  98. package/build/lib/server/converter-bridge.js.map +0 -1
  99. package/build/lib/server/index.d.ts +0 -5
  100. package/build/lib/server/index.d.ts.map +0 -1
  101. package/build/lib/server/index.js +0 -25
  102. package/build/lib/server/index.js.map +0 -1
  103. package/build/lib/server/protocol.d.ts +0 -40
  104. package/build/lib/server/protocol.d.ts.map +0 -1
  105. package/build/lib/server/protocol.js +0 -3
  106. package/build/lib/server/protocol.js.map +0 -1
  107. package/build/lib/version.d.ts +0 -2
  108. package/build/lib/version.d.ts.map +0 -1
  109. package/build/lib/version.js +0 -20
  110. package/build/lib/version.js.map +0 -1
  111. package/scripts/postinstall.js +0 -39
@@ -1,158 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startServerSession = startServerSession;
4
- exports.tryAttachToRunningApp = tryAttachToRunningApp;
5
- exports.terminateServerSession = terminateServerSession;
6
- const node_path_1 = require("node:path");
7
- const client_1 = require("../server/client");
8
- const util_1 = require("../util");
9
- const user32_1 = require("../winapi/user32");
10
- const MAX_INIT_RETRIES = 5;
11
- const INIT_RETRY_DELAY_MS = 500;
12
- const WEBVIEW_DEVTOOLS_PORT_LOWER = 10900;
13
- const WEBVIEW_DEVTOOLS_PORT_UPPER = 11000;
14
- async function startServerSession() {
15
- // Build a per-session env overlay rather than mutating process.env, which
16
- // is global across all sessions in the Appium server process.
17
- let serverEnv;
18
- // When WebView2 support is enabled, set the env var the WebView2 runtime
19
- // reads at startup so that the AUT exposes a Chrome DevTools Protocol
20
- // endpoint we can attach Chromedriver to. The C# server inherits this env
21
- // and any AUT it spawns inherits it in turn.
22
- if (this.caps.webviewEnabled) {
23
- this.webviewDevtoolsPort = this.caps.webviewDevtoolsPort
24
- ? Number(this.caps.webviewDevtoolsPort)
25
- : await (0, util_1.findFreePort)(WEBVIEW_DEVTOOLS_PORT_LOWER, WEBVIEW_DEVTOOLS_PORT_UPPER);
26
- serverEnv = {
27
- ...process.env,
28
- WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: `--remote-debugging-port=${this.webviewDevtoolsPort}`,
29
- };
30
- this.log.info(`WebView2 remote debugging enabled on port ${this.webviewDevtoolsPort}.`);
31
- }
32
- // The C# server's `init` command triggers UIAutomation static type
33
- // initializers (COM objects). These can fail intermittently, and once
34
- // a .NET type initializer fails it stays broken for the process lifetime.
35
- // The only recovery is to restart the server process and try again.
36
- for (let attempt = 1; attempt <= MAX_INIT_RETRIES; attempt++) {
37
- this.serverClient = new client_1.NovaUIAutomationClient(this.log);
38
- await this.serverClient.start(undefined, serverEnv);
39
- try {
40
- await this.sendCommand('init', {});
41
- break; // success
42
- }
43
- catch (err) {
44
- const msg = err instanceof Error ? err.message : String(err);
45
- if (attempt < MAX_INIT_RETRIES && msg.includes('type initializer')) {
46
- this.log.warn(`Server init failed (attempt ${attempt}/${MAX_INIT_RETRIES}): ${msg}. Restarting server...`);
47
- await this.serverClient.dispose();
48
- this.serverClient = undefined;
49
- // Delay before retrying to let COM resources be released
50
- await new Promise((resolve) => setTimeout(resolve, INIT_RETRY_DELAY_MS));
51
- }
52
- else {
53
- throw err;
54
- }
55
- }
56
- }
57
- if (this.caps.appWorkingDir) {
58
- const envVarsSet = new Set();
59
- const matches = this.caps.appWorkingDir.matchAll(/%([^%]+)%/g);
60
- for (const match of matches) {
61
- envVarsSet.add(match[1]);
62
- }
63
- const envVars = Array.from(envVarsSet);
64
- for (const envVar of envVars) {
65
- this.caps.appWorkingDir = this.caps.appWorkingDir.replaceAll(`%${envVar}%`, process.env[envVar.toUpperCase()] ?? '');
66
- }
67
- }
68
- if ((!this.caps.app && !this.caps.appTopLevelWindow) || (!this.caps.app || this.caps.app.toLowerCase() === 'none')) {
69
- this.log.info(`No app or top-level window specified in capabilities. Setting root element to null.`);
70
- await this.sendCommand('setRootElementNull', {});
71
- }
72
- if (this.caps.app && this.caps.app.toLowerCase() === 'root') {
73
- this.log.info(`'root' specified as app in capabilities. Setting root element to desktop root.`);
74
- await this.sendCommand('setRootElement', {});
75
- }
76
- if (this.caps.app && this.caps.app.toLowerCase() !== 'none' && this.caps.app.toLowerCase() !== 'root') {
77
- this.log.info(`Application path specified in capabilities: ${this.caps.app}`);
78
- const envVarsSet = new Set();
79
- const matches = this.caps.app.matchAll(/%([^%]+)%/g);
80
- for (const match of matches) {
81
- envVarsSet.add(match[1]);
82
- }
83
- const envVars = Array.from(envVarsSet);
84
- this.log.info(`Detected the following environment variables in app path: ${envVars.map((envVar) => `%${envVar}%`).join(', ')}`);
85
- for (const envVar of envVars) {
86
- this.caps.app = this.caps.app.replaceAll(`%${envVar}%`, process.env[envVar.toUpperCase()] ?? '');
87
- }
88
- // When noReset is true, try to attach to an already-running instance
89
- // of the app before launching a new one.
90
- if (this.opts.noReset) {
91
- const attached = await this.tryAttachToRunningApp(this.caps.app);
92
- if (attached) {
93
- this.log.info('noReset: attached to an already-running instance of the app.');
94
- return;
95
- }
96
- this.log.info('noReset: no running instance found, launching the app.');
97
- }
98
- await this.changeRootElement(this.caps.app);
99
- }
100
- if (this.caps.appTopLevelWindow) {
101
- const nativeWindowHandle = Number(this.caps.appTopLevelWindow);
102
- if (isNaN(nativeWindowHandle)) {
103
- throw new Error(`Invalid capabilities. Capability 'appTopLevelWindow' is not a valid native window handle.`);
104
- }
105
- await this.changeRootElement(nativeWindowHandle);
106
- }
107
- }
108
- /**
109
- * Attempts to attach to an already-running instance of the given app.
110
- * Returns true if successfully attached, false if no running process found.
111
- */
112
- async function tryAttachToRunningApp(appPath) {
113
- const isUwp = appPath.includes('!') && appPath.includes('_') && !(appPath.includes('/') || appPath.includes('\\'));
114
- try {
115
- if (isUwp) {
116
- // UWP: scan all visible windows and attach to one that has content.
117
- // attachToWindowHandles uses the focusable-descendant probe to skip
118
- // empty ApplicationFrameHost frames.
119
- const handles = (0, user32_1.getAllWindowHandles)();
120
- return await this.attachToWindowHandles(handles);
121
- }
122
- const normalizedPath = (0, node_path_1.normalize)(appPath);
123
- const breadcrumbs = normalizedPath.toLowerCase().split('\\').flatMap((x) => x.split('/'));
124
- const executable = breadcrumbs[breadcrumbs.length - 1];
125
- const processName = executable.endsWith('.exe') ? executable.slice(0, executable.length - 4) : executable;
126
- const processIds = await this.sendCommand('getProcessIds', { processName });
127
- if (processIds.length === 0) {
128
- return false;
129
- }
130
- const handles = (0, user32_1.getWindowAllHandlesForProcessIds)(processIds);
131
- if (handles.length === 0) {
132
- return false;
133
- }
134
- // Use the last handle (most recently shown window for this process).
135
- const elementId = await this.sendCommand('elementFromHandle', { handle: handles[handles.length - 1] }) ?? '';
136
- if (!elementId) {
137
- return false;
138
- }
139
- await this.sendCommand('setRootElementFromElementId', { elementId });
140
- const rootId = await this.sendCommand('saveRootElementToTable', {});
141
- const nwh = Number(await this.sendCommand('getProperty', { elementId: rootId, property: 'NativeWindowHandle' }));
142
- (0, user32_1.trySetForegroundWindow)(nwh);
143
- return true;
144
- }
145
- catch {
146
- return false;
147
- }
148
- }
149
- async function terminateServerSession() {
150
- if (!this.serverClient) {
151
- return;
152
- }
153
- this.log.debug(`Terminating NovaUIAutomationServer session...`);
154
- await this.serverClient.dispose();
155
- this.serverClient = undefined;
156
- this.log.debug(`NovaUIAutomationServer session terminated successfully.`);
157
- }
158
- //# sourceMappingURL=server-session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-session.js","sourceRoot":"","sources":["../../../lib/commands/server-session.ts"],"names":[],"mappings":";;AAWA,gDA2GC;AAMD,sDAkCC;AAED,wDASC;AAzKD,yCAAsC;AAEtC,6CAA0D;AAC1D,kCAAuC;AACvC,6CAAiH;AAEjH,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AAC1C,MAAM,2BAA2B,GAAG,KAAK,CAAC;AAEnC,KAAK,UAAU,kBAAkB;IACpC,0EAA0E;IAC1E,8DAA8D;IAC9D,IAAI,SAAwC,CAAC;IAE7C,yEAAyE;IACzE,sEAAsE;IACtE,0EAA0E;IAC1E,6CAA6C;IAC7C,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;QAC3B,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB;YACpD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC;YACvC,CAAC,CAAC,MAAM,IAAA,mBAAY,EAAC,2BAA2B,EAAE,2BAA2B,CAAC,CAAC;QACnF,SAAS,GAAG;YACR,GAAG,OAAO,CAAC,GAAG;YACd,qCAAqC,EAAE,2BAA2B,IAAI,CAAC,mBAAmB,EAAE;SAC/F,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,6CAA6C,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC;IAC5F,CAAC;IAED,mEAAmE;IACnE,sEAAsE;IACtE,0EAA0E;IAC1E,oEAAoE;IACpE,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,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ACjB,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,sBAAsB;IACxC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QACrB,OAAO;IACX,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAChE,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;IAClC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;AAC9E,CAAC"}
@@ -1,10 +0,0 @@
1
- type LogLike = {
2
- [level: string]: unknown;
3
- };
4
- export type LogFileMirror = {
5
- path: string;
6
- detach: () => void;
7
- };
8
- export declare function attachLogFileMirror(log: LogLike, value: unknown): LogFileMirror;
9
- export {};
10
- //# sourceMappingURL=log-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log-file.d.ts","sourceRoot":"","sources":["../../lib/log-file.ts"],"names":[],"mappings":"AAGA,KAAK,OAAO,GAAG;IACX,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B,CAAC;AAIF,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AA0CF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa,CAqC/E"}
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.attachLogFileMirror = attachLogFileMirror;
4
- const node_fs_1 = require("node:fs");
5
- const node_path_1 = require("node:path");
6
- const DEFAULT_SUBDIR = 'novawindows-driver';
7
- const MIRRORED_LEVELS = ['silly', 'verbose', 'debug', 'info', 'http', 'warn', 'error'];
8
- function resolveLogPath(value) {
9
- let dir;
10
- if (typeof value === 'string' && value.length > 0) {
11
- if (value.endsWith('\\') || value.endsWith('/')) {
12
- dir = value;
13
- }
14
- else {
15
- return value;
16
- }
17
- }
18
- if (!dir) {
19
- const base = process.env.LOCALAPPDATA
20
- ?? (0, node_path_1.join)(process.env.USERPROFILE ?? process.env.HOME ?? '.', 'AppData', 'Local');
21
- dir = (0, node_path_1.join)(base, DEFAULT_SUBDIR);
22
- }
23
- const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
24
- return (0, node_path_1.join)(dir, `session-${timestamp}.log`);
25
- }
26
- function formatArg(arg) {
27
- if (arg instanceof Error) {
28
- return arg.stack ?? `${arg.name}: ${arg.message}`;
29
- }
30
- if (typeof arg === 'string') {
31
- return arg;
32
- }
33
- try {
34
- return JSON.stringify(arg);
35
- }
36
- catch {
37
- return String(arg);
38
- }
39
- }
40
- function writeLine(stream, level, args) {
41
- const line = `${new Date().toISOString()} [${level.toUpperCase()}] ${args.map(formatArg).join(' ')}\n`;
42
- stream.write(line);
43
- }
44
- function attachLogFileMirror(log, value) {
45
- const path = resolveLogPath(value);
46
- (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(path), { recursive: true });
47
- const stream = (0, node_fs_1.createWriteStream)(path, { encoding: 'utf8', flags: 'a' });
48
- const restorers = [];
49
- for (const level of MIRRORED_LEVELS) {
50
- const original = log[level];
51
- if (typeof original !== 'function') {
52
- continue;
53
- }
54
- const originalFn = original;
55
- const hadOwn = Object.prototype.hasOwnProperty.call(log, level);
56
- const wrapped = (...args) => {
57
- writeLine(stream, level, args);
58
- return originalFn.apply(log, args);
59
- };
60
- log[level] = wrapped;
61
- restorers.push(() => {
62
- if (hadOwn) {
63
- log[level] = originalFn;
64
- }
65
- else {
66
- delete log[level];
67
- }
68
- });
69
- }
70
- writeLine(stream, 'info', [`NovaWindows driver log mirror attached at ${path}`]);
71
- let detached = false;
72
- return {
73
- path,
74
- detach: () => {
75
- if (detached) {
76
- return;
77
- }
78
- detached = true;
79
- for (const restore of restorers) {
80
- restore();
81
- }
82
- stream.end();
83
- },
84
- };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U,GAAG,QAAiB,CAAC;QACrC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAChE,MAAM,OAAO,GAAU,CAAC,GAAG,IAAe,EAAE,EAAE;YAC1C,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;YAC/B,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC;QACF,GAAG,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;QACrB,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;YAChB,IAAI,MAAM,EAAE,CAAC;gBACT,GAAG,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACJ,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,6CAA6C,IAAI,EAAE,CAAC,CAAC,CAAC;IAEjF,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO;QACH,IAAI;QACJ,MAAM,EAAE,GAAG,EAAE;YACT,IAAI,QAAQ,EAAE,CAAC;gBAAA,OAAO;YAAA,CAAC;YACvB,QAAQ,GAAG,IAAI,CAAC;YAChB,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;gBAAA,OAAO,EAAE,CAAC;YAAA,CAAC;YAC7C,MAAM,CAAC,GAAG,EAAE,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -1,4 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import type { AppiumSession } from '../session.js';
3
- export declare function registerContextTools(server: McpServer, session: AppiumSession): void;
4
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../lib/mcp/tools/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAqDpF"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerContextTools = registerContextTools;
4
- const zod_1 = require("zod");
5
- const errors_js_1 = require("../errors.js");
6
- function registerContextTools(server, session) {
7
- server.registerTool('get_current_context', {
8
- description: 'Get the current context name ("NATIVE_APP" or "WEBVIEW_<id>").',
9
- annotations: { readOnlyHint: true },
10
- }, async () => {
11
- try {
12
- const driver = session.getDriver();
13
- const context = await driver.getContext();
14
- return { content: [{ type: 'text', text: String(context) }] };
15
- }
16
- catch (err) {
17
- return { isError: true, content: [{ type: 'text', text: (0, errors_js_1.formatError)(err) }] };
18
- }
19
- });
20
- server.registerTool('get_contexts', {
21
- description: 'Get all available context names, including NATIVE_APP and any WEBVIEW_* contexts.',
22
- annotations: { readOnlyHint: true },
23
- }, async () => {
24
- try {
25
- const driver = session.getDriver();
26
- const result = await driver.execute('mobile: getContexts', [{}]);
27
- return { content: [{ type: 'text', text: JSON.stringify(result) }] };
28
- }
29
- catch (err) {
30
- return { isError: true, content: [{ type: 'text', text: (0, errors_js_1.formatError)(err) }] };
31
- }
32
- });
33
- server.registerTool('set_context', {
34
- description: 'Switch to a context by name ("NATIVE_APP" or "WEBVIEW_<id>").',
35
- inputSchema: zod_1.z.object({
36
- name: zod_1.z.string().describe('Context name to switch to'),
37
- }),
38
- }, async ({ name }) => {
39
- try {
40
- const driver = session.getDriver();
41
- await driver.switchContext(name);
42
- return { content: [{ type: 'text', text: `Switched to context: ${name}` }] };
43
- }
44
- catch (err) {
45
- return { isError: true, content: [{ type: 'text', text: (0, errors_js_1.formatError)(err) }] };
46
- }
47
- });
48
- }
49
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../lib/mcp/tools/context.ts"],"names":[],"mappings":";;AAKA,oDAqDC;AAzDD,6BAAwB;AAExB,4CAA2C;AAE3C,SAAgB,oBAAoB,CAAC,MAAiB,EAAE,OAAsB;IAC1E,MAAM,CAAC,YAAY,CACf,qBAAqB,EACrB;QACI,WAAW,EAAE,gEAAgE;QAC7E,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KACtC,EACD,KAAK,IAAI,EAAE;QACP,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;YACnC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3E,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAA,uBAAW,EAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3F,CAAC;IACL,CAAC,CACJ,CAAC;IAEF,MAAM,CAAC,YAAY,CACf,cAAc,EACd;QACI,WAAW,EAAE,mFAAmF;QAChG,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KACtC,EACD,KAAK,IAAI,EAAE;QACP,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;YACnC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACjE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;QAClF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAA,uBAAW,EAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3F,CAAC;IACL,CAAC,CACJ,CAAC;IAEF,MAAM,CAAC,YAAY,CACf,aAAa,EACb;QACI,WAAW,EAAE,+DAA+D;QAC5E,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC;YAClB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;SACzD,CAAC;KACL,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACf,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;YACnC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACjC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,wBAAwB,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QAC1F,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAA,uBAAW,EAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3F,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare class NovaUIAutomationClient {
2
- private process?;
3
- private requestId;
4
- private buffer;
5
- private pendingRequests;
6
- private log;
7
- private recordingStream?;
8
- constructor(log: NovaUIAutomationClient['log'], recordingPath?: string);
9
- private getServerPath;
10
- start(recordingPath?: string, env?: NodeJS.ProcessEnv): Promise<void>;
11
- sendCommand(method: string, params: Record<string, unknown>): Promise<unknown>;
12
- private processBuffer;
13
- dispose(): Promise<void>;
14
- }
15
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../lib/server/client.ts"],"names":[],"mappings":"AAQA,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,OAAO,CAAC,CAAiC;IACjD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,eAAe,CAKlB;IACL,OAAO,CAAC,GAAG,CAAuJ;IAClK,OAAO,CAAC,eAAe,CAAC,CAAc;gBAE1B,GAAG,EAAE,sBAAsB,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM;IAOtE,OAAO,CAAC,aAAa;IASf,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA4CrE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAwBpF,OAAO,CAAC,aAAa;IA4Df,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CA0BjC"}
@@ -1,169 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NovaUIAutomationClient = void 0;
4
- const node_child_process_1 = require("node:child_process");
5
- const node_path_1 = require("node:path");
6
- const node_fs_1 = require("node:fs");
7
- const base_driver_1 = require("@appium/base-driver");
8
- const SERVER_EXE_NAME = 'NovaUIAutomationServer.exe';
9
- class NovaUIAutomationClient {
10
- process;
11
- requestId = 0;
12
- buffer = '';
13
- pendingRequests = new Map();
14
- log;
15
- recordingStream;
16
- constructor(log, recordingPath) {
17
- this.log = log;
18
- if (recordingPath) {
19
- this.recordingStream = (0, node_fs_1.createWriteStream)(recordingPath, { encoding: 'utf8' });
20
- }
21
- }
22
- getServerPath() {
23
- // Allow overriding the server exe path via environment variable
24
- if (process.env.NOVA_WINDOWS_PATH) {
25
- return process.env.NOVA_WINDOWS_PATH;
26
- }
27
- // __dirname at runtime is build/lib/server/, so go up 3 levels to project root
28
- return (0, node_path_1.join)(__dirname, '..', '..', '..', 'native', 'win-x64', SERVER_EXE_NAME);
29
- }
30
- async start(recordingPath, env) {
31
- const serverPath = this.getServerPath();
32
- this.log.info(`Starting NovaUIAutomationServer from: ${serverPath}`);
33
- const args = [];
34
- if (recordingPath) {
35
- args.push('--record', recordingPath);
36
- }
37
- this.process = (0, node_child_process_1.spawn)(serverPath, args, env ? { env } : undefined);
38
- this.process.stdout.setEncoding('utf8');
39
- this.process.stderr.setEncoding('utf8');
40
- this.process.stdout.on('data', (chunk) => {
41
- this.buffer += chunk;
42
- this.processBuffer();
43
- });
44
- this.process.stderr.on('data', (chunk) => {
45
- // Server logs go to stderr - forward to driver log
46
- const lines = chunk.split('\n').filter(Boolean);
47
- for (const line of lines) {
48
- this.log.debug(`[server] ${line}`);
49
- }
50
- });
51
- this.process.on('exit', (code) => {
52
- this.log.info(`NovaUIAutomationServer exited with code ${code}`);
53
- // Reject all pending requests
54
- for (const [id, pending] of this.pendingRequests) {
55
- pending.reject(new base_driver_1.errors.UnknownError(`Server process exited while waiting for response to ${pending.method} (id=${id})`));
56
- }
57
- this.pendingRequests.clear();
58
- this.process = undefined;
59
- });
60
- // Wait a moment for the server to start
61
- await new Promise((resolve) => setTimeout(resolve, 100));
62
- // Verify the server is running with a ping
63
- const result = await this.sendCommand('debug:ping', {});
64
- this.log.info(`NovaUIAutomationServer started: ${JSON.stringify(result)}`);
65
- }
66
- async sendCommand(method, params) {
67
- if (!this.process) {
68
- throw new base_driver_1.errors.UnknownError('NovaUIAutomationServer is not running.');
69
- }
70
- const process = this.process;
71
- const id = ++this.requestId;
72
- const request = { id, method, params };
73
- const json = JSON.stringify(request);
74
- if (this.recordingStream) {
75
- this.recordingStream.write(JSON.stringify({
76
- ts: new Date().toISOString(),
77
- direction: 'request',
78
- ...request,
79
- }) + '\n');
80
- }
81
- return new Promise((resolve, reject) => {
82
- this.pendingRequests.set(id, { resolve, reject, method, startTime: Date.now() });
83
- process.stdin.write(json + '\n');
84
- });
85
- }
86
- processBuffer() {
87
- const lines = this.buffer.split('\n');
88
- // Keep the last partial line in the buffer
89
- this.buffer = lines.pop() ?? '';
90
- for (const line of lines) {
91
- if (!line.trim()) {
92
- continue;
93
- }
94
- try {
95
- const response = JSON.parse(line);
96
- const pending = this.pendingRequests.get(response.id);
97
- if (!pending) {
98
- this.log.warn(`Received response for unknown request id=${response.id}`);
99
- continue;
100
- }
101
- this.pendingRequests.delete(response.id);
102
- if (this.recordingStream) {
103
- this.recordingStream.write(JSON.stringify({
104
- ts: new Date().toISOString(),
105
- direction: 'response',
106
- id: response.id,
107
- result: response.result,
108
- error: response.error,
109
- duration_ms: response.duration_ms,
110
- }) + '\n');
111
- }
112
- const elapsed = Date.now() - pending.startTime;
113
- if (elapsed > 500) {
114
- this.log.warn(`SLOW command: ${pending.method} took ${elapsed}ms (server: ${response.duration_ms}ms)`);
115
- }
116
- if (response.error) {
117
- const errorMessage = `${response.error.code}: ${response.error.message}`;
118
- switch (response.error.code) {
119
- case 'ElementNotFound':
120
- pending.reject(new base_driver_1.errors.NoSuchElementError(errorMessage));
121
- break;
122
- case 'InvalidArgument':
123
- case 'InvalidCondition':
124
- pending.reject(new base_driver_1.errors.InvalidArgumentError(errorMessage));
125
- break;
126
- case 'PatternNotSupported':
127
- pending.reject(new base_driver_1.errors.UnknownError(errorMessage));
128
- break;
129
- default:
130
- pending.reject(new base_driver_1.errors.UnknownError(errorMessage));
131
- }
132
- }
133
- else {
134
- pending.resolve(response.result);
135
- }
136
- }
137
- catch {
138
- this.log.warn(`Failed to parse server response: ${line}`);
139
- }
140
- }
141
- }
142
- async dispose() {
143
- if (!this.process) {
144
- return;
145
- }
146
- try {
147
- await this.sendCommand('dispose', {});
148
- }
149
- catch {
150
- // ignore - server may already be shutting down
151
- }
152
- // Give the process a moment to exit gracefully
153
- await new Promise((resolve) => {
154
- const timeout = setTimeout(() => {
155
- this.process?.kill();
156
- resolve();
157
- }, 2000);
158
- this.process?.once('exit', () => {
159
- clearTimeout(timeout);
160
- resolve();
161
- });
162
- });
163
- this.recordingStream?.end();
164
- this.recordingStream = undefined;
165
- this.process = undefined;
166
- }
167
- }
168
- exports.NovaUIAutomationClient = NovaUIAutomationClient;
169
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../lib/server/client.ts"],"names":[],"mappings":";;;AAAA,2DAA2E;AAC3E,yCAAiC;AACjC,qCAAyD;AACzD,qDAA6C;AAG7C,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAErD,MAAa,sBAAsB;IACvB,OAAO,CAAkC;IACzC,SAAS,GAAG,CAAC,CAAC;IACd,MAAM,GAAG,EAAE,CAAC;IACZ,eAAe,GAAG,IAAI,GAAG,EAK7B,CAAC;IACG,GAAG,CAAuJ;IAC1J,eAAe,CAAe;IAEtC,YAAY,GAAkC,EAAE,aAAsB;QAClE,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,aAAa,EAAE,CAAC;YAChB,IAAI,CAAC,eAAe,GAAG,IAAA,2BAAiB,EAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAClF,CAAC;IACL,CAAC;IAEO,aAAa;QACjB,gEAAgE;QAChE,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QACzC,CAAC;QACD,+EAA+E;QAC/E,OAAO,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAA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CAAC,OAAO,GAAG,SAAS,CAAC;IAC7B,CAAC;CACJ;AAvLD,wDAuLC"}
@@ -1,13 +0,0 @@
1
- import type { ConditionDto } from './protocol';
2
- /**
3
- * Builder functions for creating ConditionDto objects.
4
- * These replace the PSObject-based condition classes when building conditions
5
- * directly (without going through the `-windows uiautomation` converter).
6
- */
7
- export declare function propertyCondition(property: string, value: unknown): ConditionDto;
8
- export declare function andCondition(...conditions: ConditionDto[]): ConditionDto;
9
- export declare function orCondition(...conditions: ConditionDto[]): ConditionDto;
10
- export declare function notCondition(condition: ConditionDto): ConditionDto;
11
- export declare function trueCondition(): ConditionDto;
12
- export declare function falseCondition(): ConditionDto;
13
- //# sourceMappingURL=conditions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../../lib/server/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AAEH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CA4ChF;AAED,wBAAgB,YAAY,CAAC,GAAG,UAAU,EAAE,YAAY,EAAE,GAAG,YAAY,CAExE;AAED,wBAAgB,WAAW,CAAC,GAAG,UAAU,EAAE,YAAY,EAAE,GAAG,YAAY,CAEvE;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,YAAY,GAAG,YAAY,CAElE;AAED,wBAAgB,aAAa,IAAI,YAAY,CAE5C;AAED,wBAAgB,cAAc,IAAI,YAAY,CAE7C"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertyCondition = propertyCondition;
4
- exports.andCondition = andCondition;
5
- exports.orCondition = orCondition;
6
- exports.notCondition = notCondition;
7
- exports.trueCondition = trueCondition;
8
- exports.falseCondition = falseCondition;
9
- /**
10
- * Builder functions for creating ConditionDto objects.
11
- * These replace the PSObject-based condition classes when building conditions
12
- * directly (without going through the `-windows uiautomation` converter).
13
- */
14
- function propertyCondition(property, value) {
15
- // Strip trailing 'Property' suffix and normalize casing
16
- if (property.toLowerCase().endsWith('property')) {
17
- property = property.slice(0, -8);
18
- }
19
- // Normalize common property names to match C# server expectations
20
- const propertyMap = {
21
- 'automationid': 'AutomationId',
22
- 'name': 'Name',
23
- 'classname': 'ClassName',
24
- 'controltype': 'ControlType',
25
- 'runtimeid': 'RuntimeId',
26
- 'nativewindowhandle': 'NativeWindowHandle',
27
- 'processid': 'ProcessId',
28
- 'isenabled': 'IsEnabled',
29
- 'isoffscreen': 'IsOffscreen',
30
- 'iskeyboardfocusable': 'IsKeyboardFocusable',
31
- 'haskeyboardfocus': 'HasKeyboardFocus',
32
- 'iscontrolelement': 'IsControlElement',
33
- 'iscontentelement': 'IsContentElement',
34
- 'ispassword': 'IsPassword',
35
- 'isrequiredforform': 'IsRequiredForForm',
36
- 'itemstatus': 'ItemStatus',
37
- 'itemtype': 'ItemType',
38
- 'localizedcontroltype': 'LocalizedControlType',
39
- 'acceleratorkey': 'AcceleratorKey',
40
- 'accesskey': 'AccessKey',
41
- 'helptext': 'HelpText',
42
- 'frameworkid': 'FrameworkId',
43
- 'orientation': 'Orientation',
44
- 'headinglevel': 'HeadingLevel',
45
- 'labeledby': 'LabeledBy',
46
- 'clickablepoint': 'ClickablePoint',
47
- 'boundingrectangle': 'BoundingRectangle',
48
- 'culture': 'Culture',
49
- 'isdialog': 'IsDialog',
50
- 'sizeofset': 'SizeOfSet',
51
- 'positioninset': 'PositionInSet',
52
- };
53
- const normalized = propertyMap[property.toLowerCase()] ?? property;
54
- return { type: 'property', property: normalized, value };
55
- }
56
- function andCondition(...conditions) {
57
- return { type: 'and', conditions };
58
- }
59
- function orCondition(...conditions) {
60
- return { type: 'or', conditions };
61
- }
62
- function notCondition(condition) {
63
- return { type: 'not', condition };
64
- }
65
- function trueCondition() {
66
- return { type: 'true' };
67
- }
68
- function falseCondition() {
69
- return { type: 'false' };
70
- }
71
- //# sourceMappingURL=conditions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../../lib/server/conditions.ts"],"names":[],"mappings":";;AAQA,8CA4CC;AAED,oCAEC;AAED,kCAEC;AAED,oCAEC;AAED,sCAEC;AAED,wCAEC;AAtED;;;;GAIG;AAEH,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,KAAc;IAC9D,wDAAwD;IACxD,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9C,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,kEAAkE;IAClE,MAAM,WAAW,GAA2B;QACxC,cAAc,EAAE,cAAc;QAC9B,MAAM,EAAE,MAAM;QACd,WAAW,EAAE,WAAW;QACxB,aAAa,EAAE,aAAa;QAC5B,WAAW,EAAE,WAAW;QACxB,oBAAoB,EAAE,oBAAoB;QAC1C,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,WAAW;QACxB,aAAa,EAAE,aAAa;QAC5B,qBAAqB,EAAE,qBAAqB;QAC5C,kBAAkB,EAAE,kBAAkB;QACtC,kBAAkB,EAAE,kBAAkB;QACtC,kBAAkB,EAAE,kBAAkB;QACtC,YAAY,EAAE,YAAY;QAC1B,mBAAmB,EAAE,mBAAmB;QACxC,YAAY,EAAE,YAAY;QAC1B,UAAU,EAAE,UAAU;QACtB,sBAAsB,EAAE,sBAAsB;QAC9C,gBAAgB,EAAE,gBAAgB;QAClC,WAAW,EAAE,WAAW;QACxB,UAAU,EAAE,UAAU;QACtB,aAAa,EAAE,aAAa;QAC5B,aAAa,EAAE,aAAa;QAC5B,cAAc,EAAE,cAAc;QAC9B,WAAW,EAAE,WAAW;QACxB,gBAAgB,EAAE,gBAAgB;QAClC,mBAAmB,EAAE,mBAAmB;QACxC,SAAS,EAAE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