Skip to content

Commit d53ab31

Browse files
ddupont808claude
andauthored
fix(cua-bench): add KeyAction support to worker client (#1088) (#1141)
The worker client only accepted HotkeyAction for key presses, but the Slack oracle uses KeyAction(key="Return"). Add `key` to valid_fn_names and handle it in check_and_fix_action so callers can express single-key presses matching the oracle behavior. Closes #1088 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0a5f898 commit d53ab31

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libs/cua-bench/cua_bench/workers/worker_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
DoubleClickAction,
1515
DragAction,
1616
HotkeyAction,
17+
KeyAction,
1718
RightClickAction,
1819
ScrollAction,
1920
TypeAction,
@@ -133,6 +134,7 @@ class CBEnvWorkerClient:
133134
"right_single",
134135
"drag",
135136
"hotkey",
137+
"key",
136138
"type",
137139
"scroll",
138140
"wait",
@@ -271,6 +273,11 @@ def check_and_fix_action(self, action_str):
271273
args_str = ",".join(args)
272274
return f"hotkey({args_str})", HotkeyAction(keys=list(args))
273275

276+
elif fn_name == "key":
277+
if not check_type(args, [str]):
278+
return "wait()", default_action
279+
return f"key({args[0]})", KeyAction(key=args[0])
280+
274281
elif fn_name == "type":
275282
if not check_type(args, [str]):
276283
return "wait()", default_action

0 commit comments

Comments
 (0)