ucu-mcp 0.3.9 → 0.4.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.
- package/CHANGELOG.md +67 -3
- package/dist/bin/ucu-mcp.js +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +2 -2
- package/dist/src/mcp/server.js +1 -1
- package/dist/src/mcp/tools/app-tools.d.ts +2 -0
- package/dist/src/mcp/tools/app-tools.js +220 -0
- package/dist/src/mcp/tools/element-tools.d.ts +23 -0
- package/dist/src/mcp/tools/element-tools.js +59 -0
- package/dist/src/mcp/tools/helpers.d.ts +82 -0
- package/dist/src/mcp/tools/helpers.js +243 -0
- package/dist/src/mcp/tools/index.d.ts +19 -0
- package/dist/src/mcp/tools/index.js +54 -0
- package/dist/src/mcp/tools/input-tools.d.ts +2 -0
- package/dist/src/mcp/tools/input-tools.js +66 -0
- package/dist/src/mcp/tools/keyboard-tools.d.ts +2 -0
- package/dist/src/mcp/tools/keyboard-tools.js +35 -0
- package/dist/src/mcp/tools/screen-tools.d.ts +2 -0
- package/dist/src/mcp/tools/screen-tools.js +69 -0
- package/dist/src/mcp/tools.d.ts +9 -0
- package/dist/src/mcp/tools.js +96 -25
- package/dist/src/platform/base.d.ts +3 -0
- package/dist/src/platform/jxa-helpers.d.ts +11 -0
- package/dist/src/platform/jxa-helpers.js +206 -0
- package/dist/src/platform/macos/ax-tree.d.ts +4 -0
- package/dist/src/platform/macos/ax-tree.js +462 -0
- package/dist/src/platform/macos/base.d.ts +57 -0
- package/dist/src/platform/macos/base.js +92 -0
- package/dist/src/platform/macos/clipboard.d.ts +3 -0
- package/dist/src/platform/macos/clipboard.js +20 -0
- package/dist/src/platform/macos/element.d.ts +4 -0
- package/dist/src/platform/macos/element.js +212 -0
- package/dist/src/platform/macos/focus.d.ts +3 -0
- package/dist/src/platform/macos/focus.js +33 -0
- package/dist/src/platform/macos/helpers.d.ts +35 -0
- package/dist/src/platform/macos/helpers.js +54 -0
- package/dist/src/platform/macos/index.d.ts +2 -0
- package/dist/src/platform/macos/index.js +1 -0
- package/dist/src/platform/macos/input.d.ts +9 -0
- package/dist/src/platform/macos/input.js +62 -0
- package/dist/src/platform/macos/screen.d.ts +7 -0
- package/dist/src/platform/macos/screen.js +197 -0
- package/dist/src/platform/macos/window.d.ts +6 -0
- package/dist/src/platform/macos/window.js +251 -0
- package/dist/src/platform/macos.d.ts +1 -0
- package/dist/src/platform/macos.js +114 -583
- package/dist/src/safety/guard.js +1 -1
- package/dist/src/util/errors.d.ts +7 -2
- package/dist/src/util/errors.js +7 -3
- package/native/cgevent/cgevent-helper +0 -0
- package/native/ocr/ocr-helper +0 -0
- package/native/windowlist/windowlist-helper +0 -0
- package/package.json +1 -1
package/dist/src/safety/guard.js
CHANGED
|
@@ -233,7 +233,6 @@ export class SafetyGuard {
|
|
|
233
233
|
reason: `Rate-limited: ${elapsed}ms since last action (min ${this.rateLimitMs}ms)`,
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
|
-
this.lastActionTime = now;
|
|
237
236
|
// 6. User activity pause (skipped for observe-class actions) -----------------
|
|
238
237
|
if (!options.skipUserActivityPause && this.isUserActivityPauseActive()) {
|
|
239
238
|
return {
|
|
@@ -241,6 +240,7 @@ export class SafetyGuard {
|
|
|
241
240
|
reason: `User activity detected — pausing automation for ${this.userActivityPauseMs}ms`,
|
|
242
241
|
};
|
|
243
242
|
}
|
|
243
|
+
this.lastActionTime = now;
|
|
244
244
|
return { allowed: true };
|
|
245
245
|
}
|
|
246
246
|
// -----------------------------------------------------------------------
|
|
@@ -10,13 +10,16 @@ export declare class UcuError extends Error {
|
|
|
10
10
|
static readonly defaultCode: string;
|
|
11
11
|
readonly code: string;
|
|
12
12
|
readonly retryable: boolean;
|
|
13
|
-
|
|
13
|
+
/** Optional inline remediation hint surfaced by the platform layer. */
|
|
14
|
+
readonly hint?: string;
|
|
15
|
+
constructor(message: string, code?: string, retryable?: boolean, hint?: string);
|
|
14
16
|
/** Serialize for MCP response / JSON.stringify. */
|
|
15
17
|
toJSON(): {
|
|
16
18
|
name: string;
|
|
17
19
|
code: string;
|
|
18
20
|
retryable: boolean;
|
|
19
21
|
message: string;
|
|
22
|
+
hint?: string;
|
|
20
23
|
};
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
@@ -45,7 +48,9 @@ export declare class PermissionError extends UcuError {
|
|
|
45
48
|
*/
|
|
46
49
|
export declare class WindowNotFoundError extends UcuError {
|
|
47
50
|
static readonly defaultCode = "WINDOW_NOT_FOUND";
|
|
48
|
-
constructor(windowId: string
|
|
51
|
+
constructor(windowId: string, options?: {
|
|
52
|
+
hint?: string;
|
|
53
|
+
});
|
|
49
54
|
}
|
|
50
55
|
/**
|
|
51
56
|
* Active target window is no longer available.
|
package/dist/src/util/errors.js
CHANGED
|
@@ -13,7 +13,9 @@ export class UcuError extends Error {
|
|
|
13
13
|
static defaultCode = "UCU_ERROR";
|
|
14
14
|
code;
|
|
15
15
|
retryable;
|
|
16
|
-
|
|
16
|
+
/** Optional inline remediation hint surfaced by the platform layer. */
|
|
17
|
+
hint;
|
|
18
|
+
constructor(message, code, retryable = false, hint) {
|
|
17
19
|
super(message);
|
|
18
20
|
if (code === undefined) {
|
|
19
21
|
// The default code applied to instances of this class when no explicit code is passed to the constructor.
|
|
@@ -23,6 +25,7 @@ export class UcuError extends Error {
|
|
|
23
25
|
this.name = this.constructor.name;
|
|
24
26
|
this.code = code;
|
|
25
27
|
this.retryable = retryable;
|
|
28
|
+
this.hint = hint;
|
|
26
29
|
}
|
|
27
30
|
/** Serialize for MCP response / JSON.stringify. */
|
|
28
31
|
toJSON() {
|
|
@@ -31,6 +34,7 @@ export class UcuError extends Error {
|
|
|
31
34
|
code: this.code,
|
|
32
35
|
retryable: this.retryable,
|
|
33
36
|
message: this.message,
|
|
37
|
+
...(this.hint && { hint: this.hint }),
|
|
34
38
|
};
|
|
35
39
|
}
|
|
36
40
|
}
|
|
@@ -84,8 +88,8 @@ function getPermissionMessage(permission, platform) {
|
|
|
84
88
|
*/
|
|
85
89
|
export class WindowNotFoundError extends UcuError {
|
|
86
90
|
static defaultCode = "WINDOW_NOT_FOUND";
|
|
87
|
-
constructor(windowId) {
|
|
88
|
-
super(`Window ${windowId} not found. It may have been closed. Run list_windows to get fresh IDs.`, WindowNotFoundError.defaultCode, false);
|
|
91
|
+
constructor(windowId, options) {
|
|
92
|
+
super(`Window ${windowId} not found. It may have been closed. Run list_windows to get fresh IDs.`, WindowNotFoundError.defaultCode, false, options?.hint);
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
/**
|
|
Binary file
|
package/native/ocr/ocr-helper
CHANGED
|
Binary file
|
|
Binary file
|