test-wuying-agentbay-sdk 0.13.0-beta.20251218164850 → 0.13.0-beta.20251219095412
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.cjs +90 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +121 -44
- package/dist/index.d.ts +121 -44
- package/dist/index.mjs +90 -15
- package/dist/index.mjs.map +1 -1
- package/docs/api/common-features/basics/filesystem.md +36 -0
- package/docs/api/computer-use/computer.md +24 -24
- package/docs/examples/common-features/basics/filesystem-example/filesystem-example.ts +13 -0
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ Handles file operations in the AgentBay cloud environment.
|
|
|
12
12
|
### Methods
|
|
13
13
|
|
|
14
14
|
- [createDirectory](#createdirectory)
|
|
15
|
+
- [deleteFile](#deletefile)
|
|
15
16
|
- [downloadFile](#downloadfile)
|
|
16
17
|
- [editFile](#editfile)
|
|
17
18
|
- [listDirectory](#listdirectory)
|
|
@@ -58,6 +59,41 @@ if (result.success) {
|
|
|
58
59
|
|
|
59
60
|
___
|
|
60
61
|
|
|
62
|
+
### deleteFile
|
|
63
|
+
|
|
64
|
+
▸ **deleteFile**(`path`): `Promise`\<`BoolResult`\>
|
|
65
|
+
|
|
66
|
+
Deletes a file at the specified path.
|
|
67
|
+
Corresponds to Python's delete_file() method
|
|
68
|
+
|
|
69
|
+
#### Parameters
|
|
70
|
+
|
|
71
|
+
| Name | Type | Description |
|
|
72
|
+
| :------ | :------ | :------ |
|
|
73
|
+
| `path` | `string` | Path to the file to delete. |
|
|
74
|
+
|
|
75
|
+
#### Returns
|
|
76
|
+
|
|
77
|
+
`Promise`\<`BoolResult`\>
|
|
78
|
+
|
|
79
|
+
BoolResult with deletion result and requestId
|
|
80
|
+
|
|
81
|
+
**`Example`**
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
85
|
+
const result = await agentBay.create();
|
|
86
|
+
if (result.success) {
|
|
87
|
+
const session = result.session;
|
|
88
|
+
await session.fileSystem.writeFile('/tmp/to_delete.txt', 'hello');
|
|
89
|
+
const deleteResult = await session.fileSystem.deleteFile('/tmp/to_delete.txt');
|
|
90
|
+
console.log('File deleted:', deleteResult.success);
|
|
91
|
+
await session.delete();
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
___
|
|
96
|
+
|
|
61
97
|
### downloadFile
|
|
62
98
|
|
|
63
99
|
▸ **downloadFile**(`remotePath`, `localPath`, `options?`): `Promise`\<`any`\>
|
|
@@ -99,7 +99,7 @@ ___
|
|
|
99
99
|
|
|
100
100
|
### clickMouse
|
|
101
101
|
|
|
102
|
-
▸ **clickMouse**(`x`, `y`, `button?`): `Promise`\<`
|
|
102
|
+
▸ **clickMouse**(`x`, `y`, `button?`): `Promise`\<`OperationResult`\>
|
|
103
103
|
|
|
104
104
|
Click mouse at specified coordinates.
|
|
105
105
|
|
|
@@ -113,7 +113,7 @@ Click mouse at specified coordinates.
|
|
|
113
113
|
|
|
114
114
|
#### Returns
|
|
115
115
|
|
|
116
|
-
`Promise`\<`
|
|
116
|
+
`Promise`\<`OperationResult`\>
|
|
117
117
|
|
|
118
118
|
Promise resolving to result with success status
|
|
119
119
|
|
|
@@ -166,7 +166,7 @@ ___
|
|
|
166
166
|
|
|
167
167
|
### dragMouse
|
|
168
168
|
|
|
169
|
-
▸ **dragMouse**(`fromX`, `fromY`, `toX`, `toY`, `button?`): `Promise`\<`
|
|
169
|
+
▸ **dragMouse**(`fromX`, `fromY`, `toX`, `toY`, `button?`): `Promise`\<`OperationResult`\>
|
|
170
170
|
|
|
171
171
|
Drag mouse from one position to another.
|
|
172
172
|
|
|
@@ -182,7 +182,7 @@ Drag mouse from one position to another.
|
|
|
182
182
|
|
|
183
183
|
#### Returns
|
|
184
184
|
|
|
185
|
-
`Promise`\<`
|
|
185
|
+
`Promise`\<`OperationResult`\>
|
|
186
186
|
|
|
187
187
|
Promise resolving to result with success status
|
|
188
188
|
|
|
@@ -265,7 +265,7 @@ if (result.success) {
|
|
|
265
265
|
|
|
266
266
|
### inputText
|
|
267
267
|
|
|
268
|
-
▸ **inputText**(`text`): `Promise`\<`
|
|
268
|
+
▸ **inputText**(`text`): `Promise`\<`OperationResult`\>
|
|
269
269
|
|
|
270
270
|
Input text at the current cursor position.
|
|
271
271
|
|
|
@@ -277,7 +277,7 @@ Input text at the current cursor position.
|
|
|
277
277
|
|
|
278
278
|
#### Returns
|
|
279
279
|
|
|
280
|
-
`Promise`\<`
|
|
280
|
+
`Promise`\<`OperationResult`\>
|
|
281
281
|
|
|
282
282
|
Promise resolving to result with success status
|
|
283
283
|
|
|
@@ -328,13 +328,13 @@ ___
|
|
|
328
328
|
|
|
329
329
|
### listVisibleApps
|
|
330
330
|
|
|
331
|
-
▸ **listVisibleApps**(): `Promise`\<`
|
|
331
|
+
▸ **listVisibleApps**(): `Promise`\<`ProcessListResult`\>
|
|
332
332
|
|
|
333
333
|
Lists all visible applications.
|
|
334
334
|
|
|
335
335
|
#### Returns
|
|
336
336
|
|
|
337
|
-
`Promise`\<`
|
|
337
|
+
`Promise`\<`ProcessListResult`\>
|
|
338
338
|
|
|
339
339
|
Promise resolving to result containing array of visible application processes
|
|
340
340
|
|
|
@@ -420,7 +420,7 @@ ___
|
|
|
420
420
|
|
|
421
421
|
### moveMouse
|
|
422
422
|
|
|
423
|
-
▸ **moveMouse**(`x`, `y`): `Promise`\<`
|
|
423
|
+
▸ **moveMouse**(`x`, `y`): `Promise`\<`OperationResult`\>
|
|
424
424
|
|
|
425
425
|
Move mouse to specified coordinates.
|
|
426
426
|
|
|
@@ -433,7 +433,7 @@ Move mouse to specified coordinates.
|
|
|
433
433
|
|
|
434
434
|
#### Returns
|
|
435
435
|
|
|
436
|
-
`Promise`\<`
|
|
436
|
+
`Promise`\<`OperationResult`\>
|
|
437
437
|
|
|
438
438
|
Promise resolving to result with success status
|
|
439
439
|
|
|
@@ -454,7 +454,7 @@ ___
|
|
|
454
454
|
|
|
455
455
|
### pressKeys
|
|
456
456
|
|
|
457
|
-
▸ **pressKeys**(`keys`, `hold?`): `Promise`\<`
|
|
457
|
+
▸ **pressKeys**(`keys`, `hold?`): `Promise`\<`OperationResult`\>
|
|
458
458
|
|
|
459
459
|
Press one or more keys.
|
|
460
460
|
|
|
@@ -467,7 +467,7 @@ Press one or more keys.
|
|
|
467
467
|
|
|
468
468
|
#### Returns
|
|
469
469
|
|
|
470
|
-
`Promise`\<`
|
|
470
|
+
`Promise`\<`OperationResult`\>
|
|
471
471
|
|
|
472
472
|
Promise resolving to result with success status
|
|
473
473
|
|
|
@@ -487,7 +487,7 @@ ___
|
|
|
487
487
|
|
|
488
488
|
### releaseKeys
|
|
489
489
|
|
|
490
|
-
▸ **releaseKeys**(`keys`): `Promise`\<`
|
|
490
|
+
▸ **releaseKeys**(`keys`): `Promise`\<`OperationResult`\>
|
|
491
491
|
|
|
492
492
|
Release previously pressed keys.
|
|
493
493
|
|
|
@@ -499,7 +499,7 @@ Release previously pressed keys.
|
|
|
499
499
|
|
|
500
500
|
#### Returns
|
|
501
501
|
|
|
502
|
-
`Promise`\<`
|
|
502
|
+
`Promise`\<`OperationResult`\>
|
|
503
503
|
|
|
504
504
|
Promise resolving to result with success status
|
|
505
505
|
|
|
@@ -614,7 +614,7 @@ ___
|
|
|
614
614
|
|
|
615
615
|
### scroll
|
|
616
616
|
|
|
617
|
-
▸ **scroll**(`x`, `y`, `direction?`, `amount?`): `Promise`\<`
|
|
617
|
+
▸ **scroll**(`x`, `y`, `direction?`, `amount?`): `Promise`\<`OperationResult`\>
|
|
618
618
|
|
|
619
619
|
Scroll at specified coordinates.
|
|
620
620
|
|
|
@@ -629,7 +629,7 @@ Scroll at specified coordinates.
|
|
|
629
629
|
|
|
630
630
|
#### Returns
|
|
631
631
|
|
|
632
|
-
`Promise`\<`
|
|
632
|
+
`Promise`\<`OperationResult`\>
|
|
633
633
|
|
|
634
634
|
Promise resolving to result with success status
|
|
635
635
|
|
|
@@ -648,7 +648,7 @@ ___
|
|
|
648
648
|
|
|
649
649
|
### startApp
|
|
650
650
|
|
|
651
|
-
▸ **startApp**(`startCmd`, `workDirectory?`, `activity?`): `Promise`\<`
|
|
651
|
+
▸ **startApp**(`startCmd`, `workDirectory?`, `activity?`): `Promise`\<`ProcessListResult`\>
|
|
652
652
|
|
|
653
653
|
Starts the specified application.
|
|
654
654
|
|
|
@@ -662,7 +662,7 @@ Starts the specified application.
|
|
|
662
662
|
|
|
663
663
|
#### Returns
|
|
664
664
|
|
|
665
|
-
`Promise`\<`
|
|
665
|
+
`Promise`\<`ProcessListResult`\>
|
|
666
666
|
|
|
667
667
|
Promise resolving to result containing array of started processes
|
|
668
668
|
|
|
@@ -682,7 +682,7 @@ ___
|
|
|
682
682
|
|
|
683
683
|
### stopAppByCmd
|
|
684
684
|
|
|
685
|
-
▸ **stopAppByCmd**(`cmd`): `Promise`\<`
|
|
685
|
+
▸ **stopAppByCmd**(`cmd`): `Promise`\<`BoolResult`\>
|
|
686
686
|
|
|
687
687
|
Stops an application by stop command.
|
|
688
688
|
|
|
@@ -694,7 +694,7 @@ Stops an application by stop command.
|
|
|
694
694
|
|
|
695
695
|
#### Returns
|
|
696
696
|
|
|
697
|
-
`Promise`\<`
|
|
697
|
+
`Promise`\<`BoolResult`\>
|
|
698
698
|
|
|
699
699
|
Promise resolving to result with success status
|
|
700
700
|
|
|
@@ -714,7 +714,7 @@ ___
|
|
|
714
714
|
|
|
715
715
|
### stopAppByPID
|
|
716
716
|
|
|
717
|
-
▸ **stopAppByPID**(`pid`): `Promise`\<`
|
|
717
|
+
▸ **stopAppByPID**(`pid`): `Promise`\<`BoolResult`\>
|
|
718
718
|
|
|
719
719
|
Stops an application by process ID.
|
|
720
720
|
|
|
@@ -726,7 +726,7 @@ Stops an application by process ID.
|
|
|
726
726
|
|
|
727
727
|
#### Returns
|
|
728
728
|
|
|
729
|
-
`Promise`\<`
|
|
729
|
+
`Promise`\<`BoolResult`\>
|
|
730
730
|
|
|
731
731
|
Promise resolving to result with success status
|
|
732
732
|
|
|
@@ -747,7 +747,7 @@ ___
|
|
|
747
747
|
|
|
748
748
|
### stopAppByPName
|
|
749
749
|
|
|
750
|
-
▸ **stopAppByPName**(`pname`): `Promise`\<`
|
|
750
|
+
▸ **stopAppByPName**(`pname`): `Promise`\<`BoolResult`\>
|
|
751
751
|
|
|
752
752
|
Stops an application by process name.
|
|
753
753
|
|
|
@@ -759,7 +759,7 @@ Stops an application by process name.
|
|
|
759
759
|
|
|
760
760
|
#### Returns
|
|
761
761
|
|
|
762
|
-
`Promise`\<`
|
|
762
|
+
`Promise`\<`BoolResult`\>
|
|
763
763
|
|
|
764
764
|
Promise resolving to result with success status
|
|
765
765
|
|
|
@@ -145,6 +145,19 @@ async function main() {
|
|
|
145
145
|
} catch (error) {
|
|
146
146
|
log(`Error moving file: ${error}`);
|
|
147
147
|
}
|
|
148
|
+
|
|
149
|
+
// 9. Delete file
|
|
150
|
+
log(`\nDeleting file: ${newFilePath}`);
|
|
151
|
+
try {
|
|
152
|
+
const deleteResponse = await session.fileSystem.deleteFile(newFilePath);
|
|
153
|
+
log(`File deleted successfully: ${deleteResponse.success}`);
|
|
154
|
+
log(`Delete File RequestId: ${deleteResponse.requestId}`);
|
|
155
|
+
|
|
156
|
+
const infoAfterDelete = await session.fileSystem.getFileInfo(newFilePath);
|
|
157
|
+
log(`Get File Info After Delete: success=${infoAfterDelete.success}`);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
log(`Error deleting file: ${error}`);
|
|
160
|
+
}
|
|
148
161
|
} finally {
|
|
149
162
|
// Clean up by deleting the session when we're done
|
|
150
163
|
log('\nDeleting the session...');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-wuying-agentbay-sdk",
|
|
3
|
-
"version": "0.13.0-beta.
|
|
3
|
+
"version": "0.13.0-beta.20251219095412",
|
|
4
4
|
"description": "TypeScript SDK for interacting with the Wuying AgentBay cloud runtime environment",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|