@illalabs/sdk 0.1.0 → 0.3.0-canary.eb4a29bf

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.
Files changed (66) hide show
  1. package/README.md +258 -0
  2. package/dist/src/chat/Chat.d.ts +2 -0
  3. package/dist/src/chat/Chat.d.ts.map +1 -1
  4. package/dist/src/chat/Chat.js +11 -2
  5. package/dist/src/chat/Chat.js.map +1 -1
  6. package/dist/src/chat/errors/UserContextMissing.d.ts +10 -0
  7. package/dist/src/chat/errors/UserContextMissing.d.ts.map +1 -0
  8. package/dist/src/chat/errors/UserContextMissing.js +13 -0
  9. package/dist/src/chat/errors/UserContextMissing.js.map +1 -0
  10. package/dist/src/chat/errors/index.d.ts +1 -0
  11. package/dist/src/chat/errors/index.d.ts.map +1 -1
  12. package/dist/src/chat/errors/index.js +1 -0
  13. package/dist/src/chat/errors/index.js.map +1 -1
  14. package/dist/src/external.d.ts +2 -9
  15. package/dist/src/external.d.ts.map +1 -1
  16. package/dist/src/external.js +2 -8
  17. package/dist/src/external.js.map +1 -1
  18. package/dist/src/interfaces/chat.interface.d.ts +8 -2
  19. package/dist/src/interfaces/chat.interface.d.ts.map +1 -1
  20. package/dist/src/interfaces/coreApiProvider.interface.d.ts +7 -1
  21. package/dist/src/interfaces/coreApiProvider.interface.d.ts.map +1 -1
  22. package/dist/src/internal.d.ts +2 -1
  23. package/dist/src/internal.d.ts.map +1 -1
  24. package/dist/src/internal.js +2 -1
  25. package/dist/src/internal.js.map +1 -1
  26. package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.d.ts +13 -0
  27. package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.d.ts.map +1 -0
  28. package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.js +67 -0
  29. package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.js.map +1 -0
  30. package/dist/src/providers/coreApiProvider/CoreApiProvider.d.ts +9 -2
  31. package/dist/src/providers/coreApiProvider/CoreApiProvider.d.ts.map +1 -1
  32. package/dist/src/providers/coreApiProvider/CoreApiProvider.js +40 -36
  33. package/dist/src/providers/coreApiProvider/CoreApiProvider.js.map +1 -1
  34. package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.d.ts +2 -4
  35. package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.d.ts.map +1 -1
  36. package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.js +7 -6
  37. package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.js.map +1 -1
  38. package/dist/src/providers/coreApiProvider/index.d.ts +2 -3
  39. package/dist/src/providers/coreApiProvider/index.d.ts.map +1 -1
  40. package/dist/src/providers/coreApiProvider/index.js.map +1 -1
  41. package/dist/src/providers/coreApiProvider/{CoreApiProviderConfig.d.ts → interfaces/CoreApiProviderConfig.interface.d.ts} +7 -2
  42. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.d.ts.map +1 -0
  43. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.js +2 -0
  44. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.js.map +1 -0
  45. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.d.ts +14 -0
  46. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.d.ts.map +1 -0
  47. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.js +2 -0
  48. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.js.map +1 -0
  49. package/dist/src/providers/coreApiProvider/interfaces/index.d.ts +3 -0
  50. package/dist/src/providers/coreApiProvider/interfaces/index.d.ts.map +1 -0
  51. package/dist/src/providers/coreApiProvider/interfaces/index.js +2 -0
  52. package/dist/src/providers/coreApiProvider/interfaces/index.js.map +1 -0
  53. package/dist/src/providers/coreApiProvider/types.d.ts +9 -0
  54. package/dist/src/providers/coreApiProvider/types.d.ts.map +1 -1
  55. package/dist/src/sdk.d.ts +288 -0
  56. package/dist/src/sdk.d.ts.map +1 -0
  57. package/dist/src/sdk.js +287 -0
  58. package/dist/src/sdk.js.map +1 -0
  59. package/package.json +9 -3
  60. package/dist/src/providers/coreApiProvider/CoreApiProviderConfig.d.ts.map +0 -1
  61. package/dist/src/providers/coreApiProvider/CoreApiProviderConfig.js +0 -2
  62. package/dist/src/providers/coreApiProvider/CoreApiProviderConfig.js.map +0 -1
  63. package/dist/src/providers/coreApiProvider/RequestOptions.d.ts +0 -10
  64. package/dist/src/providers/coreApiProvider/RequestOptions.d.ts.map +0 -1
  65. package/dist/src/providers/coreApiProvider/RequestOptions.js +0 -2
  66. package/dist/src/providers/coreApiProvider/RequestOptions.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,258 @@
