@@ -7,19 +7,18 @@ import {
77import type { CommandCapability } from '../capabilities.ts' ;
88import type { DaemonRequest } from '../../daemon/types.ts' ;
99import { resolveWaitBudgetMs } from '../wait-positionals.ts' ;
10- import {
11- FILL_DELAY_WIRE_ECHO ,
12- INTERACTION_REPEAT_WIRE_ECHO_FIELDS ,
13- type CommandWireProjection ,
14- } from '../interaction-wire-echo.ts' ;
1510import {
1611 DEFAULT_TIMEOUT_POLICY ,
1712 INSTALL_REQUEST_TIMEOUT_MS ,
1813 PREPARE_REQUEST_TIMEOUT_MS ,
1914} from './timeout-policy.ts' ;
2015import { resolvePostActionObservationSupport } from './post-action-observation.ts' ;
2116import type { PostActionObservationSupport } from './post-action-observation.ts' ;
22- import type { CommandDescriptor , CommandTimeoutPolicy } from './types.ts' ;
17+ import type {
18+ CommandDescriptor ,
19+ CommandResponseDataTransform ,
20+ CommandTimeoutPolicy ,
21+ } from './types.ts' ;
2322
2423type RawCommandDescriptor = Omit < CommandDescriptor , 'mcpExposed' > & {
2524 mcpExposed ?: boolean ;
@@ -130,18 +129,22 @@ const SETTLE_FLAG_PRESERVE_DAEMON_TIMEOUT_POLICY: CommandTimeoutPolicy = {
130129 onTimeout : 'preserve-daemon' ,
131130} ;
132131
133- const TOUCH_INTERACTION_WIRE_PROJECTION = {
134- wireEcho : {
135- ...INTERACTION_REPEAT_WIRE_ECHO_FIELDS ,
132+ const TOUCH_INTERACTION_RESPONSE_DATA_TRANSFORM = {
133+ fields : {
134+ count : { defaultValue : 1 , omitDefault : true } ,
135+ intervalMs : { defaultValue : 0 , omitDefault : true } ,
136+ holdMs : { defaultValue : 0 , omitDefault : true } ,
137+ jitterPx : { defaultValue : 0 , omitDefault : true } ,
138+ doubleTap : { defaultValue : false , omitDefault : true } ,
136139 } ,
137- } as const satisfies CommandWireProjection ;
140+ } as const satisfies CommandResponseDataTransform ;
138141
139- const FILL_INTERACTION_WIRE_PROJECTION = {
140- wireEcho : {
141- ...INTERACTION_REPEAT_WIRE_ECHO_FIELDS ,
142- delayMs : FILL_DELAY_WIRE_ECHO ,
142+ const FILL_INTERACTION_RESPONSE_DATA_TRANSFORM = {
143+ fields : {
144+ ...TOUCH_INTERACTION_RESPONSE_DATA_TRANSFORM . fields ,
145+ delayMs : { defaultValue : 0 } ,
143146 } ,
144- } as const satisfies CommandWireProjection ;
147+ } as const satisfies CommandResponseDataTransform ;
145148
146149function interactionTimeoutPolicy ( command : string ) : CommandTimeoutPolicy {
147150 return resolvePostActionObservationSupport ( command ) !== undefined
@@ -534,7 +537,7 @@ const RAW_COMMAND_DESCRIPTORS = [
534537 capability : { apple : APPLE_SIM_AND_DEVICE , android : ANDROID_ALL , linux : LINUX_DEVICE } ,
535538 timeoutPolicy : interactionTimeoutPolicy ( PUBLIC_COMMANDS . click ) ,
536539 postActionObservation : postActionObservation ( PUBLIC_COMMANDS . click ) ,
537- wireProjection : TOUCH_INTERACTION_WIRE_PROJECTION ,
540+ responseDataTransform : TOUCH_INTERACTION_RESPONSE_DATA_TRANSFORM ,
538541 batchable : true ,
539542 } ,
540543 {
@@ -543,7 +546,7 @@ const RAW_COMMAND_DESCRIPTORS = [
543546 capability : { apple : APPLE_SIM_AND_DEVICE , android : ANDROID_ALL , linux : LINUX_DEVICE } ,
544547 timeoutPolicy : interactionTimeoutPolicy ( PUBLIC_COMMANDS . fill ) ,
545548 postActionObservation : postActionObservation ( PUBLIC_COMMANDS . fill ) ,
546- wireProjection : FILL_INTERACTION_WIRE_PROJECTION ,
549+ responseDataTransform : FILL_INTERACTION_RESPONSE_DATA_TRANSFORM ,
547550 batchable : true ,
548551 } ,
549552 {
@@ -560,7 +563,7 @@ const RAW_COMMAND_DESCRIPTORS = [
560563 capability : { apple : APPLE_SIM_AND_DEVICE , android : ANDROID_ALL , linux : LINUX_DEVICE } ,
561564 timeoutPolicy : interactionTimeoutPolicy ( PUBLIC_COMMANDS . press ) ,
562565 postActionObservation : postActionObservation ( PUBLIC_COMMANDS . press ) ,
563- wireProjection : TOUCH_INTERACTION_WIRE_PROJECTION ,
566+ responseDataTransform : TOUCH_INTERACTION_RESPONSE_DATA_TRANSFORM ,
564567 batchable : true ,
565568 } ,
566569 {
@@ -796,11 +799,14 @@ const TIMEOUT_POLICY_BY_COMMAND: ReadonlyMap<string, CommandTimeoutPolicy> = new
796799 commandDescriptors . map ( ( descriptor ) => [ descriptor . name , descriptor . timeoutPolicy ] ) ,
797800) ;
798801
799- const WIRE_PROJECTION_BY_COMMAND : ReadonlyMap < string , CommandWireProjection > = new Map (
800- Array . from ( COMMAND_DESCRIPTOR_BY_NAME . values ( ) ) . flatMap ( ( descriptor ) =>
801- descriptor . wireProjection ? [ [ descriptor . name , descriptor . wireProjection ] as const ] : [ ] ,
802- ) ,
803- ) ;
802+ const RESPONSE_DATA_TRANSFORM_BY_COMMAND : ReadonlyMap < string , CommandResponseDataTransform > =
803+ new Map (
804+ Array . from ( COMMAND_DESCRIPTOR_BY_NAME . values ( ) ) . flatMap ( ( descriptor ) =>
805+ descriptor . responseDataTransform
806+ ? [ [ descriptor . name , descriptor . responseDataTransform ] as const ]
807+ : [ ] ,
808+ ) ,
809+ ) ;
804810
805811export function resolveCommandPostActionObservationSupport (
806812 command : string | undefined ,
@@ -828,9 +834,9 @@ export function resolveCommandTimeoutPolicy(command: string | undefined): Comman
828834 return TIMEOUT_POLICY_BY_COMMAND . get ( command ) ?? DEFAULT_TIMEOUT_POLICY ;
829835}
830836
831- export function resolveCommandWireProjection (
837+ export function resolveCommandResponseDataTransform (
832838 command : string | undefined ,
833- ) : CommandWireProjection | undefined {
839+ ) : CommandResponseDataTransform | undefined {
834840 if ( command === undefined ) return undefined ;
835- return WIRE_PROJECTION_BY_COMMAND . get ( command ) ;
841+ return RESPONSE_DATA_TRANSFORM_BY_COMMAND . get ( command ) ;
836842}
0 commit comments