Commit 69d66b4
fix(cua): convert Gemini scroll magnitude pixels to wheel notches (#154)
## Summary
Stacks on top of the unified CUA template branch. Fixes the Gemini
scroll handler bug Danny flagged in review.
Gemini's computer-use API reports scroll `magnitude` in **pixels**
(default ~400), but `computer.scroll`'s `delta_x` / `delta_y` expects
**wheel notches**. The cua adapter was passing `magnitude` through
unchanged, so a default Gemini scroll fired ~400 notches instead of ~7.
The standalone `gemini-computer-use` template already does the right
thing — this just brings the unified adapter in line:
- default magnitude: `3` → `400` (pixels, matching Gemini's spec)
- divide by `PX_PER_NOTCH` (60) and clamp to `MAX_NOTCHES_PER_ACTION`
(17)
- applied symmetrically in TS (`providers/gemini.ts`) and Python
(`providers/gemini.py`)
The `anthropic` and `openai` adapters already match their standalone
equivalents — no changes needed there.
## Test plan
- [ ] `go build ./...` passes (verified locally)
- [ ] `go test ./pkg/create/...` passes (verified locally)
- [ ] Deploy CUA template with Gemini provider, ask it to scroll a long
page; confirm scroll distance is page-sized, not catastrophic
- [ ] Repeat for Python template
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 822ebd0 commit 69d66b4
2 files changed
Lines changed: 21 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
172 | | - | |
| 177 | + | |
| 178 | + | |
173 | 179 | | |
174 | | - | |
175 | | - | |
| 180 | + | |
| 181 | + | |
176 | 182 | | |
177 | 183 | | |
178 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
| |||
180 | 185 | | |
181 | 186 | | |
182 | 187 | | |
183 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
184 | 193 | | |
185 | | - | |
186 | | - | |
| 194 | + | |
| 195 | + | |
187 | 196 | | |
188 | 197 | | |
189 | 198 | | |
| |||
0 commit comments