ucu-mcp 0.4.2 → 0.4.3
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/dist/bin/ucu-mcp.js
CHANGED
|
File without changes
|
|
@@ -69,13 +69,18 @@ export function registerAppTools(registerTool) {
|
|
|
69
69
|
});
|
|
70
70
|
registerTool("doctor", "Check system permissions, native helpers, and client readiness", {}, async () => {
|
|
71
71
|
const { checkPermissions, getPermissionInstructions, getTerminalAppName } = await import("../../safety/permissions.js");
|
|
72
|
-
const { MacOSPlatform: MacPlat } = await import("../../platform/macos/index.js");
|
|
73
72
|
const { existsSync, statSync } = await import("node:fs");
|
|
74
73
|
const { join, dirname, resolve } = await import("node:path");
|
|
75
74
|
const { fileURLToPath } = await import("node:url");
|
|
76
75
|
const { execFileSync } = await import("node:child_process");
|
|
77
76
|
const permissions = await checkPermissions();
|
|
78
|
-
|
|
77
|
+
let screenLocked = false;
|
|
78
|
+
try {
|
|
79
|
+
screenLocked = getPlatform().isScreenLocked?.() ?? false;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Non-darwin platform or uninitialized — screen lock not applicable.
|
|
83
|
+
}
|
|
79
84
|
const termApp = process.platform === "darwin" ? getTerminalAppName() : undefined;
|
|
80
85
|
function resolveHelperPath(relParts) {
|
|
81
86
|
const tried = [];
|
|
@@ -2,6 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
import type { Platform, AppTarget } from "../../platform/base.js";
|
|
3
3
|
import { SafetyGuard } from "../../safety/guard.js";
|
|
4
4
|
export declare function getPlatform(): Platform;
|
|
5
|
+
/** @internal Test-only injection point. */
|
|
6
|
+
export declare function __setPlatformForTesting(platform: Platform | undefined): void;
|
|
5
7
|
export declare const safety: SafetyGuard;
|
|
6
8
|
export declare function getActiveTarget(): AppTarget | undefined;
|
|
7
9
|
export declare function setActiveTarget(target: AppTarget): void;
|
|
@@ -12,6 +12,10 @@ export function getPlatform() {
|
|
|
12
12
|
}
|
|
13
13
|
return _platform;
|
|
14
14
|
}
|
|
15
|
+
/** @internal Test-only injection point. */
|
|
16
|
+
export function __setPlatformForTesting(platform) {
|
|
17
|
+
_platform = platform;
|
|
18
|
+
}
|
|
15
19
|
export const safety = new SafetyGuard();
|
|
16
20
|
let activeTargetContext;
|
|
17
21
|
export function getActiveTarget() {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* a shared safety/permission/retry pipeline (`withSafety`).
|
|
6
6
|
*/
|
|
7
7
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
-
export { getActiveTarget } from "./helpers.js";
|
|
8
|
+
export { getActiveTarget, __setPlatformForTesting } from "./helpers.js";
|
|
9
9
|
export { startUserActivityMonitor, stopUserActivityMonitor } from "./helpers.js";
|
|
10
10
|
export { findElementInputSchema } from "./element-tools.js";
|
|
11
11
|
export declare class ToolRegistry {
|
|
@@ -11,7 +11,7 @@ import { registerInputTools } from "./input-tools.js";
|
|
|
11
11
|
import { registerKeyboardTools } from "./keyboard-tools.js";
|
|
12
12
|
import { registerElementTools } from "./element-tools.js";
|
|
13
13
|
import { registerAppTools } from "./app-tools.js";
|
|
14
|
-
export { getActiveTarget } from "./helpers.js";
|
|
14
|
+
export { getActiveTarget, __setPlatformForTesting } from "./helpers.js";
|
|
15
15
|
export { startUserActivityMonitor, stopUserActivityMonitor } from "./helpers.js";
|
|
16
16
|
export { findElementInputSchema } from "./element-tools.js";
|
|
17
17
|
const log = createLogger("tools");
|
|
@@ -36,6 +36,7 @@ export class ToolRegistry {
|
|
|
36
36
|
export function registerTools(server) {
|
|
37
37
|
const registry = ToolRegistry.instance;
|
|
38
38
|
const registerTool = (name, description, schema, handler) => {
|
|
39
|
+
registry.register(name);
|
|
39
40
|
server.tool(name, description, schema, async (params) => {
|
|
40
41
|
try {
|
|
41
42
|
return await handler(params);
|