Repository navigation
Commit 62fe665
authored
fix(computer-use): work in short moments and hand the Mac back to the person (#6591)
* fix(computer-use): share the Mac with the person instead of asking for control back
When the person used the Mac during a step, computer use could raise its
window and send input under their hands, and if another window came to
the front it told the agent to hand control to the person and wait for
Continue.
In control mode the helper now waits until the person has left the mouse
and keyboard alone for half a second before it opens, looks or acts. It
reads that from the HID system's idle time, which the agent's
process-targeted input does not reach. It then brings its window back to
the front, at most twice per call. Between steps of a batch it waits and
refocuses instead of failing, and re-checks the window against the
observation when no input has landed yet. Another window in front is
reported as focus_lost with next "observe". A person who keeps working
for ten seconds gets person_active and nothing is sent. Only Take over
still asks for Continue.
Signed-off-by: Jalil <reachjalil@gmail.com>
* fix(computer-use): act at once and hand the front back instead of waiting for the person
Waiting for half a second of stillness made computer use slow whenever
the person moved the mouse. The agent now takes the front only for the
moment it needs, then gives it back.
Moving the mouse never holds the agent up. It defers at most half a
second, and only to the next gap in the person's typing or the release
of a held button, so their keys and drags do not land in its window.
It remembers which app had the front, and 0.4 s after its last call
gives the front back to that app, unless the person has already moved
on. An action and the read after it count as one moment.
A click or key press of the person's during the agent's moment stops
that step with person_interrupted and next "observe". The front stays
where the person put it, and the read right after takes no focus. Take
over still pauses for Continue. The ten-second person_active wait is
gone.
Signed-off-by: Jalil <reachjalil@gmail.com>
* fix(computer-use): never hand the front away from a person typing in the agent's window
The hand-back used the same filter as interrupts, which treats input
within 50 ms of the agent's own post as the agent's. A keystroke of the
person's in that window could go unseen, and the hand-back would then
move the front to another app while they kept typing.
The hand-back now reads click and key times unfiltered. Any of them
since the agent took the front keeps the front where it is. Input that
might be the agent's own only costs a hand-back, never moves the
person's typing. The filter remains only for stopping the agent's own
step.
Signed-off-by: Jalil <reachjalil@gmail.com>
---------
Signed-off-by: Jalil <reachjalil@gmail.com>1 parent 0719937 commit 62fe665
3 files changed
Lines changed: 465 additions & 19 deletions
File tree
- packages/computer-use/native
- Sources/ComputerUse
- Tests/ComputerUseTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
279 | 383 | | |
280 | 384 | | |
281 | 385 | | |
| |||
0 commit comments