test-wuying-agentbay-sdk 0.13.1-beta.20251224094729 → 0.13.1-beta.20251224100120
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 +280 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +83 -12
- package/dist/index.d.ts +83 -12
- package/dist/index.mjs +236 -114
- package/dist/index.mjs.map +1 -1
- package/docs/api/common-features/basics/filesystem.md +57 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -309,6 +309,24 @@ interface FileContentResult extends ApiResponse {
|
|
|
309
309
|
/** Optional error message if the operation failed */
|
|
310
310
|
errorMessage?: string;
|
|
311
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Interface for binary file content operation responses
|
|
314
|
+
* Corresponds to Python's BinaryFileContentResult type
|
|
315
|
+
*/
|
|
316
|
+
interface BinaryFileContentResult extends ApiResponse {
|
|
317
|
+
/** Request identifier for tracking API calls */
|
|
318
|
+
requestId: string;
|
|
319
|
+
/** Whether the operation was successful */
|
|
320
|
+
success: boolean;
|
|
321
|
+
/** Binary file content */
|
|
322
|
+
content: Uint8Array;
|
|
323
|
+
/** Optional error message if the operation failed */
|
|
324
|
+
errorMessage?: string;
|
|
325
|
+
/** Optional MIME type of the file */
|
|
326
|
+
contentType?: string;
|
|
327
|
+
/** Optional size of the file in bytes */
|
|
328
|
+
size?: number;
|
|
329
|
+
}
|
|
312
330
|
/**
|
|
313
331
|
* Interface for multiple file content operation responses
|
|
314
332
|
* Corresponds to Python's MultipleFileContentResult type
|
|
@@ -5278,7 +5296,8 @@ declare class FileSystem {
|
|
|
5278
5296
|
* @param path - Path to the file to read.
|
|
5279
5297
|
* @param offset - Optional: Byte offset to start reading from (0-based).
|
|
5280
5298
|
* @param length - Optional: Number of bytes to read. If 0, reads the entire file from offset.
|
|
5281
|
-
* @
|
|
5299
|
+
* @param formatType - Optional: Format to read the file in. "text" (default) or "binary".
|
|
5300
|
+
* @returns FileContentResult for text format, BinaryFileContentResult for binary format
|
|
5282
5301
|
*/
|
|
5283
5302
|
private readFileChunk;
|
|
5284
5303
|
/**
|
|
@@ -5342,7 +5361,7 @@ declare class FileSystem {
|
|
|
5342
5361
|
* @returns FileContentResult with complete file content and requestId
|
|
5343
5362
|
*/
|
|
5344
5363
|
/**
|
|
5345
|
-
* Reads the entire content of a file.
|
|
5364
|
+
* Reads the entire content of a file (text format, default).
|
|
5346
5365
|
*
|
|
5347
5366
|
* @param path - Absolute path to the file to read.
|
|
5348
5367
|
*
|
|
@@ -5352,8 +5371,6 @@ declare class FileSystem {
|
|
|
5352
5371
|
* - requestId: Unique identifier for this API request
|
|
5353
5372
|
* - errorMessage: Error description if read failed
|
|
5354
5373
|
*
|
|
5355
|
-
* @throws Error if the API call fails.
|
|
5356
|
-
*
|
|
5357
5374
|
* @example
|
|
5358
5375
|
* ```typescript
|
|
5359
5376
|
* import { AgentBay } from 'wuying-agentbay-sdk';
|
|
@@ -5364,11 +5381,65 @@ declare class FileSystem {
|
|
|
5364
5381
|
* if (result.success) {
|
|
5365
5382
|
* const session = result.session;
|
|
5366
5383
|
*
|
|
5367
|
-
* // Read a text file
|
|
5384
|
+
* // Read a text file (default)
|
|
5368
5385
|
* const fileResult = await session.fileSystem.readFile('/etc/hostname');
|
|
5369
5386
|
* if (fileResult.success) {
|
|
5370
5387
|
* console.log(`Content: ${fileResult.content}`);
|
|
5371
|
-
*
|
|
5388
|
+
* }
|
|
5389
|
+
*
|
|
5390
|
+
* await session.delete();
|
|
5391
|
+
* }
|
|
5392
|
+
* ```
|
|
5393
|
+
*/
|
|
5394
|
+
readFile(path: string): Promise<FileContentResult>;
|
|
5395
|
+
/**
|
|
5396
|
+
* Reads the entire content of a file with explicit text format.
|
|
5397
|
+
*
|
|
5398
|
+
* @param path - Absolute path to the file to read.
|
|
5399
|
+
* @param opts - Options object with format set to "text".
|
|
5400
|
+
*
|
|
5401
|
+
* @returns Promise resolving to FileContentResult containing:
|
|
5402
|
+
* - success: Whether the read operation succeeded
|
|
5403
|
+
* - content: String content of the file
|
|
5404
|
+
* - requestId: Unique identifier for this API request
|
|
5405
|
+
* - errorMessage: Error description if read failed
|
|
5406
|
+
*
|
|
5407
|
+
* @example
|
|
5408
|
+
* ```typescript
|
|
5409
|
+
* const fileResult = await session.fileSystem.readFile('/tmp/test.txt', { format: 'text' });
|
|
5410
|
+
* ```
|
|
5411
|
+
*/
|
|
5412
|
+
readFile(path: string, opts: {
|
|
5413
|
+
format: "text";
|
|
5414
|
+
}): Promise<FileContentResult>;
|
|
5415
|
+
/**
|
|
5416
|
+
* Reads the entire content of a file in binary format.
|
|
5417
|
+
*
|
|
5418
|
+
* @param path - Absolute path to the file to read.
|
|
5419
|
+
* @param opts - Options object with format set to "bytes".
|
|
5420
|
+
*
|
|
5421
|
+
* @returns Promise resolving to BinaryFileContentResult containing:
|
|
5422
|
+
* - success: Whether the read operation succeeded
|
|
5423
|
+
* - content: Uint8Array binary content of the file
|
|
5424
|
+
* - requestId: Unique identifier for this API request
|
|
5425
|
+
* - errorMessage: Error description if read failed
|
|
5426
|
+
* - contentType: Optional MIME type of the file
|
|
5427
|
+
* - size: Optional size of the file in bytes
|
|
5428
|
+
*
|
|
5429
|
+
* @example
|
|
5430
|
+
* ```typescript
|
|
5431
|
+
* import { AgentBay } from 'wuying-agentbay-sdk';
|
|
5432
|
+
*
|
|
5433
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
5434
|
+
* const result = await agentBay.create();
|
|
5435
|
+
*
|
|
5436
|
+
* if (result.success) {
|
|
5437
|
+
* const session = result.session;
|
|
5438
|
+
*
|
|
5439
|
+
* // Read a binary file
|
|
5440
|
+
* const binaryResult = await session.fileSystem.readFile('/tmp/image.png', { format: 'bytes' });
|
|
5441
|
+
* if (binaryResult.success) {
|
|
5442
|
+
* console.log(`File size: ${binaryResult.content.length} bytes`);
|
|
5372
5443
|
* }
|
|
5373
5444
|
*
|
|
5374
5445
|
* await session.delete();
|
|
@@ -5378,13 +5449,13 @@ declare class FileSystem {
|
|
|
5378
5449
|
* @remarks
|
|
5379
5450
|
* **Behavior:**
|
|
5380
5451
|
* - Automatically handles large files by reading in 60KB chunks
|
|
5381
|
-
* - Returns empty
|
|
5452
|
+
* - Returns empty Uint8Array for empty files
|
|
5382
5453
|
* - Fails if path is a directory or doesn't exist
|
|
5383
|
-
* - Content is returned as
|
|
5384
|
-
*
|
|
5385
|
-
* @see {@link writeFile}, {@link listDirectory}
|
|
5454
|
+
* - Content is returned as Uint8Array (backend uses base64 encoding internally)
|
|
5386
5455
|
*/
|
|
5387
|
-
readFile(path: string
|
|
5456
|
+
readFile(path: string, opts: {
|
|
5457
|
+
format: "bytes";
|
|
5458
|
+
}): Promise<BinaryFileContentResult>;
|
|
5388
5459
|
/**
|
|
5389
5460
|
* Writes content to a file. Automatically handles large files by chunking.
|
|
5390
5461
|
*
|
|
@@ -7684,4 +7755,4 @@ declare function logWarn(message: string, ...args: any[]): void;
|
|
|
7684
7755
|
*/
|
|
7685
7756
|
declare function logError(message: string, error?: any): void;
|
|
7686
7757
|
|
|
7687
|
-
export { APIError, APP_BLACKLIST_TEMPLATE, APP_WHITELIST_TEMPLATE, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, type AgentOptions, type ApiResponse, type ApiResponseWithData, type AppManagerRule, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, type Brand, Browser, BrowserAgent, BrowserContext, BrowserError, type BrowserFingerprint, BrowserFingerprintContext, BrowserFingerprintGenerator, type BrowserOption, BrowserOptionClass, type BrowserProxy, BrowserProxyClass, type BrowserScreen, BrowserUseAgent, type BrowserViewport, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, ClearContextRequest, ClearContextResponse, ClearContextResponseBody, Client, Code, Command, Computer, ComputerUseAgent, type Config, Context, type ContextInfoResult, ContextManager, ContextService, type ContextStatusData, type ContextStatusItem, ContextSync, type ContextSyncResult, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest, CreateSessionParams, type CreateSessionParamsConfig, DeleteContextFileRequest, DeleteContextFileResponse, DeleteContextFileResponseBody, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DeletePolicy, type DeleteResult, DeleteSessionAsyncRequest, DeleteSessionAsyncResponse, DeleteSessionAsyncResponseBody, DescribeContextFilesRequest, DescribeContextFilesResponse, DescribeContextFilesResponseBody, type DirectoryEntry, type DownloadPolicy, DownloadStrategy, type ExecutionResult, Extension, ExtensionOption, ExtensionsService, type ExtraConfigs, type ExtraProperties, type ExtractOptions, type ExtractPolicy, ExtractPolicyClass, type FileChangeEvent, FileChangeEventHelper, type FileChangeResult, FileChangeResultHelper, FileError, type FileInfo, FileSystem, type Fingerprint, FingerprintFormat, GetAdbLinkRequest, GetAdbLinkResponse, GetAdbLinkResponseBody, GetAdbLinkResponseBodyData, GetAndLoadInternalContextRequest, GetAndLoadInternalContextResponse, GetAndLoadInternalContextResponseBody, GetAndLoadInternalContextResponseBodyData, GetCdpLinkRequest, GetCdpLinkResponse, GetCdpLinkResponseBody, GetCdpLinkResponseBodyData, GetContextFileDownloadUrlRequest, GetContextFileDownloadUrlResponse, GetContextFileDownloadUrlResponseBody, GetContextFileUploadUrlRequest, GetContextFileUploadUrlResponse, GetContextFileUploadUrlResponseBody, GetContextInfoRequest, GetContextInfoResponse, GetContextInfoResponseBody, GetContextInfoResponseBodyData, GetContextRequest, GetContextResponse, GetContextResponseBody, GetContextResponseBodyData, GetLabelRequest, GetLabelResponse, GetLabelResponseBody, GetLabelResponseBodyData, GetLinkRequest, GetLinkResponse, GetLinkResponseBody, GetLinkResponseBodyData, GetMcpResourceRequest, GetMcpResourceResponse, GetMcpResourceResponseBody, GetMcpResourceResponseBodyData, GetMcpResourceResponseBodyDataDesktopInfo, GetSessionDetailRequest, GetSessionDetailResponse, GetSessionDetailResponseBody, GetSessionDetailResponseBodyData, GetSessionRequest, GetSessionResponse, GetSessionResponseBody, GetSessionResponseBodyData, HIDE_NAVIGATION_BAR_TEMPLATE, IS_RELEASE, InitBrowserRequest, InitBrowserResponse, InitBrowserResponseBody, InitBrowserResponseBodyData, type InitializationResult, Lifecycle, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, type LogLevel, type LoggerConfig, MOBILE_COMMAND_TEMPLATES, type MappingPolicy, type McpSession, type McpToolResult, Mobile, type MobileExtraConfig, type MobileSimulateConfig, MobileSimulateMode, MobileSimulateService, type MobileSimulateUploadResult, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type NavigatorFingerprint, type ObserveOptions, ObserveResult, Oss, OssError, PauseSessionAsyncRequest, PauseSessionAsyncResponse, PauseSessionAsyncResponseBody, type QueryResult, RESOLUTION_LOCK_TEMPLATE, type RecyclePolicy, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, ResumeSessionAsyncRequest, ResumeSessionAsyncResponse, ResumeSessionAsyncResponseBody, SHOW_NAVIGATION_BAR_TEMPLATE, type ScreenFingerprint, Session, SessionError, type SessionInterface, type SessionListResult, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, type SyncCallback, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UNINSTALL_BLACKLIST_TEMPLATE, UploadMode, type UploadPolicy, UploadStrategy, type UserAgentData, VERSION, type VideoCard, type WhiteList, WhiteListValidator, createListSessionParams, extraConfigsFromJSON, extraConfigsToJSON, extractRequestId, getLogLevel, getMobileCommandTemplate, hasMobileCommandTemplate, log, logDebug, logError, logInfo, logWarn, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newExtractPolicy, newMappingPolicy, newRecyclePolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy, replaceTemplatePlaceholders, setLogLevel, setupLogger, validateAppManagerRule, validateExtraConfigs, validateMobileExtraConfig, validateMobileSimulateConfig };
|
|
7758
|
+
export { APIError, APP_BLACKLIST_TEMPLATE, APP_WHITELIST_TEMPLATE, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, type AgentOptions, type ApiResponse, type ApiResponseWithData, type AppManagerRule, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, type BinaryFileContentResult, type Brand, Browser, BrowserAgent, BrowserContext, BrowserError, type BrowserFingerprint, BrowserFingerprintContext, BrowserFingerprintGenerator, type BrowserOption, BrowserOptionClass, type BrowserProxy, BrowserProxyClass, type BrowserScreen, BrowserUseAgent, type BrowserViewport, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, ClearContextRequest, ClearContextResponse, ClearContextResponseBody, Client, Code, Command, Computer, ComputerUseAgent, type Config, Context, type ContextInfoResult, ContextManager, ContextService, type ContextStatusData, type ContextStatusItem, ContextSync, type ContextSyncResult, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest, CreateSessionParams, type CreateSessionParamsConfig, DeleteContextFileRequest, DeleteContextFileResponse, DeleteContextFileResponseBody, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DeletePolicy, type DeleteResult, DeleteSessionAsyncRequest, DeleteSessionAsyncResponse, DeleteSessionAsyncResponseBody, DescribeContextFilesRequest, DescribeContextFilesResponse, DescribeContextFilesResponseBody, type DirectoryEntry, type DirectoryListResult, type DownloadPolicy, DownloadStrategy, type ExecutionResult, Extension, ExtensionOption, ExtensionsService, type ExtraConfigs, type ExtraProperties, type ExtractOptions, type ExtractPolicy, ExtractPolicyClass, type FileChangeEvent, FileChangeEventHelper, type FileChangeResult, FileChangeResultHelper, type FileContentResult, FileError, type FileInfo, type FileInfoResult, type FileSearchResult, FileSystem, type Fingerprint, FingerprintFormat, GetAdbLinkRequest, GetAdbLinkResponse, GetAdbLinkResponseBody, GetAdbLinkResponseBodyData, GetAndLoadInternalContextRequest, GetAndLoadInternalContextResponse, GetAndLoadInternalContextResponseBody, GetAndLoadInternalContextResponseBodyData, GetCdpLinkRequest, GetCdpLinkResponse, GetCdpLinkResponseBody, GetCdpLinkResponseBodyData, GetContextFileDownloadUrlRequest, GetContextFileDownloadUrlResponse, GetContextFileDownloadUrlResponseBody, GetContextFileUploadUrlRequest, GetContextFileUploadUrlResponse, GetContextFileUploadUrlResponseBody, GetContextInfoRequest, GetContextInfoResponse, GetContextInfoResponseBody, GetContextInfoResponseBodyData, GetContextRequest, GetContextResponse, GetContextResponseBody, GetContextResponseBodyData, GetLabelRequest, GetLabelResponse, GetLabelResponseBody, GetLabelResponseBodyData, GetLinkRequest, GetLinkResponse, GetLinkResponseBody, GetLinkResponseBodyData, GetMcpResourceRequest, GetMcpResourceResponse, GetMcpResourceResponseBody, GetMcpResourceResponseBodyData, GetMcpResourceResponseBodyDataDesktopInfo, GetSessionDetailRequest, GetSessionDetailResponse, GetSessionDetailResponseBody, GetSessionDetailResponseBodyData, GetSessionRequest, GetSessionResponse, GetSessionResponseBody, GetSessionResponseBodyData, HIDE_NAVIGATION_BAR_TEMPLATE, IS_RELEASE, InitBrowserRequest, InitBrowserResponse, InitBrowserResponseBody, InitBrowserResponseBodyData, type InitializationResult, Lifecycle, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, type LogLevel, type LoggerConfig, MOBILE_COMMAND_TEMPLATES, type MappingPolicy, type McpSession, type McpToolResult, Mobile, type MobileExtraConfig, type MobileSimulateConfig, MobileSimulateMode, MobileSimulateService, type MobileSimulateUploadResult, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type MultipleFileContentResult, type NavigatorFingerprint, type ObserveOptions, ObserveResult, Oss, OssError, PauseSessionAsyncRequest, PauseSessionAsyncResponse, PauseSessionAsyncResponseBody, type QueryResult, RESOLUTION_LOCK_TEMPLATE, type RecyclePolicy, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, ResumeSessionAsyncRequest, ResumeSessionAsyncResponse, ResumeSessionAsyncResponseBody, SHOW_NAVIGATION_BAR_TEMPLATE, type ScreenFingerprint, Session, SessionError, type SessionInterface, type SessionListResult, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, type SyncCallback, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UNINSTALL_BLACKLIST_TEMPLATE, UploadMode, type UploadPolicy, UploadStrategy, type UserAgentData, VERSION, type VideoCard, type WhiteList, WhiteListValidator, createListSessionParams, extraConfigsFromJSON, extraConfigsToJSON, extractRequestId, getLogLevel, getMobileCommandTemplate, hasMobileCommandTemplate, log, logDebug, logError, logInfo, logWarn, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newExtractPolicy, newMappingPolicy, newRecyclePolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy, replaceTemplatePlaceholders, setLogLevel, setupLogger, validateAppManagerRule, validateExtraConfigs, validateMobileExtraConfig, validateMobileSimulateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -309,6 +309,24 @@ interface FileContentResult extends ApiResponse {
|
|
|
309
309
|
/** Optional error message if the operation failed */
|
|
310
310
|
errorMessage?: string;
|
|
311
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Interface for binary file content operation responses
|
|
314
|
+
* Corresponds to Python's BinaryFileContentResult type
|
|
315
|
+
*/
|
|
316
|
+
interface BinaryFileContentResult extends ApiResponse {
|
|
317
|
+
/** Request identifier for tracking API calls */
|
|
318
|
+
requestId: string;
|
|
319
|
+
/** Whether the operation was successful */
|
|
320
|
+
success: boolean;
|
|
321
|
+
/** Binary file content */
|
|
322
|
+
content: Uint8Array;
|
|
323
|
+
/** Optional error message if the operation failed */
|
|
324
|
+
errorMessage?: string;
|
|
325
|
+
/** Optional MIME type of the file */
|
|
326
|
+
contentType?: string;
|
|
327
|
+
/** Optional size of the file in bytes */
|
|
328
|
+
size?: number;
|
|
329
|
+
}
|
|
312
330
|
/**
|
|
313
331
|
* Interface for multiple file content operation responses
|
|
314
332
|
* Corresponds to Python's MultipleFileContentResult type
|
|
@@ -5278,7 +5296,8 @@ declare class FileSystem {
|
|
|
5278
5296
|
* @param path - Path to the file to read.
|
|
5279
5297
|
* @param offset - Optional: Byte offset to start reading from (0-based).
|
|
5280
5298
|
* @param length - Optional: Number of bytes to read. If 0, reads the entire file from offset.
|
|
5281
|
-
* @
|
|
5299
|
+
* @param formatType - Optional: Format to read the file in. "text" (default) or "binary".
|
|
5300
|
+
* @returns FileContentResult for text format, BinaryFileContentResult for binary format
|
|
5282
5301
|
*/
|
|
5283
5302
|
private readFileChunk;
|
|
5284
5303
|
/**
|
|
@@ -5342,7 +5361,7 @@ declare class FileSystem {
|
|
|
5342
5361
|
* @returns FileContentResult with complete file content and requestId
|
|
5343
5362
|
*/
|
|
5344
5363
|
/**
|
|
5345
|
-
* Reads the entire content of a file.
|
|
5364
|
+
* Reads the entire content of a file (text format, default).
|
|
5346
5365
|
*
|
|
5347
5366
|
* @param path - Absolute path to the file to read.
|
|
5348
5367
|
*
|
|
@@ -5352,8 +5371,6 @@ declare class FileSystem {
|
|
|
5352
5371
|
* - requestId: Unique identifier for this API request
|
|
5353
5372
|
* - errorMessage: Error description if read failed
|
|
5354
5373
|
*
|
|
5355
|
-
* @throws Error if the API call fails.
|
|
5356
|
-
*
|
|
5357
5374
|
* @example
|
|
5358
5375
|
* ```typescript
|
|
5359
5376
|
* import { AgentBay } from 'wuying-agentbay-sdk';
|
|
@@ -5364,11 +5381,65 @@ declare class FileSystem {
|
|
|
5364
5381
|
* if (result.success) {
|
|
5365
5382
|
* const session = result.session;
|
|
5366
5383
|
*
|
|
5367
|
-
* // Read a text file
|
|
5384
|
+
* // Read a text file (default)
|
|
5368
5385
|
* const fileResult = await session.fileSystem.readFile('/etc/hostname');
|
|
5369
5386
|
* if (fileResult.success) {
|
|
5370
5387
|
* console.log(`Content: ${fileResult.content}`);
|
|
5371
|
-
*
|
|
5388
|
+
* }
|
|
5389
|
+
*
|
|
5390
|
+
* await session.delete();
|
|
5391
|
+
* }
|
|
5392
|
+
* ```
|
|
5393
|
+
*/
|
|
5394
|
+
readFile(path: string): Promise<FileContentResult>;
|
|
5395
|
+
/**
|
|
5396
|
+
* Reads the entire content of a file with explicit text format.
|
|
5397
|
+
*
|
|
5398
|
+
* @param path - Absolute path to the file to read.
|
|
5399
|
+
* @param opts - Options object with format set to "text".
|
|
5400
|
+
*
|
|
5401
|
+
* @returns Promise resolving to FileContentResult containing:
|
|
5402
|
+
* - success: Whether the read operation succeeded
|
|
5403
|
+
* - content: String content of the file
|
|
5404
|
+
* - requestId: Unique identifier for this API request
|
|
5405
|
+
* - errorMessage: Error description if read failed
|
|
5406
|
+
*
|
|
5407
|
+
* @example
|
|
5408
|
+
* ```typescript
|
|
5409
|
+
* const fileResult = await session.fileSystem.readFile('/tmp/test.txt', { format: 'text' });
|
|
5410
|
+
* ```
|
|
5411
|
+
*/
|
|
5412
|
+
readFile(path: string, opts: {
|
|
5413
|
+
format: "text";
|
|
5414
|
+
}): Promise<FileContentResult>;
|
|
5415
|
+
/**
|
|
5416
|
+
* Reads the entire content of a file in binary format.
|
|
5417
|
+
*
|
|
5418
|
+
* @param path - Absolute path to the file to read.
|
|
5419
|
+
* @param opts - Options object with format set to "bytes".
|
|
5420
|
+
*
|
|
5421
|
+
* @returns Promise resolving to BinaryFileContentResult containing:
|
|
5422
|
+
* - success: Whether the read operation succeeded
|
|
5423
|
+
* - content: Uint8Array binary content of the file
|
|
5424
|
+
* - requestId: Unique identifier for this API request
|
|
5425
|
+
* - errorMessage: Error description if read failed
|
|
5426
|
+
* - contentType: Optional MIME type of the file
|
|
5427
|
+
* - size: Optional size of the file in bytes
|
|
5428
|
+
*
|
|
5429
|
+
* @example
|
|
5430
|
+
* ```typescript
|
|
5431
|
+
* import { AgentBay } from 'wuying-agentbay-sdk';
|
|
5432
|
+
*
|
|
5433
|
+
* const agentBay = new AgentBay({ apiKey: 'your_api_key' });
|
|
5434
|
+
* const result = await agentBay.create();
|
|
5435
|
+
*
|
|
5436
|
+
* if (result.success) {
|
|
5437
|
+
* const session = result.session;
|
|
5438
|
+
*
|
|
5439
|
+
* // Read a binary file
|
|
5440
|
+
* const binaryResult = await session.fileSystem.readFile('/tmp/image.png', { format: 'bytes' });
|
|
5441
|
+
* if (binaryResult.success) {
|
|
5442
|
+
* console.log(`File size: ${binaryResult.content.length} bytes`);
|
|
5372
5443
|
* }
|
|
5373
5444
|
*
|
|
5374
5445
|
* await session.delete();
|
|
@@ -5378,13 +5449,13 @@ declare class FileSystem {
|
|
|
5378
5449
|
* @remarks
|
|
5379
5450
|
* **Behavior:**
|
|
5380
5451
|
* - Automatically handles large files by reading in 60KB chunks
|
|
5381
|
-
* - Returns empty
|
|
5452
|
+
* - Returns empty Uint8Array for empty files
|
|
5382
5453
|
* - Fails if path is a directory or doesn't exist
|
|
5383
|
-
* - Content is returned as
|
|
5384
|
-
*
|
|
5385
|
-
* @see {@link writeFile}, {@link listDirectory}
|
|
5454
|
+
* - Content is returned as Uint8Array (backend uses base64 encoding internally)
|
|
5386
5455
|
*/
|
|
5387
|
-
readFile(path: string
|
|
5456
|
+
readFile(path: string, opts: {
|
|
5457
|
+
format: "bytes";
|
|
5458
|
+
}): Promise<BinaryFileContentResult>;
|
|
5388
5459
|
/**
|
|
5389
5460
|
* Writes content to a file. Automatically handles large files by chunking.
|
|
5390
5461
|
*
|
|
@@ -7684,4 +7755,4 @@ declare function logWarn(message: string, ...args: any[]): void;
|
|
|
7684
7755
|
*/
|
|
7685
7756
|
declare function logError(message: string, error?: any): void;
|
|
7686
7757
|
|
|
7687
|
-
export { APIError, APP_BLACKLIST_TEMPLATE, APP_WHITELIST_TEMPLATE, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, type AgentOptions, type ApiResponse, type ApiResponseWithData, type AppManagerRule, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, type Brand, Browser, BrowserAgent, BrowserContext, BrowserError, type BrowserFingerprint, BrowserFingerprintContext, BrowserFingerprintGenerator, type BrowserOption, BrowserOptionClass, type BrowserProxy, BrowserProxyClass, type BrowserScreen, BrowserUseAgent, type BrowserViewport, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, ClearContextRequest, ClearContextResponse, ClearContextResponseBody, Client, Code, Command, Computer, ComputerUseAgent, type Config, Context, type ContextInfoResult, ContextManager, ContextService, type ContextStatusData, type ContextStatusItem, ContextSync, type ContextSyncResult, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest, CreateSessionParams, type CreateSessionParamsConfig, DeleteContextFileRequest, DeleteContextFileResponse, DeleteContextFileResponseBody, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DeletePolicy, type DeleteResult, DeleteSessionAsyncRequest, DeleteSessionAsyncResponse, DeleteSessionAsyncResponseBody, DescribeContextFilesRequest, DescribeContextFilesResponse, DescribeContextFilesResponseBody, type DirectoryEntry, type DownloadPolicy, DownloadStrategy, type ExecutionResult, Extension, ExtensionOption, ExtensionsService, type ExtraConfigs, type ExtraProperties, type ExtractOptions, type ExtractPolicy, ExtractPolicyClass, type FileChangeEvent, FileChangeEventHelper, type FileChangeResult, FileChangeResultHelper, FileError, type FileInfo, FileSystem, type Fingerprint, FingerprintFormat, GetAdbLinkRequest, GetAdbLinkResponse, GetAdbLinkResponseBody, GetAdbLinkResponseBodyData, GetAndLoadInternalContextRequest, GetAndLoadInternalContextResponse, GetAndLoadInternalContextResponseBody, GetAndLoadInternalContextResponseBodyData, GetCdpLinkRequest, GetCdpLinkResponse, GetCdpLinkResponseBody, GetCdpLinkResponseBodyData, GetContextFileDownloadUrlRequest, GetContextFileDownloadUrlResponse, GetContextFileDownloadUrlResponseBody, GetContextFileUploadUrlRequest, GetContextFileUploadUrlResponse, GetContextFileUploadUrlResponseBody, GetContextInfoRequest, GetContextInfoResponse, GetContextInfoResponseBody, GetContextInfoResponseBodyData, GetContextRequest, GetContextResponse, GetContextResponseBody, GetContextResponseBodyData, GetLabelRequest, GetLabelResponse, GetLabelResponseBody, GetLabelResponseBodyData, GetLinkRequest, GetLinkResponse, GetLinkResponseBody, GetLinkResponseBodyData, GetMcpResourceRequest, GetMcpResourceResponse, GetMcpResourceResponseBody, GetMcpResourceResponseBodyData, GetMcpResourceResponseBodyDataDesktopInfo, GetSessionDetailRequest, GetSessionDetailResponse, GetSessionDetailResponseBody, GetSessionDetailResponseBodyData, GetSessionRequest, GetSessionResponse, GetSessionResponseBody, GetSessionResponseBodyData, HIDE_NAVIGATION_BAR_TEMPLATE, IS_RELEASE, InitBrowserRequest, InitBrowserResponse, InitBrowserResponseBody, InitBrowserResponseBodyData, type InitializationResult, Lifecycle, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, type LogLevel, type LoggerConfig, MOBILE_COMMAND_TEMPLATES, type MappingPolicy, type McpSession, type McpToolResult, Mobile, type MobileExtraConfig, type MobileSimulateConfig, MobileSimulateMode, MobileSimulateService, type MobileSimulateUploadResult, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type NavigatorFingerprint, type ObserveOptions, ObserveResult, Oss, OssError, PauseSessionAsyncRequest, PauseSessionAsyncResponse, PauseSessionAsyncResponseBody, type QueryResult, RESOLUTION_LOCK_TEMPLATE, type RecyclePolicy, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, ResumeSessionAsyncRequest, ResumeSessionAsyncResponse, ResumeSessionAsyncResponseBody, SHOW_NAVIGATION_BAR_TEMPLATE, type ScreenFingerprint, Session, SessionError, type SessionInterface, type SessionListResult, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, type SyncCallback, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UNINSTALL_BLACKLIST_TEMPLATE, UploadMode, type UploadPolicy, UploadStrategy, type UserAgentData, VERSION, type VideoCard, type WhiteList, WhiteListValidator, createListSessionParams, extraConfigsFromJSON, extraConfigsToJSON, extractRequestId, getLogLevel, getMobileCommandTemplate, hasMobileCommandTemplate, log, logDebug, logError, logInfo, logWarn, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newExtractPolicy, newMappingPolicy, newRecyclePolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy, replaceTemplatePlaceholders, setLogLevel, setupLogger, validateAppManagerRule, validateExtraConfigs, validateMobileExtraConfig, validateMobileSimulateConfig };
|
|
7758
|
+
export { APIError, APP_BLACKLIST_TEMPLATE, APP_WHITELIST_TEMPLATE, type ActOptions, ActResult, Agent, AgentBay, AgentBayError, type AgentOptions, type ApiResponse, type ApiResponseWithData, type AppManagerRule, ApplyMqttTokenRequest, ApplyMqttTokenResponse, ApplyMqttTokenResponseBody, ApplyMqttTokenResponseBodyData, AuthenticationError, type BWList, type BinaryFileContentResult, type Brand, Browser, BrowserAgent, BrowserContext, BrowserError, type BrowserFingerprint, BrowserFingerprintContext, BrowserFingerprintGenerator, type BrowserOption, BrowserOptionClass, type BrowserProxy, BrowserProxyClass, type BrowserScreen, BrowserUseAgent, type BrowserViewport, CallMcpToolRequest, CallMcpToolResponse, CallMcpToolResponseBody, ClearContextRequest, ClearContextResponse, ClearContextResponseBody, Client, Code, Command, Computer, ComputerUseAgent, type Config, Context, type ContextInfoResult, ContextManager, ContextService, type ContextStatusData, type ContextStatusItem, ContextSync, type ContextSyncResult, CreateMcpSessionRequest, CreateMcpSessionRequestPersistenceDataList, CreateMcpSessionResponse, CreateMcpSessionResponseBody, CreateMcpSessionResponseBodyData, CreateMcpSessionShrinkRequest, CreateSessionParams, type CreateSessionParamsConfig, DeleteContextFileRequest, DeleteContextFileResponse, DeleteContextFileResponseBody, DeleteContextRequest, DeleteContextResponse, DeleteContextResponseBody, type DeletePolicy, type DeleteResult, DeleteSessionAsyncRequest, DeleteSessionAsyncResponse, DeleteSessionAsyncResponseBody, DescribeContextFilesRequest, DescribeContextFilesResponse, DescribeContextFilesResponseBody, type DirectoryEntry, type DirectoryListResult, type DownloadPolicy, DownloadStrategy, type ExecutionResult, Extension, ExtensionOption, ExtensionsService, type ExtraConfigs, type ExtraProperties, type ExtractOptions, type ExtractPolicy, ExtractPolicyClass, type FileChangeEvent, FileChangeEventHelper, type FileChangeResult, FileChangeResultHelper, type FileContentResult, FileError, type FileInfo, type FileInfoResult, type FileSearchResult, FileSystem, type Fingerprint, FingerprintFormat, GetAdbLinkRequest, GetAdbLinkResponse, GetAdbLinkResponseBody, GetAdbLinkResponseBodyData, GetAndLoadInternalContextRequest, GetAndLoadInternalContextResponse, GetAndLoadInternalContextResponseBody, GetAndLoadInternalContextResponseBodyData, GetCdpLinkRequest, GetCdpLinkResponse, GetCdpLinkResponseBody, GetCdpLinkResponseBodyData, GetContextFileDownloadUrlRequest, GetContextFileDownloadUrlResponse, GetContextFileDownloadUrlResponseBody, GetContextFileUploadUrlRequest, GetContextFileUploadUrlResponse, GetContextFileUploadUrlResponseBody, GetContextInfoRequest, GetContextInfoResponse, GetContextInfoResponseBody, GetContextInfoResponseBodyData, GetContextRequest, GetContextResponse, GetContextResponseBody, GetContextResponseBodyData, GetLabelRequest, GetLabelResponse, GetLabelResponseBody, GetLabelResponseBodyData, GetLinkRequest, GetLinkResponse, GetLinkResponseBody, GetLinkResponseBodyData, GetMcpResourceRequest, GetMcpResourceResponse, GetMcpResourceResponseBody, GetMcpResourceResponseBodyData, GetMcpResourceResponseBodyDataDesktopInfo, GetSessionDetailRequest, GetSessionDetailResponse, GetSessionDetailResponseBody, GetSessionDetailResponseBodyData, GetSessionRequest, GetSessionResponse, GetSessionResponseBody, GetSessionResponseBodyData, HIDE_NAVIGATION_BAR_TEMPLATE, IS_RELEASE, InitBrowserRequest, InitBrowserResponse, InitBrowserResponseBody, InitBrowserResponseBodyData, type InitializationResult, Lifecycle, ListContextsRequest, ListContextsResponse, ListContextsResponseBody, ListContextsResponseBodyData, ListMcpToolsRequest, ListMcpToolsResponse, ListMcpToolsResponseBody, type ListSessionParams, ListSessionRequest, ListSessionResponse, ListSessionResponseBody, ListSessionResponseBodyData, type LogLevel, type LoggerConfig, MOBILE_COMMAND_TEMPLATES, type MappingPolicy, type McpSession, type McpToolResult, Mobile, type MobileExtraConfig, type MobileSimulateConfig, MobileSimulateMode, MobileSimulateService, type MobileSimulateUploadResult, ModifyContextRequest, ModifyContextResponse, ModifyContextResponseBody, type MultipleFileContentResult, type NavigatorFingerprint, type ObserveOptions, ObserveResult, Oss, OssError, PauseSessionAsyncRequest, PauseSessionAsyncResponse, PauseSessionAsyncResponseBody, type QueryResult, RESOLUTION_LOCK_TEMPLATE, type RecyclePolicy, ReleaseMcpSessionRequest, ReleaseMcpSessionResponse, ReleaseMcpSessionResponseBody, ResumeSessionAsyncRequest, ResumeSessionAsyncResponse, ResumeSessionAsyncResponseBody, SHOW_NAVIGATION_BAR_TEMPLATE, type ScreenFingerprint, Session, SessionError, type SessionInterface, type SessionListResult, SetLabelRequest, SetLabelResponse, SetLabelResponseBody, type SyncCallback, SyncContextRequest, SyncContextResponse, SyncContextResponseBody, type SyncPolicy, SyncPolicyImpl, UNINSTALL_BLACKLIST_TEMPLATE, UploadMode, type UploadPolicy, UploadStrategy, type UserAgentData, VERSION, type VideoCard, type WhiteList, WhiteListValidator, createListSessionParams, extraConfigsFromJSON, extraConfigsToJSON, extractRequestId, getLogLevel, getMobileCommandTemplate, hasMobileCommandTemplate, log, logDebug, logError, logInfo, logWarn, newContextManager, newContextSync, newCreateSessionParams, newDeletePolicy, newDownloadPolicy, newExtractPolicy, newMappingPolicy, newRecyclePolicy, newSyncPolicy, newSyncPolicyWithDefaults, newUploadPolicy, replaceTemplatePlaceholders, setLogLevel, setupLogger, validateAppManagerRule, validateExtraConfigs, validateMobileExtraConfig, validateMobileSimulateConfig };
|