lustro-cli 0.1.0__py3-none-any.whl

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 (60) hide show
  1. lustro_cli/__init__.py +29 -0
  2. lustro_cli/cli.py +2460 -0
  3. lustro_cli/client.py +434 -0
  4. lustro_cli/discovery.py +1033 -0
  5. lustro_cli/exitcodes.py +25 -0
  6. lustro_cli/mcp.py +867 -0
  7. lustro_cli/wire/__init__.py +62 -0
  8. lustro_cli/wire/_schema.json +97 -0
  9. lustro_cli/wire/cursor-envelope.schema.json +28 -0
  10. lustro_cli/wire/error-envelope.schema.json +46 -0
  11. lustro_cli/wire/golden/cursor-delta.json +91 -0
  12. lustro_cli/wire/golden/cursor-reset.json +65 -0
  13. lustro_cli/wire/golden/cursor-unchanged.json +15 -0
  14. lustro_cli/wire/golden/error-envelope.json +7 -0
  15. lustro_cli/wire/golden/export-har-websocket.json +148 -0
  16. lustro_cli/wire/golden/export-har.json +359 -0
  17. lustro_cli/wire/golden/logs-delta.json +44 -0
  18. lustro_cli/wire/golden/logs-reset.json +73 -0
  19. lustro_cli/wire/golden/logs-unchanged.json +9 -0
  20. lustro_cli/wire/golden/meta.json +12 -0
  21. lustro_cli/wire/golden/prefs-delta.json +58 -0
  22. lustro_cli/wire/golden/prefs-files.json +64 -0
  23. lustro_cli/wire/golden/prefs-reset.json +58 -0
  24. lustro_cli/wire/golden/prefs-unchanged.json +4 -0
  25. lustro_cli/wire/golden/rules-list.json +44 -0
  26. lustro_cli/wire/golden/screen-tree-views.json +596 -0
  27. lustro_cli/wire/golden/screen-tree.json +689 -0
  28. lustro_cli/wire/golden/send-result.json +7 -0
  29. lustro_cli/wire/golden/senders-list.json +6 -0
  30. lustro_cli/wire/golden/sqlite-databases.json +37 -0
  31. lustro_cli/wire/golden/sqlite-exec.json +4 -0
  32. lustro_cli/wire/golden/sqlite-query.json +109 -0
  33. lustro_cli/wire/golden/sqlite-rows.json +109 -0
  34. lustro_cli/wire/golden/sqlite-schema.json +98 -0
  35. lustro_cli/wire/golden/sqlite-tables.json +57 -0
  36. lustro_cli/wire/golden/stream-delta.json +48 -0
  37. lustro_cli/wire/golden/stream-reset.json +66 -0
  38. lustro_cli/wire/golden/stream-unchanged.json +4 -0
  39. lustro_cli/wire/golden/transaction-image.json +43 -0
  40. lustro_cli/wire/golden/transaction.json +41 -0
  41. lustro_cli/wire/golden/websocket.json +37 -0
  42. lustro_cli/wire/golden/websockets-reset.json +89 -0
  43. lustro_cli/wire/golden/work-events.json +152 -0
  44. lustro_cli/wire/golden/work-item.json +118 -0
  45. lustro_cli/wire/golden/work-items.json +129 -0
  46. lustro_cli/wire/golden/work-metrics.json +40 -0
  47. lustro_cli/wire/logs.openapi.json +622 -0
  48. lustro_cli/wire/meta.schema.json +47 -0
  49. lustro_cli/wire/network.openapi.json +2458 -0
  50. lustro_cli/wire/pagination.schema.json +20 -0
  51. lustro_cli/wire/prefs.openapi.json +699 -0
  52. lustro_cli/wire/screen.openapi.json +512 -0
  53. lustro_cli/wire/sqlite.openapi.json +1233 -0
  54. lustro_cli/wire/stream-envelope.schema.json +33 -0
  55. lustro_cli/wire/sync.py +80 -0
  56. lustro_cli/wire/work.openapi.json +1188 -0
  57. lustro_cli-0.1.0.dist-info/METADATA +585 -0
  58. lustro_cli-0.1.0.dist-info/RECORD +60 -0
  59. lustro_cli-0.1.0.dist-info/WHEEL +4 -0
  60. lustro_cli-0.1.0.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,512 @@
