Skip to content

Commit 070c915

Browse files
feat: expose smooth mouse movement via public API
1 parent 1ff017f commit 070c915

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 103
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-f05b888046776a18dbffc1264a27c0256839d132066ef5f6e09ccf1bc505a8f7.yml
3-
openapi_spec_hash: 646fce3982d3efbdb38004b0e4ac4d17
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2ba004ce5444b5f8abe3bcf66fd7c6da394bc964e8b2bf197576841135a48046.yml
3+
openapi_spec_hash: f156ea2ae35e4d148704c6e4ce051239
44
config_hash: cff4d43372b6fa66b64e2d4150f6aa76

src/resources/browsers/computer.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,21 @@ export namespace ComputerBatchParams {
381381
*/
382382
y: number;
383383

384+
/**
385+
* Target total duration in milliseconds for the mouse movement when smooth=true.
386+
* Omit for automatic timing based on distance.
387+
*/
388+
duration_ms?: number;
389+
384390
/**
385391
* Modifier keys to hold during the move
386392
*/
387393
hold_keys?: Array<string>;
394+
395+
/**
396+
* Use human-like Bezier curve path instead of instant mouse movement.
397+
*/
398+
smooth?: boolean;
388399
}
389400

390401
export interface PressKey {
@@ -571,10 +582,21 @@ export interface ComputerMoveMouseParams {
571582
*/
572583
y: number;
573584

585+
/**
586+
* Target total duration in milliseconds for the mouse movement when smooth=true.
587+
* Omit for automatic timing based on distance.
588+
*/
589+
duration_ms?: number;
590+
574591
/**
575592
* Modifier keys to hold during the move
576593
*/
577594
hold_keys?: Array<string>;
595+
596+
/**
597+
* Use human-like Bezier curve path instead of instant mouse movement.
598+
*/
599+
smooth?: boolean;
578600
}
579601

580602
export interface ComputerPressKeyParams {

tests/api-resources/browsers/computer.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ describe('resource computer', () => {
4848
move_mouse: {
4949
x: 0,
5050
y: 0,
51+
duration_ms: 50,
5152
hold_keys: ['string'],
53+
smooth: true,
5254
},
5355
press_key: {
5456
keys: ['string'],
@@ -174,7 +176,9 @@ describe('resource computer', () => {
174176
const response = await client.browsers.computer.moveMouse('id', {
175177
x: 0,
176178
y: 0,
179+
duration_ms: 50,
177180
hold_keys: ['string'],
181+
smooth: true,
178182
});
179183
});
180184

0 commit comments

Comments
 (0)