Add typed field-flight prototype and preserve native qualification failures
This commit is contained in:
@@ -50,6 +50,8 @@ def gate_options(native, args):
|
||||
if any(value not in {'-errOrdinaryGateObserve', '-errOrdinaryGateChoices'} for value in tokens):
|
||||
raise Refused('Unknown native gate observer option')
|
||||
approach = getattr(args, 'enable_private_approach_proof', False)
|
||||
if getattr(args, 'enable_private_coarse_approach_proof', False) and not approach:
|
||||
raise Refused('Coarse approach requires explicit approach proof')
|
||||
if getattr(args, 'enable_private_selection_proof', False) and '-errOrdinaryGateChoices' not in tokens:
|
||||
raise Refused('Selection requires matching native gate choices')
|
||||
if approach and '-errOrdinaryGateObserve' not in tokens:
|
||||
@@ -134,7 +136,10 @@ def yaw_delta(first, second):
|
||||
|
||||
|
||||
class RelativeMouse:
|
||||
def __init__(self, query, keyboard, owner, enable_approach=False, enable_alignment=False):
|
||||
def __init__(self, query, keyboard, owner, enable_approach=False, enable_alignment=False, enable_coarse_approach=False):
|
||||
if type(enable_coarse_approach) is not bool or (enable_coarse_approach and not enable_approach):
|
||||
raise Refused("Coarse approach requires explicit approach capability")
|
||||
self.enable_coarse_approach = enable_coarse_approach
|
||||
self.query, self.keyboard, self.owner = query, keyboard, owner
|
||||
self.enable_approach = enable_approach
|
||||
self.enable_alignment = enable_alignment
|
||||
@@ -173,7 +178,7 @@ class RelativeMouse:
|
||||
self._move(dx, dy, guard)
|
||||
|
||||
def approach_move(self, dx, dy, guard, *, deadline, clock=time.monotonic):
|
||||
if (self.enable_approach is not True or type(dx) is not int or not 1 <= abs(dx) <= 128
|
||||
if (self.enable_approach is not True or type(dx) is not int or not 1 <= abs(dx) <= (384 if self.enable_coarse_approach else 128)
|
||||
or type(dy) is not int or dy != 0):
|
||||
raise Refused('Unsupported or unenabled approach relative step')
|
||||
def within_lease():
|
||||
@@ -590,7 +595,9 @@ def confirm_release(guard, keyboard, report, key, clock=time.monotonic, sleep=ti
|
||||
observation['end'] = clock()
|
||||
|
||||
|
||||
def sequence(guard, keyboard, observer, report, clock=time.monotonic, sleep=time.sleep, mouse=None, approach=False, alignment=False, selection=False):
|
||||
def sequence(guard, keyboard, observer, report, clock=time.monotonic, sleep=time.sleep, mouse=None, approach=False, alignment=False, selection=False, coarse_approach=False):
|
||||
if type(coarse_approach) is not bool or (coarse_approach and not approach) or report.get("coarse_approach_requested", False) is not coarse_approach:
|
||||
raise Refused("Coarse approach requires matching explicit capability")
|
||||
deadline = clock() + 70
|
||||
held = None
|
||||
approach_completed = False
|
||||
@@ -764,7 +771,7 @@ def run_approach(guard, keyboard, observer, mouse, report, clock, sleep):
|
||||
deadline = observer.ready_at + 35
|
||||
perform_approach(guard, ApproachKeyboard(keyboard, report, clock, deadline), ApproachMouse(mouse, report, clock, deadline),
|
||||
observer.approach_snapshots, geometry, calibration, report,
|
||||
clock=clock, sleep=sleep, notify=route_notify, key_state_busy=KeyStateBusy)
|
||||
clock=clock, sleep=sleep, notify=route_notify, key_state_busy=KeyStateBusy, profile="coarse" if report.get("coarse_approach_requested", False) else "standard")
|
||||
if not report.get('approach_proof', {}).get('completed'):
|
||||
raise Refused('Approach module did not complete')
|
||||
|
||||
@@ -986,6 +993,7 @@ def arguments(argv=None):
|
||||
p.add_argument('--enable-private-selection-proof', action='store_true', help='After facing, try one button5 wheel selection; never perform the action')
|
||||
p.add_argument('--enable-private-look-proof', action='store_true')
|
||||
p.add_argument('--enable-private-alignment-proof', action='store_true', help='After successful approach, attempt stationary native lock selection using horizontal relative mouse only')
|
||||
p.add_argument('--enable-private-coarse-approach-proof', action='store_true', help='Explicit larger stationary-yaw profile; requires approach, original clocks unchanged')
|
||||
p.add_argument('--enable-private-approach-proof', action='store_true', help='After look calibration, replace W/Tab cycle with bounded interior approach only')
|
||||
for name in ('prefix', 'game-executable', 'profile', 'report'):
|
||||
p.add_argument('--' + name, type=Path, required=True)
|
||||
@@ -994,6 +1002,8 @@ def arguments(argv=None):
|
||||
p.add_argument('--nonce', required=True)
|
||||
p.add_argument('command', nargs=argparse.REMAINDER)
|
||||
args = p.parse_args(argv)
|
||||
if args.enable_private_coarse_approach_proof and not args.enable_private_approach_proof:
|
||||
p.error('Coarse approach proof requires explicit approach proof')
|
||||
if args.enable_private_selection_proof and not (args.enable_private_alignment_proof and args.enable_private_approach_proof and args.enable_private_look_proof):
|
||||
p.error('Selection proof requires explicit alignment, approach and look proof')
|
||||
if args.enable_private_alignment_proof and not (args.enable_private_approach_proof and args.enable_private_look_proof):
|
||||
@@ -1102,6 +1112,7 @@ def main(argv=None):
|
||||
bound = display.binding(args.host_display, args.prefix)
|
||||
report = {'schema': 1, 'kind': 'headless-private-keyboard-experiment', 'input_sent': False,
|
||||
'look_requested': args.enable_private_look_proof,
|
||||
'coarse_approach_requested': getattr(args, 'enable_private_coarse_approach_proof', False),
|
||||
'approach_requested': getattr(args, 'enable_private_approach_proof', False),
|
||||
'alignment_requested': getattr(args, 'enable_private_alignment_proof', False),
|
||||
'selection_requested': getattr(args, 'enable_private_selection_proof', False),
|
||||
@@ -1187,8 +1198,8 @@ def main(argv=None):
|
||||
guard.check()
|
||||
keyboard = Keyboard(query)
|
||||
keyboard.require_idle()
|
||||
mouse = RelativeMouse(query, keyboard, owner, enable_approach=getattr(args, "enable_private_approach_proof", False), enable_alignment=getattr(args, "enable_private_alignment_proof", False)) if args.enable_private_look_proof else None
|
||||
sequence(guard, keyboard, observer, report, mouse=mouse, approach=getattr(args, "enable_private_approach_proof", False), alignment=getattr(args, "enable_private_alignment_proof", False), selection=getattr(args, "enable_private_selection_proof", False))
|
||||
mouse = RelativeMouse(query, keyboard, owner, enable_approach=getattr(args, "enable_private_approach_proof", False), enable_alignment=getattr(args, "enable_private_alignment_proof", False), enable_coarse_approach=getattr(args, "enable_private_coarse_approach_proof", False)) if args.enable_private_look_proof else None
|
||||
sequence(guard, keyboard, observer, report, mouse=mouse, approach=getattr(args, "enable_private_approach_proof", False), alignment=getattr(args, "enable_private_alignment_proof", False), selection=getattr(args, "enable_private_selection_proof", False), coarse_approach=getattr(args, "enable_private_coarse_approach_proof", False))
|
||||
except (OSError, ValueError, UnicodeError, subprocess.SubprocessError) as error:
|
||||
report['error'] = str(error)
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user