test-wuying-agentbay-sdk 0.13.0-beta.20251218180112 → 0.13.0-beta.20251219140420

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -125,6 +125,31 @@ interface OperationResult extends ApiResponse {
125
125
  /** Optional error message if the operation failed */
126
126
  errorMessage?: string;
127
127
  }
128
+ /**
129
+ * Interface for process list operation responses
130
+ * Corresponds to Python's ProcessListResult type
131
+ */
132
+ interface Process$1 {
133
+ pname: string;
134
+ pid: number;
135
+ cmdline?: string;
136
+ }
137
+ interface ProcessListResult extends OperationResult {
138
+ data: Process$1[];
139
+ }
140
+ /**
141
+ * Interface for installed app list operation responses
142
+ * Corresponds to Python's InstalledAppListResult type
143
+ */
144
+ interface InstalledApp$1 {
145
+ name: string;
146
+ startCmd: string;
147
+ stopCmd?: string;
148
+ workDirectory?: string;
149
+ }
150
+ interface InstalledAppListResult extends OperationResult {
151
+ data: InstalledApp$1[];
152
+ }
128
153
  /**
129
154
  * Interface for command execution operation responses
130
155
  * Corresponds to Python's CommandResult type
@@ -201,7 +226,7 @@ interface CodeExecutionResult extends ApiResponse {
201
226
  * Interface for boolean operation responses
202
227
  * Corresponds to Python's BoolResult type
203
228
  */
204
- interface BoolResult$2 extends ApiResponse {
229
+ interface BoolResult$1 extends ApiResponse {
205
230
  /** Request identifier for tracking API calls */
206
231
  requestId: string;
207
232
  /** Whether the operation was successful */
@@ -323,6 +348,12 @@ interface OSSDownloadResult extends ApiResponse {
323
348
  /** Optional error message if the operation failed */
324
349
  errorMessage?: string;
325
350
  }
351
+ interface WindowInfo {
352
+ windowId: number;
353
+ title: string;
354
+ pid: number;
355
+ pname: string;
356
+ }
326
357
  /**
327
358
  * Interface for window list operation responses
328
359
  * Corresponds to Python's WindowListResult type
@@ -333,10 +364,21 @@ interface WindowListResult extends ApiResponse {
333
364
  /** Whether the operation was successful */
334
365
  success: boolean;
335
366
  /** List of windows */
336
- windows: any[];
367
+ windows: WindowInfo[];
337
368
  /** Optional error message if the operation failed */
338
369
  errorMessage?: string;
339
370
  }
371
+ interface Window {
372
+ windowId: number;
373
+ title: string;
374
+ absoluteUpperLeftX?: number;
375
+ absoluteUpperLeftY?: number;
376
+ width?: number;
377
+ height?: number;
378
+ pid?: number;
379
+ pname?: string;
380
+ childWindows?: Window[];
381
+ }
340
382
  /**
341
383
  * Interface for window info operation responses
342
384
  * Corresponds to Python's WindowInfoResult type
@@ -347,7 +389,7 @@ interface WindowInfoResult extends ApiResponse {
347
389
  /** Whether the operation was successful */
348
390
  success: boolean;
349
391
  /** Window object */
350
- window?: any;
392
+ window?: Window[];
351
393
  /** Optional error message if the operation failed */
352
394
  errorMessage?: string;
353
395
  }
@@ -492,6 +534,32 @@ interface SessionResumeResult extends ApiResponse {
492
534
  /** Current status of the session. Possible values: "RUNNING", "PAUSED", "RESUMING" */
493
535
  status?: string;
494
536
  }
537
+ /**
538
+ * Represents the screen dimensions and DPI scaling information.
539
+ *
540
+ * @interface ScreenSize
541
+ * @extends OperationResult
542
+ */
543
+ interface ScreenSize extends OperationResult {
544
+ /** Screen width in pixels */
545
+ width: number;
546
+ /** Screen height in pixels */
547
+ height: number;
548
+ /** DPI scaling factor (e.g., 1.0 for 100%, 1.5 for 150%, 2.0 for 200%) */
549
+ dpiScalingFactor: number;
550
+ }
551
+ /**
552
+ * Represents the current cursor position on screen.
553
+ *
554
+ * @interface CursorPosition
555
+ * @extends OperationResult
556
+ */
557
+ interface CursorPosition extends OperationResult {
558
+ /** X coordinate in pixels (0 is left edge of screen) */
559
+ x: number;
560
+ /** Y coordinate in pixels (0 is top edge of screen) */
561
+ y: number;
562
+ }
495
563
 
