Skip to content

Commit 0f8468b

Browse files
dprevoznikclaude
andcommitted
wire scroll modifier through to hold_keys
n1.5's scroll action accepts an optional `modifier` (e.g., shift) that on browsers translates a vertical wheel into a horizontal scroll. Plumb it into Kernel's `ComputerScrollParams.hold_keys` so the OS-level modifier+wheel event is dispatched correctly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 97400cd commit 0f8468b

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

pkg/templates/python/yutori/tools/computer.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,17 @@ async def _handle_scroll(self, action: N15Action) -> ToolResult:
199199
elif direction == "right":
200200
delta_x = notches
201201

202-
self.kernel.browsers.computer.scroll(
203-
self.session_id,
204-
x=coords["x"],
205-
y=coords["y"],
206-
delta_x=delta_x,
207-
delta_y=delta_y,
208-
)
202+
modifier = action.get("modifier")
203+
scroll_kwargs: dict[str, Any] = {
204+
"x": coords["x"],
205+
"y": coords["y"],
206+
"delta_x": delta_x,
207+
"delta_y": delta_y,
208+
}
209+
if modifier:
210+
scroll_kwargs["hold_keys"] = [self._map_key(modifier)]
211+
212+
self.kernel.browsers.computer.scroll(self.session_id, **scroll_kwargs)
209213

210214
await asyncio.sleep(SCREENSHOT_DELAY_S)
211215
screenshot_result = await self.screenshot()

pkg/templates/typescript/yutori/tools/computer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,14 @@ export class ComputerTool {
229229
break;
230230
}
231231

232+
const holdKeys = action.modifier ? [this.mapKey(action.modifier)] : undefined;
233+
232234
await this.kernel.browsers.computer.scroll(this.sessionId, {
233235
x: coords.x,
234236
y: coords.y,
235237
delta_x,
236238
delta_y,
239+
...(holdKeys ? { hold_keys: holdKeys } : {}),
237240
});
238241

239242
await this.sleep(SCREENSHOT_DELAY_MS);

0 commit comments

Comments
 (0)