@elurjs/universal 0.1.1 → 0.1.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.
Files changed (36) hide show
  1. package/cli/commands.mjs +2 -2
  2. package/cli/create-app.mjs +88 -5
  3. package/cli/dev.mjs +50 -0
  4. package/cli/tck-platform-windows.mjs +450 -0
  5. package/cli/tck-windows-uia.ps1 +312 -0
  6. package/cli/vm-agent.ps1 +25 -0
  7. package/cli/vm-job-server.py +97 -0
  8. package/cli/vm-job.py +46 -0
  9. package/docs/ESTADO.md +5 -1
  10. package/docs/PENDIENTES.md +160 -8
  11. package/docs/adr/0218-sdui-gateway-live-mcp-y-scaffold.md +1 -0
  12. package/docs/adr/0220-target-windows-winui3.md +331 -0
  13. package/docs/adr/0221-shell-tabs-desktop-normativa.md +45 -0
  14. package/docs/adr/README.md +11 -10
  15. package/docs/doc-data.json +395 -104
  16. package/docs/propuestas/demo-google-devfest-a2ui-sdui.md +169 -54
  17. package/docs/skills/elur-sdui-mcp/SKILL.md +100 -0
  18. package/examples/natprobe/entry-a11y.ts +52 -0
  19. package/examples/natprobe/entry-tinput.ts +73 -0
  20. package/examples/natprobe/entry-tml.ts +46 -0
  21. package/examples/natprobe/entry.ts +89 -0
  22. package/examples/uiprops/elur.app.json +8 -0
  23. package/examples/uiprops/entry.ts +65 -0
  24. package/native/ed25519/tweetnacl.c +809 -0
  25. package/native/ed25519/tweetnacl.h +272 -0
  26. package/package.json +1 -1
  27. package/src/app/state.ts +1 -1
  28. package/src/backends/web/base-css.ts +5 -0
  29. package/src/backends/web/index.ts +55 -2
  30. package/src/ir/catalog.ts +17 -3
  31. package/src/ir/schema.ts +245 -94
  32. package/src/native/http.ts +1 -1
  33. package/src/runtime/environment.ts +1 -1
  34. package/src/sdui/cryptoModule.ts +1 -1
  35. package/src/sdui/profile.ts +3 -2
  36. package/targets/android/app/src/main/java/com/elur/universal/ElurRenderer.kt +55 -3
