wuying-agentbay-sdk 0.3.0 → 0.4.0

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.ts CHANGED
@@ -1,302 +1,41 @@
1
1
  import * as $dara from '@darabonba/typescript';
2
- import * as OpenApiDefault from '@alicloud/openapi-core';
3
- import { $OpenApiUtil } from '@alicloud/openapi-core';
2
+ import OpenApi, { $OpenApiUtil } from '@alicloud/openapi-core';
4
3
 
5
4
  /**
6
- * FileInfo represents information about a file or directory
7
- */
8
- interface FileInfo {
9
- name: string;
10
- path: string;
11
- size: number;
12
- isDirectory: boolean;
13
- modTime: string;
14
- mode: string;
15
- owner?: string;
16
- group?: string;
17
- }
18
- /**
19
- * DirectoryEntry represents an entry in a directory listing
20
- */
21
- interface DirectoryEntry {
22
- name: string;
23
- isDirectory: boolean;
24
- }
25
- /**
26
- * Handles file operations in the AgentBay cloud environment.
27
- */
28
- declare class FileSystem {
29
- private session;
30
- private client;
31
- private baseUrl;
32
- /**
33
- * Initialize a FileSystem object.
34
- *
35
- * @param session - The Session instance that this FileSystem belongs to.
36
- */
37
- constructor(session: Session);
38
- /**
39
- * Helper method to call MCP tools and handle common response processing
40
- *
41
- * @param toolName - Name of the MCP tool to call
42
- * @param args - Arguments to pass to the tool
43
- * @param defaultErrorMsg - Default error message if specific error details are not available
44
- * @returns A CallMcpToolResult with the response data
45
- * @throws APIError if the call fails
46
- */
47
- private callMcpTool;
48
- /**
49
- * Creates a new directory at the specified path.
50
- *
51
- * @param path - Path to the directory to create.
52
- * @returns The extracted text content from the API response
53
- * @throws APIError if the operation fails.
54
- */
55
- createDirectory(path: string): Promise<string>;
56
- /**
57
- * Edits a file by replacing occurrences of oldText with newText.
58
- *
59
- * @param path - Path to the file to edit.
60
- * @param edits - Array of edit operations, each containing oldText and newText.
61
- * @param dryRun - Optional: If true, preview changes without applying them.
62
- * @returns The extracted text content from the API response
63
- * @throws APIError if the operation fails.
64
- */
65
- editFile(path: string, edits: Array<{
66
- oldText: string;
67
- newText: string;
68
- }>, dryRun?: boolean): Promise<string>;
69
- /**
70
- * Gets information about a file or directory.
71
- *
72
- * @param path - Path to the file or directory to inspect.
73
- * @returns The extracted text content from the API response
74
- * @throws APIError if the operation fails.
75
- */
76
- getFileInfo(path: string): Promise<FileInfo>;
77
- /**
78
- * Lists the contents of a directory.
79
- *
80
- * @param path - Path to the directory to list.
81
- * @returns Array of directory entries with properties like name, isDirectory
82
- * @throws APIError if the operation fails.
83
- */
84
- listDirectory(path: string): Promise<DirectoryEntry[]>;
85
- /**
86
- * Moves a file or directory from source to destination.
87
- *
88
- * @param source - Path to the source file or directory.
89
- * @param destination - Path to the destination file or directory.
90
- * @returns The extracted text content from the API response
91
- * @throws APIError if the operation fails.
92
- */
93
- moveFile(source: string, destination: string): Promise<string>;
94
- /**
95
- * Reads the content of a file.
96
- *
97
- * @param path - Path to the file to read.
98
- * @param offset - Optional: Line offset to start reading from.
99
- * @param length - Optional: Number of lines to read. If 0, reads the entire file.
100
- * @returns The extracted text content from the API response
101
- * @throws APIError if the operation fails.
102
- */
103
- readFile(path: string, offset?: number, length?: number): Promise<string>;
104
- /**
105
- * Reads the content of multiple files.
106
- *
107
- * @param paths - Array of file paths to read.
108
- * @returns The extracted text content from the API response
109
- * @throws APIError if the operation fails.
110
- */
111
- readMultipleFiles(paths: string[]): Promise<Record<string, string>>;
112
- /**
113
- * Searches for files in a directory that match a pattern.
114
- *
115
- * @param path - Path to the directory to search in.
116
- * @param pattern - Pattern to search for. Supports glob patterns.
117
- * @param excludePatterns - Optional: Array of patterns to exclude.
118
- * @returns Array of search results with properties like path
119
- * @throws APIError if the operation fails.
120
- */
121
- searchFiles(path: string, pattern: string, excludePatterns?: string[]): Promise<string[]>;
122
- /**
123
- * Writes content to a file.
124
- *
125
- * @param path - Path to the file to write.
126
- * @param content - Content to write to the file.
127
- * @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
128
- * @returns The extracted text content from the API response
129
- * @throws APIError if the operation fails.
130
- */
131
- writeFile(path: string, content: string, mode?: string): Promise<string>;
132
- /**
133
- * Reads a large file in chunks to handle size limitations of the underlying API.
134
- * It automatically splits the read operation into multiple requests of chunkSize bytes each.
135
- *
136
- * @param path - Path to the file to read.
137
- * @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
138
- * @returns The complete file content as a string
139
- * @throws APIError if the operation fails.
140
- */
141
- readLargeFile(path: string, chunkSize?: number): Promise<string>;
142
- /**
143
- * Writes a large file in chunks to handle size limitations of the underlying API.
144
- * It automatically splits the write operation into multiple requests of chunkSize bytes each.
145
- *
146
- * @param path - Path to the file to write.
147
- * @param content - Content to write to the file.
148
- * @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
149
- * @returns True if the operation was successful
150
- * @throws APIError if the operation fails.
151
- */
152
- writeLargeFile(path: string, content: string, chunkSize?: number): Promise<boolean>;
153
- }
154
-
155
- /**
156
- * Represents the result of a command execution
157
- */
158
- interface CommandResult {
159
- output: string;
160
- exitCode?: number;
161
- durationMs?: number;
162
- }
163
- /**
164
- * Represents the result of code execution
165
- */
166
- interface CodeExecutionResult {
167
- output: string;
168
- durationMs?: number;
169
- memoryKb?: number;
170
- }
171
- /**
172
- * Handles command execution operations in the AgentBay cloud environment.
173
5
  */
174
- declare class Command {
175
- private session;
176
- private client;
177
- private baseUrl;
178
- /**
179
- * Initialize a Command object.
180
- *
181
- * @param session - The Session instance that this Command belongs to.
182
- */
183
- constructor(session: Session);
184
- /**
185
- * Helper method to call MCP tools and handle common response processing
186
- *
187
- * @param toolName - Name of the MCP tool to call
188
- * @param args - Arguments to pass to the tool
189
- * @param defaultErrorMsg - Default error message if specific error details are not available
190
- * @returns A CallMcpToolResult with the response data
191
- * @throws APIError if the call fails
192
- */
193
- private callMcpTool;
194
- /**
195
- * Helper method to parse JSON string or return a simple object with output
196
- */
197
- private parseCommandResult;
198
- /**
199
- * Execute a command in the cloud environment with a specified timeout.
200
- *
201
- * @param command - The command to execute.
202
- * @param timeoutMs - The timeout for the command execution in milliseconds. Default is 1000ms.
203
- * @returns A string containing the command output
204
- */
205
- executeCommand(command: string, timeoutMs?: number): Promise<string>;
206
- /**
207
- * Helper method to parse JSON string or return a simple object with output
208
- */
209
- private parseCodeExecutionResult;
210
- /**
211
- * Execute code in the specified language with a timeout.
212
- *
213
- * @param code - The code to execute.
214
- * @param language - The programming language of the code. Must be either 'python' or 'javascript'.
215
- * @param timeoutS - The timeout for the code execution in seconds. Default is 300s.
216
- * @returns A string containing the code execution output
217
- * @throws APIError if the code execution fails or if an unsupported language is specified.
218
- */
219
- runCode(code: string, language: string, timeoutS?: number): Promise<string>;
6
+ declare class ApplyMqttTokenResponseBodyData extends $dara.Model {
7
+ accessKeyId?: string;
8
+ clientId?: string;
9
+ expiration?: string;
10
+ instanceId?: string;
11
+ regionId?: string;
12
+ securityToken?: string;
13
+ static names(): {
14
+ [key: string]: string;
15
+ };
16
+ static types(): {
17
+ [key: string]: any;
18
+ };
19
+ validate(): void;
20
+ constructor(map?: {
21
+ [key: string]: any;
22
+ });
220
23
  }
221
24
 
222
- /**
223
- * Handles Object Storage Service operations in the AgentBay cloud environment.
224
- */
225
- declare class Oss {
226
- private session;
227
- private client;
228
- private baseUrl;
229
- /**
230
- * Initialize an Oss object.
231
- *
232
- * @param session - The Session instance that this Oss belongs to.
233
- */
234
- constructor(session: Session);
235
- /**
236
- * Helper method to call MCP tools and handle common response processing
237
- *
238
- * @param toolName - Name of the MCP tool to call
239
- * @param args - Arguments to pass to the tool
240
- * @param defaultErrorMsg - Default error message if specific error details are not available
241
- * @returns A CallMcpToolResult with the response data
242
- * @throws APIError if the call fails
243
- */
244
- private callMcpTool;
245
- /**
246
- * Initialize OSS environment variables with the specified credentials.
247
- *
248
- * @param accessKeyId - The Access Key ID for OSS authentication.
249
- * @param accessKeySecret - The Access Key Secret for OSS authentication.
250
- * @param securityToken - The security token for OSS authentication.
251
- * @param endpoint - The OSS service endpoint. If not specified, the default is used.
252
- * @param region - The OSS region. If not specified, the default is used.
253
- * @returns The extracted text content from the API response
254
- */
255
- envInit(accessKeyId: string, accessKeySecret: string, securityToken: string, endpoint?: string, region?: string): Promise<string>;
256
- /**
257
- * Create an OSS client with the provided credentials.
258
- *
259
- * @param accessKeyId - The Access Key ID for OSS authentication.
260
- * @param accessKeySecret - The Access Key Secret for OSS authentication.
261
- * @param endpoint - The OSS service endpoint. If not specified, the default is used.
262
- * @param region - The OSS region. If not specified, the default is used.
263
- * @returns The extracted text content from the API response
264
- */
265
- createClient(accessKeyId: string, accessKeySecret: string, endpoint?: string, region?: string): Promise<string>;
266
- /**
267
- * Upload a local file or directory to OSS.
268
- *
269
- * @param bucket - OSS bucket name.
270
- * @param object - Object key in OSS.
271
- * @param path - Local file or directory path to upload.
272
- * @returns The extracted text content from the API response
273
- */
274
- upload(bucket: string, object: string, path: string): Promise<string>;
275
- /**
276
- * Upload a local file or directory to OSS using a pre-signed URL.
277
- *
278
- * @param url - Pre-signed URL for anonymous upload.
279
- * @param path - Local file or directory path to upload.
280
- * @returns The extracted text content from the API response
281
- */
282
- uploadAnonymous(url: string, path: string): Promise<string>;
283
- /**
284
- * Download an object from OSS to a local file or directory.
285
- *
286
- * @param bucket - OSS bucket name.
287
- * @param object - Object key in OSS.
288
- * @param path - Local file or directory path to save the downloaded content.
289
- * @returns The extracted text content from the API response
290
- */
291
- download(bucket: string, object: string, path: string): Promise<string>;
292
- /**
293
- * Download an object from OSS using a pre-signed URL.
294
- *
295
- * @param url - Pre-signed URL for anonymous download.
296
- * @param path - Local file or directory path to save the downloaded content.
297
- * @returns The extracted text content from the API response
298
- */
299
- downloadAnonymous(url: string, path: string): Promise<string>;
25
+ declare class CreateMcpSessionRequestPersistenceDataList extends $dara.Model {
26
+ contextId?: string;
27
+ path?: string;
28
+ policy?: string;
29
+ static names(): {
30
+ [key: string]: string;
31
+ };
32
+ static types(): {
33
+ [key: string]: any;
34
+ };
35
+ validate(): void;
36
+ constructor(map?: {
37
+ [key: string]: any;
38
+ });
300
39
  }
301
40
 
302
41
  declare class CreateMcpSessionResponseBodyData extends $dara.Model {
@@ -337,6 +76,20 @@ declare class GetContextResponseBodyData extends $dara.Model {
337
76
  });
338
77
  }
339
78
 
79
+ declare class GetContextInfoResponseBodyData extends $dara.Model {
80
+ contextStatus?: string;
81
+ static names(): {
82
+ [key: string]: string;
83
+ };
84
+ static types(): {
85
+ [key: string]: any;
86
+ };
87
+ validate(): void;
88
+ constructor(map?: {
89
+ [key: string]: any;
90
+ });
91
+ }
92
+
340
93
  declare class GetLabelResponseBodyData extends $dara.Model {
341
94
  labels?: string;
342
95
  static names(): {
@@ -351,12 +104,27 @@ declare class GetLabelResponseBodyData extends $dara.Model {
351
104
  });
352
105
  }
353
106
 
107
+ declare class GetLinkResponseBodyData extends $dara.Model {
108
+ url?: string;
109
+ static names(): {
110
+ [key: string]: string;
111
+ };
112
+ static types(): {
113
+ [key: string]: any;
114
+ };
115
+ validate(): void;
116
+ constructor(map?: {
117
+ [key: string]: any;
118
+ });
119
+ }
120
+
354
121
  declare class GetMcpResourceResponseBodyDataDesktopInfo extends $dara.Model {
355
122
  appId?: string;
356
123
  authCode?: string;
357
124
  connectionProperties?: string;
358
125
  resourceId?: string;
359
126
  resourceType?: string;
127
+ ticket?: string;
360
128
  static names(): {
361
129
  [key: string]: string;
362
130
  };
@@ -418,6 +186,58 @@ declare class ListSessionResponseBodyData extends $dara.Model {
418
186
  });
419
187
  }
