@mseep/clawdcursor 1.5.5
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 +2264 -0
- package/LICENSE +21 -0
- package/README.md +385 -0
- package/SECURITY.md +44 -0
- package/SKILL.md +503 -0
- package/dist/core/agent-loop/agent.d.ts +42 -0
- package/dist/core/agent-loop/agent.js +1023 -0
- package/dist/core/agent-loop/agent.js.map +1 -0
- package/dist/core/agent-loop/batch-tool.d.ts +25 -0
- package/dist/core/agent-loop/batch-tool.js +218 -0
- package/dist/core/agent-loop/batch-tool.js.map +1 -0
- package/dist/core/agent-loop/coord-scale.d.ts +72 -0
- package/dist/core/agent-loop/coord-scale.js +89 -0
- package/dist/core/agent-loop/coord-scale.js.map +1 -0
- package/dist/core/agent-loop/focus-guard.d.ts +24 -0
- package/dist/core/agent-loop/focus-guard.js +29 -0
- package/dist/core/agent-loop/focus-guard.js.map +1 -0
- package/dist/core/agent-loop/project-mcp.d.ts +97 -0
- package/dist/core/agent-loop/project-mcp.js +253 -0
- package/dist/core/agent-loop/project-mcp.js.map +1 -0
- package/dist/core/agent-loop/prompt.d.ts +45 -0
- package/dist/core/agent-loop/prompt.js +426 -0
- package/dist/core/agent-loop/prompt.js.map +1 -0
- package/dist/core/agent-loop/tool-meta.d.ts +93 -0
- package/dist/core/agent-loop/tool-meta.js +651 -0
- package/dist/core/agent-loop/tool-meta.js.map +1 -0
- package/dist/core/agent-loop/tools.d.ts +38 -0
- package/dist/core/agent-loop/tools.js +2134 -0
- package/dist/core/agent-loop/tools.js.map +1 -0
- package/dist/core/agent-loop/types.d.ts +170 -0
- package/dist/core/agent-loop/types.js +12 -0
- package/dist/core/agent-loop/types.js.map +1 -0
- package/dist/core/agent.d.ts +51 -0
- package/dist/core/agent.js +245 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/app-categories.d.ts +67 -0
- package/dist/core/app-categories.js +108 -0
- package/dist/core/app-categories.js.map +1 -0
- package/dist/core/banner.d.ts +70 -0
- package/dist/core/banner.js +245 -0
- package/dist/core/banner.js.map +1 -0
- package/dist/core/classify/capability.d.ts +45 -0
- package/dist/core/classify/capability.js +78 -0
- package/dist/core/classify/capability.js.map +1 -0
- package/dist/core/decompose/llm-decomposer.d.ts +35 -0
- package/dist/core/decompose/llm-decomposer.js +156 -0
- package/dist/core/decompose/llm-decomposer.js.map +1 -0
- package/dist/core/decompose/parser.d.ts +27 -0
- package/dist/core/decompose/parser.js +101 -0
- package/dist/core/decompose/parser.js.map +1 -0
- package/dist/core/observability/correlation.d.ts +19 -0
- package/dist/core/observability/correlation.js +36 -0
- package/dist/core/observability/correlation.js.map +1 -0
- package/dist/core/observability/cost-meter.d.ts +51 -0
- package/dist/core/observability/cost-meter.js +134 -0
- package/dist/core/observability/cost-meter.js.map +1 -0
- package/dist/core/observability/logger.d.ts +61 -0
- package/dist/core/observability/logger.js +550 -0
- package/dist/core/observability/logger.js.map +1 -0
- package/dist/core/router/aliases.d.ts +50 -0
- package/dist/core/router/aliases.js +104 -0
- package/dist/core/router/aliases.js.map +1 -0
- package/dist/core/router/normalize.d.ts +41 -0
- package/dist/core/router/normalize.js +80 -0
- package/dist/core/router/normalize.js.map +1 -0
- package/dist/core/safety.d.ts +126 -0
- package/dist/core/safety.js +568 -0
- package/dist/core/safety.js.map +1 -0
- package/dist/core/sense/a11y-resolver.d.ts +73 -0
- package/dist/core/sense/a11y-resolver.js +76 -0
- package/dist/core/sense/a11y-resolver.js.map +1 -0
- package/dist/core/sense/fingerprint.d.ts +41 -0
- package/dist/core/sense/fingerprint.js +123 -0
- package/dist/core/sense/fingerprint.js.map +1 -0
- package/dist/core/sense/rank.d.ts +70 -0
- package/dist/core/sense/rank.js +192 -0
- package/dist/core/sense/rank.js.map +1 -0
- package/dist/core/sense/reactive-check.d.ts +40 -0
- package/dist/core/sense/reactive-check.js +48 -0
- package/dist/core/sense/reactive-check.js.map +1 -0
- package/dist/core/sense/snapshot.d.ts +19 -0
- package/dist/core/sense/snapshot.js +100 -0
- package/dist/core/sense/snapshot.js.map +1 -0
- package/dist/core/sense/types.d.ts +66 -0
- package/dist/core/sense/types.js +9 -0
- package/dist/core/sense/types.js.map +1 -0
- package/dist/core/sense/ui-map-anchors.d.ts +7 -0
- package/dist/core/sense/ui-map-anchors.js +24 -0
- package/dist/core/sense/ui-map-anchors.js.map +1 -0
- package/dist/core/sense/ui-map-elements.d.ts +5 -0
- package/dist/core/sense/ui-map-elements.js +33 -0
- package/dist/core/sense/ui-map-elements.js.map +1 -0
- package/dist/core/sense/ui-map-find.d.ts +56 -0
- package/dist/core/sense/ui-map-find.js +153 -0
- package/dist/core/sense/ui-map-find.js.map +1 -0
- package/dist/core/sense/ui-map-fuse.d.ts +4 -0
- package/dist/core/sense/ui-map-fuse.js +44 -0
- package/dist/core/sense/ui-map-fuse.js.map +1 -0
- package/dist/core/sense/ui-map-geom.d.ts +3 -0
- package/dist/core/sense/ui-map-geom.js +16 -0
- package/dist/core/sense/ui-map-geom.js.map +1 -0
- package/dist/core/sense/ui-map-holder.d.ts +58 -0
- package/dist/core/sense/ui-map-holder.js +87 -0
- package/dist/core/sense/ui-map-holder.js.map +1 -0
- package/dist/core/sense/ui-map-normalize.d.ts +19 -0
- package/dist/core/sense/ui-map-normalize.js +65 -0
- package/dist/core/sense/ui-map-normalize.js.map +1 -0
- package/dist/core/sense/ui-map-render.d.ts +4 -0
- package/dist/core/sense/ui-map-render.js +34 -0
- package/dist/core/sense/ui-map-render.js.map +1 -0
- package/dist/core/sense/ui-map-resolve.d.ts +41 -0
- package/dist/core/sense/ui-map-resolve.js +59 -0
- package/dist/core/sense/ui-map-resolve.js.map +1 -0
- package/dist/core/sense/ui-map-types.d.ts +66 -0
- package/dist/core/sense/ui-map-types.js +11 -0
- package/dist/core/sense/ui-map-types.js.map +1 -0
- package/dist/core/sense/ui-map.d.ts +29 -0
- package/dist/core/sense/ui-map.js +113 -0
- package/dist/core/sense/ui-map.js.map +1 -0
- package/dist/core/verify/assertions.d.ts +132 -0
- package/dist/core/verify/assertions.js +284 -0
- package/dist/core/verify/assertions.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/browser-config.d.ts +36 -0
- package/dist/llm/browser-config.js +83 -0
- package/dist/llm/browser-config.js.map +1 -0
- package/dist/llm/client.d.ts +268 -0
- package/dist/llm/client.js +1094 -0
- package/dist/llm/client.js.map +1 -0
- package/dist/llm/config.d.ts +79 -0
- package/dist/llm/config.js +375 -0
- package/dist/llm/config.js.map +1 -0
- package/dist/llm/credentials.d.ts +35 -0
- package/dist/llm/credentials.js +491 -0
- package/dist/llm/credentials.js.map +1 -0
- package/dist/llm/external-creds.d.ts +42 -0
- package/dist/llm/external-creds.js +169 -0
- package/dist/llm/external-creds.js.map +1 -0
- package/dist/llm/providers.d.ts +123 -0
- package/dist/llm/providers.js +717 -0
- package/dist/llm/providers.js.map +1 -0
- package/dist/paths.d.ts +31 -0
- package/dist/paths.js +147 -0
- package/dist/paths.js.map +1 -0
- package/dist/platform/accessibility.d.ts +139 -0
- package/dist/platform/accessibility.js +670 -0
- package/dist/platform/accessibility.js.map +1 -0
- package/dist/platform/cdp-driver.d.ts +318 -0
- package/dist/platform/cdp-driver.js +1179 -0
- package/dist/platform/cdp-driver.js.map +1 -0
- package/dist/platform/index.d.ts +11 -0
- package/dist/platform/index.js +69 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/keys.d.ts +17 -0
- package/dist/platform/keys.js +129 -0
- package/dist/platform/keys.js.map +1 -0
- package/dist/platform/launch-poll.d.ts +101 -0
- package/dist/platform/launch-poll.js +177 -0
- package/dist/platform/launch-poll.js.map +1 -0
- package/dist/platform/linux.d.ts +173 -0
- package/dist/platform/linux.js +1253 -0
- package/dist/platform/linux.js.map +1 -0
- package/dist/platform/macos.d.ts +136 -0
- package/dist/platform/macos.js +976 -0
- package/dist/platform/macos.js.map +1 -0
- package/dist/platform/native-desktop.d.ts +145 -0
- package/dist/platform/native-desktop.js +936 -0
- package/dist/platform/native-desktop.js.map +1 -0
- package/dist/platform/native-helper.d.ts +130 -0
- package/dist/platform/native-helper.js +592 -0
- package/dist/platform/native-helper.js.map +1 -0
- package/dist/platform/ocr-engine.d.ts +78 -0
- package/dist/platform/ocr-engine.js +363 -0
- package/dist/platform/ocr-engine.js.map +1 -0
- package/dist/platform/ps-runner.d.ts +28 -0
- package/dist/platform/ps-runner.js +228 -0
- package/dist/platform/ps-runner.js.map +1 -0
- package/dist/platform/types.d.ts +397 -0
- package/dist/platform/types.js +15 -0
- package/dist/platform/types.js.map +1 -0
- package/dist/platform/uri-handler.d.ts +75 -0
- package/dist/platform/uri-handler.js +273 -0
- package/dist/platform/uri-handler.js.map +1 -0
- package/dist/platform/wayland-backend.d.ts +53 -0
- package/dist/platform/wayland-backend.js +348 -0
- package/dist/platform/wayland-backend.js.map +1 -0
- package/dist/platform/windows.d.ts +232 -0
- package/dist/platform/windows.js +1210 -0
- package/dist/platform/windows.js.map +1 -0
- package/dist/postbuild.d.ts +10 -0
- package/dist/postbuild.js +98 -0
- package/dist/postbuild.js.map +1 -0
- package/dist/schema/snapshot.d.ts +33 -0
- package/dist/schema/snapshot.js +90 -0
- package/dist/schema/snapshot.js.map +1 -0
- package/dist/shortcuts.d.ts +30 -0
- package/dist/shortcuts.js +261 -0
- package/dist/shortcuts.js.map +1 -0
- package/dist/surface/cli.d.ts +7 -0
- package/dist/surface/cli.js +1556 -0
- package/dist/surface/cli.js.map +1 -0
- package/dist/surface/dashboard.d.ts +8 -0
- package/dist/surface/dashboard.js +1193 -0
- package/dist/surface/dashboard.js.map +1 -0
- package/dist/surface/doctor.d.ts +29 -0
- package/dist/surface/doctor.js +1514 -0
- package/dist/surface/doctor.js.map +1 -0
- package/dist/surface/format.d.ts +10 -0
- package/dist/surface/format.js +37 -0
- package/dist/surface/format.js.map +1 -0
- package/dist/surface/http-utility.d.ts +65 -0
- package/dist/surface/http-utility.js +336 -0
- package/dist/surface/http-utility.js.map +1 -0
- package/dist/surface/mcp-server.d.ts +91 -0
- package/dist/surface/mcp-server.js +280 -0
- package/dist/surface/mcp-server.js.map +1 -0
- package/dist/surface/onboarding.d.ts +15 -0
- package/dist/surface/onboarding.js +184 -0
- package/dist/surface/onboarding.js.map +1 -0
- package/dist/surface/pidfile.d.ts +79 -0
- package/dist/surface/pidfile.js +263 -0
- package/dist/surface/pidfile.js.map +1 -0
- package/dist/surface/readiness.d.ts +45 -0
- package/dist/surface/readiness.js +230 -0
- package/dist/surface/readiness.js.map +1 -0
- package/dist/surface/report.d.ts +68 -0
- package/dist/surface/report.js +341 -0
- package/dist/surface/report.js.map +1 -0
- package/dist/surface/skill-register.d.ts +14 -0
- package/dist/surface/skill-register.js +150 -0
- package/dist/surface/skill-register.js.map +1 -0
- package/dist/surface/version.d.ts +6 -0
- package/dist/surface/version.js +27 -0
- package/dist/surface/version.js.map +1 -0
- package/dist/tools/a11y.d.ts +8 -0
- package/dist/tools/a11y.js +545 -0
- package/dist/tools/a11y.js.map +1 -0
- package/dist/tools/a11y_depth.d.ts +19 -0
- package/dist/tools/a11y_depth.js +455 -0
- package/dist/tools/a11y_depth.js.map +1 -0
- package/dist/tools/agent.d.ts +15 -0
- package/dist/tools/agent.js +248 -0
- package/dist/tools/agent.js.map +1 -0
- package/dist/tools/batch.d.ts +46 -0
- package/dist/tools/batch.js +230 -0
- package/dist/tools/batch.js.map +1 -0
- package/dist/tools/cdp.d.ts +8 -0
- package/dist/tools/cdp.js +233 -0
- package/dist/tools/cdp.js.map +1 -0
- package/dist/tools/compact.d.ts +63 -0
- package/dist/tools/compact.js +418 -0
- package/dist/tools/compact.js.map +1 -0
- package/dist/tools/cost-class.d.ts +38 -0
- package/dist/tools/cost-class.js +117 -0
- package/dist/tools/cost-class.js.map +1 -0
- package/dist/tools/desktop.d.ts +9 -0
- package/dist/tools/desktop.js +346 -0
- package/dist/tools/desktop.js.map +1 -0
- package/dist/tools/electron_bridge.d.ts +41 -0
- package/dist/tools/electron_bridge.js +261 -0
- package/dist/tools/electron_bridge.js.map +1 -0
- package/dist/tools/extras.d.ts +22 -0
- package/dist/tools/extras.js +942 -0
- package/dist/tools/extras.js.map +1 -0
- package/dist/tools/favorites.d.ts +13 -0
- package/dist/tools/favorites.js +137 -0
- package/dist/tools/favorites.js.map +1 -0
- package/dist/tools/introspection.d.ts +13 -0
- package/dist/tools/introspection.js +55 -0
- package/dist/tools/introspection.js.map +1 -0
- package/dist/tools/ocr.d.ts +8 -0
- package/dist/tools/ocr.js +66 -0
- package/dist/tools/ocr.js.map +1 -0
- package/dist/tools/orchestration.d.ts +7 -0
- package/dist/tools/orchestration.js +377 -0
- package/dist/tools/orchestration.js.map +1 -0
- package/dist/tools/playbooks/extract-compose.d.ts +22 -0
- package/dist/tools/playbooks/extract-compose.js +85 -0
- package/dist/tools/playbooks/extract-compose.js.map +1 -0
- package/dist/tools/playbooks/find-replace.d.ts +11 -0
- package/dist/tools/playbooks/find-replace.js +56 -0
- package/dist/tools/playbooks/find-replace.js.map +1 -0
- package/dist/tools/playbooks/index.d.ts +63 -0
- package/dist/tools/playbooks/index.js +70 -0
- package/dist/tools/playbooks/index.js.map +1 -0
- package/dist/tools/playbooks/keys-blocklist.d.ts +24 -0
- package/dist/tools/playbooks/keys-blocklist.js +89 -0
- package/dist/tools/playbooks/keys-blocklist.js.map +1 -0
- package/dist/tools/registry.d.ts +40 -0
- package/dist/tools/registry.js +560 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/safety-gate.d.ts +16 -0
- package/dist/tools/safety-gate.js +70 -0
- package/dist/tools/safety-gate.js.map +1 -0
- package/dist/tools/scheduler.d.ts +76 -0
- package/dist/tools/scheduler.js +413 -0
- package/dist/tools/scheduler.js.map +1 -0
- package/dist/tools/shortcuts.d.ts +13 -0
- package/dist/tools/shortcuts.js +205 -0
- package/dist/tools/shortcuts.js.map +1 -0
- package/dist/tools/smart.d.ts +15 -0
- package/dist/tools/smart.js +785 -0
- package/dist/tools/smart.js.map +1 -0
- package/dist/tools/types.d.ts +174 -0
- package/dist/tools/types.js +67 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/window-text.d.ts +15 -0
- package/dist/tools/window-text.js +39 -0
- package/dist/tools/window-text.js.map +1 -0
- package/dist/types.d.ts +122 -0
- package/dist/types.js +41 -0
- package/dist/types.js.map +1 -0
- package/native/Package.swift +38 -0
- package/native/README.md +113 -0
- package/native/Sources/ClawdCursorHelper/main.swift +602 -0
- package/native/Sources/ClawdCursorHost/main.swift +182 -0
- package/native/Sources/PermissionCheck/main.swift +53 -0
- package/native/Sources/ScreenshotHelper/main.swift +219 -0
- package/native/build.sh +139 -0
- package/native/entitlements.plist +12 -0
- package/package.json +115 -0
- package/scripts/banner.ps1 +112 -0
- package/scripts/coord-accuracy.ps1 +140 -0
- package/scripts/coord-uwp.ps1 +80 -0
- package/scripts/edge-glow.ps1 +180 -0
- package/scripts/find-element.ps1 +198 -0
- package/scripts/get-foreground-window.ps1 +71 -0
- package/scripts/get-screen-context.ps1 +183 -0
- package/scripts/get-windows.ps1 +66 -0
- package/scripts/install-panic-hotkey.ps1 +46 -0
- package/scripts/interact-element.ps1 +431 -0
- package/scripts/invoke-element.ps1 +314 -0
- package/scripts/linux/atspi-bridge.py +356 -0
- package/scripts/linux/ocr-recognize.py +154 -0
- package/scripts/mac/_window-picker.jxa +163 -0
- package/scripts/mac/find-element.jxa +0 -0
- package/scripts/mac/find-element.sh +161 -0
- package/scripts/mac/focus-window.jxa +284 -0
- package/scripts/mac/get-focused-element.jxa +102 -0
- package/scripts/mac/get-foreground-window.jxa +173 -0
- package/scripts/mac/get-screen-context.jxa +197 -0
- package/scripts/mac/get-ui-tree.sh +141 -0
- package/scripts/mac/get-windows.jxa +117 -0
- package/scripts/mac/interact-element.sh +235 -0
- package/scripts/mac/invoke-element.jxa +408 -0
- package/scripts/mac/ocr-recognize.swift +124 -0
- package/scripts/ocr-recognize.ps1 +102 -0
- package/scripts/postinstall-native.js +48 -0
- package/scripts/ps-bridge.ps1 +830 -0
- package/scripts/smoke-mcp.ps1 +119 -0
- package/scripts/sync-version.ts +178 -0
- package/scripts/verify-install.js +81 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Desktop tools — screenshot, mouse, keyboard, screen info.
|
|
4
|
+
*
|
|
5
|
+
* Coordinate system: All mouse tools accept IMAGE-SPACE coordinates
|
|
6
|
+
* (matching the 1280px-wide screenshots from desktop_screenshot).
|
|
7
|
+
* The server auto-scales to Windows LOGICAL coordinates via mouseScaleFactor.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.getDesktopTools = getDesktopTools;
|
|
44
|
+
const os = __importStar(require("os"));
|
|
45
|
+
/** Dangerous key combos that are blocked */
|
|
46
|
+
const BLOCKED_KEYS = ['alt+f4', 'ctrl+alt+delete', 'ctrl+alt+del'];
|
|
47
|
+
const IS_MAC = os.platform() === 'darwin';
|
|
48
|
+
/**
|
|
49
|
+
* Best-effort active-window label for a tool's result text.
|
|
50
|
+
*
|
|
51
|
+
* `getActiveWindow()` goes through the platform a11y bridge (the persistent
|
|
52
|
+
* PowerShell/UIA process on Windows, AX on macOS, AT-SPI on Linux). That call
|
|
53
|
+
* is only ever used here to ANNOTATE the result ("Key pressed: X in [app]") —
|
|
54
|
+
* it is NOT load-bearing for the actual key/type action. So it must never be
|
|
55
|
+
* able to block or hang the action: if the bridge is slow, recovering, or
|
|
56
|
+
* wedged, we fall back to "(unknown)" after a short timeout and the keystroke
|
|
57
|
+
* still goes through. OS-agnostic — applies to every platform's bridge.
|
|
58
|
+
*/
|
|
59
|
+
async function activeWindowLabel(ctx) {
|
|
60
|
+
try {
|
|
61
|
+
const active = await Promise.race([
|
|
62
|
+
ctx.a11y.getActiveWindow(),
|
|
63
|
+
new Promise(resolve => setTimeout(() => resolve(null), 1500)),
|
|
64
|
+
]);
|
|
65
|
+
return active ? `[${active.processName}] "${active.title}"` : '(unknown)';
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return '(unknown)';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function getDesktopTools() {
|
|
72
|
+
return [
|
|
73
|
+
// ── PERCEPTION ──
|
|
74
|
+
{
|
|
75
|
+
name: 'desktop_screenshot',
|
|
76
|
+
description: 'LAST RESORT — take a screenshot only when the accessibility tree and OCR are both insufficient (custom canvas, icon-only UI, pixel-level verification). Prefer read_screen first, then ocr_read_screen; escalate to screenshot only when those fail. Returns the image resized to 1280px wide.',
|
|
77
|
+
parameters: {},
|
|
78
|
+
category: 'perception',
|
|
79
|
+
compactGroup: 'computer',
|
|
80
|
+
safetyTier: 0,
|
|
81
|
+
handler: async (_params, ctx) => {
|
|
82
|
+
await ctx.ensureInitialized();
|
|
83
|
+
const frame = await ctx.desktop.captureForLLM();
|
|
84
|
+
const base64 = frame.buffer.toString('base64');
|
|
85
|
+
return {
|
|
86
|
+
text: `Screenshot: ${frame.llmWidth}x${frame.llmHeight}px (real: ${frame.width}x${frame.height}, scale: ${frame.scaleFactor.toFixed(2)}x). Mouse tools accept these image-space coordinates.`,
|
|
87
|
+
image: { data: base64, mimeType: 'image/jpeg' },
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'desktop_screenshot_region',
|
|
93
|
+
description: 'Take a zoomed screenshot of a specific screen region for detailed inspection. Coordinates are in image-space (from desktop_screenshot).',
|
|
94
|
+
parameters: {
|
|
95
|
+
x: { type: 'number', description: 'Left edge X in image-space coordinates', required: true },
|
|
96
|
+
y: { type: 'number', description: 'Top edge Y in image-space coordinates', required: true },
|
|
97
|
+
width: { type: 'number', description: 'Width in image-space pixels', required: true },
|
|
98
|
+
height: { type: 'number', description: 'Height in image-space pixels', required: true },
|
|
99
|
+
},
|
|
100
|
+
category: 'perception',
|
|
101
|
+
compactGroup: 'computer',
|
|
102
|
+
safetyTier: 0,
|
|
103
|
+
handler: async ({ x, y, width, height }, ctx) => {
|
|
104
|
+
await ctx.ensureInitialized();
|
|
105
|
+
const sf = ctx.getScreenshotScaleFactor();
|
|
106
|
+
const frame = await ctx.desktop.captureRegionForLLM(Math.round(x * sf), Math.round(y * sf), Math.round(width * sf), Math.round(height * sf));
|
|
107
|
+
const base64 = frame.buffer.toString('base64');
|
|
108
|
+
return {
|
|
109
|
+
text: `Region: (${x},${y}) ${width}x${height} image-space → zoomed to ${frame.llmWidth}x${frame.llmHeight}px.`,
|
|
110
|
+
image: { data: base64, mimeType: 'image/jpeg' },
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'get_screen_size',
|
|
116
|
+
description: 'Get the screen dimensions and scale factor.',
|
|
117
|
+
parameters: {},
|
|
118
|
+
category: 'perception',
|
|
119
|
+
compactGroup: 'window',
|
|
120
|
+
safetyTier: 0,
|
|
121
|
+
handler: async (_params, ctx) => {
|
|
122
|
+
await ctx.ensureInitialized();
|
|
123
|
+
const size = ctx.desktop.getScreenSize();
|
|
124
|
+
const msf = ctx.getMouseScaleFactor();
|
|
125
|
+
const ssf = ctx.getScreenshotScaleFactor();
|
|
126
|
+
return {
|
|
127
|
+
text: JSON.stringify({
|
|
128
|
+
physicalWidth: size.width,
|
|
129
|
+
physicalHeight: size.height,
|
|
130
|
+
screenshotScaleFactor: ssf,
|
|
131
|
+
mouseScaleFactor: msf,
|
|
132
|
+
imageWidth: Math.round(size.width / ssf),
|
|
133
|
+
imageHeight: Math.round(size.height / ssf),
|
|
134
|
+
}),
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
// ── MOUSE ──
|
|
139
|
+
{
|
|
140
|
+
name: 'mouse_click',
|
|
141
|
+
description: 'Click the left mouse button at the given image-space coordinates.',
|
|
142
|
+
parameters: {
|
|
143
|
+
x: { type: 'number', description: 'X coordinate in image-space', required: true },
|
|
144
|
+
y: { type: 'number', description: 'Y coordinate in image-space', required: true },
|
|
145
|
+
},
|
|
146
|
+
category: 'mouse',
|
|
147
|
+
compactGroup: 'computer',
|
|
148
|
+
safetyTier: 1,
|
|
149
|
+
handler: async ({ x, y }, ctx) => {
|
|
150
|
+
await ctx.ensureInitialized();
|
|
151
|
+
const sf = ctx.getMouseScaleFactor();
|
|
152
|
+
const rx = Math.round(x * sf), ry = Math.round(y * sf);
|
|
153
|
+
await ctx.desktop.mouseClick(rx, ry);
|
|
154
|
+
ctx.a11y.invalidateCache();
|
|
155
|
+
ctx.uiMaps?.invalidate();
|
|
156
|
+
return { text: `Clicked at (${x}, ${y}) → logical (${rx}, ${ry})` };
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'mouse_double_click',
|
|
161
|
+
description: 'Double-click the left mouse button at the given image-space coordinates.',
|
|
162
|
+
parameters: {
|
|
163
|
+
x: { type: 'number', description: 'X coordinate in image-space', required: true },
|
|
164
|
+
y: { type: 'number', description: 'Y coordinate in image-space', required: true },
|
|
165
|
+
},
|
|
166
|
+
category: 'mouse',
|
|
167
|
+
compactGroup: 'computer',
|
|
168
|
+
safetyTier: 1,
|
|
169
|
+
handler: async ({ x, y }, ctx) => {
|
|
170
|
+
await ctx.ensureInitialized();
|
|
171
|
+
const sf = ctx.getMouseScaleFactor();
|
|
172
|
+
await ctx.desktop.mouseDoubleClick(Math.round(x * sf), Math.round(y * sf));
|
|
173
|
+
ctx.a11y.invalidateCache();
|
|
174
|
+
ctx.uiMaps?.invalidate();
|
|
175
|
+
return { text: `Double-clicked at (${x}, ${y})` };
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'mouse_right_click',
|
|
180
|
+
description: 'Right-click at the given image-space coordinates (opens context menu).',
|
|
181
|
+
parameters: {
|
|
182
|
+
x: { type: 'number', description: 'X coordinate in image-space', required: true },
|
|
183
|
+
y: { type: 'number', description: 'Y coordinate in image-space', required: true },
|
|
184
|
+
},
|
|
185
|
+
category: 'mouse',
|
|
186
|
+
compactGroup: 'computer',
|
|
187
|
+
safetyTier: 1,
|
|
188
|
+
handler: async ({ x, y }, ctx) => {
|
|
189
|
+
await ctx.ensureInitialized();
|
|
190
|
+
const sf = ctx.getMouseScaleFactor();
|
|
191
|
+
await ctx.desktop.mouseRightClick(Math.round(x * sf), Math.round(y * sf));
|
|
192
|
+
ctx.a11y.invalidateCache();
|
|
193
|
+
ctx.uiMaps?.invalidate();
|
|
194
|
+
return { text: `Right-clicked at (${x}, ${y})` };
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'mouse_hover',
|
|
199
|
+
description: 'Move the mouse to the given image-space coordinates without clicking. Useful for revealing tooltips or hover menus.',
|
|
200
|
+
parameters: {
|
|
201
|
+
x: { type: 'number', description: 'X coordinate in image-space', required: true },
|
|
202
|
+
y: { type: 'number', description: 'Y coordinate in image-space', required: true },
|
|
203
|
+
},
|
|
204
|
+
category: 'mouse',
|
|
205
|
+
compactGroup: 'computer',
|
|
206
|
+
safetyTier: 1,
|
|
207
|
+
handler: async ({ x, y }, ctx) => {
|
|
208
|
+
await ctx.ensureInitialized();
|
|
209
|
+
const sf = ctx.getMouseScaleFactor();
|
|
210
|
+
await ctx.desktop.mouseMove(Math.round(x * sf), Math.round(y * sf));
|
|
211
|
+
return { text: `Mouse moved to (${x}, ${y})` };
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
name: 'mouse_scroll',
|
|
216
|
+
description: 'Scroll the mouse wheel at the given image-space coordinates.',
|
|
217
|
+
parameters: {
|
|
218
|
+
x: { type: 'number', description: 'X coordinate in image-space', required: true },
|
|
219
|
+
y: { type: 'number', description: 'Y coordinate in image-space', required: true },
|
|
220
|
+
direction: { type: 'string', description: 'Scroll direction', required: true, enum: ['up', 'down'] },
|
|
221
|
+
amount: { type: 'number', description: 'Scroll amount in wheel ticks (default: 3)', required: false, default: 3 },
|
|
222
|
+
},
|
|
223
|
+
category: 'mouse',
|
|
224
|
+
compactGroup: 'computer',
|
|
225
|
+
safetyTier: 1,
|
|
226
|
+
handler: async ({ x, y, direction, amount }, ctx) => {
|
|
227
|
+
await ctx.ensureInitialized();
|
|
228
|
+
const sf = ctx.getMouseScaleFactor();
|
|
229
|
+
const ticks = amount ?? 3;
|
|
230
|
+
const delta = direction === 'down' ? ticks : -ticks;
|
|
231
|
+
await ctx.desktop.mouseScroll(Math.round(x * sf), Math.round(y * sf), delta);
|
|
232
|
+
return { text: `Scrolled ${direction} ${ticks} ticks at (${x}, ${y})` };
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'mouse_drag',
|
|
237
|
+
description: 'Drag from one image-space coordinate to another (click-hold-move-release). Useful for selecting text, moving objects, or resizing.',
|
|
238
|
+
parameters: {
|
|
239
|
+
startX: { type: 'number', description: 'Start X in image-space', required: true },
|
|
240
|
+
startY: { type: 'number', description: 'Start Y in image-space', required: true },
|
|
241
|
+
endX: { type: 'number', description: 'End X in image-space', required: true },
|
|
242
|
+
endY: { type: 'number', description: 'End Y in image-space', required: true },
|
|
243
|
+
x1: { type: 'number', description: 'Alias for startX', required: false },
|
|
244
|
+
y1: { type: 'number', description: 'Alias for startY', required: false },
|
|
245
|
+
x2: { type: 'number', description: 'Alias for endX', required: false },
|
|
246
|
+
y2: { type: 'number', description: 'Alias for endY', required: false },
|
|
247
|
+
},
|
|
248
|
+
category: 'mouse',
|
|
249
|
+
compactGroup: 'computer',
|
|
250
|
+
safetyTier: 1,
|
|
251
|
+
handler: async ({ startX, startY, endX, endY, x1, y1, x2, y2 }, ctx) => {
|
|
252
|
+
await ctx.ensureInitialized();
|
|
253
|
+
const sx = startX ?? x1;
|
|
254
|
+
const sy = startY ?? y1;
|
|
255
|
+
const ex = endX ?? x2;
|
|
256
|
+
const ey = endY ?? y2;
|
|
257
|
+
const sf = ctx.getMouseScaleFactor();
|
|
258
|
+
await ctx.desktop.mouseDrag(Math.round(sx * sf), Math.round(sy * sf), Math.round(ex * sf), Math.round(ey * sf));
|
|
259
|
+
ctx.a11y.invalidateCache();
|
|
260
|
+
ctx.uiMaps?.invalidate();
|
|
261
|
+
return { text: `Dragged (${sx},${sy}) → (${ex},${ey})` };
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
// ── KEYBOARD ──
|
|
265
|
+
{
|
|
266
|
+
name: 'type_text',
|
|
267
|
+
description: 'Type text into the currently focused element. Internally uses clipboard paste for reliability (no dropped chars). The user clipboard is saved before and restored after, so calling type_text never clobbers any text the caller had previously placed on the clipboard.',
|
|
268
|
+
parameters: {
|
|
269
|
+
text: { type: 'string', description: 'The text to type', required: true },
|
|
270
|
+
},
|
|
271
|
+
category: 'keyboard',
|
|
272
|
+
compactGroup: 'computer',
|
|
273
|
+
safetyTier: 1,
|
|
274
|
+
handler: async ({ text }, ctx) => {
|
|
275
|
+
await ctx.ensureInitialized();
|
|
276
|
+
const activeInfo = await activeWindowLabel(ctx);
|
|
277
|
+
// Preserve the user's clipboard contents around the paste-as-type
|
|
278
|
+
// operation. Without this, callers who do
|
|
279
|
+
// write_clipboard("important sentence")
|
|
280
|
+
// type_text("\nheader\n")
|
|
281
|
+
// key_press("ctrl+v")
|
|
282
|
+
// get the header text re-pasted instead of the sentence — type_text
|
|
283
|
+
// silently overwrote the clipboard. Save/restore makes type_text
|
|
284
|
+
// transparent to the clipboard.
|
|
285
|
+
let saved = null;
|
|
286
|
+
try {
|
|
287
|
+
saved = await ctx.a11y.readClipboard();
|
|
288
|
+
}
|
|
289
|
+
catch { /* clipboard unreadable — leave saved=null, restore becomes a no-op below */ }
|
|
290
|
+
await ctx.a11y.writeClipboard(text);
|
|
291
|
+
await new Promise(r => setTimeout(r, 50));
|
|
292
|
+
// Paste combo is platform-specific
|
|
293
|
+
await ctx.desktop.keyPress(IS_MAC ? 'super+v' : 'ctrl+v');
|
|
294
|
+
await new Promise(r => setTimeout(r, 100));
|
|
295
|
+
// Restore clipboard. Best-effort — if the read failed (no clipboard
|
|
296
|
+
// available) or the restore throws, we don't surface the error;
|
|
297
|
+
// type_text's contract is about typing, not clipboard ops.
|
|
298
|
+
if (saved !== null) {
|
|
299
|
+
try {
|
|
300
|
+
await ctx.a11y.writeClipboard(saved);
|
|
301
|
+
}
|
|
302
|
+
catch { /* best-effort */ }
|
|
303
|
+
}
|
|
304
|
+
ctx.a11y.invalidateCache();
|
|
305
|
+
ctx.uiMaps?.invalidate();
|
|
306
|
+
return { text: `Typed ${text.length} chars into ${activeInfo}` };
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: 'key_press',
|
|
311
|
+
description: 'Press a keyboard key or key combination. Use "+" for a chord (e.g. "ctrl+s", "shift+enter", "alt+tab"). Separate multiple presses with SPACES to send them in sequence (e.g. "Down Down End", "ctrl+a Delete"). Single keys: "Return", "Tab", "Escape", "Backspace", "Delete", "F1"-"F12", "Left/Right/Up/Down".',
|
|
312
|
+
parameters: {
|
|
313
|
+
key: { type: 'string', description: 'Key/combo to press (e.g. "Return", "ctrl+a", "F5"). Space-separate combos for a sequence ("Down Down End").', required: true },
|
|
314
|
+
},
|
|
315
|
+
category: 'keyboard',
|
|
316
|
+
compactGroup: 'computer',
|
|
317
|
+
safetyTier: 1,
|
|
318
|
+
handler: async ({ key }, ctx) => {
|
|
319
|
+
await ctx.ensureInitialized();
|
|
320
|
+
// Defense-in-depth: a missing/mistyped arg used to reach `.toLowerCase()`
|
|
321
|
+
// on `undefined` and throw an opaque crash. Fail with an actionable
|
|
322
|
+
// message instead (the `computer` compound names this field `combo`,
|
|
323
|
+
// with `key` accepted as an alias).
|
|
324
|
+
if (typeof key !== 'string' || key.trim() === '') {
|
|
325
|
+
return { text: 'key_press: "key" is required — the key or combo to press, e.g. "Return" or "ctrl+a". (On the `computer` compound the field is `combo`; `key` is also accepted.)', isError: true };
|
|
326
|
+
}
|
|
327
|
+
// "+" joins a chord; whitespace separates combos pressed in sequence.
|
|
328
|
+
const combos = key.trim().split(/\s+/);
|
|
329
|
+
for (const combo of combos) {
|
|
330
|
+
const lower = combo.toLowerCase().replace(/\s+/g, '');
|
|
331
|
+
if (BLOCKED_KEYS.some(b => lower === b)) {
|
|
332
|
+
return { text: `BLOCKED: "${combo}" is a dangerous key combo.`, isError: true };
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
const activeInfo = await activeWindowLabel(ctx);
|
|
336
|
+
for (const combo of combos) {
|
|
337
|
+
await ctx.desktop.keyPress(combo);
|
|
338
|
+
}
|
|
339
|
+
ctx.a11y.invalidateCache();
|
|
340
|
+
ctx.uiMaps?.invalidate();
|
|
341
|
+
return { text: `Key pressed: ${key} in ${activeInfo}` };
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
];
|
|
345
|
+
}
|
|
346
|
+
//# sourceMappingURL=desktop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desktop.js","sourceRoot":"","sources":["../../src/tools/desktop.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCH,0CAmSC;AAjUD,uCAAyB;AAGzB,4CAA4C;AAC5C,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;AACnE,MAAM,MAAM,GAAG,EAAE,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,KAAK,UAAU,iBAAiB,CAAC,GAAgB;IAC/C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;YAChC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE;YAC1B,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;SACpE,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,WAAW,MAAM,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC;IAC5E,CAAC;IAAC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O,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBACtD,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;wBACxC,OAAO,EAAE,IAAI,EAAE,aAAa,KAAK,6BAA6B,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oBAClF,CAAC;gBACH,CAAC;gBACD,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC;gBAChD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBAC3B,MAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACpC,CAAC;gBACD,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC3B,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;gBACzB,OAAO,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,UAAU,EAAE,EAAE,CAAC;YAC1D,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v0.8.2 — Electron / WebView2 / WKWebView detection + CDP bridging hints.
|
|
3
|
+
*
|
|
4
|
+
* Modern "native" apps on Windows and macOS are frequently Electron or
|
|
5
|
+
* WebView2 wrappers around Chromium. Their accessibility trees often
|
|
6
|
+
* contain only the window chrome — the entire document body is inside
|
|
7
|
+
* the web view and is NOT reachable via UIA or AX directly.
|
|
8
|
+
*
|
|
9
|
+
* Examples on Windows (WebView2 / Electron):
|
|
10
|
+
* - New Outlook (olk)
|
|
11
|
+
* - Microsoft Teams
|
|
12
|
+
* - Discord
|
|
13
|
+
* - Slack
|
|
14
|
+
* - VS Code
|
|
15
|
+
* - GitHub Desktop
|
|
16
|
+
* - Notion
|
|
17
|
+
*
|
|
18
|
+
* The clean fix is to bridge to their embedded Chromium via CDP. That
|
|
19
|
+
* requires the app to be launched with a remote-debugging port. We
|
|
20
|
+
* cannot attach to an already-running app that wasn't launched that
|
|
21
|
+
* way, but we CAN:
|
|
22
|
+
*
|
|
23
|
+
* 1. Detect which running processes are Electron/WebView2 shells by
|
|
24
|
+
* process-name heuristics + module snooping (on Windows).
|
|
25
|
+
* 2. Scan the common Electron remote-debug port range for already-
|
|
26
|
+
* enabled /json endpoints.
|
|
27
|
+
* 3. Tell the agent HOW to relaunch the app with debugging enabled
|
|
28
|
+
* so a bridge can attach.
|
|
29
|
+
*
|
|
30
|
+
* This file ships two tools:
|
|
31
|
+
* - `detect_webview_apps` — enumerate candidates + their CDP status
|
|
32
|
+
* - `attach_webview_cdp` — discover the debugger URL and connect
|
|
33
|
+
* the existing cdp_driver to it
|
|
34
|
+
*
|
|
35
|
+
* Linux TODO: the same heuristics apply (look for
|
|
36
|
+
* /proc/{pid}/cmdline containing `--type=renderer` or `.asar`), but
|
|
37
|
+
* AT-SPI already gives us a richer tree on Linux Electron apps than
|
|
38
|
+
* UIA does on Windows. Follow-up.
|
|
39
|
+
*/
|
|
40
|
+
import type { ToolDefinition } from './types';
|
|
41
|
+
export declare function getElectronBridgeTools(): ToolDefinition[];
|