@moxxy/plugin-computer-control 0.41.2 → 0.42.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/bin/win32-x64/moxxy-computer.exe +0 -0
- package/bin/win32-x64/moxxy-computer.exe.json +1 -1
- package/dist/backend/access.d.ts +129 -0
- package/dist/backend/access.d.ts.map +1 -0
- package/dist/backend/access.js +158 -0
- package/dist/backend/access.js.map +1 -0
- package/dist/backend/app-hints.d.ts +14 -0
- package/dist/backend/app-hints.d.ts.map +1 -0
- package/dist/backend/app-hints.js +30 -0
- package/dist/backend/app-hints.js.map +1 -0
- package/dist/backend/backend.d.ts +70 -0
- package/dist/backend/backend.d.ts.map +1 -0
- package/dist/backend/backend.js +466 -0
- package/dist/backend/backend.js.map +1 -0
- package/dist/backend/rpc.d.ts +1438 -0
- package/dist/backend/rpc.d.ts.map +1 -0
- package/dist/backend/rpc.js +75 -0
- package/dist/backend/rpc.js.map +1 -0
- package/dist/backend/turn-controls.d.ts +20 -0
- package/dist/backend/turn-controls.d.ts.map +1 -0
- package/dist/backend/turn-controls.js +115 -0
- package/dist/backend/turn-controls.js.map +1 -0
- package/dist/contract/guidance.d.ts +12 -0
- package/dist/contract/guidance.d.ts.map +1 -0
- package/dist/contract/guidance.js +42 -0
- package/dist/contract/guidance.js.map +1 -0
- package/dist/contract/image.d.ts +29 -0
- package/dist/contract/image.d.ts.map +1 -0
- package/dist/contract/image.js +46 -0
- package/dist/contract/image.js.map +1 -0
- package/dist/contract/keys.d.ts +15 -0
- package/dist/contract/keys.d.ts.map +1 -0
- package/dist/contract/keys.js +118 -0
- package/dist/contract/keys.js.map +1 -0
- package/dist/contract/outcome.d.ts +61 -0
- package/dist/contract/outcome.d.ts.map +1 -0
- package/dist/contract/outcome.js +63 -0
- package/dist/contract/outcome.js.map +1 -0
- package/dist/contract/progress.d.ts +27 -0
- package/dist/contract/progress.d.ts.map +1 -0
- package/dist/contract/progress.js +36 -0
- package/dist/contract/progress.js.map +1 -0
- package/dist/contract/tools.d.ts +338 -0
- package/dist/contract/tools.d.ts.map +1 -0
- package/dist/contract/tools.js +195 -0
- package/dist/contract/tools.js.map +1 -0
- package/dist/contract/untrusted.d.ts +3 -0
- package/dist/contract/untrusted.d.ts.map +1 -0
- package/dist/contract/untrusted.js +8 -0
- package/dist/contract/untrusted.js.map +1 -0
- package/dist/helper/artifact.d.ts +41 -0
- package/dist/helper/artifact.d.ts.map +1 -0
- package/dist/helper/artifact.js +189 -0
- package/dist/helper/artifact.js.map +1 -0
- package/dist/helper/protocol.d.ts +80 -0
- package/dist/helper/protocol.d.ts.map +1 -0
- package/dist/helper/protocol.js +49 -0
- package/dist/helper/protocol.js.map +1 -0
- package/dist/helper/transport.d.ts +43 -0
- package/dist/helper/transport.d.ts.map +1 -0
- package/dist/{windows → helper}/transport.js +45 -19
- package/dist/helper/transport.js.map +1 -0
- package/dist/index.d.ts +9 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -42
- package/dist/index.js.map +1 -1
- package/dist/jev/ladder.d.ts +32 -0
- package/dist/jev/ladder.d.ts.map +1 -0
- package/dist/jev/ladder.js +66 -0
- package/dist/jev/ladder.js.map +1 -0
- package/dist/jev/memory.d.ts +11 -0
- package/dist/jev/memory.d.ts.map +1 -0
- package/dist/jev/memory.js +16 -0
- package/dist/jev/memory.js.map +1 -0
- package/dist/jev/run.d.ts +93 -0
- package/dist/jev/run.d.ts.map +1 -0
- package/dist/jev/run.js +403 -0
- package/dist/jev/run.js.map +1 -0
- package/dist/jev/train.d.ts +97 -0
- package/dist/jev/train.d.ts.map +1 -0
- package/dist/jev/train.js +28 -0
- package/dist/jev/train.js.map +1 -0
- package/dist/linux/profile.d.ts +6 -0
- package/dist/linux/profile.d.ts.map +1 -0
- package/dist/linux/profile.js +21 -0
- package/dist/linux/profile.js.map +1 -0
- package/dist/macos/profile.d.ts +5 -0
- package/dist/macos/profile.d.ts.map +1 -0
- package/dist/macos/profile.js +17 -0
- package/dist/macos/profile.js.map +1 -0
- package/dist/preview/controller.d.ts +127 -0
- package/dist/preview/controller.d.ts.map +1 -0
- package/dist/preview/controller.js +203 -0
- package/dist/preview/controller.js.map +1 -0
- package/dist/preview/surface.d.ts +9 -0
- package/dist/preview/surface.d.ts.map +1 -0
- package/dist/preview/surface.js +50 -0
- package/dist/preview/surface.js.map +1 -0
- package/dist/windows/maintenance.d.ts +1 -1
- package/dist/windows/maintenance.d.ts.map +1 -1
- package/dist/windows/maintenance.js +6 -5
- package/dist/windows/maintenance.js.map +1 -1
- package/dist/windows/profile.d.ts +5 -0
- package/dist/windows/profile.d.ts.map +1 -0
- package/dist/windows/profile.js +17 -0
- package/dist/windows/profile.js.map +1 -0
- package/learned/README.md +26 -0
- package/learned/cases/com.apple.calculator.json +395 -0
- package/learned/cases/com.apple.finder.json +115 -0
- package/learned/cases/com.apple.safari.json +112 -0
- package/learned/cases/com.apple.systempreferences.json +255 -0
- package/learned/com.apple.calculator-eace95fc.json +334 -0
- package/learned/com.apple.finder-27cf6ce8.json +260 -0
- package/learned/com.apple.safari-7cd9df4f.json +143 -0
- package/learned/com.apple.systempreferences-02cf0b8b.json +535 -0
- package/package.json +13 -7
- package/scripts/promote-learned.mjs +8 -0
- package/scripts/summarize-trial.mjs +68 -0
- package/scripts/train-learned.mjs +64 -0
- package/skills/computer-apps/blender.md +29 -0
- package/skills/computer-apps/browsers.md +50 -0
- package/skills/computer-apps/design-tools.md +37 -0
- package/skills/computer-apps/finder.md +23 -0
- package/skills/computer-apps/office.md +46 -0
- package/skills/computer-apps/video-editors.md +44 -0
- package/skills/computer-control.md +154 -191
- package/src/backend/access.test.ts +158 -0
- package/src/backend/access.ts +168 -0
- package/src/backend/app-hints.test.ts +59 -0
- package/src/backend/app-hints.ts +39 -0
- package/src/backend/backend.test.ts +725 -0
- package/src/backend/backend.ts +482 -0
- package/src/backend/contract-helper.fixture.mjs +138 -0
- package/src/backend/helper.fixture.ts +38 -0
- package/src/backend/rpc.ts +90 -0
- package/src/backend/turn-controls.test.ts +178 -0
- package/src/backend/turn-controls.ts +120 -0
- package/src/contract/guidance.test.ts +75 -0
- package/src/contract/guidance.ts +48 -0
- package/src/contract/image.test.ts +74 -0
- package/src/contract/image.ts +54 -0
- package/src/contract/keys.test.ts +103 -0
- package/src/contract/keys.ts +117 -0
- package/src/contract/outcome.test.ts +71 -0
- package/src/contract/outcome.ts +72 -0
- package/src/contract/progress.test.ts +56 -0
- package/src/contract/progress.ts +43 -0
- package/src/contract/tools.test.ts +210 -0
- package/src/contract/tools.ts +212 -0
- package/src/contract/untrusted.test.ts +20 -0
- package/src/contract/untrusted.ts +8 -0
- package/src/helper/artifact.test.ts +131 -0
- package/src/helper/artifact.ts +182 -0
- package/src/helper/protocol.test.ts +29 -0
- package/src/helper/protocol.ts +50 -0
- package/src/{windows → helper}/transport.test.ts +76 -19
- package/src/{windows → helper}/transport.ts +54 -16
- package/src/index.test.ts +112 -0
- package/src/index.ts +36 -53
- package/src/jev/ladder.test.ts +113 -0
- package/src/jev/ladder.ts +88 -0
- package/src/jev/memory.ts +20 -0
- package/src/jev/run.test.ts +700 -0
- package/src/jev/run.ts +443 -0
- package/src/jev/train.test.ts +40 -0
- package/src/jev/train.ts +41 -0
- package/src/linux/helper.test.ts +481 -0
- package/src/linux/profile.ts +25 -0
- package/src/macos/helper.test.ts +988 -0
- package/src/macos/profile.ts +19 -0
- package/src/preview/controller.test.ts +308 -0
- package/src/preview/controller.ts +262 -0
- package/src/preview/surface.test.ts +68 -0
- package/src/preview/surface.ts +45 -0
- package/src/skill.test.ts +34 -0
- package/src/windows/maintenance.ts +8 -7
- package/src/windows/profile.ts +19 -0
- package/dist/shell.d.ts +0 -56
- package/dist/shell.d.ts.map +0 -1
- package/dist/shell.js +0 -189
- package/dist/shell.js.map +0 -1
- package/dist/temporary-files.d.ts +0 -2
- package/dist/temporary-files.d.ts.map +0 -1
- package/dist/temporary-files.js +0 -10
- package/dist/temporary-files.js.map +0 -1
- package/dist/tools/applescript.d.ts +0 -2
- package/dist/tools/applescript.d.ts.map +0 -1
- package/dist/tools/applescript.js +0 -50
- package/dist/tools/applescript.js.map +0 -1
- package/dist/tools/click.d.ts +0 -2
- package/dist/tools/click.d.ts.map +0 -1
- package/dist/tools/click.js +0 -58
- package/dist/tools/click.js.map +0 -1
- package/dist/tools/clipboard.d.ts +0 -2
- package/dist/tools/clipboard.d.ts.map +0 -1
- package/dist/tools/clipboard.js +0 -71
- package/dist/tools/clipboard.js.map +0 -1
- package/dist/tools/key.d.ts +0 -11
- package/dist/tools/key.d.ts.map +0 -1
- package/dist/tools/key.js +0 -143
- package/dist/tools/key.js.map +0 -1
- package/dist/tools/open.d.ts +0 -2
- package/dist/tools/open.d.ts.map +0 -1
- package/dist/tools/open.js +0 -91
- package/dist/tools/open.js.map +0 -1
- package/dist/tools/screenshot.d.ts +0 -2
- package/dist/tools/screenshot.d.ts.map +0 -1
- package/dist/tools/screenshot.js +0 -162
- package/dist/tools/screenshot.js.map +0 -1
- package/dist/tools/type.d.ts +0 -8
- package/dist/tools/type.d.ts.map +0 -1
- package/dist/tools/type.js +0 -65
- package/dist/tools/type.js.map +0 -1
- package/dist/windows/artifact.d.ts +0 -3
- package/dist/windows/artifact.d.ts.map +0 -1
- package/dist/windows/artifact.js +0 -57
- package/dist/windows/artifact.js.map +0 -1
- package/dist/windows/backend.d.ts +0 -11
- package/dist/windows/backend.d.ts.map +0 -1
- package/dist/windows/backend.js +0 -122
- package/dist/windows/backend.js.map +0 -1
- package/dist/windows/contracts.d.ts +0 -1627
- package/dist/windows/contracts.d.ts.map +0 -1
- package/dist/windows/contracts.js +0 -137
- package/dist/windows/contracts.js.map +0 -1
- package/dist/windows/control-service.d.ts +0 -12
- package/dist/windows/control-service.d.ts.map +0 -1
- package/dist/windows/control-service.js +0 -65
- package/dist/windows/control-service.js.map +0 -1
- package/dist/windows/guidance.d.ts +0 -3
- package/dist/windows/guidance.d.ts.map +0 -1
- package/dist/windows/guidance.js +0 -20
- package/dist/windows/guidance.js.map +0 -1
- package/dist/windows/protocol.d.ts +0 -9
- package/dist/windows/protocol.d.ts.map +0 -1
- package/dist/windows/protocol.js +0 -32
- package/dist/windows/protocol.js.map +0 -1
- package/dist/windows/transport.d.ts +0 -23
- package/dist/windows/transport.d.ts.map +0 -1
- package/dist/windows/transport.js.map +0 -1
- package/src/shell.test.ts +0 -186
- package/src/shell.ts +0 -213
- package/src/temporary-files.test.ts +0 -18
- package/src/temporary-files.ts +0 -9
- package/src/tools/applescript-serialize.test.ts +0 -74
- package/src/tools/applescript.ts +0 -53
- package/src/tools/click.ts +0 -60
- package/src/tools/clipboard.ts +0 -72
- package/src/tools/key.ts +0 -155
- package/src/tools/open.ts +0 -96
- package/src/tools/screenshot.test.ts +0 -137
- package/src/tools/screenshot.ts +0 -180
- package/src/tools/type.ts +0 -68
- package/src/tools.test.ts +0 -94
- package/src/windows/action-contracts.test.ts +0 -13
- package/src/windows/artifact.test.ts +0 -16
- package/src/windows/artifact.ts +0 -57
- package/src/windows/backend.test.ts +0 -41
- package/src/windows/backend.ts +0 -122
- package/src/windows/contracts.test.ts +0 -81
- package/src/windows/contracts.ts +0 -143
- package/src/windows/control-service.test.ts +0 -58
- package/src/windows/control-service.ts +0 -68
- package/src/windows/guidance.test.ts +0 -29
- package/src/windows/guidance.ts +0 -21
- package/src/windows/model-contract.test.ts +0 -37
- package/src/windows/protocol.ts +0 -27
- package/src/windows/text-contracts.test.ts +0 -14
- package/src/windows/window-typing.test.ts +0 -14
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Why an action did not go through, with the model's next step. One table for every platform. */
|
|
3
|
+
declare const hints: {
|
|
4
|
+
readonly app_not_allowed: "Ask for this app with computer_request_access, or finish the task without it.";
|
|
5
|
+
readonly app_not_found: "Check the name with computer_list_apps and use the bundle identifier or app id it returns.";
|
|
6
|
+
readonly ambiguous_app: "Several apps match that name; pick one id from computer_list_apps.";
|
|
7
|
+
readonly tier_insufficient: "The grant for this app does not allow this action; ask the user for a higher level with computer_request_access or use a read-only path.";
|
|
8
|
+
readonly permissions_not_granted: "The operating system has not granted Accessibility or Screen Recording; ask the user to allow it in System Settings, then try again.";
|
|
9
|
+
readonly permissions_pending: "The user has not answered the permission prompt yet; wait for the answer before acting.";
|
|
10
|
+
readonly user_stopped: "The user stopped Computer Use; do not act again until they ask.";
|
|
11
|
+
readonly user_intervened: "The user took over the mouse or keyboard; the action was paused. Observe again once they resume.";
|
|
12
|
+
readonly screen_locked: "The screen is locked; ask the user to unlock it.";
|
|
13
|
+
readonly not_frontmost: "Another app came to the front; call computer_get_app_state for the target app and retry only if it is still needed.";
|
|
14
|
+
readonly target_blocked: "A dialog or sheet covers the target; handle it first, based on a fresh computer_get_app_state.";
|
|
15
|
+
readonly hit_test_mismatch: "Something else is at that point now; call computer_get_app_state and target by element_index.";
|
|
16
|
+
readonly point_outside_frame: "Use coordinates inside the latest screenshot of this window.";
|
|
17
|
+
readonly screen_changed: "The pixels at the target changed since the last screenshot; call computer_get_app_state before clicking.";
|
|
18
|
+
readonly stale_state: "That index or point belongs to an older state; call computer_get_app_state and use its indices.";
|
|
19
|
+
readonly no_state: "Call computer_get_app_state for this app first; actions use its indices and screenshot coordinates.";
|
|
20
|
+
readonly unsupported_action: "This element does not support that action; use an action listed for it or click by coordinates.";
|
|
21
|
+
readonly canvas: "The point is on a canvas without accessibility; use computer_click or computer_drag on screenshot coordinates, or keyboard shortcuts.";
|
|
22
|
+
readonly would_replace_content: "Typing would replace the whole field; select the insertion point first or confirm with the user.";
|
|
23
|
+
readonly system_key_combo: "System key combinations need the systemKeyCombos grant from computer_request_access.";
|
|
24
|
+
readonly clipboard_not_granted: "Clipboard access needs the clipboardRead or clipboardWrite grant from computer_request_access.";
|
|
25
|
+
readonly own_window: "That target belongs to Moxxy itself; act only on the granted app.";
|
|
26
|
+
readonly protected_path: "A save dialog points at a protected location; choose a different folder or ask the user.";
|
|
27
|
+
readonly no_progress: "The same action left the app unchanged twice; try another method (element action, keyboard shortcut, menu or coordinates).";
|
|
28
|
+
readonly invalid_key: "Use xdotool key syntax such as \"Return\", \"Tab\", \"super+c\", \"ctrl+shift+Tab\", \"Page_Down\" or \"KP_0\".";
|
|
29
|
+
readonly timeout: "The app did not respond in time; the action was not retried. Observe again before deciding.";
|
|
30
|
+
readonly helper_failed: "The native helper failed or answered unexpectedly; the action was not retried. Observe again before deciding.";
|
|
31
|
+
readonly page_loading: "The click followed a link to another page, and after several seconds the page has not changed: it is probably still loading. Look again with computer_get_app_state before you act; clicking the link again, double-clicking it or pressing Return on it can start the same thing twice (a second new design, a second order).";
|
|
32
|
+
};
|
|
33
|
+
export type ErrorCode = keyof typeof hints;
|
|
34
|
+
export declare const errorCodes: ErrorCode[];
|
|
35
|
+
export declare function isErrorCode(value: string): value is ErrorCode;
|
|
36
|
+
export declare function hintFor(code: ErrorCode): string;
|
|
37
|
+
/** Technical result of one action; `delivered` means sent, never verified. */
|
|
38
|
+
export declare const actionResultSchema: z.ZodObject<{
|
|
39
|
+
outcome: z.ZodEnum<["delivered", "ineffective", "unsupported", "blocked"]>;
|
|
40
|
+
code: z.ZodOptional<z.ZodEnum<["app_not_allowed" | "app_not_found" | "ambiguous_app" | "tier_insufficient" | "permissions_not_granted" | "permissions_pending" | "user_stopped" | "user_intervened" | "screen_locked" | "not_frontmost" | "target_blocked" | "hit_test_mismatch" | "point_outside_frame" | "screen_changed" | "stale_state" | "no_state" | "unsupported_action" | "canvas" | "would_replace_content" | "system_key_combo" | "clipboard_not_granted" | "own_window" | "protected_path" | "no_progress" | "invalid_key" | "timeout" | "helper_failed" | "page_loading", ...("app_not_allowed" | "app_not_found" | "ambiguous_app" | "tier_insufficient" | "permissions_not_granted" | "permissions_pending" | "user_stopped" | "user_intervened" | "screen_locked" | "not_frontmost" | "target_blocked" | "hit_test_mismatch" | "point_outside_frame" | "screen_changed" | "stale_state" | "no_state" | "unsupported_action" | "canvas" | "would_replace_content" | "system_key_combo" | "clipboard_not_granted" | "own_window" | "protected_path" | "no_progress" | "invalid_key" | "timeout" | "helper_failed" | "page_loading")[]]>>;
|
|
41
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
42
|
+
method: z.ZodOptional<z.ZodEnum<["ax", "input", "background"]>>;
|
|
43
|
+
}, "strict", z.ZodTypeAny, {
|
|
44
|
+
outcome: "delivered" | "ineffective" | "unsupported" | "blocked";
|
|
45
|
+
code?: "app_not_allowed" | "app_not_found" | "ambiguous_app" | "tier_insufficient" | "permissions_not_granted" | "permissions_pending" | "user_stopped" | "user_intervened" | "screen_locked" | "not_frontmost" | "target_blocked" | "hit_test_mismatch" | "point_outside_frame" | "screen_changed" | "stale_state" | "no_state" | "unsupported_action" | "canvas" | "would_replace_content" | "system_key_combo" | "clipboard_not_granted" | "own_window" | "protected_path" | "no_progress" | "invalid_key" | "timeout" | "helper_failed" | "page_loading" | undefined;
|
|
46
|
+
hint?: string | undefined;
|
|
47
|
+
method?: "ax" | "input" | "background" | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
outcome: "delivered" | "ineffective" | "unsupported" | "blocked";
|
|
50
|
+
code?: "app_not_allowed" | "app_not_found" | "ambiguous_app" | "tier_insufficient" | "permissions_not_granted" | "permissions_pending" | "user_stopped" | "user_intervened" | "screen_locked" | "not_frontmost" | "target_blocked" | "hit_test_mismatch" | "point_outside_frame" | "screen_changed" | "stale_state" | "no_state" | "unsupported_action" | "canvas" | "would_replace_content" | "system_key_combo" | "clipboard_not_granted" | "own_window" | "protected_path" | "no_progress" | "invalid_key" | "timeout" | "helper_failed" | "page_loading" | undefined;
|
|
51
|
+
hint?: string | undefined;
|
|
52
|
+
method?: "ax" | "input" | "background" | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
export type ActionResult = z.infer<typeof actionResultSchema>;
|
|
55
|
+
export declare function describeResult(result: ActionResult): string;
|
|
56
|
+
export declare class ComputerUseError extends Error {
|
|
57
|
+
readonly code: ErrorCode;
|
|
58
|
+
constructor(code: ErrorCode, message: string);
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../../src/contract/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kGAAkG;AAClG,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BD,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,KAAK,CAAC;AAC3C,eAAO,MAAM,UAAU,EAAyB,SAAS,EAAE,CAAC;AAG5D,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,SAAS,CAE7D;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAE/C;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAKpB,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAM3D;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;gBAEb,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM;CAK7C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Why an action did not go through, with the model's next step. One table for every platform. */
|
|
3
|
+
const hints = {
|
|
4
|
+
app_not_allowed: 'Ask for this app with computer_request_access, or finish the task without it.',
|
|
5
|
+
app_not_found: 'Check the name with computer_list_apps and use the bundle identifier or app id it returns.',
|
|
6
|
+
ambiguous_app: 'Several apps match that name; pick one id from computer_list_apps.',
|
|
7
|
+
tier_insufficient: 'The grant for this app does not allow this action; ask the user for a higher level with computer_request_access or use a read-only path.',
|
|
8
|
+
permissions_not_granted: 'The operating system has not granted Accessibility or Screen Recording; ask the user to allow it in System Settings, then try again.',
|
|
9
|
+
permissions_pending: 'The user has not answered the permission prompt yet; wait for the answer before acting.',
|
|
10
|
+
user_stopped: 'The user stopped Computer Use; do not act again until they ask.',
|
|
11
|
+
user_intervened: 'The user took over the mouse or keyboard; the action was paused. Observe again once they resume.',
|
|
12
|
+
screen_locked: 'The screen is locked; ask the user to unlock it.',
|
|
13
|
+
not_frontmost: 'Another app came to the front; call computer_get_app_state for the target app and retry only if it is still needed.',
|
|
14
|
+
target_blocked: 'A dialog or sheet covers the target; handle it first, based on a fresh computer_get_app_state.',
|
|
15
|
+
hit_test_mismatch: 'Something else is at that point now; call computer_get_app_state and target by element_index.',
|
|
16
|
+
point_outside_frame: 'Use coordinates inside the latest screenshot of this window.',
|
|
17
|
+
screen_changed: 'The pixels at the target changed since the last screenshot; call computer_get_app_state before clicking.',
|
|
18
|
+
stale_state: 'That index or point belongs to an older state; call computer_get_app_state and use its indices.',
|
|
19
|
+
no_state: 'Call computer_get_app_state for this app first; actions use its indices and screenshot coordinates.',
|
|
20
|
+
unsupported_action: 'This element does not support that action; use an action listed for it or click by coordinates.',
|
|
21
|
+
canvas: 'The point is on a canvas without accessibility; use computer_click or computer_drag on screenshot coordinates, or keyboard shortcuts.',
|
|
22
|
+
would_replace_content: 'Typing would replace the whole field; select the insertion point first or confirm with the user.',
|
|
23
|
+
system_key_combo: 'System key combinations need the systemKeyCombos grant from computer_request_access.',
|
|
24
|
+
clipboard_not_granted: 'Clipboard access needs the clipboardRead or clipboardWrite grant from computer_request_access.',
|
|
25
|
+
own_window: 'That target belongs to Moxxy itself; act only on the granted app.',
|
|
26
|
+
protected_path: 'A save dialog points at a protected location; choose a different folder or ask the user.',
|
|
27
|
+
no_progress: 'The same action left the app unchanged twice; try another method (element action, keyboard shortcut, menu or coordinates).',
|
|
28
|
+
invalid_key: 'Use xdotool key syntax such as "Return", "Tab", "super+c", "ctrl+shift+Tab", "Page_Down" or "KP_0".',
|
|
29
|
+
timeout: 'The app did not respond in time; the action was not retried. Observe again before deciding.',
|
|
30
|
+
helper_failed: 'The native helper failed or answered unexpectedly; the action was not retried. Observe again before deciding.',
|
|
31
|
+
page_loading: 'The click followed a link to another page, and after several seconds the page has not changed: it is probably still loading. Look again with computer_get_app_state before you act; clicking the link again, double-clicking it or pressing Return on it can start the same thing twice (a second new design, a second order).',
|
|
32
|
+
};
|
|
33
|
+
export const errorCodes = Object.keys(hints);
|
|
34
|
+
const errorCodeSchema = z.enum(errorCodes);
|
|
35
|
+
export function isErrorCode(value) {
|
|
36
|
+
return Object.hasOwn(hints, value);
|
|
37
|
+
}
|
|
38
|
+
export function hintFor(code) {
|
|
39
|
+
return hints[code];
|
|
40
|
+
}
|
|
41
|
+
/** Technical result of one action; `delivered` means sent, never verified. */
|
|
42
|
+
export const actionResultSchema = z.object({
|
|
43
|
+
outcome: z.enum(['delivered', 'ineffective', 'unsupported', 'blocked']),
|
|
44
|
+
code: errorCodeSchema.optional(),
|
|
45
|
+
hint: z.string().max(1000).optional(),
|
|
46
|
+
method: z.enum(['ax', 'input', 'background']).optional(),
|
|
47
|
+
}).strict();
|
|
48
|
+
export function describeResult(result) {
|
|
49
|
+
if (result.outcome === 'delivered') {
|
|
50
|
+
return ['Action delivered; verify its effect in the new state before relying on it.', result.code ? hintFor(result.code) : undefined].filter(Boolean).join(' ');
|
|
51
|
+
}
|
|
52
|
+
const hint = result.hint ?? (result.code ? hintFor(result.code) : undefined);
|
|
53
|
+
return [`Action ${result.outcome}${result.code ? ` (${result.code})` : ''}.`, hint].filter(Boolean).join(' ');
|
|
54
|
+
}
|
|
55
|
+
export class ComputerUseError extends Error {
|
|
56
|
+
code;
|
|
57
|
+
constructor(code, message) {
|
|
58
|
+
super(`${message}. ${hintFor(code)}`);
|
|
59
|
+
this.name = 'ComputerUseError';
|
|
60
|
+
this.code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E,GAAG,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChH,CAAC;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,CAAY;IAEzB,YAAY,IAAe,EAAE,OAAe;QAC1C,KAAK,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AppTree } from '@moxxy/jev';
|
|
2
|
+
/** What the model can see of an app: its tree and its screenshot. Pixels count, so canvas work is progress. */
|
|
3
|
+
export declare function fingerprint(tree: AppTree, image?: {
|
|
4
|
+
base64: string;
|
|
5
|
+
}): string;
|
|
6
|
+
type Look = {
|
|
7
|
+
readonly tree: AppTree;
|
|
8
|
+
readonly screenshot?: {
|
|
9
|
+
readonly base64: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Whether the window changed between two looks: by elements and picture when both have a picture, else by the
|
|
14
|
+
* elements alone, without their places (which come with a picture).
|
|
15
|
+
*/
|
|
16
|
+
export declare function looksDifferent(a: Look, b: Look): boolean;
|
|
17
|
+
/** Each app's last action, and how many times in a row it left the app looking the same. */
|
|
18
|
+
export declare class ProgressTracker {
|
|
19
|
+
private readonly last;
|
|
20
|
+
/** The same action a third time after two that changed nothing is refused before it is sent. */
|
|
21
|
+
check(app: string, signature: string): void;
|
|
22
|
+
/** Returns how many times in a row `signature` has now left `app` unchanged (0 after a change). */
|
|
23
|
+
record(app: string, signature: string, changed: boolean): number;
|
|
24
|
+
forget(app: string): void;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/contract/progress.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,+GAA+G;AAC/G,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE7E;AAED,KAAK,IAAI,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAE1F;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO,CAIxD;AAED,4FAA4F;AAC5F,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA+D;IAEpF,gGAAgG;IAChG,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAO3C,mGAAmG;IACnG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM;IAOhE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAC1B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { ComputerUseError } from './outcome.js';
|
|
3
|
+
/** What the model can see of an app: its tree and its screenshot. Pixels count, so canvas work is progress. */
|
|
4
|
+
export function fingerprint(tree, image) {
|
|
5
|
+
return createHash('sha256').update(JSON.stringify(tree)).update('\0').update(image ? image.base64 : '-').digest('hex');
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Whether the window changed between two looks: by elements and picture when both have a picture, else by the
|
|
9
|
+
* elements alone, without their places (which come with a picture).
|
|
10
|
+
*/
|
|
11
|
+
export function looksDifferent(a, b) {
|
|
12
|
+
if (a.screenshot && b.screenshot)
|
|
13
|
+
return fingerprint(a.tree, a.screenshot) !== fingerprint(b.tree, b.screenshot);
|
|
14
|
+
const placeless = (tree) => ({ ...tree, elements: tree.elements.map(({ frame: _, ...element }) => element) });
|
|
15
|
+
return fingerprint(placeless(a.tree)) !== fingerprint(placeless(b.tree));
|
|
16
|
+
}
|
|
17
|
+
/** Each app's last action, and how many times in a row it left the app looking the same. */
|
|
18
|
+
export class ProgressTracker {
|
|
19
|
+
last = new Map();
|
|
20
|
+
/** The same action a third time after two that changed nothing is refused before it is sent. */
|
|
21
|
+
check(app, signature) {
|
|
22
|
+
const last = this.last.get(app);
|
|
23
|
+
if (last && last.signature === signature && last.unchanged >= 2) {
|
|
24
|
+
throw new ComputerUseError('no_progress', 'This exact action already left the app unchanged twice and was not sent again');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Returns how many times in a row `signature` has now left `app` unchanged (0 after a change). */
|
|
28
|
+
record(app, signature, changed) {
|
|
29
|
+
const last = this.last.get(app);
|
|
30
|
+
const unchanged = changed ? 0 : (last?.signature === signature ? last.unchanged : 0) + 1;
|
|
31
|
+
this.last.set(app, { signature, unchanged });
|
|
32
|
+
return unchanged;
|
|
33
|
+
}
|
|
34
|
+
forget(app) { this.last.delete(app); }
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/contract/progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,+GAA+G;AAC/G,MAAM,UAAU,WAAW,CAAC,IAAa,EAAE,KAA0B;IACnE,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,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CAAC;QAC7H,CAAC;IACH,CAAC;IAED,mGAAmG;IACnG,MAAM,CAAC,GAAW,EAAE,SAAiB,EAAE,OAAgB;QACrD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACzF,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;QAC7C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,GAAW,IAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrD"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { pointsAtFocus, wordsIn } from '@moxxy/jev';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
type TargetInput = {
|
|
4
|
+
element_index?: number;
|
|
5
|
+
x?: number;
|
|
6
|
+
y?: number;
|
|
7
|
+
};
|
|
8
|
+
export type Target = {
|
|
9
|
+
kind: 'element';
|
|
10
|
+
index: number;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'point';
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'focused';
|
|
17
|
+
};
|
|
18
|
+
export declare function resolveTarget(input: TargetInput): Target;
|
|
19
|
+
type TargetRule = 'required' | 'optional' | undefined;
|
|
20
|
+
interface ActionDef<S extends z.ZodRawShape> {
|
|
21
|
+
readonly shape: S;
|
|
22
|
+
readonly target: TargetRule;
|
|
23
|
+
}
|
|
24
|
+
/** Actions on one app, without the `app` field. */
|
|
25
|
+
declare const actions: {
|
|
26
|
+
click: ActionDef<{
|
|
27
|
+
element_index: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
} & {
|
|
31
|
+
mouse_button: z.ZodDefault<z.ZodEnum<["left", "right", "middle"]>>;
|
|
32
|
+
click_count: z.ZodDefault<z.ZodNumber>;
|
|
33
|
+
modifiers: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
34
|
+
}>;
|
|
35
|
+
type_text: ActionDef<{
|
|
36
|
+
element_index: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
text: z.ZodString;
|
|
38
|
+
}>;
|
|
39
|
+
press_key: ActionDef<{
|
|
40
|
+
key: z.ZodEffects<z.ZodString, string, string>;
|
|
41
|
+
repeat: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
}>;
|
|
43
|
+
scroll: ActionDef<{
|
|
44
|
+
element_index: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
x: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
y: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
} & {
|
|
48
|
+
direction: z.ZodEnum<["up", "down", "left", "right"]>;
|
|
49
|
+
pages: z.ZodDefault<z.ZodNumber>;
|
|
50
|
+
}>;
|
|
51
|
+
drag: ActionDef<{
|
|
52
|
+
from_x: z.ZodNumber;
|
|
53
|
+
from_y: z.ZodNumber;
|
|
54
|
+
to_x: z.ZodNumber;
|
|
55
|
+
to_y: z.ZodNumber;
|
|
56
|
+
}>;
|
|
57
|
+
set_value: ActionDef<{
|
|
58
|
+
element_index: z.ZodNumber;
|
|
59
|
+
value: z.ZodString;
|
|
60
|
+
}>;
|
|
61
|
+
perform_secondary_action: ActionDef<{
|
|
62
|
+
element_index: z.ZodNumber;
|
|
63
|
+
secondary_action: z.ZodString;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
type ActionName = keyof typeof actions;
|
|
67
|
+
type ActionOutput<N extends ActionName> = z.output<z.ZodObject<(typeof actions)[N]['shape'], 'strict'>>;
|
|
68
|
+
export declare const actionNames: ActionName[];
|
|
69
|
+
/** One action as the backend hands it on: its name and its parsed fields. */
|
|
70
|
+
export type ComputerAction = {
|
|
71
|
+
[N in ActionName]: {
|
|
72
|
+
action: N;
|
|
73
|
+
} & ActionOutput<N>;
|
|
74
|
+
}[ActionName];
|
|
75
|
+
/** One step of computer_run: what to do, the element in words, and what must show afterwards. */
|
|
76
|
+
export declare const runStepShape: z.ZodObject<{
|
|
77
|
+
do: z.ZodEnum<["click", "type", "set_value", "key", "scroll"]>;
|
|
78
|
+
target: z.ZodOptional<z.ZodString>;
|
|
79
|
+
text: z.ZodOptional<z.ZodString>;
|
|
80
|
+
key: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
81
|
+
direction: z.ZodOptional<z.ZodEnum<["up", "down", "left", "right"]>>;
|
|
82
|
+
expect: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, "strict", z.ZodTypeAny, {
|
|
84
|
+
do: "type" | "key" | "click" | "scroll" | "set_value";
|
|
85
|
+
key?: string | undefined;
|
|
86
|
+
text?: string | undefined;
|
|
87
|
+
direction?: "up" | "down" | "left" | "right" | undefined;
|
|
88
|
+
target?: string | undefined;
|
|
89
|
+
expect?: string | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
do: "type" | "key" | "click" | "scroll" | "set_value";
|
|
92
|
+
key?: string | undefined;
|
|
93
|
+
text?: string | undefined;
|
|
94
|
+
direction?: "up" | "down" | "left" | "right" | undefined;
|
|
95
|
+
target?: string | undefined;
|
|
96
|
+
expect?: string | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
export type RunStep = z.infer<typeof runStepShape>;
|
|
99
|
+
export { pointsAtFocus, wordsIn };
|
|
100
|
+
export interface ComputerToolSpec<I = unknown> {
|
|
101
|
+
readonly description: string;
|
|
102
|
+
readonly input: z.ZodType<I, z.ZodTypeDef, unknown>;
|
|
103
|
+
}
|
|
104
|
+
export declare const computerTools: {
|
|
105
|
+
computer_status: {
|
|
106
|
+
description: string;
|
|
107
|
+
input: z.ZodObject<{
|
|
108
|
+
open_settings: z.ZodOptional<z.ZodEnum<["accessibility", "screen_recording"]>>;
|
|
109
|
+
}, "strict", z.ZodTypeAny, {
|
|
110
|
+
open_settings?: "accessibility" | "screen_recording" | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
open_settings?: "accessibility" | "screen_recording" | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
};
|
|
115
|
+
computer_list_apps: {
|
|
116
|
+
description: string;
|
|
117
|
+
input: z.ZodObject<{
|
|
118
|
+
query: z.ZodOptional<z.ZodString>;
|
|
119
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
120
|
+
}, "strict", z.ZodTypeAny, {
|
|
121
|
+
limit: number;
|
|
122
|
+
query?: string | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
query?: string | undefined;
|
|
125
|
+
limit?: number | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
};
|
|
128
|
+
computer_request_access: {
|
|
129
|
+
description: string;
|
|
130
|
+
input: z.ZodEffects<z.ZodObject<{
|
|
131
|
+
apps: z.ZodArray<z.ZodString, "many">;
|
|
132
|
+
reason: z.ZodString;
|
|
133
|
+
clipboard_read: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
+
clipboard_write: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
system_key_combos: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
+
full_access: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
137
|
+
}, "strict", z.ZodTypeAny, {
|
|
138
|
+
apps: string[];
|
|
139
|
+
reason: string;
|
|
140
|
+
clipboard_read?: boolean | undefined;
|
|
141
|
+
clipboard_write?: boolean | undefined;
|
|
142
|
+
system_key_combos?: boolean | undefined;
|
|
143
|
+
full_access?: string[] | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
apps: string[];
|
|
146
|
+
reason: string;
|
|
147
|
+
clipboard_read?: boolean | undefined;
|
|
148
|
+
clipboard_write?: boolean | undefined;
|
|
149
|
+
system_key_combos?: boolean | undefined;
|
|
150
|
+
full_access?: string[] | undefined;
|
|
151
|
+
}>, {
|
|
152
|
+
apps: string[];
|
|
153
|
+
reason: string;
|
|
154
|
+
clipboard_read?: boolean | undefined;
|
|
155
|
+
clipboard_write?: boolean | undefined;
|
|
156
|
+
system_key_combos?: boolean | undefined;
|
|
157
|
+
full_access?: string[] | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
apps: string[];
|
|
160
|
+
reason: string;
|
|
161
|
+
clipboard_read?: boolean | undefined;
|
|
162
|
+
clipboard_write?: boolean | undefined;
|
|
163
|
+
system_key_combos?: boolean | undefined;
|
|
164
|
+
full_access?: string[] | undefined;
|
|
165
|
+
}>;
|
|
166
|
+
};
|
|
167
|
+
computer_get_app_state: {
|
|
168
|
+
description: string;
|
|
169
|
+
input: z.ZodEffects<z.ZodObject<{
|
|
170
|
+
app: z.ZodString;
|
|
171
|
+
window_id: z.ZodOptional<z.ZodString>;
|
|
172
|
+
disable_diff: z.ZodDefault<z.ZodBoolean>;
|
|
173
|
+
}, "strict", z.ZodTypeAny, {
|
|
174
|
+
app: string;
|
|
175
|
+
disable_diff: boolean;
|
|
176
|
+
window_id?: string | undefined;
|
|
177
|
+
}, {
|
|
178
|
+
app: string;
|
|
179
|
+
window_id?: string | undefined;
|
|
180
|
+
disable_diff?: boolean | undefined;
|
|
181
|
+
}>, {
|
|
182
|
+
app: string;
|
|
183
|
+
disable_diff: boolean;
|
|
184
|
+
window_id?: string | undefined;
|
|
185
|
+
}, unknown>;
|
|
186
|
+
};
|
|
187
|
+
computer_click: {
|
|
188
|
+
description: string;
|
|
189
|
+
input: z.ZodType<{
|
|
190
|
+
mouse_button: "left" | "right" | "middle";
|
|
191
|
+
click_count: number;
|
|
192
|
+
x?: number | undefined;
|
|
193
|
+
y?: number | undefined;
|
|
194
|
+
modifiers?: string | undefined;
|
|
195
|
+
element_index?: number | undefined;
|
|
196
|
+
} & {
|
|
197
|
+
app: string;
|
|
198
|
+
}, z.ZodTypeDef, unknown>;
|
|
199
|
+
};
|
|
200
|
+
computer_type_text: {
|
|
201
|
+
description: string;
|
|
202
|
+
input: z.ZodType<{
|
|
203
|
+
text: string;
|
|
204
|
+
element_index?: number | undefined;
|
|
205
|
+
} & {
|
|
206
|
+
app: string;
|
|
207
|
+
}, z.ZodTypeDef, unknown>;
|
|
208
|
+
};
|
|
209
|
+
computer_press_key: {
|
|
210
|
+
description: string;
|
|
211
|
+
input: z.ZodType<{
|
|
212
|
+
key: string;
|
|
213
|
+
repeat: number;
|
|
214
|
+
} & {
|
|
215
|
+
app: string;
|
|
216
|
+
}, z.ZodTypeDef, unknown>;
|
|
217
|
+
};
|
|
218
|
+
computer_scroll: {
|
|
219
|
+
description: string;
|
|
220
|
+
input: z.ZodType<{
|
|
221
|
+
direction: "up" | "down" | "left" | "right";
|
|
222
|
+
pages: number;
|
|
223
|
+
x?: number | undefined;
|
|
224
|
+
y?: number | undefined;
|
|
225
|
+
element_index?: number | undefined;
|
|
226
|
+
} & {
|
|
227
|
+
app: string;
|
|
228
|
+
}, z.ZodTypeDef, unknown>;
|
|
229
|
+
};
|
|
230
|
+
computer_drag: {
|
|
231
|
+
description: string;
|
|
232
|
+
input: z.ZodType<{
|
|
233
|
+
from_x: number;
|
|
234
|
+
from_y: number;
|
|
235
|
+
to_x: number;
|
|
236
|
+
to_y: number;
|
|
237
|
+
} & {
|
|
238
|
+
app: string;
|
|
239
|
+
}, z.ZodTypeDef, unknown>;
|
|
240
|
+
};
|
|
241
|
+
computer_set_value: {
|
|
242
|
+
description: string;
|
|
243
|
+
input: z.ZodType<{
|
|
244
|
+
value: string;
|
|
245
|
+
element_index: number;
|
|
246
|
+
} & {
|
|
247
|
+
app: string;
|
|
248
|
+
}, z.ZodTypeDef, unknown>;
|
|
249
|
+
};
|
|
250
|
+
computer_perform_secondary_action: {
|
|
251
|
+
description: string;
|
|
252
|
+
input: z.ZodType<{
|
|
253
|
+
element_index: number;
|
|
254
|
+
secondary_action: string;
|
|
255
|
+
} & {
|
|
256
|
+
app: string;
|
|
257
|
+
}, z.ZodTypeDef, unknown>;
|
|
258
|
+
};
|
|
259
|
+
computer_run: {
|
|
260
|
+
description: string;
|
|
261
|
+
input: z.ZodObject<{
|
|
262
|
+
app: z.ZodString;
|
|
263
|
+
goal: z.ZodString;
|
|
264
|
+
steps: z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
265
|
+
do: z.ZodEnum<["click", "type", "set_value", "key", "scroll"]>;
|
|
266
|
+
target: z.ZodOptional<z.ZodString>;
|
|
267
|
+
text: z.ZodOptional<z.ZodString>;
|
|
268
|
+
key: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
269
|
+
direction: z.ZodOptional<z.ZodEnum<["up", "down", "left", "right"]>>;
|
|
270
|
+
expect: z.ZodOptional<z.ZodString>;
|
|
271
|
+
}, "strict", z.ZodTypeAny, {
|
|
272
|
+
do: "type" | "key" | "click" | "scroll" | "set_value";
|
|
273
|
+
key?: string | undefined;
|
|
274
|
+
text?: string | undefined;
|
|
275
|
+
direction?: "up" | "down" | "left" | "right" | undefined;
|
|
276
|
+
target?: string | undefined;
|
|
277
|
+
expect?: string | undefined;
|
|
278
|
+
}, {
|
|
279
|
+
do: "type" | "key" | "click" | "scroll" | "set_value";
|
|
280
|
+
key?: string | undefined;
|
|
281
|
+
text?: string | undefined;
|
|
282
|
+
direction?: "up" | "down" | "left" | "right" | undefined;
|
|
283
|
+
target?: string | undefined;
|
|
284
|
+
expect?: string | undefined;
|
|
285
|
+
}>, {
|
|
286
|
+
do: "type" | "key" | "click" | "scroll" | "set_value";
|
|
287
|
+
key?: string | undefined;
|
|
288
|
+
text?: string | undefined;
|
|
289
|
+
direction?: "up" | "down" | "left" | "right" | undefined;
|
|
290
|
+
target?: string | undefined;
|
|
291
|
+
expect?: string | undefined;
|
|
292
|
+
}, {
|
|
293
|
+
do: "type" | "key" | "click" | "scroll" | "set_value";
|
|
294
|
+
key?: string | undefined;
|
|
295
|
+
text?: string | undefined;
|
|
296
|
+
direction?: "up" | "down" | "left" | "right" | undefined;
|
|
297
|
+
target?: string | undefined;
|
|
298
|
+
expect?: string | undefined;
|
|
299
|
+
}>, {
|
|
300
|
+
do: "type" | "key" | "click" | "scroll" | "set_value";
|
|
301
|
+
key?: string | undefined;
|
|
302
|
+
text?: string | undefined;
|
|
303
|
+
direction?: "up" | "down" | "left" | "right" | undefined;
|
|
304
|
+
target?: string | undefined;
|
|
305
|
+
expect?: string | undefined;
|
|
306
|
+
}, unknown>, "many">;
|
|
307
|
+
}, "strict", z.ZodTypeAny, {
|
|
308
|
+
app: string;
|
|
309
|
+
goal: string;
|
|
310
|
+
steps: {
|
|
311
|
+
do: "type" | "key" | "click" | "scroll" | "set_value";
|
|
312
|
+
key?: string | undefined;
|
|
313
|
+
text?: string | undefined;
|
|
314
|
+
direction?: "up" | "down" | "left" | "right" | undefined;
|
|
315
|
+
target?: string | undefined;
|
|
316
|
+
expect?: string | undefined;
|
|
317
|
+
}[];
|
|
318
|
+
}, {
|
|
319
|
+
app: string;
|
|
320
|
+
goal: string;
|
|
321
|
+
steps: unknown[];
|
|
322
|
+
}>;
|
|
323
|
+
};
|
|
324
|
+
computer_zoom: {
|
|
325
|
+
description: string;
|
|
326
|
+
input: z.ZodObject<{
|
|
327
|
+
app: z.ZodString;
|
|
328
|
+
region: z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, number[], number[]>;
|
|
329
|
+
}, "strict", z.ZodTypeAny, {
|
|
330
|
+
app: string;
|
|
331
|
+
region: number[];
|
|
332
|
+
}, {
|
|
333
|
+
app: string;
|
|
334
|
+
region: number[];
|
|
335
|
+
}>;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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