@lingxia/types 0.11.1 → 0.13.0

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.
@@ -0,0 +1,716 @@
1
+ import type {
2
+ Automation,
3
+ BrowserCookies,
4
+ BrowserDriver,
5
+ DesktopApp,
6
+ DesktopAx,
7
+ DesktopClipboard,
8
+ DesktopDriver,
9
+ DesktopKey,
10
+ DesktopPointer,
11
+ DesktopProcess,
12
+ DesktopWait,
13
+ DesktopWindowDriver,
14
+ DeviceDriver,
15
+ LxAppDriver,
16
+ LxAppManager,
17
+ NavDriver,
18
+ PageDriver,
19
+ PageKey,
20
+ PagePointer,
21
+ ShellDriver,
22
+ TerminalDriver,
23
+ } from '../automation/index.js';
24
+ import type {
25
+ AppearanceApi,
26
+ AutostartApi,
27
+ CompressVideoTask,
28
+ DownloadTask,
29
+ FileSystemApi,
30
+ HostAppApi,
31
+ HostAppUpdateInfo,
32
+ HostAppUpdateTask,
33
+ LxFile,
34
+ NavigationBarApi,
35
+ PageMessagePort,
36
+ PreviewMediaHandle,
37
+ TabSurface,
38
+ PageSurface,
39
+ ShellApi,
40
+ Storage,
41
+ SurfaceApi,
42
+ TabBarApi,
43
+ TerminalApi,
44
+ TerminalColorSchemesApi,
45
+ TerminalFontsApi,
46
+ TerminalPreviewController,
47
+ TerminalSettingsApi,
48
+ TrayApi,
49
+ UpdateManager,
50
+ UploadTask,
51
+ VideoContext,
52
+ } from '../generated/logic.js';
53
+
54
+ export const LX_API_NAMES = [
55
+ 'app',
56
+ 'appearance',
57
+ 'automation',
58
+ 'chooseDirectory',
59
+ 'chooseFile',
60
+ 'chooseMedia',
61
+ 'compressImage',
62
+ 'compressVideo',
63
+ 'connectWifi',
64
+ 'createVideoContext',
65
+ 'downloadFile',
66
+ 'env',
67
+ 'extractVideoThumbnail',
68
+ 'fs',
69
+ 'getConnectedWifi',
70
+ 'getDeviceInfo',
71
+ 'getImageInfo',
72
+ 'getLocation',
73
+ 'getLxAppInfo',
74
+ 'getNetworkInfo',
75
+ 'getScreenInfo',
76
+ 'getStorage',
77
+ 'getSystemSetting',
78
+ 'getUpdateManager',
79
+ 'getVideoInfo',
80
+ 'getWifiList',
81
+ 'hideToast',
82
+ 'makePhoneCall',
83
+ 'navigateBack',
84
+ 'navigateBackApp',
85
+ 'navigateTo',
86
+ 'navigateToApp',
87
+ 'navigationBar',
88
+ 'onDeviceOrientationChange',
89
+ 'onKeyDown',
90
+ 'onKeyUp',
91
+ 'onNetworkChange',
92
+ 'onWifiConnected',
93
+ 'openExternal',
94
+ 'openFile',
95
+ 'previewMedia',
96
+ 'reLaunch',
97
+ 'redirectTo',
98
+ 'saveImageToPhotosAlbum',
99
+ 'saveVideoToPhotosAlbum',
100
+ 'scanCode',
101
+ 'setDeviceOrientation',
102
+ 'setMoreActions',
103
+ 'share',
104
+ 'shell',
105
+ 'showActionSheet',
106
+ 'showModal',
107
+ 'showToast',
108
+ 'startPullDownRefresh',
109
+ 'startWifi',
110
+ 'stopPullDownRefresh',
111
+ 'stopWifi',
112
+ 'supports',
113
+ 'surface',
114
+ 'switchTab',
115
+ 'tabBar',
116
+ 'terminal',
117
+ 'tray',
118
+ 'uploadFile',
119
+ 'vibrateLong',
120
+ 'vibrateShort',
121
+ ] as const;
122
+
123
+ const HOST_APP_API = [
124
+ 'autostart',
125
+ 'checkUpdate',
126
+ 'envVersion',
127
+ 'exit',
128
+ 'getBaseInfo',
129
+ 'onDisplayLanguageChange',
130
+ 'screenshot',
131
+ 'setBadge',
132
+ ] as const;
133
+ const HOST_APP_RUNTIME_API = HOST_APP_API.filter((name) => name !== 'autostart');
134
+ const AUTOSTART_API = ['isEnabled', 'setEnabled'] as const;
135
+ const APPEARANCE_API = ['get', 'set'] as const;
136
+ const NAVIGATION_BAR_API = ['update'] as const;
137
+ const TAB_BAR_API = ['update'] as const;
138
+ const TERMINAL_API = ['colorSchemes', 'fonts', 'settings', 'windows'] as const;
139
+ const TERMINAL_SETTINGS_API = ['get', 'onChange', 'reset', 'update'] as const;
140
+ const TERMINAL_COLOR_SCHEMES_API = ['createPreview', 'import', 'list'] as const;
141
+ const TERMINAL_FONTS_API = ['list'] as const;
142
+ const TERMINAL_PREVIEW_API = ['clear', 'close', 'show'] as const;
143
+ const WINDOWS_TERMINAL_API = ['install', 'setEnabled', 'status'] as const;
144
+ const ENV_API = ['USER_CACHE_PATH', 'USER_DATA_PATH'] as const;
145
+ const SURFACE_NAMESPACE_API = ['get', 'onContext', 'openDeclared', 'openPage', 'openUrl'] as const;
146
+ const SHELL_API = ['openApp', 'openBuiltin', 'openDeclared', 'reconfigure', 'sidebarActions'] as const;
147
+ const SHELL_SIDEBAR_ACTIONS_API = ['clear', 'remove', 'replace', 'update'] as const;
148
+ const TRAY_API = ['hide', 'onClick', 'setBadge', 'setIcon', 'setMenu', 'setTitle', 'show'] as const;
149
+ const FILE_SYSTEM_API = [
150
+ 'copy',
151
+ 'exists',
152
+ 'file',
153
+ 'mkdir',
154
+ 'readDir',
155
+ 'remove',
156
+ 'rename',
157
+ 'stat',
158
+ 'write',
159
+ ] as const;
160
+ const LX_FILE_API = [
161
+ 'arrayBuffer',
162
+ 'base64',
163
+ 'bytes',
164
+ 'exists',
165
+ 'json',
166
+ 'path',
167
+ 'stat',
168
+ 'text',
169
+ ] as const;
170
+ const STORAGE_API = ['clear', 'delete', 'get', 'info', 'list', 'set'] as const;
171
+ const UPDATE_MANAGER_API = ['applyUpdate', 'onUpdateFailed', 'onUpdateReady'] as const;
172
+ const VIDEO_CONTEXT_API = [
173
+ 'exitFullScreen',
174
+ 'pause',
175
+ 'play',
176
+ 'requestFullScreen',
177
+ 'seek',
178
+ 'setStreamSource',
179
+ 'stop',
180
+ ] as const;
181
+
182
+ const AUTOMATION_API = [
183
+ 'browser',
184
+ 'desktop',
185
+ 'device',
186
+ 'lxapp',
187
+ 'lxapps',
188
+ 'shell',
189
+ 'terminal',
190
+ ] as const;
191
+ const SHELL_DRIVER_API = ['pins', 'setPin'] as const;
192
+ const TERMINAL_DRIVER_API = ['input', 'newTab', 'setMaximized', 'snapshot', 'split'] as const;
193
+ const LXAPP_DRIVER_API = ['eval', 'info', 'nav', 'page', 'pages', 'surfaceLayout'] as const;
194
+ const LXAPP_MANAGER_API = [
195
+ 'close',
196
+ 'current',
197
+ 'list',
198
+ 'open',
199
+ 'restart',
200
+ 'screenshot',
201
+ 'uninstall',
202
+ 'windows',
203
+ ] as const;
204
+ const PAGE_DRIVER_API = [
205
+ 'click',
206
+ 'eval',
207
+ 'fill',
208
+ 'key',
209
+ 'pointer',
210
+ 'press',
211
+ 'query',
212
+ 'screenshot',
213
+ 'scroll',
214
+ 'scrollTo',
215
+ 'type',
216
+ 'waitFor',
217
+ ] as const;
218
+ const PAGE_POINTER_API = ['click', 'down', 'drag', 'move', 'scroll', 'up'] as const;
219
+ const PAGE_KEY_API = ['press', 'type'] as const;
220
+ const NAV_DRIVER_API = [
221
+ 'back',
222
+ 'current',
223
+ 'info',
224
+ 'redirect',
225
+ 'relaunch',
226
+ 'stack',
227
+ 'switchTab',
228
+ 'to',
229
+ ] as const;
230
+ const DEVICE_DRIVER_API = ['get', 'list', 'set'] as const;
231
+ const BROWSER_DRIVER_API = [
232
+ 'activate',
233
+ 'back',
234
+ 'click',
235
+ 'close',
236
+ 'cookies',
237
+ 'current',
238
+ 'eval',
239
+ 'fill',
240
+ 'forward',
241
+ 'open',
242
+ 'press',
243
+ 'query',
244
+ 'reload',
245
+ 'screenshot',
246
+ 'scroll',
247
+ 'scrollTo',
248
+ 'tabs',
249
+ 'type',
250
+ 'wait',
251
+ ] as const;
252
+ const BROWSER_COOKIES_API = ['clear', 'delete', 'list', 'set'] as const;
253
+ const DESKTOP_DRIVER_API = [
254
+ 'app',
255
+ 'ax',
256
+ 'clipboard',
257
+ 'displays',
258
+ 'doctor',
259
+ 'key',
260
+ 'permissions',
261
+ 'pixel',
262
+ 'pointer',
263
+ 'process',
264
+ 'screenshot',
265
+ 'snapshot',
266
+ 'wait',
267
+ 'window',
268
+ 'windows',
269
+ ] as const;
270
+ const DESKTOP_POINTER_API = ['click', 'down', 'drag', 'move', 'scroll', 'up'] as const;
271
+ const DESKTOP_KEY_API = ['down', 'press', 'type', 'up'] as const;
272
+ const DESKTOP_WINDOW_API = [
273
+ 'activate',
274
+ 'close',
275
+ 'focus',
276
+ 'maximize',
277
+ 'minimize',
278
+ 'moveTo',
279
+ 'moveToDisplay',
280
+ 'raise',
281
+ 'resize',
282
+ 'restore',
283
+ 'setAlwaysOnTop',
284
+ 'status',
285
+ ] as const;
286
+ const DESKTOP_CLIPBOARD_API = ['clear', 'get', 'paste', 'set'] as const;
287
+ const DESKTOP_AX_API = [
288
+ 'collapse',
289
+ 'expand',
290
+ 'focus',
291
+ 'hitTest',
292
+ 'invoke',
293
+ 'query',
294
+ 'scrollIntoView',
295
+ 'select',
296
+ 'setValue',
297
+ 'tree',
298
+ ] as const;
299
+ const DESKTOP_WAIT_API = ['ax', 'pixel', 'window'] as const;
300
+ const DESKTOP_APP_API = ['launch', 'quit'] as const;
301
+ const DESKTOP_PROCESS_API = ['kill', 'list'] as const;
302
+
303
+ export const LX_RUNTIME_SURFACES = [
304
+ {
305
+ name: 'lx',
306
+ layer: 'logic',
307
+ expression: 'lx',
308
+ members: LX_API_NAMES,
309
+ optionalMembers: ['terminal'],
310
+ properties: [
311
+ 'app',
312
+ 'appearance',
313
+ 'env',
314
+ 'fs',
315
+ 'navigationBar',
316
+ 'shell',
317
+ 'surface',
318
+ 'tabBar',
319
+ 'terminal',
320
+ 'tray',
321
+ ],
322
+ },
323
+ {
324
+ name: 'lx.app',
325
+ layer: 'logic',
326
+ expression: 'lx.app',
327
+ members: HOST_APP_RUNTIME_API,
328
+ properties: ['envVersion'],
329
+ },
330
+ {
331
+ name: 'lx.app.autostart',
332
+ layer: 'logic',
333
+ expression: 'lx.app.autostart',
334
+ members: AUTOSTART_API,
335
+ optional: true,
336
+ },
337
+ {
338
+ name: 'lx.appearance',
339
+ layer: 'logic',
340
+ expression: 'lx.appearance',
341
+ members: APPEARANCE_API,
342
+ },
343
+ {
344
+ name: 'lx.navigationBar',
345
+ layer: 'logic',
346
+ expression: 'lx.navigationBar',
347
+ members: NAVIGATION_BAR_API,
348
+ },
349
+ {
350
+ name: 'lx.tabBar',
351
+ layer: 'logic',
352
+ expression: 'lx.tabBar',
353
+ members: TAB_BAR_API,
354
+ },
355
+ {
356
+ name: 'lx.terminal',
357
+ layer: 'logic',
358
+ expression: 'lx.terminal',
359
+ members: TERMINAL_API,
360
+ properties: TERMINAL_API,
361
+ optional: true,
362
+ },
363
+ {
364
+ name: 'lx.terminal.settings',
365
+ layer: 'logic',
366
+ expression: 'lx.terminal?.settings',
367
+ members: TERMINAL_SETTINGS_API,
368
+ optional: true,
369
+ },
370
+ {
371
+ name: 'lx.terminal.colorSchemes',
372
+ layer: 'logic',
373
+ expression: 'lx.terminal?.colorSchemes',
374
+ members: TERMINAL_COLOR_SCHEMES_API,
375
+ optional: true,
376
+ },
377
+ {
378
+ name: 'lx.terminal.fonts',
379
+ layer: 'logic',
380
+ expression: 'lx.terminal?.fonts',
381
+ members: TERMINAL_FONTS_API,
382
+ optional: true,
383
+ },
384
+ {
385
+ name: 'lx.terminal.windows',
386
+ layer: 'logic',
387
+ expression: 'lx.terminal?.windows',
388
+ members: WINDOWS_TERMINAL_API,
389
+ optional: true,
390
+ },
391
+ {
392
+ name: 'lx.env',
393
+ layer: 'logic',
394
+ expression: 'lx.env',
395
+ members: ENV_API,
396
+ properties: ENV_API,
397
+ },
398
+ {
399
+ name: 'lx.surface',
400
+ layer: 'logic',
401
+ expression: 'lx.surface',
402
+ members: SURFACE_NAMESPACE_API,
403
+ },
404
+ {
405
+ name: 'lx.shell',
406
+ layer: 'logic',
407
+ expression: 'lx.shell',
408
+ members: SHELL_API,
409
+ properties: SHELL_API,
410
+ },
411
+ {
412
+ name: 'lx.shell.sidebarActions',
413
+ layer: 'logic',
414
+ expression: 'lx.shell.sidebarActions',
415
+ members: SHELL_SIDEBAR_ACTIONS_API,
416
+ },
417
+ { name: 'lx.tray', layer: 'logic', expression: 'lx.tray', members: TRAY_API },
418
+ { name: 'lx.fs', layer: 'logic', expression: 'lx.fs', members: FILE_SYSTEM_API },
419
+ { name: 'Storage', layer: 'logic', expression: 'lx.getStorage()', members: STORAGE_API },
420
+ { name: 'UpdateManager', layer: 'logic', expression: 'lx.getUpdateManager()', members: UPDATE_MANAGER_API },
421
+ {
422
+ name: 'Automation',
423
+ layer: 'automation',
424
+ expression: 'lx.automation()',
425
+ members: AUTOMATION_API,
426
+ properties: ['browser', 'desktop', 'device', 'lxapps', 'shell', 'terminal'],
427
+ },
428
+ { name: 'ShellDriver', layer: 'automation', expression: 'lx.automation().shell', members: SHELL_DRIVER_API },
429
+ {
430
+ name: 'TerminalDriver',
431
+ layer: 'automation',
432
+ expression: 'lx.automation().terminal',
433
+ members: TERMINAL_DRIVER_API,
434
+ },
435
+ {
436
+ name: 'LxAppDriver',
437
+ layer: 'automation',
438
+ expression: 'lx.automation().lxapp()',
439
+ members: LXAPP_DRIVER_API,
440
+ properties: ['nav', 'page'],
441
+ },
442
+ {
443
+ name: 'PageDriver',
444
+ layer: 'automation',
445
+ expression: 'lx.automation().lxapp().page',
446
+ members: PAGE_DRIVER_API,
447
+ properties: ['key', 'pointer'],
448
+ },
449
+ { name: 'PagePointer', layer: 'automation', expression: 'lx.automation().lxapp().page.pointer', members: PAGE_POINTER_API },
450
+ { name: 'PageKey', layer: 'automation', expression: 'lx.automation().lxapp().page.key', members: PAGE_KEY_API },
451
+ { name: 'NavDriver', layer: 'automation', expression: 'lx.automation().lxapp().nav', members: NAV_DRIVER_API },
452
+ { name: 'LxAppManager', layer: 'automation', expression: 'lx.automation().lxapps', members: LXAPP_MANAGER_API },
453
+ { name: 'DeviceDriver', layer: 'automation', expression: 'lx.automation().device', members: DEVICE_DRIVER_API },
454
+ {
455
+ name: 'BrowserDriver',
456
+ layer: 'automation',
457
+ expression: 'lx.automation().browser',
458
+ members: BROWSER_DRIVER_API,
459
+ properties: ['cookies'],
460
+ },
461
+ { name: 'BrowserCookies', layer: 'automation', expression: 'lx.automation().browser.cookies', members: BROWSER_COOKIES_API },
462
+ {
463
+ name: 'DesktopDriver',
464
+ layer: 'automation',
465
+ expression: 'lx.automation().desktop',
466
+ members: DESKTOP_DRIVER_API,
467
+ properties: ['app', 'ax', 'clipboard', 'key', 'pointer', 'process', 'wait', 'window'],
468
+ },
469
+ { name: 'DesktopPointer', layer: 'automation', expression: 'lx.automation().desktop.pointer', members: DESKTOP_POINTER_API },
470
+ { name: 'DesktopKey', layer: 'automation', expression: 'lx.automation().desktop.key', members: DESKTOP_KEY_API },
471
+ { name: 'DesktopWindow', layer: 'automation', expression: 'lx.automation().desktop.window', members: DESKTOP_WINDOW_API },
472
+ { name: 'DesktopClipboard', layer: 'automation', expression: 'lx.automation().desktop.clipboard', members: DESKTOP_CLIPBOARD_API },
473
+ { name: 'DesktopAx', layer: 'automation', expression: 'lx.automation().desktop.ax', members: DESKTOP_AX_API },
474
+ { name: 'DesktopWait', layer: 'automation', expression: 'lx.automation().desktop.wait', members: DESKTOP_WAIT_API },
475
+ { name: 'DesktopApp', layer: 'automation', expression: 'lx.automation().desktop.app', members: DESKTOP_APP_API },
476
+ { name: 'DesktopProcess', layer: 'automation', expression: 'lx.automation().desktop.process', members: DESKTOP_PROCESS_API },
477
+ ] as const;
478
+
479
+ /** Canonical identifiers used by behavioral automation coverage. */
480
+ export const LX_RUNTIME_CAPABILITY_NAMES = LX_RUNTIME_SURFACES.flatMap(({ name, members }) => (
481
+ members.map((member) => `${name}.${member}`)
482
+ ));
483
+
484
+ /** Canonical identifiers used by runtime shape automation coverage. */
485
+ export const LX_RUNTIME_SHAPE_NAMES = LX_RUNTIME_CAPABILITY_NAMES.map((name) => `shape:${name}`);
486
+
487
+ const DOWNLOAD_TASK_API = [
488
+ 'abort',
489
+ 'cancel',
490
+ 'catch',
491
+ 'finally',
492
+ 'next',
493
+ 'pause',
494
+ 'resume',
495
+ 'return',
496
+ 'then',
497
+ 'wait',
498
+ ] as const;
499
+ const UPLOAD_TASK_API = ['cancel', 'catch', 'finally', 'next', 'return', 'then', 'wait'] as const;
500
+ const COMPRESS_VIDEO_TASK_API = ['cancel', 'catch', 'finally', 'next', 'return', 'then', 'wait'] as const;
501
+ const HOST_UPDATE_INFO_API = ['apply', 'isForceUpdate', 'releaseNotes', 'size', 'version'] as const;
502
+ const HOST_UPDATE_TASK_API = ['catch', 'finally', 'next', 'return', 'then', 'wait'] as const;
503
+ const PREVIEW_MEDIA_API = ['completed', 'current', 'onChange', 'presented'] as const;
504
+ const PAGE_SURFACE_API = [
505
+ 'alive',
506
+ 'close',
507
+ 'hide',
508
+ 'id',
509
+ 'key',
510
+ 'kind',
511
+ 'onClose',
512
+ 'onHide',
513
+ 'onMessage',
514
+ 'onShow',
515
+ 'postMessage',
516
+ 'realized',
517
+ 'show',
518
+ 'visible',
519
+ ] as const;
520
+ const TAB_SURFACE_API = [
521
+ 'activate',
522
+ 'alive',
523
+ 'close',
524
+ 'id',
525
+ 'key',
526
+ 'kind',
527
+ 'onClose',
528
+ 'realized',
529
+ 'scope',
530
+ 'visible',
531
+ ] as const;
532
+ const PAGE_MESSAGE_PORT_API = ['onMessage', 'postMessage'] as const;
533
+
534
+ export const LX_RETURNED_OBJECT_SURFACES = [
535
+ {
536
+ name: 'LxFile',
537
+ members: LX_FILE_API,
538
+ properties: ['path'],
539
+ optionalProperties: [],
540
+ fixture: 'runtime-safe',
541
+ factory: 'lx.fs.file',
542
+ },
543
+ {
544
+ name: 'VideoContext',
545
+ members: VIDEO_CONTEXT_API,
546
+ properties: [],
547
+ optionalProperties: [],
548
+ fixture: 'runtime-safe',
549
+ factory: 'lx.createVideoContext',
550
+ },
551
+ {
552
+ name: 'DownloadTask',
553
+ members: DOWNLOAD_TASK_API,
554
+ properties: [],
555
+ optionalProperties: [],
556
+ fixture: 'external-service',
557
+ factory: 'lx.downloadFile',
558
+ },
559
+ {
560
+ name: 'UploadTask',
561
+ members: UPLOAD_TASK_API,
562
+ properties: [],
563
+ optionalProperties: [],
564
+ fixture: 'external-service',
565
+ factory: 'lx.uploadFile',
566
+ },
567
+ {
568
+ name: 'CompressVideoTask',
569
+ members: COMPRESS_VIDEO_TASK_API,
570
+ properties: [],
571
+ optionalProperties: [],
572
+ fixture: 'external-media',
573
+ factory: 'lx.compressVideo',
574
+ },
575
+ {
576
+ name: 'HostAppUpdateInfo',
577
+ members: HOST_UPDATE_INFO_API,
578
+ properties: ['isForceUpdate', 'releaseNotes', 'size', 'version'],
579
+ optionalProperties: ['releaseNotes', 'size'],
580
+ fixture: 'external-service',
581
+ factory: 'lx.app.checkUpdate().update',
582
+ },
583
+ {
584
+ name: 'HostAppUpdateTask',
585
+ members: HOST_UPDATE_TASK_API,
586
+ properties: [],
587
+ optionalProperties: [],
588
+ fixture: 'external-service',
589
+ factory: 'HostAppUpdateInfo.apply',
590
+ },
591
+ {
592
+ name: 'PreviewMediaHandle',
593
+ members: PREVIEW_MEDIA_API,
594
+ properties: ['completed', 'current', 'presented'],
595
+ optionalProperties: [],
596
+ fixture: 'external-ui',
597
+ factory: 'lx.previewMedia',
598
+ },
599
+ {
600
+ name: 'PageSurface',
601
+ members: PAGE_SURFACE_API,
602
+ properties: ['alive', 'id', 'key', 'kind', 'realized', 'visible'],
603
+ optionalProperties: ['key'],
604
+ fixture: 'surface',
605
+ factory: 'lx.surface.openPage',
606
+ },
607
+ {
608
+ name: 'TabSurface',
609
+ members: TAB_SURFACE_API,
610
+ properties: ['alive', 'id', 'key', 'kind', 'realized', 'scope', 'visible'],
611
+ optionalProperties: ['key'],
612
+ fixture: 'surface',
613
+ factory: 'lx.surface.openUrl',
614
+ },
615
+ {
616
+ name: 'PageMessagePort',
617
+ members: PAGE_MESSAGE_PORT_API,
618
+ properties: [],
619
+ optionalProperties: [],
620
+ fixture: 'navigation',
621
+ factory: 'lx.navigateTo',
622
+ },
623
+ ] as const;
624
+
625
+ /** Canonical identifiers for behavior exercised through objects returned by lx APIs. */
626
+ export const LX_RETURNED_OBJECT_CAPABILITY_NAMES = LX_RETURNED_OBJECT_SURFACES.flatMap(({ name, members }) => (
627
+ members.map((member) => `${name}.${member}`)
628
+ ));
629
+
630
+ export const LX_RETURNED_OBJECT_SHAPE_NAMES = LX_RETURNED_OBJECT_CAPABILITY_NAMES.map((name) => `shape:${name}`);
631
+
632
+ /**
633
+ * Shape coverage a run on any host must prove. A surface marked `optional`, or
634
+ * a member listed in `optionalMembers`, is absent on hosts that do not build
635
+ * it — `lx.terminal` ships only inside the bundled Terminal Settings lxapp —
636
+ * so a suite that skips it has not covered it. Requiring it here would let the
637
+ * covers gate report a surface nobody touched as proven.
638
+ */
639
+ export const LX_REQUIRED_RUNTIME_SHAPE_NAMES = [
640
+ ...LX_RUNTIME_SURFACES.flatMap((surface) => {
641
+ if ('optional' in surface && surface.optional) return [];
642
+ const optionalMembers: readonly string[] =
643
+ 'optionalMembers' in surface ? surface.optionalMembers : [];
644
+ return surface.members
645
+ .filter((member) => !optionalMembers.includes(member))
646
+ .map((member) => `shape:${surface.name}.${member}`);
647
+ }),
648
+ ...LX_RETURNED_OBJECT_SURFACES
649
+ .filter(({ fixture }) => fixture === 'runtime-safe')
650
+ .flatMap(({ name, members }) => members.map((member) => `shape:${name}.${member}`)),
651
+ ];
652
+
653
+ type StringKey<T> = Extract<keyof T, string>;
654
+ type Members<T extends readonly string[]> = T[number];
655
+ type Exact<T, TMembers extends readonly string[]> = [
656
+ Exclude<StringKey<T>, Members<TMembers>>,
657
+ Exclude<Members<TMembers>, StringKey<T>>,
658
+ ] extends [never, never]
659
+ ? true
660
+ : false;
661
+ type AssertTrue<T extends true> = T;
662
+ type PublishedLx = Lx & { automation(): Automation };
663
+
664
+ export type LxApiManifestGate = [
665
+ AssertTrue<Exact<PublishedLx, typeof LX_API_NAMES>>,
666
+ AssertTrue<Exact<HostAppApi, typeof HOST_APP_API>>,
667
+ AssertTrue<Exact<AutostartApi, typeof AUTOSTART_API>>,
668
+ AssertTrue<Exact<AppearanceApi, typeof APPEARANCE_API>>,
669
+ AssertTrue<Exact<NavigationBarApi, typeof NAVIGATION_BAR_API>>,
670
+ AssertTrue<Exact<TabBarApi, typeof TAB_BAR_API>>,
671
+ AssertTrue<Exact<TerminalApi, typeof TERMINAL_API>>,
672
+ AssertTrue<Exact<TerminalSettingsApi, typeof TERMINAL_SETTINGS_API>>,
673
+ AssertTrue<Exact<TerminalColorSchemesApi, typeof TERMINAL_COLOR_SCHEMES_API>>,
674
+ AssertTrue<Exact<TerminalFontsApi, typeof TERMINAL_FONTS_API>>,
675
+ AssertTrue<Exact<TerminalPreviewController, typeof TERMINAL_PREVIEW_API>>,
676
+ AssertTrue<Exact<LxEnv, typeof ENV_API>>,
677
+ AssertTrue<Exact<ShellApi, typeof SHELL_API>>,
678
+ AssertTrue<Exact<ShellApi['sidebarActions'], typeof SHELL_SIDEBAR_ACTIONS_API>>,
679
+ AssertTrue<Exact<TrayApi, typeof TRAY_API>>,
680
+ AssertTrue<Exact<FileSystemApi, typeof FILE_SYSTEM_API>>,
681
+ AssertTrue<Exact<LxFile, typeof LX_FILE_API>>,
682
+ AssertTrue<Exact<Storage, typeof STORAGE_API>>,
683
+ AssertTrue<Exact<UpdateManager, typeof UPDATE_MANAGER_API>>,
684
+ AssertTrue<Exact<VideoContext, typeof VIDEO_CONTEXT_API>>,
685
+ AssertTrue<Exact<Automation, typeof AUTOMATION_API>>,
686
+ AssertTrue<Exact<ShellDriver, typeof SHELL_DRIVER_API>>,
687
+ AssertTrue<Exact<TerminalDriver, typeof TERMINAL_DRIVER_API>>,
688
+ AssertTrue<Exact<LxAppDriver, typeof LXAPP_DRIVER_API>>,
689
+ AssertTrue<Exact<LxAppManager, typeof LXAPP_MANAGER_API>>,
690
+ AssertTrue<Exact<PageDriver, typeof PAGE_DRIVER_API>>,
691
+ AssertTrue<Exact<PagePointer, typeof PAGE_POINTER_API>>,
692
+ AssertTrue<Exact<PageKey, typeof PAGE_KEY_API>>,
693
+ AssertTrue<Exact<NavDriver, typeof NAV_DRIVER_API>>,
694
+ AssertTrue<Exact<DeviceDriver, typeof DEVICE_DRIVER_API>>,
695
+ AssertTrue<Exact<BrowserDriver, typeof BROWSER_DRIVER_API>>,
696
+ AssertTrue<Exact<BrowserCookies, typeof BROWSER_COOKIES_API>>,
697
+ AssertTrue<Exact<DesktopDriver, typeof DESKTOP_DRIVER_API>>,
698
+ AssertTrue<Exact<DesktopPointer, typeof DESKTOP_POINTER_API>>,
699
+ AssertTrue<Exact<DesktopKey, typeof DESKTOP_KEY_API>>,
700
+ AssertTrue<Exact<DesktopWindowDriver, typeof DESKTOP_WINDOW_API>>,
701
+ AssertTrue<Exact<DesktopClipboard, typeof DESKTOP_CLIPBOARD_API>>,
702
+ AssertTrue<Exact<DesktopAx, typeof DESKTOP_AX_API>>,
703
+ AssertTrue<Exact<DesktopWait, typeof DESKTOP_WAIT_API>>,
704
+ AssertTrue<Exact<DesktopApp, typeof DESKTOP_APP_API>>,
705
+ AssertTrue<Exact<DesktopProcess, typeof DESKTOP_PROCESS_API>>,
706
+ AssertTrue<Exact<DownloadTask, typeof DOWNLOAD_TASK_API>>,
707
+ AssertTrue<Exact<UploadTask, typeof UPLOAD_TASK_API>>,
708
+ AssertTrue<Exact<CompressVideoTask, typeof COMPRESS_VIDEO_TASK_API>>,
709
+ AssertTrue<Exact<HostAppUpdateInfo, typeof HOST_UPDATE_INFO_API>>,
710
+ AssertTrue<Exact<HostAppUpdateTask, typeof HOST_UPDATE_TASK_API>>,
711
+ AssertTrue<Exact<PreviewMediaHandle, typeof PREVIEW_MEDIA_API>>,
712
+ AssertTrue<Exact<SurfaceApi, typeof SURFACE_NAMESPACE_API>>,
713
+ AssertTrue<Exact<PageSurface, typeof PAGE_SURFACE_API>>,
714
+ AssertTrue<Exact<TabSurface, typeof TAB_SURFACE_API>>,
715
+ AssertTrue<Exact<PageMessagePort, typeof PAGE_MESSAGE_PORT_API>>,
716
+ ];