@illalabs/sdk 0.1.0-canary.48bfe253 → 0.1.0-canary.9fc2c20f
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 +118 -3
- package/dist/src/chat/Chat.d.ts +2 -0
- package/dist/src/chat/Chat.d.ts.map +1 -1
- package/dist/src/chat/Chat.js +3 -0
- package/dist/src/chat/Chat.js.map +1 -1
- package/dist/src/chat/errors/UserContextMissing.d.ts +10 -0
- package/dist/src/chat/errors/UserContextMissing.d.ts.map +1 -0
- package/dist/src/chat/errors/UserContextMissing.js +13 -0
- package/dist/src/chat/errors/UserContextMissing.js.map +1 -0
- package/dist/src/chat/errors/index.d.ts +1 -0
- package/dist/src/chat/errors/index.d.ts.map +1 -1
- package/dist/src/chat/errors/index.js +1 -0
- package/dist/src/chat/errors/index.js.map +1 -1
- package/dist/src/external.d.ts +2 -9
- package/dist/src/external.d.ts.map +1 -1
- package/dist/src/external.js +2 -8
- package/dist/src/external.js.map +1 -1
- package/dist/src/internal.d.ts +2 -1
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +2 -1
- package/dist/src/internal.js.map +1 -1
- package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.d.ts +13 -0
- package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.d.ts.map +1 -0
- package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.js +67 -0
- package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.js.map +1 -0
- package/dist/src/providers/coreApiProvider/CoreApiProvider.d.ts.map +1 -1
- package/dist/src/providers/coreApiProvider/CoreApiProvider.js +24 -33
- package/dist/src/providers/coreApiProvider/CoreApiProvider.js.map +1 -1
- package/dist/src/sdk.d.ts +288 -0
- package/dist/src/sdk.d.ts.map +1 -0
- package/dist/src/sdk.js +287 -0
- package/dist/src/sdk.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,6 +12,98 @@ pnpm add @illalabs/sdk
|
|
|
12
12
|
|
|
13
13
|
## 📖 Quick Start
|
|
14
14
|
|
|
15
|
+
The SDK provides a simple interface (`IllaSDK`) that handles all the complexity of managing chats, context, and API communication:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { IllaSDK } from "@illalabs/sdk";
|
|
19
|
+
|
|
20
|
+
// Initialize the SDK with your API key
|
|
21
|
+
const sdk = new IllaSDK({
|
|
22
|
+
apiKey: "your-api-key",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Start a conversation
|
|
26
|
+
const result = await sdk.sendMessage("What is my wallet balance on Base?", {
|
|
27
|
+
userContext: { address: "0x..." },
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log("Response:", result.response.text);
|
|
31
|
+
console.log("Chat ID:", result.chatId);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Multi-turn Conversations
|
|
35
|
+
|
|
36
|
+
Continue a conversation by passing the chat ID from previous messages:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// Start a new conversation
|
|
40
|
+
const result1 = await sdk.sendMessage("What can you help me with?", {
|
|
41
|
+
userContext: { address: "0x..." },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Continue the conversation using the chat ID
|
|
45
|
+
const result2 = await sdk.sendMessage("I want to swap 1 ETH for USDC on Base", {
|
|
46
|
+
chatId: result1.chatId,
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Handling Tool Execution
|
|
51
|
+
|
|
52
|
+
When the AI needs to execute blockchain operations, it will return pending tools:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
const result = await sdk.sendMessage("Swap 1 ETH for USDC on Base", {
|
|
56
|
+
userContext: { address: "0x..." },
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Check if there are tools to execute
|
|
60
|
+
if (result.response.pendingTools && result.response.pendingTools.length > 0) {
|
|
61
|
+
const tool = result.response.pendingTools[0];
|
|
62
|
+
|
|
63
|
+
// Execute the tool (e.g., send a transaction)
|
|
64
|
+
const executionResult = await executeTool(tool);
|
|
65
|
+
|
|
66
|
+
// Send the result back to the AI
|
|
67
|
+
const toolResult = {
|
|
68
|
+
toolCallId: tool.toolCallId,
|
|
69
|
+
toolName: tool.toolName,
|
|
70
|
+
result: executionResult,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const followUp = await sdk.sendToolResult(result.chatId, toolResult);
|
|
74
|
+
console.log(followUp.response.text);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 🔧 Advanced Usage
|
|
79
|
+
|
|
80
|
+
For more control over the SDK's behavior, you can directly instantiate and configure individual components:
|
|
81
|
+
|
|
82
|
+
### Custom Cache and Context Manager
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { ContextManager, IllaSDK, InMemoryCache } from "@illalabs/sdk";
|
|
86
|
+
|
|
87
|
+
// Create a custom cache
|
|
88
|
+
const cache = new InMemoryCache();
|
|
89
|
+
|
|
90
|
+
// Initialize SDK with custom cache
|
|
91
|
+
const sdk = new IllaSDK({ apiKey: "your-api-key" }, { cache });
|
|
92
|
+
|
|
93
|
+
// Or create a custom context manager with specific configuration
|
|
94
|
+
const contextManager = IllaSDK.createNewContextManager(cache, {
|
|
95
|
+
defaultToolsConfig: {
|
|
96
|
+
autoRouter: { swapOrBridge: "lifi" },
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const customSdk = new IllaSDK({ apiKey: "your-api-key" }, { contextManager });
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Direct Component Usage
|
|
104
|
+
|
|
105
|
+
For maximum flexibility, you can use the SDK components directly:
|
|
106
|
+
|
|
15
107
|
```typescript
|
|
16
108
|
import { Chat, ContextManager, CoreApiProvider, InMemoryCache, Prompt } from "@illalabs/sdk";
|
|
17
109
|
|
|
@@ -36,13 +128,35 @@ const chat = new Chat({
|
|
|
36
128
|
},
|
|
37
129
|
});
|
|
38
130
|
|
|
39
|
-
// Send a message
|
|
131
|
+
// Send a message using Prompt
|
|
40
132
|
const prompt = new Prompt({ text: "What is my wallet balance on Base?" });
|
|
41
133
|
const result = await chat.sendMessage(prompt);
|
|
42
134
|
|
|
43
135
|
console.log("Response:", result.response.text);
|
|
44
136
|
```
|
|
45
137
|
|
|
138
|
+
### Managing Multiple Chats
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { IllaSDK } from "@illalabs/sdk";
|
|
142
|
+
|
|
143
|
+
const sdk = new IllaSDK({ apiKey: "your-api-key" });
|
|
144
|
+
|
|
145
|
+
// Create chat instances explicitly
|
|
146
|
+
const chat1 = sdk.createChat({
|
|
147
|
+
userContext: { address: "0x123..." },
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
const chat2 = sdk.createChat({
|
|
151
|
+
userContext: { address: "0x456..." },
|
|
152
|
+
id: "custom-chat-id", // Optional: provide your own ID
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Get all active chat IDs
|
|
156
|
+
const chatIds = sdk.chatIds;
|
|
157
|
+
console.log("Active chats:", chatIds);
|
|
158
|
+
```
|
|
159
|
+
|
|
46
160
|
## 🧪 Testing
|
|
47
161
|
|
|
48
162
|
### Unit Tests
|
|
@@ -118,6 +232,7 @@ E2E_API_KEY=your-api-key E2E_FORK_BASE_RPC_URL="https://mainnet.base.org" pnpm t
|
|
|
118
232
|
|
|
119
233
|
```plaintext
|
|
120
234
|
src/
|
|
235
|
+
├── sdk.ts # Main SDK facade (IllaSDK class)
|
|
121
236
|
├── chat/ # Chat class and related utilities
|
|
122
237
|
├── context/ # Context management
|
|
123
238
|
├── caching/ # Cache implementations
|
|
@@ -128,8 +243,8 @@ src/
|
|
|
128
243
|
|
|
129
244
|
test/
|
|
130
245
|
├── unit/ # Unit tests
|
|
131
|
-
├── e2e/
|
|
132
|
-
└── utils/
|
|
246
|
+
├── e2e/ # End-to-end tests organized by class
|
|
247
|
+
└── utils/ # Shared test utilities and helpers
|
|
133
248
|
```
|
|
134
249
|
|
|
135
250
|
## Contributing
|
package/dist/src/chat/Chat.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MessageHistoryType } from "@illalabs/interfaces";
|
|
1
2
|
import type { AwaitableActionDescriptor, AwaitActionResult } from "../asyncToolChecker/index.js";
|
|
2
3
|
import type { ChatContextSnapshot, ChatOptions, SendMessageResult } from "../interfaces/index.js";
|
|
3
4
|
import type { Prompt } from "../prompt/index.js";
|
|
@@ -23,6 +24,7 @@ export declare class Chat {
|
|
|
23
24
|
* @returns Chat identifier.
|
|
24
25
|
*/
|
|
25
26
|
getId(): string;
|
|
27
|
+
get messages(): Promise<MessageHistoryType>;
|
|
26
28
|
/**
|
|
27
29
|
* Sends a prompt to the Core API and returns the processed result.
|
|
28
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/chat/Chat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/chat/Chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIR,kBAAkB,EAGrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAER,yBAAyB,EACzB,iBAAiB,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACR,mBAAmB,EACnB,WAAW,EAGX,iBAAiB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAA4B,MAAM,EAAc,MAAM,oBAAoB,CAAC;AAIvF;;GAEG;AACH,qBAAa,IAAI;IACb,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAE5B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmB;IAEnD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAkB;IAEjD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAmB;I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CAAC,CAAC;IAC5E,CAAC;CACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error raised when a user context is not provided when creating a new chat.
|
|
3
|
+
*/
|
|
4
|
+
export declare class UserContextMissing extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link UserContextMissing} instance.
|
|
7
|
+
*/
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=UserContextMissing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserContextMissing.d.ts","sourceRoot":"","sources":["../../../../src/chat/errors/UserContextMissing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IACzC;;OAEG;;CAKN"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error raised when a user context is not provided when creating a new chat.
|
|
3
|
+
*/
|
|
4
|
+
export class UserContextMissing extends Error {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new {@link UserContextMissing} instance.
|
|
7
|
+
*/
|
|
8
|
+
constructor() {
|
|
9
|
+
super("User context is required to create a new chat");
|
|
10
|
+
this.name = "UserContextMissing";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=UserContextMissing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserContextMissing.js","sourceRoot":"","sources":["../../../../src/chat/errors/UserContextMissing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACzC;;OAEG;IACH;QACI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACrC,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/chat/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/chat/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/src/external.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public API exports for the Illa SDK package
|
|
3
3
|
*
|
|
4
|
-
* This file
|
|
5
|
-
* Only exports listed here are considered part of the public API.
|
|
4
|
+
* This file exports the public API of the SDK.
|
|
6
5
|
*/
|
|
7
|
-
export
|
|
8
|
-
export { Chat } from "./chat/index.js";
|
|
9
|
-
export { ContextManager } from "./context/index.js";
|
|
10
|
-
export { AsyncToolChecker } from "./asyncToolChecker/index.js";
|
|
11
|
-
export type { CacheEntryOptions, ChatContextSnapshot, ContextManagerOptions, ICache, IContextManager, } from "./interfaces/index.js";
|
|
12
|
-
export * from "./prompt/index.js";
|
|
13
|
-
export * from "./providers/index.js";
|
|
6
|
+
export * from "./sdk.js";
|
|
14
7
|
//# sourceMappingURL=external.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,UAAU,CAAC"}
|
package/dist/src/external.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public API exports for the Illa SDK package
|
|
3
3
|
*
|
|
4
|
-
* This file
|
|
5
|
-
* Only exports listed here are considered part of the public API.
|
|
4
|
+
* This file exports the public API of the SDK.
|
|
6
5
|
*/
|
|
7
|
-
export
|
|
8
|
-
export { Chat } from "./chat/index.js";
|
|
9
|
-
export { ContextManager } from "./context/index.js";
|
|
10
|
-
export { AsyncToolChecker } from "./asyncToolChecker/index.js";
|
|
11
|
-
export * from "./prompt/index.js";
|
|
12
|
-
export * from "./providers/index.js";
|
|
6
|
+
export * from "./sdk.js";
|
|
13
7
|
//# sourceMappingURL=external.js.map
|
package/dist/src/external.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,UAAU,CAAC"}
|
package/dist/src/internal.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
export * from "./caching/index.js";
|
|
9
9
|
export * from "./chat/index.js";
|
|
10
10
|
export * from "./context/index.js";
|
|
11
|
-
export * from "./external.js";
|
|
12
11
|
export * from "./prompt/index.js";
|
|
13
12
|
export * from "./asyncToolChecker/index.js";
|
|
13
|
+
export * from "./providers/index.js";
|
|
14
|
+
export * from "./interfaces/index.js";
|
|
14
15
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
package/dist/src/internal.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
export * from "./caching/index.js";
|
|
9
9
|
export * from "./chat/index.js";
|
|
10
10
|
export * from "./context/index.js";
|
|
11
|
-
export * from "./external.js";
|
|
12
11
|
export * from "./prompt/index.js";
|
|
13
12
|
export * from "./asyncToolChecker/index.js";
|
|
13
|
+
export * from "./providers/index.js";
|
|
14
|
+
export * from "./interfaces/index.js";
|
|
14
15
|
//# sourceMappingURL=internal.js.map
|
package/dist/src/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CoreApiChatErrorResponse, LongPollingActionErrorResponse } from "@illalabs/interfaces";
|
|
2
|
+
declare class ChatErrorHandler {
|
|
3
|
+
private static handleAxiosError;
|
|
4
|
+
private static handleUnknownError;
|
|
5
|
+
static handle(error: unknown): CoreApiChatErrorResponse;
|
|
6
|
+
}
|
|
7
|
+
declare class AsyncToolCheckerErrorHandler {
|
|
8
|
+
private static handleAxiosError;
|
|
9
|
+
private static handleUnknownError;
|
|
10
|
+
static handle(error: unknown): LongPollingActionErrorResponse;
|
|
11
|
+
}
|
|
12
|
+
export { ChatErrorHandler, AsyncToolCheckerErrorHandler };
|
|
13
|
+
//# sourceMappingURL=CoreApiErrorHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreApiErrorHandler.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,wBAAwB,EACxB,8BAA8B,EACjC,MAAM,sBAAsB,CAAC;AAG9B,cAAM,gBAAgB;IAClB,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAe/B,OAAO,CAAC,MAAM,CAAC,kBAAkB;WAQnB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB;CAKjE;AAED,cAAM,4BAA4B;IAC9B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAe/B,OAAO,CAAC,MAAM,CAAC,kBAAkB;WAQnB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,8BAA8B;CAKvE;AAED,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AxiosError } from "axios";
|
|
2
|
+
class ChatErrorHandler {
|
|
3
|
+
static handleAxiosError(error) {
|
|
4
|
+
const body = error.response?.data;
|
|
5
|
+
if (body) {
|
|
6
|
+
return {
|
|
7
|
+
...body,
|
|
8
|
+
statusCode: error.status ?? 500,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
name: error.name,
|
|
13
|
+
message: error.message,
|
|
14
|
+
statusCode: error.status ?? 500,
|
|
15
|
+
details: error.message,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
static handleUnknownError(error) {
|
|
19
|
+
return {
|
|
20
|
+
name: error.name,
|
|
21
|
+
message: error.message,
|
|
22
|
+
statusCode: 500,
|
|
23
|
+
details: "SDK Call SendMessage failed",
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
static handle(error) {
|
|
27
|
+
if (error instanceof AxiosError)
|
|
28
|
+
return this.handleAxiosError(error);
|
|
29
|
+
if (error instanceof Error)
|
|
30
|
+
return this.handleUnknownError(error);
|
|
31
|
+
return this.handleUnknownError(new Error(String(error)));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
class AsyncToolCheckerErrorHandler {
|
|
35
|
+
static handleAxiosError(error) {
|
|
36
|
+
const body = error.response?.data;
|
|
37
|
+
if (body) {
|
|
38
|
+
return {
|
|
39
|
+
...body,
|
|
40
|
+
statusCode: error.status ?? 500,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
name: error.name,
|
|
45
|
+
message: error.message,
|
|
46
|
+
statusCode: error.status ?? 500,
|
|
47
|
+
details: error.message,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
static handleUnknownError(error) {
|
|
51
|
+
return {
|
|
52
|
+
name: error.name,
|
|
53
|
+
message: error.message,
|
|
54
|
+
statusCode: 500,
|
|
55
|
+
details: "SDK AsyncToolChecker awaitTransaction failed",
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
static handle(error) {
|
|
59
|
+
if (error instanceof AxiosError)
|
|
60
|
+
return this.handleAxiosError(error);
|
|
61
|
+
if (error instanceof Error)
|
|
62
|
+
return this.handleUnknownError(error);
|
|
63
|
+
return this.handleUnknownError(new Error(String(error)));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export { ChatErrorHandler, AsyncToolCheckerErrorHandler };
|
|
67
|
+
//# sourceMappingURL=CoreApiErrorHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreApiErrorHandler.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiErrorHandler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,MAAM,gBAAgB;IACV,MAAM,CAAC,gBAAgB,CAAC,KAAiB;QAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAgC,CAAC;QAC9D,IAAI,IAAI,EAAE,CAAC;YACP,OAAO;gBACH,GAAG,IAAI;gBACP,UAAU,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG;aAClC,CAAC;QACN,CAAC;QACD,OAAO;YACH,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG;YAC/B,OAAO,EAAE,KAAK,CAAC,OAAO;SACzB,CAAC;IACN,CAAC;IACO,MAAM,CAAC,kBAAkB,CAAC,KAAY;QAC1C,OAAO;YACH,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,GAAG;YACf,OAAO,EAAE,6BAA6B;SACzC,CAAC;IACN,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,KAAc;QAC/B,IAAI,KAAK,YAAY,UAAU;YAAE,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACrE,IAAI,KAAK,YAAY,KAAK;YAAE,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;CACJ;AAED,MAAM,4BAA4B;IACtB,MAAM,CAAC,gBAAgB,CAAC,KAAiB;QAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAsC,CAAC;QACpE,IAAI,IAAI,EAAE,CAAC;YACP,OAAO;gBACH,GAAG,IAAI;gBACP,UAAU,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG;aAClC,CAAC;QACN,CAAC;QACD,OAAO;YACH,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG;YAC/B,OAAO,EAAE,KAAK,CAAC,OAAO;SACzB,CAAC;IACN,CAAC;IACO,MAAM,CAAC,kBAAkB,CAAC,KAAY;QAC1C,OAAO;YACH,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,GAAG;YACf,OAAO,EAAE,8CAA8C;SAC1D,CAAC;IACN,CAAC;IACM,MAAM,CAAC,MAAM,CAAC,KAAc;QAC/B,IAAI,KAAK,YAAY,UAAU;YAAE,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACrE,IAAI,KAAK,YAAY,KAAK;YAAE,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;CACJ;AAED,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreApiProvider.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"CoreApiProvider.d.ts","sourceRoot":"","sources":["../../../../src/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|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { AsyncToolCheckerErrorHandler, ChatErrorHandler } from "./CoreApiErrorHandler.js";
|
|
2
3
|
import { CoreApiAuthenticationMissing } from "./errors/index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Axios based Core API provider implementation
|
|
@@ -34,45 +35,35 @@ export class CoreApiProvider {
|
|
|
34
35
|
*/
|
|
35
36
|
async sendMessage(body, options = {}) {
|
|
36
37
|
const requestConfig = this.buildRequestConfig(options);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// All errors will end up here because Axios throws for 4XX and 5XX status codes
|
|
46
|
-
// if (error instanceof AxiosError) {
|
|
47
|
-
// const errorResponse: CoreApiChatErrorResponse = ChatErrorHandler.handle(error);
|
|
48
|
-
// return errorResponse;
|
|
49
|
-
// }
|
|
38
|
+
try {
|
|
39
|
+
const response = await this.client.post(this.routes.chat, body, requestConfig);
|
|
40
|
+
return response.data;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const errorResponse = ChatErrorHandler.handle(error);
|
|
44
|
+
return errorResponse;
|
|
45
|
+
}
|
|
50
46
|
}
|
|
51
47
|
/**
|
|
52
48
|
* Polls the Core API for transaction status
|
|
53
49
|
*/
|
|
54
50
|
async awaitTransaction(params, options = {}) {
|
|
55
51
|
const requestConfig = this.buildRequestConfig(options);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// All errors will end up here because Axios throws for 4XX and 5XX status codes
|
|
72
|
-
// if (error instanceof AxiosError) {
|
|
73
|
-
// const errorResponse: LongPollingActionErrorResponse = ExecutionCheckerErrorHandler.handle(error);
|
|
74
|
-
// return errorResponse;
|
|
75
|
-
// }
|
|
52
|
+
try {
|
|
53
|
+
const response = await this.client.get(this.routes.actionStatus, {
|
|
54
|
+
...requestConfig,
|
|
55
|
+
params: {
|
|
56
|
+
toolName: params.toolName,
|
|
57
|
+
protocol: params.protocol,
|
|
58
|
+
args: params.args,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return response.data;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const errorResponse = AsyncToolCheckerErrorHandler.handle(error);
|
|
65
|
+
return errorResponse;
|
|
66
|
+
}
|
|
76
67
|
}
|
|
77
68
|
/** @inheritdoc */
|
|
78
69
|
getRoutes() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreApiProvider.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoreApiProvider.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiProvider.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;GAEG;AACH,MAAM,OAAO,eAAe;IACxB;;OAEG;IACgB,MAAM,CAAgB;IAEzC;;OAEG;IACgB,MAAM,CAAkC;IAE3D;;OAEG;IACH,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAyB;QACvF,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEpD,MAAM,oBAAoB,GACtB,iBAAiB;YACjB,CAAC,CAAC,aAAkC,EAAiB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAA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CAAC,IAAI;iBACpB;aACJ,CACJ,CAAC;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,aAAa,GACf,4BAA4B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/C,OAAO,aAAa,CAAC;QACzB,CAAC;IACL,CAAC;IAED,kBAAkB;IACX,SAAS;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACO,kBAAkB,CAAC,OAAuB;QAChD,OAAO;YACH,MAAM,EAAE,OAAO,CAAC,MAAM;SACzB,CAAC;IACN,CAAC;IAEO,cAAc,CAAC,OAAyC;QAC5D,sDAAsD;QACtD,OAAO,OAAO,IAAI,6BAA6B,CAAC;IACpD,CAAC;IAEO,mBAAmB,CAAC,OAA2B;QACnD,OAAO;YACH,cAAc,EAAE,kBAAkB;YAClC,GAAG,OAAO;SACb,CAAC;IACN,CAAC;IAEO,iBAAiB,CAAC,OAA4B;QAClD,IAAI,OAAO,EAAE,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,IAAI,4BAA4B,EAAE,CAAC;QAC7C,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import type { MessageHistoryType, ToolResultType, UserContext } from "@illalabs/interfaces";
|
|
2
|
+
import type { CacheEntryOptions, ChatContextSnapshot, ContextManagerOptions, ICache, IContextManager, SendMessageResult } from "./internal.js";
|
|
3
|
+
import { Chat, ContextManager } from "./internal.js";
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for initializing the IllaSDK.
|
|
6
|
+
*
|
|
7
|
+
* @property apiKey - Your ILLA API key for authentication
|
|
8
|
+
* @property baseURL - Optional custom base URL for the ILLA API (defaults to production API)
|
|
9
|
+
*/
|
|
10
|
+
type illaSDKConfig = {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
baseURL?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Optional configuration for the IllaSDK instance.
|
|
16
|
+
* You can either provide a custom cache and context manager options,
|
|
17
|
+
* or provide a complete custom context manager implementation.
|
|
18
|
+
*
|
|
19
|
+
* @property cache - Optional custom cache implementation (used with contextManagerOptions)
|
|
20
|
+
* @property contextManagerOptions - Optional configuration for the default context manager
|
|
21
|
+
* @property contextManager - Optional custom context manager implementation (mutually exclusive with cache/contextManagerOptions)
|
|
22
|
+
*/
|
|
23
|
+
type illaSDKOptions = {
|
|
24
|
+
cache?: ICache;
|
|
25
|
+
contextManagerOptions?: ContextManagerOptions;
|
|
26
|
+
contextManager?: never;
|
|
27
|
+
} | {
|
|
28
|
+
contextManager: IContextManager;
|
|
29
|
+
cache?: never;
|
|
30
|
+
contextManagerOptions?: never;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Options for creating a new chat instance.
|
|
34
|
+
*
|
|
35
|
+
* @property userContext - The user's context information { address: `0x${string}` }
|
|
36
|
+
* @property id - Optional custom ID for the chat. If not provided, a UUID will be generated
|
|
37
|
+
*/
|
|
38
|
+
type ChatOptions = {
|
|
39
|
+
userContext: UserContext;
|
|
40
|
+
id?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Context for sending a message. Requires either a chatId (to use an existing chat)
|
|
44
|
+
* or a userContext (to create a new chat).
|
|
45
|
+
*
|
|
46
|
+
* @property chatId - ID of an existing chat to send the message to
|
|
47
|
+
* @property userContext - User context for creating a new chat (required if chatId is not provided)
|
|
48
|
+
*/
|
|
49
|
+
type SendMessageContext = {
|
|
50
|
+
chatId: string;
|
|
51
|
+
userContext?: never;
|
|
52
|
+
} | {
|
|
53
|
+
chatId?: never;
|
|
54
|
+
userContext: UserContext;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Error raised when attempting to interact with a chat that doesn't exist.
|
|
58
|
+
*
|
|
59
|
+
* This typically occurs when using an invalid or expired chat ID with methods
|
|
60
|
+
* like {@link IllaSDK.sendToolResult}.
|
|
61
|
+
*/
|
|
62
|
+
declare class ChatNotFound extends Error {
|
|
63
|
+
/**
|
|
64
|
+
* The ID of the chat that was not found.
|
|
65
|
+
*/
|
|
66
|
+
readonly chatId: string;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new {@link ChatNotFound} instance.
|
|
69
|
+
*
|
|
70
|
+
* @param chatId The ID of the chat that was not found.
|
|
71
|
+
* @param options Error options for error chaining.
|
|
72
|
+
*/
|
|
73
|
+
constructor(chatId: string, options?: ErrorOptions);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The main entry point for interacting with the ILLA AI SDK.
|
|
77
|
+
* This class provides methods for creating and managing chat sessions,
|
|
78
|
+
* sending messages, handling tool results, and configuring async tool checkers.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* import { IllaSDK } from '@illalabs/sdk';
|
|
83
|
+
*
|
|
84
|
+
* const sdk = new IllaSDK({
|
|
85
|
+
* apiKey: 'your-api-key'
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* // Start a conversation
|
|
89
|
+
* const result = await sdk.sendMessage(
|
|
90
|
+
* "What can you help me with?",
|
|
91
|
+
* { userContext: { address: "0x1234..." } }
|
|
92
|
+
* );
|
|
93
|
+
*
|
|
94
|
+
* console.log(result.response.text);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare class IllaSDK {
|
|
98
|
+
private coreApiProvider;
|
|
99
|
+
private contextManager;
|
|
100
|
+
private chats;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a new instance of the IllaSDK.
|
|
103
|
+
*
|
|
104
|
+
* @param config - Configuration object containing API key and optional base URL
|
|
105
|
+
* @param options - Optional configuration for cache and context manager
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* // Basic initialization
|
|
110
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
111
|
+
*
|
|
112
|
+
* // With custom cache
|
|
113
|
+
* const cache = new InMemoryCache();
|
|
114
|
+
* const sdk = new IllaSDK(
|
|
115
|
+
* { apiKey: 'your-api-key' },
|
|
116
|
+
* { cache }
|
|
117
|
+
* );
|
|
118
|
+
*
|
|
119
|
+
* // With custom context manager
|
|
120
|
+
* const contextManager = new ContextManager(cache, { defaultToolsConfig: { autoRouter: { swapOrBridge: 'lifi' } } });
|
|
121
|
+
* const sdk = new IllaSDK(
|
|
122
|
+
* { apiKey: 'your-api-key' },
|
|
123
|
+
* { contextManager }
|
|
124
|
+
* );
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
constructor(config: illaSDKConfig, options?: illaSDKOptions);
|
|
128
|
+
/**
|
|
129
|
+
* Gets an array of all active chat IDs managed by this SDK instance.
|
|
130
|
+
*
|
|
131
|
+
* @returns {string[]} Array of chat IDs
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
136
|
+
*
|
|
137
|
+
* await sdk.sendMessage("Hello", { userContext: { address: "0x123" } });
|
|
138
|
+
* await sdk.sendMessage("Hi", { userContext: { address: "0x456" } });
|
|
139
|
+
*
|
|
140
|
+
* const chatIds = sdk.chatIds;
|
|
141
|
+
* console.log(chatIds); // ['chat-id-1', 'chat-id-2']
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
get chatIds(): string[];
|
|
145
|
+
/**
|
|
146
|
+
* Creates a new ContextManager instance. This is a factory method for creating
|
|
147
|
+
* context managers with custom configurations.
|
|
148
|
+
*
|
|
149
|
+
* @param cache - The cache implementation to use for storing context
|
|
150
|
+
* @param options - Configuration options for the context manager
|
|
151
|
+
* @returns {ContextManager} A new ContextManager instance
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const cache = new InMemoryCache();
|
|
156
|
+
* const contextManager = IllaSDK.createNewContextManager(cache, {
|
|
157
|
+
* defaultToolsConfig: {
|
|
158
|
+
* autoRouter: { swapOrBridge: 'lifi' }
|
|
159
|
+
* }
|
|
160
|
+
* });
|
|
161
|
+
*
|
|
162
|
+
* const sdk = new IllaSDK(
|
|
163
|
+
* { apiKey: 'your-api-key' },
|
|
164
|
+
* { contextManager }
|
|
165
|
+
* );
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
static createNewContextManager(cache: ICache, options: ContextManagerOptions): ContextManager;
|
|
169
|
+
/**
|
|
170
|
+
* Creates a new Chat instance with the specified options.
|
|
171
|
+
* The chat is automatically registered with this SDK instance.
|
|
172
|
+
*
|
|
173
|
+
* @param options - Options for creating the chat, including user context and optional ID
|
|
174
|
+
* @param contextManager - Optional custom context manager for this chat. If not provided, uses the SDK's default
|
|
175
|
+
* @returns {Chat} A new Chat instance
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
180
|
+
*
|
|
181
|
+
* // Create a new chat
|
|
182
|
+
* const chat = sdk.createChat({
|
|
183
|
+
* userContext: { address: "0x1234..." }
|
|
184
|
+
* });
|
|
185
|
+
*
|
|
186
|
+
* // Send messages directly through the chat instance
|
|
187
|
+
* const result = await chat.sendMessage(new Prompt({ text: "Hello!" }));
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
createChat(options: ChatOptions, contextManager?: ContextManager): Chat;
|
|
191
|
+
/**
|
|
192
|
+
* Sends a message to a chat session. This is the primary method for interacting with the AI.
|
|
193
|
+
* If a chatId is provided, the message will be sent to the existing chat.
|
|
194
|
+
* If a chatId is not provided, a new chat will be created with the provided userContext.
|
|
195
|
+
*
|
|
196
|
+
* @param msg - The message text to send
|
|
197
|
+
* @param context - Context containing either chatId for existing chat or userContext for new chat
|
|
198
|
+
* @returns {Promise<SendMessageResult>} The AI's response including chat ID, response text, and any pending tools
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
203
|
+
*
|
|
204
|
+
* // Start a new conversation
|
|
205
|
+
* const result1 = await sdk.sendMessage(
|
|
206
|
+
* "What can you help me with?",
|
|
207
|
+
* { userContext: { address: "0x1234..." } }
|
|
208
|
+
* );
|
|
209
|
+
* console.log(result1.response.text);
|
|
210
|
+
* console.log("Chat ID:", result1.chatId);
|
|
211
|
+
*
|
|
212
|
+
* // Continue the conversation using the chat ID
|
|
213
|
+
* const result2 = await sdk.sendMessage(
|
|
214
|
+
* "I want to swap 1 ETH for USDC on Base",
|
|
215
|
+
* { chatId: result1.chatId }
|
|
216
|
+
* );
|
|
217
|
+
*
|
|
218
|
+
* // Check if there are tools to execute
|
|
219
|
+
* if (result2.response.pendingTools && result2.response.pendingTools.length > 0) {
|
|
220
|
+
* console.log("Tool to execute:", result2.response.pendingTools[0]);
|
|
221
|
+
* }
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
sendMessage(msg: string, context: SendMessageContext): Promise<SendMessageResult>;
|
|
225
|
+
/**
|
|
226
|
+
* Sends the result of a tool execution back to the AI. This method is used to complete
|
|
227
|
+
* the tool execution loop when the AI requests a tool to be executed.
|
|
228
|
+
*
|
|
229
|
+
* @param chatId - The ID of the chat to send the tool result to
|
|
230
|
+
* @param toolResult - The result of the tool execution
|
|
231
|
+
* @returns {Promise<SendMessageResult>} The AI's response after processing the tool result
|
|
232
|
+
* @throws {Error} If the chat with the specified chatId is not found
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```typescript
|
|
236
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
237
|
+
*
|
|
238
|
+
* // Start a conversation that will request a tool execution
|
|
239
|
+
* const result1 = await sdk.sendMessage(
|
|
240
|
+
* "Swap 1 ETH for USDC on Base",
|
|
241
|
+
* { userContext: { address: "0x1234..." } }
|
|
242
|
+
* );
|
|
243
|
+
*
|
|
244
|
+
* // Check if there are pending tools to execute
|
|
245
|
+
* if (result1.response.pendingTools && result1.response.pendingTools.length > 0) {
|
|
246
|
+
* const tool = result1.response.pendingTools[0];
|
|
247
|
+
*
|
|
248
|
+
* // Execute the tool (e.g., send a transaction)
|
|
249
|
+
* const executionResult = await executeTool(tool);
|
|
250
|
+
*
|
|
251
|
+
* // Send the result back to the ILLA
|
|
252
|
+
* const toolResult: ToolResultType = {
|
|
253
|
+
* toolCallId: tool.toolCallId,
|
|
254
|
+
* toolName: tool.toolName,
|
|
255
|
+
* result?: executionResult,
|
|
256
|
+
* error?: executionResult.error,
|
|
257
|
+
* };
|
|
258
|
+
*
|
|
259
|
+
* const result2 = await sdk.sendToolResult(result1.chatId, toolResult);
|
|
260
|
+
* console.log(result2.response.text); // ILLA's response after processing the tool result
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
sendToolResult(chatId: string, toolResult: ToolResultType): Promise<SendMessageResult>;
|
|
265
|
+
/**
|
|
266
|
+
* Gets the messages for a given chat ID.
|
|
267
|
+
*
|
|
268
|
+
* @param chatId - The ID of the chat to get the messages for
|
|
269
|
+
* @returns {Promise<MessageHistoryType>} The messages for the chat
|
|
270
|
+
* @throws {ChatNotFound} If the chat with the specified chatId is not found
|
|
271
|
+
*/
|
|
272
|
+
getMessages(chatId: string): Promise<MessageHistoryType>;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Exports the public API of the SDK.
|
|
276
|
+
* A user could import IllaSDK as a single entry point to the SDK.
|
|
277
|
+
* Or they could import the individual components of the SDK for advanced usage.
|
|
278
|
+
*/
|
|
279
|
+
export { IllaSDK, ChatNotFound };
|
|
280
|
+
export { InMemoryCache } from "./caching/index.js";
|
|
281
|
+
export { Prompt } from "./prompt/index.js";
|
|
282
|
+
export { Chat } from "./chat/index.js";
|
|
283
|
+
export { ContextManager } from "./context/index.js";
|
|
284
|
+
export { AsyncToolChecker } from "./asyncToolChecker/index.js";
|
|
285
|
+
export { CoreApiProvider } from "./providers/index.js";
|
|
286
|
+
export { UserContextMissing } from "./chat/errors/index.js";
|
|
287
|
+
export type { illaSDKConfig, ChatContextSnapshot, CacheEntryOptions, ICache, IContextManager, SendMessageContext, };
|
|
288
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE5F,OAAO,KAAK,EACR,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,iBAAiB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEH,IAAI,EACJ,cAAc,EAKjB,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,KAAK,aAAa,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,KAAK,cAAc,GACb;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,cAAc,CAAC,EAAE,KAAK,CAAC;CAC1B,GACD;IACI,cAAc,EAAE,eAAe,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,qBAAqB,CAAC,EAAE,KAAK,CAAC;CACjC,CAAC;AAER;;;;;GAKG;AACH,KAAK,WAAW,GAAG;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;GAMG;AACH,KAAK,kBAAkB,GACjB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,CA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;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EACR,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,EACN,eAAe,EACf,kBAAkB,GACrB,CAAC"}
|
package/dist/src/sdk.js
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { AsyncToolChecker, Chat, ContextManager, CoreApiProvider, InMemoryCache, Prompt, UserContextMissing, } from "./internal.js";
|
|
2
|
+
/**
|
|
3
|
+
* Error raised when attempting to interact with a chat that doesn't exist.
|
|
4
|
+
*
|
|
5
|
+
* This typically occurs when using an invalid or expired chat ID with methods
|
|
6
|
+
* like {@link IllaSDK.sendToolResult}.
|
|
7
|
+
*/
|
|
8
|
+
class ChatNotFound extends Error {
|
|
9
|
+
/**
|
|
10
|
+
* The ID of the chat that was not found.
|
|
11
|
+
*/
|
|
12
|
+
chatId;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new {@link ChatNotFound} instance.
|
|
15
|
+
*
|
|
16
|
+
* @param chatId The ID of the chat that was not found.
|
|
17
|
+
* @param options Error options for error chaining.
|
|
18
|
+
*/
|
|
19
|
+
constructor(chatId, options) {
|
|
20
|
+
super(`Chat with ID ${chatId} not found`, options);
|
|
21
|
+
this.name = "ChatNotFound";
|
|
22
|
+
this.chatId = chatId;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The main entry point for interacting with the ILLA AI SDK.
|
|
27
|
+
* This class provides methods for creating and managing chat sessions,
|
|
28
|
+
* sending messages, handling tool results, and configuring async tool checkers.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { IllaSDK } from '@illalabs/sdk';
|
|
33
|
+
*
|
|
34
|
+
* const sdk = new IllaSDK({
|
|
35
|
+
* apiKey: 'your-api-key'
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* // Start a conversation
|
|
39
|
+
* const result = await sdk.sendMessage(
|
|
40
|
+
* "What can you help me with?",
|
|
41
|
+
* { userContext: { address: "0x1234..." } }
|
|
42
|
+
* );
|
|
43
|
+
*
|
|
44
|
+
* console.log(result.response.text);
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
class IllaSDK {
|
|
48
|
+
coreApiProvider;
|
|
49
|
+
contextManager;
|
|
50
|
+
chats = new Map();
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new instance of the IllaSDK.
|
|
53
|
+
*
|
|
54
|
+
* @param config - Configuration object containing API key and optional base URL
|
|
55
|
+
* @param options - Optional configuration for cache and context manager
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* // Basic initialization
|
|
60
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
61
|
+
*
|
|
62
|
+
* // With custom cache
|
|
63
|
+
* const cache = new InMemoryCache();
|
|
64
|
+
* const sdk = new IllaSDK(
|
|
65
|
+
* { apiKey: 'your-api-key' },
|
|
66
|
+
* { cache }
|
|
67
|
+
* );
|
|
68
|
+
*
|
|
69
|
+
* // With custom context manager
|
|
70
|
+
* const contextManager = new ContextManager(cache, { defaultToolsConfig: { autoRouter: { swapOrBridge: 'lifi' } } });
|
|
71
|
+
* const sdk = new IllaSDK(
|
|
72
|
+
* { apiKey: 'your-api-key' },
|
|
73
|
+
* { contextManager }
|
|
74
|
+
* );
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
constructor(config, options) {
|
|
78
|
+
this.coreApiProvider = new CoreApiProvider({
|
|
79
|
+
baseURL: config.baseURL,
|
|
80
|
+
headers: {
|
|
81
|
+
"x-api-key": config.apiKey,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
if (options && options.contextManager) {
|
|
85
|
+
this.contextManager = options.contextManager;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.contextManager = new ContextManager(options?.cache ?? new InMemoryCache(), options?.contextManagerOptions ?? {});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Gets an array of all active chat IDs managed by this SDK instance.
|
|
93
|
+
*
|
|
94
|
+
* @returns {string[]} Array of chat IDs
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
99
|
+
*
|
|
100
|
+
* await sdk.sendMessage("Hello", { userContext: { address: "0x123" } });
|
|
101
|
+
* await sdk.sendMessage("Hi", { userContext: { address: "0x456" } });
|
|
102
|
+
*
|
|
103
|
+
* const chatIds = sdk.chatIds;
|
|
104
|
+
* console.log(chatIds); // ['chat-id-1', 'chat-id-2']
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
get chatIds() {
|
|
108
|
+
return Array.from(this.chats.keys());
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new ContextManager instance. This is a factory method for creating
|
|
112
|
+
* context managers with custom configurations.
|
|
113
|
+
*
|
|
114
|
+
* @param cache - The cache implementation to use for storing context
|
|
115
|
+
* @param options - Configuration options for the context manager
|
|
116
|
+
* @returns {ContextManager} A new ContextManager instance
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const cache = new InMemoryCache();
|
|
121
|
+
* const contextManager = IllaSDK.createNewContextManager(cache, {
|
|
122
|
+
* defaultToolsConfig: {
|
|
123
|
+
* autoRouter: { swapOrBridge: 'lifi' }
|
|
124
|
+
* }
|
|
125
|
+
* });
|
|
126
|
+
*
|
|
127
|
+
* const sdk = new IllaSDK(
|
|
128
|
+
* { apiKey: 'your-api-key' },
|
|
129
|
+
* { contextManager }
|
|
130
|
+
* );
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
static createNewContextManager(cache, options) {
|
|
134
|
+
return new ContextManager(cache, options);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Creates a new Chat instance with the specified options.
|
|
138
|
+
* The chat is automatically registered with this SDK instance.
|
|
139
|
+
*
|
|
140
|
+
* @param options - Options for creating the chat, including user context and optional ID
|
|
141
|
+
* @param contextManager - Optional custom context manager for this chat. If not provided, uses the SDK's default
|
|
142
|
+
* @returns {Chat} A new Chat instance
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
147
|
+
*
|
|
148
|
+
* // Create a new chat
|
|
149
|
+
* const chat = sdk.createChat({
|
|
150
|
+
* userContext: { address: "0x1234..." }
|
|
151
|
+
* });
|
|
152
|
+
*
|
|
153
|
+
* // Send messages directly through the chat instance
|
|
154
|
+
* const result = await chat.sendMessage(new Prompt({ text: "Hello!" }));
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
createChat(options, contextManager) {
|
|
158
|
+
const chat = new Chat({
|
|
159
|
+
coreApiProvider: this.coreApiProvider,
|
|
160
|
+
contextManager: contextManager ?? this.contextManager,
|
|
161
|
+
userContext: options.userContext,
|
|
162
|
+
id: options.id,
|
|
163
|
+
asyncToolChecker: new AsyncToolChecker({
|
|
164
|
+
coreApiProvider: this.coreApiProvider,
|
|
165
|
+
}),
|
|
166
|
+
});
|
|
167
|
+
this.chats.set(chat.getId(), chat);
|
|
168
|
+
return chat;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Sends a message to a chat session. This is the primary method for interacting with the AI.
|
|
172
|
+
* If a chatId is provided, the message will be sent to the existing chat.
|
|
173
|
+
* If a chatId is not provided, a new chat will be created with the provided userContext.
|
|
174
|
+
*
|
|
175
|
+
* @param msg - The message text to send
|
|
176
|
+
* @param context - Context containing either chatId for existing chat or userContext for new chat
|
|
177
|
+
* @returns {Promise<SendMessageResult>} The AI's response including chat ID, response text, and any pending tools
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
182
|
+
*
|
|
183
|
+
* // Start a new conversation
|
|
184
|
+
* const result1 = await sdk.sendMessage(
|
|
185
|
+
* "What can you help me with?",
|
|
186
|
+
* { userContext: { address: "0x1234..." } }
|
|
187
|
+
* );
|
|
188
|
+
* console.log(result1.response.text);
|
|
189
|
+
* console.log("Chat ID:", result1.chatId);
|
|
190
|
+
*
|
|
191
|
+
* // Continue the conversation using the chat ID
|
|
192
|
+
* const result2 = await sdk.sendMessage(
|
|
193
|
+
* "I want to swap 1 ETH for USDC on Base",
|
|
194
|
+
* { chatId: result1.chatId }
|
|
195
|
+
* );
|
|
196
|
+
*
|
|
197
|
+
* // Check if there are tools to execute
|
|
198
|
+
* if (result2.response.pendingTools && result2.response.pendingTools.length > 0) {
|
|
199
|
+
* console.log("Tool to execute:", result2.response.pendingTools[0]);
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
sendMessage(msg, context) {
|
|
204
|
+
if (context.chatId && this.chats.get(context.chatId) !== undefined) {
|
|
205
|
+
return this.chats.get(context.chatId).sendMessage(new Prompt({ text: msg }));
|
|
206
|
+
}
|
|
207
|
+
if (!context.userContext) {
|
|
208
|
+
throw new UserContextMissing();
|
|
209
|
+
}
|
|
210
|
+
const chat = this.createChat({ userContext: context.userContext });
|
|
211
|
+
this.chats.set(chat.getId(), chat);
|
|
212
|
+
return chat.sendMessage(new Prompt({ text: msg }));
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Sends the result of a tool execution back to the AI. This method is used to complete
|
|
216
|
+
* the tool execution loop when the AI requests a tool to be executed.
|
|
217
|
+
*
|
|
218
|
+
* @param chatId - The ID of the chat to send the tool result to
|
|
219
|
+
* @param toolResult - The result of the tool execution
|
|
220
|
+
* @returns {Promise<SendMessageResult>} The AI's response after processing the tool result
|
|
221
|
+
* @throws {Error} If the chat with the specified chatId is not found
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const sdk = new IllaSDK({ apiKey: 'your-api-key' });
|
|
226
|
+
*
|
|
227
|
+
* // Start a conversation that will request a tool execution
|
|
228
|
+
* const result1 = await sdk.sendMessage(
|
|
229
|
+
* "Swap 1 ETH for USDC on Base",
|
|
230
|
+
* { userContext: { address: "0x1234..." } }
|
|
231
|
+
* );
|
|
232
|
+
*
|
|
233
|
+
* // Check if there are pending tools to execute
|
|
234
|
+
* if (result1.response.pendingTools && result1.response.pendingTools.length > 0) {
|
|
235
|
+
* const tool = result1.response.pendingTools[0];
|
|
236
|
+
*
|
|
237
|
+
* // Execute the tool (e.g., send a transaction)
|
|
238
|
+
* const executionResult = await executeTool(tool);
|
|
239
|
+
*
|
|
240
|
+
* // Send the result back to the ILLA
|
|
241
|
+
* const toolResult: ToolResultType = {
|
|
242
|
+
* toolCallId: tool.toolCallId,
|
|
243
|
+
* toolName: tool.toolName,
|
|
244
|
+
* result?: executionResult,
|
|
245
|
+
* error?: executionResult.error,
|
|
246
|
+
* };
|
|
247
|
+
*
|
|
248
|
+
* const result2 = await sdk.sendToolResult(result1.chatId, toolResult);
|
|
249
|
+
* console.log(result2.response.text); // ILLA's response after processing the tool result
|
|
250
|
+
* }
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
async sendToolResult(chatId, toolResult) {
|
|
254
|
+
if (this.chats.get(chatId) === undefined) {
|
|
255
|
+
throw new ChatNotFound(chatId);
|
|
256
|
+
}
|
|
257
|
+
return await this.chats.get(chatId).sendMessage(new Prompt({ toolResult }));
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Gets the messages for a given chat ID.
|
|
261
|
+
*
|
|
262
|
+
* @param chatId - The ID of the chat to get the messages for
|
|
263
|
+
* @returns {Promise<MessageHistoryType>} The messages for the chat
|
|
264
|
+
* @throws {ChatNotFound} If the chat with the specified chatId is not found
|
|
265
|
+
*/
|
|
266
|
+
async getMessages(chatId) {
|
|
267
|
+
const chat = this.chats.get(chatId);
|
|
268
|
+
if (!chat) {
|
|
269
|
+
throw new ChatNotFound(chatId);
|
|
270
|
+
}
|
|
271
|
+
return chat.messages;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Exports the public API of the SDK.
|
|
276
|
+
* A user could import IllaSDK as a single entry point to the SDK.
|
|
277
|
+
* Or they could import the individual components of the SDK for advanced usage.
|
|
278
|
+
*/
|
|
279
|
+
export { IllaSDK, ChatNotFound };
|
|
280
|
+
export { InMemoryCache } from "./caching/index.js";
|
|
281
|
+
export { Prompt } from "./prompt/index.js";
|
|
282
|
+
export { Chat } from "./chat/index.js";
|
|
283
|
+
export { ContextManager } from "./context/index.js";
|
|
284
|
+
export { AsyncToolChecker } from "./asyncToolChecker/index.js";
|
|
285
|
+
export { CoreApiProvider } from "./providers/index.js";
|
|
286
|
+
export { UserContextMissing } from "./chat/errors/index.js";
|
|
287
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,gBAAgB,EAChB,IAAI,EACJ,cAAc,EACd,eAAe,EACf,aAAa,EACb,MAAM,EACN,kBAAkB,GACrB,MAAM,eAAe,CAAC;AAwDvB;;;;;GAKG;AACH,MAAM,YAAa,SAAQ,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|
-
"version": "0.1.0-canary.
|
|
3
|
+
"version": "0.1.0-canary.9fc2c20f",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "TypeScript SDK for interacting with Illa's Core API",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"axios": "1.12.2",
|
|
24
24
|
"uuid": "13.0.0",
|
|
25
25
|
"viem": "2.37.13",
|
|
26
|
-
"@illalabs/interfaces": "0.1.0-canary.
|
|
26
|
+
"@illalabs/interfaces": "0.1.0-canary.9fc2c20f"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"zod": "4.1.12"
|