@airtop/sdk 1.0.0-alpha2.40 → 1.0.0-alpha2.42
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 +80 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -4
- package/dist/index.d.ts +27 -4
- package/dist/index.js +80 -26
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ export { index_js as AirtopCore };
|
|
|
4
4
|
export { AIPromptResponse, ScrapeResponse } from '@airtop/core/resources/index.js';
|
|
5
5
|
import * as _airtop_core_resources_shared_mjs from '@airtop/core/resources/shared.mjs';
|
|
6
6
|
export { _airtop_core_resources_shared_mjs as AirtopCoreShared };
|
|
7
|
-
import { WindowClickParams, WindowHoverParams, WindowLoadURLParams, WindowMonitorParams, WindowPageQueryParams, WindowPaginatedExtractionParams, WindowScrapeParams, WindowScreenshotParams, WindowScrollParams, WindowTypeParams, WindowExtractParams, WindowActParams, WindowLlmParams, WindowFindOneParams, WindowFindManyParams, WindowWaitForPageParams, WindowNavigateParams, WindowFillFormParams } from '@airtop/core/resources/windows.js';
|
|
7
|
+
import { WindowClickParams, WindowHoverParams, WindowLoadURLParams, WindowMonitorParams, WindowPageQueryParams, WindowPaginatedExtractionParams, WindowScrapeParams, WindowScreenshotParams, WindowScrollParams, WindowTypeParams, WindowExtractParams, WindowActParams, WindowLlmParams, WindowFindOneParams, WindowFindManyParams, WindowWaitForPageParams, WindowNavigateParams, WindowFillFormParams, WindowComputerUseParams } from '@airtop/core/resources/windows.js';
|
|
8
8
|
import * as windows_js from '@airtop/core/resources/windows.js';
|
|
9
9
|
export { windows_js as AirtopCoreWindows };
|
|
10
10
|
export { WindowActParams, WindowClickParams, WindowExtractParams, WindowFillFormParams, WindowFindManyParams, WindowFindOneParams, WindowGetParams, WindowHoverParams, WindowLlmParams, WindowLoadURLParams, WindowMonitorParams, WindowNavigateParams, WindowPageQueryParams, WindowPaginatedExtractionParams, WindowScrapeParams, WindowScreenshotParams, WindowScrollParams, WindowTypeParams, WindowWaitForPageParams } from '@airtop/core/resources/windows.js';
|
|
@@ -14,7 +14,7 @@ import { AirtopJsonSchemaAdapter } from '@airtop/json-schema-adapter';
|
|
|
14
14
|
export { AirtopJsonSchemaAdapter } from '@airtop/json-schema-adapter';
|
|
15
15
|
import { ILogLayer } from 'loglayer';
|
|
16
16
|
export { ILogLayer } from 'loglayer';
|
|
17
|
-
import { Issue, SessionConfigV1, ListAutomationsOutput, AutomationData, FilesResponse, EnvelopeDefaultMeta, GetFileData, CreateFileData, AirtopPagination, ExternalFile, ServicePromptActionResponseEnvelope, ServicePromptParameters, ExternalSessionWithConnectionInfo, ExtractActionResponseEnvelope, ActActionResponseEnvelope, LlmActionResponseEnvelope, NodeHandle, WaitForPageActionResponseEnvelope, NavigateActionResponseEnvelope, FindOneActionResponseEnvelope, FindManyActionResponseEnvelope, AIPromptResponse as AIPromptResponse$1, WindowIDDataResponse, OperationOutcomeResponse, WindowsResponse } from '@airtop/core/resources/shared.js';
|
|
17
|
+
import { Issue, SessionConfigV1, ListAutomationsOutput, AutomationData, FilesResponse, EnvelopeDefaultMeta, GetFileData, CreateFileData, AirtopPagination, ExternalFile, ServicePromptActionResponseEnvelope, ServicePromptParameters, ExternalSessionWithConnectionInfo, ExtractActionResponseEnvelope, ActActionResponseEnvelope, LlmActionResponseEnvelope, NodeHandle, WaitForPageActionResponseEnvelope, NavigateActionResponseEnvelope, ComputerUseResponseEnvelope, FindOneActionResponseEnvelope, FindManyActionResponseEnvelope, AIPromptResponse as AIPromptResponse$1, WindowIDDataResponse, OperationOutcomeResponse, WindowsResponse } from '@airtop/core/resources/shared.js';
|
|
18
18
|
export { AIResponseEnvelope, ActActionResponseData, AgentInvocationData, AgentVersionData, AirtopPagination, AsyncConfig, AsyncSessionAIResponseEnvelope, BrowserWaitNavigationConfig, ClickConfig, ClientProvidedResponseMetadata, CreateFileData, EnvelopeDefaultMeta, ExternalSessionAIResponseMetadata, ExternalSessionAIResponseMetadataUsage, ExternalSessionConfig, ExternalSessionWithConnectionInfo, ExtractActionResponseData, FindManyActionResponseData, FindOneActionResponseData, GetFileData, IntervalMonitorConfig, Issue, LlmActionResponseData, MonitorConfig, NavigateActionResponseData, OperationOutcome, OperationOutcomeResponse, PageQueryConfig, PageQueryExperimentalConfig, PaginatedExtractionConfig, ScrapeResponseContent, ScrapeResponseEnvelope, ScrapeResponseOutput, ScreenshotConfig, ScreenshotMetadata, ScreenshotRequestConfig, ScreenshotScrollPosition, ScreenshotViewportDimensions, ScrollByConfig, ScrollToEdgeConfig, ServicePromptActionResponseData, SummaryExperimentalConfig, VisualAnalysisConfig, WaitForPageActionResponseData, WindowIDData, WindowIDDataResponse, WindowInfo, WindowResponse, WindowsResponse, WindowsWithMeta } from '@airtop/core/resources/shared.js';
|
|
19
19
|
import { AutomationUpdateDescriptionParams } from '@airtop/core/resources/automations.js';
|
|
20
20
|
import * as _airtop_core_resources_sessions_mjs from '@airtop/core/resources/sessions.mjs';
|
|
@@ -891,6 +891,17 @@ interface AirtopNodeApiResponseData extends NodeHandle {
|
|
|
891
891
|
*/
|
|
892
892
|
interface WindowFillFormConfig extends Omit<WindowFillFormParams, "sessionId" | "parameters"> {
|
|
893
893
|
}
|
|
894
|
+
/**
|
|
895
|
+
* Configuration parameters for executing a computer use action in a window.
|
|
896
|
+
* Excludes prompt and session ID which are provided separately.
|
|
897
|
+
*/
|
|
898
|
+
interface WindowComputerUseConfig extends Omit<WindowComputerUseParams, "prompt" | "sessionId"> {
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Response from a computer use operation.
|
|
902
|
+
*/
|
|
903
|
+
interface WindowComputerUseResponse extends ComputerUseResponseEnvelope {
|
|
904
|
+
}
|
|
894
905
|
|
|
895
906
|
/**
|
|
896
907
|
* Represents a node in the DOM
|
|
@@ -1139,6 +1150,14 @@ declare class AirtopWindowClient extends AirtopBase {
|
|
|
1139
1150
|
waitForPage(config?: WindowWaitForPageConfig, requestOptions?: AirtopRequestOptions): Promise<WindowWaitForPageResponse>;
|
|
1140
1151
|
navigate(direction: WindowNavigateDirection, config?: WindowNavigateConfig, requestOptions?: AirtopRequestOptions): Promise<WindowNavigateResponse>;
|
|
1141
1152
|
fillForm(formData: string | object, config?: WindowFillFormConfig, requestOptions?: AirtopRequestOptions): Promise<AIPromptResponse>;
|
|
1153
|
+
/**
|
|
1154
|
+
* Executes a computer use action in the window using AI-driven browser automation.
|
|
1155
|
+
* @param prompt - A natural language description of the action to perform
|
|
1156
|
+
* @param config - Configuration options for the computer use action
|
|
1157
|
+
* @param requestOptions - Request options
|
|
1158
|
+
* @returns Promise resolving to the computer use operation result
|
|
1159
|
+
*/
|
|
1160
|
+
computerUse(prompt: string, config?: WindowComputerUseConfig, requestOptions?: AirtopRequestOptions): Promise<WindowComputerUseResponse>;
|
|
1142
1161
|
}
|
|
1143
1162
|
|
|
1144
1163
|
/**
|
|
@@ -1282,8 +1301,12 @@ declare class AirtopSessionClient extends AirtopBase {
|
|
|
1282
1301
|
* Defaults to looking back 5 seconds in the event stream for the file to be available.
|
|
1283
1302
|
* Use `lookbackSeconds` to control this behavior.
|
|
1284
1303
|
*
|
|
1304
|
+
* This method uses a two-phase approach:
|
|
1305
|
+
* - Phase 1 (if lookbackSeconds > 0): Check historical events within the lookback window
|
|
1306
|
+
* - Phase 2: Wait for events from startTime forward until timeout (ensures no gap between phases)
|
|
1307
|
+
*
|
|
1285
1308
|
* @param configuration - The optional configuration parameters for the function
|
|
1286
|
-
* @param configuration.lookbackSeconds - The number of seconds to look back for prior events. Default `5`. 0 means no lookback.
|
|
1309
|
+
* @param configuration.lookbackSeconds - The number of seconds to look back for prior events. Default `5`. 0 means no lookback (only wait for new events).
|
|
1287
1310
|
* @param configuration.fileType - The file type to wait for, such as "browser_download". If provided, only files of this type will be considered.
|
|
1288
1311
|
* @param requestOptions - Optional request configuration including timeout
|
|
1289
1312
|
* @returns Object containing file's id and downloadUrl, or null if timed out
|
|
@@ -1770,4 +1793,4 @@ interface AirtopPluginRegistration {
|
|
|
1770
1793
|
*/
|
|
1771
1794
|
declare function registerAirtopPlugin(plugin: AirtopPluginRegistration): void;
|
|
1772
1795
|
|
|
1773
|
-
export { type AirtopAgentCancelInvocationParams, AirtopAgentClient, type AirtopAgentCreateAgentParams, type AirtopAgentCreateInvocationParams, type AirtopAgentDeleteAgentsParams, type AirtopAgentGetAgentParams, type AirtopAgentGetAgentsParams, type AirtopAgentGetInvocationsParams, type AirtopAgentGetVersionDataParams, type AirtopAgentPublishAgentParams, type AirtopAgentResponse, type AirtopAgentUpdateAgentParams, type AirtopAgentUpdateVersionDataParams, type AirtopAutomationData, type AirtopAutomationListResponse, type AirtopAutomationUpdateDescriptionConfig, AirtopBase, AirtopClient, type AirtopClientPlugin, type AirtopConstructorConfig, type AirtopCreateAgentInvocationResponse, type AirtopCreateAgentResponse, type AirtopCreateNewAgentDraftResponse, type AirtopDeleteAgentsResponse, AirtopError, AirtopFile, AirtopFileClient, type AirtopFileCreateResponse, type AirtopFileGetResponse, type AirtopFileListParams, type AirtopFileListResponse, type AirtopFileListWithInstancesResponse, type AirtopFilesResponse, type AirtopGetAgentInvocationsResponse, type AirtopGetAgentResponse, type AirtopGetAgentVersionDataResponse, type AirtopGetAgentsResponse, AirtopMocks, AirtopNode, type AirtopNodeApiResponseData, AirtopPluginAugmentationType, type AirtopPluginRegistration, type AirtopPluginType, type AirtopProfile, type AirtopPublishNewAgentResponse, type AirtopRequestOptions, AirtopSession, AirtopSessionClient, type AirtopSessionClientPlugin, type AirtopSessionPlugin, type AirtopSessionResponse, type AirtopUpdateAgentResponse, type AirtopUpdateVersionDataResponse, AirtopWindow, AirtopWindowClient, type AirtopWindowClientPlugin, type AirtopWindowCreateResponse, type AirtopWindowGetInfoResponse, type AirtopWindowPlugin, AirtopWindowScreenshot, type AirtopWindowScreenshotPlugin, type AirtopWindowScreenshotResponse, type CommonAirtopConfig, type CommonFileResponse, type CommonResponse, type CommonWindowResponse, type CreateFileConfig, type CreateSessionConfig, type ExtendedServicePromptParameters, type FileCreateData, type FileData, type FileError, type FileListData, type FileMetadata, type FileStatusEvent, type FileWarning, type GetFilesConfig, type GetSessionsConfig, type OutputJsonSchemaConfig, type ScreenshotData, type SessionData, type SessionError, type SessionMetadata, type SessionServiceResponse, type SessionWarning, type WaitForDownloadConfig, type WaitForDownloadResult, type WindowActConfig, type WindowActResponse, type WindowClickConfig, type WindowCreateData, type WindowCreateOptions, type WindowError, type WindowExtractConfig, type WindowExtractResponse, type WindowFillFormConfig, type WindowFindManyConfig, type WindowFindManyResponse, type WindowFindOneConfig, type WindowFindOneResponse, type WindowGetConfig, type WindowHoverConfig, type WindowInfoData, type WindowLlmConfig, type WindowLlmFileContentData, type WindowLlmResponse, type WindowLoadUrlConfig, type WindowMetadata, type WindowMonitorConfig, type WindowNavigateConfig, WindowNavigateDirection, type WindowNavigateResponse, type WindowPageQueryConfig, type WindowPaginatedExtractionConfig, type WindowPromptResponse, type WindowScrapeConfig, type WindowScrapeResponse, type WindowScreenshotConfig, type WindowScrollConfig, type WindowTypeConfig, type WindowWaitForPageConfig, type WindowWaitForPageResponse, type WindowWarning, registerAirtopPlugin };
|
|
1796
|
+
export { type AirtopAgentCancelInvocationParams, AirtopAgentClient, type AirtopAgentCreateAgentParams, type AirtopAgentCreateInvocationParams, type AirtopAgentDeleteAgentsParams, type AirtopAgentGetAgentParams, type AirtopAgentGetAgentsParams, type AirtopAgentGetInvocationsParams, type AirtopAgentGetVersionDataParams, type AirtopAgentPublishAgentParams, type AirtopAgentResponse, type AirtopAgentUpdateAgentParams, type AirtopAgentUpdateVersionDataParams, type AirtopAutomationData, type AirtopAutomationListResponse, type AirtopAutomationUpdateDescriptionConfig, AirtopBase, AirtopClient, type AirtopClientPlugin, type AirtopConstructorConfig, type AirtopCreateAgentInvocationResponse, type AirtopCreateAgentResponse, type AirtopCreateNewAgentDraftResponse, type AirtopDeleteAgentsResponse, AirtopError, AirtopFile, AirtopFileClient, type AirtopFileCreateResponse, type AirtopFileGetResponse, type AirtopFileListParams, type AirtopFileListResponse, type AirtopFileListWithInstancesResponse, type AirtopFilesResponse, type AirtopGetAgentInvocationsResponse, type AirtopGetAgentResponse, type AirtopGetAgentVersionDataResponse, type AirtopGetAgentsResponse, AirtopMocks, AirtopNode, type AirtopNodeApiResponseData, AirtopPluginAugmentationType, type AirtopPluginRegistration, type AirtopPluginType, type AirtopProfile, type AirtopPublishNewAgentResponse, type AirtopRequestOptions, AirtopSession, AirtopSessionClient, type AirtopSessionClientPlugin, type AirtopSessionPlugin, type AirtopSessionResponse, type AirtopUpdateAgentResponse, type AirtopUpdateVersionDataResponse, AirtopWindow, AirtopWindowClient, type AirtopWindowClientPlugin, type AirtopWindowCreateResponse, type AirtopWindowGetInfoResponse, type AirtopWindowPlugin, AirtopWindowScreenshot, type AirtopWindowScreenshotPlugin, type AirtopWindowScreenshotResponse, type CommonAirtopConfig, type CommonFileResponse, type CommonResponse, type CommonWindowResponse, type CreateFileConfig, type CreateSessionConfig, type ExtendedServicePromptParameters, type FileCreateData, type FileData, type FileError, type FileListData, type FileMetadata, type FileStatusEvent, type FileWarning, type GetFilesConfig, type GetSessionsConfig, type OutputJsonSchemaConfig, type ScreenshotData, type SessionData, type SessionError, type SessionMetadata, type SessionServiceResponse, type SessionWarning, type WaitForDownloadConfig, type WaitForDownloadResult, type WindowActConfig, type WindowActResponse, type WindowClickConfig, type WindowComputerUseConfig, type WindowComputerUseResponse, type WindowCreateData, type WindowCreateOptions, type WindowError, type WindowExtractConfig, type WindowExtractResponse, type WindowFillFormConfig, type WindowFindManyConfig, type WindowFindManyResponse, type WindowFindOneConfig, type WindowFindOneResponse, type WindowGetConfig, type WindowHoverConfig, type WindowInfoData, type WindowLlmConfig, type WindowLlmFileContentData, type WindowLlmResponse, type WindowLoadUrlConfig, type WindowMetadata, type WindowMonitorConfig, type WindowNavigateConfig, WindowNavigateDirection, type WindowNavigateResponse, type WindowPageQueryConfig, type WindowPaginatedExtractionConfig, type WindowPromptResponse, type WindowScrapeConfig, type WindowScrapeResponse, type WindowScreenshotConfig, type WindowScrollConfig, type WindowTypeConfig, type WindowWaitForPageConfig, type WindowWaitForPageResponse, type WindowWarning, registerAirtopPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { index_js as AirtopCore };
|
|
|
4
4
|
export { AIPromptResponse, ScrapeResponse } from '@airtop/core/resources/index.js';
|
|
5
5
|
import * as _airtop_core_resources_shared_mjs from '@airtop/core/resources/shared.mjs';
|
|
6
6
|
export { _airtop_core_resources_shared_mjs as AirtopCoreShared };
|
|
7
|
-
import { WindowClickParams, WindowHoverParams, WindowLoadURLParams, WindowMonitorParams, WindowPageQueryParams, WindowPaginatedExtractionParams, WindowScrapeParams, WindowScreenshotParams, WindowScrollParams, WindowTypeParams, WindowExtractParams, WindowActParams, WindowLlmParams, WindowFindOneParams, WindowFindManyParams, WindowWaitForPageParams, WindowNavigateParams, WindowFillFormParams } from '@airtop/core/resources/windows.js';
|
|
7
|
+
import { WindowClickParams, WindowHoverParams, WindowLoadURLParams, WindowMonitorParams, WindowPageQueryParams, WindowPaginatedExtractionParams, WindowScrapeParams, WindowScreenshotParams, WindowScrollParams, WindowTypeParams, WindowExtractParams, WindowActParams, WindowLlmParams, WindowFindOneParams, WindowFindManyParams, WindowWaitForPageParams, WindowNavigateParams, WindowFillFormParams, WindowComputerUseParams } from '@airtop/core/resources/windows.js';
|
|
8
8
|
import * as windows_js from '@airtop/core/resources/windows.js';
|
|
9
9
|
export { windows_js as AirtopCoreWindows };
|
|
10
10
|
export { WindowActParams, WindowClickParams, WindowExtractParams, WindowFillFormParams, WindowFindManyParams, WindowFindOneParams, WindowGetParams, WindowHoverParams, WindowLlmParams, WindowLoadURLParams, WindowMonitorParams, WindowNavigateParams, WindowPageQueryParams, WindowPaginatedExtractionParams, WindowScrapeParams, WindowScreenshotParams, WindowScrollParams, WindowTypeParams, WindowWaitForPageParams } from '@airtop/core/resources/windows.js';
|
|
@@ -14,7 +14,7 @@ import { AirtopJsonSchemaAdapter } from '@airtop/json-schema-adapter';
|
|
|
14
14
|
export { AirtopJsonSchemaAdapter } from '@airtop/json-schema-adapter';
|
|
15
15
|
import { ILogLayer } from 'loglayer';
|
|
16
16
|
export { ILogLayer } from 'loglayer';
|
|
17
|
-
import { Issue, SessionConfigV1, ListAutomationsOutput, AutomationData, FilesResponse, EnvelopeDefaultMeta, GetFileData, CreateFileData, AirtopPagination, ExternalFile, ServicePromptActionResponseEnvelope, ServicePromptParameters, ExternalSessionWithConnectionInfo, ExtractActionResponseEnvelope, ActActionResponseEnvelope, LlmActionResponseEnvelope, NodeHandle, WaitForPageActionResponseEnvelope, NavigateActionResponseEnvelope, FindOneActionResponseEnvelope, FindManyActionResponseEnvelope, AIPromptResponse as AIPromptResponse$1, WindowIDDataResponse, OperationOutcomeResponse, WindowsResponse } from '@airtop/core/resources/shared.js';
|
|
17
|
+
import { Issue, SessionConfigV1, ListAutomationsOutput, AutomationData, FilesResponse, EnvelopeDefaultMeta, GetFileData, CreateFileData, AirtopPagination, ExternalFile, ServicePromptActionResponseEnvelope, ServicePromptParameters, ExternalSessionWithConnectionInfo, ExtractActionResponseEnvelope, ActActionResponseEnvelope, LlmActionResponseEnvelope, NodeHandle, WaitForPageActionResponseEnvelope, NavigateActionResponseEnvelope, ComputerUseResponseEnvelope, FindOneActionResponseEnvelope, FindManyActionResponseEnvelope, AIPromptResponse as AIPromptResponse$1, WindowIDDataResponse, OperationOutcomeResponse, WindowsResponse } from '@airtop/core/resources/shared.js';
|
|
18
18
|
export { AIResponseEnvelope, ActActionResponseData, AgentInvocationData, AgentVersionData, AirtopPagination, AsyncConfig, AsyncSessionAIResponseEnvelope, BrowserWaitNavigationConfig, ClickConfig, ClientProvidedResponseMetadata, CreateFileData, EnvelopeDefaultMeta, ExternalSessionAIResponseMetadata, ExternalSessionAIResponseMetadataUsage, ExternalSessionConfig, ExternalSessionWithConnectionInfo, ExtractActionResponseData, FindManyActionResponseData, FindOneActionResponseData, GetFileData, IntervalMonitorConfig, Issue, LlmActionResponseData, MonitorConfig, NavigateActionResponseData, OperationOutcome, OperationOutcomeResponse, PageQueryConfig, PageQueryExperimentalConfig, PaginatedExtractionConfig, ScrapeResponseContent, ScrapeResponseEnvelope, ScrapeResponseOutput, ScreenshotConfig, ScreenshotMetadata, ScreenshotRequestConfig, ScreenshotScrollPosition, ScreenshotViewportDimensions, ScrollByConfig, ScrollToEdgeConfig, ServicePromptActionResponseData, SummaryExperimentalConfig, VisualAnalysisConfig, WaitForPageActionResponseData, WindowIDData, WindowIDDataResponse, WindowInfo, WindowResponse, WindowsResponse, WindowsWithMeta } from '@airtop/core/resources/shared.js';
|
|
19
19
|
import { AutomationUpdateDescriptionParams } from '@airtop/core/resources/automations.js';
|
|
20
20
|
import * as _airtop_core_resources_sessions_mjs from '@airtop/core/resources/sessions.mjs';
|
|
@@ -891,6 +891,17 @@ interface AirtopNodeApiResponseData extends NodeHandle {
|
|
|
891
891
|
*/
|
|
892
892
|
interface WindowFillFormConfig extends Omit<WindowFillFormParams, "sessionId" | "parameters"> {
|
|
893
893
|
}
|
|
894
|
+
/**
|
|
895
|
+
* Configuration parameters for executing a computer use action in a window.
|
|
896
|
+
* Excludes prompt and session ID which are provided separately.
|
|
897
|
+
*/
|
|
898
|
+
interface WindowComputerUseConfig extends Omit<WindowComputerUseParams, "prompt" | "sessionId"> {
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Response from a computer use operation.
|
|
902
|
+
*/
|
|
903
|
+
interface WindowComputerUseResponse extends ComputerUseResponseEnvelope {
|
|
904
|
+
}
|
|
894
905
|
|
|
895
906
|
/**
|
|
896
907
|
* Represents a node in the DOM
|
|
@@ -1139,6 +1150,14 @@ declare class AirtopWindowClient extends AirtopBase {
|
|
|
1139
1150
|
waitForPage(config?: WindowWaitForPageConfig, requestOptions?: AirtopRequestOptions): Promise<WindowWaitForPageResponse>;
|
|
1140
1151
|
navigate(direction: WindowNavigateDirection, config?: WindowNavigateConfig, requestOptions?: AirtopRequestOptions): Promise<WindowNavigateResponse>;
|
|
1141
1152
|
fillForm(formData: string | object, config?: WindowFillFormConfig, requestOptions?: AirtopRequestOptions): Promise<AIPromptResponse>;
|
|
1153
|
+
/**
|
|
1154
|
+
* Executes a computer use action in the window using AI-driven browser automation.
|
|
1155
|
+
* @param prompt - A natural language description of the action to perform
|
|
1156
|
+
* @param config - Configuration options for the computer use action
|
|
1157
|
+
* @param requestOptions - Request options
|
|
1158
|
+
* @returns Promise resolving to the computer use operation result
|
|
1159
|
+
*/
|
|
1160
|
+
computerUse(prompt: string, config?: WindowComputerUseConfig, requestOptions?: AirtopRequestOptions): Promise<WindowComputerUseResponse>;
|
|
1142
1161
|
}
|
|
1143
1162
|
|
|
1144
1163
|
/**
|
|
@@ -1282,8 +1301,12 @@ declare class AirtopSessionClient extends AirtopBase {
|
|
|
1282
1301
|
* Defaults to looking back 5 seconds in the event stream for the file to be available.
|
|
1283
1302
|
* Use `lookbackSeconds` to control this behavior.
|
|
1284
1303
|
*
|
|
1304
|
+
* This method uses a two-phase approach:
|
|
1305
|
+
* - Phase 1 (if lookbackSeconds > 0): Check historical events within the lookback window
|
|
1306
|
+
* - Phase 2: Wait for events from startTime forward until timeout (ensures no gap between phases)
|
|
1307
|
+
*
|
|
1285
1308
|
* @param configuration - The optional configuration parameters for the function
|
|
1286
|
-
* @param configuration.lookbackSeconds - The number of seconds to look back for prior events. Default `5`. 0 means no lookback.
|
|
1309
|
+
* @param configuration.lookbackSeconds - The number of seconds to look back for prior events. Default `5`. 0 means no lookback (only wait for new events).
|
|
1287
1310
|
* @param configuration.fileType - The file type to wait for, such as "browser_download". If provided, only files of this type will be considered.
|
|
1288
1311
|
* @param requestOptions - Optional request configuration including timeout
|
|
1289
1312
|
* @returns Object containing file's id and downloadUrl, or null if timed out
|
|
@@ -1770,4 +1793,4 @@ interface AirtopPluginRegistration {
|
|
|
1770
1793
|
*/
|
|
1771
1794
|
declare function registerAirtopPlugin(plugin: AirtopPluginRegistration): void;
|
|
1772
1795
|
|
|
1773
|
-
export { type AirtopAgentCancelInvocationParams, AirtopAgentClient, type AirtopAgentCreateAgentParams, type AirtopAgentCreateInvocationParams, type AirtopAgentDeleteAgentsParams, type AirtopAgentGetAgentParams, type AirtopAgentGetAgentsParams, type AirtopAgentGetInvocationsParams, type AirtopAgentGetVersionDataParams, type AirtopAgentPublishAgentParams, type AirtopAgentResponse, type AirtopAgentUpdateAgentParams, type AirtopAgentUpdateVersionDataParams, type AirtopAutomationData, type AirtopAutomationListResponse, type AirtopAutomationUpdateDescriptionConfig, AirtopBase, AirtopClient, type AirtopClientPlugin, type AirtopConstructorConfig, type AirtopCreateAgentInvocationResponse, type AirtopCreateAgentResponse, type AirtopCreateNewAgentDraftResponse, type AirtopDeleteAgentsResponse, AirtopError, AirtopFile, AirtopFileClient, type AirtopFileCreateResponse, type AirtopFileGetResponse, type AirtopFileListParams, type AirtopFileListResponse, type AirtopFileListWithInstancesResponse, type AirtopFilesResponse, type AirtopGetAgentInvocationsResponse, type AirtopGetAgentResponse, type AirtopGetAgentVersionDataResponse, type AirtopGetAgentsResponse, AirtopMocks, AirtopNode, type AirtopNodeApiResponseData, AirtopPluginAugmentationType, type AirtopPluginRegistration, type AirtopPluginType, type AirtopProfile, type AirtopPublishNewAgentResponse, type AirtopRequestOptions, AirtopSession, AirtopSessionClient, type AirtopSessionClientPlugin, type AirtopSessionPlugin, type AirtopSessionResponse, type AirtopUpdateAgentResponse, type AirtopUpdateVersionDataResponse, AirtopWindow, AirtopWindowClient, type AirtopWindowClientPlugin, type AirtopWindowCreateResponse, type AirtopWindowGetInfoResponse, type AirtopWindowPlugin, AirtopWindowScreenshot, type AirtopWindowScreenshotPlugin, type AirtopWindowScreenshotResponse, type CommonAirtopConfig, type CommonFileResponse, type CommonResponse, type CommonWindowResponse, type CreateFileConfig, type CreateSessionConfig, type ExtendedServicePromptParameters, type FileCreateData, type FileData, type FileError, type FileListData, type FileMetadata, type FileStatusEvent, type FileWarning, type GetFilesConfig, type GetSessionsConfig, type OutputJsonSchemaConfig, type ScreenshotData, type SessionData, type SessionError, type SessionMetadata, type SessionServiceResponse, type SessionWarning, type WaitForDownloadConfig, type WaitForDownloadResult, type WindowActConfig, type WindowActResponse, type WindowClickConfig, type WindowCreateData, type WindowCreateOptions, type WindowError, type WindowExtractConfig, type WindowExtractResponse, type WindowFillFormConfig, type WindowFindManyConfig, type WindowFindManyResponse, type WindowFindOneConfig, type WindowFindOneResponse, type WindowGetConfig, type WindowHoverConfig, type WindowInfoData, type WindowLlmConfig, type WindowLlmFileContentData, type WindowLlmResponse, type WindowLoadUrlConfig, type WindowMetadata, type WindowMonitorConfig, type WindowNavigateConfig, WindowNavigateDirection, type WindowNavigateResponse, type WindowPageQueryConfig, type WindowPaginatedExtractionConfig, type WindowPromptResponse, type WindowScrapeConfig, type WindowScrapeResponse, type WindowScreenshotConfig, type WindowScrollConfig, type WindowTypeConfig, type WindowWaitForPageConfig, type WindowWaitForPageResponse, type WindowWarning, registerAirtopPlugin };
|
|
1796
|
+
export { type AirtopAgentCancelInvocationParams, AirtopAgentClient, type AirtopAgentCreateAgentParams, type AirtopAgentCreateInvocationParams, type AirtopAgentDeleteAgentsParams, type AirtopAgentGetAgentParams, type AirtopAgentGetAgentsParams, type AirtopAgentGetInvocationsParams, type AirtopAgentGetVersionDataParams, type AirtopAgentPublishAgentParams, type AirtopAgentResponse, type AirtopAgentUpdateAgentParams, type AirtopAgentUpdateVersionDataParams, type AirtopAutomationData, type AirtopAutomationListResponse, type AirtopAutomationUpdateDescriptionConfig, AirtopBase, AirtopClient, type AirtopClientPlugin, type AirtopConstructorConfig, type AirtopCreateAgentInvocationResponse, type AirtopCreateAgentResponse, type AirtopCreateNewAgentDraftResponse, type AirtopDeleteAgentsResponse, AirtopError, AirtopFile, AirtopFileClient, type AirtopFileCreateResponse, type AirtopFileGetResponse, type AirtopFileListParams, type AirtopFileListResponse, type AirtopFileListWithInstancesResponse, type AirtopFilesResponse, type AirtopGetAgentInvocationsResponse, type AirtopGetAgentResponse, type AirtopGetAgentVersionDataResponse, type AirtopGetAgentsResponse, AirtopMocks, AirtopNode, type AirtopNodeApiResponseData, AirtopPluginAugmentationType, type AirtopPluginRegistration, type AirtopPluginType, type AirtopProfile, type AirtopPublishNewAgentResponse, type AirtopRequestOptions, AirtopSession, AirtopSessionClient, type AirtopSessionClientPlugin, type AirtopSessionPlugin, type AirtopSessionResponse, type AirtopUpdateAgentResponse, type AirtopUpdateVersionDataResponse, AirtopWindow, AirtopWindowClient, type AirtopWindowClientPlugin, type AirtopWindowCreateResponse, type AirtopWindowGetInfoResponse, type AirtopWindowPlugin, AirtopWindowScreenshot, type AirtopWindowScreenshotPlugin, type AirtopWindowScreenshotResponse, type CommonAirtopConfig, type CommonFileResponse, type CommonResponse, type CommonWindowResponse, type CreateFileConfig, type CreateSessionConfig, type ExtendedServicePromptParameters, type FileCreateData, type FileData, type FileError, type FileListData, type FileMetadata, type FileStatusEvent, type FileWarning, type GetFilesConfig, type GetSessionsConfig, type OutputJsonSchemaConfig, type ScreenshotData, type SessionData, type SessionError, type SessionMetadata, type SessionServiceResponse, type SessionWarning, type WaitForDownloadConfig, type WaitForDownloadResult, type WindowActConfig, type WindowActResponse, type WindowClickConfig, type WindowComputerUseConfig, type WindowComputerUseResponse, type WindowCreateData, type WindowCreateOptions, type WindowError, type WindowExtractConfig, type WindowExtractResponse, type WindowFillFormConfig, type WindowFindManyConfig, type WindowFindManyResponse, type WindowFindOneConfig, type WindowFindOneResponse, type WindowGetConfig, type WindowHoverConfig, type WindowInfoData, type WindowLlmConfig, type WindowLlmFileContentData, type WindowLlmResponse, type WindowLoadUrlConfig, type WindowMetadata, type WindowMonitorConfig, type WindowNavigateConfig, WindowNavigateDirection, type WindowNavigateResponse, type WindowPageQueryConfig, type WindowPaginatedExtractionConfig, type WindowPromptResponse, type WindowScrapeConfig, type WindowScrapeResponse, type WindowScreenshotConfig, type WindowScrollConfig, type WindowTypeConfig, type WindowWaitForPageConfig, type WindowWaitForPageResponse, type WindowWarning, registerAirtopPlugin };
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var require_package = __commonJS({
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@airtop/sdk",
|
|
11
11
|
description: "Airtop SDK for TypeScript",
|
|
12
|
-
version: "1.0.0-alpha2.
|
|
12
|
+
version: "1.0.0-alpha2.42",
|
|
13
13
|
type: "module",
|
|
14
14
|
main: "./dist/index.cjs",
|
|
15
15
|
module: "./dist/index.js",
|
|
@@ -48,7 +48,7 @@ var require_package = __commonJS({
|
|
|
48
48
|
"verify-types": "tsc --noEmit && tsc --noEmit --project tsconfig.e2e.json"
|
|
49
49
|
},
|
|
50
50
|
dependencies: {
|
|
51
|
-
"@airtop/core": "0.1.0-alpha.
|
|
51
|
+
"@airtop/core": "0.1.0-alpha.52",
|
|
52
52
|
"@airtop/json-schema-adapter": "workspace:*",
|
|
53
53
|
"date-fns": "4.1.0",
|
|
54
54
|
loglayer: "8.1.0",
|
|
@@ -1133,6 +1133,29 @@ var AirtopWindowClient = class extends AirtopBase {
|
|
|
1133
1133
|
)
|
|
1134
1134
|
);
|
|
1135
1135
|
}
|
|
1136
|
+
/**
|
|
1137
|
+
* Executes a computer use action in the window using AI-driven browser automation.
|
|
1138
|
+
* @param prompt - A natural language description of the action to perform
|
|
1139
|
+
* @param config - Configuration options for the computer use action
|
|
1140
|
+
* @param requestOptions - Request options
|
|
1141
|
+
* @returns Promise resolving to the computer use operation result
|
|
1142
|
+
*/
|
|
1143
|
+
async computerUse(prompt, config, requestOptions = {}) {
|
|
1144
|
+
return await withRequestCompletionPolling(
|
|
1145
|
+
this.client,
|
|
1146
|
+
() => this.client.windows.computerUse(
|
|
1147
|
+
this.getWindowId(),
|
|
1148
|
+
{
|
|
1149
|
+
sessionId: this.sessionId,
|
|
1150
|
+
prompt,
|
|
1151
|
+
...config || {}
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
...this.resolveRequestOptions(requestOptions)
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1136
1159
|
};
|
|
1137
1160
|
|
|
1138
1161
|
// src/window/AirtopWindow.ts
|
|
@@ -1408,8 +1431,12 @@ var AirtopSessionClient = class extends AirtopBase {
|
|
|
1408
1431
|
* Defaults to looking back 5 seconds in the event stream for the file to be available.
|
|
1409
1432
|
* Use `lookbackSeconds` to control this behavior.
|
|
1410
1433
|
*
|
|
1434
|
+
* This method uses a two-phase approach:
|
|
1435
|
+
* - Phase 1 (if lookbackSeconds > 0): Check historical events within the lookback window
|
|
1436
|
+
* - Phase 2: Wait for events from startTime forward until timeout (ensures no gap between phases)
|
|
1437
|
+
*
|
|
1411
1438
|
* @param configuration - The optional configuration parameters for the function
|
|
1412
|
-
* @param configuration.lookbackSeconds - The number of seconds to look back for prior events. Default `5`. 0 means no lookback.
|
|
1439
|
+
* @param configuration.lookbackSeconds - The number of seconds to look back for prior events. Default `5`. 0 means no lookback (only wait for new events).
|
|
1413
1440
|
* @param configuration.fileType - The file type to wait for, such as "browser_download". If provided, only files of this type will be considered.
|
|
1414
1441
|
* @param requestOptions - Optional request configuration including timeout
|
|
1415
1442
|
* @returns Object containing file's id and downloadUrl, or null if timed out
|
|
@@ -1425,35 +1452,62 @@ var AirtopSessionClient = class extends AirtopBase {
|
|
|
1425
1452
|
resolve(null);
|
|
1426
1453
|
}, timeoutSeconds * 1e3);
|
|
1427
1454
|
});
|
|
1455
|
+
const isQualifyingEvent = (e) => {
|
|
1456
|
+
if (e.event !== "file_status" || e.status !== "available") {
|
|
1457
|
+
return false;
|
|
1458
|
+
}
|
|
1459
|
+
if (fileType && e.type !== fileType) {
|
|
1460
|
+
this.log.info(`skipping file of type ${e.type} (looking for ${fileType})`);
|
|
1461
|
+
return false;
|
|
1462
|
+
}
|
|
1463
|
+
return true;
|
|
1464
|
+
};
|
|
1465
|
+
const createResult = (e) => ({
|
|
1466
|
+
id: e.fileId,
|
|
1467
|
+
downloadUrl: e.downloadUrl,
|
|
1468
|
+
fileName: e.name,
|
|
1469
|
+
fileType: e.type
|
|
1470
|
+
});
|
|
1428
1471
|
const processEventsPromise = (async () => {
|
|
1429
|
-
const
|
|
1472
|
+
const thresholdTime = startTime.getTime() - lookbackSeconds * 1e3;
|
|
1473
|
+
if (lookbackSeconds > 0) {
|
|
1474
|
+
this.log.info(`Phase 1: checking historical events from last ${lookbackSeconds} seconds`);
|
|
1475
|
+
const historicalEvents = await this.client.sessions.getEvents(
|
|
1476
|
+
this.sessionId,
|
|
1477
|
+
{ all: true, reverse: true },
|
|
1478
|
+
{ timeoutInSeconds: timeoutSeconds, ...requestOptions || {} }
|
|
1479
|
+
);
|
|
1480
|
+
for await (const event of historicalEvents) {
|
|
1481
|
+
const e = event;
|
|
1482
|
+
const eventTime = Date.parse(e.eventTime);
|
|
1483
|
+
if (eventTime < thresholdTime) {
|
|
1484
|
+
this.log.info(`Phase 1: reached lookback threshold, no matching file found in history`);
|
|
1485
|
+
break;
|
|
1486
|
+
}
|
|
1487
|
+
if (isQualifyingEvent(e)) {
|
|
1488
|
+
this.log.info(`Phase 1: found file in history:
|
|
1489
|
+
${JSON.stringify(event, null, 2)}`);
|
|
1490
|
+
return createResult(e);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
this.log.info(`Phase 2: waiting for download events from ${startTime.toISOString()} forward`);
|
|
1495
|
+
const newEvents = await this.client.sessions.getEvents(
|
|
1430
1496
|
this.sessionId,
|
|
1431
|
-
{ all:
|
|
1497
|
+
{ all: true, reverse: false },
|
|
1432
1498
|
{ timeoutInSeconds: timeoutSeconds, ...requestOptions || {} }
|
|
1433
1499
|
);
|
|
1434
|
-
|
|
1500
|
+
const startTimeMs = startTime.getTime();
|
|
1501
|
+
for await (const event of newEvents) {
|
|
1435
1502
|
const e = event;
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1503
|
+
const eventTime = Date.parse(e.eventTime);
|
|
1504
|
+
if (eventTime < startTimeMs) {
|
|
1505
|
+
continue;
|
|
1506
|
+
}
|
|
1507
|
+
if (isQualifyingEvent(e)) {
|
|
1508
|
+
this.log.info(`Phase 2: found download event:
|
|
1440
1509
|
${JSON.stringify(event, null, 2)}`);
|
|
1441
|
-
|
|
1442
|
-
this.log.info(`skipping file of type ${e.type} (looking for ${fileType})`);
|
|
1443
|
-
continue;
|
|
1444
|
-
}
|
|
1445
|
-
const thresholdTime = startTime.getTime() - lookbackSeconds * 1e3;
|
|
1446
|
-
if (eventTime < thresholdTime) {
|
|
1447
|
-
this.log.info(`stopping event processing - encountered event older than lookbackSeconds threshold`);
|
|
1448
|
-
break;
|
|
1449
|
-
}
|
|
1450
|
-
return {
|
|
1451
|
-
id: e.fileId,
|
|
1452
|
-
downloadUrl: e.downloadUrl,
|
|
1453
|
-
fileName: e.name,
|
|
1454
|
-
fileType: e.type
|
|
1455
|
-
};
|
|
1456
|
-
}
|
|
1510
|
+
return createResult(e);
|
|
1457
1511
|
}
|
|
1458
1512
|
}
|
|
1459
1513
|
return null;
|