@@ -0,0 +1,312 @@
1
+ # cli/tck-windows-uia.ps1 — probe UIA del harness T6 Windows (ADR-0220).
2
+ # Observa el host por la API de accesibilidad real de la plataforma
3
+ # (equivalente al uiautomator dump de Android y al AT-SPI de Linux):
4
+ # árbol, ControlType, nombres, BoundingRectangle (pantalla) y patrones.
5
+ #
6
+ # Uso (corre DENTRO del guest Windows — el orquestador lo invoca por el
7
+ # job server):
8
+ # tck-windows-uia.ps1 dump <pid> → JSON [{name,role,x,y,w,h,text}]
9
+ # tck-windows-uia.ps1 focus <pid> <name> → SetFocus/click al centro
10
+ # tck-windows-uia.ps1 type <pid> <name> <s> → foco + SendKeys del texto
11
+ # tck-windows-uia.ps1 click <x> <y> → mouse_event b1 en (x,y)
12
+ # tck-windows-uia.ps1 wheel <x> <y> <n> → n notches MOUSEEVENTF_WHEEL
13
+ # tck-windows-uia.ps1 shot <x> <y> <w> <h> <out.png>
14
+ # tck-windows-uia.ps1 resize <pid> <w> <h> → MoveWindow en la ventana
15
+ # tck-windows-uia.ps1 keys <combo> → SendKeys ("^s", "{ENTER}"…)
16
+ # tck-windows-uia.ps1 longpress <x> <y> <ms>
17
+ # tck-windows-uia.ps1 drag <x1> <y1> <x2> <y2> <pasos>
18
+ #
19
+ # Todo emite JSON por stdout; errores a stderr + exit 1.
20
+
21
+ param([Parameter(Mandatory=$true)][string]$Cmd,
22
+ [Parameter(ValueFromRemainingArguments=$true)][string[]]$Rest)
23
+
24
+ # El agente captura esta stdout decodificando UTF-8; con el codepage OEM
25
+ # por defecto (CP850) un '→' sale como byte 0x1A y llega como U+001A.
26
+ [Console]::OutputEncoding = [Text.Encoding]::UTF8
27
+
28
+ Add-Type -AssemblyName UIAutomationClient
29
+ Add-Type -AssemblyName UIAutomationTypes
30
+ Add-Type -AssemblyName System.Windows.Forms
31
+ Add-Type -AssemblyName System.Drawing
32
+
33
+ $sig = @'
34
+ using System;
35
+ using System.Runtime.InteropServices;
36
+ public class U32T {
37
+ [DllImport("user32.dll")] public static extern bool SetCursorPos(int x,int y);
38
+ [DllImport("user32.dll")] public static extern void mouse_event(uint f,int x,int y,int d,int e);
39
+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);
40
+ [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr h,int c);
41
+ [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h,IntPtr i,int x,int y,int cx,int cy,uint f);
42
+ [DllImport("user32.dll")] public static extern bool MoveWindow(IntPtr h,int x,int y,int w,int hh,bool r);
43
+ [DllImport("user32.dll")] public static extern IntPtr WindowFromPoint(System.Drawing.Point p);
44
+ [DllImport("user32.dll")] public static extern int GetWindowThreadProcessId(IntPtr h,out int p);
45
+ [StructLayout(LayoutKind.Sequential)] public struct MI { public int dx,dy,d,du; public int dwF,time; public IntPtr ex; }
46
+ [StructLayout(LayoutKind.Sequential)] public struct INP { public int type; public MI mi; }
47
+ [DllImport("user32.dll")] public static extern uint SendInput(uint n, INP[] p, int cb);
48
+ public const uint LD=0x02, LU=0x04, WHEEL=0x0800;
49
+ }
50
+ '@
51
+ Add-Type -TypeDefinition $sig -ReferencedAssemblies @(
52
+ 'System.Windows.Forms','System.Drawing','UIAutomationClient','UIAutomationTypes')
53
+
54
+ function Fail($m) { [Console]::Error.WriteLine($m); exit 1 }
55
+
56
+ $auto = [System.Windows.Automation.AutomationElement]
57
+ $pt = [System.Windows.Automation.PropertyCondition]
58
+
59
+ function AppWindow([int]$pid_) {
60
+ $w = $auto::RootElement.FindFirst(
61
+ [System.Windows.Automation.TreeScope]::Children,
62
+ (New-Object $pt($auto::ProcessIdProperty, $pid_)))
63
+ if (-not $w) { Fail "ventana no encontrada: pid $pid_" }
64
+ return $w
65
+ }
66
+
67
+ function NodeInfo($el, [int]$depth) {
68
+ $c = $el.Current
69
+ $o = [ordered]@{
70
+ name = [string]$c.Name
71
+ role = ($c.ControlType.ProgrammaticName -replace '^ControlType\.','')
72
+ depth = $depth
73
+ }
74
+ try { $o.lct = [string]$c.LocalizedControlType } catch {}
75
+ try {
76
+ $r = $c.BoundingRectangle
77
+ $o.x = [int]$r.X; $o.y = [int]$r.Y; $o.w = [int]$r.Width; $o.h = [int]$r.Height
78
+ } catch {}
79
+ try {
80
+ $vp = $el.GetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern)
81
+ if ($vp) { $o.value = [string]$vp.Current.Value }
82
+ } catch {}
83
+ try {
84
+ if ($el.GetCurrentPattern([System.Windows.Automation.TextPattern]::Pattern)) {
85
+ $o.text = $el.GetCurrentPattern([System.Windows.Automation.TextPattern]::Pattern).DocumentRange.GetText(-1)
86
+ } else {
87
+ $o.text = [string]$c.Name
88
+ }
89
+ } catch { $o.text = [string]$c.Name }
90
+ return $o
91
+ }
92
+
93
+ $tw = [System.Windows.Automation.TreeWalker]::ControlViewWalker
94
+ function Walk($el, [int]$depth, $acc) {
95
+ if ($depth -gt 24 -or $null -eq $el) { return }
96
+ try {
97
+ [void]$acc.Add((NodeInfo $el $depth))
98
+ # ControlViewWalker: la vista real de a11y — salta wrappers
99
+ # no-control y poda accessible=false (misma semántica que AT-SPI /
100
+ # uiautomator importantForA11y). FindAll(Children, cond) NO sirve:
101
+ # no desciende por hijos que no matchean la condición.
102
+ $k = $tw.GetFirstChild($el)
103
+ while ($k) { Walk $k ($depth + 1) $acc; $k = $tw.GetNextSibling($k) }
104
+ } catch { }
105
+ }
106
+
107
+ function FindNamed($win, [string]$name) {
108
+ return $win.FindFirst([System.Windows.Automation.TreeScope]::Descendants,
109
+ (New-Object $pt($auto::NameProperty, $name)))
110
+ }
111
+
112
+ function FocusTarget($el) {
113
+ # El `label` vive en el wrapper Custom; el control interactivo real
114
+ # (Edit, Button…) es el primer descendiente con un patrón de entrada.
115
+ foreach ($patt in @(
116
+ [System.Windows.Automation.ValuePattern]::Pattern,
117
+ [System.Windows.Automation.InvokePattern]::Pattern,
118
+ [System.Windows.Automation.TogglePattern]::Pattern,
119
+ [System.Windows.Automation.SelectionItemPattern]::Pattern)) {
120
+ try {
121
+ if ($el.GetCurrentPattern($patt)) { return $el }
122
+ } catch {}
123
+ }
124
+ try {
125
+ $d = $el.FindFirst([System.Windows.Automation.TreeScope]::Descendants,
126
+ (New-Object $pt($auto::IsEnabledProperty, $true)))
127
+ if ($d) {
128
+ foreach ($patt in @(
129
+ [System.Windows.Automation.ValuePattern]::Pattern,
130
+ [System.Windows.Automation.InvokePattern]::Pattern,
131
+ [System.Windows.Automation.TogglePattern]::Pattern,
132
+ [System.Windows.Automation.SelectionItemPattern]::Pattern)) {
133
+ try { if ($d.GetCurrentPattern($patt)) { return $d } } catch {}
134
+ }
135
+ return $d
136
+ }
137
+ } catch {}
138
+ return $el
139
+ }
140
+
141
+ function ClickXY([int]$x, [int]$y) {
142
+ [U32T]::SetCursorPos($x, $y) | Out-Null
143
+ [U32T]::mouse_event([U32T]::LD, 0, 0, 0, 0)
144
+ Start-Sleep -Milliseconds 60
145
+ [U32T]::mouse_event([U32T]::LU, 0, 0, 0, 0)
146
+ }
147
+
148
+ function RaiseApp($win) {
149
+ # Los pixels/SendKeys/clicks del harness leen la pantalla real; una
150
+ # consola encima convierte todo en [12,12,12]. El exe es subsystem
151
+ # console: al lanzarlo sin consola heredable Windows 11 abre su
152
+ # terminal por defecto (WindowsTerminal) encima de la app — hay que
153
+ # ocultarlo. SetForegroundWindow se bloquea desde procesos en
154
+ # background: solo HWND_TOPMOST deja la app por encima.
155
+ Get-Process WindowsTerminal -ErrorAction SilentlyContinue |
156
+ ForEach-Object { [U32T]::ShowWindow($_.MainWindowHandle, 0) | Out-Null }
157
+ $h = [IntPtr]$win.Current.NativeWindowHandle
158
+ # El raise fija la posición para que los px del harness sean
159
+ # deterministas — la ventana debe quedar ENTERA dentro de la pantalla
160
+ # (los nodos a x>ScreenWidth no existen en el framebuffer: px=negro).
161
+ $sw = [Windows.Forms.SystemInformation]::PrimaryMonitorSize.Width
162
+ $sh = [Windows.Forms.SystemInformation]::PrimaryMonitorSize.Height
163
+ $wr = $win.Current.BoundingRectangle
164
+ $x = [Math]::Max(0, [Math]::Min(40, $sw - $wr.Width - 10))
165
+ $y = [Math]::Max(0, [Math]::Min(40, $sh - $wr.Height - 60))
166
+ [U32T]::ShowWindow($h, 9) | Out-Null
167
+ [U32T]::SetWindowPos($h, [IntPtr](-1), $x, $y, 0, 0, 1) | Out-Null
168
+ [U32T]::SetForegroundWindow($h) | Out-Null
169
+ }
170
+
171
+ function ClickCenter($el) {
172
+ $r = $el.Current.BoundingRectangle
173
+ ClickXY ([int]($r.X + $r.Width / 2)) ([int]($r.Y + $r.Height / 2))
174
+ }
175
+
176
+ switch ($Cmd) {
177
+ 'dump' {
178
+ $win = AppWindow ([int]$Rest[0])
179
+ $acc = New-Object System.Collections.ArrayList
180
+ Walk $win 0 $acc
181
+ # ArrayList → JSON plano
182
+ $arr = @($acc)
183
+ ConvertTo-Json -Compress -Depth 4 @(if ($arr.Count -eq 1) { ,$arr[0] } else { $arr })
184
+ }
185
+ 'focus' {
186
+ $win = AppWindow ([int]$Rest[0])
187
+ RaiseApp $win
188
+ $el = FindNamed $win $Rest[1]
189
+ if (-not $el) { Fail "nodo no encontrado: $($Rest[1])" }
190
+ $el = FocusTarget $el
191
+ try { $el.SetFocus(); ConvertTo-Json -Compress @{focused=$Rest[1]}; break } catch {}
192
+ ClickCenter $el
193
+ ConvertTo-Json -Compress @{focused=$Rest[1]}
194
+ }
195
+ 'type' {
196
+ $win = AppWindow ([int]$Rest[0])
197
+ RaiseApp $win
198
+ $el = FindNamed $win $Rest[1]
199
+ if (-not $el) { Fail "nodo no encontrado: $($Rest[1])" }
200
+ $el = FocusTarget $el
201
+ # SendKeys va al foco OS, no al foco UIA — un click real lleva las
202
+ # dos cosas al control (además de caret), igual que un usuario.
203
+ ClickCenter $el
204
+ Start-Sleep -Milliseconds 300
205
+ try { $el.SetFocus() } catch {}
206
+ $txt = $Rest[2] -replace '([+^%~(){}\[\]])', '{$1}'
207
+ [System.Windows.Forms.SendKeys]::SendWait($txt)
208
+ ConvertTo-Json -Compress @{typed=$Rest[2]}
209
+ }
210
+ 'click' { ClickXY ([int]$Rest[0]) ([int]$Rest[1])
211
+ ConvertTo-Json -Compress @{clicked=@([int]$Rest[0],[int]$Rest[1])} }
212
+ 'raise' {
213
+ $win = AppWindow ([int]$Rest[0])
214
+ RaiseApp $win
215
+ ConvertTo-Json -Compress @{raised=$Rest[0]; hwnd=[int64]$win.Current.NativeWindowHandle}
216
+ }
217
+ 'at' {
218
+ # qué ventana está realmente en (x,y) — diagnóstico de z-order.
219
+ $h = [U32T]::WindowFromPoint((New-Object System.Drawing.Point([int]$Rest[0],[int]$Rest[1])))
220
+ $wp = 0
221
+ [U32T]::GetWindowThreadProcessId($h, [ref]$wp) | Out-Null
222
+ $pn = (Get-Process -Id $wp -ErrorAction SilentlyContinue).ProcessName
223
+ ConvertTo-Json -Compress @{x=[int]$Rest[0]; y=[int]$Rest[1]; hwnd=[int64]$h; pid=$wp; proc=$pn}
224
+ }
225
+ 'props' {
226
+ $win = AppWindow ([int]$Rest[0])
227
+ $el = FindNamed $win $Rest[1]
228
+ if (-not $el) { Fail "nodo no encontrado: $($Rest[1])" }
229
+ $c = $el.Current
230
+ $r = $c.BoundingRectangle
231
+ ConvertTo-Json -Compress ([ordered]@{
232
+ name=$c.Name; ct=$c.ControlType.ProgrammaticName; cls=$c.ClassName;
233
+ off=$c.IsOffscreen; en=$c.IsEnabled; rect="$($r.X),$($r.Y),$($r.Width)x$($r.Height)" })
234
+ }
235
+ 'wheel' {
236
+ [U32T]::SetCursorPos([int]$Rest[0], [int]$Rest[1]) | Out-Null
237
+ $n = [int]$Rest[2]
238
+ for ($i = 0; $i -lt [Math]::Abs($n); $i++) {
239
+ [U32T]::mouse_event([U32T]::WHEEL, 0, 0, $(if ($n -gt 0) { 120 } else { -120 }), 0)
240
+ Start-Sleep -Milliseconds 120
241
+ }
242
+ ConvertTo-Json -Compress @{wheeled=@([int]$Rest[0],[int]$Rest[1],$n)}
243
+ }
244
+ 'px' {
245
+ # Pixel de pantalla en (x,y) — evidencia sin mover PNGs al host.
246
+ $bmp = New-Object System.Drawing.Bitmap 1, 1
247
+ $g = [System.Drawing.Graphics]::FromImage($bmp)
248
+ $g.CopyFromScreen([int]$Rest[0], [int]$Rest[1], 0, 0,
249
+ (New-Object System.Drawing.Size 1, 1))
250
+ $c = $bmp.GetPixel(0, 0)
251
+ $g.Dispose(); $bmp.Dispose()
252
+ ConvertTo-Json -Compress @{rgb=@($c.R,$c.G,$c.B)}
253
+ }
254
+ 'shot' {
255
+ $x=[int]$Rest[0]; $y=[int]$Rest[1]; $w=[int]$Rest[2]; $h=[int]$Rest[3]
256
+ $bmp = New-Object System.Drawing.Bitmap $w, $h
257
+ $g = [System.Drawing.Graphics]::FromImage($bmp)
258
+ $g.CopyFromScreen($x, $y, 0, 0, (New-Object System.Drawing.Size $w, $h))
259
+ $bmp.Save($Rest[4], [System.Drawing.Imaging.ImageFormat]::Png)
260
+ $g.Dispose(); $bmp.Dispose()
261
+ ConvertTo-Json -Compress @{shot=$Rest[4]; size=@($w,$h)}
262
+ }
263
+ 'resize' {
264
+ $p = Get-Process -Id ([int]$Rest[0]) -ErrorAction SilentlyContinue
265
+ if (-not $p) { Fail "proceso no encontrado: $($Rest[0])" }
266
+ [U32T]::MoveWindow($p.MainWindowHandle, 40, 40, [int]$Rest[1], [int]$Rest[2], $true) | Out-Null
267
+ ConvertTo-Json -Compress @{resized=@([int]$Rest[1],[int]$Rest[2])}
268
+ }
269
+ 'keys' {
270
+ [System.Windows.Forms.SendKeys]::SendWait($Rest[0])
271
+ ConvertTo-Json -Compress @{keys=$Rest[0]}
272
+ }
273
+ 'longpress' {
274
+ $x=[int]$Rest[0]; $y=[int]$Rest[1]
275
+ [U32T]::SetCursorPos($x, $y) | Out-Null
276
+ [U32T]::mouse_event([U32T]::LD, 0, 0, 0, 0)
277
+ Start-Sleep -Milliseconds ([int]$Rest[2])
278
+ [U32T]::mouse_event([U32T]::LU, 0, 0, 0, 0)
279
+ ConvertTo-Json -Compress @{longpress=@($x,$y,[int]$Rest[2])}
280
+ }
281
+ 'drag' {
282
+ $x1=[int]$Rest[0]; $y1=[int]$Rest[1]; $x2=[int]$Rest[2]; $y2=[int]$Rest[3]
283
+ $steps = [Math]::Max(1, [int]$Rest[4])
284
+ # SendInput (MOVE|ABSOLUTE): SetCursorPos no genera PointerMoved en
285
+ # el stack de punteros de WinUI 3 (los clicks sí pasan por
286
+ # WM_LBUTTON* — el move sintético solo WM_MOUSEMOVE, que la isla
287
+ # no traduce a pointer).
288
+ $sw=[Windows.Forms.SystemInformation]::PrimaryMonitorSize.Width
289
+ $sh=[Windows.Forms.SystemInformation]::PrimaryMonitorSize.Height
290
+ $mi = { param($x,$y,$f)
291
+ $i = New-Object U32T+INP
292
+ $i.type = 0
293
+ $i.mi.dx = [int]($x * 65535 / ($sw - 1))
294
+ $i.mi.dy = [int]($y * 65535 / ($sh - 1))
295
+ $i.mi.dwF = $f -bor 0x8000
296
+ return ,@($i)
297
+ }
298
+ [U32T]::SendInput(1, (& $mi $x1 $y1 0x0001), 40) | Out-Null
299
+ Start-Sleep -Milliseconds 50
300
+ [U32T]::mouse_event([U32T]::LD, 0, 0, 0, 0)
301
+ Start-Sleep -Milliseconds 50
302
+ for ($i = 1; $i -le $steps; $i++) {
303
+ $px = $x1 + ($x2-$x1)*$i/$steps
304
+ $py = $y1 + ($y2-$y1)*$i/$steps
305
+ [U32T]::SendInput(1, (& $mi $px $py 0x0001), 40) | Out-Null
306
+ Start-Sleep -Milliseconds 20
307
+ }
308
+ [U32T]::mouse_event([U32T]::LU, 0, 0, 0, 0)
309
+ ConvertTo-Json -Compress @{drag=@($x1,$y1,$x2,$y2,$steps)}
310
+ }
311
+ default { Fail "cmd desconocido: $Cmd" }
312
+ }
@@ -0,0 +1,25 @@
1
+ # cli/vm-agent.ps1 — agente guest del job server (cli/vm-job-server.py).
2
+ # Corre dentro de la VM Windows: pollea /poll cada 400ms, ejecuta el cmd
3
+ # recibido por cmd /c y POSTea la salida a /result. La plantilla se
4
+ # sirve con __VM__/__PORT__ sustituidos por el server.
5
+ $h='http://10.0.2.2:__PORT__'
6
+ $vm='__VM__'
7
+ # PS decodifica la stdout de procesos hijo con [Console]::OutputEncoding;
8
+ # sin UTF-8 un '→' emitido por el probe llega mojibake ('ÔåÆ').
9
+ [Console]::OutputEncoding = [Text.Encoding]::UTF8
10
+ while($true){
11
+ try{
12
+ $j=irm "$h/poll?vm=$vm" -TimeoutSec 5
13
+ if($j.id){
14
+ try{ $o=& cmd /c ($j.cmd+' 2>&1') | Out-String }
15
+ catch{ $o=$_.Exception.Message }
16
+ try{
17
+ # out como UTF8→base64: un cuerpo crudo con tildes/JSON grande
18
+ # pierde el POST entero en algunos guests (job <pending> eterno).
19
+ $b64=[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes([string]$o))
20
+ irm -Method Post -Uri "$h/result" -ContentType 'application/json' -Body (@{vm=$vm;id=$j.id;out_b64=$b64}|ConvertTo-Json -Compress) | Out-Null
21
+ }catch{}
22
+ }
23
+ }catch{}
24
+ sleep -Milliseconds 400
25
+ }
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env python3
2
+ # cli/vm-job-server.py — job server del host dev para VMs Windows
3
+ # (VirtualBox NAT). El agente guest (cli/vm-agent.ps1) pollea
4
+ # /poll/<vm>, ejecuta el cmd recibido y POSTea el resultado a /result.
5
+ # El cliente sube por /submit y lee por /fetch/<vm>/<id>.
6
+ # /agent/<vm> sirve el agente con el nombre de VM incrustado (el guest
7
+ # lo baja una vez con iex(irm http://10.0.2.2:8899/agent/<VM>)).
8
+ # /files/<p> sirve archivos del framework — el guest sincroniza
9
+ # bundles/fuentes con Invoke-WebRequest contra 10.0.2.2:8899.
10
+ #
11
+ # python3 cli/vm-job-server.py [puerto]
12
+ import http.server, json, threading, urllib.parse, os, collections, sys
13
+
14
+ ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
15
+ PORT = int(sys.argv[1]) if len(sys.argv) > 1 else 8899
16
+ queues = collections.defaultdict(collections.deque) # vm -> deque of (id,cmd)
17
+ results = {} # "vm/id" -> out
18
+ counter = [0]
19
+ lock = threading.Lock()
20
+
21
+ class H(http.server.BaseHTTPRequestHandler):
22
+ def log_message(self, *a): pass
23
+ def _j(self, obj, code=200):
24
+ b = json.dumps(obj).encode()
25
+ self.send_response(code)
26
+ self.send_header("Content-Type", "application/json")
27
+ self.send_header("Content-Length", str(len(b)))
28
+ self.end_headers(); self.wfile.write(b)
29
+ def _t(self, txt, code=200, ct="text/plain"):
30
+ b = txt.encode("utf-8", "replace")
31
+ self.send_response(code)
32
+ self.send_header("Content-Type", ct)
33
+ self.send_header("Content-Length", str(len(b)))
34
+ self.end_headers(); self.wfile.write(b)
35
+ def do_GET(self):
36
+ u = urllib.parse.urlparse(self.path)
37
+ if u.path.startswith("/agent/"):
38
+ vmname = u.path[len("/agent/"):]
39
+ tpl = open(os.path.join(ROOT, "cli", "vm-agent.ps1")).read()
40
+ self._t(tpl.replace("__VM__", vmname).replace("__PORT__", str(PORT)),
41
+ ct="text/plain")
42
+ return
43
+ if u.path == "/poll":
44
+ vm = urllib.parse.parse_qs(u.query).get("vm", [""])[0]
45
+ elif u.path.startswith("/poll/"):
46
+ vm = u.path.split("/", 2)[2]
47
+ else:
48
+ vm = None
49
+ if vm is not None:
50
+ with lock:
51
+ job = queues[vm].popleft() if queues[vm] else None
52
+ self._j(job if job else {})
53
+ return
54
+ if u.path.startswith("/fetch/"):
55
+ key = u.path[len("/fetch/"):]
56
+ with lock:
57
+ r = results.get(key)
58
+ self._t(r if r is not None else "<pending>")
59
+ return
60
+ if u.path.startswith("/files/"):
61
+ rel = urllib.parse.unquote(u.path[len("/files/"):])
62
+ p = os.path.normpath(os.path.join(ROOT, rel))
63
+ if not p.startswith(ROOT) or not os.path.isfile(p):
64
+ self._t("nf", 404); return
65
+ self.send_response(200)
66
+ self.send_header("Content-Length", str(os.path.getsize(p)))
67
+ self.end_headers()
68
+ with open(p, "rb") as f: self.wfile.write(f.read())
69
+ return
70
+ self._t("ok")
71
+ def do_POST(self):
72
+ ln = int(self.headers.get("Content-Length", 0))
73
+ body = self.rfile.read(ln) if ln else b"{}"
74
+ try: d = json.loads(body)
75
+ except Exception: d = {}
76
+ u = urllib.parse.urlparse(self.path)
77
+ if u.path == "/submit":
78
+ with lock:
79
+ counter[0] += 1
80
+ jid = str(counter[0])
81
+ queues[d.get("vm", "")].append({"id": jid, "cmd": d.get("cmd", "")})
82
+ self._j({"id": jid})
83
+ return
84
+ if u.path == "/result":
85
+ out = d.get("out", "")
86
+ if "out_b64" in d:
87
+ import base64
88
+ try: out = base64.b64decode(d["out_b64"]).decode("utf-8", "replace")
89
+ except Exception: out = d["out_b64"]
90
+ with lock:
91
+ results[d.get("vm", "") + "/" + str(d.get("id", ""))] = out
92
+ self._j({"ok": True})
93
+ return
94
+ self._t("nf", 404)
95
+
96
+ print(f"[vm-job-server] :{PORT} root={ROOT}", flush=True)
97
+ http.server.ThreadingHTTPServer(("0.0.0.0", PORT), H).serve_forever()
package/cli/vm-job.py ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env python3
2
+ # cli/vm-job.py — cliente del job server (cli/vm-job-server.py).
3
+ # vm-job.py <vm> "<cmd>" [timeout] → imprime la salida del job
4
+ # vm-job.py <vm> <archivo.ps1> [timeout] → sube el .ps1 por base64 y
5
+ # lo ejecuta con -file (evita quoting de cmd y patrones
6
+ # iex/irm bloqueados por ASR en algunos guests)
7
+ import sys, os, base64, json, urllib.request, time
8
+
9
+ JOB = os.environ.get("ELUR_VM_JOB", "http://localhost:8899")
10
+
11
+ def submit(vm, cmd):
12
+ req = urllib.request.Request(JOB + "/submit",
13
+ data=json.dumps({"vm": vm, "cmd": cmd}).encode(),
14
+ headers={"Content-Type": "application/json"})
15
+ return json.loads(urllib.request.urlopen(req, timeout=10).read())["id"]
16
+
17
+ def fetch(key, timeout=90):
18
+ t = time.time()
19
+ while time.time() - t < timeout:
20
+ r = urllib.request.urlopen(JOB + "/fetch/" + key,
21
+ timeout=10).read().decode()
22
+ if r != "<pending>":
23
+ return r
24
+ time.sleep(0.6)
25
+ return "<timeout>"
26
+
27
+ def run(vm, cmd, timeout):
28
+ jid = submit(vm, cmd)
29
+ return fetch(f"{vm}/{jid}", timeout)
30
+
31
+ def main():
32
+ vm, arg = sys.argv[1], sys.argv[2]
33
+ timeout = float(sys.argv[3]) if len(sys.argv) > 3 else 90
34
+ if os.path.isfile(arg):
35
+ data = open(arg, "rb").read()
36
+ b64 = base64.b64encode(data).decode()
37
+ dst = rf"C:\Users\elur\job{os.getpid()}.ps1"
38
+ wr = (f"powershell -c \"[IO.File]::WriteAllText('{dst}',"
39
+ f"[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('{b64}')))\"")
40
+ run(vm, wr, 30)
41
+ print(run(vm, f"powershell -ep bypass -file {dst}", timeout))
42
+ else:
43
+ print(run(vm, arg, timeout))
44
+
45
+ if __name__ == "__main__":
46
+ main()
package/docs/ESTADO.md CHANGED
@@ -582,7 +582,11 @@ release ADR-0104 (elur.app.json, signing/AAB/splits, keep-rules,
582
582
  (R7.3 cerrado 2026-09-30: el host loguea `dlAbi`/`moduleAbi`/
583
583
  engine/fp del manifiesto al init — `MainActivity.kt`).
584
584
  - **Plataformas**: Linux nativo implementado (GTK4, TCK 36/36 — incl. platform views + gaps certificados, ADR-0181);
585
- Windows = siguiente target desktop; macOS y ChromeOS
585
+ Windows nativo implementado (WinUI 3, ADR-0220 — `text-input`
586
+ incluida: resuelto 2026-11-19 con `IXamlMetadataProvider`
587
+ code-only + merge en `OnLaunched`; verificado con typing real
588
+ y eventos en Win10 22H2 unpackaged y Win11 empaquetado);
589
+ macOS y ChromeOS
586
590
  pendientes (ADR-0180 — Tauri descartado); iOS pendiente
587
591
  (ADR-0010, requiere Mac); SDUI y 120 Hz diferidos por scope.
588
592
  - Heap JS en métricas: sin API de engine (ausencia aceptada).
@@ -767,14 +767,31 @@ sigue abierto:
767
767
  `Alt+←`=`__elur_back`, suspend/resume n/a desktop, multi-ventana=
768
768
  exclusión v1, Tab=orden de documento, `window{}` aditiva en
769
769
  `elur.app.json`. Tabla completa: propuesta §4.
770
- - [ ] **Target Windows nativo (`targets/windows/`)** — **siguiente
771
- target desktop** (ADR-0180), el más caro de iteración: WinUI 3 = C++/WinRT + Windows App
772
- SDK, **no cross-compila con mingw** (Windows real o runner
773
- `windows-*`); MSIX-first declarado; TSF evitado con `TextBox`/
774
- `RichEditBox` reales; PerMonitorV2 + `DpiChanged`; qjs compila con
775
- MSVC (Hermes-windows después); CESM vía `CreateFileMapping`; firma
776
- Authenticode+SmartScreen post-spike; deep links por protocol
777
- activation del manifest. Detalle en la propuesta §3.3.
770
+ - [ ] **Target Windows nativo (`targets/windows/`)** — **implementado
771
+ y verificado en vivo** (ADR-0220, WinUI 3 + QuickJS-ng + Yoga/CESM
772
+ compartidos; MSVC 14.44 / SDK 10.0.26100 / WASDK 2.7) en VM
773
+ Windows 11 Pro 26H2 retail limpia 26300.9457: botones, toggles,
774
+ slider, spans/href, scroll, imagen+fallback, medición y eventos
775
+ funcionan; pipeline MSIX (signed + dev-register) operativo.
776
+ **`text-input` RESUELTO (2026-11-19)**: el crash `0x80004005`
777
+ era el requisito `IXamlMetadataProvider` de apps code-only —
778
+ resuelto con el provider en `ApplicationT` + merge de
779
+ `XamlControlsResources` en `OnLaunched` + `Initialize()`.
780
+ Verificado en vivo: Win10 22H2 unpackaged (`TextBox` en UIA,
781
+ typing real, `input`/`focus` llegan al JS) y Win11 empaquetado
782
+ (`resources merged`, `value: win11`). Deploy:
783
+ `WindowsAppSdkUndockedRegFreeWinRTInitialize=false` (el
784
+ auto-init crasheaba en combase bajo identidad), bootstrap
785
+ explícito `MddBootstrapInitialize2` unpackaged +
786
+ `PackageDependency` packaged. **A11y diverge por OS**: en Win10
787
+ 22H2 el árbol UIA se expone completo y `label`/`hint`/`role`/
788
+ `required` están verificados en vivo (op `update-semantics`
789
+ implementada en el host); en 26H2 UIA no expone el subárbol
790
+ Xaml en absoluto — segundo defecto, específico de esa build.
791
+ También pendiente: Hermes-windows, firma Authenticode real,
792
+ deep links por protocol activation del manifest.
793
+ (Cerrado 2026-11-19: transiciones `nav-*` animadas — retención de
794
+ salientes + Storyboard/SplineDoubleKeyFrame, ver abajo §14.)
778
795
  - [x] **Eventos ADR-0179 on-device Android** — CERRADO 2026-10-13.
779
796
  `ElurEventsTckTest` (UiDevice + `dumpWindowHierarchy`, canal de
780
797
  instrumentación — `adb shell input` quedó descartado: MIUI filtra
@@ -1304,3 +1321,138 @@ expone budget) y un `workletArm` simulado no puede cortar un bucle
1304
1321
  infinito real — colgaría el motor. El skip por capability es el
1305
1322
  comportamiento correcto; instalar la cap en un harness modificado sería
1306
1323
  probar un motor distinto del que se distribuye.
1324
+
1325
+ ## 14. Paridad restante — plan concreto (2026-11-19, commit ef6102e)
1326
+
1327
+ Lo hecho en esta ola: linux `sticky` (GtkFixed+adjustment, ADR-0150),
1328
+ `multiline`/`rows` (swap GtkEntry→GtkScrolledWindow+GtkTextView con
1329
+ paths duales), `maxlength` UTF-16 (entry+buffer), android `pinch`
1330
+ (ScaleGestureDetector — primer emisor del vocabulario). TCK linux
1331
+ 38/38 verde. Lo que falta, ordenado por bloqueo:
1332
+
1333
+ - [x] **Windows `AutomationPeer` custom** — CERRADO 2026-11-19
1334
+ (commit dcd9932). `ElurPeer : FrameworkElementAutomationPeerT` +
1335
+ `ElurHost : ContentControlT` wrapper por nodo; expone
1336
+ SelectionItem/ExpandCollapse/Value patterns según las props
1337
+ declaradas. Verificado UIA Win10 22H2: `IsSelected=True`,
1338
+ `Expand()`→evento `action`, `Value='cuarenta y dos por ciento'`,
1339
+ `accessible=false` retira nodo+subárbol (Raw en host + poda
1340
+ `GetChildrenCore`). `actions` con nombre sigue `no` — UIA no
1341
+ tiene patrón de acciones arbitrarias (solo las derivadas de
1342
+ `expanded` entran).
1343
+ - [x] **Windows transiciones `nav-*`** — CERRADO 2026-11-19.
1344
+ Retención del saliente (`detachedEl_` en remove-child de shell) +
1345
+ Storyboard con `SplineDoubleKeyFrame` (KeySpline = la misma
1346
+ cubic-bezier que resuelve `bezierY` en linux, control points
1347
+ directos) sobre `Canvas.Left/Top`+`Opacity`+CompositeTransform
1348
+ escala; descriptor `def` custom con capas incoming/outgoing
1349
+ (ADR-0165). Verificado navdemo on-device: `inbox.x` se movió
1350
+ 170→180 en muestras UIA consecutivas (cola del easing), saliente
1351
+ deslizó y se eliminó al completar. Pitfall: `Canvas.Left` son
1352
+ dependent animations → `EnableDependentAnimation(true)`.
1353
+ - [x] **Windows sesión de medición gestual + props** — CERRADO
1354
+ 2026-11-19 (Win11, mouse_event/SendKeys+UIA, probe dedicado
1355
+ `examples/uiprops`). Gestos: `longPress`→`exact` (DispatcherTimer
1356
+ 500ms — `Holding` no dispara con ratón — + `lpFired` suprime el
1357
+ press del release), `hover`/`blur`/`contextMenu`/`pointer`/`key`
1358
+ →`exact`. `pan`/`pinch` siguen `approx`: el recognizer de
1359
+ Manipulation lo posee el elemento más profundo (deltas no
1360
+ burbujean) y el **input inyectado no produce deltas** — wiring
1361
+ correcto en `gestureEl()` (Tx|Ty|Scale, slop 8px, consumeGesture,
1362
+ gate pinch 2-contactos), pendiente hardware real. Props medidas
1363
+ →`exact`: `dir` (fix doble-volteo Yoga+FlowDirection — solo hojas),
1364
+ `shortcut` (fix modificadores — InputKeyboardSource, CoreWindow es
1365
+ null en desktop), `scrollTop`/`scrollLeft` (ChangeView→scrollbar
1366
+ nativo 120/150 por RangeValuePattern), `src`+`load` (data: URI por
1367
+ InMemoryRandomAccessStream — UriSource no lo acepta y `.get()`
1368
+ congela el UI thread), `focused` (fallback DispatcherQueue Low —
1369
+ Focus() antes del insert/Loaded es no-op), `readOnly`
1370
+ (ValuePattern.IsReadOnly=True). Detalle en ADR-0220 §Props.
1371
+ - [x] **TCK-UIA runner** — CERRADO 2026-11-19. Port completo:
1372
+ `cli/tck-platform-windows.mjs` (orquestador bun, misma lista de
1373
+ checks que linux) + `cli/tck-windows-uia.ps1` (probe UIA in-guest:
1374
+ dump/focus/type/click/wheel/shot/px/raise/at/drag/longpress) +
1375
+ transporte `cli/vm-job-server.py`+`cli/vm-agent.ps1` sobre la VM
1376
+ VirtualBox. Resultado medido Win11: **25/1** — el único FAIL es
1377
+ `TCK-EV-PAN` (el input inyectado no materializa `PointerMoved` en la
1378
+ isla XAML — gap de herramienta, ADR-0220; el path de ratón real por
1379
+ PointerMoved sí está implementado). Hallazgos del camino que ya son
1380
+ contrato del harness: la app es subsystem console y Windows 11
1381
+ hospeda su consola en una ventana de WindowsTerminal que tapa la
1382
+ app — `raise` la oculta antes de medir píxeles; la ventana se sube
1383
+ TOPMOST y se ancla dentro de la pantalla (los nodos a
1384
+ x>ScreenWidth no existen en el framebuffer: px=negro); el kill del
1385
+ runner cierra `CloseMainWindow` antes de `Stop-Process` (el swapchain
1386
+ de un WinUI matado a la fuerza deja la presentación del siguiente
1387
+ launch en blanco hasta reiniciar el adaptador/VM).
1388
+ - [x] **`shell` prop (normativa)** — CERRADO 2026-11-19 (ADR-0221):
1389
+ `no` permanente en linux+windows — el chrome de tabs inferior es
1390
+ idioma móvil; la vía es `chrome:"none"` + barra propia de la app
1391
+ (misma decisión que ADR-0177 en linux). El *tipo* shell y el modelo
1392
+ router/tabs funcionan en los 3 nativos.
1393
+ - [x] **Web/linux/windows `pinch`** — CERRADO 2026-11-19: emitido en
1394
+ los 4 backends (web PointerEvents×2, android ScaleGestureDetector,
1395
+ linux GtkGestureZoom, windows ManipulationDelta·Scale). Gestión
1396
+ gestual real no medible con input inyectado — mismo gap que `pan`
1397
+ (ADR-0220), pendiente hardware real.
1398
+ - [x] **Linux multiline — verificación GTK** — CERRADO 2026-11-19
1399
+ (ver §"Actualización 2026-11-19 noche" — AT-SPI medido).
1400
+ - [x] **`accessible=false` windows** — CERRADO 2026-11-19 con el
1401
+ AutomationPeer: `Raw` en el host + `GetChildrenCore`→vacío; el
1402
+ nodo+subárbol sale de ControlView (medido).
1403
+ - [ ] **`label` en `text` linux** — GTK4: accessible-name de un label
1404
+ es su propio texto; workaround posible: contenedor accesible
1405
+ envolvente (cambia árbol visual — decidir).
1406
+
1407
+ ### Actualización 2026-11-19 — AutomationPeer + nav-* windows
1408
+
1409
+ - `ElurPeer`/`ElurHost` (elur_uia_host.h): selected/expanded/valueText
1410
+ `no→exact` verificado UIA; `accessible=false` resuelto; `actions`
1411
+ derivadas de `expanded` llegan al JS como `action` (paridad GTK).
1412
+ - `nav-*` windows: retención+Storyboard/SplineDoubleKeyFrame —
1413
+ `inbox.x` midió 170→180 animando en UIA real (navdemo pop).
1414
+ - Build verde tras normalización de macros Win32 (FindText/
1415
+ GetClassName/GetCurrentTime → undef en elur_host_win.h antes de la
1416
+ cadena de headers generados).
1417
+
1418
+ ### Actualización 2026-11-19 noche (commit 13bfa9a)
1419
+
1420
+ - `pinch` emitido en los 4 backends: web (PointerEvents×2, distancia
1421
+ relativa+foco medio), android (ScaleGestureDetector), linux
1422
+ (GtkGestureZoom), windows (ManipulationDelta·Scale OR con pan).
1423
+ **windows pinch compilado en fuente pero SIN build en VM ni gesto
1424
+ real** — verificar al recompilar el host.
1425
+ - linux `multiline` verificado AT-SPI (input con \n llega al JS, swap
1426
+ Entry→TextView sin crash, maxlength buffer enforce 50→40 exacto).
1427
+ - `maxlength` → exact×4 (UTF-16 enforce medido en linux multiline;
1428
+ ficha divergence retirada).
1429
+ - TCK linux 38/38 ×2 corridas del día.
1430
+ - Resto del bloque §14 sigue pendiente: AutomationPeer (cierra
1431
+ selected/expanded/valueText/actions + accessible=false), nav-*
1432
+ windows, TCK-UIA runner, shell normativa, sesión gestual UIA.
1433
+
1434
+ ### Actualización 2026-11-19 — TCK-UIA runner + paridad eventos windows
1435
+
1436
+ - `cli/tck-platform-windows.mjs` + `tck-windows-uia.ps1` + job server
1437
+ vm-agent: **25/1** en Win11 (único FAIL `TCK-EV-PAN`, gap de input
1438
+ inyectado documentado). Reporte:
1439
+ `docs/benchmarks/tck-platform-windows-2026-11-20/`.
1440
+ - Fixes del host que el runner sacó a la luz (todos verificados por
1441
+ check): `parseColor` acepta `#rgb`/`#rgba` shorthand (sin ello el
1442
+ Border quedaba sin fondo → sin hit-test → sin eventos); `submit`
1443
+ emite `{"text":…}` (era `value` — bug de paridad); `press`/
1444
+ `longPress` habilitan `IsTapEnabled`/`IsHoldingEnabled` en el host y
1445
+ el Border; `key` gana foco programático diferido tras
1446
+ `PointerReleased` + fallback de `KeyDown` en la raíz (en XAML
1447
+ islands el foco de entrada queda en la raíz aunque el foco lógico
1448
+ esté en el nodo); `pan` añade path de ratón por `PointerMoved`;
1449
+ `src` de imagen lee paths relativos a stream (UriSource no soporta
1450
+ `file://` unpackaged) y asigna `Source` diferido al UI thread tras
1451
+ el decode; `label` también nombra el control interno
1452
+ (AutomationProperties.Name del Edit — TCK-IME); nav restore ya no
1453
+ crashea (`layW/layH=-1`→Width E_INVALIDARG; elemento re-insertado
1454
+ estando aún en `Children`→0x800f1000, `Parent` null aunque siga en
1455
+ la colección).
1456
+ - El `relayout` ahora dimensiona `inner`/`border` de contenedores con
1457
+ el rect de Yoga — sin ello el peer UIA reportaba bounds nulos
1458
+ (Canvas vacío colapsa a 0×0 → `IsOffscreen`).