@aryacode/dsh-plugin-arya-computer-use 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/NOTICE.md +18 -0
- package/README.md +108 -2
- package/client.js +492 -0
- package/cordis.patch.yml +16 -0
- package/docs/PLAN.md +151 -0
- package/icon.svg +6 -0
- package/index.js +622 -0
- package/locale/en.json +6 -0
- package/mcp/activity.mjs +299 -0
- package/mcp/adapter-server.mjs +626 -0
- package/mcp/browser-launcher.mjs +66 -0
- package/mcp/settings.mjs +87 -0
- package/mcp/takeover.mjs +253 -0
- package/package.json +88 -4
- package/scripts/ocr.ps1 +95 -0
- package/scripts/windows-takeover.cs +1190 -0
- package/scripts/windows-takeover.ps1 +25 -0
- package/skills/arya-desktop/SKILL.md +75 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
param([Parameter(Mandatory=$true)][string]$CancelEvent, [switch]$TestMode)
|
|
2
|
+
$ErrorActionPreference = 'Stop'
|
|
3
|
+
[Console]::InputEncoding = New-Object System.Text.UTF8Encoding($false)
|
|
4
|
+
[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
|
|
5
|
+
try {
|
|
6
|
+
Add-Type -AssemblyName System.Windows.Forms, System.Drawing
|
|
7
|
+
$source = [IO.File]::ReadAllText((Join-Path $PSScriptRoot 'windows-takeover.cs'), [Text.Encoding]::UTF8)
|
|
8
|
+
if ($PSVersionTable.PSEdition -eq 'Core') {
|
|
9
|
+
$references = @(Get-ChildItem -LiteralPath (Join-Path $PSHOME 'ref') -Filter '*.dll' | ForEach-Object { $_.FullName })
|
|
10
|
+
$references += [System.Windows.Forms.Form].Assembly.Location
|
|
11
|
+
$references += [System.Drawing.Graphics].Assembly.Location
|
|
12
|
+
$references += [System.Reflection.Assembly]::Load('System.Windows.Forms.Primitives').Location
|
|
13
|
+
$references += [System.Reflection.Assembly]::Load('Microsoft.Win32.SystemEvents').Location
|
|
14
|
+
# .NET 10 splits Windows Forms / drawing contracts into these assemblies.
|
|
15
|
+
$references += @(Get-ChildItem -LiteralPath $PSHOME -Filter 'System.Private.Windows*.dll' | ForEach-Object { $_.FullName })
|
|
16
|
+
Add-Type -TypeDefinition ("#define WCU_CORE`n" + $source) -ReferencedAssemblies $references
|
|
17
|
+
} else {
|
|
18
|
+
Add-Type -AssemblyName System.Web.Extensions
|
|
19
|
+
Add-Type -TypeDefinition $source -ReferencedAssemblies System.Windows.Forms,System.Drawing,System.Web.Extensions
|
|
20
|
+
}
|
|
21
|
+
[DshTakeover.Host]::Run($CancelEvent, [bool]$TestMode)
|
|
22
|
+
} catch {
|
|
23
|
+
[Console]::Error.WriteLine($_.Exception.ToString())
|
|
24
|
+
exit 1
|
|
25
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arya-desktop
|
|
3
|
+
description: Drive Windows desktop applications through semantic UIA refs (snapshot -> act -> verify) with the arya_desktop MCP tools: click, set_value, type, press, scroll, find, launch, windows, OCR fallback, batch. Use when asked to operate a native app (Notepad, Explorer, Office, Studio 5000, RSLogix, FTView, MotionWorks, any Win32/XAML window).
|
|
4
|
+
whenToUse: Any task that requires seeing or controlling a Windows desktop application.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Arya Desktop — observe, act, verify
|
|
8
|
+
|
|
9
|
+
You drive Windows apps through `mcp__arya_desktop__*` tools. The engine reads
|
|
10
|
+
UIA trees and presses controls by their **semantic actions** — never pixels.
|
|
11
|
+
Screenshots are evidence, not input.
|
|
12
|
+
|
|
13
|
+
## The loop
|
|
14
|
+
|
|
15
|
+
1. **Observe** — `snapshot` the target window. Dense windows: `skeleton: true`
|
|
16
|
+
or `compact: true` first, then `root: <ref>` to drill into the part you need.
|
|
17
|
+
Chromium-based windows (Chrome, Electron, Obsidian, VS Code webviews) start
|
|
18
|
+
thin and grow: pass `timeout_ms: 10000`–`25000` and re-snapshot after the
|
|
19
|
+
first contact.
|
|
20
|
+
2. **Act** — one action on one ref: `click`, `set_value`, `type`, `press`,
|
|
21
|
+
`scroll`. Prefer `set_value` for edits: it writes through the accessibility
|
|
22
|
+
value pattern and never touches the pointer. `type` needs real keystrokes, so
|
|
23
|
+
in the default background mode it only works on targets that accept
|
|
24
|
+
synthetic text; when it fails, either use `set_value` or enable headed input
|
|
25
|
+
for this conversation with `tools {operation:"headed",on:true}`.
|
|
26
|
+
3. **Verify** — re-`snapshot` (or `get`/`is` on the ref). The envelope tells
|
|
27
|
+
you what happened:
|
|
28
|
+
- `delivered_verified` — confirmed by readback.
|
|
29
|
+
- `delivered_unverified` + `retry: unsafe` — engine cannot prove it; do NOT
|
|
30
|
+
blind-repeat. Re-observe first.
|
|
31
|
+
- `ACTION_FAILED` with `details.kind: post_action_verification` — the action
|
|
32
|
+
LANDED, the readback differs. Read `details.post_state`; do NOT retry.
|
|
33
|
+
- `STALE_REF` / `AMBIGUOUS_TARGET` — re-snapshot; refs die when the window
|
|
34
|
+
changes. Identical twins (same control twice) refuse refs: pick with
|
|
35
|
+
headed `click` at coordinates after `tools {operation:"headed",on:true}`.
|
|
36
|
+
|
|
37
|
+
## Rules that keep you safe
|
|
38
|
+
|
|
39
|
+
- **One action, then look.** Do not fire a chain of actions on a stale tree.
|
|
40
|
+
When you must chain, use `batch` (1–20 steps, stops on first error, then
|
|
41
|
+
observes once).
|
|
42
|
+
- **Elevation.** This host must run as Administrator. If you see
|
|
43
|
+
`lease_directory_untrusted`, tell the user: restart AryaCode as Administrator.
|
|
44
|
+
- **Headed toggle.** Default is headless (no mouse/keyboard takeover): semantic
|
|
45
|
+
UIA input goes straight to the control and never moves the user's pointer.
|
|
46
|
+
When headless cannot do the job (cursor-moving input, notifications, start
|
|
47
|
+
menu, tray, surfaces that reject background input), call
|
|
48
|
+
`tools {operation:"headed",on:true}` for this conversation, then `on:false`
|
|
49
|
+
when done. Headed input briefly focuses the target window and drives the real
|
|
50
|
+
keyboard/mouse, so warn the user before switching it on.
|
|
51
|
+
- **Launch.** Bare names resolve only under System32 (`notepad` works,
|
|
52
|
+
`chrome` does not). Use the absolute exe path. If many instances run, the
|
|
53
|
+
engine refuses to guess — that is correct; ask the user.
|
|
54
|
+
- **Destructive actions** (delete, send, pay, submit, close unsaved work,
|
|
55
|
+
kill processes) require the user's confirmation first.
|
|
56
|
+
- **No UIA tree** (games, canvas UIs, remote desktops): `ocr` reads text with
|
|
57
|
+
screenshot pixel coordinates; headed clicks at those coordinates are the
|
|
58
|
+
fallback. OCR hits are not refs.
|
|
59
|
+
- **Web pages are not in the UIA tree.** Chrome/Electron page content needs
|
|
60
|
+
the `arya_browser` lane (agent-browser MCP) — use `mcp__arya_browser__*`
|
|
61
|
+
tools for anything inside a web page.
|
|
62
|
+
- **Menus:** expand a menuitem (`click` on a `haspopup` item, or `expand`),
|
|
63
|
+
then snapshot the menu surface. Win32/WPF/Chromium menus are detected;
|
|
64
|
+
WinUI3/MSIX menus may not be — fall back to OCR + headed click.
|
|
65
|
+
- **End your turn clean:** when finished driving, call
|
|
66
|
+
`tools {operation:"session_end"}` so the driver session and overlay release.
|
|
67
|
+
|
|
68
|
+
## Session & state
|
|
69
|
+
|
|
70
|
+
- Each conversation gets its own engine session automatically on first action
|
|
71
|
+
(`tools` shows its id and state).
|
|
72
|
+
- Screenshots land in files (paths returned in results) — open them with the
|
|
73
|
+
read tool when you need the picture.
|
|
74
|
+
- `tools {operation:"list"}` shows the tool surface and current state
|
|
75
|
+
(session, headed, overlay).
|