-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathopenapi.yaml
More file actions
603 lines (565 loc) · 14.5 KB
/
openapi.yaml
File metadata and controls
603 lines (565 loc) · 14.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
openapi: 3.1.0
info:
title: OculOS API
description: |
Universal UI automation API. Control any desktop app through structured JSON.
OculOS reads the OS accessibility tree and exposes every button, text field,
checkbox, and menu item as an API endpoint.
version: 0.1.0
license:
name: MIT
url: https://github.com/huseyinstif/oculos/blob/main/LICENSE
contact:
url: https://github.com/huseyinstif/oculos
servers:
- url: http://127.0.0.1:7878
description: Local OculOS server
paths:
/health:
get:
summary: Health check
tags: [System]
responses:
"200":
description: Server status
content:
application/json:
schema:
$ref: "#/components/schemas/HealthResponse"
/windows:
get:
summary: List all visible windows
tags: [Discovery]
responses:
"200":
description: List of windows
content:
application/json:
schema:
$ref: "#/components/schemas/WindowListResponse"
/windows/{pid}/tree:
get:
summary: Full UI element tree for a process
tags: [Discovery]
parameters:
- $ref: "#/components/parameters/pid"
responses:
"200":
description: Element tree
content:
application/json:
schema:
$ref: "#/components/schemas/ElementResponse"
"404":
description: Window not found
/windows/{pid}/find:
get:
summary: Search for elements
tags: [Discovery]
parameters:
- $ref: "#/components/parameters/pid"
- name: q
in: query
description: Text to match against label or automation_id
schema:
type: string
- name: type
in: query
description: "Element type filter (Button, Edit, CheckBox, etc.)"
schema:
type: string
- name: interactive
in: query
description: "Return only elements with actions"
schema:
type: string
enum: ["true", "false"]
responses:
"200":
description: Matching elements
content:
application/json:
schema:
$ref: "#/components/schemas/ElementListResponse"
/windows/{pid}/wait:
get:
summary: Wait for an element to appear
description: Polls every 250ms until a matching element is found or timeout is reached.
tags: [Discovery]
parameters:
- $ref: "#/components/parameters/pid"
- name: q
in: query
schema:
type: string
- name: type
in: query
schema:
type: string
- name: interactive
in: query
schema:
type: string
- name: timeout
in: query
description: Timeout in milliseconds (default 5000, max 30000)
schema:
type: integer
default: 5000
responses:
"200":
description: Matching elements found
content:
application/json:
schema:
$ref: "#/components/schemas/ElementListResponse"
"408":
description: Timeout — no matching element found
/windows/{pid}/screenshot:
get:
summary: Capture window screenshot
tags: [Window Operations]
parameters:
- $ref: "#/components/parameters/pid"
responses:
"200":
description: PNG image
content:
image/png:
schema:
type: string
format: binary
"404":
description: Window not found
/windows/{pid}/focus:
post:
summary: Bring window to foreground
tags: [Window Operations]
parameters:
- $ref: "#/components/parameters/pid"
responses:
"200":
description: Success
/windows/{pid}/close:
post:
summary: Close window gracefully
tags: [Window Operations]
parameters:
- $ref: "#/components/parameters/pid"
responses:
"200":
description: Success
/hwnd/{hwnd}/tree:
get:
summary: UI tree by window handle
tags: [Discovery]
parameters:
- $ref: "#/components/parameters/hwnd"
responses:
"200":
description: Element tree
/hwnd/{hwnd}/find:
get:
summary: Search elements by window handle
tags: [Discovery]
parameters:
- $ref: "#/components/parameters/hwnd"
- name: q
in: query
schema:
type: string
- name: type
in: query
schema:
type: string
- name: interactive
in: query
schema:
type: string
responses:
"200":
description: Matching elements
/interact/{id}/click:
post:
summary: Click an element
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
responses:
"200":
description: Success
"404":
description: Element not found
/interact/{id}/set-text:
post:
summary: Set text content
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [text]
properties:
text:
type: string
responses:
"200":
description: Success
/interact/{id}/send-keys:
post:
summary: Simulate keyboard input
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [keys]
properties:
keys:
type: string
description: "Text + special keys like {ENTER}, {CTRL+A}"
responses:
"200":
description: Success
/interact/{id}/focus:
post:
summary: Move keyboard focus to element
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
responses:
"200":
description: Success
/interact/{id}/toggle:
post:
summary: Toggle checkbox or toggle button
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
responses:
"200":
description: Success
/interact/{id}/expand:
post:
summary: Expand dropdown, tree item, or menu
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
responses:
"200":
description: Success
/interact/{id}/collapse:
post:
summary: Collapse dropdown, tree item, or menu
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
responses:
"200":
description: Success
/interact/{id}/select:
post:
summary: Select list item, radio button, or tab
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
responses:
"200":
description: Success
/interact/{id}/set-range:
post:
summary: Set numeric value on slider or spinner
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [value]
properties:
value:
type: number
responses:
"200":
description: Success
/interact/{id}/scroll:
post:
summary: Scroll a container
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [direction]
properties:
direction:
type: string
enum: [up, down, left, right, page-up, page-down]
responses:
"200":
description: Success
/interact/{id}/scroll-into-view:
post:
summary: Scroll element into visible viewport
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
responses:
"200":
description: Success
/interact/{id}/highlight:
post:
summary: Highlight element on screen
tags: [Interactions]
parameters:
- $ref: "#/components/parameters/elementId"
requestBody:
content:
application/json:
schema:
type: object
properties:
duration_ms:
type: integer
default: 2000
responses:
"200":
description: Success with bounding rect
/interact/batch:
post:
summary: Execute multiple interactions in one request
tags: [Interactions]
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/BatchPayload"
responses:
"200":
description: Results for each action
content:
application/json:
schema:
$ref: "#/components/schemas/BatchResponse"
/ws:
get:
summary: WebSocket for live action events
tags: [System]
description: Upgrade to WebSocket to receive real-time interaction events.
components:
parameters:
pid:
name: pid
in: path
required: true
schema:
type: integer
description: Process ID
hwnd:
name: hwnd
in: path
required: true
schema:
type: integer
description: Window handle
elementId:
name: id
in: path
required: true
schema:
type: string
description: Element oculos_id
schemas:
ApiResponse:
type: object
properties:
success:
type: boolean
data: {}
error:
type: string
nullable: true
HealthResponse:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
type: object
properties:
status:
type: string
version:
type: string
platform:
type: string
arch:
type: string
uptime_secs:
type: integer
Window:
type: object
properties:
pid:
type: integer
hwnd:
type: integer
title:
type: string
exe_name:
type: string
rect:
$ref: "#/components/schemas/Rect"
visible:
type: boolean
WindowListResponse:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/Window"
Rect:
type: object
properties:
x:
type: integer
y:
type: integer
width:
type: integer
height:
type: integer
UiElement:
type: object
properties:
oculos_id:
type: string
type:
type: string
label:
type: string
value:
type: string
nullable: true
rect:
$ref: "#/components/schemas/Rect"
enabled:
type: boolean
focused:
type: boolean
toggle_state:
type: string
nullable: true
enum: ["Off", "On", "Indeterminate"]
is_selected:
type: boolean
nullable: true
expand_state:
type: string
nullable: true
enum: ["Collapsed", "Expanded", "PartiallyExpanded", "LeafNode"]
range:
type: object
nullable: true
properties:
value:
type: number
minimum:
type: number
maximum:
type: number
step:
type: number
automation_id:
type: string
nullable: true
help_text:
type: string
nullable: true
actions:
type: array
items:
type: string
children:
type: array
items:
$ref: "#/components/schemas/UiElement"
ElementResponse:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
$ref: "#/components/schemas/UiElement"
ElementListResponse:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/UiElement"
BatchPayload:
type: object
required: [actions]
properties:
actions:
type: array
items:
type: object
required: [element_id, action]
properties:
element_id:
type: string
action:
type: string
enum: [click, set-text, send-keys, focus, toggle, expand, collapse, select, set-range, scroll]
text:
type: string
keys:
type: string
value:
type: number
direction:
type: string
BatchResponse:
allOf:
- $ref: "#/components/schemas/ApiResponse"
- type: object
properties:
data:
type: array
items:
type: object
properties:
index:
type: integer
action:
type: string
element_id:
type: string
success:
type: boolean
error:
type: string
nullable: true