@equos/node-sdk 0.0.3

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 ADDED
@@ -0,0 +1,50 @@
1
+ # @equos/node-sdk
2
+ [Equos.ai](https://equos.ai) official node js SDK.
3
+
4
+ ## Prerequisites
5
+ - Go to [Equos Studio](https://studio.equos.ai).
6
+ - Create an organization.
7
+ - Create an API Key.
8
+
9
+
10
+ ## Installation
11
+ ```bash
12
+ npm install @equos/node-sdk
13
+ ```
14
+
15
+ ## Usage
16
+ ```ts
17
+ import { Equos } from '@equos/node-sdk';
18
+
19
+ const MY_API_KEY = ''
20
+
21
+ const client = Equos.client(MY_API_KEY);
22
+
23
+
24
+ // Create an avatar.
25
+ const referenceImageAsDataUrl: string = 'data:...';
26
+ const avatar = await client.avatars.create('Equos Avatar', referenceImageAsDataUrl);
27
+ console.log(avatar);
28
+
29
+ // Start a session.
30
+
31
+ const sessionOptions = {
32
+ name: 'Equos Session',
33
+ agent: {
34
+ instructions: 'You are a Korean teacher...'
35
+ },
36
+ avatar: {
37
+ id: avatar.id // or create one on the fly with referenceImage.
38
+ },
39
+ consumerIdentity: {
40
+ identity: 'client-identity',
41
+ name: 'Client Name'
42
+ }
43
+ }
44
+
45
+ const result = await client.sessions.create(sessionOptions);
46
+
47
+ console.log(result.session);
48
+ console.log(result.consumerAccessToken);
49
+
50
+ ```
@@ -0,0 +1,8 @@
1
+ import { EquosAvatarData, ListEquosAvatarsData } from '../types/avatar.type';
2
+ import { HttpUtils } from '../utils/http.utils';
3
+ export declare class EquosAvatar {
4
+ private readonly http;
5
+ constructor(http: HttpUtils);
6
+ create(name: string, dataUrl: string): Promise<EquosAvatarData>;
7
+ list(skip?: number, take?: number): Promise<ListEquosAvatarsData>;
8
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EquosAvatar = void 0;
4
+ class EquosAvatar {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ create(name, dataUrl) {
10
+ return this.http.post('/avatars', {
11
+ name,
12
+ refImage: dataUrl,
13
+ });
14
+ }
15
+ list(skip = 0, take = 10) {
16
+ return this.http.get(`/avatars?skip=${skip}&take=${take}`);
17
+ }
18
+ }
19
+ exports.EquosAvatar = EquosAvatar;
@@ -0,0 +1,11 @@
1
+ import { EquosAvatarData, ListEquosAvatarsData } from '../types/avatar.type';
2
+ import { CreateEquosSessionRequestData, CreateEquosSessionResponseData } from '../types/session.type';
3
+ import { HttpUtils } from '../utils/http.utils';
4
+ export declare class EquosSession {
5
+ private readonly http;
6
+ constructor(http: HttpUtils);
7
+ get(id: string): Promise<EquosAvatarData>;
8
+ create(data: CreateEquosSessionRequestData): Promise<CreateEquosSessionResponseData>;
9
+ list(skip?: number, take?: number): Promise<ListEquosAvatarsData>;
10
+ stop(id: string): Promise<EquosAvatarData>;
11
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EquosSession = void 0;
4
+ class EquosSession {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ get(id) {
10
+ return this.http.get(`/sessions/${id}`);
11
+ }
12
+ create(data) {
13
+ return this.http.post('/sessions', data);
14
+ }
15
+ list(skip = 0, take = 10) {
16
+ return this.http.get(`/sessions?skip=${skip}&take=${take}`);
17
+ }
18
+ stop(id) {
19
+ return this.http.patch(`/sessions/${id}/stop`, {});
20
+ }
21
+ }
22
+ exports.EquosSession = EquosSession;
@@ -0,0 +1,13 @@
1
+ import { EquosAvatar } from './apis/avatar';
2
+ import { EquosSession } from './apis/session';
3
+ export declare class Equos {
4
+ private readonly apiKey;
5
+ private readonly version;
6
+ private readonly http;
7
+ private avatarApi;
8
+ private sessionApi;
9
+ private constructor();
10
+ static client(apiKey: string): Equos;
11
+ get avatars(): EquosAvatar;
12
+ get sessions(): EquosSession;
13
+ }
package/dist/equos.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Equos = void 0;
4
+ const avatar_1 = require("./apis/avatar");
5
+ const session_1 = require("./apis/session");
6
+ const constants_utils_1 = require("./utils/constants.utils");
7
+ const http_utils_1 = require("./utils/http.utils");
8
+ class Equos {
9
+ apiKey;
10
+ version;
11
+ http;
12
+ avatarApi;
13
+ sessionApi;
14
+ constructor(apiKey, version = 'v1') {
15
+ this.apiKey = apiKey;
16
+ this.version = version;
17
+ this.http = new http_utils_1.HttpUtils(constants_utils_1.ConstantsUtils.API_BASE_URL, this.version, this.apiKey);
18
+ this.avatarApi = new avatar_1.EquosAvatar(this.http);
19
+ this.sessionApi = new session_1.EquosSession(this.http);
20
+ }
21
+ static client(apiKey) {
22
+ return new Equos(apiKey);
23
+ }
24
+ get avatars() {
25
+ return this.avatarApi;
26
+ }
27
+ get sessions() {
28
+ return this.sessionApi;
29
+ }
30
+ }
31
+ exports.Equos = Equos;
@@ -0,0 +1 @@
1
+ export * from './equos';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
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
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./equos"), exports);
@@ -0,0 +1,19 @@
1
+ export interface CreateEquosAvatarData {
2
+ name: string;
3
+ refImage: string;
4
+ }
5
+ export interface EquosAvatarData {
6
+ id: string;
7
+ name: string;
8
+ thumbnailUrl: string;
9
+ apiKeyId: string;
10
+ organizationId: string;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
14
+ export interface ListEquosAvatarsData {
15
+ skip: number;
16
+ take: number;
17
+ total: number;
18
+ avatars: EquosAvatarData[];
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,60 @@
1
+ export interface EquosSessionData {
2
+ id: string;
3
+ name: string;
4
+ provider: string;
5
+ client?: string;
6
+ host: {
7
+ serverUrl: string;
8
+ };
9
+ avatar: {
10
+ id: string;
11
+ identity?: string;
12
+ name?: string;
13
+ thumbnailUrl?: string;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ };
17
+ agent?: {
18
+ instructions: string;
19
+ };
20
+ startedAt: Date;
21
+ endedAt?: Date;
22
+ createdAt: Date;
23
+ updatedAt: Date;
24
+ }
25
+ export interface CreateEquosSessionRequestData {
26
+ name: string;
27
+ client?: string;
28
+ host?: {
29
+ serverUrl: string;
30
+ accessToken: string;
31
+ };
32
+ agent?: {
33
+ instructions: string;
34
+ };
35
+ avatar: {
36
+ id?: string;
37
+ identity?: string;
38
+ name?: string;
39
+ refImage?: string;
40
+ };
41
+ remoteAgentConnectingIdentity?: {
42
+ identity: string;
43
+ name: string;
44
+ };
45
+ consumerIdentity?: {
46
+ identity: string;
47
+ name: string;
48
+ };
49
+ }
50
+ export interface CreateEquosSessionResponseData {
51
+ session: EquosSessionData;
52
+ consumerAccessToken?: string;
53
+ remoteAgentAccessToken?: string;
54
+ }
55
+ export interface ListEquosSessionsData {
56
+ skip: number;
57
+ take: number;
58
+ total: number;
59
+ sessions: EquosSessionData[];
60
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export declare class ConstantsUtils {
2
+ static readonly API_BASE_URL = "https://api.equos.io/v1";
3
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConstantsUtils = void 0;
4
+ class ConstantsUtils {
5
+ static API_BASE_URL = 'https://api.equos.io/v1';
6
+ }
7
+ exports.ConstantsUtils = ConstantsUtils;
@@ -0,0 +1,10 @@
1
+ export declare class HttpUtils {
2
+ private readonly baseUrl;
3
+ private readonly version;
4
+ private readonly apiKey;
5
+ constructor(baseUrl: string, version: string, apiKey: string);
6
+ private getPath;
7
+ get<T>(path: string): Promise<T>;
8
+ post<T, U>(path: string, data: T): Promise<U>;
9
+ patch<T, U>(path: string, data: T): Promise<U>;
10
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HttpUtils = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ class HttpUtils {
9
+ baseUrl;
10
+ version;
11
+ apiKey;
12
+ constructor(baseUrl, version, apiKey) {
13
+ this.baseUrl = baseUrl;
14
+ this.version = version;
15
+ this.apiKey = apiKey;
16
+ }
17
+ getPath(path) {
18
+ return `${this.baseUrl}/${this.version}${path}`;
19
+ }
20
+ async get(path) {
21
+ return axios_1.default
22
+ .get(this.getPath(path), {
23
+ headers: {
24
+ 'x-api-key': this.apiKey,
25
+ },
26
+ })
27
+ .then((response) => response.data);
28
+ }
29
+ async post(path, data) {
30
+ return axios_1.default
31
+ .post(this.getPath(path), data, {
32
+ headers: {
33
+ 'x-api-key': this.apiKey,
34
+ },
35
+ })
36
+ .then((response) => response.data);
37
+ }
38
+ async patch(path, data) {
39
+ return axios_1.default
40
+ .patch(this.getPath(path), data, {
41
+ headers: {
42
+ 'x-api-key': this.apiKey,
43
+ },
44
+ })
45
+ .then((response) => response.data);
46
+ }
47
+ }
48
+ exports.HttpUtils = HttpUtils;
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@equos/node-sdk",
3
+ "version": "0.0.3",
4
+ "description": "Equos.ai node.js official SDK.",
5
+ "keywords": [
6
+ "ai",
7
+ "avatar",
8
+ "livekit",
9
+ "pipecat",
10
+ "sdk",
11
+ "equos.ai",
12
+ "equos"
13
+ ],
14
+ "homepage": "https://github.com/LipittSAS/equos-node#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/LipittSAS/equos-node/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/LipittSAS/equos-node.git"
21
+ },
22
+ "license": "ISC",
23
+ "author": "combis.loic@gmail.com",
24
+ "type": "commonjs",
25
+ "main": "dist/index.js",
26
+ "types": "dist/index.d.ts",
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "scripts": {
31
+ "build": "rimraf dist && tsc",
32
+ "dev": "ts-node src/index.ts",
33
+ "test": "jest",
34
+ "lint": "eslint . --ext .ts",
35
+ "prepare": "npm run build"
36
+ },
37
+ "dependencies": {
38
+ "axios": "^1.11.0"
39
+ },
40
+ "devDependencies": {
41
+ "@types/jest": "^30.0.0",
42
+ "@types/node": "^24.3.0",
43
+ "eslint": "^9.33.0",
44
+ "jest": "^29.7.0",
45
+ "prettier": "^3.6.2",
46
+ "rimraf": "^6.0.1",
47
+ "ts-jest": "^29.4.1",
48
+ "ts-node": "^10.9.2",
49
+ "typescript": "^5.9.2"
50
+ }
51
+ }