@@ -11,6 +11,7 @@ export type CommandCapability = {
1111 apple ?: KindMatrix ;
1212 android ?: KindMatrix ;
1313 linux ?: KindMatrix ;
14+ web ?: KindMatrix ;
1415 supports ?: ( device : DeviceInfo ) => boolean ;
1516 /** Optional actionable hint surfaced when this command is rejected at admission for `device`. */
1617 unsupportedHint ?: ( device : DeviceInfo ) => string | undefined ;
@@ -39,12 +40,17 @@ const synthesisGestureUnsupportedHint = (device: DeviceInfo): string | undefined
3940// Linux device kind is always 'device' (local desktop).
4041const LINUX_DEVICE : KindMatrix = { device : true } ;
4142const LINUX_NONE : KindMatrix = { } ;
43+ const WEB_DEVICE : KindMatrix = { device : true } ;
4244const ALL_DEVICE_COMMAND_CAPABILITY = {
4345 apple : { simulator : true , device : true } ,
4446 android : { emulator : true , device : true , unknown : true } ,
4547 linux : LINUX_DEVICE ,
4648} as const satisfies CommandCapability ;
47- const APP_RUNTIME_CAPABILITY = ALL_DEVICE_COMMAND_CAPABILITY ;
49+ const WEB_COMMAND_CAPABILITY = {
50+ ...ALL_DEVICE_COMMAND_CAPABILITY ,
51+ web : WEB_DEVICE ,
52+ } as const satisfies CommandCapability ;
53+ const APP_RUNTIME_CAPABILITY = WEB_COMMAND_CAPABILITY ;
4854const APP_INVENTORY_CAPABILITY = {
4955 apple : { simulator : true , device : true } ,
5056 android : { emulator : true , device : true , unknown : true } ,
@@ -124,6 +130,7 @@ const COMMAND_CAPABILITY_MATRIX: Record<string, CommandCapability> = {
124130 apple : { simulator : true , device : true } ,
125131 android : { emulator : true , device : true , unknown : true } ,
126132 linux : LINUX_DEVICE ,
133+ web : WEB_DEVICE ,
127134 } ,
128135 clipboard : {
129136 apple : { simulator : true , device : true } ,
@@ -147,19 +154,20 @@ const COMMAND_CAPABILITY_MATRIX: Record<string, CommandCapability> = {
147154 apple : { simulator : true , device : true } ,
148155 android : { emulator : true , device : true , unknown : true } ,
149156 linux : LINUX_DEVICE ,
157+ web : WEB_DEVICE ,
150158 } ,
151159 fling : {
152160 apple : { simulator : true , device : true } ,
153161 android : { emulator : true , device : true , unknown : true } ,
154162 linux : LINUX_NONE ,
155163 } ,
156- snapshot : ALL_DEVICE_COMMAND_CAPABILITY ,
164+ snapshot : WEB_COMMAND_CAPABILITY ,
157165 diff : ALL_DEVICE_COMMAND_CAPABILITY ,
158- screenshot : ALL_DEVICE_COMMAND_CAPABILITY ,
159- wait : ALL_DEVICE_COMMAND_CAPABILITY ,
160- get : ALL_DEVICE_COMMAND_CAPABILITY ,
161- find : ALL_DEVICE_COMMAND_CAPABILITY ,
162- is : ALL_DEVICE_COMMAND_CAPABILITY ,
166+ screenshot : WEB_COMMAND_CAPABILITY ,
167+ wait : WEB_COMMAND_CAPABILITY ,
168+ get : WEB_COMMAND_CAPABILITY ,
169+ find : WEB_COMMAND_CAPABILITY ,
170+ is : WEB_COMMAND_CAPABILITY ,
163171 focus : {
164172 apple : { simulator : true , device : true } ,
165173 android : { emulator : true , device : true , unknown : true } ,
@@ -200,6 +208,7 @@ const COMMAND_CAPABILITY_MATRIX: Record<string, CommandCapability> = {
200208 apple : { simulator : true , device : true } ,
201209 android : { emulator : true , device : true , unknown : true } ,
202210 linux : LINUX_DEVICE ,
211+ web : WEB_DEVICE ,
203212 } ,
204213 push : {
205214 apple : { simulator : true } ,
@@ -228,6 +237,7 @@ const COMMAND_CAPABILITY_MATRIX: Record<string, CommandCapability> = {
228237 apple : { simulator : true , device : true } ,
229238 android : { emulator : true , device : true , unknown : true } ,
230239 linux : LINUX_DEVICE ,
240+ web : WEB_DEVICE ,
231241 } ,
232242 swipe : {
233243 apple : { simulator : true , device : true } ,
@@ -246,17 +256,19 @@ const COMMAND_CAPABILITY_MATRIX: Record<string, CommandCapability> = {
246256 android : { emulator : true , device : true , unknown : true } ,
247257 linux : LINUX_NONE ,
248258 } ,
249- type : ALL_DEVICE_COMMAND_CAPABILITY ,
259+ type : WEB_COMMAND_CAPABILITY ,
250260} ;
251261
252262export function isCommandSupportedOnDevice ( command : string , device : DeviceInfo ) : boolean {
253263 const capability = COMMAND_CAPABILITY_MATRIX [ command ] ;
254264 if ( ! capability ) return true ;
255265 const byPlatform = isApplePlatform ( device . platform )
256266 ? capability . apple
257- : device . platform === 'linux'
258- ? capability . linux
259- : capability . android ;
267+ : device . platform === 'android'
268+ ? capability . android
269+ : device . platform === 'linux'
270+ ? capability . linux
271+ : capability . web ;
260272 if ( ! byPlatform ) return false ;
261273 if ( capability . supports && ! capability . supports ( device ) ) return false ;
262274 const kind = ( device . kind ?? 'unknown' ) as keyof KindMatrix ;
0 commit comments