asteroid-odyssey 1.0.12 → 1.0.16

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/README.md CHANGED
@@ -1,54 +1,17 @@
1
1
  # Agents SDK, TypeScript
2
2
 
3
- This is a TypeScript SDK for the Asteroid Agents API.
3
+ The official TypeScript SDK for interacting with the Asteroid Agents API.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install asteroid-sdk
8
+ npm install asteroid-odyssey
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
- Below is a minimal example showing how to start an agent workflow, poll for its status until it's completed, and then retrieve its result:
13
+ Please head to our documentation at https://docs.asteroid.ai/sdk/typescript
14
14
 
15
- ```ts
16
- import { AsteroidAgents } from 'asteroid-sdk';
15
+ ## License
17
16
 
18
- const asteroid = new AsteroidAgents('YOUR_API_KEY'); // Generate a key at https://platform.asteroid.ai
19
-
20
- const workflowID = 'YOUR_WORKFLOW_ID'; // You can create a workflow at https://platform.asteroid.ai or use the .createWorkflow() method
21
-
22
- async function runWorkflowExample() {
23
- try {
24
- // Start the workflow
25
- const runID = await asteroid.runWorkflow(workflowID, { name: 'Alice' });
26
- console.log('Workflow run initiated with ID:', runID);
27
-
28
- // Poll for the workflow status until it completes
29
- while (true) {
30
- const status = await asteroid.getRunStatus(runID);
31
- console.log('Current workflow status:', status);
32
- if (status === 'completed') break;
33
- // Wait for 1 second before checking again
34
- await new Promise(resolve => setTimeout(resolve, 1000));
35
- }
36
-
37
- // Retrieve the result after completion
38
- const result = await asteroid.getRunResult(runID);
39
- console.log('Workflow completed. Result:', result);
40
- } catch (error) {
41
- console.error('Error executing the workflow:', error);
42
- }
43
- }
44
-
45
- runWorkflowExample();
46
- ```
47
-
48
- ## Development
49
-
50
- Regenerate the client SDK from the OpenAPI spec (assuming it's located at `../agents/server/api/openapi.yaml`):
51
-
52
- ```bash
53
- npm run generate
54
- ```
17
+ The Asteroid Odyssey SDK is available under the MIT License.
@@ -0,0 +1,12 @@
1
+ import type { ClientOptions } from './types.gen';
2
+ import { type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch';
3
+ /**
4
+ * The `createClientConfig()` function will be called on client initialization
5
+ * and the returned object will become the client's initial configuration.
6
+ *
7
+ * You may want to initialize your client this way instead of calling
8
+ * `setConfig()`. This is useful for example if you're using Next.js
9
+ * to ensure your client always has the correct values.
10
+ */
11
+ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>;
12
+ export declare const client: import("@hey-api/client-fetch").Client;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // This file is auto-generated by @hey-api/openapi-ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.client = void 0;
5
+ const client_fetch_1 = require("@hey-api/client-fetch");
6
+ exports.client = (0, client_fetch_1.createClient)((0, client_fetch_1.createConfig)());
@@ -1,16 +1,2 @@
1
- export { ApiError } from './core/ApiError';
2
- export { CancelablePromise, CancelError } from './core/CancelablePromise';
3
- export { OpenAPI } from './core/OpenAPI';
4
- export type { OpenAPIConfig } from './core/OpenAPI';
5
- export type { Agent } from './models/Agent';
6
- export { CreateWorkflowRequest } from './models/CreateWorkflowRequest';
7
- export type { Execution } from './models/Execution';
8
- export type { OptimisationRequest } from './models/OptimisationRequest';
9
- export type { Workflow } from './models/Workflow';
10
- export type { WorkflowExecution } from './models/WorkflowExecution';
11
- export type { WorkflowExecutionRequest } from './models/WorkflowExecutionRequest';
12
- export { AgentService } from './services/AgentService';
13
- export { ApiService } from './services/ApiService';
14
- export { DefaultService } from './services/DefaultService';
15
- export { OptimiserService } from './services/OptimiserService';
16
- export { WorkflowService } from './services/WorkflowService';
1
+ export * from './types.gen';
2
+ export * from './sdk.gen';
@@ -1,26 +1,19 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WorkflowService = exports.OptimiserService = exports.DefaultService = exports.ApiService = exports.AgentService = exports.CreateWorkflowRequest = exports.OpenAPI = exports.CancelError = exports.CancelablePromise = exports.ApiError = void 0;
4
- /* generated using openapi-typescript-codegen -- do not edit */
5
- /* istanbul ignore file */
6
- /* tslint:disable */
7
- /* eslint-disable */
8
- var ApiError_1 = require("./core/ApiError");
9
- Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return ApiError_1.ApiError; } });
10
- var CancelablePromise_1 = require("./core/CancelablePromise");
11
- Object.defineProperty(exports, "CancelablePromise", { enumerable: true, get: function () { return CancelablePromise_1.CancelablePromise; } });
12
- Object.defineProperty(exports, "CancelError", { enumerable: true, get: function () { return CancelablePromise_1.CancelError; } });
13
- var OpenAPI_1 = require("./core/OpenAPI");
14
- Object.defineProperty(exports, "OpenAPI", { enumerable: true, get: function () { return OpenAPI_1.OpenAPI; } });
15
- var CreateWorkflowRequest_1 = require("./models/CreateWorkflowRequest");
16
- Object.defineProperty(exports, "CreateWorkflowRequest", { enumerable: true, get: function () { return CreateWorkflowRequest_1.CreateWorkflowRequest; } });
17
- var AgentService_1 = require("./services/AgentService");
18
- Object.defineProperty(exports, "AgentService", { enumerable: true, get: function () { return AgentService_1.AgentService; } });
19
- var ApiService_1 = require("./services/ApiService");
20
- Object.defineProperty(exports, "ApiService", { enumerable: true, get: function () { return ApiService_1.ApiService; } });
21
- var DefaultService_1 = require("./services/DefaultService");
22
- Object.defineProperty(exports, "DefaultService", { enumerable: true, get: function () { return DefaultService_1.DefaultService; } });
23
- var OptimiserService_1 = require("./services/OptimiserService");
24
- Object.defineProperty(exports, "OptimiserService", { enumerable: true, get: function () { return OptimiserService_1.OptimiserService; } });
25
- var WorkflowService_1 = require("./services/WorkflowService");
26
- Object.defineProperty(exports, "WorkflowService", { enumerable: true, get: function () { return WorkflowService_1.WorkflowService; } });
17
+ // This file is auto-generated by @hey-api/openapi-ts
18
+ __exportStar(require("./types.gen"), exports);
19
+ __exportStar(require("./sdk.gen"), exports);
@@ -0,0 +1,95 @@
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';
3
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
4
+ /**
5
+ * You can provide a client instance returned by `createClient()` instead of
6
+ * individual options. This might be also useful if you want to implement a
7
+ * custom client.
8
+ */
9
+ client?: Client;
10
+ /**
11
+ * You can pass arbitrary values through the `meta` object. This can be
12
+ * used to access values that aren't defined as part of the SDK function.
13
+ */
14
+ meta?: Record<string, unknown>;
15
+ };
16
+ /**
17
+ * Get the OpenAPI schema
18
+ */
19
+ export declare const getOpenApi: <ThrowOnError extends boolean = false>(options?: Options<GetOpenApiData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
20
+ /**
21
+ * Check the health of the API
22
+ */
23
+ export declare const healthCheck: <ThrowOnError extends boolean = false>(options?: Options<HealthCheckData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
24
+ status?: string;
25
+ }, {
26
+ error?: string;
27
+ }, ThrowOnError>;
28
+ /**
29
+ * Get all agents
30
+ */
31
+ export declare const getAgents: <ThrowOnError extends boolean = false>(options?: Options<GetAgentsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Agent[], unknown, ThrowOnError>;
32
+ /**
33
+ * Queue an optimisation job
34
+ */
35
+ export declare const queueOptimisationJob: <ThrowOnError extends boolean = false>(options?: Options<QueueOptimisationJobData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
36
+ /**
37
+ * Create a new workflow for an agent
38
+ */
39
+ export declare const createWorkflow: <ThrowOnError extends boolean = false>(options: Options<CreateWorkflowData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<string, unknown, ThrowOnError>;
40
+ /**
41
+ * Delete a workflow
42
+ */
43
+ export declare const deleteWorkflow: <ThrowOnError extends boolean = false>(options: Options<DeleteWorkflowData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
44
+ result?: string;
45
+ }, {
46
+ error?: string;
47
+ }, ThrowOnError>;
48
+ /**
49
+ * Get a workflow
50
+ */
51
+ export declare const getWorkflow: <ThrowOnError extends boolean = false>(options: Options<GetWorkflowData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Workflow, unknown, ThrowOnError>;
52
+ /**
53
+ * Execute a saved workflow for an agent
54
+ */
55
+ export declare const executeWorkflow: <ThrowOnError extends boolean = false>(options: Options<ExecuteWorkflowData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<string, unknown, ThrowOnError>;
56
+ /**
57
+ * Get all executions for a workflow
58
+ */
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 an execution
62
+ */
63
+ export declare const deleteExecution: <ThrowOnError extends boolean = false>(options: Options<DeleteExecutionData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
64
+ result?: string;
65
+ }, {
66
+ error?: string;
67
+ }, ThrowOnError>;
68
+ /**
69
+ * Get an execution
70
+ */
71
+ export declare const getExecution: <ThrowOnError extends boolean = false>(options: Options<GetExecutionData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Execution, unknown, ThrowOnError>;
72
+ /**
73
+ * Update the status of an execution
74
+ */
75
+ export declare const updateExecutionStatus: <ThrowOnError extends boolean = false>(options: Options<UpdateExecutionStatusData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
76
+ /**
77
+ * Get the browser session for an execution
78
+ */
79
+ export declare const getBrowserSession: <ThrowOnError extends boolean = false>(options: Options<GetBrowserSessionData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").BrowserSession, unknown, ThrowOnError>;
80
+ /**
81
+ * Set your slack notification channel
82
+ */
83
+ export declare const setSlackChannel: <ThrowOnError extends boolean = false>(options: Options<SetSlackChannelData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<unknown, unknown, ThrowOnError>;
84
+ /**
85
+ * Get all workflows and their executions
86
+ */
87
+ export declare const getAgentWorkflowExecutions: <ThrowOnError extends boolean = false>(options: Options<GetAgentWorkflowExecutionsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").WorkflowExecution[], unknown, ThrowOnError>;
88
+ /**
89
+ * Get the progress of an execution
90
+ */
91
+ export declare const getExecutionProgress: <ThrowOnError extends boolean = false>(options: Options<GetExecutionProgressData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ProgressUpdate[], unknown, ThrowOnError>;
92
+ /**
93
+ * Get files for an execution
94
+ */
95
+ export declare const getExecutionFiles: <ThrowOnError extends boolean = false>(options: Options<GetExecutionFilesData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").File[], unknown, ThrowOnError>;
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ // This file is auto-generated by @hey-api/openapi-ts
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;
5
+ const client_gen_1 = require("./client.gen");
6
+ /**
7
+ * Get the OpenAPI schema
8
+ */
9
+ const getOpenApi = (options) => {
10
+ return (options?.client ?? client_gen_1.client).get({
11
+ url: '/openapi.yaml',
12
+ ...options
13
+ });
14
+ };
15
+ exports.getOpenApi = getOpenApi;
16
+ /**
17
+ * Check the health of the API
18
+ */
19
+ const healthCheck = (options) => {
20
+ return (options?.client ?? client_gen_1.client).get({
21
+ url: '/health',
22
+ ...options
23
+ });
24
+ };
25
+ exports.healthCheck = healthCheck;
26
+ /**
27
+ * Get all agents
28
+ */
29
+ const getAgents = (options) => {
30
+ return (options?.client ?? client_gen_1.client).get({
31
+ url: '/agents',
32
+ ...options
33
+ });
34
+ };
35
+ exports.getAgents = getAgents;
36
+ /**
37
+ * Queue an optimisation job
38
+ */
39
+ const queueOptimisationJob = (options) => {
40
+ return (options?.client ?? client_gen_1.client).post({
41
+ url: '/optimiser',
42
+ ...options,
43
+ headers: {
44
+ 'Content-Type': 'application/json',
45
+ ...options?.headers
46
+ }
47
+ });
48
+ };
49
+ exports.queueOptimisationJob = queueOptimisationJob;
50
+ /**
51
+ * Create a new workflow for an agent
52
+ */
53
+ const createWorkflow = (options) => {
54
+ return (options.client ?? client_gen_1.client).post({
55
+ url: '/workflow/{agent_name}/create',
56
+ ...options,
57
+ headers: {
58
+ 'Content-Type': 'application/json',
59
+ ...options?.headers
60
+ }
61
+ });
62
+ };
63
+ exports.createWorkflow = createWorkflow;
64
+ /**
65
+ * Delete a workflow
66
+ */
67
+ const deleteWorkflow = (options) => {
68
+ return (options.client ?? client_gen_1.client).delete({
69
+ url: '/workflow/{workflow_id}',
70
+ ...options
71
+ });
72
+ };
73
+ exports.deleteWorkflow = deleteWorkflow;
74
+ /**
75
+ * Get a workflow
76
+ */
77
+ const getWorkflow = (options) => {
78
+ return (options.client ?? client_gen_1.client).get({
79
+ url: '/workflow/{workflow_id}',
80
+ ...options
81
+ });
82
+ };
83
+ exports.getWorkflow = getWorkflow;
84
+ /**
85
+ * Execute a saved workflow for an agent
86
+ */
87
+ const executeWorkflow = (options) => {
88
+ return (options.client ?? client_gen_1.client).post({
89
+ url: '/workflow/{workflow_id}',
90
+ ...options,
91
+ headers: {
92
+ 'Content-Type': 'application/json',
93
+ ...options?.headers
94
+ }
95
+ });
96
+ };
97
+ exports.executeWorkflow = executeWorkflow;
98
+ /**
99
+ * Get all executions for a workflow
100
+ */
101
+ const getExecutionsForWorkflow = (options) => {
102
+ return (options.client ?? client_gen_1.client).get({
103
+ url: '/workflow/{workflow_id}/executions',
104
+ ...options
105
+ });
106
+ };
107
+ exports.getExecutionsForWorkflow = getExecutionsForWorkflow;
108
+ /**
109
+ * Delete an execution
110
+ */
111
+ const deleteExecution = (options) => {
112
+ return (options.client ?? client_gen_1.client).delete({
113
+ url: '/execution/{id}',
114
+ ...options
115
+ });
116
+ };
117
+ exports.deleteExecution = deleteExecution;
118
+ /**
119
+ * Get an execution
120
+ */
121
+ const getExecution = (options) => {
122
+ return (options.client ?? client_gen_1.client).get({
123
+ url: '/execution/{id}',
124
+ ...options
125
+ });
126
+ };
127
+ exports.getExecution = getExecution;
128
+ /**
129
+ * Update the status of an execution
130
+ */
131
+ const updateExecutionStatus = (options) => {
132
+ return (options.client ?? client_gen_1.client).post({
133
+ url: '/execution/{id}/status',
134
+ ...options,
135
+ headers: {
136
+ 'Content-Type': 'application/json',
137
+ ...options?.headers
138
+ }
139
+ });
140
+ };
141
+ exports.updateExecutionStatus = updateExecutionStatus;
142
+ /**
143
+ * Get the browser session for an execution
144
+ */
145
+ const getBrowserSession = (options) => {
146
+ return (options.client ?? client_gen_1.client).get({
147
+ url: '/execution/{id}/browser_session',
148
+ ...options
149
+ });
150
+ };
151
+ exports.getBrowserSession = getBrowserSession;
152
+ /**
153
+ * Set your slack notification channel
154
+ */
155
+ const setSlackChannel = (options) => {
156
+ return (options.client ?? client_gen_1.client).post({
157
+ url: '/slack_channel',
158
+ ...options,
159
+ headers: {
160
+ 'Content-Type': 'application/json',
161
+ ...options?.headers
162
+ }
163
+ });
164
+ };
165
+ exports.setSlackChannel = setSlackChannel;
166
+ /**
167
+ * Get all workflows and their executions
168
+ */
169
+ const getAgentWorkflowExecutions = (options) => {
170
+ return (options.client ?? client_gen_1.client).get({
171
+ url: '/agent/{agent_name}/workflows',
172
+ ...options
173
+ });
174
+ };
175
+ exports.getAgentWorkflowExecutions = getAgentWorkflowExecutions;
176
+ /**
177
+ * Get the progress of an execution
178
+ */
179
+ const getExecutionProgress = (options) => {
180
+ return (options.client ?? client_gen_1.client).get({
181
+ url: '/execution/{id}/progress',
182
+ ...options
183
+ });
184
+ };
185
+ exports.getExecutionProgress = getExecutionProgress;
186
+ /**
187
+ * Get files for an execution
188
+ */
189
+ const getExecutionFiles = (options) => {
190
+ return (options.client ?? client_gen_1.client).get({
191
+ url: '/execution/{id}/files',
192
+ ...options
193
+ });
194
+ };
195
+ exports.getExecutionFiles = getExecutionFiles;