496
564
  /**
497
565
  */
@@ -4208,6 +4276,9 @@ declare function replaceTemplatePlaceholders(template: string, replacements: Rec
4208
4276
  * Provides mouse, keyboard, and screen operations for desktop environments.
4209
4277
  */
4210
4278
 
4279
+ interface ScreenshotResult$1 extends OperationResult {
4280
+ data: string;
4281
+ }
4211
4282
  declare enum MouseButton {
4212
4283
  LEFT = "left",
4213
4284
  RIGHT = "right",
@@ -4220,21 +4291,6 @@ declare enum ScrollDirection {
4220
4291
  LEFT = "left",
4221
4292
  RIGHT = "right"
4222
4293
  }
4223
- interface BoolResult$1 extends OperationResult {
4224
- data?: boolean;
4225
- }
4226
- interface CursorPosition extends OperationResult {
4227
- x: number;
4228
- y: number;
4229
- }
4230
- interface ScreenSize extends OperationResult {
4231
- width: number;
4232
- height: number;
4233
- dpiScalingFactor: number;
4234
- }
4235
- interface ScreenshotResult$1 extends OperationResult {
4236
- data: string;
4237
- }
4238
4294
  interface ComputerSession {
4239
4295
  callMcpTool(toolName: string, args: Record<string, any>): Promise<any>;
4240
4296
  sessionId: string;
@@ -4263,7 +4319,7 @@ declare class Computer {
4263
4319
  * }
4264
4320
  * ```
4265
4321
  */
4266
- clickMouse(x: number, y: number, button?: MouseButton | string): Promise<BoolResult$1>;
4322
+ clickMouse(x: number, y: number, button?: MouseButton | string): Promise<OperationResult>;
4267
4323
  /**
4268
4324
  * Move mouse to specified coordinates.
4269
4325
  *
@@ -4283,7 +4339,7 @@ declare class Computer {
4283
4339
  * }
4284
4340
  * ```
4285
4341
  */
4286
- moveMouse(x: number, y: number): Promise<BoolResult$1>;
4342
+ moveMouse(x: number, y: number): Promise<OperationResult>;
4287
4343
  /**
4288
4344
  * Drag mouse from one position to another.
4289
4345
  *
@@ -4305,7 +4361,7 @@ declare class Computer {
4305
4361
  * }
4306
4362
  * ```
4307
4363
  */
4308
- dragMouse(fromX: number, fromY: number, toX: number, toY: number, button?: MouseButton | string): Promise<BoolResult$1>;
4364
+ dragMouse(fromX: number, fromY: number, toX: number, toY: number, button?: MouseButton | string): Promise<OperationResult>;
4309
4365
  /**
4310
4366
  * Scroll at specified coordinates.
4311
4367
  *
@@ -4325,7 +4381,7 @@ declare class Computer {
4325
4381
  * }
4326
4382
  * ```
4327
4383
  */
4328
- scroll(x: number, y: number, direction?: ScrollDirection | string, amount?: number): Promise<BoolResult$1>;
4384
+ scroll(x: number, y: number, direction?: ScrollDirection | string, amount?: number): Promise<OperationResult>;
4329
4385
  /**
4330
4386
  * Input text at the current cursor position.
4331
4387
  *
@@ -4342,7 +4398,7 @@ declare class Computer {
4342
4398
  * }
4343
4399
  * ```
4344
4400
  */
4345
- inputText(text: string): Promise<BoolResult$1>;
4401
+ inputText(text: string): Promise<OperationResult>;
4346
4402
  /**
4347
4403
  * Press one or more keys.
4348
4404
  *
@@ -4361,7 +4417,7 @@ declare class Computer {
4361
4417
  * }
4362
4418
  * ```
4363
4419
  */
4364
- pressKeys(keys: string[], hold?: boolean): Promise<BoolResult$1>;
4420
+ pressKeys(keys: string[], hold?: boolean): Promise<OperationResult>;
4365
4421
  /**
4366
4422
  * Release previously pressed keys.
4367
4423
  *
@@ -4379,7 +4435,7 @@ declare class Computer {
4379
4435
  * }
4380
4436
  * ```
4381
4437
  */
4382
- releaseKeys(keys: string[]): Promise<BoolResult$1>;
4438
+ releaseKeys(keys: string[]): Promise<OperationResult>;
4383
4439
  /**
4384
4440
  * Get cursor position.
4385
4441
  *
@@ -4466,7 +4522,7 @@ declare class Computer {
4466
4522
  * }
4467
4523
  * ```
4468
4524
  */
4469
- getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
4525
+ getActiveWindow(): Promise<WindowInfoResult>;
4470
4526
  /**
4471
4527
  * Activates the specified window.
4472
4528
  *
@@ -4484,7 +4540,7 @@ declare class Computer {
4484
4540
  * }
4485
4541
  * ```
4486
4542
  */
4487
- activateWindow(windowId: number): Promise<BoolResult$2>;
4543
+ activateWindow(windowId: number): Promise<BoolResult$1>;
4488
4544
  /**
4489
4545
  * Closes the specified window.
4490
4546
  *
@@ -4503,7 +4559,7 @@ declare class Computer {
4503
4559
  * }
4504
4560
  * ```
4505
4561
  */
4506
- closeWindow(windowId: number): Promise<BoolResult$2>;
4562
+ closeWindow(windowId: number): Promise<BoolResult$1>;
4507
4563
  /**
4508
4564
  * Maximizes the specified window.
4509
4565
  *
@@ -4522,7 +4578,7 @@ declare class Computer {
4522
4578
  * }
4523
4579
  * ```
4524
4580
  */
4525
- maximizeWindow(windowId: number): Promise<BoolResult$2>;
4581
+ maximizeWindow(windowId: number): Promise<BoolResult$1>;
4526
4582
  /**
4527
4583
  * Minimizes the specified window.
4528
4584
  *
@@ -4541,7 +4597,7 @@ declare class Computer {
4541
4597
  * }
4542
4598
  * ```
4543
4599
  */
4544
- minimizeWindow(windowId: number): Promise<BoolResult$2>;
4600
+ minimizeWindow(windowId: number): Promise<BoolResult$1>;
4545
4601
  /**
4546
4602
  * Restores the specified window.
4547
4603
  *
@@ -4561,7 +4617,7 @@ declare class Computer {
4561
4617
  * }
4562
4618
  * ```
4563
4619
  */
4564
- restoreWindow(windowId: number): Promise<BoolResult$2>;
4620
+ restoreWindow(windowId: number): Promise<BoolResult$1>;
4565
4621
  /**
4566
4622
  * Resizes the specified window.
4567
4623
  *
@@ -4582,7 +4638,7 @@ declare class Computer {
4582
4638
  * }
4583
4639
  * ```
4584
4640
  */
4585
- resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$2>;
4641
+ resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult$1>;
4586
4642
  /**
4587
4643
  * Makes the specified window fullscreen.
4588
4644
  *
@@ -4601,7 +4657,7 @@ declare class Computer {
4601
4657
  * }
4602
4658
  * ```
4603
4659
  */
4604
- fullscreenWindow(windowId: number): Promise<BoolResult$2>;
4660
+ fullscreenWindow(windowId: number): Promise<BoolResult$1>;
4605
4661
  /**
4606
4662
  * Toggles focus mode on or off.
4607
4663
  *
@@ -4619,7 +4675,7 @@ declare class Computer {
4619
4675
  * }
4620
4676
  * ```
4621
4677
  */
4622
- focusMode(on: boolean): Promise<BoolResult$2>;
4678
+ focusMode(on: boolean): Promise<BoolResult$1>;
4623
4679
  /**
4624
4680
  * Gets the list of installed applications.
4625
4681
  *
@@ -4639,7 +4695,7 @@ declare class Computer {
4639
4695
  * }
4640
4696
  * ```
4641
4697
  */
4642
- getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<any>;
4698
+ getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppListResult>;
4643
4699
  /**
4644
4700
  * Starts the specified application.
4645
4701
  *
@@ -4659,7 +4715,7 @@ declare class Computer {
4659
4715
  * }
4660
4716
  * ```
4661
4717
  */
4662
- startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<any>;
4718
+ startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessListResult>;
4663
4719
  /**
4664
4720
  * Stops an application by process name.
4665
4721
  *
@@ -4677,7 +4733,7 @@ declare class Computer {
4677
4733
  * }
4678
4734
  * ```
4679
4735
  */
4680
- stopAppByPName(pname: string): Promise<any>;
4736
+ stopAppByPName(pname: string): Promise<BoolResult$1>;
4681
4737
  /**
4682
4738
  * Stops an application by process ID.
4683
4739
  *
@@ -4696,7 +4752,7 @@ declare class Computer {
4696
4752
  * }
4697
4753
  * ```
4698
4754
  */
4699
- stopAppByPID(pid: number): Promise<any>;
4755
+ stopAppByPID(pid: number): Promise<BoolResult$1>;
4700
4756
  /**
4701
4757
  * Stops an application by stop command.
4702
4758
  *
@@ -4714,7 +4770,7 @@ declare class Computer {
4714
4770
  * }
4715
4771
  * ```
4716
4772
  */
4717
- stopAppByCmd(cmd: string): Promise<any>;
4773
+ stopAppByCmd(cmd: string): Promise<BoolResult$1>;
4718
4774
  /**
4719
4775
  * Lists all visible applications.
4720
4776
  *
@@ -4731,7 +4787,7 @@ declare class Computer {
4731
4787
  * }
4732
4788
  * ```
4733
4789
  */
4734
- listVisibleApps(): Promise<any>;
4790
+ listVisibleApps(): Promise<ProcessListResult>;
4735
4791
  }
4736
4792
 
4737
4793
  interface ContextStatusData {
@@ -4965,7 +5021,28 @@ declare class FileSystem {
4965
5021
  * }
4966
5022
  * ```
4967
5023
  */
4968
- createDirectory(path: string): Promise<BoolResult$2>;
5024
+ createDirectory(path: string): Promise<BoolResult$1>;
5025
+ /**
5026
+ * Deletes a file at the specified path.
5027
+ * Corresponds to Python's delete_file() method
5028
+ *
5029
+ * @param path - Path to the file to delete.
5030
+ * @returns BoolResult with deletion result and requestId
5031
+ *
5032
+ * @example
5033
+ * ```typescript
5034
+ * const agentBay = new AgentBay({ apiKey: 'your_api_key' });
5035
+ * const result = await agentBay.create();
5036
+ * if (result.success) {
5037
+ * const session = result.session;
5038
+ * await session.fileSystem.writeFile('/tmp/to_delete.txt', 'hello');
5039
+ * const deleteResult = await session.fileSystem.deleteFile('/tmp/to_delete.txt');
5040
+ * console.log('File deleted:', deleteResult.success);
5041
+ * await session.delete();
5042
+ * }
5043
+ * ```
5044
+ */
5045
+ deleteFile(path: string): Promise<BoolResult$1>;
4969
5046
  /**
4970
5047
  * Edits a file by replacing occurrences of oldText with newText.
4971
5048
  * Corresponds to Python's edit_file() method
@@ -4991,7 +5068,7 @@ declare class FileSystem {
4991
5068
  editFile(path: string, edits: Array<{
4992
5069
  oldText: string;
4993
5070
  newText: string;
4994
- }>, dryRun?: boolean): Promise<BoolResult$2>;
5071
+ }>, dryRun?: boolean): Promise<BoolResult$1>;
4995
5072
  /**
4996
5073
  * Gets information about a file or directory.
4997
5074
  * Corresponds to Python's get_file_info() method
@@ -5072,7 +5149,7 @@ declare class FileSystem {
5072
5149
  * }
5073
5150
  * ```
5074
5151
  */
5075
- moveFile(source: string, destination: string): Promise<BoolResult$2>;
5152
+ moveFile(source: string, destination: string): Promise<BoolResult$1>;
5076
5153
  /**
5077
5154
  * Internal method to read a file chunk. Used for chunked file operations.
5078
5155
  *
@@ -5242,7 +5319,7 @@ declare class FileSystem {
5242
5319
  *
5243
5320
  * @see {@link readFile}, {@link listDirectory}
5244
5321
  */
5245
- writeFile(path: string, content: string, mode?: string): Promise<BoolResult$2>;
5322
+ writeFile(path: string, content: string, mode?: string): Promise<BoolResult$1>;
5246
5323
  /**
5247
5324
  * Get file change information for the specified directory path
5248
5325
  *