asteroid-odyssey 1.0.17 → 1.0.22
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/generated/agents/sdk.gen.d.ts +29 -1
- package/dist/generated/agents/sdk.gen.js +79 -1
- package/dist/generated/agents/types.gen.d.ts +274 -11
- package/dist/index.d.ts +12 -2
- package/dist/index.js +21 -6
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { GetOpenApiData, HealthCheckData, GetAgentsData, QueueOptimisationJobData, CreateWorkflowData, DeleteWorkflowData, GetWorkflowData, ExecuteWorkflowData, GetExecutionsForWorkflowData, DeleteExecutionData, GetExecutionData, UpdateExecutionStatusData, GetBrowserSessionData, SetSlackChannelData, GetAgentWorkflowExecutionsData, GetExecutionProgressData, GetExecutionFilesData } from './types.gen';
|
|
2
|
+
import type { GetOpenApiData, HealthCheckData, GetAgentsData, QueueOptimisationJobData, CreateWorkflowData, DeleteWorkflowData, GetWorkflowData, ExecuteWorkflowData, GetExecutionsForWorkflowData, DeleteWorkflowCredentialsData, GetWorkflowCredentialsData, AddWorkflowCredentialData, GetCredentialsPublicKeyData, DeleteExecutionData, GetExecutionData, UpdateExecutionStatusData, GetBrowserSessionData, SetSlackChannelData, GetAgentWorkflowExecutionsData, GetExecutionProgressData, GetExecutionFilesData, GetWorkflowVersionsData, GetExecutionUserMessagesData, CreateExecutionUserMessageData } 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
|
|
@@ -57,6 +57,22 @@ export declare const executeWorkflow: <ThrowOnError extends boolean = false>(opt
|
|
|
57
57
|
* Get all executions for a workflow
|
|
58
58
|
*/
|
|
59
59
|
export declare const getExecutionsForWorkflow: <ThrowOnError extends boolean = false>(options: Options<GetExecutionsForWorkflowData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Execution[], unknown, ThrowOnError>;
|
|
60
|
+
/**
|
|
61
|
+
* Delete credentials for a workflow
|
|
62
|
+
*/
|
|
63
|
+
export declare const deleteWorkflowCredentials: <ThrowOnError extends boolean = false>(options: Options<DeleteWorkflowCredentialsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
|
|
64
|
+
/**
|
|
65
|
+
* Get credentials for a workflow (and all prior versions of the workflow)
|
|
66
|
+
*/
|
|
67
|
+
export declare const getWorkflowCredentials: <ThrowOnError extends boolean = false>(options: Options<GetWorkflowCredentialsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").CredentialsResponse, unknown, ThrowOnError>;
|
|
68
|
+
/**
|
|
69
|
+
* Add a credential for a workflow
|
|
70
|
+
*/
|
|
71
|
+
export declare const addWorkflowCredential: <ThrowOnError extends boolean = false>(options: Options<AddWorkflowCredentialData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
|
|
72
|
+
/**
|
|
73
|
+
* Get the public key for credentials
|
|
74
|
+
*/
|
|
75
|
+
export declare const getCredentialsPublicKey: <ThrowOnError extends boolean = false>(options?: Options<GetCredentialsPublicKeyData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<string, unknown, ThrowOnError>;
|
|
60
76
|
/**
|
|
61
77
|
* Delete an execution
|
|
62
78
|
*/
|
|
@@ -93,3 +109,15 @@ export declare const getExecutionProgress: <ThrowOnError extends boolean = false
|
|
|
93
109
|
* Get files for an execution
|
|
94
110
|
*/
|
|
95
111
|
export declare const getExecutionFiles: <ThrowOnError extends boolean = false>(options: Options<GetExecutionFilesData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").File[], unknown, ThrowOnError>;
|
|
112
|
+
/**
|
|
113
|
+
* Get all versions of a workflow
|
|
114
|
+
*/
|
|
115
|
+
export declare const getWorkflowVersions: <ThrowOnError extends boolean = false>(options: Options<GetWorkflowVersionsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Workflow[], unknown, ThrowOnError>;
|
|
116
|
+
/**
|
|
117
|
+
* Get all user messages for an execution
|
|
118
|
+
*/
|
|
119
|
+
export declare const getExecutionUserMessages: <ThrowOnError extends boolean = false>(options: Options<GetExecutionUserMessagesData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").UserMessage[], unknown, ThrowOnError>;
|
|
120
|
+
/**
|
|
121
|
+
* Create a user message for an execution
|
|
122
|
+
*/
|
|
123
|
+
export declare const createExecutionUserMessage: <ThrowOnError extends boolean = false>(options: Options<CreateExecutionUserMessageData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
|
|
@@ -1,7 +1,7 @@
|
|
|
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.getExecutionFiles = exports.getExecutionProgress = exports.getAgentWorkflowExecutions = exports.setSlackChannel = exports.getBrowserSession = exports.updateExecutionStatus = exports.getExecution = exports.deleteExecution = exports.getExecutionsForWorkflow = exports.executeWorkflow = exports.getWorkflow = exports.deleteWorkflow = exports.createWorkflow = exports.queueOptimisationJob = exports.getAgents = exports.healthCheck = exports.getOpenApi = void 0;
|
|
4
|
+
exports.createExecutionUserMessage = exports.getExecutionUserMessages = exports.getWorkflowVersions = exports.getExecutionFiles = exports.getExecutionProgress = exports.getAgentWorkflowExecutions = exports.setSlackChannel = exports.getBrowserSession = exports.updateExecutionStatus = exports.getExecution = exports.deleteExecution = exports.getCredentialsPublicKey = exports.addWorkflowCredential = exports.getWorkflowCredentials = exports.deleteWorkflowCredentials = exports.getExecutionsForWorkflow = exports.executeWorkflow = exports.getWorkflow = exports.deleteWorkflow = exports.createWorkflow = exports.queueOptimisationJob = exports.getAgents = exports.healthCheck = exports.getOpenApi = void 0;
|
|
5
5
|
const client_gen_1 = require("./client.gen");
|
|
6
6
|
/**
|
|
7
7
|
* Get the OpenAPI schema
|
|
@@ -105,6 +105,50 @@ const getExecutionsForWorkflow = (options) => {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
exports.getExecutionsForWorkflow = getExecutionsForWorkflow;
|
|
108
|
+
/**
|
|
109
|
+
* Delete credentials for a workflow
|
|
110
|
+
*/
|
|
111
|
+
const deleteWorkflowCredentials = (options) => {
|
|
112
|
+
return (options.client ?? client_gen_1.client).delete({
|
|
113
|
+
url: '/workflow/{workflow_id}/credentials',
|
|
114
|
+
...options
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
exports.deleteWorkflowCredentials = deleteWorkflowCredentials;
|
|
118
|
+
/**
|
|
119
|
+
* Get credentials for a workflow (and all prior versions of the workflow)
|
|
120
|
+
*/
|
|
121
|
+
const getWorkflowCredentials = (options) => {
|
|
122
|
+
return (options.client ?? client_gen_1.client).get({
|
|
123
|
+
url: '/workflow/{workflow_id}/credentials',
|
|
124
|
+
...options
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
exports.getWorkflowCredentials = getWorkflowCredentials;
|
|
128
|
+
/**
|
|
129
|
+
* Add a credential for a workflow
|
|
130
|
+
*/
|
|
131
|
+
const addWorkflowCredential = (options) => {
|
|
132
|
+
return (options.client ?? client_gen_1.client).patch({
|
|
133
|
+
url: '/workflow/{workflow_id}/credentials',
|
|
134
|
+
...options,
|
|
135
|
+
headers: {
|
|
136
|
+
'Content-Type': 'application/json',
|
|
137
|
+
...options?.headers
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
exports.addWorkflowCredential = addWorkflowCredential;
|
|
142
|
+
/**
|
|
143
|
+
* Get the public key for credentials
|
|
144
|
+
*/
|
|
145
|
+
const getCredentialsPublicKey = (options) => {
|
|
146
|
+
return (options?.client ?? client_gen_1.client).get({
|
|
147
|
+
url: '/credentials/public_key',
|
|
148
|
+
...options
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
exports.getCredentialsPublicKey = getCredentialsPublicKey;
|
|
108
152
|
/**
|
|
109
153
|
* Delete an execution
|
|
110
154
|
*/
|
|
@@ -193,3 +237,37 @@ const getExecutionFiles = (options) => {
|
|
|
193
237
|
});
|
|
194
238
|
};
|
|
195
239
|
exports.getExecutionFiles = getExecutionFiles;
|
|
240
|
+
/**
|
|
241
|
+
* Get all versions of a workflow
|
|
242
|
+
*/
|
|
243
|
+
const getWorkflowVersions = (options) => {
|
|
244
|
+
return (options.client ?? client_gen_1.client).get({
|
|
245
|
+
url: '/workflow/{workflow_id}/versions',
|
|
246
|
+
...options
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
exports.getWorkflowVersions = getWorkflowVersions;
|
|
250
|
+
/**
|
|
251
|
+
* Get all user messages for an execution
|
|
252
|
+
*/
|
|
253
|
+
const getExecutionUserMessages = (options) => {
|
|
254
|
+
return (options.client ?? client_gen_1.client).get({
|
|
255
|
+
url: '/execution/{id}/user_messages',
|
|
256
|
+
...options
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
exports.getExecutionUserMessages = getExecutionUserMessages;
|
|
260
|
+
/**
|
|
261
|
+
* Create a user message for an execution
|
|
262
|
+
*/
|
|
263
|
+
const createExecutionUserMessage = (options) => {
|
|
264
|
+
return (options.client ?? client_gen_1.client).post({
|
|
265
|
+
url: '/execution/{id}/user_messages',
|
|
266
|
+
...options,
|
|
267
|
+
headers: {
|
|
268
|
+
'Content-Type': 'application/json',
|
|
269
|
+
...options?.headers
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
exports.createExecutionUserMessage = createExecutionUserMessage;
|
|
@@ -31,14 +31,14 @@ export type Agent = {
|
|
|
31
31
|
* The visibility of the agent
|
|
32
32
|
*/
|
|
33
33
|
visibility: string;
|
|
34
|
-
/**
|
|
35
|
-
* The required fields for the agent
|
|
36
|
-
*/
|
|
37
|
-
required_fields: Array<string>;
|
|
38
34
|
/**
|
|
39
35
|
* The prompts for the agent
|
|
40
36
|
*/
|
|
41
37
|
required_prompts: Array<string>;
|
|
38
|
+
/**
|
|
39
|
+
* The fields that must be provided when creating a workflow for a given agent
|
|
40
|
+
*/
|
|
41
|
+
required_fields?: Array<string>;
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* A JSON Schema that defines the expected structure and validation rules for workflow results.
|
|
@@ -57,7 +57,7 @@ export type CreateWorkflowRequest = {
|
|
|
57
57
|
user_id?: string;
|
|
58
58
|
result_schema: ResultSchema;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* Unused field for custom configuration
|
|
61
61
|
*/
|
|
62
62
|
fields: {
|
|
63
63
|
[key: string]: unknown;
|
|
@@ -66,10 +66,15 @@ export type CreateWorkflowRequest = {
|
|
|
66
66
|
* The prompts for the workflow. They can have variables in them. They will be merged with the dynamic data passed when the workflow is executed.
|
|
67
67
|
*/
|
|
68
68
|
prompts: Array<string>;
|
|
69
|
+
workflow_options: UnresolvedWorkflowOptions;
|
|
69
70
|
/**
|
|
70
71
|
* The Language Model Provider for the Workflow
|
|
71
72
|
*/
|
|
72
73
|
provider: 'openai' | 'anthropic';
|
|
74
|
+
/**
|
|
75
|
+
* The URL to start the workflow.
|
|
76
|
+
*/
|
|
77
|
+
start_url: string;
|
|
73
78
|
};
|
|
74
79
|
export type Workflow = {
|
|
75
80
|
/**
|
|
@@ -93,12 +98,6 @@ export type Workflow = {
|
|
|
93
98
|
* Workflow name.
|
|
94
99
|
*/
|
|
95
100
|
name: string;
|
|
96
|
-
/**
|
|
97
|
-
* Workflow configuration.
|
|
98
|
-
*/
|
|
99
|
-
fields: {
|
|
100
|
-
[key: string]: unknown;
|
|
101
|
-
};
|
|
102
101
|
/**
|
|
103
102
|
* The prompts for the workflow. They can have variables in them. They will be merged with the dynamic data passed when the workflow is executed.
|
|
104
103
|
*/
|
|
@@ -107,6 +106,22 @@ export type Workflow = {
|
|
|
107
106
|
* The variables in the prompts.
|
|
108
107
|
*/
|
|
109
108
|
prompt_variables?: Array<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Additional options for the workflow. See documentation for more details.
|
|
111
|
+
*/
|
|
112
|
+
workflow_options?: {
|
|
113
|
+
[key: string]: unknown;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The URL to start the workflow.
|
|
117
|
+
*/
|
|
118
|
+
start_url: string;
|
|
119
|
+
/**
|
|
120
|
+
* JSON object containing static workflow configuration (e.g. a prompt_template).
|
|
121
|
+
*/
|
|
122
|
+
fields?: {
|
|
123
|
+
[key: string]: unknown;
|
|
124
|
+
};
|
|
110
125
|
};
|
|
111
126
|
export type WorkflowExecution = {
|
|
112
127
|
workflow: Workflow;
|
|
@@ -118,6 +133,26 @@ export type WorkflowExecution = {
|
|
|
118
133
|
export type WorkflowExecutionRequest = {
|
|
119
134
|
[key: string]: unknown;
|
|
120
135
|
};
|
|
136
|
+
export type CredentialsRequest = {
|
|
137
|
+
credentials: Array<Credential>;
|
|
138
|
+
};
|
|
139
|
+
export type Credential = {
|
|
140
|
+
/**
|
|
141
|
+
* The credential name
|
|
142
|
+
*/
|
|
143
|
+
name: string;
|
|
144
|
+
/**
|
|
145
|
+
* The encrypted credential
|
|
146
|
+
*/
|
|
147
|
+
data: string;
|
|
148
|
+
};
|
|
149
|
+
export type CredentialsResponse = {
|
|
150
|
+
/**
|
|
151
|
+
* The name of the workflow
|
|
152
|
+
*/
|
|
153
|
+
workflow_name: string;
|
|
154
|
+
credentials: Array<Credential>;
|
|
155
|
+
};
|
|
121
156
|
export type Execution = {
|
|
122
157
|
/**
|
|
123
158
|
* Execution identifier.
|
|
@@ -250,6 +285,98 @@ export type File = {
|
|
|
250
285
|
*/
|
|
251
286
|
signed_url: string;
|
|
252
287
|
};
|
|
288
|
+
/**
|
|
289
|
+
* A message given to the agent by the user
|
|
290
|
+
*/
|
|
291
|
+
export type UserMessage = {
|
|
292
|
+
/**
|
|
293
|
+
* Unique identifier for the message
|
|
294
|
+
*/
|
|
295
|
+
id: string;
|
|
296
|
+
/**
|
|
297
|
+
* ID of the execution this message belongs to
|
|
298
|
+
*/
|
|
299
|
+
execution_id: string;
|
|
300
|
+
/**
|
|
301
|
+
* ID of the user who created the message
|
|
302
|
+
*/
|
|
303
|
+
user_id: string;
|
|
304
|
+
/**
|
|
305
|
+
* The message content
|
|
306
|
+
*/
|
|
307
|
+
message: string;
|
|
308
|
+
/**
|
|
309
|
+
* When the message was created
|
|
310
|
+
*/
|
|
311
|
+
created_at: string;
|
|
312
|
+
/**
|
|
313
|
+
* Whether the message has been injected into the agent's conversation
|
|
314
|
+
*/
|
|
315
|
+
injected: boolean;
|
|
316
|
+
/**
|
|
317
|
+
* When the message was injected into the agent's conversation
|
|
318
|
+
*/
|
|
319
|
+
injected_at: string;
|
|
320
|
+
};
|
|
321
|
+
export type CreateMessageRequest = {
|
|
322
|
+
/**
|
|
323
|
+
* The message content
|
|
324
|
+
*/
|
|
325
|
+
message: string;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Optional workflow configuration options. All fields are optional and will use defaults if not specified.
|
|
329
|
+
*/
|
|
330
|
+
export type UnresolvedWorkflowOptions = {
|
|
331
|
+
/**
|
|
332
|
+
* Maximum number of iterations for the workflow
|
|
333
|
+
*/
|
|
334
|
+
max_iterations?: number;
|
|
335
|
+
/**
|
|
336
|
+
* Timeout in seconds per step
|
|
337
|
+
*/
|
|
338
|
+
timeout_per_step?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Browser viewport width
|
|
341
|
+
*/
|
|
342
|
+
viewport_width?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Browser viewport height
|
|
345
|
+
*/
|
|
346
|
+
viewport_height?: number;
|
|
347
|
+
/**
|
|
348
|
+
* Maximum retries for LLM calls
|
|
349
|
+
*/
|
|
350
|
+
max_llm_retries?: number;
|
|
351
|
+
/**
|
|
352
|
+
* Delay between retries in seconds
|
|
353
|
+
*/
|
|
354
|
+
llm_retry_delay?: number;
|
|
355
|
+
/**
|
|
356
|
+
* Maximum pause duration in minutes
|
|
357
|
+
*/
|
|
358
|
+
max_pause_duration?: number;
|
|
359
|
+
/**
|
|
360
|
+
* Status check interval in seconds
|
|
361
|
+
*/
|
|
362
|
+
status_check_interval?: number;
|
|
363
|
+
/**
|
|
364
|
+
* Temperature for LLM (0.0 to 1.0)
|
|
365
|
+
*/
|
|
366
|
+
temperature?: number;
|
|
367
|
+
/**
|
|
368
|
+
* Prompt template for LLM
|
|
369
|
+
*/
|
|
370
|
+
prompt_template?: string;
|
|
371
|
+
/**
|
|
372
|
+
* Allowed tools for LLM
|
|
373
|
+
*/
|
|
374
|
+
allowed_tools?: Array<string>;
|
|
375
|
+
/**
|
|
376
|
+
* Require human approval to finish
|
|
377
|
+
*/
|
|
378
|
+
require_human_approval_to_finish?: boolean;
|
|
379
|
+
};
|
|
253
380
|
export type GetOpenApiData = {
|
|
254
381
|
body?: never;
|
|
255
382
|
path?: never;
|
|
@@ -421,6 +548,80 @@ export type GetExecutionsForWorkflowResponses = {
|
|
|
421
548
|
200: Array<Execution>;
|
|
422
549
|
};
|
|
423
550
|
export type GetExecutionsForWorkflowResponse = GetExecutionsForWorkflowResponses[keyof GetExecutionsForWorkflowResponses];
|
|
551
|
+
export type DeleteWorkflowCredentialsData = {
|
|
552
|
+
body?: never;
|
|
553
|
+
path: {
|
|
554
|
+
workflow_id: string;
|
|
555
|
+
};
|
|
556
|
+
query?: never;
|
|
557
|
+
url: '/workflow/{workflow_id}/credentials';
|
|
558
|
+
};
|
|
559
|
+
export type DeleteWorkflowCredentialsErrors = {
|
|
560
|
+
/**
|
|
561
|
+
* Workflow not found
|
|
562
|
+
*/
|
|
563
|
+
404: unknown;
|
|
564
|
+
};
|
|
565
|
+
export type DeleteWorkflowCredentialsResponses = {
|
|
566
|
+
/**
|
|
567
|
+
* Credentials deleted successfully
|
|
568
|
+
*/
|
|
569
|
+
200: unknown;
|
|
570
|
+
};
|
|
571
|
+
export type GetWorkflowCredentialsData = {
|
|
572
|
+
body?: never;
|
|
573
|
+
path: {
|
|
574
|
+
workflow_id: string;
|
|
575
|
+
};
|
|
576
|
+
query?: never;
|
|
577
|
+
url: '/workflow/{workflow_id}/credentials';
|
|
578
|
+
};
|
|
579
|
+
export type GetWorkflowCredentialsErrors = {
|
|
580
|
+
/**
|
|
581
|
+
* Workflow not found
|
|
582
|
+
*/
|
|
583
|
+
404: unknown;
|
|
584
|
+
};
|
|
585
|
+
export type GetWorkflowCredentialsResponses = {
|
|
586
|
+
/**
|
|
587
|
+
* The workflow credentials
|
|
588
|
+
*/
|
|
589
|
+
200: CredentialsResponse;
|
|
590
|
+
};
|
|
591
|
+
export type GetWorkflowCredentialsResponse = GetWorkflowCredentialsResponses[keyof GetWorkflowCredentialsResponses];
|
|
592
|
+
export type AddWorkflowCredentialData = {
|
|
593
|
+
body: CredentialsRequest;
|
|
594
|
+
path: {
|
|
595
|
+
workflow_id: string;
|
|
596
|
+
};
|
|
597
|
+
query?: never;
|
|
598
|
+
url: '/workflow/{workflow_id}/credentials';
|
|
599
|
+
};
|
|
600
|
+
export type AddWorkflowCredentialResponses = {
|
|
601
|
+
/**
|
|
602
|
+
* Credentials set successfully
|
|
603
|
+
*/
|
|
604
|
+
200: unknown;
|
|
605
|
+
};
|
|
606
|
+
export type GetCredentialsPublicKeyData = {
|
|
607
|
+
body?: never;
|
|
608
|
+
path?: never;
|
|
609
|
+
query?: never;
|
|
610
|
+
url: '/credentials/public_key';
|
|
611
|
+
};
|
|
612
|
+
export type GetCredentialsPublicKeyErrors = {
|
|
613
|
+
/**
|
|
614
|
+
* Public key not found
|
|
615
|
+
*/
|
|
616
|
+
404: unknown;
|
|
617
|
+
};
|
|
618
|
+
export type GetCredentialsPublicKeyResponses = {
|
|
619
|
+
/**
|
|
620
|
+
* The public key for credentials
|
|
621
|
+
*/
|
|
622
|
+
200: string;
|
|
623
|
+
};
|
|
624
|
+
export type GetCredentialsPublicKeyResponse = GetCredentialsPublicKeyResponses[keyof GetCredentialsPublicKeyResponses];
|
|
424
625
|
export type DeleteExecutionData = {
|
|
425
626
|
body?: never;
|
|
426
627
|
path: {
|
|
@@ -592,6 +793,68 @@ export type GetExecutionFilesResponses = {
|
|
|
592
793
|
200: Array<File>;
|
|
593
794
|
};
|
|
594
795
|
export type GetExecutionFilesResponse = GetExecutionFilesResponses[keyof GetExecutionFilesResponses];
|
|
796
|
+
export type GetWorkflowVersionsData = {
|
|
797
|
+
body?: never;
|
|
798
|
+
path: {
|
|
799
|
+
workflow_id: string;
|
|
800
|
+
};
|
|
801
|
+
query?: never;
|
|
802
|
+
url: '/workflow/{workflow_id}/versions';
|
|
803
|
+
};
|
|
804
|
+
export type GetWorkflowVersionsErrors = {
|
|
805
|
+
/**
|
|
806
|
+
* Workflow not found
|
|
807
|
+
*/
|
|
808
|
+
404: unknown;
|
|
809
|
+
};
|
|
810
|
+
export type GetWorkflowVersionsResponses = {
|
|
811
|
+
/**
|
|
812
|
+
* List of workflow versions
|
|
813
|
+
*/
|
|
814
|
+
200: Array<Workflow>;
|
|
815
|
+
};
|
|
816
|
+
export type GetWorkflowVersionsResponse = GetWorkflowVersionsResponses[keyof GetWorkflowVersionsResponses];
|
|
817
|
+
export type GetExecutionUserMessagesData = {
|
|
818
|
+
body?: never;
|
|
819
|
+
path: {
|
|
820
|
+
id: string;
|
|
821
|
+
};
|
|
822
|
+
query?: never;
|
|
823
|
+
url: '/execution/{id}/user_messages';
|
|
824
|
+
};
|
|
825
|
+
export type GetExecutionUserMessagesErrors = {
|
|
826
|
+
/**
|
|
827
|
+
* Execution not found
|
|
828
|
+
*/
|
|
829
|
+
404: unknown;
|
|
830
|
+
};
|
|
831
|
+
export type GetExecutionUserMessagesResponses = {
|
|
832
|
+
/**
|
|
833
|
+
* List of messages for the execution
|
|
834
|
+
*/
|
|
835
|
+
200: Array<UserMessage>;
|
|
836
|
+
};
|
|
837
|
+
export type GetExecutionUserMessagesResponse = GetExecutionUserMessagesResponses[keyof GetExecutionUserMessagesResponses];
|
|
838
|
+
export type CreateExecutionUserMessageData = {
|
|
839
|
+
body: CreateMessageRequest;
|
|
840
|
+
path: {
|
|
841
|
+
id: string;
|
|
842
|
+
};
|
|
843
|
+
query?: never;
|
|
844
|
+
url: '/execution/{id}/user_messages';
|
|
845
|
+
};
|
|
846
|
+
export type CreateExecutionUserMessageErrors = {
|
|
847
|
+
/**
|
|
848
|
+
* Execution not found
|
|
849
|
+
*/
|
|
850
|
+
404: unknown;
|
|
851
|
+
};
|
|
852
|
+
export type CreateExecutionUserMessageResponses = {
|
|
853
|
+
/**
|
|
854
|
+
* Message created successfully
|
|
855
|
+
*/
|
|
856
|
+
201: unknown;
|
|
857
|
+
};
|
|
595
858
|
export type ClientOptions = {
|
|
596
859
|
baseUrl: `${string}://${string}/api/v1` | (string & {});
|
|
597
860
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { CreateWorkflowRequest, WorkflowExecutionRequest, Execution } from './generated/agents/types.gen';
|
|
2
|
+
import type { CreateWorkflowRequest, WorkflowExecutionRequest, Execution, BrowserSession } from './generated/agents/types.gen';
|
|
3
3
|
/**
|
|
4
4
|
* Create an API client with a provided API key.
|
|
5
5
|
*
|
|
@@ -9,7 +9,9 @@ import type { CreateWorkflowRequest, WorkflowExecutionRequest, Execution } from
|
|
|
9
9
|
* @example
|
|
10
10
|
* const client = AsteroidClient('your-api-key');
|
|
11
11
|
*/
|
|
12
|
-
export declare const AsteroidClient: (apiKey: string
|
|
12
|
+
export declare const AsteroidClient: (apiKey: string, options?: {
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
}) => Client;
|
|
13
15
|
/**
|
|
14
16
|
* Create a new workflow for a given agent.
|
|
15
17
|
*
|
|
@@ -80,6 +82,14 @@ export declare const getWorkflowExecutionProgress: (client: Client, executionId:
|
|
|
80
82
|
* console.log(result);
|
|
81
83
|
*/
|
|
82
84
|
export declare const getWorkflowResult: (client: Client, executionId: string) => Promise<Record<string, unknown>>;
|
|
85
|
+
/**
|
|
86
|
+
* Get the browser session for an execution.
|
|
87
|
+
*
|
|
88
|
+
* @param client - The API client.
|
|
89
|
+
* @param executionId - The execution identifier.
|
|
90
|
+
* @returns The browser session.
|
|
91
|
+
*/
|
|
92
|
+
export declare const getBrowserSession: (client: Client, executionId: string) => Promise<BrowserSession>;
|
|
83
93
|
/**
|
|
84
94
|
* Waits for a workflow execution to reach a terminal state and returns the result.
|
|
85
95
|
* Continuously polls the execution status until it's either "completed", "cancelled", or "failed".
|
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.getWorkflowResult = exports.getWorkflowExecutionProgress = exports.getExecutionStatus = exports.executeWorkflowById = exports.createNewWorkflow = exports.AsteroidClient = void 0;
|
|
39
|
+
exports.waitForExecutionResult = exports.getBrowserSession = exports.getWorkflowResult = exports.getWorkflowExecutionProgress = exports.getExecutionStatus = exports.executeWorkflowById = exports.createNewWorkflow = 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
|
/**
|
|
@@ -48,9 +48,9 @@ const AgentsSDK = __importStar(require("./generated/agents/sdk.gen"));
|
|
|
48
48
|
* @example
|
|
49
49
|
* const client = AsteroidClient('your-api-key');
|
|
50
50
|
*/
|
|
51
|
-
const AsteroidClient = (apiKey) => {
|
|
51
|
+
const AsteroidClient = (apiKey, options) => {
|
|
52
52
|
return (0, client_fetch_1.createClient)({
|
|
53
|
-
baseUrl: 'https://odyssey.asteroid.ai/api/v1',
|
|
53
|
+
baseUrl: options?.baseUrl || 'https://odyssey.asteroid.ai/api/v1',
|
|
54
54
|
headers: {
|
|
55
55
|
'X-Asteroid-Agents-Api-Key': apiKey
|
|
56
56
|
}
|
|
@@ -75,9 +75,6 @@ exports.AsteroidClient = AsteroidClient;
|
|
|
75
75
|
* });
|
|
76
76
|
*/
|
|
77
77
|
const createNewWorkflow = async (client, agentName, workflowDetails) => {
|
|
78
|
-
// Add a workflow_name key to the workflowDetails.fields object
|
|
79
|
-
// This field is deprecated and will be removed in a future version.
|
|
80
|
-
workflowDetails.fields.workflow_name = workflowDetails.name;
|
|
81
78
|
const response = await AgentsSDK.createWorkflow({
|
|
82
79
|
client,
|
|
83
80
|
path: { agent_name: agentName },
|
|
@@ -173,6 +170,24 @@ const getWorkflowResult = async (client, executionId) => {
|
|
|
173
170
|
return execution.result;
|
|
174
171
|
};
|
|
175
172
|
exports.getWorkflowResult = getWorkflowResult;
|
|
173
|
+
/**
|
|
174
|
+
* Get the browser session for an execution.
|
|
175
|
+
*
|
|
176
|
+
* @param client - The API client.
|
|
177
|
+
* @param executionId - The execution identifier.
|
|
178
|
+
* @returns The browser session.
|
|
179
|
+
*/
|
|
180
|
+
const getBrowserSession = async (client, executionId) => {
|
|
181
|
+
const browserSession = await AgentsSDK.getBrowserSession({
|
|
182
|
+
client,
|
|
183
|
+
path: { id: executionId },
|
|
184
|
+
});
|
|
185
|
+
if (browserSession.error) {
|
|
186
|
+
throw new Error(browserSession.error);
|
|
187
|
+
}
|
|
188
|
+
return browserSession.data;
|
|
189
|
+
};
|
|
190
|
+
exports.getBrowserSession = getBrowserSession;
|
|
176
191
|
/**
|
|
177
192
|
* Waits for a workflow execution to reach a terminal state and returns the result.
|
|
178
193
|
* Continuously polls the execution status until it's either "completed", "cancelled", or "failed".
|