@momasiku/dsh-pilot 0.5.11 → 0.5.12
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/lib/scripts/_dsh-action.ps1 +21 -0
- package/package.json +1 -1
|
@@ -24,6 +24,12 @@ $script:ActionStopPayload = $null
|
|
|
24
24
|
# point at a different control; this is what lets a click notice that.
|
|
25
25
|
$script:UiListing = $null
|
|
26
26
|
|
|
27
|
+
# Chromium builds its accessibility tree lazily: the first client to ask gets a
|
|
28
|
+
# nearly empty answer while the tree is still being constructed. Measured on the
|
|
29
|
+
# harness window right after a restart: 3 elements, then 77 a moment later. One
|
|
30
|
+
# retry per worker turns that into a correct first answer.
|
|
31
|
+
$script:UiWarmed = $false
|
|
32
|
+
|
|
27
33
|
function Write-ActionError([string] $message) {
|
|
28
34
|
$script:ActionStopPayload = [ordered]@{ ok = $false; error = $message }
|
|
29
35
|
throw [System.Exception]::new($message)
|
|
@@ -394,11 +400,26 @@ switch ($action) {
|
|
|
394
400
|
$moRaw = Get-Param 'meaningfulOnly'
|
|
395
401
|
if ($null -ne $moRaw) { $meaningfulOnly = [bool] $moRaw }
|
|
396
402
|
$tree = Get-DshUiaNodes -Handle $treeHandle -IncludeValues $includeValues -MeaningfulOnly $meaningfulOnly
|
|
403
|
+
if (-not $script:UiWarmed -and $tree.total -lt 8) {
|
|
404
|
+
# A window that really has fewer than eight elements pays one extra read
|
|
405
|
+
# once per worker; a cold Electron window is the case this exists for.
|
|
406
|
+
Start-Sleep -Milliseconds 300
|
|
407
|
+
$tree = Get-DshUiaNodes -Handle $treeHandle -IncludeValues $includeValues -MeaningfulOnly $meaningfulOnly
|
|
408
|
+
}
|
|
409
|
+
if ($tree.total -ge 8) { $script:UiWarmed = $true }
|
|
397
410
|
if (-not $tree.ok) { Write-ActionError $tree.error }
|
|
398
411
|
$items = @{}
|
|
399
412
|
foreach ($n in $tree.nodes) { $items[[int] $n.index] = @{ role = [string] $n.role; name = [string] $n.name } }
|
|
400
413
|
$script:UiListing = @{ handle = [long] $treeHandle; items = $items }
|
|
401
414
|
$lines = Format-DshUiaNodes -Nodes $tree.nodes -Truncated $tree.truncated
|
|
415
|
+
if ($meaningfulOnly -and $tree.nodes.Count -eq 0) {
|
|
416
|
+
# An empty list would read as 'this window has no tree', which is the one
|
|
417
|
+
# wrong conclusion to leave a caller with: say what is actually there.
|
|
418
|
+
$full = Get-DshUiaNodes -Handle $treeHandle -MeaningfulOnly $false
|
|
419
|
+
if ($full.nodes.Count -gt 0) {
|
|
420
|
+
$lines = @(('(no operable controls here; the window has {0} elements - pass meaningfulOnly:false to see them)' -f $full.nodes.Count))
|
|
421
|
+
}
|
|
422
|
+
}
|
|
402
423
|
$treeCursor = [DshInput]::Cursor()
|
|
403
424
|
$result = [ordered]@{
|
|
404
425
|
ok = $true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momasiku/dsh-pilot",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"description": "Desktop vision and control for DeepSeek Harness - the whole Windows machine, any application, not browser automation: screen_view captures the live screen as an image the model can see, desktop_control drives the mouse, keyboard, and windows against the exact same pixel space; desktop_sequence runs a whole batch of actions in one call and looks once at the end.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "momasiku",
|