@bytexbyte/nxtlinq-ai-agent-sdk 1.0.4 → 1.0.6

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/index.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.NxtlinqAIAgent = exports.NxtlinqAITSDK = exports.ChatBot = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const json_stable_stringify_1 = __importDefault(require("json-stable-stringify"));
9
- const nxtlinq_api_1 = require("./api/nxtlinq-api");
9
+ const nxtlinq_api_js_1 = require("./api/nxtlinq-api.js");
10
10
  var ChatBot_1 = require("./components/ChatBot");
11
11
  Object.defineProperty(exports, "ChatBot", { enumerable: true, get: function () { return ChatBot_1.ChatBot; } });
12
12
  class NxtlinqAITSDK {
@@ -14,7 +14,7 @@ class NxtlinqAITSDK {
14
14
  this.signer = null;
15
15
  this.walletAddress = null;
16
16
  this.serviceId = serviceId;
17
- this.api = (0, nxtlinq_api_1.createNxtlinqApi)(apiKey, apiSecret);
17
+ this.api = (0, nxtlinq_api_js_1.createNxtlinqApi)(apiKey, apiSecret);
18
18
  }
19
19
  async connectWallet() {
20
20
  if (typeof window === 'undefined' || !window.ethereum) {
@@ -158,7 +158,7 @@ class NxtlinqAIAgent {
158
158
  this.permissions = [];
159
159
  this.projectId = projectId;
160
160
  this.apiKey = apiKey;
161
- this.api = (0, nxtlinq_api_1.createNxtlinqApi)(apiKey, apiSecret);
161
+ this.api = (0, nxtlinq_api_js_1.createNxtlinqApi)(apiKey, apiSecret);
162
162
  }
163
163
  setAIT(ait, signer) {
164
164
  this.ait = ait;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/nxtlinq-ai-agent-sdk",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Nxtlinq AI Agent SDK - Proprietary Software",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,24 @@
1
+ import { AITInfo, CreateAITParams, CreateMetadataParams, VerifyWalletParams, SignInParams, WalletInfo } from '../types/ait-api';
2
+
3
+ export interface AITApi {
4
+ ait: {
5
+ getAITByServiceIdAndController: (params: { serviceId: string; controller: string }, token: string) => Promise<AITInfo | { error: string }>;
6
+ createAIT: (params: CreateAITParams, token: string) => Promise<AITInfo | { error: string }>;
7
+ };
8
+ wallet: {
9
+ verifyWallet: (params: VerifyWalletParams, token: string) => Promise<WalletInfo | { error: string }>;
10
+ getWallet: (params: { address: string }, token: string) => Promise<WalletInfo | { error: string }>;
11
+ };
12
+ metadata: {
13
+ createMetadata: (metadata: CreateMetadataParams, token: string) => Promise<{ metadataCid: string } | { error: string }>;
14
+ };
15
+ auth: {
16
+ getNonce: (params: { address: string }) => Promise<{ code: string; timestamp: number } | { error: string }>;
17
+ signIn: (params: SignInParams) => Promise<{ accessToken: string } | { error: string }>;
18
+ };
19
+ agent: {
20
+ sendMessage: (params: { message: string; serviceId: string }) => Promise<{ reply: string } | { error: string }>;
21
+ };
22
+ }
23
+
24
+ export function createNxtlinqApi(apiKey: string, apiSecret: string): AITApi;
@@ -1,17 +1,15 @@
1
- import { AITApi } from '../types/ait-api';
2
-
3
1
  const AI_AGENT_API_HOST = 'https://ai-agent.nxtlinq.ai';
4
2
  const AIT_SERVICE_API_HOST = 'https://staging-ait-service.nxtlinq.ai';
5
3
 
6
- export const createNxtlinqApi = (apiKey: string, apiSecret: string): AITApi => {
7
- const getAuthHeader = (): Record<string, string> => {
4
+ export const createNxtlinqApi = (apiKey, apiSecret) => {
5
+ const getAuthHeader = () => {
8
6
  const token = localStorage.getItem('nxtlinqAITServiceAccessToken');
9
7
  return token ? { 'Authorization': `Bearer ${JSON.parse(token)}` } : {};
10
8
  };
11
9
 
12
10
  return {
13
11
  ait: {
14
- getAITByServiceIdAndController: async (params: { serviceId: string; controller: string }, token: string) => {
12
+ getAITByServiceIdAndController: async (params, token) => {
15
13
  const response = await fetch(`${AIT_SERVICE_API_HOST}/api/ait/service/${params.serviceId}/controller/${params.controller}`, {
16
14
  method: 'GET',
17
15
  headers: {
@@ -22,7 +20,7 @@ export const createNxtlinqApi = (apiKey: string, apiSecret: string): AITApi => {
22
20
  });
23
21
  return response.json();
24
22
  },
25
- createAIT: async (params: any, token: string) => {
23
+ createAIT: async (params, token) => {
26
24
  const response = await fetch(`${AIT_SERVICE_API_HOST}/api/ait`, {
27
25
  method: 'POST',
28
26
  headers: {
@@ -37,7 +35,7 @@ export const createNxtlinqApi = (apiKey: string, apiSecret: string): AITApi => {
37
35
  }
38
36
  },
39
37
  wallet: {
40
- verifyWallet: async (params: any, token: string) => {
38
+ verifyWallet: async (params, token) => {
41
39
  const response = await fetch(`${AIT_SERVICE_API_HOST}/api/wallet`, {
42
40
  method: 'POST',
43
41
  headers: {
@@ -50,7 +48,7 @@ export const createNxtlinqApi = (apiKey: string, apiSecret: string): AITApi => {
50
48
  });
51
49
  return response.json();
52
50
  },
53
- getWallet: async (params: { address: string }, token: string) => {
51
+ getWallet: async (params, token) => {
54
52
  const response = await fetch(`${AIT_SERVICE_API_HOST}/api/wallet/address/${params.address}`, {
55
53
  method: 'GET',
56
54
  headers: {
@@ -63,7 +61,7 @@ export const createNxtlinqApi = (apiKey: string, apiSecret: string): AITApi => {
63
61
  }
64
62
  },
65
63
  metadata: {
66
- createMetadata: async (metadata: any, token: string) => {
64
+ createMetadata: async (metadata, token) => {
67
65
  const response = await fetch(`${AIT_SERVICE_API_HOST}/api/metadata`, {
68
66
  method: 'POST',
69
67
  headers: {
@@ -78,7 +76,7 @@ export const createNxtlinqApi = (apiKey: string, apiSecret: string): AITApi => {
78
76
  }
79
77
  },
80
78
  auth: {
81
- getNonce: async (params: { address: string }) => {
79
+ getNonce: async (params) => {
82
80
  const response = await fetch(`${AIT_SERVICE_API_HOST}/api/auth/address/${params.address}/nonce`, {
83
81
  method: 'GET',
84
82
  headers: {
@@ -89,7 +87,7 @@ export const createNxtlinqApi = (apiKey: string, apiSecret: string): AITApi => {
89
87
  });
90
88
  return response.json();
91
89
  },
92
- signIn: async (params: any) => {
90
+ signIn: async (params) => {
93
91
  const response = await fetch(`${AIT_SERVICE_API_HOST}/api/auth`, {
94
92
  method: 'POST',
95
93
  headers: {
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ethers } from 'ethers';
2
2
  import stringify from 'json-stable-stringify';
3
3
  import { AITInfo, AITMetadata, PermissionGroup, PermissionOption, WalletInfo, CreateAITParams, CreateMetadataParams, VerifyWalletParams, SignInParams } from './types/ait-api';
4
- import { createNxtlinqApi } from './api/nxtlinq-api';
4
+ import { createNxtlinqApi } from './api/nxtlinq-api.js';
5
5
 
6
6
  export { ChatBot } from './components/ChatBot';
7
7
  export type { Message, PresetMessage, ToolUse, ChatBotProps } from './components/ChatBot';
package/tsconfig.json CHANGED
@@ -14,7 +14,11 @@
14
14
  "isolatedModules": true,
15
15
  "composite": false,
16
16
  "declarationMap": true,
17
- "rootDir": "src"
17
+ "rootDir": "src",
18
+ "baseUrl": "src",
19
+ "paths": {
20
+ "*": ["*"]
21
+ }
18
22
  },
19
23
  "include": ["src/**/*"],
20
24
  "exclude": ["node_modules", "dist"]