asteroid-odyssey 1.0.25 → 1.1.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { GetOpenApiData, HealthCheckData, ExecuteAgentData, GetExecutionStatusData, GetExecutionResultData } from './types.gen';
|
|
1
|
+
import { type Options as ClientOptions, type TDataShape, type Client } from '@hey-api/client-fetch';
|
|
2
|
+
import type { GetOpenApiData, UploadExecutionFilesData, HealthCheckData, ExecuteAgentData, ExecuteAgentStructuredData, GetExecutionStatusData, GetExecutionResultData, GetBrowserSessionRecordingData } from './types.gen';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -17,6 +17,13 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
17
17
|
* Get the OpenAPI schema
|
|
18
18
|
*/
|
|
19
19
|
export declare const getOpenApi: <ThrowOnError extends boolean = false>(options?: Options<GetOpenApiData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
|
|
20
|
+
/**
|
|
21
|
+
* Upload files to an execution
|
|
22
|
+
*/
|
|
23
|
+
export declare const uploadExecutionFiles: <ThrowOnError extends boolean = false>(options: Options<UploadExecutionFilesData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
|
|
24
|
+
message?: string;
|
|
25
|
+
file_ids?: Array<string>;
|
|
26
|
+
}, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
20
27
|
/**
|
|
21
28
|
* Check the health of the API
|
|
22
29
|
*/
|
|
@@ -30,6 +37,11 @@ export declare const healthCheck: <ThrowOnError extends boolean = false>(options
|
|
|
30
37
|
* Executes an agent with the provided parameters
|
|
31
38
|
*/
|
|
32
39
|
export declare const executeAgent: <ThrowOnError extends boolean = false>(options: Options<ExecuteAgentData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ExecutionResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
40
|
+
/**
|
|
41
|
+
* Execute an agent with structured parameters
|
|
42
|
+
* Executes an agent with structured parameters including optional agent profile configuration. This is the recommended method for new integrations.
|
|
43
|
+
*/
|
|
44
|
+
export declare const executeAgentStructured: <ThrowOnError extends boolean = false>(options: Options<ExecuteAgentStructuredData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ExecutionResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
33
45
|
/**
|
|
34
46
|
* Get execution status
|
|
35
47
|
*/
|
|
@@ -38,3 +50,8 @@ export declare const getExecutionStatus: <ThrowOnError extends boolean = false>(
|
|
|
38
50
|
* Get execution result
|
|
39
51
|
*/
|
|
40
52
|
export declare const getExecutionResult: <ThrowOnError extends boolean = false>(options: Options<GetExecutionResultData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ExecutionResultResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
53
|
+
/**
|
|
54
|
+
* Get browser session recording
|
|
55
|
+
* Retrieves the browser session recording URL for a completed execution
|
|
56
|
+
*/
|
|
57
|
+
export declare const getBrowserSessionRecording: <ThrowOnError extends boolean = false>(options: Options<GetBrowserSessionRecordingData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").BrowserSessionRecordingResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getExecutionResult = exports.getExecutionStatus = exports.executeAgent = exports.healthCheck = exports.getOpenApi = void 0;
|
|
4
|
+
exports.getBrowserSessionRecording = exports.getExecutionResult = exports.getExecutionStatus = exports.executeAgentStructured = exports.executeAgent = exports.healthCheck = exports.uploadExecutionFiles = exports.getOpenApi = void 0;
|
|
5
|
+
const client_fetch_1 = require("@hey-api/client-fetch");
|
|
5
6
|
const client_gen_1 = require("./client.gen");
|
|
6
7
|
/**
|
|
7
8
|
* Get the OpenAPI schema
|
|
@@ -13,6 +14,27 @@ const getOpenApi = (options) => {
|
|
|
13
14
|
});
|
|
14
15
|
};
|
|
15
16
|
exports.getOpenApi = getOpenApi;
|
|
17
|
+
/**
|
|
18
|
+
* Upload files to an execution
|
|
19
|
+
*/
|
|
20
|
+
const uploadExecutionFiles = (options) => {
|
|
21
|
+
return (options.client ?? client_gen_1.client).post({
|
|
22
|
+
...client_fetch_1.formDataBodySerializer,
|
|
23
|
+
security: [
|
|
24
|
+
{
|
|
25
|
+
name: 'X-Asteroid-Agents-Api-Key',
|
|
26
|
+
type: 'apiKey'
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
url: '/execution/{id}/files',
|
|
30
|
+
...options,
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': null,
|
|
33
|
+
...options?.headers
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.uploadExecutionFiles = uploadExecutionFiles;
|
|
16
38
|
/**
|
|
17
39
|
* Check the health of the API
|
|
18
40
|
*/
|
|
@@ -44,6 +66,27 @@ const executeAgent = (options) => {
|
|
|
44
66
|
});
|
|
45
67
|
};
|
|
46
68
|
exports.executeAgent = executeAgent;
|
|
69
|
+
/**
|
|
70
|
+
* Execute an agent with structured parameters
|
|
71
|
+
* Executes an agent with structured parameters including optional agent profile configuration. This is the recommended method for new integrations.
|
|
72
|
+
*/
|
|
73
|
+
const executeAgentStructured = (options) => {
|
|
74
|
+
return (options.client ?? client_gen_1.client).post({
|
|
75
|
+
security: [
|
|
76
|
+
{
|
|
77
|
+
name: 'X-Asteroid-Agents-Api-Key',
|
|
78
|
+
type: 'apiKey'
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
url: '/agent/{id}/execute',
|
|
82
|
+
...options,
|
|
83
|
+
headers: {
|
|
84
|
+
'Content-Type': 'application/json',
|
|
85
|
+
...options?.headers
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
exports.executeAgentStructured = executeAgentStructured;
|
|
47
90
|
/**
|
|
48
91
|
* Get execution status
|
|
49
92
|
*/
|
|
@@ -76,3 +119,20 @@ const getExecutionResult = (options) => {
|
|
|
76
119
|
});
|
|
77
120
|
};
|
|
78
121
|
exports.getExecutionResult = getExecutionResult;
|
|
122
|
+
/**
|
|
123
|
+
* Get browser session recording
|
|
124
|
+
* Retrieves the browser session recording URL for a completed execution
|
|
125
|
+
*/
|
|
126
|
+
const getBrowserSessionRecording = (options) => {
|
|
127
|
+
return (options.client ?? client_gen_1.client).get({
|
|
128
|
+
security: [
|
|
129
|
+
{
|
|
130
|
+
name: 'X-Asteroid-Agents-Api-Key',
|
|
131
|
+
type: 'apiKey'
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
url: '/execution/{id}/browser_session/recording',
|
|
135
|
+
...options
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
exports.getBrowserSessionRecording = getBrowserSessionRecording;
|
|
@@ -32,7 +32,8 @@ export type ExecutionResultResponse = {
|
|
|
32
32
|
execution_id: string;
|
|
33
33
|
status: Status;
|
|
34
34
|
/**
|
|
35
|
-
* The
|
|
35
|
+
* (Deprecated, use execution_result instead) The structured result data from the execution. Contains the outcome, reasoning, final answer, and result.
|
|
36
|
+
* @deprecated
|
|
36
37
|
*/
|
|
37
38
|
result?: {
|
|
38
39
|
[key: string]: unknown;
|
|
@@ -41,17 +42,58 @@ export type ExecutionResultResponse = {
|
|
|
41
42
|
* Error message (if execution failed)
|
|
42
43
|
*/
|
|
43
44
|
error?: string;
|
|
45
|
+
execution_result?: ExecutionResult;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The result of an execution. Contains the outcome, reasoning, and result.
|
|
49
|
+
*/
|
|
50
|
+
export type ExecutionResult = {
|
|
51
|
+
/**
|
|
52
|
+
* The outcome of the execution (success or failure)
|
|
53
|
+
*/
|
|
54
|
+
outcome?: 'success' | 'failure';
|
|
55
|
+
/**
|
|
56
|
+
* The reasoning behind the execution outcome
|
|
57
|
+
*/
|
|
58
|
+
reasoning?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The structured result data from the execution. This will follow the format defined in the result_schema of the agent.
|
|
61
|
+
*/
|
|
62
|
+
result?: {
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
};
|
|
44
65
|
};
|
|
45
66
|
/**
|
|
46
67
|
* Status of the execution
|
|
47
68
|
*/
|
|
48
|
-
export type Status = 'starting' | 'running' | 'paused' | 'completed' | 'cancelled' | 'failed' | 'awaiting_completion';
|
|
69
|
+
export type Status = 'starting' | 'running' | 'paused' | 'completed' | 'cancelled' | 'failed' | 'awaiting_completion' | 'paused_by_agent';
|
|
49
70
|
export type ErrorResponse = {
|
|
50
71
|
/**
|
|
51
72
|
* Error message
|
|
52
73
|
*/
|
|
53
74
|
error: string;
|
|
54
75
|
};
|
|
76
|
+
export type BrowserSessionRecordingResponse = {
|
|
77
|
+
/**
|
|
78
|
+
* The URL of the browser session recording
|
|
79
|
+
*/
|
|
80
|
+
recording_url: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Request to execute an agent with structured parameters including optional agent profile configuration
|
|
84
|
+
*/
|
|
85
|
+
export type StructuredAgentExecutionRequest = {
|
|
86
|
+
/**
|
|
87
|
+
* The ID of the browser profile to use
|
|
88
|
+
*/
|
|
89
|
+
agent_profile_id?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Dynamic data to be merged into the saved agent configuration.
|
|
92
|
+
*/
|
|
93
|
+
dynamic_data?: {
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
55
97
|
export type GetOpenApiData = {
|
|
56
98
|
body?: never;
|
|
57
99
|
path?: never;
|
|
@@ -64,6 +106,53 @@ export type GetOpenApiResponses = {
|
|
|
64
106
|
*/
|
|
65
107
|
200: unknown;
|
|
66
108
|
};
|
|
109
|
+
export type UploadExecutionFilesData = {
|
|
110
|
+
body: {
|
|
111
|
+
/**
|
|
112
|
+
* Files to upload to the execution
|
|
113
|
+
*/
|
|
114
|
+
files?: Array<Blob | File>;
|
|
115
|
+
};
|
|
116
|
+
path: {
|
|
117
|
+
/**
|
|
118
|
+
* The ID of the execution
|
|
119
|
+
*/
|
|
120
|
+
id: string;
|
|
121
|
+
};
|
|
122
|
+
query?: never;
|
|
123
|
+
url: '/execution/{id}/files';
|
|
124
|
+
};
|
|
125
|
+
export type UploadExecutionFilesErrors = {
|
|
126
|
+
/**
|
|
127
|
+
* Bad request
|
|
128
|
+
*/
|
|
129
|
+
400: ErrorResponse;
|
|
130
|
+
/**
|
|
131
|
+
* Unauthorized
|
|
132
|
+
*/
|
|
133
|
+
401: ErrorResponse;
|
|
134
|
+
/**
|
|
135
|
+
* Execution not found
|
|
136
|
+
*/
|
|
137
|
+
404: ErrorResponse;
|
|
138
|
+
};
|
|
139
|
+
export type UploadExecutionFilesError = UploadExecutionFilesErrors[keyof UploadExecutionFilesErrors];
|
|
140
|
+
export type UploadExecutionFilesResponses = {
|
|
141
|
+
/**
|
|
142
|
+
* Files uploaded successfully
|
|
143
|
+
*/
|
|
144
|
+
200: {
|
|
145
|
+
/**
|
|
146
|
+
* Success message
|
|
147
|
+
*/
|
|
148
|
+
message?: string;
|
|
149
|
+
/**
|
|
150
|
+
* IDs of the uploaded files
|
|
151
|
+
*/
|
|
152
|
+
file_ids?: Array<string>;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
export type UploadExecutionFilesResponse = UploadExecutionFilesResponses[keyof UploadExecutionFilesResponses];
|
|
67
156
|
export type HealthCheckData = {
|
|
68
157
|
body?: never;
|
|
69
158
|
path?: never;
|
|
@@ -127,6 +216,39 @@ export type ExecuteAgentResponses = {
|
|
|
127
216
|
202: ExecutionResponse;
|
|
128
217
|
};
|
|
129
218
|
export type ExecuteAgentResponse = ExecuteAgentResponses[keyof ExecuteAgentResponses];
|
|
219
|
+
export type ExecuteAgentStructuredData = {
|
|
220
|
+
body: StructuredAgentExecutionRequest;
|
|
221
|
+
path: {
|
|
222
|
+
/**
|
|
223
|
+
* The ID of the agent
|
|
224
|
+
*/
|
|
225
|
+
id: string;
|
|
226
|
+
};
|
|
227
|
+
query?: never;
|
|
228
|
+
url: '/agent/{id}/execute';
|
|
229
|
+
};
|
|
230
|
+
export type ExecuteAgentStructuredErrors = {
|
|
231
|
+
/**
|
|
232
|
+
* Invalid request
|
|
233
|
+
*/
|
|
234
|
+
400: ErrorResponse;
|
|
235
|
+
/**
|
|
236
|
+
* Agent not found
|
|
237
|
+
*/
|
|
238
|
+
404: ErrorResponse;
|
|
239
|
+
/**
|
|
240
|
+
* Internal server error
|
|
241
|
+
*/
|
|
242
|
+
500: ErrorResponse;
|
|
243
|
+
};
|
|
244
|
+
export type ExecuteAgentStructuredError = ExecuteAgentStructuredErrors[keyof ExecuteAgentStructuredErrors];
|
|
245
|
+
export type ExecuteAgentStructuredResponses = {
|
|
246
|
+
/**
|
|
247
|
+
* Agent execution started successfully
|
|
248
|
+
*/
|
|
249
|
+
202: ExecutionResponse;
|
|
250
|
+
};
|
|
251
|
+
export type ExecuteAgentStructuredResponse = ExecuteAgentStructuredResponses[keyof ExecuteAgentStructuredResponses];
|
|
130
252
|
export type GetExecutionStatusData = {
|
|
131
253
|
body?: never;
|
|
132
254
|
path: {
|
|
@@ -185,6 +307,35 @@ export type GetExecutionResultResponses = {
|
|
|
185
307
|
200: ExecutionResultResponse;
|
|
186
308
|
};
|
|
187
309
|
export type GetExecutionResultResponse = GetExecutionResultResponses[keyof GetExecutionResultResponses];
|
|
310
|
+
export type GetBrowserSessionRecordingData = {
|
|
311
|
+
body?: never;
|
|
312
|
+
path: {
|
|
313
|
+
/**
|
|
314
|
+
* The ID of the execution
|
|
315
|
+
*/
|
|
316
|
+
id: string;
|
|
317
|
+
};
|
|
318
|
+
query?: never;
|
|
319
|
+
url: '/execution/{id}/browser_session/recording';
|
|
320
|
+
};
|
|
321
|
+
export type GetBrowserSessionRecordingErrors = {
|
|
322
|
+
/**
|
|
323
|
+
* Browser session not found
|
|
324
|
+
*/
|
|
325
|
+
404: ErrorResponse;
|
|
326
|
+
/**
|
|
327
|
+
* Internal server error
|
|
328
|
+
*/
|
|
329
|
+
500: ErrorResponse;
|
|
330
|
+
};
|
|
331
|
+
export type GetBrowserSessionRecordingError = GetBrowserSessionRecordingErrors[keyof GetBrowserSessionRecordingErrors];
|
|
332
|
+
export type GetBrowserSessionRecordingResponses = {
|
|
333
|
+
/**
|
|
334
|
+
* Browser session recording retrieved successfully
|
|
335
|
+
*/
|
|
336
|
+
200: BrowserSessionRecordingResponse;
|
|
337
|
+
};
|
|
338
|
+
export type GetBrowserSessionRecordingResponse = GetBrowserSessionRecordingResponses[keyof GetBrowserSessionRecordingResponses];
|
|
188
339
|
export type ClientOptions = {
|
|
189
|
-
baseUrl: 'https://odyssey.asteroid.ai/api/v1' | (string & {});
|
|
340
|
+
baseUrl: 'https://odyssey.asteroid.ai/api/v1' | `${string}://${string}/api/v1` | (string & {});
|
|
190
341
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type {
|
|
2
|
+
import type { StructuredAgentExecutionRequest, ExecutionStatusResponse, BrowserSessionRecordingResponse } from './generated/agents/types.gen';
|
|
3
3
|
/**
|
|
4
4
|
* Create an API client with a provided API key.
|
|
5
5
|
*
|
|
@@ -13,17 +13,20 @@ export declare const AsteroidClient: (apiKey: string, options?: {
|
|
|
13
13
|
baseUrl?: string;
|
|
14
14
|
}) => Client;
|
|
15
15
|
/**
|
|
16
|
-
* Execute an agent with
|
|
16
|
+
* Execute an agent with parameters including optional agent profile ID.
|
|
17
17
|
*
|
|
18
18
|
* @param client - The API client.
|
|
19
19
|
* @param agentId - The ID of the agent to execute.
|
|
20
|
-
* @param executionData - The execution parameters.
|
|
20
|
+
* @param executionData - The structured execution parameters.
|
|
21
21
|
* @returns The execution ID.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
|
-
* const executionId = await executeAgent(client, 'my-agent-id', {
|
|
24
|
+
* const executionId = await executeAgent(client, 'my-agent-id', {
|
|
25
|
+
* agent_profile_id: 'profile-123',
|
|
26
|
+
* dynamic_data: { input: "some dynamic value" }
|
|
27
|
+
* });
|
|
25
28
|
*/
|
|
26
|
-
export declare const executeAgent: (client: Client, agentId: string, executionData:
|
|
29
|
+
export declare const executeAgent: (client: Client, agentId: string, executionData: StructuredAgentExecutionRequest) => Promise<string>;
|
|
27
30
|
/**
|
|
28
31
|
* Get the current status for an execution.
|
|
29
32
|
*
|
|
@@ -62,6 +65,36 @@ export declare const getExecutionResult: (client: Client, executionId: string) =
|
|
|
62
65
|
* const result = await waitForExecutionResult(client, executionId, 2000);
|
|
63
66
|
*/
|
|
64
67
|
export declare const waitForExecutionResult: (client: Client, executionId: string, interval?: number, timeout?: number) => Promise<Record<string, unknown>>;
|
|
68
|
+
/**
|
|
69
|
+
* Get the browser session recording URL for a completed execution.
|
|
70
|
+
*
|
|
71
|
+
* @param client - The API client.
|
|
72
|
+
* @param executionId - The execution identifier.
|
|
73
|
+
* @returns The browser session recording URL.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* const recording = await getBrowserSessionRecording(client, executionId);
|
|
77
|
+
* console.log(recording.recording_url);
|
|
78
|
+
*/
|
|
79
|
+
export declare const getBrowserSessionRecording: (client: Client, executionId: string) => Promise<BrowserSessionRecordingResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* Upload files to an execution.
|
|
82
|
+
*
|
|
83
|
+
* @param client - The API client.
|
|
84
|
+
* @param executionId - The execution identifier.
|
|
85
|
+
* @param files - Array of files to upload.
|
|
86
|
+
* @returns The uploaded file IDs and success message.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* const fileInput = document.getElementById('file-input') as HTMLInputElement;
|
|
90
|
+
* const files = Array.from(fileInput.files || []);
|
|
91
|
+
* const result = await uploadExecutionFiles(client, executionId, files);
|
|
92
|
+
* console.log(result.file_ids);
|
|
93
|
+
*/
|
|
94
|
+
export declare const uploadExecutionFiles: (client: Client, executionId: string, files: Array<Blob | File>) => Promise<{
|
|
95
|
+
message?: string;
|
|
96
|
+
file_ids?: string[];
|
|
97
|
+
}>;
|
|
65
98
|
/**
|
|
66
99
|
* Optionally, re-export all generated functions and types.
|
|
67
100
|
*/
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.waitForExecutionResult = exports.getExecutionResult = exports.getExecutionStatus = exports.executeAgent = exports.AsteroidClient = void 0;
|
|
39
|
+
exports.uploadExecutionFiles = exports.getBrowserSessionRecording = exports.waitForExecutionResult = exports.getExecutionResult = exports.getExecutionStatus = exports.executeAgent = exports.AsteroidClient = void 0;
|
|
40
40
|
const client_fetch_1 = require("@hey-api/client-fetch");
|
|
41
41
|
const AgentsSDK = __importStar(require("./generated/agents/sdk.gen"));
|
|
42
42
|
/**
|
|
@@ -58,18 +58,21 @@ const AsteroidClient = (apiKey, options) => {
|
|
|
58
58
|
};
|
|
59
59
|
exports.AsteroidClient = AsteroidClient;
|
|
60
60
|
/**
|
|
61
|
-
* Execute an agent with
|
|
61
|
+
* Execute an agent with parameters including optional agent profile ID.
|
|
62
62
|
*
|
|
63
63
|
* @param client - The API client.
|
|
64
64
|
* @param agentId - The ID of the agent to execute.
|
|
65
|
-
* @param executionData - The execution parameters.
|
|
65
|
+
* @param executionData - The structured execution parameters.
|
|
66
66
|
* @returns The execution ID.
|
|
67
67
|
*
|
|
68
68
|
* @example
|
|
69
|
-
* const executionId = await executeAgent(client, 'my-agent-id', {
|
|
69
|
+
* const executionId = await executeAgent(client, 'my-agent-id', {
|
|
70
|
+
* agent_profile_id: 'profile-123',
|
|
71
|
+
* dynamic_data: { input: "some dynamic value" }
|
|
72
|
+
* });
|
|
70
73
|
*/
|
|
71
74
|
const executeAgent = async (client, agentId, executionData) => {
|
|
72
|
-
const response = await AgentsSDK.
|
|
75
|
+
const response = await AgentsSDK.executeAgentStructured({
|
|
73
76
|
client,
|
|
74
77
|
path: { id: agentId },
|
|
75
78
|
body: executionData,
|
|
@@ -160,6 +163,54 @@ const waitForExecutionResult = async (client, executionId, interval = 1000, time
|
|
|
160
163
|
throw new Error(`Execution ${executionId} timed out after ${timeout}ms`);
|
|
161
164
|
};
|
|
162
165
|
exports.waitForExecutionResult = waitForExecutionResult;
|
|
166
|
+
/**
|
|
167
|
+
* Get the browser session recording URL for a completed execution.
|
|
168
|
+
*
|
|
169
|
+
* @param client - The API client.
|
|
170
|
+
* @param executionId - The execution identifier.
|
|
171
|
+
* @returns The browser session recording URL.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* const recording = await getBrowserSessionRecording(client, executionId);
|
|
175
|
+
* console.log(recording.recording_url);
|
|
176
|
+
*/
|
|
177
|
+
const getBrowserSessionRecording = async (client, executionId) => {
|
|
178
|
+
const response = await AgentsSDK.getBrowserSessionRecording({
|
|
179
|
+
client,
|
|
180
|
+
path: { id: executionId },
|
|
181
|
+
});
|
|
182
|
+
if (response.error) {
|
|
183
|
+
throw new Error(response.error.error);
|
|
184
|
+
}
|
|
185
|
+
return response.data;
|
|
186
|
+
};
|
|
187
|
+
exports.getBrowserSessionRecording = getBrowserSessionRecording;
|
|
188
|
+
/**
|
|
189
|
+
* Upload files to an execution.
|
|
190
|
+
*
|
|
191
|
+
* @param client - The API client.
|
|
192
|
+
* @param executionId - The execution identifier.
|
|
193
|
+
* @param files - Array of files to upload.
|
|
194
|
+
* @returns The uploaded file IDs and success message.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* const fileInput = document.getElementById('file-input') as HTMLInputElement;
|
|
198
|
+
* const files = Array.from(fileInput.files || []);
|
|
199
|
+
* const result = await uploadExecutionFiles(client, executionId, files);
|
|
200
|
+
* console.log(result.file_ids);
|
|
201
|
+
*/
|
|
202
|
+
const uploadExecutionFiles = async (client, executionId, files) => {
|
|
203
|
+
const response = await AgentsSDK.uploadExecutionFiles({
|
|
204
|
+
client,
|
|
205
|
+
path: { id: executionId },
|
|
206
|
+
body: { files },
|
|
207
|
+
});
|
|
208
|
+
if (response.error) {
|
|
209
|
+
throw new Error(response.error.error);
|
|
210
|
+
}
|
|
211
|
+
return response.data;
|
|
212
|
+
};
|
|
213
|
+
exports.uploadExecutionFiles = uploadExecutionFiles;
|
|
163
214
|
/**
|
|
164
215
|
* Optionally, re-export all generated functions and types.
|
|
165
216
|
*/
|