asteroid-odyssey 1.0.8 → 1.0.11
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/AgentsSDK.d.ts +70 -0
- package/dist/AgentsSDK.js +102 -0
- package/dist/Asteroid.d.ts +70 -0
- package/dist/Asteroid.js +102 -0
- package/dist/examples/index.d.ts +1 -0
- package/dist/examples/index.js +33 -0
- package/dist/generated/agents/models/Workflow.d.ts +4 -0
- package/dist/generated/agents/services/WorkflowService.d.ts +2 -1
- package/dist/generated/agents/services/WorkflowService.js +6 -2
- package/dist/index.js +3 -1
- package/dist/src/generated/agents/core/ApiError.d.ts +10 -0
- package/dist/src/generated/agents/core/ApiError.js +20 -0
- package/dist/src/generated/agents/core/ApiRequestOptions.d.ts +13 -0
- package/dist/src/generated/agents/core/ApiRequestOptions.js +2 -0
- package/dist/src/generated/agents/core/ApiResult.d.ts +7 -0
- package/dist/src/generated/agents/core/ApiResult.js +2 -0
- package/dist/src/generated/agents/core/CancelablePromise.d.ts +20 -0
- package/dist/src/generated/agents/core/CancelablePromise.js +104 -0
- package/dist/src/generated/agents/core/OpenAPI.d.ts +16 -0
- package/dist/src/generated/agents/core/OpenAPI.js +14 -0
- package/dist/src/generated/agents/core/request.d.ts +30 -0
- package/dist/src/generated/agents/core/request.js +294 -0
- package/dist/src/generated/agents/index.d.ts +16 -0
- package/dist/src/generated/agents/index.js +24 -0
- package/dist/src/generated/agents/models/Agent.d.ts +22 -0
- package/dist/src/generated/agents/models/Agent.js +2 -0
- package/dist/src/generated/agents/models/CreateWorkflowRequest.d.ts +14 -0
- package/dist/src/generated/agents/models/CreateWorkflowRequest.js +2 -0
- package/dist/src/generated/agents/models/Execution.d.ts +18 -0
- package/dist/src/generated/agents/models/Execution.js +2 -0
- package/dist/src/generated/agents/models/OptimisationRequest.d.ts +6 -0
- package/dist/src/generated/agents/models/OptimisationRequest.js +2 -0
- package/dist/src/generated/agents/models/Workflow.d.ts +26 -0
- package/dist/src/generated/agents/models/Workflow.js +2 -0
- package/dist/src/generated/agents/models/WorkflowExecution.d.ts +6 -0
- package/dist/src/generated/agents/models/WorkflowExecution.js +2 -0
- package/dist/src/generated/agents/models/WorkflowExecutionRequest.d.ts +4 -0
- package/dist/src/generated/agents/models/WorkflowExecutionRequest.js +2 -0
- package/dist/src/generated/agents/services/AgentService.d.ts +10 -0
- package/dist/src/generated/agents/services/AgentService.js +19 -0
- package/dist/src/generated/agents/services/ApiService.d.ts +9 -0
- package/dist/src/generated/agents/services/ApiService.js +19 -0
- package/dist/src/generated/agents/services/DefaultService.d.ts +23 -0
- package/dist/src/generated/agents/services/DefaultService.js +43 -0
- package/dist/src/generated/agents/services/OptimiserService.d.ts +11 -0
- package/dist/src/generated/agents/services/OptimiserService.js +22 -0
- package/dist/src/generated/agents/services/WorkflowService.d.ts +19 -0
- package/dist/src/generated/agents/services/WorkflowService.js +40 -0
- package/dist/src/generated/platform/core/ApiError.d.ts +10 -0
- package/dist/src/generated/platform/core/ApiError.js +20 -0
- package/dist/src/generated/platform/core/ApiRequestOptions.d.ts +13 -0
- package/dist/src/generated/platform/core/ApiRequestOptions.js +2 -0
- package/dist/src/generated/platform/core/ApiResult.d.ts +7 -0
- package/dist/src/generated/platform/core/ApiResult.js +2 -0
- package/dist/src/generated/platform/core/CancelablePromise.d.ts +20 -0
- package/dist/src/generated/platform/core/CancelablePromise.js +104 -0
- package/dist/src/generated/platform/core/OpenAPI.d.ts +16 -0
- package/dist/src/generated/platform/core/OpenAPI.js +14 -0
- package/dist/src/generated/platform/core/request.d.ts +30 -0
- package/dist/src/generated/platform/core/request.js +294 -0
- package/dist/src/generated/platform/index.d.ts +56 -0
- package/dist/src/generated/platform/index.js +58 -0
- package/dist/src/generated/platform/models/APIKey.d.ts +9 -0
- package/dist/src/generated/platform/models/APIKey.js +2 -0
- package/dist/src/generated/platform/models/AgentReport.d.ts +45 -0
- package/dist/src/generated/platform/models/AgentReport.js +2 -0
- package/dist/src/generated/platform/models/AsteroidChat.d.ts +9 -0
- package/dist/src/generated/platform/models/AsteroidChat.js +2 -0
- package/dist/src/generated/platform/models/AsteroidChoice.d.ts +16 -0
- package/dist/src/generated/platform/models/AsteroidChoice.js +14 -0
- package/dist/src/generated/platform/models/AsteroidMessage.d.ts +27 -0
- package/dist/src/generated/platform/models/AsteroidMessage.js +15 -0
- package/dist/src/generated/platform/models/AsteroidToolCall.d.ts +11 -0
- package/dist/src/generated/platform/models/AsteroidToolCall.js +2 -0
- package/dist/src/generated/platform/models/ChainExecution.d.ts +6 -0
- package/dist/src/generated/platform/models/ChainExecution.js +2 -0
- package/dist/src/generated/platform/models/ChainExecutionState.d.ts +8 -0
- package/dist/src/generated/platform/models/ChainExecutionState.js +2 -0
- package/dist/src/generated/platform/models/ChainRequest.d.ts +6 -0
- package/dist/src/generated/platform/models/ChainRequest.js +2 -0
- package/dist/src/generated/platform/models/ChatFormat.d.ts +5 -0
- package/dist/src/generated/platform/models/ChatFormat.js +13 -0
- package/dist/src/generated/platform/models/ChatIds.d.ts +5 -0
- package/dist/src/generated/platform/models/ChatIds.js +2 -0
- package/dist/src/generated/platform/models/ChoiceIds.d.ts +6 -0
- package/dist/src/generated/platform/models/ChoiceIds.js +2 -0
- package/dist/src/generated/platform/models/Decision.d.ts +7 -0
- package/dist/src/generated/platform/models/Decision.js +15 -0
- package/dist/src/generated/platform/models/ErrorResponse.d.ts +4 -0
- package/dist/src/generated/platform/models/ErrorResponse.js +2 -0
- package/dist/src/generated/platform/models/FailureCategory.d.ts +12 -0
- package/dist/src/generated/platform/models/FailureCategory.js +20 -0
- package/dist/src/generated/platform/models/FailureReport.d.ts +33 -0
- package/dist/src/generated/platform/models/FailureReport.js +13 -0
- package/dist/src/generated/platform/models/Feedback.d.ts +13 -0
- package/dist/src/generated/platform/models/Feedback.js +2 -0
- package/dist/src/generated/platform/models/FeedbackRequest.d.ts +6 -0
- package/dist/src/generated/platform/models/FeedbackRequest.js +2 -0
- package/dist/src/generated/platform/models/HubStats.d.ts +10 -0
- package/dist/src/generated/platform/models/HubStats.js +2 -0
- package/dist/src/generated/platform/models/MessageRole.d.ts +5 -0
- package/dist/src/generated/platform/models/MessageRole.js +13 -0
- package/dist/src/generated/platform/models/MessageType.d.ts +6 -0
- package/dist/src/generated/platform/models/MessageType.js +14 -0
- package/dist/src/generated/platform/models/Permission.d.ts +5 -0
- package/dist/src/generated/platform/models/Permission.js +13 -0
- package/dist/src/generated/platform/models/Project.d.ts +8 -0
- package/dist/src/generated/platform/models/Project.js +2 -0
- package/dist/src/generated/platform/models/ReviewPayload.d.ts +29 -0
- package/dist/src/generated/platform/models/ReviewPayload.js +2 -0
- package/dist/src/generated/platform/models/Run.d.ts +9 -0
- package/dist/src/generated/platform/models/Run.js +2 -0
- package/dist/src/generated/platform/models/RunExecution.d.ts +8 -0
- package/dist/src/generated/platform/models/RunExecution.js +2 -0
- package/dist/src/generated/platform/models/RunState.d.ts +2 -0
- package/dist/src/generated/platform/models/RunState.js +2 -0
- package/dist/src/generated/platform/models/Status.d.ts +8 -0
- package/dist/src/generated/platform/models/Status.js +16 -0
- package/dist/src/generated/platform/models/SupervisionRequest.d.ts +9 -0
- package/dist/src/generated/platform/models/SupervisionRequest.js +2 -0
- package/dist/src/generated/platform/models/SupervisionRequestState.d.ts +8 -0
- package/dist/src/generated/platform/models/SupervisionRequestState.js +2 -0
- package/dist/src/generated/platform/models/SupervisionResult.d.ts +9 -0
- package/dist/src/generated/platform/models/SupervisionResult.js +2 -0
- package/dist/src/generated/platform/models/SupervisionStatus.d.ts +7 -0
- package/dist/src/generated/platform/models/SupervisionStatus.js +2 -0
- package/dist/src/generated/platform/models/Supervisor.d.ts +10 -0
- package/dist/src/generated/platform/models/Supervisor.js +2 -0
- package/dist/src/generated/platform/models/SupervisorChain.d.ts +5 -0
- package/dist/src/generated/platform/models/SupervisorChain.js +2 -0
- package/dist/src/generated/platform/models/SupervisorStats.d.ts +21 -0
- package/dist/src/generated/platform/models/SupervisorStats.js +2 -0
- package/dist/src/generated/platform/models/SupervisorType.d.ts +8 -0
- package/dist/src/generated/platform/models/SupervisorType.js +16 -0
- package/dist/src/generated/platform/models/Task.d.ts +7 -0
- package/dist/src/generated/platform/models/Task.js +2 -0
- package/dist/src/generated/platform/models/Tool.d.ts +9 -0
- package/dist/src/generated/platform/models/Tool.js +2 -0
- package/dist/src/generated/platform/models/ToolCallIds.d.ts +4 -0
- package/dist/src/generated/platform/models/ToolCallIds.js +2 -0
- package/dist/src/generated/platform/models/ToolSupervisionResult.d.ts +36 -0
- package/dist/src/generated/platform/models/ToolSupervisionResult.js +2 -0
- package/dist/src/generated/platform/models/User.d.ts +4 -0
- package/dist/src/generated/platform/models/User.js +2 -0
- package/dist/src/generated/platform/services/ApiKeyService.d.ts +33 -0
- package/dist/src/generated/platform/services/ApiKeyService.js +64 -0
- package/dist/src/generated/platform/services/ApiService.d.ts +9 -0
- package/dist/src/generated/platform/services/ApiService.js +19 -0
- package/dist/src/generated/platform/services/ImproveService.d.ts +20 -0
- package/dist/src/generated/platform/services/ImproveService.js +47 -0
- package/dist/src/generated/platform/services/ProjectService.d.ts +34 -0
- package/dist/src/generated/platform/services/ProjectService.js +72 -0
- package/dist/src/generated/platform/services/RunService.d.ts +103 -0
- package/dist/src/generated/platform/services/RunService.js +227 -0
- package/dist/src/generated/platform/services/StatsService.d.ts +10 -0
- package/dist/src/generated/platform/services/StatsService.js +22 -0
- package/dist/src/generated/platform/services/SupervisionService.d.ts +46 -0
- package/dist/src/generated/platform/services/SupervisionService.js +100 -0
- package/dist/src/generated/platform/services/SupervisorService.d.ts +43 -0
- package/dist/src/generated/platform/services/SupervisorService.js +92 -0
- package/dist/src/generated/platform/services/TaskService.d.ts +29 -0
- package/dist/src/generated/platform/services/TaskService.js +59 -0
- package/dist/src/generated/platform/services/ToolCallService.d.ts +42 -0
- package/dist/src/generated/platform/services/ToolCallService.js +92 -0
- package/dist/src/generated/platform/services/ToolService.d.ts +47 -0
- package/dist/src/generated/platform/services/ToolService.js +92 -0
- package/dist/src/index.d.ts +70 -0
- package/dist/src/index.js +102 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WorkflowExecution } from '../models/WorkflowExecution';
|
|
2
|
+
import type { WorkflowExecutionRequest } from '../models/WorkflowExecutionRequest';
|
|
3
|
+
import type { CancelablePromise } from '../core/CancelablePromise';
|
|
4
|
+
export declare class WorkflowService {
|
|
5
|
+
/**
|
|
6
|
+
* Execute a saved workflow for an agent
|
|
7
|
+
* @param workflowId
|
|
8
|
+
* @param requestBody
|
|
9
|
+
* @returns string Workflow executed successfully, job queued
|
|
10
|
+
* @throws ApiError
|
|
11
|
+
*/
|
|
12
|
+
static executeWorkflow(workflowId: string, requestBody: WorkflowExecutionRequest): CancelablePromise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Get all workflows and their executions
|
|
15
|
+
* @returns WorkflowExecution List of workflow executions
|
|
16
|
+
* @throws ApiError
|
|
17
|
+
*/
|
|
18
|
+
static getWorkflowExecutions(): CancelablePromise<Array<WorkflowExecution>>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkflowService = void 0;
|
|
4
|
+
const OpenAPI_1 = require("../core/OpenAPI");
|
|
5
|
+
const request_1 = require("../core/request");
|
|
6
|
+
class WorkflowService {
|
|
7
|
+
/**
|
|
8
|
+
* Execute a saved workflow for an agent
|
|
9
|
+
* @param workflowId
|
|
10
|
+
* @param requestBody
|
|
11
|
+
* @returns string Workflow executed successfully, job queued
|
|
12
|
+
* @throws ApiError
|
|
13
|
+
*/
|
|
14
|
+
static executeWorkflow(workflowId, requestBody) {
|
|
15
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
url: '/workflow/{workflow_id}',
|
|
18
|
+
path: {
|
|
19
|
+
'workflow_id': workflowId,
|
|
20
|
+
},
|
|
21
|
+
body: requestBody,
|
|
22
|
+
mediaType: 'application/json',
|
|
23
|
+
errors: {
|
|
24
|
+
400: `Invalid input or missing required fields`,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get all workflows and their executions
|
|
30
|
+
* @returns WorkflowExecution List of workflow executions
|
|
31
|
+
* @throws ApiError
|
|
32
|
+
*/
|
|
33
|
+
static getWorkflowExecutions() {
|
|
34
|
+
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
35
|
+
method: 'GET',
|
|
36
|
+
url: '/workflow_executions',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.WorkflowService = WorkflowService;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
export declare class ApiError extends Error {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly statusText: string;
|
|
7
|
+
readonly body: any;
|
|
8
|
+
readonly request: ApiRequestOptions;
|
|
9
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
class ApiError extends Error {
|
|
5
|
+
url;
|
|
6
|
+
status;
|
|
7
|
+
statusText;
|
|
8
|
+
body;
|
|
9
|
+
request;
|
|
10
|
+
constructor(request, response, message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'ApiError';
|
|
13
|
+
this.url = response.url;
|
|
14
|
+
this.status = response.status;
|
|
15
|
+
this.statusText = response.statusText;
|
|
16
|
+
this.body = response.body;
|
|
17
|
+
this.request = request;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ApiError = ApiError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ApiRequestOptions = {
|
|
2
|
+
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly path?: Record<string, any>;
|
|
5
|
+
readonly cookies?: Record<string, any>;
|
|
6
|
+
readonly headers?: Record<string, any>;
|
|
7
|
+
readonly query?: Record<string, any>;
|
|
8
|
+
readonly formData?: Record<string, any>;
|
|
9
|
+
readonly body?: any;
|
|
10
|
+
readonly mediaType?: string;
|
|
11
|
+
readonly responseHeader?: string;
|
|
12
|
+
readonly errors?: Record<number, string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class CancelError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
get isCancelled(): boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface OnCancel {
|
|
6
|
+
readonly isResolved: boolean;
|
|
7
|
+
readonly isRejected: boolean;
|
|
8
|
+
readonly isCancelled: boolean;
|
|
9
|
+
(cancelHandler: () => void): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class CancelablePromise<T> implements Promise<T> {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
14
|
+
get [Symbol.toStringTag](): string;
|
|
15
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
16
|
+
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
17
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
18
|
+
cancel(): void;
|
|
19
|
+
get isCancelled(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CancelablePromise = exports.CancelError = void 0;
|
|
4
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint:disable */
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
class CancelError extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'CancelError';
|
|
12
|
+
}
|
|
13
|
+
get isCancelled() {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CancelError = CancelError;
|
|
18
|
+
class CancelablePromise {
|
|
19
|
+
#isResolved;
|
|
20
|
+
#isRejected;
|
|
21
|
+
#isCancelled;
|
|
22
|
+
#cancelHandlers;
|
|
23
|
+
#promise;
|
|
24
|
+
#resolve;
|
|
25
|
+
#reject;
|
|
26
|
+
constructor(executor) {
|
|
27
|
+
this.#isResolved = false;
|
|
28
|
+
this.#isRejected = false;
|
|
29
|
+
this.#isCancelled = false;
|
|
30
|
+
this.#cancelHandlers = [];
|
|
31
|
+
this.#promise = new Promise((resolve, reject) => {
|
|
32
|
+
this.#resolve = resolve;
|
|
33
|
+
this.#reject = reject;
|
|
34
|
+
const onResolve = (value) => {
|
|
35
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.#isResolved = true;
|
|
39
|
+
if (this.#resolve)
|
|
40
|
+
this.#resolve(value);
|
|
41
|
+
};
|
|
42
|
+
const onReject = (reason) => {
|
|
43
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.#isRejected = true;
|
|
47
|
+
if (this.#reject)
|
|
48
|
+
this.#reject(reason);
|
|
49
|
+
};
|
|
50
|
+
const onCancel = (cancelHandler) => {
|
|
51
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.#cancelHandlers.push(cancelHandler);
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
|
57
|
+
get: () => this.#isResolved,
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
|
60
|
+
get: () => this.#isRejected,
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
|
63
|
+
get: () => this.#isCancelled,
|
|
64
|
+
});
|
|
65
|
+
return executor(onResolve, onReject, onCancel);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
get [Symbol.toStringTag]() {
|
|
69
|
+
return "Cancellable Promise";
|
|
70
|
+
}
|
|
71
|
+
then(onFulfilled, onRejected) {
|
|
72
|
+
return this.#promise.then(onFulfilled, onRejected);
|
|
73
|
+
}
|
|
74
|
+
catch(onRejected) {
|
|
75
|
+
return this.#promise.catch(onRejected);
|
|
76
|
+
}
|
|
77
|
+
finally(onFinally) {
|
|
78
|
+
return this.#promise.finally(onFinally);
|
|
79
|
+
}
|
|
80
|
+
cancel() {
|
|
81
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this.#isCancelled = true;
|
|
85
|
+
if (this.#cancelHandlers.length) {
|
|
86
|
+
try {
|
|
87
|
+
for (const cancelHandler of this.#cancelHandlers) {
|
|
88
|
+
cancelHandler();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.warn('Cancellation threw an error', error);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
this.#cancelHandlers.length = 0;
|
|
97
|
+
if (this.#reject)
|
|
98
|
+
this.#reject(new CancelError('Request aborted'));
|
|
99
|
+
}
|
|
100
|
+
get isCancelled() {
|
|
101
|
+
return this.#isCancelled;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.CancelablePromise = CancelablePromise;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
3
|
+
type Headers = Record<string, string>;
|
|
4
|
+
export type OpenAPIConfig = {
|
|
5
|
+
BASE: string;
|
|
6
|
+
VERSION: string;
|
|
7
|
+
WITH_CREDENTIALS: boolean;
|
|
8
|
+
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
9
|
+
TOKEN?: string | Resolver<string> | undefined;
|
|
10
|
+
USERNAME?: string | Resolver<string> | undefined;
|
|
11
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
|
12
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
13
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
14
|
+
};
|
|
15
|
+
export declare const OpenAPI: OpenAPIConfig;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAPI = void 0;
|
|
4
|
+
exports.OpenAPI = {
|
|
5
|
+
BASE: 'https://api.asteroid.ai/api/v1',
|
|
6
|
+
VERSION: '1.0.0',
|
|
7
|
+
WITH_CREDENTIALS: false,
|
|
8
|
+
CREDENTIALS: 'include',
|
|
9
|
+
TOKEN: undefined,
|
|
10
|
+
USERNAME: undefined,
|
|
11
|
+
PASSWORD: undefined,
|
|
12
|
+
HEADERS: undefined,
|
|
13
|
+
ENCODE_PATH: undefined,
|
|
14
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
import { CancelablePromise } from './CancelablePromise';
|
|
4
|
+
import type { OnCancel } from './CancelablePromise';
|
|
5
|
+
import type { OpenAPIConfig } from './OpenAPI';
|
|
6
|
+
export declare const isDefined: <T>(value: T | null | undefined) => value is Exclude<T, null | undefined>;
|
|
7
|
+
export declare const isString: (value: any) => value is string;
|
|
8
|
+
export declare const isStringWithValue: (value: any) => value is string;
|
|
9
|
+
export declare const isBlob: (value: any) => value is Blob;
|
|
10
|
+
export declare const isFormData: (value: any) => value is FormData;
|
|
11
|
+
export declare const base64: (str: string) => string;
|
|
12
|
+
export declare const getQueryString: (params: Record<string, any>) => string;
|
|
13
|
+
export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
|
|
14
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
15
|
+
export declare const resolve: <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>) => Promise<T | undefined>;
|
|
16
|
+
export declare const getHeaders: (config: OpenAPIConfig, options: ApiRequestOptions) => Promise<Headers>;
|
|
17
|
+
export declare const getRequestBody: (options: ApiRequestOptions) => any;
|
|
18
|
+
export declare const sendRequest: (config: OpenAPIConfig, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Headers, onCancel: OnCancel) => Promise<Response>;
|
|
19
|
+
export declare const getResponseHeader: (response: Response, responseHeader?: string) => string | undefined;
|
|
20
|
+
export declare const getResponseBody: (response: Response) => Promise<any>;
|
|
21
|
+
export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Request method
|
|
24
|
+
* @param config The OpenAPI configuration object
|
|
25
|
+
* @param options The request options from the service
|
|
26
|
+
* @returns CancelablePromise<T>
|
|
27
|
+
* @throws ApiError
|
|
28
|
+
*/
|
|
29
|
+
export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions) => CancelablePromise<T>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.request = exports.catchErrorCodes = exports.getResponseBody = exports.getResponseHeader = exports.sendRequest = exports.getRequestBody = exports.getHeaders = exports.resolve = exports.getFormData = exports.getQueryString = exports.base64 = exports.isFormData = exports.isBlob = exports.isStringWithValue = exports.isString = exports.isDefined = void 0;
|
|
4
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint:disable */
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const ApiError_1 = require("./ApiError");
|
|
9
|
+
const CancelablePromise_1 = require("./CancelablePromise");
|
|
10
|
+
const isDefined = (value) => {
|
|
11
|
+
return value !== undefined && value !== null;
|
|
12
|
+
};
|
|
13
|
+
exports.isDefined = isDefined;
|
|
14
|
+
const isString = (value) => {
|
|
15
|
+
return typeof value === 'string';
|
|
16
|
+
};
|
|
17
|
+
exports.isString = isString;
|
|
18
|
+
const isStringWithValue = (value) => {
|
|
19
|
+
return (0, exports.isString)(value) && value !== '';
|
|
20
|
+
};
|
|
21
|
+
exports.isStringWithValue = isStringWithValue;
|
|
22
|
+
const isBlob = (value) => {
|
|
23
|
+
return (typeof value === 'object' &&
|
|
24
|
+
typeof value.type === 'string' &&
|
|
25
|
+
typeof value.stream === 'function' &&
|
|
26
|
+
typeof value.arrayBuffer === 'function' &&
|
|
27
|
+
typeof value.constructor === 'function' &&
|
|
28
|
+
typeof value.constructor.name === 'string' &&
|
|
29
|
+
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
30
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
31
|
+
};
|
|
32
|
+
exports.isBlob = isBlob;
|
|
33
|
+
const isFormData = (value) => {
|
|
34
|
+
return value instanceof FormData;
|
|
35
|
+
};
|
|
36
|
+
exports.isFormData = isFormData;
|
|
37
|
+
const base64 = (str) => {
|
|
38
|
+
try {
|
|
39
|
+
return btoa(str);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
return Buffer.from(str).toString('base64');
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.base64 = base64;
|
|
47
|
+
const getQueryString = (params) => {
|
|
48
|
+
const qs = [];
|
|
49
|
+
const append = (key, value) => {
|
|
50
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
51
|
+
};
|
|
52
|
+
const process = (key, value) => {
|
|
53
|
+
if ((0, exports.isDefined)(value)) {
|
|
54
|
+
if (Array.isArray(value)) {
|
|
55
|
+
value.forEach(v => {
|
|
56
|
+
process(key, v);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else if (typeof value === 'object') {
|
|
60
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
61
|
+
process(`${key}[${k}]`, v);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
append(key, value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
70
|
+
process(key, value);
|
|
71
|
+
});
|
|
72
|
+
if (qs.length > 0) {
|
|
73
|
+
return `?${qs.join('&')}`;
|
|
74
|
+
}
|
|
75
|
+
return '';
|
|
76
|
+
};
|
|
77
|
+
exports.getQueryString = getQueryString;
|
|
78
|
+
const getUrl = (config, options) => {
|
|
79
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
80
|
+
const path = options.url
|
|
81
|
+
.replace('{api-version}', config.VERSION)
|
|
82
|
+
.replace(/{(.*?)}/g, (substring, group) => {
|
|
83
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
84
|
+
return encoder(String(options.path[group]));
|
|
85
|
+
}
|
|
86
|
+
return substring;
|
|
87
|
+
});
|
|
88
|
+
const url = `${config.BASE}${path}`;
|
|
89
|
+
if (options.query) {
|
|
90
|
+
return `${url}${(0, exports.getQueryString)(options.query)}`;
|
|
91
|
+
}
|
|
92
|
+
return url;
|
|
93
|
+
};
|
|
94
|
+
const getFormData = (options) => {
|
|
95
|
+
if (options.formData) {
|
|
96
|
+
const formData = new FormData();
|
|
97
|
+
const process = (key, value) => {
|
|
98
|
+
if ((0, exports.isString)(value) || (0, exports.isBlob)(value)) {
|
|
99
|
+
formData.append(key, value);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
formData.append(key, JSON.stringify(value));
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
Object.entries(options.formData)
|
|
106
|
+
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
107
|
+
.forEach(([key, value]) => {
|
|
108
|
+
if (Array.isArray(value)) {
|
|
109
|
+
value.forEach(v => process(key, v));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
process(key, value);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return formData;
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
118
|
+
};
|
|
119
|
+
exports.getFormData = getFormData;
|
|
120
|
+
const resolve = async (options, resolver) => {
|
|
121
|
+
if (typeof resolver === 'function') {
|
|
122
|
+
return resolver(options);
|
|
123
|
+
}
|
|
124
|
+
return resolver;
|
|
125
|
+
};
|
|
126
|
+
exports.resolve = resolve;
|
|
127
|
+
const getHeaders = async (config, options) => {
|
|
128
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
129
|
+
(0, exports.resolve)(options, config.TOKEN),
|
|
130
|
+
(0, exports.resolve)(options, config.USERNAME),
|
|
131
|
+
(0, exports.resolve)(options, config.PASSWORD),
|
|
132
|
+
(0, exports.resolve)(options, config.HEADERS),
|
|
133
|
+
]);
|
|
134
|
+
const headers = Object.entries({
|
|
135
|
+
Accept: 'application/json',
|
|
136
|
+
...additionalHeaders,
|
|
137
|
+
...options.headers,
|
|
138
|
+
})
|
|
139
|
+
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
140
|
+
.reduce((headers, [key, value]) => ({
|
|
141
|
+
...headers,
|
|
142
|
+
[key]: String(value),
|
|
143
|
+
}), {});
|
|
144
|
+
if ((0, exports.isStringWithValue)(token)) {
|
|
145
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
146
|
+
}
|
|
147
|
+
if ((0, exports.isStringWithValue)(username) && (0, exports.isStringWithValue)(password)) {
|
|
148
|
+
const credentials = (0, exports.base64)(`${username}:${password}`);
|
|
149
|
+
headers['Authorization'] = `Basic ${credentials}`;
|
|
150
|
+
}
|
|
151
|
+
if (options.body !== undefined) {
|
|
152
|
+
if (options.mediaType) {
|
|
153
|
+
headers['Content-Type'] = options.mediaType;
|
|
154
|
+
}
|
|
155
|
+
else if ((0, exports.isBlob)(options.body)) {
|
|
156
|
+
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
157
|
+
}
|
|
158
|
+
else if ((0, exports.isString)(options.body)) {
|
|
159
|
+
headers['Content-Type'] = 'text/plain';
|
|
160
|
+
}
|
|
161
|
+
else if (!(0, exports.isFormData)(options.body)) {
|
|
162
|
+
headers['Content-Type'] = 'application/json';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return new Headers(headers);
|
|
166
|
+
};
|
|
167
|
+
exports.getHeaders = getHeaders;
|
|
168
|
+
const getRequestBody = (options) => {
|
|
169
|
+
if (options.body !== undefined) {
|
|
170
|
+
if (options.mediaType?.includes('/json')) {
|
|
171
|
+
return JSON.stringify(options.body);
|
|
172
|
+
}
|
|
173
|
+
else if ((0, exports.isString)(options.body) || (0, exports.isBlob)(options.body) || (0, exports.isFormData)(options.body)) {
|
|
174
|
+
return options.body;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
return JSON.stringify(options.body);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return undefined;
|
|
181
|
+
};
|
|
182
|
+
exports.getRequestBody = getRequestBody;
|
|
183
|
+
const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
184
|
+
const controller = new AbortController();
|
|
185
|
+
const request = {
|
|
186
|
+
headers,
|
|
187
|
+
body: body ?? formData,
|
|
188
|
+
method: options.method,
|
|
189
|
+
signal: controller.signal,
|
|
190
|
+
};
|
|
191
|
+
if (config.WITH_CREDENTIALS) {
|
|
192
|
+
request.credentials = config.CREDENTIALS;
|
|
193
|
+
}
|
|
194
|
+
onCancel(() => controller.abort());
|
|
195
|
+
return await fetch(url, request);
|
|
196
|
+
};
|
|
197
|
+
exports.sendRequest = sendRequest;
|
|
198
|
+
const getResponseHeader = (response, responseHeader) => {
|
|
199
|
+
if (responseHeader) {
|
|
200
|
+
const content = response.headers.get(responseHeader);
|
|
201
|
+
if ((0, exports.isString)(content)) {
|
|
202
|
+
return content;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return undefined;
|
|
206
|
+
};
|
|
207
|
+
exports.getResponseHeader = getResponseHeader;
|
|
208
|
+
const getResponseBody = async (response) => {
|
|
209
|
+
if (response.status !== 204) {
|
|
210
|
+
try {
|
|
211
|
+
const contentType = response.headers.get('Content-Type');
|
|
212
|
+
if (contentType) {
|
|
213
|
+
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
214
|
+
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
215
|
+
if (isJSON) {
|
|
216
|
+
return await response.json();
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
return await response.text();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
console.error(error);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return undefined;
|
|
228
|
+
};
|
|
229
|
+
exports.getResponseBody = getResponseBody;
|
|
230
|
+
const catchErrorCodes = (options, result) => {
|
|
231
|
+
const errors = {
|
|
232
|
+
400: 'Bad Request',
|
|
233
|
+
401: 'Unauthorized',
|
|
234
|
+
403: 'Forbidden',
|
|
235
|
+
404: 'Not Found',
|
|
236
|
+
500: 'Internal Server Error',
|
|
237
|
+
502: 'Bad Gateway',
|
|
238
|
+
503: 'Service Unavailable',
|
|
239
|
+
...options.errors,
|
|
240
|
+
};
|
|
241
|
+
const error = errors[result.status];
|
|
242
|
+
if (error) {
|
|
243
|
+
throw new ApiError_1.ApiError(options, result, error);
|
|
244
|
+
}
|
|
245
|
+
if (!result.ok) {
|
|
246
|
+
const errorStatus = result.status ?? 'unknown';
|
|
247
|
+
const errorStatusText = result.statusText ?? 'unknown';
|
|
248
|
+
const errorBody = (() => {
|
|
249
|
+
try {
|
|
250
|
+
return JSON.stringify(result.body, null, 2);
|
|
251
|
+
}
|
|
252
|
+
catch (e) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
})();
|
|
256
|
+
throw new ApiError_1.ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
exports.catchErrorCodes = catchErrorCodes;
|
|
260
|
+
/**
|
|
261
|
+
* Request method
|
|
262
|
+
* @param config The OpenAPI configuration object
|
|
263
|
+
* @param options The request options from the service
|
|
264
|
+
* @returns CancelablePromise<T>
|
|
265
|
+
* @throws ApiError
|
|
266
|
+
*/
|
|
267
|
+
const request = (config, options) => {
|
|
268
|
+
return new CancelablePromise_1.CancelablePromise(async (resolve, reject, onCancel) => {
|
|
269
|
+
try {
|
|
270
|
+
const url = getUrl(config, options);
|
|
271
|
+
const formData = (0, exports.getFormData)(options);
|
|
272
|
+
const body = (0, exports.getRequestBody)(options);
|
|
273
|
+
const headers = await (0, exports.getHeaders)(config, options);
|
|
274
|
+
if (!onCancel.isCancelled) {
|
|
275
|
+
const response = await (0, exports.sendRequest)(config, options, url, body, formData, headers, onCancel);
|
|
276
|
+
const responseBody = await (0, exports.getResponseBody)(response);
|
|
277
|
+
const responseHeader = (0, exports.getResponseHeader)(response, options.responseHeader);
|
|
278
|
+
const result = {
|
|
279
|
+
url,
|
|
280
|
+
ok: response.ok,
|
|
281
|
+
status: response.status,
|
|
282
|
+
statusText: response.statusText,
|
|
283
|
+
body: responseHeader ?? responseBody,
|
|
284
|
+
};
|
|
285
|
+
(0, exports.catchErrorCodes)(options, result);
|
|
286
|
+
resolve(result.body);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
reject(error);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
exports.request = request;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { AgentReport } from './models/AgentReport';
|
|
6
|
+
export type { APIKey } from './models/APIKey';
|
|
7
|
+
export type { AsteroidChat } from './models/AsteroidChat';
|
|
8
|
+
export { AsteroidChoice } from './models/AsteroidChoice';
|
|
9
|
+
export { AsteroidMessage } from './models/AsteroidMessage';
|
|
10
|
+
export type { AsteroidToolCall } from './models/AsteroidToolCall';
|
|
11
|
+
export type { ChainExecution } from './models/ChainExecution';
|
|
12
|
+
export type { ChainExecutionState } from './models/ChainExecutionState';
|
|
13
|
+
export type { ChainRequest } from './models/ChainRequest';
|
|
14
|
+
export { ChatFormat } from './models/ChatFormat';
|
|
15
|
+
export type { ChatIds } from './models/ChatIds';
|
|
16
|
+
export type { ChoiceIds } from './models/ChoiceIds';
|
|
17
|
+
export { Decision } from './models/Decision';
|
|
18
|
+
export type { ErrorResponse } from './models/ErrorResponse';
|
|
19
|
+
export { FailureCategory } from './models/FailureCategory';
|
|
20
|
+
export { FailureReport } from './models/FailureReport';
|
|
21
|
+
export type { Feedback } from './models/Feedback';
|
|
22
|
+
export type { FeedbackRequest } from './models/FeedbackRequest';
|
|
23
|
+
export type { HubStats } from './models/HubStats';
|
|
24
|
+
export { MessageRole } from './models/MessageRole';
|
|
25
|
+
export { MessageType } from './models/MessageType';
|
|
26
|
+
export { Permission } from './models/Permission';
|
|
27
|
+
export type { Project } from './models/Project';
|
|
28
|
+
export type { ReviewPayload } from './models/ReviewPayload';
|
|
29
|
+
export type { Run } from './models/Run';
|
|
30
|
+
export type { RunExecution } from './models/RunExecution';
|
|
31
|
+
export type { RunState } from './models/RunState';
|
|
32
|
+
export { Status } from './models/Status';
|
|
33
|
+
export type { SupervisionRequest } from './models/SupervisionRequest';
|
|
34
|
+
export type { SupervisionRequestState } from './models/SupervisionRequestState';
|
|
35
|
+
export type { SupervisionResult } from './models/SupervisionResult';
|
|
36
|
+
export type { SupervisionStatus } from './models/SupervisionStatus';
|
|
37
|
+
export type { Supervisor } from './models/Supervisor';
|
|
38
|
+
export type { SupervisorChain } from './models/SupervisorChain';
|
|
39
|
+
export type { SupervisorStats } from './models/SupervisorStats';
|
|
40
|
+
export { SupervisorType } from './models/SupervisorType';
|
|
41
|
+
export type { Task } from './models/Task';
|
|
42
|
+
export type { Tool } from './models/Tool';
|
|
43
|
+
export type { ToolCallIds } from './models/ToolCallIds';
|
|
44
|
+
export type { ToolSupervisionResult } from './models/ToolSupervisionResult';
|
|
45
|
+
export type { User } from './models/User';
|
|
46
|
+
export { ApiService } from './services/ApiService';
|
|
47
|
+
export { ApiKeyService } from './services/ApiKeyService';
|
|
48
|
+
export { ImproveService } from './services/ImproveService';
|
|
49
|
+
export { ProjectService } from './services/ProjectService';
|
|
50
|
+
export { RunService } from './services/RunService';
|
|
51
|
+
export { StatsService } from './services/StatsService';
|
|
52
|
+
export { SupervisionService } from './services/SupervisionService';
|
|
53
|
+
export { SupervisorService } from './services/SupervisorService';
|
|
54
|
+
export { TaskService } from './services/TaskService';
|
|
55
|
+
export { ToolService } from './services/ToolService';
|
|
56
|
+
export { ToolCallService } from './services/ToolCallService';
|