@crewdle/web-sdk-types 1.0.10 → 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/ai/GenerativeAIContext.d.ts +16 -0
- package/dist/ai/GenerativeAIContext.js +1 -0
- package/dist/ai/GenerativeAIWorker.d.ts +10 -0
- package/dist/ai/GenerativeAIWorker.js +1 -0
- package/dist/ai/GenerativeAIWorkerConnector.d.ts +25 -0
- package/dist/ai/GenerativeAIWorkerConnector.js +1 -0
- package/dist/ai/GenerativeAIWorkerConnectorConstructor.d.ts +6 -0
- package/dist/ai/GenerativeAIWorkerConnectorConstructor.js +1 -0
- package/dist/ai/VectorDatabaseConnector.d.ts +17 -0
- package/dist/ai/VectorDatabaseConnector.js +1 -0
- package/dist/ai/VectorDatabaseConnectorConstructor.d.ts +6 -0
- package/dist/ai/VectorDatabaseConnectorConstructor.js +1 -0
- package/dist/ai/index.d.ts +6 -0
- package/dist/ai/index.js +6 -0
- package/dist/core/cluster/Cluster.d.ts +21 -0
- package/dist/core/node/agent/AgentCapacity.d.ts +1 -0
- package/dist/core/sdk/SDKOptions.d.ts +9 -0
- package/dist/core/stream/ContentType.d.ts +5 -1
- package/dist/core/stream/ContentType.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/job/Job.d.ts +108 -0
- package/dist/job/Job.js +34 -0
- package/dist/job/JobDispatcher.d.ts +30 -0
- package/dist/job/JobDispatcher.js +1 -0
- package/dist/job/JobWorker.d.ts +10 -0
- package/dist/job/JobWorker.js +1 -0
- package/dist/job/JobWorkerConnector.d.ts +12 -0
- package/dist/job/JobWorkerConnector.js +1 -0
- package/dist/job/index.d.ts +4 -0
- package/dist/job/index.js +4 -0
- package/dist/object-storage/event/StorageEvent.d.ts +2 -2
- package/dist/object-storage/event/StorageEventType.d.ts +4 -0
- package/dist/object-storage/event/StorageEventType.js +4 -0
- package/dist/object-storage/event/SyncCompleteEvent.d.ts +11 -0
- package/dist/object-storage/event/SyncCompleteEvent.js +1 -0
- package/dist/object-storage/event/index.d.ts +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a context for a Generative AI service.
|
|
3
|
+
* @category AI
|
|
4
|
+
*/
|
|
5
|
+
export interface IGenerativeAIContext {
|
|
6
|
+
/**
|
|
7
|
+
* Prompt the Generative AI Context to start processing a prompt.
|
|
8
|
+
* @param prompt The prompt to start processing.
|
|
9
|
+
* @returns The response from the AI service.
|
|
10
|
+
*/
|
|
11
|
+
prompt(prompt: string): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Close the Generative AI Context.
|
|
14
|
+
*/
|
|
15
|
+
close(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IJob, IJobWorkerConnector, IJobResult } from '../job';
|
|
2
|
+
/**
|
|
3
|
+
* The generative AI worker connector interface.
|
|
4
|
+
* @category Connector
|
|
5
|
+
*/
|
|
6
|
+
export interface IGenerativeAIWorkerConnector extends IJobWorkerConnector {
|
|
7
|
+
/**
|
|
8
|
+
* Initialize the machine learning model.
|
|
9
|
+
* @param llmModel The path to the LLM model.
|
|
10
|
+
* @param similarityModel The path to the similarity model.
|
|
11
|
+
*/
|
|
12
|
+
initialize(llmModel: string, similarityModel: string): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Add content to the machine learning model.
|
|
15
|
+
* @param content The content to add.
|
|
16
|
+
* @returns A promise that resolves when the content has been added.
|
|
17
|
+
*/
|
|
18
|
+
addContent(content: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Process a job.
|
|
21
|
+
* @param job The job to process.
|
|
22
|
+
* @returns An async generator that yields the job result.
|
|
23
|
+
*/
|
|
24
|
+
processJob(job: IJob): AsyncGenerator<IJobResult>;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IGenerativeAIWorkerConnector, VectorDatabaseConnectorConstructor } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* The generative AI worker connector constructor type.
|
|
4
|
+
* @category AI
|
|
5
|
+
*/
|
|
6
|
+
export type GenerativeAIWorkerConnectorConstructor = new (vectorDatabaseConnector: VectorDatabaseConnectorConstructor) => IGenerativeAIWorkerConnector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vector database connector interface.
|
|
3
|
+
* @category Connector
|
|
4
|
+
*/
|
|
5
|
+
export interface IVectorDatabaseConnector {
|
|
6
|
+
/**
|
|
7
|
+
* Search for the k nearest vectors.
|
|
8
|
+
* @param vector The vector to search for.
|
|
9
|
+
* @param k The number of nearest vectors to return.
|
|
10
|
+
*/
|
|
11
|
+
search(vector: number[], k: number): number[];
|
|
12
|
+
/**
|
|
13
|
+
* Insert vectors into the database.
|
|
14
|
+
* @param vectors The vectors to insert.
|
|
15
|
+
*/
|
|
16
|
+
insert(vectors: number[][]): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './GenerativeAIContext';
|
|
2
|
+
export * from './GenerativeAIWorker';
|
|
3
|
+
export * from './GenerativeAIWorkerConnector';
|
|
4
|
+
export * from './GenerativeAIWorkerConnectorConstructor';
|
|
5
|
+
export * from './VectorDatabaseConnector';
|
|
6
|
+
export * from './VectorDatabaseConnectorConstructor';
|
package/dist/ai/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './GenerativeAIContext';
|
|
2
|
+
export * from './GenerativeAIWorker';
|
|
3
|
+
export * from './GenerativeAIWorkerConnector';
|
|
4
|
+
export * from './GenerativeAIWorkerConnectorConstructor';
|
|
5
|
+
export * from './VectorDatabaseConnector';
|
|
6
|
+
export * from './VectorDatabaseConnectorConstructor';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IClusterEventEmitter } from '.';
|
|
2
|
+
import { IGenerativeAIContext, IGenerativeAIWorker } from '../../ai';
|
|
2
3
|
import { IKeyValueDatabase, IDatabaseLayout, ILayoutBuilder } from '../../key-value-database';
|
|
3
4
|
import { ILocalMediaStream, ILocalDynamicMediaStream, IRemoteMediaStream, MediaStreamSource } from '../../media-stream';
|
|
4
5
|
import { IObjectStoreBucket } from '../../object-storage';
|
|
@@ -39,6 +40,16 @@ export interface ICluster extends IClusterEventEmitter {
|
|
|
39
40
|
* @returns A promise that resolves with the key-value database.
|
|
40
41
|
*/
|
|
41
42
|
openKeyValueDatabase(name: string, layout: IDatabaseLayout | ILayoutBuilder): Promise<IKeyValueDatabase>;
|
|
43
|
+
/**
|
|
44
|
+
* Open a generative AI context.
|
|
45
|
+
* @param label The label of the generative AI context.
|
|
46
|
+
*/
|
|
47
|
+
openGenerativeAIContext(label: string): Promise<IGenerativeAIContext>;
|
|
48
|
+
/**
|
|
49
|
+
* Open a generative AI worker.
|
|
50
|
+
* @param label The label of the generative AI Worker.
|
|
51
|
+
*/
|
|
52
|
+
openGenerativeAIWorker(label: string): Promise<IGenerativeAIWorker>;
|
|
42
53
|
/**
|
|
43
54
|
* Publish a local media stream.
|
|
44
55
|
* @param label The label of the media stream.
|
|
@@ -70,6 +81,16 @@ export interface ICluster extends IClusterEventEmitter {
|
|
|
70
81
|
* @param strategy The strategy to use to filter the key-value databases.
|
|
71
82
|
*/
|
|
72
83
|
getKeyValueDatabases(strategy?: (item: IKeyValueDatabase) => boolean): IKeyValueDatabase[];
|
|
84
|
+
/**
|
|
85
|
+
* Get an array of opened generative AI contexts.
|
|
86
|
+
* @param strategy The strategy to use to filter the job dispatchers.
|
|
87
|
+
*/
|
|
88
|
+
getGenerativeAIContexts(strategy?: (item: IGenerativeAIContext) => boolean): IGenerativeAIContext[];
|
|
89
|
+
/**
|
|
90
|
+
* Get an array of opened generative AI workers.
|
|
91
|
+
* @param strategy The strategy to use to filter the job workers.
|
|
92
|
+
*/
|
|
93
|
+
getGenerativeAIWorkers(strategy?: (item: IGenerativeAIWorker) => boolean): IGenerativeAIWorker[];
|
|
73
94
|
/**
|
|
74
95
|
* Get an array of published local media streams.
|
|
75
96
|
* @param strategy The strategy to use to filter the media streams.
|
|
@@ -2,6 +2,7 @@ import { KeyValueDatabaseConnectorConstructor } from '../../key-value-database';
|
|
|
2
2
|
import { ILoggingConnector } from '.';
|
|
3
3
|
import { ObjectStoreConnectorConstructor } from '../../object-storage';
|
|
4
4
|
import { PeerConnectionConnectorConstructor } from '../connection';
|
|
5
|
+
import { GenerativeAIWorkerConnectorConstructor, VectorDatabaseConnectorConstructor } from '../../ai';
|
|
5
6
|
/**
|
|
6
7
|
* Options to configure the SDK.
|
|
7
8
|
* @category Core
|
|
@@ -34,6 +35,14 @@ export interface ISDKOptions {
|
|
|
34
35
|
* If not provided, the default peer connection connector is WebRTC in browser.
|
|
35
36
|
*/
|
|
36
37
|
peerConnectionConnector?: PeerConnectionConnectorConstructor;
|
|
38
|
+
/**
|
|
39
|
+
* The custom generative AI worker connector to use for generative AI tasks.
|
|
40
|
+
*/
|
|
41
|
+
generativeAIWorkerConnector?: GenerativeAIWorkerConnectorConstructor;
|
|
42
|
+
/**
|
|
43
|
+
* The custom vector database connector to use for vector database tasks.
|
|
44
|
+
*/
|
|
45
|
+
vectorDatabaseConnector?: VectorDatabaseConnectorConstructor;
|
|
37
46
|
/**
|
|
38
47
|
* The maximum number of outgoing subscriptions.
|
|
39
48
|
*/
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IJob Interface
|
|
3
|
+
* Represents a job to be executed by the JobService.
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export interface IJob {
|
|
7
|
+
/**
|
|
8
|
+
* The ID of the job.
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* The parameters of the job.
|
|
13
|
+
*/
|
|
14
|
+
parameters: JobParameters;
|
|
15
|
+
/**
|
|
16
|
+
* The status of the job.
|
|
17
|
+
*/
|
|
18
|
+
status?: JobStatus;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* JobType Enum
|
|
22
|
+
* Provide this to create a job with a specific type.
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
export declare enum JobType {
|
|
26
|
+
AI = 0,
|
|
27
|
+
Other = 1
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* JobStatus Enum
|
|
31
|
+
* Represents the status of a job.
|
|
32
|
+
* @ignore
|
|
33
|
+
*/
|
|
34
|
+
export declare enum JobStatus {
|
|
35
|
+
/**
|
|
36
|
+
* The job is pending.
|
|
37
|
+
*/
|
|
38
|
+
Pending = "Pending",
|
|
39
|
+
/**
|
|
40
|
+
* The job is processing.
|
|
41
|
+
*/
|
|
42
|
+
Processing = "Processing",
|
|
43
|
+
/**
|
|
44
|
+
* The job is completed.
|
|
45
|
+
*/
|
|
46
|
+
Completed = "Completed",
|
|
47
|
+
/**
|
|
48
|
+
* The job has failed.
|
|
49
|
+
*/
|
|
50
|
+
Failed = "Failed"
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Base IJobParameters Interface
|
|
54
|
+
* Allows providing parameters specific to the job type.
|
|
55
|
+
* @ignore
|
|
56
|
+
*/
|
|
57
|
+
export interface IJobParameters {
|
|
58
|
+
jobType: JobType;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* IJobParametersAI Interface
|
|
62
|
+
* Parameters for AI job type.
|
|
63
|
+
* @ignore
|
|
64
|
+
*/
|
|
65
|
+
export interface IJobParametersAI extends IJobParameters {
|
|
66
|
+
jobType: JobType.AI;
|
|
67
|
+
prompt: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* JobParameters Type
|
|
71
|
+
* Union of all job parameters interfaces.
|
|
72
|
+
* @ignore
|
|
73
|
+
*/
|
|
74
|
+
export type JobParameters = IJobParametersAI;
|
|
75
|
+
/**
|
|
76
|
+
* IJobResult Interface
|
|
77
|
+
* Represents the result of a job.
|
|
78
|
+
* @ignore
|
|
79
|
+
*/
|
|
80
|
+
export interface IJobResult {
|
|
81
|
+
/**
|
|
82
|
+
* The ID of the job.
|
|
83
|
+
*/
|
|
84
|
+
id: string;
|
|
85
|
+
/**
|
|
86
|
+
* The status of the job result.
|
|
87
|
+
*/
|
|
88
|
+
status: JobStatus;
|
|
89
|
+
/**
|
|
90
|
+
* The result of the job.
|
|
91
|
+
*/
|
|
92
|
+
result: JobResult;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* IJobResultAI Interface
|
|
96
|
+
* Represents the result of an AI job.
|
|
97
|
+
* @ignore
|
|
98
|
+
*/
|
|
99
|
+
export interface IJobResultAI {
|
|
100
|
+
jobType: JobType.AI;
|
|
101
|
+
output: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* JobResult Type
|
|
105
|
+
* Union of all job result interfaces.
|
|
106
|
+
* @ignore
|
|
107
|
+
*/
|
|
108
|
+
export type JobResult = IJobResultAI;
|
package/dist/job/Job.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JobType Enum
|
|
3
|
+
* Provide this to create a job with a specific type.
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export var JobType;
|
|
7
|
+
(function (JobType) {
|
|
8
|
+
JobType[JobType["AI"] = 0] = "AI";
|
|
9
|
+
JobType[JobType["Other"] = 1] = "Other";
|
|
10
|
+
})(JobType || (JobType = {}));
|
|
11
|
+
/**
|
|
12
|
+
* JobStatus Enum
|
|
13
|
+
* Represents the status of a job.
|
|
14
|
+
* @ignore
|
|
15
|
+
*/
|
|
16
|
+
export var JobStatus;
|
|
17
|
+
(function (JobStatus) {
|
|
18
|
+
/**
|
|
19
|
+
* The job is pending.
|
|
20
|
+
*/
|
|
21
|
+
JobStatus["Pending"] = "Pending";
|
|
22
|
+
/**
|
|
23
|
+
* The job is processing.
|
|
24
|
+
*/
|
|
25
|
+
JobStatus["Processing"] = "Processing";
|
|
26
|
+
/**
|
|
27
|
+
* The job is completed.
|
|
28
|
+
*/
|
|
29
|
+
JobStatus["Completed"] = "Completed";
|
|
30
|
+
/**
|
|
31
|
+
* The job has failed.
|
|
32
|
+
*/
|
|
33
|
+
JobStatus["Failed"] = "Failed";
|
|
34
|
+
})(JobStatus || (JobStatus = {}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import { IDataStream } from '../core/stream';
|
|
3
|
+
import { IJob, IJobResult } from './Job';
|
|
4
|
+
/**
|
|
5
|
+
* The Job Dispatcher interface.
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
8
|
+
export interface IJobDispatcher extends IDataStream {
|
|
9
|
+
/**
|
|
10
|
+
* Create a new job.
|
|
11
|
+
* @param jobId The ID of the job.
|
|
12
|
+
* @param parameters The parameters of the job.
|
|
13
|
+
*/
|
|
14
|
+
createJob(job: IJob): Promise<Observable<IJobResult>>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a job by ID.
|
|
17
|
+
* @param id The ID of the job to get.
|
|
18
|
+
* @returns The job.
|
|
19
|
+
*/
|
|
20
|
+
getJob(id: string): IJob;
|
|
21
|
+
/**
|
|
22
|
+
* Get all jobs.
|
|
23
|
+
* @returns All jobs.
|
|
24
|
+
*/
|
|
25
|
+
getJobs(): IJob[];
|
|
26
|
+
/**
|
|
27
|
+
* Close the Job Dispatcher.
|
|
28
|
+
*/
|
|
29
|
+
close(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IJob, IJobResult } from './Job';
|
|
2
|
+
/**
|
|
3
|
+
* The Job Worker Connector interface.
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export interface IJobWorkerConnector {
|
|
7
|
+
/**
|
|
8
|
+
* Process a job.
|
|
9
|
+
* @param job The job to process.
|
|
10
|
+
*/
|
|
11
|
+
processJob(job: IJob): AsyncGenerator<IJobResult>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IFileDeleteEvent, IFileMoveEvent, IFileWriteEvent, IFolderCreateEvent, IFolderDeleteEvent, IFolderMoveEvent } from '.';
|
|
1
|
+
import { IFileDeleteEvent, IFileMoveEvent, IFileWriteEvent, IFolderCreateEvent, IFolderDeleteEvent, IFolderMoveEvent, ISyncCompleteEvent } from '.';
|
|
2
2
|
/**
|
|
3
3
|
* The object store event.
|
|
4
4
|
* @category Object Storage
|
|
5
5
|
*/
|
|
6
|
-
export type StorageEvent = IFileWriteEvent | IFileDeleteEvent | IFileMoveEvent | IFolderCreateEvent | IFolderDeleteEvent | IFolderMoveEvent;
|
|
6
|
+
export type StorageEvent = IFileWriteEvent | IFileDeleteEvent | IFileMoveEvent | IFolderCreateEvent | IFolderDeleteEvent | IFolderMoveEvent | ISyncCompleteEvent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,5 +8,6 @@ export { IFolderDeleteEvent } from './FolderDeleteEvent';
|
|
|
8
8
|
export { IFolderMoveEvent } from './FolderMoveEvent';
|
|
9
9
|
export { IObjectDeleteEventPayload } from './ObjectDeleteEventPayload';
|
|
10
10
|
export { IObjectMoveEventPayload } from './ObjectMoveEventPayload';
|
|
11
|
+
export { ISyncCompleteEvent } from './SyncCompleteEvent';
|
|
11
12
|
export { StorageEvent } from './StorageEvent';
|
|
12
13
|
export { StorageEventType } from './StorageEventType';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewdle/web-sdk-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "The Crewdle Mist Web SDK public types and interfaces",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
"url": "https://github.com/Crewdle/web-sdk-types/issues"
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/Crewdle/web-sdk-types#readme",
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"rxjs": "^7.8.1"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
},
|
|
20
25
|
"devDependencies": {
|
|
21
26
|
"typescript": "^5.4.3"
|
|
22
27
|
},
|