@hypothesi/tauri-mcp-server 0.11.2 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/config.d.ts +14 -0
- package/dist/config.js +26 -0
- package/dist/driver/app-discovery.d.ts +4 -2
- package/dist/driver/app-discovery.js +23 -3
- package/dist/driver/element-picker.d.ts +1 -1
- package/dist/driver/plugin-client.d.ts +23 -1
- package/dist/driver/plugin-client.js +127 -2
- package/dist/driver/plugin-commands.d.ts +8 -4
- package/dist/driver/plugin-commands.js +71 -16
- package/dist/driver/protocol.d.ts +7 -0
- package/dist/driver/scripts/find-element.js +129 -16
- package/dist/driver/scripts/focus.js +31 -4
- package/dist/driver/scripts/html2canvas-loader.js +20 -2
- package/dist/driver/scripts/index.d.ts +2 -4
- package/dist/driver/scripts/index.js +40 -11
- package/dist/driver/scripts/interact.js +66 -5
- package/dist/driver/scripts/resolve-ref.js +101 -50
- package/dist/driver/session-manager.d.ts +39 -0
- package/dist/driver/session-manager.js +133 -13
- package/dist/driver/webview-executor.d.ts +20 -8
- package/dist/driver/webview-executor.js +159 -58
- package/dist/driver/webview-interactions.d.ts +57 -42
- package/dist/driver/webview-interactions.js +62 -40
- package/dist/manager/mobile.js +3 -2
- package/dist/monitor/logs.d.ts +14 -2
- package/dist/monitor/logs.js +37 -5
- package/dist/tools-registry.js +35 -33
- package/dist/version.d.ts +5 -0
- package/dist/version.js +16 -0
- package/package.json +1 -1
- package/dist/driver/scripts/get-styles.js +0 -47
- package/dist/driver/scripts/keyboard.js +0 -76
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keyboard interaction scripts
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Type text into an element
|
|
7
|
-
* @param {Object} params
|
|
8
|
-
* @param {string} params.selector - CSS selector for the element
|
|
9
|
-
* @param {string} params.text - Text to type
|
|
10
|
-
*/
|
|
11
|
-
function typeText(params) {
|
|
12
|
-
const { selector, text } = params;
|
|
13
|
-
|
|
14
|
-
const element = document.querySelector(selector);
|
|
15
|
-
if (!element) {
|
|
16
|
-
throw new Error(`Element not found: ${selector}`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Focus the element
|
|
20
|
-
element.focus();
|
|
21
|
-
|
|
22
|
-
// Set the value
|
|
23
|
-
element.value = text;
|
|
24
|
-
|
|
25
|
-
// Trigger input event for frameworks that listen to it
|
|
26
|
-
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
27
|
-
element.dispatchEvent(new Event('change', { bubbles: true }));
|
|
28
|
-
|
|
29
|
-
return `Typed "${text}" into ${selector}`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Send keyboard events (press, down, up)
|
|
34
|
-
* @param {Object} params
|
|
35
|
-
* @param {string} params.action - 'press', 'down', or 'up'
|
|
36
|
-
* @param {string} params.key - Key to press
|
|
37
|
-
* @param {string[]} params.modifiers - Modifier keys
|
|
38
|
-
*/
|
|
39
|
-
function keyEvent(params) {
|
|
40
|
-
const { action, key, modifiers } = params;
|
|
41
|
-
|
|
42
|
-
const eventOptions = {
|
|
43
|
-
key: key,
|
|
44
|
-
code: key,
|
|
45
|
-
bubbles: true,
|
|
46
|
-
cancelable: true,
|
|
47
|
-
ctrlKey: modifiers.includes('Control'),
|
|
48
|
-
altKey: modifiers.includes('Alt'),
|
|
49
|
-
shiftKey: modifiers.includes('Shift'),
|
|
50
|
-
metaKey: modifiers.includes('Meta'),
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const activeElement = document.activeElement || document.body;
|
|
54
|
-
|
|
55
|
-
if (action === 'press') {
|
|
56
|
-
activeElement.dispatchEvent(new KeyboardEvent('keydown', eventOptions));
|
|
57
|
-
activeElement.dispatchEvent(new KeyboardEvent('keypress', eventOptions));
|
|
58
|
-
activeElement.dispatchEvent(new KeyboardEvent('keyup', eventOptions));
|
|
59
|
-
return `Pressed key: ${key}${modifiers.length ? ' with ' + modifiers.join('+') : ''}`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (action === 'down') {
|
|
63
|
-
activeElement.dispatchEvent(new KeyboardEvent('keydown', eventOptions));
|
|
64
|
-
return `Key down: ${key}${modifiers.length ? ' with ' + modifiers.join('+') : ''}`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (action === 'up') {
|
|
68
|
-
activeElement.dispatchEvent(new KeyboardEvent('keyup', eventOptions));
|
|
69
|
-
return `Key up: ${key}${modifiers.length ? ' with ' + modifiers.join('+') : ''}`;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
throw new Error(`Unknown action: ${action}`);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Export for use
|
|
76
|
-
({ typeText, keyEvent })
|