1
+ {
2
+ "openapi": "3.1.0",
3
+ "info": {
4
+ "title": "Lustro Screen debug tab",
5
+ "version": "1.0",
6
+ "description": "The app's windows and the UI tree in each: the classic Views, and the Compose semantics nodes of each Compose host, read in the app's process on the main thread. A read takes milliseconds, sees every test tag, and does not wait for the screen to stop changing, as uiautomator dump does; ?settle waits for two reads in a row to be the same, with the window focus at rest. The tree has the app's own windows only: a permission dialog, the chooser, the keyboard, a notification, and a toast are not in it, and a WebView is a View without its page. When no window has hasWindowFocus, a window of another app is on top. The text of a password field comes as one dot for each character. The tab has no console view, so it is not in the tab bar; _meta lists it. All routes are token-authenticated (Bearer header or HttpOnly cookie) and live under /api/v1/screen. Errors use the shared error envelope."
7
+ },
8
+ "servers": [
9
+ {
10
+ "url": "/",
11
+ "description": "The Lustro debug server (loopback by default)."
12
+ }
13
+ ],
14
+ "paths": {
15
+ "/api/v1/screen/tree": {
16
+ "get": {
17
+ "operationId": "getScreenTree",
18
+ "summary": "The app's windows, and the nodes of each.",
19
+ "description": "Reads every window of the app's process on the main thread, and calls the app's ScreenContextProvider after the read. GET changes nothing. When the main thread does not start and finish the read within 5000 ms plus the settle time, the request answers 504 with code main_thread_blocked. When the read throws, as with a View of the app whose getter throws, it answers 500 with code read_failed, and the app goes on.",
20
+ "parameters": [
21
+ {
22
+ "name": "merged",
23
+ "in": "query",
24
+ "required": false,
25
+ "schema": {
26
+ "type": "boolean",
27
+ "default": true
28
+ },
29
+ "description": "true for the merged semantics tree, in which a clickable node carries the text of its children, as accessibility services see it; false for the unmerged one, in which each text is a node of its own. A node has the same id in both. 400 with field merged for any other value."
30
+ },
31
+ {
32
+ "name": "settle",
33
+ "in": "query",
34
+ "required": false,
35
+ "schema": {
36
+ "type": "integer",
37
+ "format": "int32",
38
+ "minimum": 0,
39
+ "maximum": 10000,
40
+ "default": 0
41
+ },
42
+ "description": "Read the tree on each frame until two reads in a row are the same and the window focus is at rest, the top visible window that can take the focus having it and no other window, for up to this many milliseconds, and return the last read with settle. The window manager moves the focus some frames after a dialog opens or closes. 0 reads once. 400 with field settle for any other value."
43
+ }
44
+ ],
45
+ "responses": {
46
+ "200": {
47
+ "description": "The windows.",
48
+ "content": {
49
+ "application/json": {
50
+ "schema": {
51
+ "$ref": "#/components/schemas/ScreenTree"
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "400": {
57
+ "$ref": "#/components/responses/Error"
58
+ },
59
+ "401": {
60
+ "$ref": "#/components/responses/Error"
61
+ },
62
+ "403": {
63
+ "$ref": "#/components/responses/Error"
64
+ },
65
+ "413": {
66
+ "$ref": "#/components/responses/Error"
67
+ },
68
+ "500": {
69
+ "$ref": "#/components/responses/Error"
70
+ },
71
+ "503": {
72
+ "$ref": "#/components/responses/Error"
73
+ },
74
+ "504": {
75
+ "$ref": "#/components/responses/Error"
76
+ }
77
+ }
78
+ }
79
+ }
80
+ },
81
+ "components": {
82
+ "responses": {
83
+ "Error": {
84
+ "description": "Error envelope.",
85
+ "content": {
86
+ "application/json": {
87
+ "schema": {
88
+ "$ref": "#/components/schemas/ErrorEnvelope"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "schemas": {
95
+ "ErrorEnvelope": {
96
+ "type": "object",
97
+ "required": [
98
+ "error",
99
+ "message"
100
+ ],
101
+ "properties": {
102
+ "error": {
103
+ "type": "string",
104
+ "enum": [
105
+ "bad_request",
106
+ "unauthorized",
107
+ "forbidden",
108
+ "not_found",
109
+ "method_not_allowed",
110
+ "conflict",
111
+ "payload_too_large",
112
+ "unprocessable_entity",
113
+ "too_many_requests",
114
+ "internal_error",
115
+ "unavailable",
116
+ "timeout",
117
+ "error"
118
+ ],
119
+ "description": "Machine error type, e.g. bad_request, not_found, timeout."
120
+ },
121
+ "message": {
122
+ "type": "string"
123
+ },
124
+ "code": {
125
+ "type": "string"
126
+ },
127
+ "field": {
128
+ "type": "string"
129
+ },
130
+ "hint": {
131
+ "type": "string"
132
+ }
133
+ },
134
+ "additionalProperties": false
135
+ },
136
+ "ScreenTree": {
137
+ "type": "object",
138
+ "required": [
139
+ "windows",
140
+ "merged",
141
+ "density",
142
+ "compose",
143
+ "windowSource",
144
+ "context"
145
+ ],
146
+ "properties": {
147
+ "windows": {
148
+ "type": "array",
149
+ "items": {
150
+ "$ref": "#/components/schemas/ScreenWindow"
151
+ },
152
+ "description": "The app's windows, in the order the app added them: the activity, then the dialogs and popups over it."
153
+ },
154
+ "merged": {
155
+ "type": "boolean",
156
+ "description": "Whether the Compose nodes are the merged semantics tree."
157
+ },
158
+ "density": {
159
+ "type": "number",
160
+ "exclusiveMinimum": 0,
161
+ "description": "The display density, pixels for each dp."
162
+ },
163
+ "compose": {
164
+ "type": "boolean",
165
+ "description": "Whether the app has Compose UI, so that the tree has the semantics nodes of its Compose hosts."
166
+ },
167
+ "windowSource": {
168
+ "enum": [
169
+ "inspector",
170
+ "reflection",
171
+ "activities"
172
+ ],
173
+ "description": "How the tab found the windows: WindowInspector from API 29; WindowManagerGlobal before; or, when that failed, the started activities, without their dialogs and popups."
174
+ },
175
+ "composeError": {
176
+ "type": "string",
177
+ "description": "Why the tab could not read a Compose host's semantics tree, such as a Compose UI without a call that the tab makes. The host's View is in the tree without semantics nodes."
178
+ },
179
+ "settle": {
180
+ "$ref": "#/components/schemas/Settle"
181
+ },
182
+ "context": {
183
+ "description": "What the app's ScreenContextProvider returned, such as its navigation back stack: any JSON value, or null when the app registered none, it returned null, or it failed (see contextError)."
184
+ },
185
+ "contextError": {
186
+ "type": "string",
187
+ "description": "Why context is null: the provider threw, or returned text that is not JSON."
188
+ }
189
+ },
190
+ "additionalProperties": false
191
+ },
192
+ "ScreenWindow": {
193
+ "type": "object",
194
+ "description": "A window of the app's process: an activity, or a dialog, popup, or bottom sheet over it.",
195
+ "required": [
196
+ "id",
197
+ "type",
198
+ "kind",
199
+ "title",
200
+ "hasWindowFocus",
201
+ "focusable",
202
+ "visible",
203
+ "bounds",
204
+ "nodes"
205
+ ],
206
+ "properties": {
207
+ "id": {
208
+ "type": "string",
209
+ "description": "The id of the window's root View, its first node."
210
+ },
211
+ "type": {
212
+ "type": [
213
+ "integer",
214
+ "null"
215
+ ],
216
+ "description": "The window type of the root View's WindowManager.LayoutParams, such as 1 for an activity and 2 for a dialog."
217
+ },
218
+ "kind": {
219
+ "enum": [
220
+ "activity",
221
+ "dialog",
222
+ "popup",
223
+ "system",
224
+ "other"
225
+ ],
226
+ "description": "The group of the type: activity for TYPE_BASE_APPLICATION; dialog for TYPE_APPLICATION and TYPE_APPLICATION_ATTACHED_DIALOG, which Dialog, DialogFragment, Compose's Dialog, and bottom sheet dialogs use; popup for the other sub-windows, which PopupWindow, Compose's Popup, menus, and spinners use; system for system window types, such as an overlay."
227
+ },
228
+ "title": {
229
+ "type": [
230
+ "string",
231
+ "null"
232
+ ],
233
+ "description": "The window's title, such as the package and class of an activity."
234
+ },
235
+ "hasWindowFocus": {
236
+ "type": "boolean",
237
+ "description": "Whether the window has the window focus. A window of another app, such as a permission dialog or the chooser, can cover the app while the server still answers, and then no window of the app has the focus: read that window with uiautomator."
238
+ },
239
+ "focusable": {
240
+ "type": "boolean",
241
+ "description": "Whether the window can take the focus: false for a window with FLAG_NOT_FOCUSABLE, such as a popup that does not take the keys."
242
+ },
243
+ "visible": {
244
+ "type": "boolean",
245
+ "description": "Whether the window's root View is shown and the window is visible."
246
+ },
247
+ "bounds": {
248
+ "$ref": "#/components/schemas/Rect",
249
+ "description": "The window on the screen."
250
+ },
251
+ "nodes": {
252
+ "type": "array",
253
+ "items": {
254
+ "$ref": "#/components/schemas/ScreenNode"
255
+ },
256
+ "description": "The window's nodes, each before its children, the children in the order of their parent."
257
+ }
258
+ },
259
+ "additionalProperties": false
260
+ },
261
+ "ScreenNode": {
262
+ "type": "object",
263
+ "description": "A node of a window: a classic View, or a Compose semantics node. A key that the node does not have is left out: a text, a role, a state that is not set, enabled when the node is enabled, and clickable, focused, password, and clipped when they are false.",
264
+ "required": [
265
+ "id",
266
+ "kind",
267
+ "bounds",
268
+ "screenBounds",
269
+ "visibleBounds"
270
+ ],
271
+ "properties": {
272
+ "id": {
273
+ "type": "string",
274
+ "pattern": "^(v[0-9]+|c[0-9]+\\.-?[0-9]+)$",
275
+ "description": "v and a number for a View, which stays the same while the View lives; c, the number of the Compose host's View, a dot, and the semantics id for a Compose node, the same in the merged and the unmerged tree."
276
+ },
277
+ "parent": {
278
+ "type": "string",
279
+ "description": "The id of the node's parent. A window's first node has none. The parent of a Compose host's root semantics node is the host's View; the Views of an AndroidView in a Compose host follow the host's semantics nodes, with the host as their parent."
280
+ },
281
+ "kind": {
282
+ "enum": [
283
+ "view",
284
+ "compose"
285
+ ]
286
+ },
287
+ "className": {
288
+ "type": "string",
289
+ "description": "The class of a View, such as android.widget.Button. Compose nodes have none: see role."
290
+ },
291
+ "resourceId": {
292
+ "type": "string",
293
+ "description": "The resource name of a View's id, such as com.example:id/save. Generated ids have none."
294
+ },
295
+ "testTag": {
296
+ "type": "string",
297
+ "description": "A Compose node's Modifier.testTag, or a View's tag when it is a string. Every test tag is here, whether the app sets testTagsAsResourceId or not."
298
+ },
299
+ "text": {
300
+ "type": "array",
301
+ "items": {
302
+ "type": "string"
303
+ },
304
+ "minItems": 1,
305
+ "description": "The node's text, one string for each text of a merged node, in order. A field's text is in editableText."
306
+ },
307
+ "contentDescription": {
308
+ "type": "array",
309
+ "items": {
310
+ "type": "string"
311
+ },
312
+ "minItems": 1
313
+ },
314
+ "editableText": {
315
+ "type": "string",
316
+ "description": "The text in a text field, which can be empty."
317
+ },
318
+ "password": {
319
+ "const": true,
320
+ "description": "The node is a password field: editableText and text have one dot for each character, as the screen shows them."
321
+ },
322
+ "role": {
323
+ "type": "string",
324
+ "description": "A Compose node's Role, such as Button, Checkbox, Switch, RadioButton, Tab, Image, or DropdownList."
325
+ },
326
+ "stateDescription": {
327
+ "type": "string"
328
+ },
329
+ "error": {
330
+ "type": "string",
331
+ "description": "The error that a field shows, from Compose's error semantics or TextView.setError()."
332
+ },
333
+ "bounds": {
334
+ "$ref": "#/components/schemas/Rect",
335
+ "description": "The node in its window, before any clipping."
336
+ },
337
+ "screenBounds": {
338
+ "$ref": "#/components/schemas/Rect",
339
+ "description": "The node on the screen, before any clipping."
340
+ },
341
+ "visibleBounds": {
342
+ "oneOf": [
343
+ {
344
+ "$ref": "#/components/schemas/Rect"
345
+ },
346
+ {
347
+ "type": "null"
348
+ }
349
+ ],
350
+ "description": "The part of the node that is on the screen after its parents and its window clip it; null when no part of it is, as a View that is INVISIBLE, a node of zero size, or a row scrolled out of view."
351
+ },
352
+ "clipped": {
353
+ "const": true,
354
+ "description": "A parent or the window cuts the node, so only a part of it is on the screen."
355
+ },
356
+ "enabled": {
357
+ "const": false,
358
+ "description": "The node is disabled."
359
+ },
360
+ "focused": {
361
+ "const": true
362
+ },
363
+ "selected": {
364
+ "type": "boolean",
365
+ "description": "Whether the node is selected, as a tab: present for a Compose node that is selectable, and for a View only when it is selected."
366
+ },
367
+ "toggle": {
368
+ "type": "string",
369
+ "description": "The toggle state of a switch or check box: on, off, or indeterminate."
370
+ },
371
+ "clickable": {
372
+ "const": true,
373
+ "description": "The node has a click action: OnClick is in actions."
374
+ },
375
+ "actions": {
376
+ "type": "array",
377
+ "items": {
378
+ "type": "string"
379
+ },
380
+ "minItems": 1,
381
+ "description": "The semantics actions that drive the node, by their Compose names: OnClick, OnLongClick, SetText, PerformImeAction, ScrollBy, ScrollToIndex, PageUp, PageDown, PageLeft, PageRight, SetProgress, Expand, Collapse, and Dismiss. A View has OnClick when it is clickable, OnLongClick when it is long-clickable, SetText when it is an enabled EditText, and ScrollBy when it can scroll."
382
+ },
383
+ "horizontalScroll": {
384
+ "$ref": "#/components/schemas/ScrollRange"
385
+ },
386
+ "verticalScroll": {
387
+ "$ref": "#/components/schemas/ScrollRange"
388
+ },
389
+ "collection": {
390
+ "type": "object",
391
+ "description": "A Compose list or grid: how many rows and columns it has, or null when it does not say.",
392
+ "required": [
393
+ "rows",
394
+ "columns"
395
+ ],
396
+ "properties": {
397
+ "rows": {
398
+ "type": [
399
+ "integer",
400
+ "null"
401
+ ],
402
+ "minimum": 0
403
+ },
404
+ "columns": {
405
+ "type": [
406
+ "integer",
407
+ "null"
408
+ ],
409
+ "minimum": 0
410
+ }
411
+ },
412
+ "additionalProperties": false
413
+ }
414
+ },
415
+ "additionalProperties": false
416
+ },
417
+ "Rect": {
418
+ "type": "object",
419
+ "description": "A rectangle in pixels: left and top inside it, right and bottom just outside.",
420
+ "required": [
421
+ "left",
422
+ "top",
423
+ "right",
424
+ "bottom"
425
+ ],
426
+ "properties": {
427
+ "left": {
428
+ "type": "integer"
429
+ },
430
+ "top": {
431
+ "type": "integer"
432
+ },
433
+ "right": {
434
+ "type": "integer"
435
+ },
436
+ "bottom": {
437
+ "type": "integer"
438
+ }
439
+ },
440
+ "additionalProperties": false
441
+ },
442
+ "ScrollRange": {
443
+ "type": "object",
444
+ "description": "The scroll position of a node on one axis, in pixels.",
445
+ "required": [
446
+ "value",
447
+ "max",
448
+ "reverse",
449
+ "forward",
450
+ "backward"
451
+ ],
452
+ "properties": {
453
+ "value": {
454
+ "type": "number",
455
+ "description": "How far the node is scrolled."
456
+ },
457
+ "max": {
458
+ "type": [
459
+ "number",
460
+ "null"
461
+ ],
462
+ "description": "How far it can scroll; null when the node does not say, as a View that is not a scroll container's."
463
+ },
464
+ "reverse": {
465
+ "type": "boolean",
466
+ "description": "Whether the node scrolls in reverse, as a list that starts at its end."
467
+ },
468
+ "forward": {
469
+ "type": "boolean",
470
+ "description": "Whether it can scroll further forward: down or right, or up or left when reverse."
471
+ },
472
+ "backward": {
473
+ "type": "boolean",
474
+ "description": "Whether it can scroll back."
475
+ }
476
+ },
477
+ "additionalProperties": false
478
+ },
479
+ "Settle": {
480
+ "type": "object",
481
+ "description": "How a settle wait ended. Present only when the request asked for one.",
482
+ "required": [
483
+ "requestedMs",
484
+ "settled",
485
+ "waitedMs",
486
+ "frames"
487
+ ],
488
+ "properties": {
489
+ "requestedMs": {
490
+ "type": "integer",
491
+ "minimum": 1,
492
+ "maximum": 10000
493
+ },
494
+ "settled": {
495
+ "type": "boolean",
496
+ "description": "Whether two reads on consecutive frames were the same and the window focus was at rest. false when the time was over first, and the tree is the last read, as while a window of another app has the focus."
497
+ },
498
+ "waitedMs": {
499
+ "type": "integer",
500
+ "minimum": 0
501
+ },
502
+ "frames": {
503
+ "type": "integer",
504
+ "minimum": 0,
505
+ "description": "How many frames the tab read after the first read."
506
+ }
507
+ },
508
+ "additionalProperties": false
509
+ }
510
+ }
511
+ }
512
+ }