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.
Files changed (53) hide show
  1. package/CHANGELOG.md +67 -3
  2. package/dist/bin/ucu-mcp.js +1 -1
  3. package/dist/src/index.d.ts +2 -2
  4. package/dist/src/index.js +2 -2
  5. package/dist/src/mcp/server.js +1 -1
  6. package/dist/src/mcp/tools/app-tools.d.ts +2 -0
  7. package/dist/src/mcp/tools/app-tools.js +220 -0
  8. package/dist/src/mcp/tools/element-tools.d.ts +23 -0
  9. package/dist/src/mcp/tools/element-tools.js +59 -0
  10. package/dist/src/mcp/tools/helpers.d.ts +82 -0
  11. package/dist/src/mcp/tools/helpers.js +243 -0
  12. package/dist/src/mcp/tools/index.d.ts +19 -0
  13. package/dist/src/mcp/tools/index.js +54 -0
  14. package/dist/src/mcp/tools/input-tools.d.ts +2 -0
  15. package/dist/src/mcp/tools/input-tools.js +66 -0
  16. package/dist/src/mcp/tools/keyboard-tools.d.ts +2 -0
  17. package/dist/src/mcp/tools/keyboard-tools.js +35 -0
  18. package/dist/src/mcp/tools/screen-tools.d.ts +2 -0
  19. package/dist/src/mcp/tools/screen-tools.js +69 -0
  20. package/dist/src/mcp/tools.d.ts +9 -0
  21. package/dist/src/mcp/tools.js +96 -25
  22. package/dist/src/platform/base.d.ts +3 -0
  23. package/dist/src/platform/jxa-helpers.d.ts +11 -0
  24. package/dist/src/platform/jxa-helpers.js +206 -0
  25. package/dist/src/platform/macos/ax-tree.d.ts +4 -0
  26. package/dist/src/platform/macos/ax-tree.js +462 -0
  27. package/dist/src/platform/macos/base.d.ts +57 -0
  28. package/dist/src/platform/macos/base.js +92 -0
  29. package/dist/src/platform/macos/clipboard.d.ts +3 -0
  30. package/dist/src/platform/macos/clipboard.js +20 -0
  31. package/dist/src/platform/macos/element.d.ts +4 -0
  32. package/dist/src/platform/macos/element.js +212 -0
  33. package/dist/src/platform/macos/focus.d.ts +3 -0
  34. package/dist/src/platform/macos/focus.js +33 -0
  35. package/dist/src/platform/macos/helpers.d.ts +35 -0
  36. package/dist/src/platform/macos/helpers.js +54 -0
  37. package/dist/src/platform/macos/index.d.ts +2 -0
  38. package/dist/src/platform/macos/index.js +1 -0
  39. package/dist/src/platform/macos/input.d.ts +9 -0
  40. package/dist/src/platform/macos/input.js +62 -0
  41. package/dist/src/platform/macos/screen.d.ts +7 -0
  42. package/dist/src/platform/macos/screen.js +197 -0
  43. package/dist/src/platform/macos/window.d.ts +6 -0
  44. package/dist/src/platform/macos/window.js +251 -0
  45. package/dist/src/platform/macos.d.ts +1 -0
  46. package/dist/src/platform/macos.js +114 -583
  47. package/dist/src/safety/guard.js +1 -1
  48. package/dist/src/util/errors.d.ts +7 -2
  49. package/dist/src/util/errors.js +7 -3
  50. package/native/cgevent/cgevent-helper +0 -0
  51. package/native/ocr/ocr-helper +0 -0
  52. package/native/windowlist/windowlist-helper +0 -0
  53. package/package.json +1 -1
@@ -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
- constructor(message: string, code?: string, retryable?: boolean);
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.
@@ -13,7 +13,9 @@ export class UcuError extends Error {
13
13
  static defaultCode = "UCU_ERROR";
14
14
  code;
15
15
  retryable;
16
- constructor(message, code, retryable = false) {
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
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ucu-mcp",
3
- "version": "0.3.9",
3
+ "version": "0.4.2",
4
4
  "description": "MCP server for Universal Computer Use — desktop automation for AI agents via Model Context Protocol",
5
5
  "type": "module",
6
6
  "bin": {