1
+ # @illalabs/sdk
2
+
3
+ TypeScript SDK for building chat-based blockchain interactions with Illa's Core API.
4
+
5
+ ## 🚀 Installation
6
+
7
+ ```bash
8
+ npm install @illalabs/sdk
9
+ # or
10
+ pnpm add @illalabs/sdk
11
+ ```
12
+
13
+ ## 📖 Quick Start
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
+
107
+ ```typescript
108
+ import { Chat, ContextManager, CoreApiProvider, InMemoryCache, Prompt } from "@illalabs/sdk";
109
+
110
+ // Configure the API provider
111
+ const provider = new CoreApiProvider({
112
+ baseURL: "https://api-dev.illalabs.io",
113
+ headers: {
114
+ "x-api-key": "your-api-key",
115
+ },
116
+ });
117
+
118
+ // Set up context management with caching
119
+ const cache = new InMemoryCache();
120
+ const contextManager = new ContextManager(cache);
121
+
122
+ // Create a chat instance
123
+ const chat = new Chat({
124
+ coreApiProvider: provider,
125
+ contextManager,
126
+ userContext: {
127
+ address: "0x...", // User's wallet address
128
+ },
129
+ });
130
+
131
+ // Send a message using Prompt
132
+ const prompt = new Prompt({ text: "What is my wallet balance on Base?" });
133
+ const result = await chat.sendMessage(prompt);
134
+
135
+ console.log("Response:", result.response.text);
136
+ ```
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
+
160
+ ## 🧪 Testing
161
+
162
+ ### Unit Tests
163
+
164
+ ```bash
165
+ pnpm test # Run unit tests
166
+ pnpm test:cov # Run with coverage
167
+ ```
168
+
169
+ ### E2E Tests
170
+
171
+ The SDK provides comprehensive E2E testing using Anvil to fork Base mainnet. This ensures tests run against a realistic blockchain environment that's compatible with the Core API (chain ID 8453).
172
+
173
+ #### Prerequisites
174
+
175
+ E2E tests **require** a Base RPC URL for forking:
176
+
177
+ ```bash
178
+ # Set Base fork URL (required for E2E tests)
179
+ export E2E_FORK_BASE_RPC_URL="https://mainnet.base.org"
180
+
181
+ # Get a faster RPC from:
182
+ # - Alchemy: https://www.alchemy.com/
183
+ # - Infura: https://www.infura.io/
184
+ # - QuickNode: https://www.quicknode.com/
185
+ ```
186
+
187
+ #### Quick Start
188
+
189
+ ```bash
190
+ # Mocked API + Anvil (Base fork)
191
+ E2E_FORK_BASE_RPC_URL="https://mainnet.base.org" pnpm test:e2e:anvil
192
+
193
+ # Real API + Anvil (Base fork) - full integration
194
+ E2E_API_KEY=your-api-key E2E_FORK_BASE_RPC_URL="https://mainnet.base.org" pnpm test:e2e:anvil
195
+ ```
196
+
197
+ #### Configuration Options
198
+
199
+ **Required:**
200
+
201
+ - `E2E_FORK_BASE_RPC_URL`: Base mainnet RPC URL for forking (required for all E2E tests)
202
+
203
+ **Optional:**
204
+
205
+ - `E2E_API_KEY`: API key for authentication (if not provided, uses mocked API)
206
+ - `E2E_BASE_URL`: Base URL for the API endpoint (default: `https://api-dev.illalabs.io`)
207
+ - `E2E_TEST_ADDRESS`: Test wallet address (default: `0x5527E7744df42A56ABE7451cbFEDa1601Fa35196`)
208
+
209
+ **Note:** Environment variables use the `E2E_` prefix to avoid conflicts with vitest/vite built-in variables.
210
+
211
+ ## 📚 Documentation
212
+
213
+ - [Introduction](./docs/introduction.mdx)
214
+ - [Authentication](./docs/authentication.mdx)
215
+ - [Quickstart](./docs/quickstart.mdx)
216
+ - [Configuration](./docs/concepts/configuration.mdx)
217
+ - [Error Handling](./docs/concepts/error-handling.mdx)
218
+ - [TypeScript Support](./docs/concepts/typescript-support.mdx)
219
+ - [Testing Guide](./docs/testing.mdx)
220
+
221
+ ## Features
222
+
223
+ - **Chat-based Interface**: Intuitive conversational API for blockchain interactions
224
+ - **Context Management**: Automatic conversation history and state management
225
+ - **Multi-turn Conversations**: Seamless context preservation across messages
226
+ - **Session Persistence**: Resume conversations across different instances
227
+ - **Async Tool Monitoring**: Built-in support for long-running blockchain operations
228
+ - **TypeScript-first**: Full type safety with comprehensive type definitions
229
+ - **Flexible Caching**: Pluggable cache implementations (in-memory, Redis, etc.)
230
+
231
+ ## 📦 Project Structure
232
+
233
+ ```plaintext
234
+ src/
235
+ ├── sdk.ts # Main SDK facade (IllaSDK class)
236
+ ├── chat/ # Chat class and related utilities
237
+ ├── context/ # Context management
238
+ ├── caching/ # Cache implementations
239
+ ├── prompt/ # Prompt creation and formatting
240
+ ├── providers/ # API provider implementations
241
+ ├── interfaces/ # TypeScript interfaces
242
+ └── asyncToolChecker/ # Tool execution monitoring
243
+
244
+ test/
245
+ ├── unit/ # Unit tests
246
+ ├── e2e/ # End-to-end tests organized by class
247
+ └── utils/ # Shared test utilities and helpers
248
+ ```
249
+
250
+ ## Contributing
251
+
252
+ Wonderland is a team of top Web3 researchers, developers, and operators who believe that the future needs to be open-source, permissionless, and decentralized
253
+
254
+ [DeFi sucks](https://defi.sucks), but Wonderland is here to make it better
255
+
256
+ ## 📄 License
257
+
258
+ MIT - See [LICENSE](../../LICENSE) for details.
@@ -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":"AASA,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,OAA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IAErD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IAEzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAE1C;;;;OAIG;gBACgB,OAAO,EAAE,WAAW;IASvC;;;;OAIG;IACI,KAAK,IAAI,MAAM;IAItB,IAAW,QAAQ,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAEjD;IAED;;;;;;OAMG;IACU,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAwCpE,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAMhC;;;;;;;;;;;;OAYG;IACU,WAAW,CAAC,UAAU,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAe3F;;;OAGG;IACU,UAAU,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIvD;;;;OAIG;IACU,UAAU,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxE"}
@@ -31,6 +31,9 @@ export class Chat {
31
31
  getId() {
32
32
  return this.id;
33
33
  }
34
+ get messages() {
35
+ return this.contextManager.getContext(this.id).then((context) => context.messages);
36
+ }
34
37
  /**
35
38
  * Sends a prompt to the Core API and returns the processed result.
36
39
  *
@@ -51,7 +54,10 @@ export class Chat {
51
54
  promptSnapshot,
52
55
  messages: stagedMessages,
53
56
  toolsConfig: originalContext.toolsConfig,
54
- response,
57
+ response: {
58
+ isError: true,
59
+ error: response,
60
+ },
55
61
  };
56
62
  }
57
63
  await this.contextManager.setMessages(this.id, response.messages);
@@ -62,7 +68,10 @@ export class Chat {
62
68
  promptSnapshot,
63
69
  messages: response.messages,
64
70
  toolsConfig: originalContext.toolsConfig,
65
- response,
71
+ response: {
72
+ data: response,
73
+ isError: false,
74
+ },
66
75
  };
67
76
  }
68
77
  buildRequest(context, normalizedPrompt) {
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../../src/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KAAK,EAAE;gBACpB,UAAU;aACb,CAAC,CAAC;QACP,CAAC;QAED,OAAO,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAC/B,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,UAAU,EAAE,UAAU,CAAC,IAAI;SAC9B,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,UAAU;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,UAAU,CAAC,QAA6B;QACjD,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAClE,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,WAAW,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,2 +1,3 @@
1
1
  export { ChatAsyncToolCheckerUnavailable } from "./ChatAsyncToolCheckerUnavailable.js";
2
+ export { UserContextMissing } from "./UserContextMissing.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -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,2 +1,3 @@
1
1
  export { ChatAsyncToolCheckerUnavailable } from "./ChatAsyncToolCheckerUnavailable.js";
2
+ export { UserContextMissing } from "./UserContextMissing.js";
2
3
  //# sourceMappingURL=index.js.map
@@ -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"}
@@ -1,14 +1,7 @@
1
1
  /**
2
2
  * Public API exports for the Illa SDK package
3
3
  *
4
- * This file explicitly defines the public interface of the SDK.
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 { InMemoryCache } from "./caching/index.js";
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;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,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,YAAY,EACR,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,EACN,eAAe,GAClB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,UAAU,CAAC"}
@@ -1,13 +1,7 @@
1
1
  /**
2
2
  * Public API exports for the Illa SDK package
3
3
  *
4
- * This file explicitly defines the public interface of the SDK.
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 { InMemoryCache } from "./caching/index.js";
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
@@ -1 +1 @@
1
- {"version":3,"file":"external.js","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAQ/D,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"external.js","sourceRoot":"","sources":["../../src/external.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { CoreApiChatBodyRequest, CoreApiChatResponse, MessageHistoryType, ToolAutorouterRequest, UserContext } from "@illalabs/interfaces";
1
+ import type { CoreApiChatBodyRequest, CoreApiChatErrorResponse, CoreApiChatSuccessResponse, MessageHistoryType, ToolAutorouterRequest, UserContext } from "@illalabs/interfaces";
2
2
  import type { AsyncToolChecker } from "../asyncToolChecker/index.js";
3
3
  import type { PromptRole, PromptSnapshot } from "../prompt/index.js";
4
4
  import type { IContextManager } from "./contextManager.interface.js";
@@ -62,7 +62,13 @@ export interface SendMessageResult {
62
62
  /**
63
63
  * Raw response from the Core API.
64
64
  */
65
- readonly response: CoreApiChatResponse;
65
+ readonly response: {
66
+ readonly data: CoreApiChatSuccessResponse;
67
+ readonly isError: false;
68
+ } | {
69
+ readonly isError: true;
70
+ readonly error: CoreApiChatErrorResponse;
71
+ };
66
72
  }
67
73
  /**
68
74
  * Payload structure for chat requests sent to the Core API.
@@ -1 +1 @@
1
- {"version":3,"file":"chat.interface.d.ts","sourceRoot":"","sources":["../../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AElD;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,QAAQ,EACX;QACI,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAC;QAC1C,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;KAC3B,GACD;QACI,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;KAC5C,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAE5C;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACrC"}
@@ -1,5 +1,5 @@
1
1
  import type { CoreApiChatRequest, CoreApiChatResponse, LongPollingActionRequest, LongPollingActionResponse } from "@illalabs/interfaces";
2
- import type { RequestOptions } from "../providers/coreApiProvider/index.js";
2
+ import type { CoreApiProviderRoutes, RequestOptions } from "../providers/coreApiProvider/index.js";
3
3
  /**
4
4
  * Contract for the Core API provider
5
5
  */
@@ -22,5 +22,11 @@ export interface ICoreApiProvider {
22
22
  * @returns Core API execution checker response
23
23
  */
24
24
  awaitTransaction(request: LongPollingActionRequest["params"], options?: RequestOptions): Promise<LongPollingActionResponse>;
25
+ /**
26
+ * Retrieves the configured routes for the Core API endpoints used by the provider.
27
+ *
28
+ * @returns Route configuration including chat and action status paths.
29
+ */
30
+ getRoutes(): Required<CoreApiProviderRoutes>;
25
31
  }
26
32
  //# sourceMappingURL=coreApiProvider.interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coreApiProvider.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/coreApiProvider.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;;;;OAOG;IACH,WAAW,CACP,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACnC,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;;;;OAOG;IACH,gBAAgB,CACZ,OAAO,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAC3C,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACzC"}
1
+ {"version":3,"file":"coreApiProvider.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/coreApiProvider.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;;;;OAOG;IACH,WAAW,CACP,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACnC,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;;;;OAOG;IACH,gBAAgB,CACZ,OAAO,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAC3C,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC;;;;OAIG;IACH,SAAS,IAAI,QAAQ,CAAC,qBAAqB,CAAC,CAAC;CAChD"}
@@ -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,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,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"}
@@ -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
@@ -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,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,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,gBAAg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,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,7 +1,8 @@
1
1
  import type { CoreApiChatRequest, CoreApiChatResponse, LongPollingActionRequest, LongPollingActionResponse } from "@illalabs/interfaces";
2
2
  import type { AxiosInstance } from "axios";
3
3
  import type { ICoreApiProvider } from "../../interfaces/index.js";
4
- import type { CoreApiProviderConfig, RequestOptions } from "./index.js";
4
+ import type { CoreApiProviderConfig, CoreApiProviderRoutes } from "./interfaces/index.js";
5
+ import type { RequestOptions } from "./types.js";
5
6
  /**
6
7
  * Axios based Core API provider implementation
7
8
  */
@@ -10,10 +11,14 @@ export declare class CoreApiProvider implements ICoreApiProvider {
10
11
  * Axios instance configured for the Core API
11
12
  */
12
13
  protected readonly client: AxiosInstance;
14
+ /**
15
+ * Routes used by the provider when issuing requests.
16
+ */
17
+ protected readonly routes: Required<CoreApiProviderRoutes>;
13
18
  /**
14
19
  * @param config Core API provider configuration
15
20
  */
16
- constructor({ baseURL, timeout, headers, httpClientFactory }: CoreApiProviderConfig);
21
+ constructor({ baseURL, timeout, headers, httpClientFactory, routes }: CoreApiProviderConfig);
17
22
  /**
18
23
  * Sends a chat message to the Core API
19
24
  */
@@ -22,6 +27,8 @@ export declare class CoreApiProvider implements ICoreApiProvider {
22
27
  * Polls the Core API for transaction status
23
28
  */
24
29
  awaitTransaction(params: LongPollingActionRequest["params"], options?: RequestOptions): Promise<LongPollingActionResponse>;
30
+ /** @inheritdoc */
31
+ getRoutes(): Required<CoreApiProviderRoutes>;
25
32
  /**
26
33
  * Builds request configuration shared across endpoints
27
34
  */