420
188
 
189
+ declare class ApplyMqttTokenRequest extends $dara.Model {
190
+ desktopId?: string;
191
+ sessionToken?: string;
192
+ static names(): {
193
+ [key: string]: string;
194
+ };
195
+ static types(): {
196
+ [key: string]: any;
197
+ };
198
+ validate(): void;
199
+ constructor(map?: {
200
+ [key: string]: any;
201
+ });
202
+ }
203
+
204
+ declare class ApplyMqttTokenResponseBody extends $dara.Model {
205
+ code?: string;
206
+ data?: ApplyMqttTokenResponseBodyData;
207
+ httpStatusCode?: number;
208
+ message?: string;
209
+ requestId?: string;
210
+ success?: boolean;
211
+ static names(): {
212
+ [key: string]: string;
213
+ };
214
+ static types(): {
215
+ [key: string]: any;
216
+ };
217
+ validate(): void;
218
+ constructor(map?: {
219
+ [key: string]: any;
220
+ });
221
+ }
222
+
223
+ declare class ApplyMqttTokenResponse extends $dara.Model {
224
+ headers?: {
225
+ [key: string]: string;
226
+ };
227
+ statusCode?: number;
228
+ body?: ApplyMqttTokenResponseBody;
229
+ static names(): {
230
+ [key: string]: string;
231
+ };
232
+ static types(): {
233
+ [key: string]: any;
234
+ };
235
+ validate(): void;
236
+ constructor(map?: {
237
+ [key: string]: any;
238
+ });
239
+ }
240
+
421
241
  declare class CallMcpToolRequest extends $dara.Model {
422
242
  args?: string;
423
243
  authorization?: string;
@@ -482,6 +302,27 @@ declare class CreateMcpSessionRequest extends $dara.Model {
482
302
  externalUserId?: string;
483
303
  imageId?: string;
484
304
  labels?: string;
305
+ persistenceDataList?: CreateMcpSessionRequestPersistenceDataList[];
306
+ sessionId?: string;
307
+ static names(): {
308
+ [key: string]: string;
309
+ };
310
+ static types(): {
311
+ [key: string]: any;
312
+ };
313
+ validate(): void;
314
+ constructor(map?: {
315
+ [key: string]: any;
316
+ });
317
+ }
318
+
319
+ declare class CreateMcpSessionShrinkRequest extends $dara.Model {
320
+ authorization?: string;
321
+ contextId?: string;
322
+ externalUserId?: string;
323
+ imageId?: string;
324
+ labels?: string;
325
+ persistenceDataListShrink?: string;
485
326
  sessionId?: string;
486
327
  static names(): {
487
328
  [key: string]: string;
@@ -636,6 +477,61 @@ declare class GetContextResponse extends $dara.Model {
636
477
  });
637
478
  }
638
479
 
480
+ declare class GetContextInfoRequest extends $dara.Model {
481
+ authorization?: string;
482
+ contextId?: string;
483
+ path?: string;
484
+ sessionId?: string;
485
+ taskType?: string;
486
+ static names(): {
487
+ [key: string]: string;
488
+ };
489
+ static types(): {
490
+ [key: string]: any;
491
+ };
492
+ validate(): void;
493
+ constructor(map?: {
494
+ [key: string]: any;
495
+ });
496
+ }
497
+
498
+ declare class GetContextInfoResponseBody extends $dara.Model {
499
+ code?: string;
500
+ data?: GetContextInfoResponseBodyData;
501
+ httpStatusCode?: number;
502
+ message?: string;
503
+ requestId?: string;
504
+ success?: boolean;
505
+ static names(): {
506
+ [key: string]: string;
507
+ };
508
+ static types(): {
509
+ [key: string]: any;
510
+ };
511
+ validate(): void;
512
+ constructor(map?: {
513
+ [key: string]: any;
514
+ });
515
+ }
516
+
517
+ declare class GetContextInfoResponse extends $dara.Model {
518
+ headers?: {
519
+ [key: string]: string;
520
+ };
521
+ statusCode?: number;
522
+ body?: GetContextInfoResponseBody;
523
+ static names(): {
524
+ [key: string]: string;
525
+ };
526
+ static types(): {
527
+ [key: string]: any;
528
+ };
529
+ validate(): void;
530
+ constructor(map?: {
531
+ [key: string]: any;
532
+ });
533
+ }
534
+
639
535
  declare class GetLabelRequest extends $dara.Model {
640
536
  authorization?: string;
641
537
  maxResults?: number;
@@ -695,6 +591,8 @@ declare class GetLabelResponse extends $dara.Model {
695
591
 
696
592
  declare class GetLinkRequest extends $dara.Model {
697
593
  authorization?: string;
594
+ port?: number;
595
+ protocolType?: string;
698
596
  sessionId?: string;
699
597
  static names(): {
700
598
  [key: string]: string;
@@ -710,7 +608,59 @@ declare class GetLinkRequest extends $dara.Model {
710
608
 
711
609
  declare class GetLinkResponseBody extends $dara.Model {
712
610
  code?: string;
713
- data?: string;
611
+ data?: GetLinkResponseBodyData;
612
+ httpStatusCode?: number;
613
+ message?: string;
614
+ requestId?: string;
615
+ success?: boolean;
616
+ static names(): {
617
+ [key: string]: string;
618
+ };
619
+ static types(): {
620
+ [key: string]: any;
621
+ };
622
+ validate(): void;
623
+ constructor(map?: {
624
+ [key: string]: any;
625
+ });
626
+ }
627
+
628
+ declare class GetLinkResponse extends $dara.Model {
629
+ headers?: {
630
+ [key: string]: string;
631
+ };
632
+ statusCode?: number;
633
+ body?: GetLinkResponseBody;
634
+ static names(): {
635
+ [key: string]: string;
636
+ };
637
+ static types(): {
638
+ [key: string]: any;
639
+ };
640
+ validate(): void;
641
+ constructor(map?: {
642
+ [key: string]: any;
643
+ });
644
+ }
645
+
646
+ declare class GetMcpResourceRequest extends $dara.Model {
647
+ authorization?: string;
648
+ sessionId?: string;
649
+ static names(): {
650
+ [key: string]: string;
651
+ };
652
+ static types(): {
653
+ [key: string]: any;
654
+ };
655
+ validate(): void;
656
+ constructor(map?: {
657
+ [key: string]: any;
658
+ });
659
+ }
660
+
661
+ declare class GetMcpResourceResponseBody extends $dara.Model {
662
+ code?: string;
663
+ data?: GetMcpResourceResponseBodyData;
714
664
  httpStatusCode?: number;
715
665
  message?: string;
716
666
  requestId?: string;
@@ -727,12 +677,68 @@ declare class GetLinkResponseBody extends $dara.Model {
727
677
  });
728
678
  }
729
679
 
730
- declare class GetLinkResponse extends $dara.Model {
680
+ declare class GetMcpResourceResponse extends $dara.Model {
681
+ headers?: {
682
+ [key: string]: string;
683
+ };
684
+ statusCode?: number;
685
+ body?: GetMcpResourceResponseBody;
686
+ static names(): {
687
+ [key: string]: string;
688
+ };
689
+ static types(): {
690
+ [key: string]: any;
691
+ };
692
+ validate(): void;
693
+ constructor(map?: {
694
+ [key: string]: any;
695
+ });
696
+ }
697
+
698
+ declare class ListContextsRequest extends $dara.Model {
699
+ authorization?: string;
700
+ maxResults?: number;
701
+ nextToken?: string;
702
+ static names(): {
703
+ [key: string]: string;
704
+ };
705
+ static types(): {
706
+ [key: string]: any;
707
+ };
708
+ validate(): void;
709
+ constructor(map?: {
710
+ [key: string]: any;
711
+ });
712
+ }
713
+
714
+ declare class ListContextsResponseBody extends $dara.Model {
715
+ code?: string;
716
+ data?: ListContextsResponseBodyData[];
717
+ httpStatusCode?: number;
718
+ maxResults?: number;
719
+ message?: string;
720
+ nextToken?: string;
721
+ requestId?: string;
722
+ success?: boolean;
723
+ totalCount?: number;
724
+ static names(): {
725
+ [key: string]: string;
726
+ };
727
+ static types(): {
728
+ [key: string]: any;
729
+ };
730
+ validate(): void;
731
+ constructor(map?: {
732
+ [key: string]: any;
733
+ });
734
+ }
735
+
736
+ declare class ListContextsResponse extends $dara.Model {
731
737
  headers?: {
732
738
  [key: string]: string;
733
739
  };
734
740
  statusCode?: number;
735
- body?: GetLinkResponseBody;
741
+ body?: ListContextsResponseBody;
736
742
  static names(): {
737
743
  [key: string]: string;
738
744
  };
@@ -745,9 +751,9 @@ declare class GetLinkResponse extends $dara.Model {
745
751
  });
746
752
  }
747
753
 
748
- declare class GetMcpResourceRequest extends $dara.Model {
754
+ declare class ListMcpToolsRequest extends $dara.Model {
749
755
  authorization?: string;
750
- sessionId?: string;
756
+ imageId?: string;
751
757
  static names(): {
752
758
  [key: string]: string;
753
759
  };
@@ -760,9 +766,9 @@ declare class GetMcpResourceRequest extends $dara.Model {
760
766
  });
761
767
  }
762
768
 
763
- declare class GetMcpResourceResponseBody extends $dara.Model {
769
+ declare class ListMcpToolsResponseBody extends $dara.Model {
764
770
  code?: string;
765
- data?: GetMcpResourceResponseBodyData;
771
+ data?: string;
766
772
  httpStatusCode?: number;
767
773
  message?: string;
768
774
  requestId?: string;
@@ -779,12 +785,12 @@ declare class GetMcpResourceResponseBody extends $dara.Model {
779
785
  });
780
786
  }
781
787
 
782
- declare class GetMcpResourceResponse extends $dara.Model {
788
+ declare class ListMcpToolsResponse extends $dara.Model {
783
789
  headers?: {
784
790
  [key: string]: string;
785
791
  };
786
792
  statusCode?: number;
787
- body?: GetMcpResourceResponseBody;
793
+ body?: ListMcpToolsResponseBody;
788
794
  static names(): {
789
795
  [key: string]: string;
790
796
  };
@@ -797,8 +803,9 @@ declare class GetMcpResourceResponse extends $dara.Model {
797
803
  });
798
804
  }
799
805
 
800
- declare class ListContextsRequest extends $dara.Model {
806
+ declare class ListSessionRequest extends $dara.Model {
801
807
  authorization?: string;
808
+ labels?: string;
802
809
  maxResults?: number;
803
810
  nextToken?: string;
804
811
  static names(): {
@@ -813,9 +820,9 @@ declare class ListContextsRequest extends $dara.Model {
813
820
  });
814
821
  }
815
822
 
816
- declare class ListContextsResponseBody extends $dara.Model {
823
+ declare class ListSessionResponseBody extends $dara.Model {
817
824
  code?: string;
818
- data?: ListContextsResponseBodyData[];
825
+ data?: ListSessionResponseBodyData[];
819
826
  httpStatusCode?: number;
820
827
  maxResults?: number;
821
828
  message?: string;
@@ -835,12 +842,12 @@ declare class ListContextsResponseBody extends $dara.Model {
835
842
  });
836
843
  }
837
844
 
838
- declare class ListContextsResponse extends $dara.Model {
845
+ declare class ListSessionResponse extends $dara.Model {
839
846
  headers?: {
840
847
  [key: string]: string;
841
848
  };
842
849
  statusCode?: number;
843
- body?: ListContextsResponseBody;
850
+ body?: ListSessionResponseBody;
844
851
  static names(): {
845
852
  [key: string]: string;
846
853
  };
@@ -853,11 +860,10 @@ declare class ListContextsResponse extends $dara.Model {
853
860
  });
854
861
  }
855
862
 
856
- declare class ListSessionRequest extends $dara.Model {
863
+ declare class ModifyContextRequest extends $dara.Model {
857
864
  authorization?: string;
858
- labels?: string;
859
- maxResults?: number;
860
- nextToken?: string;
865
+ id?: string;
866
+ name?: string;
861
867
  static names(): {
862
868
  [key: string]: string;
863
869
  };
@@ -870,16 +876,12 @@ declare class ListSessionRequest extends $dara.Model {
870
876
  });
871
877
  }
872
878
 
873
- declare class ListSessionResponseBody extends $dara.Model {
879
+ declare class ModifyContextResponseBody extends $dara.Model {
874
880
  code?: string;
875
- data?: ListSessionResponseBodyData[];
876
881
  httpStatusCode?: number;
877
- maxResults?: number;
878
882
  message?: string;
879
- nextToken?: string;
880
883
  requestId?: string;
881
884
  success?: boolean;
882
- totalCount?: number;
883
885
  static names(): {
884
886
  [key: string]: string;
885
887
  };
@@ -892,12 +894,12 @@ declare class ListSessionResponseBody extends $dara.Model {
892
894
  });
893
895
  }
894
896
 
895
- declare class ListSessionResponse extends $dara.Model {
897
+ declare class ModifyContextResponse extends $dara.Model {
896
898
  headers?: {
897
899
  [key: string]: string;
898
900
  };
899
901
  statusCode?: number;
900
- body?: ListSessionResponseBody;
902
+ body?: ModifyContextResponseBody;
901
903
  static names(): {
902
904
  [key: string]: string;
903
905
  };
@@ -910,10 +912,9 @@ declare class ListSessionResponse extends $dara.Model {
910
912
  });
911
913
  }
912
914
 
913
- declare class ModifyContextRequest extends $dara.Model {
915
+ declare class ReleaseMcpSessionRequest extends $dara.Model {
914
916
  authorization?: string;
915
- id?: string;
916
- name?: string;
917
+ sessionId?: string;
917
918
  static names(): {
918
919
  [key: string]: string;
919
920
  };
@@ -926,7 +927,7 @@ declare class ModifyContextRequest extends $dara.Model {
926
927
  });
927
928
  }
928
929
 
929
- declare class ModifyContextResponseBody extends $dara.Model {
930
+ declare class ReleaseMcpSessionResponseBody extends $dara.Model {
930
931
  code?: string;
931
932
  httpStatusCode?: number;
932
933
  message?: string;
@@ -944,12 +945,12 @@ declare class ModifyContextResponseBody extends $dara.Model {
944
945
  });
945
946
  }
946
947
 
947
- declare class ModifyContextResponse extends $dara.Model {
948
+ declare class ReleaseMcpSessionResponse extends $dara.Model {
948
949
  headers?: {
949
950
  [key: string]: string;
950
951
  };
951
952
  statusCode?: number;
952
- body?: ModifyContextResponseBody;
953
+ body?: ReleaseMcpSessionResponseBody;
953
954
  static names(): {
954
955
  [key: string]: string;
955
956
  };
@@ -962,8 +963,9 @@ declare class ModifyContextResponse extends $dara.Model {
962
963
  });
963
964
  }
964
965
 
965
- declare class ReleaseMcpSessionRequest extends $dara.Model {
966
+ declare class SetLabelRequest extends $dara.Model {
966
967
  authorization?: string;
968
+ labels?: string;
967
969
  sessionId?: string;
968
970
  static names(): {
969
971
  [key: string]: string;
@@ -977,7 +979,7 @@ declare class ReleaseMcpSessionRequest extends $dara.Model {
977
979
  });
978
980
  }
979
981
 
980
- declare class ReleaseMcpSessionResponseBody extends $dara.Model {
982
+ declare class SetLabelResponseBody extends $dara.Model {
981
983
  code?: string;
982
984
  httpStatusCode?: number;
983
985
  message?: string;
@@ -995,12 +997,12 @@ declare class ReleaseMcpSessionResponseBody extends $dara.Model {
995
997
  });
996
998
  }
997
999
 
998
- declare class ReleaseMcpSessionResponse extends $dara.Model {
1000
+ declare class SetLabelResponse extends $dara.Model {
999
1001
  headers?: {
1000
1002
  [key: string]: string;
1001
1003
  };
1002
1004
  statusCode?: number;
1003
- body?: ReleaseMcpSessionResponseBody;
1005
+ body?: SetLabelResponseBody;
1004
1006
  static names(): {
1005
1007
  [key: string]: string;
1006
1008
  };
@@ -1013,9 +1015,11 @@ declare class ReleaseMcpSessionResponse extends $dara.Model {
1013
1015
  });
1014
1016
  }
1015
1017
 
1016
- declare class SetLabelRequest extends $dara.Model {
1018
+ declare class SyncContextRequest extends $dara.Model {
1017
1019
  authorization?: string;
1018
- labels?: string;
1020
+ contextId?: string;
1021
+ mode?: string;
1022
+ path?: string;
1019
1023
  sessionId?: string;
1020
1024
  static names(): {
1021
1025
  [key: string]: string;
@@ -1029,7 +1033,7 @@ declare class SetLabelRequest extends $dara.Model {
1029
1033
  });
1030
1034
  }
1031
1035
 
1032
- declare class SetLabelResponseBody extends $dara.Model {
1036
+ declare class SyncContextResponseBody extends $dara.Model {
1033
1037
  code?: string;
1034
1038
  httpStatusCode?: number;
1035
1039
  message?: string;
@@ -1047,12 +1051,12 @@ declare class SetLabelResponseBody extends $dara.Model {
1047
1051
  });
1048
1052
  }
1049
1053
 
1050
- declare class SetLabelResponse extends $dara.Model {
1054
+ declare class SyncContextResponse extends $dara.Model {
1051
1055
  headers?: {
1052
1056
  [key: string]: string;
1053
1057
  };
1054
1058
  statusCode?: number;
1055
- body?: SetLabelResponseBody;
1059
+ body?: SyncContextResponseBody;
1056
1060
  static names(): {
1057
1061
  [key: string]: string;
1058
1062
  };
@@ -1065,8 +1069,6 @@ declare class SetLabelResponse extends $dara.Model {
1065
1069
  });
1066
1070
  }
1067
1071
 
1068
- declare const OpenApi: typeof OpenApiDefault.default;
1069
-
1070
1072
  declare class Client extends OpenApi {
1071
1073
  constructor(config: $OpenApiUtil.Config);
1072
1074
  getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: {
@@ -1090,11 +1092,11 @@ declare class Client extends OpenApi {
1090
1092
  /**
1091
1093
  * 创建 mcp session
1092
1094
  *
1093
- * @param request - CreateMcpSessionRequest
1095
+ * @param tmpReq - CreateMcpSessionRequest
1094
1096
  * @param runtime - runtime options for this request RuntimeOptions
1095
1097
  * @returns CreateMcpSessionResponse
1096
1098
  */
1097
- createMcpSessionWithOptions(request: CreateMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<CreateMcpSessionResponse>;
1099
+ createMcpSessionWithOptions(tmpReq: CreateMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<CreateMcpSessionResponse>;
1098
1100
  /**
1099
1101
  * 创建 mcp session
1100
1102
  *
@@ -1132,6 +1134,21 @@ declare class Client extends OpenApi {
1132
1134
  * @returns GetContextResponse
1133
1135
  */
1134
1136
  getContext(request: GetContextRequest): Promise<GetContextResponse>;
1137
+ /**
1138
+ * 获取上下文信息
1139
+ *
1140
+ * @param request - GetContextInfoRequest
1141
+ * @param runtime - runtime options for this request RuntimeOptions
1142
+ * @returns GetContextInfoResponse
1143
+ */
1144
+ getContextInfoWithOptions(request: GetContextInfoRequest, runtime: $dara.RuntimeOptions): Promise<GetContextInfoResponse>;
1145
+ /**
1146
+ * 获取上下文信息
1147
+ *
1148
+ * @param request - GetContextInfoRequest
1149
+ * @returns GetContextInfoResponse
1150
+ */
1151
+ getContextInfo(request: GetContextInfoRequest): Promise<GetContextInfoResponse>;
1135
1152
  /**
1136
1153
  * 获取标签
1137
1154
  *
@@ -1184,74 +1201,557 @@ declare class Client extends OpenApi {
1184
1201
  * @param runtime - runtime options for this request RuntimeOptions
1185
1202
  * @returns ListContextsResponse
1186
1203
  */
1187
- listContextsWithOptions(request: ListContextsRequest, runtime: $dara.RuntimeOptions): Promise<ListContextsResponse>;
1204
+ listContextsWithOptions(request: ListContextsRequest, runtime: $dara.RuntimeOptions): Promise<ListContextsResponse>;
1205
+ /**
1206
+ * 获取上下文列表
1207
+ *
1208
+ * @param request - ListContextsRequest
1209
+ * @returns ListContextsResponse
1210
+ */
1211
+ listContexts(request: ListContextsRequest): Promise<ListContextsResponse>;
1212
+ /**
1213
+ * ListMcpTools
1214
+ *
1215
+ * @param request - ListMcpToolsRequest
1216
+ * @param runtime - runtime options for this request RuntimeOptions
1217
+ * @returns ListMcpToolsResponse
1218
+ */
1219
+ listMcpToolsWithOptions(request: ListMcpToolsRequest, runtime: $dara.RuntimeOptions): Promise<ListMcpToolsResponse>;
1220
+ /**
1221
+ * ListMcpTools
1222
+ *
1223
+ * @param request - ListMcpToolsRequest
1224
+ * @returns ListMcpToolsResponse
1225
+ */
1226
+ listMcpTools(request: ListMcpToolsRequest): Promise<ListMcpToolsResponse>;
1227
+ /**
1228
+ * 根据Lable查询Session列表
1229
+ *
1230
+ * @param request - ListSessionRequest
1231
+ * @param runtime - runtime options for this request RuntimeOptions
1232
+ * @returns ListSessionResponse
1233
+ */
1234
+ listSessionWithOptions(request: ListSessionRequest, runtime: $dara.RuntimeOptions): Promise<ListSessionResponse>;
1235
+ /**
1236
+ * 根据Lable查询Session列表
1237
+ *
1238
+ * @param request - ListSessionRequest
1239
+ * @returns ListSessionResponse
1240
+ */
1241
+ listSession(request: ListSessionRequest): Promise<ListSessionResponse>;
1242
+ /**
1243
+ * 修改上下文
1244
+ *
1245
+ * @param request - ModifyContextRequest
1246
+ * @param runtime - runtime options for this request RuntimeOptions
1247
+ * @returns ModifyContextResponse
1248
+ */
1249
+ modifyContextWithOptions(request: ModifyContextRequest, runtime: $dara.RuntimeOptions): Promise<ModifyContextResponse>;
1250
+ /**
1251
+ * 修改上下文
1252
+ *
1253
+ * @param request - ModifyContextRequest
1254
+ * @returns ModifyContextResponse
1255
+ */
1256
+ modifyContext(request: ModifyContextRequest): Promise<ModifyContextResponse>;
1257
+ /**
1258
+ * 释放 mcp session
1259
+ *
1260
+ * @param request - ReleaseMcpSessionRequest
1261
+ * @param runtime - runtime options for this request RuntimeOptions
1262
+ * @returns ReleaseMcpSessionResponse
1263
+ */
1264
+ releaseMcpSessionWithOptions(request: ReleaseMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<ReleaseMcpSessionResponse>;
1265
+ /**
1266
+ * 释放 mcp session
1267
+ *
1268
+ * @param request - ReleaseMcpSessionRequest
1269
+ * @returns ReleaseMcpSessionResponse
1270
+ */
1271
+ releaseMcpSession(request: ReleaseMcpSessionRequest): Promise<ReleaseMcpSessionResponse>;
1272
+ /**
1273
+ * 设置标签
1274
+ *
1275
+ * @param request - SetLabelRequest
1276
+ * @param runtime - runtime options for this request RuntimeOptions
1277
+ * @returns SetLabelResponse
1278
+ */
1279
+ setLabelWithOptions(request: SetLabelRequest, runtime: $dara.RuntimeOptions): Promise<SetLabelResponse>;
1280
+ /**
1281
+ * 设置标签
1282
+ *
1283
+ * @param request - SetLabelRequest
1284
+ * @returns SetLabelResponse
1285
+ */
1286
+ setLabel(request: SetLabelRequest): Promise<SetLabelResponse>;
1287
+ /**
1288
+ * 同步上下文
1289
+ *
1290
+ * @param request - SyncContextRequest
1291
+ * @param runtime - runtime options for this request RuntimeOptions
1292
+ * @returns SyncContextResponse
1293
+ */
1294
+ syncContextWithOptions(request: SyncContextRequest, runtime: $dara.RuntimeOptions): Promise<SyncContextResponse>;
1295
+ /**
1296
+ * 同步上下文
1297
+ *
1298
+ * @param request - SyncContextRequest
1299
+ * @returns SyncContextResponse
1300
+ */
1301
+ syncContext(request: SyncContextRequest): Promise<SyncContextResponse>;
1302
+ }
1303
+
1304
+ interface Config {
1305
+ region_id: string;
1306
+ endpoint: string;
1307
+ timeout_ms: number;
1308
+ }
1309
+
1310
+ /**
1311
+ * Base interface for API responses
1312
+ */
1313
+ interface ApiResponse {
1314
+ /** Optional request identifier for tracking API calls */
1315
+ requestId?: string;
1316
+ /** Optional error message if the operation failed */
1317
+ errorMessage?: string;
1318
+ /** Optional status code if the operation failed */
1319
+ success?: boolean;
1320
+ }
1321
+ /**
1322
+ * Interface for delete operation responses
1323
+ */
1324
+ interface DeleteResult extends ApiResponse {
1325
+ /** Whether the delete operation was successful */
1326
+ success: boolean;
1327
+ /** Optional error message if the operation failed */
1328
+ errorMessage?: string;
1329
+ }
1330
+ /**
1331
+ * Interface for session creation operation responses
1332
+ * Corresponds to Python's SessionResult type
1333
+ */
1334
+ interface SessionResult extends ApiResponse {
1335
+ /** Request identifier for tracking API calls */
1336
+ requestId: string;
1337
+ /** Whether the session creation was successful */
1338
+ success: boolean;
1339
+ /** The created session object (only present if successful) */
1340
+ session?: any;
1341
+ /** Error message if the operation failed */
1342
+ errorMessage?: string;
1343
+ }
1344
+ /**
1345
+ * Interface for operation results
1346
+ * Corresponds to Python's OperationResult type
1347
+ */
1348
+ interface OperationResult extends ApiResponse {
1349
+ /** Request identifier for tracking API calls */
1350
+ requestId: string;
1351
+ /** Whether the operation was successful */
1352
+ success: boolean;
1353
+ /** Optional data payload */
1354
+ data?: any;
1355
+ /** Optional error message if the operation failed */
1356
+ errorMessage?: string;
1357
+ }
1358
+ /**
1359
+ * Interface for process list operation responses
1360
+ * Corresponds to Python's ProcessListResult type
1361
+ */
1362
+ interface ProcessListResult extends ApiResponse {
1363
+ /** Request identifier for tracking API calls */
1364
+ requestId: string;
1365
+ /** Whether the operation was successful */
1366
+ success: boolean;
1367
+ /** The list of process objects */
1368
+ data: any[];
1369
+ /** Optional error message if the operation failed */
1370
+ errorMessage?: string;
1371
+ }
1372
+ /**
1373
+ * Interface for installed app list operation responses
1374
+ * Corresponds to Python's InstalledAppListResult type
1375
+ */
1376
+ interface InstalledAppListResult extends ApiResponse {
1377
+ /** Request identifier for tracking API calls */
1378
+ requestId: string;
1379
+ /** Whether the operation was successful */
1380
+ success: boolean;
1381
+ /** The list of installed app objects */
1382
+ data: any[];
1383
+ /** Optional error message if the operation failed */
1384
+ errorMessage?: string;
1385
+ }
1386
+ /**
1387
+ * Interface for application operation responses
1388
+ * Corresponds to Python's AppOperationResult type
1389
+ */
1390
+ interface AppOperationResult extends ApiResponse {
1391
+ /** Request identifier for tracking API calls */
1392
+ requestId: string;
1393
+ /** Whether the operation was successful */
1394
+ success: boolean;
1395
+ /** Optional error message if the operation failed */
1396
+ errorMessage?: string;
1397
+ }
1398
+ /**
1399
+ * Interface for command execution operation responses
1400
+ * Corresponds to Python's CommandResult type
1401
+ */
1402
+ interface CommandResult extends ApiResponse {
1403
+ /** Request identifier for tracking API calls */
1404
+ requestId: string;
1405
+ /** Whether the command execution was successful */
1406
+ success: boolean;
1407
+ /** The command output */
1408
+ output: string;
1409
+ /** Optional error message if the operation failed */
1410
+ errorMessage?: string;
1411
+ }
1412
+ /**
1413
+ * Interface for code execution operation responses
1414
+ * Corresponds to Python's CodeExecutionResult type
1415
+ */
1416
+ interface CodeExecutionResult extends ApiResponse {
1417
+ /** Request identifier for tracking API calls */
1418
+ requestId: string;
1419
+ /** Whether the code execution was successful */
1420
+ success: boolean;
1421
+ /** The execution result */
1422
+ result: string;
1423
+ /** Optional error message if the operation failed */
1424
+ errorMessage?: string;
1425
+ }
1426
+ /**
1427
+ * Interface for boolean operation responses
1428
+ * Corresponds to Python's BoolResult type
1429
+ */
1430
+ interface BoolResult extends ApiResponse {
1431
+ /** Request identifier for tracking API calls */
1432
+ requestId: string;
1433
+ /** Whether the operation was successful */
1434
+ success: boolean;
1435
+ /** Boolean data result */
1436
+ data?: boolean;
1437
+ /** Optional error message if the operation failed */
1438
+ errorMessage?: string;
1439
+ }
1440
+ /**
1441
+ * Interface for file info operation responses
1442
+ * Corresponds to Python's FileInfoResult type
1443
+ */
1444
+ interface FileInfoResult extends ApiResponse {
1445
+ /** Request identifier for tracking API calls */
1446
+ requestId: string;
1447
+ /** Whether the operation was successful */
1448
+ success: boolean;
1449
+ /** File information object */
1450
+ fileInfo?: Record<string, any>;
1451
+ /** Optional error message if the operation failed */
1452
+ errorMessage?: string;
1453
+ }
1454
+ /**
1455
+ * Interface for directory list operation responses
1456
+ * Corresponds to Python's DirectoryListResult type
1457
+ */
1458
+ interface DirectoryListResult extends ApiResponse {
1459
+ /** Request identifier for tracking API calls */
1460
+ requestId: string;
1461
+ /** Whether the operation was successful */
1462
+ success: boolean;
1463
+ /** Directory entries */
1464
+ entries: Record<string, any>[];
1465
+ /** Optional error message if the operation failed */
1466
+ errorMessage?: string;
1467
+ }
1468
+ /**
1469
+ * Interface for file content operation responses
1470
+ * Corresponds to Python's FileContentResult type
1471
+ */
1472
+ interface FileContentResult extends ApiResponse {
1473
+ /** Request identifier for tracking API calls */
1474
+ requestId: string;
1475
+ /** Whether the operation was successful */
1476
+ success: boolean;
1477
+ /** File content */
1478
+ content: string;
1479
+ /** Optional error message if the operation failed */
1480
+ errorMessage?: string;
1481
+ }
1482
+ /**
1483
+ * Interface for multiple file content operation responses
1484
+ * Corresponds to Python's MultipleFileContentResult type
1485
+ */
1486
+ interface MultipleFileContentResult extends ApiResponse {
1487
+ /** Request identifier for tracking API calls */
1488
+ requestId: string;
1489
+ /** Whether the operation was successful */
1490
+ success: boolean;
1491
+ /** Multiple file contents */
1492
+ contents: Record<string, string>;
1493
+ /** Optional error message if the operation failed */
1494
+ errorMessage?: string;
1495
+ }
1496
+ /**
1497
+ * Interface for file search operation responses
1498
+ * Corresponds to Python's FileSearchResult type
1499
+ */
1500
+ interface FileSearchResult extends ApiResponse {
1501
+ /** Request identifier for tracking API calls */
1502
+ requestId: string;
1503
+ /** Whether the operation was successful */
1504
+ success: boolean;
1505
+ /** Matching file paths */
1506
+ matches: string[];
1507
+ /** Optional error message if the operation failed */
1508
+ errorMessage?: string;
1509
+ }
1510
+ /**
1511
+ * Interface for OSS client creation operation responses
1512
+ * Corresponds to Python's OSSClientResult type
1513
+ */
1514
+ interface OSSClientResult extends ApiResponse {
1515
+ /** Request identifier for tracking API calls */
1516
+ requestId: string;
1517
+ /** Whether the operation was successful */
1518
+ success: boolean;
1519
+ /** OSS client configuration */
1520
+ clientConfig: Record<string, any>;
1521
+ /** Optional error message if the operation failed */
1522
+ errorMessage?: string;
1523
+ }
1524
+ /**
1525
+ * Interface for OSS upload operation responses
1526
+ * Corresponds to Python's OSSUploadResult type
1527
+ */
1528
+ interface OSSUploadResult extends ApiResponse {
1529
+ /** Request identifier for tracking API calls */
1530
+ requestId: string;
1531
+ /** Whether the operation was successful */
1532
+ success: boolean;
1533
+ /** Result of the upload operation */
1534
+ content: string;
1535
+ /** Optional error message if the operation failed */
1536
+ errorMessage?: string;
1537
+ }
1538
+ /**
1539
+ * Interface for OSS download operation responses
1540
+ * Corresponds to Python's OSSDownloadResult type
1541
+ */
1542
+ interface OSSDownloadResult extends ApiResponse {
1543
+ /** Request identifier for tracking API calls */
1544
+ requestId: string;
1545
+ /** Whether the operation was successful */
1546
+ success: boolean;
1547
+ /** Result of the download operation */
1548
+ content: string;
1549
+ /** Optional error message if the operation failed */
1550
+ errorMessage?: string;
1551
+ }
1552
+ /**
1553
+ * Interface for UI element list operation responses
1554
+ * Corresponds to Python's UIElementListResult type
1555
+ */
1556
+ interface UIElementListResult extends ApiResponse {
1557
+ /** Request identifier for tracking API calls */
1558
+ requestId: string;
1559
+ /** Whether the operation was successful */
1560
+ success: boolean;
1561
+ /** UI elements */
1562
+ elements: Record<string, any>[];
1563
+ /** Optional error message if the operation failed */
1564
+ errorMessage?: string;
1565
+ }
1566
+ /**
1567
+ * Interface for window list operation responses
1568
+ * Corresponds to Python's WindowListResult type
1569
+ */
1570
+ interface WindowListResult extends ApiResponse {
1571
+ /** Request identifier for tracking API calls */
1572
+ requestId: string;
1573
+ /** Whether the operation was successful */
1574
+ success: boolean;
1575
+ /** List of windows */
1576
+ windows: any[];
1577
+ /** Optional error message if the operation failed */
1578
+ errorMessage?: string;
1579
+ }
1580
+ /**
1581
+ * Interface for window info operation responses
1582
+ * Corresponds to Python's WindowInfoResult type
1583
+ */
1584
+ interface WindowInfoResult extends ApiResponse {
1585
+ /** Request identifier for tracking API calls */
1586
+ requestId: string;
1587
+ /** Whether the operation was successful */
1588
+ success: boolean;
1589
+ /** Window object */
1590
+ window?: any;
1591
+ /** Optional error message if the operation failed */
1592
+ errorMessage?: string;
1593
+ }
1594
+ /**
1595
+ * Interface for context operation responses
1596
+ * Corresponds to Python's ContextResult type
1597
+ */
1598
+ interface ContextResult extends ApiResponse {
1599
+ /** Request identifier for tracking API calls */
1600
+ requestId: string;
1601
+ /** Whether the operation was successful */
1602
+ success: boolean;
1603
+ /** The context ID */
1604
+ contextId: string;
1605
+ /** The context object (only present if successful) */
1606
+ context?: any;
1607
+ /** Optional error message if the operation failed */
1608
+ errorMessage?: string;
1609
+ }
1610
+ /**
1611
+ * Interface for context list operation responses
1612
+ * Corresponds to Python's ContextListResult type
1613
+ */
1614
+ interface ContextListResult extends ApiResponse {
1615
+ /** Request identifier for tracking API calls */
1616
+ requestId: string;
1617
+ /** Whether the operation was successful */
1618
+ success: boolean;
1619
+ /** List of contexts */
1620
+ contexts: any[];
1621
+ /** Optional error message if the operation failed */
1622
+ errorMessage?: string;
1623
+ }
1624
+
1625
+ /**
1626
+ * Represents a persistent storage context in the AgentBay cloud environment.
1627
+ */
1628
+ declare class Context {
1629
+ /**
1630
+ * The unique identifier of the context.
1631
+ */
1632
+ id: string;
1633
+ /**
1634
+ * The name of the context.
1635
+ */
1636
+ name: string;
1637
+ /**
1638
+ * The current state of the context (e.g., "available", "in-use").
1639
+ */
1640
+ state: string;
1641
+ /**
1642
+ * Date and time when the Context was created.
1643
+ */
1644
+ createdAt?: string;
1188
1645
  /**
1189
- * 获取上下文列表
1190
- *
1191
- * @param request - ListContextsRequest
1192
- * @returns ListContextsResponse
1646
+ * Date and time when the Context was last used.
1193
1647
  */
1194
- listContexts(request: ListContextsRequest): Promise<ListContextsResponse>;
1648
+ lastUsedAt?: string;
1195
1649
  /**
1196
- * 根据Lable查询Session列表
1197
- *
1198
- * @param request - ListSessionRequest
1199
- * @param runtime - runtime options for this request RuntimeOptions
1200
- * @returns ListSessionResponse
1650
+ * The operating system type this context is bound to.
1201
1651
  */
1202
- listSessionWithOptions(request: ListSessionRequest, runtime: $dara.RuntimeOptions): Promise<ListSessionResponse>;
1652
+ osType?: string;
1203
1653
  /**
1204
- * 根据Lable查询Session列表
1654
+ * Initialize a Context object.
1205
1655
  *
1206
- * @param request - ListSessionRequest
1207
- * @returns ListSessionResponse
1656
+ * @param id - The unique identifier of the context.
1657
+ * @param name - The name of the context.
1658
+ * @param state - The current state of the context.
1659
+ * @param createdAt - Date and time when the Context was created.
1660
+ * @param lastUsedAt - Date and time when the Context was last used.
1661
+ * @param osType - The operating system type this context is bound to.
1208
1662
  */
1209
- listSession(request: ListSessionRequest): Promise<ListSessionResponse>;
1663
+ constructor(id: string, name: string, state?: string, createdAt?: string, lastUsedAt?: string, osType?: string);
1664
+ }
1665
+ /**
1666
+ * Provides methods to manage persistent contexts in the AgentBay cloud environment.
1667
+ */
1668
+ declare class ContextService {
1669
+ private agentBay;
1210
1670
  /**
1211
- * 修改上下文
1671
+ * Initialize the ContextService.
1212
1672
  *
1213
- * @param request - ModifyContextRequest
1214
- * @param runtime - runtime options for this request RuntimeOptions
1215
- * @returns ModifyContextResponse
1673
+ * @param agentBay - The AgentBay instance.
1216
1674
  */
1217
- modifyContextWithOptions(request: ModifyContextRequest, runtime: $dara.RuntimeOptions): Promise<ModifyContextResponse>;
1675
+ constructor(agentBay: AgentBay);
1218
1676
  /**
1219
- * 修改上下文
1677
+ * Lists all available contexts.
1678
+ * Corresponds to Python's list() method
1220
1679
  *
1221
- * @param request - ModifyContextRequest
1222
- * @returns ModifyContextResponse
1680
+ * @returns ContextListResult with contexts list and requestId
1223
1681
  */
1224
- modifyContext(request: ModifyContextRequest): Promise<ModifyContextResponse>;
1682
+ list(): Promise<ContextListResult>;
1225
1683
  /**
1226
- * 释放 mcp session
1684
+ * Gets a context by name. Optionally creates it if it doesn't exist.
1685
+ * Corresponds to Python's get() method
1227
1686
  *
1228
- * @param request - ReleaseMcpSessionRequest
1229
- * @param runtime - runtime options for this request RuntimeOptions
1230
- * @returns ReleaseMcpSessionResponse
1687
+ * @param name - The name of the context to get.
1688
+ * @param create - Whether to create the context if it doesn't exist.
1689
+ * @returns ContextResult with context data and requestId
1231
1690
  */
1232
- releaseMcpSessionWithOptions(request: ReleaseMcpSessionRequest, runtime: $dara.RuntimeOptions): Promise<ReleaseMcpSessionResponse>;
1691
+ get(name: string, create?: boolean): Promise<ContextResult>;
1233
1692
  /**
1234
- * 释放 mcp session
1693
+ * Creates a new context with the given name.
1694
+ * Corresponds to Python's create() method
1235
1695
  *
1236
- * @param request - ReleaseMcpSessionRequest
1237
- * @returns ReleaseMcpSessionResponse
1696
+ * @param name - The name for the new context.
1697
+ * @returns ContextResult with created context data and requestId
1238
1698
  */
1239
- releaseMcpSession(request: ReleaseMcpSessionRequest): Promise<ReleaseMcpSessionResponse>;
1699
+ create(name: string): Promise<ContextResult>;
1240
1700
  /**
1241
- * 设置标签
1701
+ * Updates the specified context.
1702
+ * Corresponds to Python's update() method
1242
1703
  *
1243
- * @param request - SetLabelRequest
1244
- * @param runtime - runtime options for this request RuntimeOptions
1245
- * @returns SetLabelResponse
1704
+ * @param context - The Context object to update.
1705
+ * @returns OperationResult with updated context data and requestId
1246
1706
  */
1247
- setLabelWithOptions(request: SetLabelRequest, runtime: $dara.RuntimeOptions): Promise<SetLabelResponse>;
1707
+ update(context: Context): Promise<OperationResult>;
1248
1708
  /**
1249
- * 设置标签
1709
+ * Deletes the specified context.
1710
+ * Corresponds to Python's delete() method
1250
1711
  *
1251
- * @param request - SetLabelRequest
1252
- * @returns SetLabelResponse
1712
+ * @param context - The Context object to delete.
1713
+ * @returns OperationResult with requestId
1253
1714
  */
1254
- setLabel(request: SetLabelRequest): Promise<SetLabelResponse>;
1715
+ delete(context: Context): Promise<OperationResult>;
1716
+ }
1717
+
1718
+ declare enum UploadStrategy {
1719
+ UploadBeforeResourceRelease = "UploadBeforeResourceRelease"
1720
+ }
1721
+ declare enum DownloadStrategy {
1722
+ DownloadAsync = "DownloadAsync"
1723
+ }
1724
+ interface UploadPolicy {
1725
+ autoUpload: boolean;
1726
+ uploadStrategy: UploadStrategy;
1727
+ period?: number;
1728
+ }
1729
+ interface DownloadPolicy {
1730
+ autoDownload: boolean;
1731
+ downloadStrategy: DownloadStrategy;
1732
+ }
1733
+ interface DeletePolicy {
1734
+ syncLocalFile: boolean;
1735
+ }
1736
+ interface WhiteList {
1737
+ path: string;
1738
+ excludePaths?: string[];
1739
+ }
1740
+ interface BWList {
1741
+ whiteLists?: WhiteList[];
1742
+ }
1743
+ interface SyncPolicy {
1744
+ uploadPolicy?: UploadPolicy;
1745
+ downloadPolicy?: DownloadPolicy;
1746
+ deletePolicy?: DeletePolicy;
1747
+ bwList?: BWList;
1748
+ }
1749
+ declare class ContextSync {
1750
+ contextId: string;
1751
+ path: string;
1752
+ policy?: SyncPolicy;
1753
+ constructor(contextId: string, path: string, policy?: SyncPolicy);
1754
+ withPolicy(policy: SyncPolicy): ContextSync;
1255
1755
  }
1256
1756
 
1257
1757
  /**
@@ -1302,75 +1802,170 @@ declare class Application {
1302
1802
  private parseJSON;
1303
1803
  /**
1304
1804
  * Retrieves a list of installed applications.
1805
+ * Corresponds to Python's get_installed_apps() method
1806
+ *
1305
1807
  * @param startMenu Whether to include applications from the start menu. Defaults to true.
1306
1808
  * @param desktop Whether to include applications from the desktop. Defaults to true.
1307
1809
  * @param ignoreSystemApps Whether to ignore system applications. Defaults to true.
1308
- * @returns Array of InstalledApp objects
1810
+ * @returns InstalledAppListResult with installed apps and requestId
1309
1811
  * @throws Error if the operation fails.
1310
1812
  */
1311
- getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledApp[]>;
1813
+ getInstalledApps(startMenu?: boolean, desktop?: boolean, ignoreSystemApps?: boolean): Promise<InstalledAppListResult>;
1312
1814
  /**
1313
1815
  * Starts an application with the given command and optional working directory.
1816
+ * Corresponds to Python's start_app() method
1817
+ *
1314
1818
  * @param startCmd The command to start the application.
1315
1819
  * @param workDirectory The working directory for the application. Defaults to an empty string.
1316
- * @returns Array of Process objects representing the started processes
1820
+ * @param activity Activity name to launch (e.g. ".SettingsActivity" or "com.package/.Activity"). Defaults to an empty string.
1821
+ * @returns ProcessListResult with started processes and requestId
1317
1822
  * @throws Error if the operation fails.
1318
1823
  */
1319
- startApp(startCmd: string, workDirectory?: string): Promise<Process[]>;
1824
+ startApp(startCmd: string, workDirectory?: string, activity?: string): Promise<ProcessListResult>;
1320
1825
  /**
1321
1826
  * Stops an application by process name.
1827
+ * Corresponds to Python's stop_app_by_pname() method
1828
+ *
1322
1829
  * @param pname The name of the process to stop.
1830
+ * @returns AppOperationResult with requestId
1323
1831
  * @throws Error if the operation fails.
1324
1832
  */
1325
- stopAppByPName(pname: string): Promise<void>;
1833
+ stopAppByPName(pname: string): Promise<AppOperationResult>;
1326
1834
  /**
1327
1835
  * Stops an application by process ID.
1836
+ * Corresponds to Python's stop_app_by_pid() method
1837
+ *
1328
1838
  * @param pid The ID of the process to stop.
1839
+ * @returns AppOperationResult with requestId
1329
1840
  * @throws Error if the operation fails.
1330
1841
  */
1331
- stopAppByPID(pid: number): Promise<void>;
1842
+ stopAppByPID(pid: number): Promise<AppOperationResult>;
1332
1843
  /**
1333
1844
  * Stops an application by stop command.
1845
+ * Corresponds to Python's stop_app_by_cmd() method
1846
+ *
1334
1847
  * @param stopCmd The command to stop the application.
1848
+ * @returns AppOperationResult with requestId
1335
1849
  * @throws Error if the operation fails.
1336
1850
  */
1337
- stopAppByCmd(stopCmd: string): Promise<void>;
1851
+ stopAppByCmd(stopCmd: string): Promise<AppOperationResult>;
1338
1852
  /**
1339
1853
  * Lists all currently visible applications.
1340
- * @returns Array of Process objects representing the visible processes
1854
+ * Corresponds to Python's list_visible_apps() method
1855
+ *
1856
+ * @returns ProcessListResult with visible processes and requestId
1341
1857
  * @throws Error if the operation fails.
1342
1858
  */
1343
- listVisibleApps(): Promise<Process[]>;
1859
+ listVisibleApps(): Promise<ProcessListResult>;
1860
+ }
1861
+
1862
+ /**
1863
+ * Handles command execution operations in the AgentBay cloud environment.
1864
+ */
1865
+ declare class Command {
1866
+ private session;
1867
+ private client;
1868
+ private baseUrl;
1869
+ /**
1870
+ * Initialize a Command object.
1871
+ *
1872
+ * @param session - The Session instance that this Command belongs to.
1873
+ */
1874
+ constructor(session: Session);
1875
+ /**
1876
+ * Helper method to call MCP tools and handle common response processing
1877
+ *
1878
+ * @param toolName - Name of the MCP tool to call
1879
+ * @param args - Arguments to pass to the tool
1880
+ * @param defaultErrorMsg - Default error message if specific error details are not available
1881
+ * @returns A CallMcpToolResult with the response data
1882
+ * @throws APIError if the call fails
1883
+ */
1884
+ private callMcpTool;
1885
+ /**
1886
+ * Execute a command in the cloud environment with a specified timeout.
1887
+ * Corresponds to Python's execute_command() method
1888
+ *
1889
+ * @param command - The command to execute.
1890
+ * @param timeoutMs - The timeout for the command execution in milliseconds. Default is 1000ms.
1891
+ * @returns CommandResult with command output and requestId
1892
+ */
1893
+ executeCommand(command: string, timeoutMs?: number): Promise<CommandResult>;
1894
+ /**
1895
+ * Execute code in the specified language with a timeout.
1896
+ * Corresponds to Python's run_code() method
1897
+ *
1898
+ * @param code - The code to execute.
1899
+ * @param language - The programming language of the code. Must be either 'python' or 'javascript'.
1900
+ * @param timeoutS - The timeout for the code execution in seconds. Default is 300s.
1901
+ * @returns CodeExecutionResult with code execution output and requestId
1902
+ * @throws Error if an unsupported language is specified.
1903
+ */
1904
+ runCode(code: string, language: string, timeoutS?: number): Promise<CodeExecutionResult>;
1905
+ }
1906
+
1907
+ interface ContextStatusData {
1908
+ contextId: string;
1909
+ path: string;
1910
+ errorMessage: string;
1911
+ status: string;
1912
+ startTime: number;
1913
+ finishTime: number;
1914
+ taskType: string;
1915
+ }
1916
+ interface ContextInfoResult extends ApiResponse {
1917
+ contextStatusData: ContextStatusData[];
1918
+ }
1919
+ interface ContextSyncResult extends ApiResponse {
1920
+ success: boolean;
1921
+ }
1922
+ interface SessionInterface {
1923
+ getAPIKey(): string;
1924
+ getClient(): Client;
1925
+ getSessionId(): string;
1926
+ }
1927
+ declare class ContextManager {
1928
+ private session;
1929
+ constructor(session: SessionInterface);
1930
+ info(): Promise<ContextInfoResult>;
1931
+ infoWithParams(contextId?: string, path?: string, taskType?: string): Promise<ContextInfoResult>;
1932
+ sync(): Promise<ContextSyncResult>;
1933
+ syncWithParams(contextId?: string, path?: string, mode?: string): Promise<ContextSyncResult>;
1344
1934
  }
1345
1935
 
1346
1936
  /**
1347
- * Represents a window in the system.
1937
+ * FileInfo represents information about a file or directory
1348
1938
  */
1349
- interface Window {
1350
- window_id: number;
1351
- title: string;
1352
- absolute_upper_left_x?: number;
1353
- absolute_upper_left_y?: number;
1354
- width?: number;
1355
- height?: number;
1356
- pid?: number;
1357
- pname?: string;
1358
- child_windows?: Window[];
1939
+ interface FileInfo {
1940
+ name: string;
1941
+ path: string;
1942
+ size: number;
1943
+ isDirectory: boolean;
1944
+ modTime: string;
1945
+ mode: string;
1946
+ owner?: string;
1947
+ group?: string;
1359
1948
  }
1360
1949
  /**
1361
- * Handles window management operations in the AgentBay cloud environment.
1950
+ * DirectoryEntry represents an entry in a directory listing
1362
1951
  */
1363
- declare class WindowManager {
1952
+ interface DirectoryEntry {
1953
+ name: string;
1954
+ isDirectory: boolean;
1955
+ }
1956
+ /**
1957
+ * Handles file operations in the AgentBay cloud environment.
1958
+ */
1959
+ declare class FileSystem {
1364
1960
  private session;
1961
+ private client;
1962
+ private baseUrl;
1365
1963
  /**
1366
- * Creates a new WindowManager instance.
1367
- * @param session The session object that provides access to the AgentBay API.
1964
+ * Initialize a FileSystem object.
1965
+ *
1966
+ * @param session - The Session instance that this FileSystem belongs to.
1368
1967
  */
1369
- constructor(session: {
1370
- getAPIKey(): string;
1371
- getClient(): any;
1372
- getSessionId(): string;
1373
- });
1968
+ constructor(session: Session);
1374
1969
  /**
1375
1970
  * Helper method to call MCP tools and handle common response processing
1376
1971
  *
@@ -1382,73 +1977,183 @@ declare class WindowManager {
1382
1977
  */
1383
1978
  private callMcpTool;
1384
1979
  /**
1385
- * Helper method to parse JSON string into Window objects
1386
- * @param jsonStr - JSON string to parse
1387
- * @returns Array of Window objects or single Window object
1980
+ * Creates a new directory at the specified path.
1981
+ * Corresponds to Python's create_directory() method
1982
+ *
1983
+ * @param path - Path to the directory to create.
1984
+ * @returns BoolResult with creation result and requestId
1388
1985
  */
1389
- private parseWindowsFromJSON;
1986
+ createDirectory(path: string): Promise<BoolResult>;
1390
1987
  /**
1391
- * Lists all root windows in the system.
1392
- * @returns Array of Window objects
1393
- * @throws Error if the operation fails.
1988
+ * Edits a file by replacing occurrences of oldText with newText.
1989
+ * Corresponds to Python's edit_file() method
1990
+ *
1991
+ * @param path - Path to the file to edit.
1992
+ * @param edits - Array of edit operations, each containing oldText and newText.
1993
+ * @param dryRun - Optional: If true, preview changes without applying them.
1994
+ * @returns BoolResult with edit result and requestId
1995
+ */
1996
+ editFile(path: string, edits: Array<{
1997
+ oldText: string;
1998
+ newText: string;
1999
+ }>, dryRun?: boolean): Promise<BoolResult>;
2000
+ /**
2001
+ * Gets information about a file or directory.
2002
+ * Corresponds to Python's get_file_info() method
2003
+ *
2004
+ * @param path - Path to the file or directory to inspect.
2005
+ * @returns FileInfoResult with file info and requestId
1394
2006
  */
1395
- listRootWindows(): Promise<Window[]>;
2007
+ getFileInfo(path: string): Promise<FileInfoResult>;
1396
2008
  /**
1397
- * Gets the currently active window.
1398
- * @returns Window object or null if no active window
1399
- * @throws Error if the operation fails.
2009
+ * Lists the contents of a directory.
2010
+ * Corresponds to Python's list_directory() method
2011
+ *
2012
+ * @param path - Path to the directory to list.
2013
+ * @returns DirectoryListResult with directory entries and requestId
1400
2014
  */
1401
- getActiveWindow(): Promise<Window | null>;
2015
+ listDirectory(path: string): Promise<DirectoryListResult>;
1402
2016
  /**
1403
- * Activates a window by ID.
1404
- * @param windowId The ID of the window to activate.
1405
- * @throws Error if the operation fails.
2017
+ * Moves a file or directory from source to destination.
2018
+ * Corresponds to Python's move_file() method
2019
+ *
2020
+ * @param source - Path to the source file or directory.
2021
+ * @param destination - Path to the destination file or directory.
2022
+ * @returns BoolResult with move result and requestId
2023
+ */
2024
+ moveFile(source: string, destination: string): Promise<BoolResult>;
2025
+ /**
2026
+ * Reads the content of a file.
2027
+ * Corresponds to Python's read_file() method
2028
+ *
2029
+ * @param path - Path to the file to read.
2030
+ * @param offset - Optional: Line offset to start reading from.
2031
+ * @param length - Optional: Number of lines to read. If 0, reads the entire file.
2032
+ * @returns FileContentResult with file content and requestId
2033
+ */
2034
+ readFile(path: string, offset?: number, length?: number): Promise<FileContentResult>;
2035
+ /**
2036
+ * Reads the content of multiple files.
2037
+ * Corresponds to Python's read_multiple_files() method
2038
+ *
2039
+ * @param paths - Array of file paths to read.
2040
+ * @returns MultipleFileContentResult with file contents and requestId
2041
+ */
2042
+ readMultipleFiles(paths: string[]): Promise<MultipleFileContentResult>;
2043
+ /**
2044
+ * Searches for files in a directory that match a pattern.
2045
+ * Corresponds to Python's search_files() method
2046
+ *
2047
+ * @param path - Path to the directory to search in.
2048
+ * @param pattern - Pattern to search for. Supports glob patterns.
2049
+ * @param excludePatterns - Optional: Array of patterns to exclude.
2050
+ * @returns FileSearchResult with search results and requestId
2051
+ */
2052
+ searchFiles(path: string, pattern: string, excludePatterns?: string[]): Promise<FileSearchResult>;
2053
+ /**
2054
+ * Writes content to a file.
2055
+ * Corresponds to Python's write_file() method
2056
+ *
2057
+ * @param path - Path to the file to write.
2058
+ * @param content - Content to write to the file.
2059
+ * @param mode - Optional: Write mode. One of "overwrite", "append", or "create_new". Default is "overwrite".
2060
+ * @returns BoolResult with write result and requestId
2061
+ */
2062
+ writeFile(path: string, content: string, mode?: string): Promise<BoolResult>;
2063
+ /**
2064
+ * Reads a large file in chunks to handle size limitations of the underlying API.
2065
+ * Corresponds to Python's read_large_file() method
2066
+ *
2067
+ * @param path - Path to the file to read.
2068
+ * @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
2069
+ * @returns FileContentResult with complete file content and requestId
2070
+ */
2071
+ readLargeFile(path: string, chunkSize?: number): Promise<FileContentResult>;
2072
+ /**
2073
+ * Writes a large file in chunks to handle size limitations of the underlying API.
2074
+ * Corresponds to Python's write_large_file() method
2075
+ *
2076
+ * @param path - Path to the file to write.
2077
+ * @param content - Content to write to the file.
2078
+ * @param chunkSize - Optional: Size of each chunk in bytes. Default is 60KB.
2079
+ * @returns BoolResult indicating success or failure with requestId
1406
2080
  */
1407
- activateWindow(windowId: number): Promise<void>;
2081
+ writeLargeFile(path: string, content: string, chunkSize?: number): Promise<BoolResult>;
2082
+ }
2083
+
2084
+ /**
2085
+ * Handles Object Storage Service operations in the AgentBay cloud environment.
2086
+ */
2087
+ declare class Oss {
2088
+ private session;
2089
+ private client;
2090
+ private baseUrl;
1408
2091
  /**
1409
- * Maximizes a window by ID.
1410
- * @param windowId The ID of the window to maximize.
1411
- * @throws Error if the operation fails.
2092
+ * Initialize an Oss object.
2093
+ *
2094
+ * @param session - The Session instance that this Oss belongs to.
1412
2095
  */
1413
- maximizeWindow(windowId: number): Promise<void>;
2096
+ constructor(session: Session);
1414
2097
  /**
1415
- * Minimizes a window by ID.
1416
- * @param windowId The ID of the window to minimize.
1417
- * @throws Error if the operation fails.
2098
+ * Helper method to call MCP tools and handle common response processing
2099
+ *
2100
+ * @param toolName - Name of the MCP tool to call
2101
+ * @param args - Arguments to pass to the tool
2102
+ * @param defaultErrorMsg - Default error message if specific error details are not available
2103
+ * @returns A CallMcpToolResult with the response data
2104
+ * @throws APIError if the call fails
1418
2105
  */
1419
- minimizeWindow(windowId: number): Promise<void>;
2106
+ private callMcpTool;
1420
2107
  /**
1421
- * Restores a window by ID.
1422
- * @param windowId The ID of the window to restore.
1423
- * @throws Error if the operation fails.
2108
+ * Initialize OSS environment variables with the specified credentials.
2109
+ * Corresponds to Python's env_init() method
2110
+ *
2111
+ * @param accessKeyId - The Access Key ID for OSS authentication.
2112
+ * @param accessKeySecret - The Access Key Secret for OSS authentication.
2113
+ * @param securityToken - The security token for OSS authentication.
2114
+ * @param endpoint - The OSS service endpoint. If not specified, the default is used.
2115
+ * @param region - The OSS region. If not specified, the default is used.
2116
+ * @returns OSSClientResult with initialization result and requestId
1424
2117
  */
1425
- restoreWindow(windowId: number): Promise<void>;
2118
+ envInit(accessKeyId: string, accessKeySecret: string, securityToken?: string, endpoint?: string, region?: string): Promise<OSSClientResult>;
1426
2119
  /**
1427
- * Closes a window by ID.
1428
- * @param windowId The ID of the window to close.
1429
- * @throws Error if the operation fails.
2120
+ * Upload a local file or directory to OSS.
2121
+ * Corresponds to Python's upload() method
2122
+ *
2123
+ * @param bucket - OSS bucket name.
2124
+ * @param object - ObjectS.
2125
+ * @param path - Local file or directory path to upload.
2126
+ * @returns OSSUploadResult with upload result and requestId
1430
2127
  */
1431
- closeWindow(windowId: number): Promise<void>;
2128
+ upload(bucket: string, object: string, path: string): Promise<OSSUploadResult>;
1432
2129
  /**
1433
- * Sets a window to fullscreen by ID.
1434
- * @param windowId The ID of the window to set to fullscreen.
1435
- * @throws Error if the operation fails.
2130
+ * Upload a local file or directory to OSS using a pre-signed URL.
2131
+ * Corresponds to Python's upload_anonymous() method
2132
+ *
2133
+ * @param url - Pre-signed URL for anonymous upload.
2134
+ * @param path - Local file or directory path to upload.
2135
+ * @returns OSSUploadResult with upload result and requestId
1436
2136
  */
1437
- fullscreenWindow(windowId: number): Promise<void>;
2137
+ uploadAnonymous(url: string, path: string): Promise<OSSUploadResult>;
1438
2138
  /**
1439
- * Resizes a window by ID.
1440
- * @param windowId The ID of the window to resize.
1441
- * @param width The new width of the window.
1442
- * @param height The new height of the window.
1443
- * @throws Error if the operation fails.
2139
+ * Download an object from OSS to a local file or directory.
2140
+ * Corresponds to Python's download() method
2141
+ *
2142
+ * @param bucket - OSS bucket name.
2143
+ * @param object - Object key in OSS.
2144
+ * @param path - Local file or directory path to save the downloaded content.
2145
+ * @returns OSSDownloadResult with download result and requestId
1444
2146
  */
1445
- resizeWindow(windowId: number, width: number, height: number): Promise<void>;
2147
+ download(bucket: string, object: string, path: string): Promise<OSSDownloadResult>;
1446
2148
  /**
1447
- * Enables or disables focus mode.
1448
- * @param on Whether to enable focus mode.
1449
- * @throws Error if the operation fails.
2149
+ * Download an object from OSS using a pre-signed URL.
2150
+ * Corresponds to Python's download_anonymous() method
2151
+ *
2152
+ * @param url - Pre-signed URL for anonymous download.
2153
+ * @param path - Local file or directory path to save the downloaded content.
2154
+ * @returns OSSDownloadResult with download result and requestId
1450
2155
  */
1451
- focusMode(on: boolean): Promise<void>;
2156
+ downloadAnonymous(url: string, path: string): Promise<OSSDownloadResult>;
1452
2157
  }
1453
2158
 
1454
2159
  /**
@@ -1498,246 +2203,297 @@ declare class UI {
1498
2203
  private callMcpTool;
1499
2204
  /**
1500
2205
  * Retrieves all clickable UI elements within the specified timeout.
2206
+ * Corresponds to Python's get_clickable_ui_elements() method
1501
2207
  *
1502
2208
  * @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
1503
- * @returns An array of UIElement objects
1504
- * @throws Error if the operation fails.
2209
+ * @returns UIElementListResult with clickable UI elements and requestId
1505
2210
  */
1506
- getClickableUIElements(timeoutMs?: number): Promise<UIElement[]>;
2211
+ getClickableUIElements(timeoutMs?: number): Promise<UIElementListResult>;
1507
2212
  /**
1508
2213
  * Retrieves all UI elements within the specified timeout.
2214
+ * Corresponds to Python's get_all_ui_elements() method
1509
2215
  *
1510
2216
  * @param timeoutMs - The timeout in milliseconds. Default is 2000ms.
1511
- * @returns An array of UIElement objects
1512
- * @throws Error if the operation fails.
2217
+ * @returns UIElementListResult with all UI elements and requestId
1513
2218
  */
1514
- getAllUIElements(timeoutMs?: number): Promise<UIElement[]>;
2219
+ getAllUIElements(timeoutMs?: number): Promise<UIElementListResult>;
1515
2220
  /**
1516
2221
  * Sends a key press event.
2222
+ * Corresponds to Python's send_key() method
1517
2223
  *
1518
2224
  * @param key - The key code to send.
1519
- * @returns The extracted text content from the API response
1520
- * @throws Error if the operation fails.
2225
+ * @returns BoolResult with key press result and requestId
1521
2226
  */
1522
- sendKey(key: number): Promise<string>;
2227
+ sendKey(key: number): Promise<BoolResult>;
1523
2228
  /**
1524
2229
  * Inputs text into the active field.
2230
+ * Corresponds to Python's input_text() method
1525
2231
  *
1526
2232
  * @param text - The text to input.
1527
- * @returns The extracted text content from the API response
1528
- * @throws Error if the operation fails.
2233
+ * @returns BoolResult with input result and requestId
1529
2234
  */
1530
- inputText(text: string): Promise<string>;
2235
+ inputText(text: string): Promise<BoolResult>;
1531
2236
  /**
1532
2237
  * Performs a swipe gesture on the screen.
2238
+ * Corresponds to Python's swipe() method
1533
2239
  *
1534
2240
  * @param startX - The starting X coordinate.
1535
2241
  * @param startY - The starting Y coordinate.
1536
2242
  * @param endX - The ending X coordinate.
1537
2243
  * @param endY - The ending Y coordinate.
1538
2244
  * @param durationMs - The duration of the swipe in milliseconds. Default is 300ms.
1539
- * @returns The extracted text content from the API response
1540
- * @throws Error if the operation fails.
2245
+ * @returns BoolResult with swipe result and requestId
1541
2246
  */
1542
- swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<string>;
2247
+ swipe(startX: number, startY: number, endX: number, endY: number, durationMs?: number): Promise<BoolResult>;
1543
2248
  /**
1544
2249
  * Performs a click at the specified coordinates.
2250
+ * Corresponds to Python's click() method
1545
2251
  *
1546
2252
  * @param x - The X coordinate.
1547
2253
  * @param y - The Y coordinate.
1548
2254
  * @param button - The mouse button to click. Default is 'left'.
1549
- * @returns The extracted text content from the API response
1550
- * @throws Error if the operation fails.
2255
+ * @returns BoolResult with click result and requestId
1551
2256
  */
1552
- click(x: number, y: number, button?: string): Promise<string>;
2257
+ click(x: number, y: number, button?: string): Promise<BoolResult>;
1553
2258
  /**
1554
2259
  * Takes a screenshot of the current screen.
2260
+ * Corresponds to Python's screenshot() method
1555
2261
  *
1556
- * @returns The extracted text content from the API response (usually a base64-encoded image)
1557
- * @throws Error if the operation fails.
2262
+ * @returns OperationResult with screenshot data and requestId
1558
2263
  */
1559
- screenshot(): Promise<string>;
2264
+ screenshot(): Promise<OperationResult>;
1560
2265
  }
1561
2266
 
1562
2267
  /**
1563
- * Contains information about a session.
1564
- */
1565
- interface SessionInfo {
1566
- sessionId: string;
1567
- resourceUrl: string;
1568
- appId?: string;
1569
- authCode?: string;
1570
- connectionProperties?: string;
1571
- resourceId?: string;
1572
- resourceType?: string;
1573
- }
1574
- /**
1575
- * Represents a session in the AgentBay cloud environment.
2268
+ * Handles window management operations in the AgentBay cloud environment.
1576
2269
  */
1577
- declare class Session {
1578
- private agentBay;
1579
- client: Client;
1580
- sessionId: string;
1581
- resourceUrl: string;
1582
- filesystem: FileSystem;
1583
- command: Command;
1584
- oss: Oss;
1585
- Application: Application;
1586
- window: WindowManager;
1587
- ui: UI;
2270
+ declare class WindowManager {
2271
+ private session;
1588
2272
  /**
1589
- * Initialize a Session object.
1590
- *
1591
- * @param agentBay - The AgentBay instance that created this session.
1592
- * @param sessionId - The ID of this session.
2273
+ * Creates a new WindowManager instance.
2274
+ * @param session The session object that provides access to the AgentBay API.
1593
2275
  */
1594
- constructor(agentBay: AgentBay, sessionId: string);
2276
+ constructor(session: {
2277
+ getAPIKey(): string;
2278
+ getClient(): any;
2279
+ getSessionId(): string;
2280
+ });
1595
2281
  /**
1596
- * Get information about this session.
2282
+ * Helper method to call MCP tools and handle common response processing
1597
2283
  *
1598
- * @returns Session information.
2284
+ * @param toolName - Name of the MCP tool to call
2285
+ * @param args - Arguments to pass to the tool
2286
+ * @param defaultErrorMsg - Default error message if specific error details are not available
2287
+ * @returns A CallMcpToolResult with the response data
2288
+ * @throws APIError if the call fails
1599
2289
  */
2290
+ private callMcpTool;
1600
2291
  /**
1601
- * Delete this session.
1602
- *
1603
- * @returns True if the session was successfully deleted.
2292
+ * Helper method to parse JSON string into Window objects
2293
+ * @param jsonStr - JSON string to parse
2294
+ * @returns Array of Window objects or single Window object
1604
2295
  */
1605
- delete(): Promise<boolean>;
2296
+ private parseWindowsFromJSON;
1606
2297
  /**
1607
- * Sets the labels for this session.
2298
+ * Lists all root windows in the system.
2299
+ * Corresponds to Python's list_root_windows() method
1608
2300
  *
1609
- * @param labels - The labels to set for the session.
1610
- * @throws APIError if the operation fails.
2301
+ * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
2302
+ * @returns WindowListResult with windows array and requestId
1611
2303
  */
1612
- setLabels(labels: Record<string, string>): Promise<void>;
2304
+ listRootWindows(timeoutMs?: number): Promise<WindowListResult>;
1613
2305
  /**
1614
- * Gets the labels for this session.
2306
+ * Gets the currently active window.
2307
+ * Corresponds to Python's get_active_window() method
1615
2308
  *
1616
- * @returns The labels for the session.
1617
- * @throws APIError if the operation fails.
2309
+ * @param timeoutMs - The timeout in milliseconds. Default is 3000ms.
2310
+ * @returns WindowInfoResult with active window data and requestId
1618
2311
  */
1619
- getLabels(): Promise<Record<string, string>>;
2312
+ getActiveWindow(timeoutMs?: number): Promise<WindowInfoResult>;
1620
2313
  /**
1621
- * Get the API key.
2314
+ * Activates a window by ID.
2315
+ * Corresponds to Python's activate_window() method
1622
2316
  *
1623
- * @returns The API key.
2317
+ * @param windowId The ID of the window to activate.
2318
+ * @returns BoolResult with requestId
1624
2319
  */
1625
- getAPIKey(): string;
2320
+ activateWindow(windowId: number): Promise<BoolResult>;
1626
2321
  /**
1627
- * Get the client.
2322
+ * Maximizes a window by ID.
2323
+ * Corresponds to Python's maximize_window() method
1628
2324
  *
1629
- * @returns The client.
2325
+ * @param windowId The ID of the window to maximize.
2326
+ * @returns BoolResult with requestId
1630
2327
  */
1631
- getClient(): Client;
2328
+ maximizeWindow(windowId: number): Promise<BoolResult>;
1632
2329
  /**
1633
- * Get the session ID.
2330
+ * Minimizes a window by ID.
2331
+ * Corresponds to Python's minimize_window() method
1634
2332
  *
1635
- * @returns The session ID.
2333
+ * @param windowId The ID of the window to minimize.
2334
+ * @returns BoolResult with requestId
1636
2335
  */
1637
- getSessionId(): string;
2336
+ minimizeWindow(windowId: number): Promise<BoolResult>;
1638
2337
  /**
1639
- * Gets information about this session.
2338
+ * Restores a window by ID.
2339
+ * Corresponds to Python's restore_window() method
1640
2340
  *
1641
- * @returns Information about the session.
1642
- * @throws APIError if the operation fails.
2341
+ * @param windowId The ID of the window to restore.
2342
+ * @returns BoolResult with requestId
1643
2343
  */
1644
- info(): Promise<SessionInfo>;
2344
+ restoreWindow(windowId: number): Promise<BoolResult>;
1645
2345
  /**
1646
- * Gets the link for this session.
2346
+ * Closes a window by ID.
2347
+ * Corresponds to Python's close_window() method
1647
2348
  *
1648
- * @returns The link for the session.
1649
- * @throws APIError if the operation fails.
2349
+ * @param windowId The ID of the window to close.
2350
+ * @returns BoolResult with requestId
1650
2351
  */
1651
- getLink(): Promise<string>;
1652
- }
1653
-
1654
- /**
1655
- * Represents a persistent storage context in the AgentBay cloud environment.
1656
- */
1657
- declare class Context {
2352
+ closeWindow(windowId: number): Promise<BoolResult>;
1658
2353
  /**
1659
- * The unique identifier of the context.
2354
+ * Sets a window to fullscreen by ID.
2355
+ * Corresponds to Python's fullscreen_window() method
2356
+ *
2357
+ * @param windowId The ID of the window to set to fullscreen.
2358
+ * @returns BoolResult with requestId
1660
2359
  */
1661
- id: string;
2360
+ fullscreenWindow(windowId: number): Promise<BoolResult>;
1662
2361
  /**
1663
- * The name of the context.
2362
+ * Resizes a window by ID.
2363
+ * Corresponds to Python's resize_window() method
2364
+ *
2365
+ * @param windowId The ID of the window to resize.
2366
+ * @param width The new width of the window.
2367
+ * @param height The new height of the window.
2368
+ * @returns BoolResult with requestId
1664
2369
  */
1665
- name: string;
2370
+ resizeWindow(windowId: number, width: number, height: number): Promise<BoolResult>;
1666
2371
  /**
1667
- * The current state of the context (e.g., "available", "in-use").
2372
+ * Enables or disables focus mode.
2373
+ * Corresponds to Python's focus_mode() method
2374
+ *
2375
+ * @param on Whether to enable focus mode.
2376
+ * @returns BoolResult with requestId
1668
2377
  */
1669
- state: string;
2378
+ focusMode(on: boolean): Promise<BoolResult>;
2379
+ }
2380
+
2381
+ /**
2382
+ * Represents a session in the AgentBay cloud environment.
2383
+ */
2384
+ declare class Session {
2385
+ private agentBay;
2386
+ sessionId: string;
2387
+ resourceUrl: string;
2388
+ fileSystem: FileSystem;
2389
+ command: Command;
2390
+ oss: Oss;
2391
+ application: Application;
2392
+ window: WindowManager;
2393
+ ui: UI;
2394
+ context: ContextManager;
1670
2395
  /**
1671
- * Date and time when the Context was created.
2396
+ * Initialize a Session object.
2397
+ *
2398
+ * @param agentBay - The AgentBay instance that created this session.
2399
+ * @param sessionId - The ID of this session.
1672
2400
  */
1673
- createdAt?: string;
2401
+ constructor(agentBay: AgentBay, sessionId: string);
1674
2402
  /**
1675
- * Date and time when the Context was last used.
2403
+ * Return the API key for this session.
1676
2404
  */
1677
- lastUsedAt?: string;
2405
+ getAPIKey(): string;
1678
2406
  /**
1679
- * The operating system type this context is bound to.
2407
+ * Return the HTTP client for this session.
1680
2408
  */
1681
- osType?: string;
2409
+ getClient(): Client;
1682
2410
  /**
1683
- * Initialize a Context object.
1684
- *
1685
- * @param id - The unique identifier of the context.
1686
- * @param name - The name of the context.
1687
- * @param state - The current state of the context.
1688
- * @param createdAt - Date and time when the Context was created.
1689
- * @param lastUsedAt - Date and time when the Context was last used.
1690
- * @param osType - The operating system type this context is bound to.
2411
+ * Return the session_id for this session.
1691
2412
  */
1692
- constructor(id: string, name: string, state?: string, createdAt?: string, lastUsedAt?: string, osType?: string);
1693
- }
1694
- /**
1695
- * Provides methods to manage persistent contexts in the AgentBay cloud environment.
1696
- */
1697
- declare class ContextService {
1698
- private agentBay;
2413
+ getSessionId(): string;
1699
2414
  /**
1700
- * Initialize the ContextService.
2415
+ * Delete this session.
1701
2416
  *
1702
- * @param agentBay - The AgentBay instance.
2417
+ * @returns DeleteResult indicating success or failure and request ID
1703
2418
  */
1704
- constructor(agentBay: AgentBay);
2419
+ delete(): Promise<DeleteResult>;
1705
2420
  /**
1706
- * Lists all available contexts.
2421
+ * Sets the labels for this session.
1707
2422
  *
1708
- * @returns A list of Context objects.
2423
+ * @param labels - The labels to set for the session.
2424
+ * @returns OperationResult indicating success or failure with request ID
2425
+ * @throws Error if the operation fails (matching Python SessionError)
1709
2426
  */
1710
- list(): Promise<Context[]>;
2427
+ setLabels(labels: Record<string, string>): Promise<OperationResult>;
1711
2428
  /**
1712
- * Gets a context by name. Optionally creates it if it doesn't exist.
2429
+ * Gets the labels for this session.
1713
2430
  *
1714
- * @param name - The name of the context to get.
1715
- * @param create - Whether to create the context if it doesn't exist.
1716
- * @returns The Context object if found or created, null if not found and create is false.
2431
+ * @returns OperationResult containing the labels as data and request ID
2432
+ * @throws Error if the operation fails (matching Python SessionError)
1717
2433
  */
1718
- get(name: string, create?: boolean): Promise<Context | null>;
2434
+ getLabels(): Promise<OperationResult>;
1719
2435
  /**
1720
- * Creates a new context with the given name.
2436
+ * Gets information about this session.
1721
2437
  *
1722
- * @param name - The name for the new context.
1723
- * @returns The created Context object.
2438
+ * @returns OperationResult containing the session information as data and request ID
2439
+ * @throws Error if the operation fails (matching Python SessionError)
1724
2440
  */
1725
- create(name: string): Promise<Context>;
2441
+ info(): Promise<OperationResult>;
1726
2442
  /**
1727
- * Updates the specified context.
2443
+ * Get a link associated with the current session.
1728
2444
  *
1729
- * @param context - The Context object to update.
1730
- * @returns The updated Context object.
2445
+ * @param protocolType - Optional protocol type to use for the link
2446
+ * @param port - Optional port to use for the link
2447
+ * @returns OperationResult containing the link as data and request ID
2448
+ * @throws Error if the operation fails (matching Python SessionError)
1731
2449
  */
1732
- update(context: Context): Promise<Context>;
2450
+ getLink(protocolType?: string, port?: number): Promise<OperationResult>;
1733
2451
  /**
1734
- * Deletes the specified context.
2452
+ * Asynchronously get a link associated with the current session.
1735
2453
  *
1736
- * @param context - The Context object to delete.
2454
+ * @param protocolType - Optional protocol type to use for the link
2455
+ * @param port - Optional port to use for the link
2456
+ * @returns OperationResult containing the link as data and request ID
2457
+ * @throws Error if the operation fails (matching Python SessionError)
1737
2458
  */
1738
- delete(context: Context): Promise<void>;
2459
+ getLinkAsync(protocolType?: string, port?: number): Promise<OperationResult>;
2460
+ }
2461
+
2462
+ /**
2463
+ * Parameters for listing sessions with pagination support
2464
+ */
2465
+ interface ListSessionParams {
2466
+ /** Number of results per page (default: 10) */
2467
+ maxResults?: number;
2468
+ /** Token for the next page */
2469
+ nextToken?: string;
2470
+ /** Labels to filter by */
2471
+ labels: Record<string, string>;
2472
+ }
2473
+ /**
2474
+ * Result type for session listing with pagination information
2475
+ * Maintain consistency with the existing TypeScript SDK return structure and use the data field
2476
+ */
2477
+ interface SessionListResult extends ApiResponse {
2478
+ /** Array of sessions */
2479
+ data: Session[];
2480
+ /** Token for the next page (if available) */
2481
+ nextToken?: string;
2482
+ /** Number of results per page */
2483
+ maxResults?: number;
2484
+ /** Total number of results */
2485
+ totalCount?: number;
1739
2486
  }
1740
2487
 
2488
+ /**
2489
+ * Parameters for creating a session.
2490
+ */
2491
+ interface CreateSessionParams {
2492
+ contextId?: string;
2493
+ labels?: Record<string, string>;
2494
+ imageId?: string;
2495
+ contextSync?: ContextSync[];
2496
+ }
1741
2497
  /**
1742
2498
  * Main class for interacting with the AgentBay cloud runtime environment.
1743
2499
  */
@@ -1756,23 +2512,19 @@ declare class AgentBay {
1756
2512
  *
1757
2513
  * @param options - Configuration options
1758
2514
  * @param options.apiKey - API key for authentication. If not provided, will look for AGENTBAY_API_KEY environment variable.
2515
+ * @param options.config - Custom configuration object. If not provided, will use environment-based configuration.
1759
2516
  */
1760
2517
  constructor(options?: {
1761
2518
  apiKey?: string;
2519
+ config?: Config;
1762
2520
  });
1763
2521
  /**
1764
2522
  * Create a new session in the AgentBay cloud environment.
1765
2523
  *
1766
- * @param options - Optional parameters for creating the session
1767
- * @param options.contextId - ID of the context to bind to the session
1768
- * @param options.labels - Custom labels for the session
1769
- * @returns A new Session object.
2524
+ * @param params - Optional parameters for creating the session
2525
+ * @returns SessionResult containing the created session and request ID
1770
2526
  */
1771
- create(options?: {
1772
- contextId?: string;
1773
- labels?: Record<string, string>;
1774
- imageId?: string;
1775
- }): Promise<Session>;
2527
+ create(params?: CreateSessionParams): Promise<SessionResult>;
1776
2528
  /**
1777
2529
  * List all available sessions.
1778
2530
  *
@@ -1780,20 +2532,22 @@ declare class AgentBay {
1780
2532
  */
1781
2533
  list(): Session[];
1782
2534
  /**
1783
- * List sessions filtered by the provided labels.
2535
+ * List sessions filtered by the provided labels with pagination support.
1784
2536
  * It returns sessions that match all the specified labels.
1785
2537
  *
1786
- * @param labels - The labels to filter by.
1787
- * @returns A list of session objects that match the labels.
2538
+ * **Breaking Change**: This method currently only accepts ListSessionParams parameters,
2539
+ *
2540
+ * @param params - Parameters including labels and pagination options (required)
2541
+ * @returns API response with sessions list and pagination info
1788
2542
  */
1789
- listByLabels(labels: Record<string, string>): Promise<Session[]>;
2543
+ listByLabels(params?: ListSessionParams): Promise<SessionListResult>;
1790
2544
  /**
1791
- * Delete a session by ID.
2545
+ * Delete a session by session object.
1792
2546
  *
1793
- * @param sessionId - The ID of the session to delete.
1794
- * @returns True if the session was successfully deleted.
2547
+ * @param session - The session to delete.
2548
+ * @returns DeleteResult indicating success or failure and request ID
1795
2549
  */
1796
- delete(session: Session): Promise<boolean>;
2550
+ delete(session: Session): Promise<DeleteResult>;
1797
2551
  /**
1798
2552
  *
1799
2553
  * @param sessionId - The ID of the session to remove.
@@ -1804,34 +2558,76 @@ declare class AgentBay {
1804
2558
  }
1805
2559
 
1806
2560
  /**
1807
- * Base exception for all AgentBay errors.
2561
+ * Base exception for all AgentBay SDK errors.
1808
2562
  */
1809
2563
  declare class AgentBayError extends Error {
1810
- constructor(message: string);
2564
+ extra: Record<string, any>;
2565
+ constructor(message?: string, extra?: Record<string, any>);
1811
2566
  }
1812
2567
  /**
1813
2568
  * Raised when there is an authentication error.
1814
2569
  */
1815
2570
  declare class AuthenticationError extends AgentBayError {
1816
- constructor(message: string);
2571
+ constructor(message?: string, extra?: Record<string, any>);
1817
2572
  }
1818
2573
  /**
1819
2574
  * Raised when there is an error with the API.
1820
2575
  */
1821
2576
  declare class APIError extends AgentBayError {
1822
- constructor(message: string);
2577
+ statusCode?: number;
2578
+ constructor(message?: string, statusCode?: number, extra?: Record<string, any>);
1823
2579
  }
1824
2580
  /**
1825
- * Raised when there is an error with file operations.
2581
+ * Raised for errors related to file operations.
1826
2582
  */
1827
2583
  declare class FileError extends AgentBayError {
1828
- constructor(message: string);
2584
+ constructor(message?: string, extra?: Record<string, any>);
1829
2585
  }
1830
2586
  /**
1831
- * Raised when there is an error with command execution.
2587
+ * Raised for errors related to command execution.
1832
2588
  */
1833
2589
  declare class CommandError extends AgentBayError {
1834
- constructor(message: string);
2590
+ constructor(message?: string, extra?: Record<string, any>);
2591
+ }
2592
+ /**
2593
+ * Raised for errors related to session operations.
2594
+ */
2595
+ declare class SessionError extends AgentBayError {
2596
+ constructor(message?: string, extra?: Record<string, any>);
1835
2597
  }
2598
+ /**
2599
+ * Raised for errors related to OSS operations.
2600
+ */
2601
+ declare class OssError extends AgentBayError {
2602
+ constructor(message?: string, extra?: Record<string, any>);
2603
+ }
2604
+ /**
2605
+ * Raised for errors related to application operations.
2606
+ */
2607
+ declare class ApplicationError extends AgentBayError {
2608
+ constructor(message?: string, extra?: Record<string, any>);
2609
+ }
2610
+ /**
2611
+ * Raised for errors related to UI operations.
2612
+ */
2613
+ declare class UIError extends AgentBayError {
2614
+ constructor(message?: string, extra?: Record<string, any>);
2615
+ }
2616
+
2617
+ /**
2618
+ * Utility functions for logging in a clean format
2619
+ */
2620
+ /**
2621
+ * Log a message without the log prefix and file location
2622
+ * @param message The message to log
2623
+ * @param args Optional arguments to log
2624
+ */
2625
+ declare function log(message: string, ...args: any[]): void;
2626
+ /**
2627
+ * Log an error message
2628
+ * @param message The error message to log
2629
+ * @param error Optional error object
2630
+ */
2631
+ declare function logError(message: string, error?: any): void;
1836
2632
 
1837
- export { APIError, AgentBay, AgentBayError, Application, AuthenticationError, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, Client, type CodeExecutionResult, Command, CommandError, type CommandResult, Context, ContextService, CreateMcpSessionRequest, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DirectoryEntry, FileError, type FileInfo, FileSystem, GetContextRequest, GetContextResponse, GetContextResponseBody, GetContextResponseBodyData, GetLabelRequest, GetLabelResponse, GetLabelResponseBody, GetLabelResponseBodyData, GetLinkRequest, GetLinkResponse, GetLinkResponseBody, GetMcpResourceRequest, GetMcpResourceResponse, GetMcpResourceResponseBody, GetMcpResourceResponseBodyData, GetMcpResourceResponseBodyDataDesktopInfo, type InstalledApp, KeyCode, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, Oss, type Process, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, Session, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, UI, type UIElement };
2633
+ export { APIError, AgentBay, AgentBayError, Application, ApplicationError, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, Client, Command, CommandError, Context, ContextService, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DirectoryEntry, FileError, type FileInfo, FileSystem, GetContextInfoRequest, GetContextInfoResponse, GetContextInfoResponseBody, GetContextInfoResponseBodyData, GetContextRequest, GetContextResponse, GetContextResponseBody, GetContextResponseBodyData, GetLabelRequest, GetLabelResponse, GetLabelResponseBody, GetLabelResponseBodyData, GetLinkRequest, GetLinkResponse, GetLinkResponseBody, GetLinkResponseBodyData, GetMcpResourceRequest, GetMcpResourceResponse, GetMcpResourceResponseBody, GetMcpResourceResponseBodyData, GetMcpResourceResponseBodyDataDesktopInfo, type InstalledApp, KeyCode, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, Oss, OssError, type Process, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, Session, SessionError, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, UI, type UIElement, UIError, log, logError };