@illalabs/sdk 0.0.0 → 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.
Files changed (221) hide show
  1. package/LICENSE +17 -2
  2. package/README.md +256 -1
  3. package/dist/src/asyncToolChecker/AsyncToolChecker.d.ts +39 -0
  4. package/dist/src/asyncToolChecker/AsyncToolChecker.d.ts.map +1 -0
  5. package/dist/src/asyncToolChecker/AsyncToolChecker.js +209 -0
  6. package/dist/src/asyncToolChecker/AsyncToolChecker.js.map +1 -0
  7. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerMaxRetriesExceeded.d.ts +23 -0
  8. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerMaxRetriesExceeded.d.ts.map +1 -0
  9. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerMaxRetriesExceeded.js +30 -0
  10. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerMaxRetriesExceeded.js.map +1 -0
  11. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerMethodNotImplemented.d.ts +17 -0
  12. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerMethodNotImplemented.d.ts.map +1 -0
  13. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerMethodNotImplemented.js +26 -0
  14. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerMethodNotImplemented.js.map +1 -0
  15. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerTimeout.d.ts +17 -0
  16. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerTimeout.d.ts.map +1 -0
  17. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerTimeout.js +21 -0
  18. package/dist/src/asyncToolChecker/errors/AsyncToolCheckerTimeout.js.map +1 -0
  19. package/dist/src/asyncToolChecker/errors/index.d.ts +4 -0
  20. package/dist/src/asyncToolChecker/errors/index.d.ts.map +1 -0
  21. package/dist/src/asyncToolChecker/errors/index.js +4 -0
  22. package/dist/src/asyncToolChecker/errors/index.js.map +1 -0
  23. package/dist/src/asyncToolChecker/index.d.ts +6 -0
  24. package/dist/src/asyncToolChecker/index.d.ts.map +1 -0
  25. package/dist/src/asyncToolChecker/index.js +5 -0
  26. package/dist/src/asyncToolChecker/index.js.map +1 -0
  27. package/dist/src/asyncToolChecker/types.d.ts +24 -0
  28. package/dist/src/asyncToolChecker/types.d.ts.map +1 -0
  29. package/dist/src/asyncToolChecker/types.js +2 -0
  30. package/dist/src/asyncToolChecker/types.js.map +1 -0
  31. package/dist/src/asyncToolChecker/utils/index.d.ts +3 -0
  32. package/dist/src/asyncToolChecker/utils/index.d.ts.map +1 -0
  33. package/dist/src/asyncToolChecker/utils/index.js +3 -0
  34. package/dist/src/asyncToolChecker/utils/index.js.map +1 -0
  35. package/dist/src/asyncToolChecker/utils/isErrorResponse.d.ts +11 -0
  36. package/dist/src/asyncToolChecker/utils/isErrorResponse.d.ts.map +1 -0
  37. package/dist/src/asyncToolChecker/utils/isErrorResponse.js +12 -0
  38. package/dist/src/asyncToolChecker/utils/isErrorResponse.js.map +1 -0
  39. package/dist/src/asyncToolChecker/utils/normalizeTimeout.d.ts +9 -0
  40. package/dist/src/asyncToolChecker/utils/normalizeTimeout.d.ts.map +1 -0
  41. package/dist/src/asyncToolChecker/utils/normalizeTimeout.js +14 -0
  42. package/dist/src/asyncToolChecker/utils/normalizeTimeout.js.map +1 -0
  43. package/dist/src/caching/InMemoryCache.d.ts +14 -0
  44. package/dist/src/caching/InMemoryCache.d.ts.map +1 -0
  45. package/dist/src/caching/InMemoryCache.js +31 -0
  46. package/dist/src/caching/InMemoryCache.js.map +1 -0
  47. package/dist/src/caching/index.d.ts +3 -0
  48. package/dist/src/caching/index.d.ts.map +1 -0
  49. package/dist/src/caching/index.js +2 -0
  50. package/dist/src/caching/index.js.map +1 -0
  51. package/dist/src/chat/Chat.d.ts +64 -0
  52. package/dist/src/chat/Chat.d.ts.map +1 -0
  53. package/dist/src/chat/Chat.js +129 -0
  54. package/dist/src/chat/Chat.js.map +1 -0
  55. package/dist/src/chat/errors/ChatAsyncToolCheckerUnavailable.d.ts +19 -0
  56. package/dist/src/chat/errors/ChatAsyncToolCheckerUnavailable.d.ts.map +1 -0
  57. package/dist/src/chat/errors/ChatAsyncToolCheckerUnavailable.js +28 -0
  58. package/dist/src/chat/errors/ChatAsyncToolCheckerUnavailable.js.map +1 -0
  59. package/dist/src/chat/errors/UserContextMissing.d.ts +10 -0
  60. package/dist/src/chat/errors/UserContextMissing.d.ts.map +1 -0
  61. package/dist/src/chat/errors/UserContextMissing.js +13 -0
  62. package/dist/src/chat/errors/UserContextMissing.js.map +1 -0
  63. package/dist/src/chat/errors/index.d.ts +3 -0
  64. package/dist/src/chat/errors/index.d.ts.map +1 -0
  65. package/dist/src/chat/errors/index.js +3 -0
  66. package/dist/src/chat/errors/index.js.map +1 -0
  67. package/dist/src/chat/index.d.ts +5 -0
  68. package/dist/src/chat/index.d.ts.map +1 -0
  69. package/dist/src/chat/index.js +3 -0
  70. package/dist/src/chat/index.js.map +1 -0
  71. package/dist/src/chat/types.d.ts +9 -0
  72. package/dist/src/chat/types.d.ts.map +1 -0
  73. package/dist/src/chat/types.js +2 -0
  74. package/dist/src/chat/types.js.map +1 -0
  75. package/dist/src/chat/utils/index.d.ts +2 -0
  76. package/dist/src/chat/utils/index.d.ts.map +1 -0
  77. package/dist/src/chat/utils/index.js +2 -0
  78. package/dist/src/chat/utils/index.js.map +1 -0
  79. package/dist/src/chat/utils/uuid.d.ts +12 -0
  80. package/dist/src/chat/utils/uuid.d.ts.map +1 -0
  81. package/dist/src/chat/utils/uuid.js +19 -0
  82. package/dist/src/chat/utils/uuid.js.map +1 -0
  83. package/dist/src/context/ContextManager.d.ts +26 -0
  84. package/dist/src/context/ContextManager.d.ts.map +1 -0
  85. package/dist/src/context/ContextManager.js +93 -0
  86. package/dist/src/context/ContextManager.js.map +1 -0
  87. package/dist/src/context/index.d.ts +2 -0
  88. package/dist/src/context/index.d.ts.map +1 -0
  89. package/dist/src/context/index.js +2 -0
  90. package/dist/src/context/index.js.map +1 -0
  91. package/dist/src/context/types.d.ts +17 -0
  92. package/dist/src/context/types.d.ts.map +1 -0
  93. package/dist/src/context/types.js +2 -0
  94. package/dist/src/context/types.js.map +1 -0
  95. package/dist/src/external.d.ts +7 -0
  96. package/dist/src/external.d.ts.map +1 -0
  97. package/dist/src/external.js +7 -0
  98. package/dist/src/external.js.map +1 -0
  99. package/dist/src/index.d.ts +8 -0
  100. package/dist/src/index.d.ts.map +1 -0
  101. package/dist/src/index.js +8 -0
  102. package/dist/src/index.js.map +1 -0
  103. package/dist/src/interfaces/asyncToolChecker.interface.d.ts +85 -0
  104. package/dist/src/interfaces/asyncToolChecker.interface.d.ts.map +1 -0
  105. package/dist/src/interfaces/asyncToolChecker.interface.js +2 -0
  106. package/dist/src/interfaces/asyncToolChecker.interface.js.map +1 -0
  107. package/dist/src/interfaces/cache.interface.d.ts +35 -0
  108. package/dist/src/interfaces/cache.interface.d.ts.map +1 -0
  109. package/dist/src/interfaces/cache.interface.js +2 -0
  110. package/dist/src/interfaces/cache.interface.js.map +1 -0
  111. package/dist/src/interfaces/chat.interface.d.ts +84 -0
  112. package/dist/src/interfaces/chat.interface.d.ts.map +1 -0
  113. package/dist/src/interfaces/chat.interface.js +2 -0
  114. package/dist/src/interfaces/chat.interface.js.map +1 -0
  115. package/dist/src/interfaces/contextManager.interface.d.ts +86 -0
  116. package/dist/src/interfaces/contextManager.interface.d.ts.map +1 -0
  117. package/dist/src/interfaces/contextManager.interface.js +2 -0
  118. package/dist/src/interfaces/contextManager.interface.js.map +1 -0
  119. package/dist/src/interfaces/coreApiProvider.interface.d.ts +32 -0
  120. package/dist/src/interfaces/coreApiProvider.interface.d.ts.map +1 -0
  121. package/dist/src/interfaces/coreApiProvider.interface.js +2 -0
  122. package/dist/src/interfaces/coreApiProvider.interface.js.map +1 -0
  123. package/dist/src/interfaces/index.d.ts +7 -0
  124. package/dist/src/interfaces/index.d.ts.map +1 -0
  125. package/dist/src/interfaces/index.js +2 -0
  126. package/dist/src/interfaces/index.js.map +1 -0
  127. package/dist/src/internal.d.ts +15 -0
  128. package/dist/src/internal.d.ts.map +1 -0
  129. package/dist/src/internal.js +15 -0
  130. package/dist/src/internal.js.map +1 -0
  131. package/dist/src/prompt/Prompt.d.ts +61 -0
  132. package/dist/src/prompt/Prompt.d.ts.map +1 -0
  133. package/dist/src/prompt/Prompt.js +118 -0
  134. package/dist/src/prompt/Prompt.js.map +1 -0
  135. package/dist/src/prompt/errors/PromptConfigurationConflict.d.ts +10 -0
  136. package/dist/src/prompt/errors/PromptConfigurationConflict.d.ts.map +1 -0
  137. package/dist/src/prompt/errors/PromptConfigurationConflict.js +13 -0
  138. package/dist/src/prompt/errors/PromptConfigurationConflict.js.map +1 -0
  139. package/dist/src/prompt/errors/index.d.ts +2 -0
  140. package/dist/src/prompt/errors/index.d.ts.map +1 -0
  141. package/dist/src/prompt/errors/index.js +2 -0
  142. package/dist/src/prompt/errors/index.js.map +1 -0
  143. package/dist/src/prompt/index.d.ts +4 -0
  144. package/dist/src/prompt/index.d.ts.map +1 -0
  145. package/dist/src/prompt/index.js +3 -0
  146. package/dist/src/prompt/index.js.map +1 -0
  147. package/dist/src/prompt/types.d.ts +57 -0
  148. package/dist/src/prompt/types.d.ts.map +1 -0
  149. package/dist/src/prompt/types.js +2 -0
  150. package/dist/src/prompt/types.js.map +1 -0
  151. package/dist/src/prompt/utils/cloneToolResult.d.ts +12 -0
  152. package/dist/src/prompt/utils/cloneToolResult.d.ts.map +1 -0
  153. package/dist/src/prompt/utils/cloneToolResult.js +28 -0
  154. package/dist/src/prompt/utils/cloneToolResult.js.map +1 -0
  155. package/dist/src/prompt/utils/deepClone.d.ts +9 -0
  156. package/dist/src/prompt/utils/deepClone.d.ts.map +1 -0
  157. package/dist/src/prompt/utils/deepClone.js +15 -0
  158. package/dist/src/prompt/utils/deepClone.js.map +1 -0
  159. package/dist/src/prompt/utils/index.d.ts +5 -0
  160. package/dist/src/prompt/utils/index.d.ts.map +1 -0
  161. package/dist/src/prompt/utils/index.js +5 -0
  162. package/dist/src/prompt/utils/index.js.map +1 -0
  163. package/dist/src/prompt/utils/normalizeTextPrompt.d.ts +14 -0
  164. package/dist/src/prompt/utils/normalizeTextPrompt.d.ts.map +1 -0
  165. package/dist/src/prompt/utils/normalizeTextPrompt.js +22 -0
  166. package/dist/src/prompt/utils/normalizeTextPrompt.js.map +1 -0
  167. package/dist/src/prompt/utils/normalizeToolResult.d.ts +14 -0
  168. package/dist/src/prompt/utils/normalizeToolResult.d.ts.map +1 -0
  169. package/dist/src/prompt/utils/normalizeToolResult.js +27 -0
  170. package/dist/src/prompt/utils/normalizeToolResult.js.map +1 -0
  171. package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.d.ts +13 -0
  172. package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.d.ts.map +1 -0
  173. package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.js +67 -0
  174. package/dist/src/providers/coreApiProvider/CoreApiErrorHandler.js.map +1 -0
  175. package/dist/src/providers/coreApiProvider/CoreApiProvider.d.ts +42 -0
  176. package/dist/src/providers/coreApiProvider/CoreApiProvider.d.ts.map +1 -0
  177. package/dist/src/providers/coreApiProvider/CoreApiProvider.js +97 -0
  178. package/dist/src/providers/coreApiProvider/CoreApiProvider.js.map +1 -0
  179. package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.d.ts +8 -0
  180. package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.d.ts.map +1 -0
  181. package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.js +15 -0
  182. package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.js.map +1 -0
  183. package/dist/src/providers/coreApiProvider/errors/CoreApiMethodNotImplemented.d.ts +9 -0
  184. package/dist/src/providers/coreApiProvider/errors/CoreApiMethodNotImplemented.d.ts.map +1 -0
  185. package/dist/src/providers/coreApiProvider/errors/CoreApiMethodNotImplemented.js +19 -0
  186. package/dist/src/providers/coreApiProvider/errors/CoreApiMethodNotImplemented.js.map +1 -0
  187. package/dist/src/providers/coreApiProvider/errors/index.d.ts +3 -0
  188. package/dist/src/providers/coreApiProvider/errors/index.d.ts.map +1 -0
  189. package/dist/src/providers/coreApiProvider/errors/index.js +3 -0
  190. package/dist/src/providers/coreApiProvider/errors/index.js.map +1 -0
  191. package/dist/src/providers/coreApiProvider/index.d.ts +6 -0
  192. package/dist/src/providers/coreApiProvider/index.d.ts.map +1 -0
  193. package/dist/src/providers/coreApiProvider/index.js +3 -0
  194. package/dist/src/providers/coreApiProvider/index.js.map +1 -0
  195. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.d.ts +29 -0
  196. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.d.ts.map +1 -0
  197. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.js +2 -0
  198. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.js.map +1 -0
  199. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.d.ts +14 -0
  200. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.d.ts.map +1 -0
  201. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.js +2 -0
  202. package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.js.map +1 -0
  203. package/dist/src/providers/coreApiProvider/interfaces/index.d.ts +3 -0
  204. package/dist/src/providers/coreApiProvider/interfaces/index.d.ts.map +1 -0
  205. package/dist/src/providers/coreApiProvider/interfaces/index.js +2 -0
  206. package/dist/src/providers/coreApiProvider/interfaces/index.js.map +1 -0
  207. package/dist/src/providers/coreApiProvider/types.d.ts +16 -0
  208. package/dist/src/providers/coreApiProvider/types.d.ts.map +1 -0
  209. package/dist/src/providers/coreApiProvider/types.js +2 -0
  210. package/dist/src/providers/coreApiProvider/types.js.map +1 -0
  211. package/dist/src/providers/index.d.ts +2 -0
  212. package/dist/src/providers/index.d.ts.map +1 -0
  213. package/dist/src/providers/index.js +2 -0
  214. package/dist/src/providers/index.js.map +1 -0
  215. package/dist/src/sdk.d.ts +288 -0
  216. package/dist/src/sdk.d.ts.map +1 -0
  217. package/dist/src/sdk.js +287 -0
  218. package/dist/src/sdk.js.map +1 -0
  219. package/package.json +42 -5
  220. package/index.d.ts +0 -1
  221. package/index.js +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,21 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025
3
+ Copyright (c) 2025 Wonderland
4
+
4
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
6
  of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction...
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,258 @@
1
1
  # @illalabs/sdk
2
2
 
3
- Reserved package name. Actual code will be published in a later version.
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.
@@ -0,0 +1,39 @@
1
+ import type { AsyncCheckerEvents, AsyncToolCheckerCheckParams, AsyncToolCheckerOptions, EventSubscription, PollingConfig } from "../interfaces/index.js";
2
+ import type { AwaitActionResult } from "./types.js";
3
+ /**
4
+ * Provides high level tooling to monitor asynchronous Core API executions.
5
+ */
6
+ export declare class AsyncToolChecker {
7
+ private readonly coreApiProvider;
8
+ /**
9
+ * Creates a new {@link AsyncToolChecker} instance.
10
+ *
11
+ * @param options Dependencies required to perform asynchronous checks.
12
+ */
13
+ constructor(options: AsyncToolCheckerOptions);
14
+ /**
15
+ * Retrieves the latest status for a specific tool execution.
16
+ *
17
+ * The method delegates the long polling request to the injected {@link ICoreApiProvider}
18
+ * and normalizes the resulting payload into an {@link AwaitActionResult} discriminated union
19
+ * to simplify downstream handling.
20
+ *
21
+ * @param params Parameters describing the tool execution to inspect.
22
+ *
23
+ * @returns Latest status returned by the Core API.
24
+ */
25
+ check(params: AsyncToolCheckerCheckParams): Promise<AwaitActionResult>;
26
+ /**
27
+ * Subscribes to status updates for a tool execution using a polling strategy.
28
+ *
29
+ * TODO: Implement polling orchestration and event dispatch once the execution
30
+ * checker workflow is defined.
31
+ *
32
+ * @param events Callback handlers invoked during the subscription lifecycle.
33
+ * @param pollingConfig Configuration that controls polling cadence and retries.
34
+ *
35
+ * @returns Subscription handle that allows callers to cancel the polling loop.
36
+ */
37
+ subscribe<TPayload, TError>(params: AsyncToolCheckerCheckParams, events: AsyncCheckerEvents<TPayload, TError>, pollingConfig: PollingConfig): EventSubscription;
38
+ }
39
+ //# sourceMappingURL=AsyncToolChecker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncToolChecker.d.ts","sourceRoot":"","sources":["../../../src/asyncToolChecker/AsyncToolChecker.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACR,kBAAkB,EAClB,2BAA2B,EAC3B,uBAAuB,EACvB,iBAAiB,EAEjB,aAAa,EAEhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAIpD;;GAEG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmB;IAEnD;;;;OAIG;gBACgB,OAAO,EAAE,uBAAuB;IAInD;;;;;;;;;;OAUG;IACU,KAAK,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoBnF;;;;;;;;;;OAUG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAC7B,MAAM,EAAE,2BAA2B,EACnC,MAAM,EAAE,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC5C,aAAa,EAAE,aAAa,GAC7B,iBAAiB;CAqMvB"}
@@ -0,0 +1,209 @@
1
+ import { AsyncToolCheckerMaxRetriesExceeded, AsyncToolCheckerTimeout } from "./errors/index.js";
2
+ import { isErrorResponse, normalizeTimeout } from "./utils/index.js";
3
+ /**
4
+ * Provides high level tooling to monitor asynchronous Core API executions.
5
+ */
6
+ export class AsyncToolChecker {
7
+ coreApiProvider;
8
+ /**
9
+ * Creates a new {@link AsyncToolChecker} instance.
10
+ *
11
+ * @param options Dependencies required to perform asynchronous checks.
12
+ */
13
+ constructor(options) {
14
+ this.coreApiProvider = options.coreApiProvider;
15
+ }
16
+ /**
17
+ * Retrieves the latest status for a specific tool execution.
18
+ *
19
+ * The method delegates the long polling request to the injected {@link ICoreApiProvider}
20
+ * and normalizes the resulting payload into an {@link AwaitActionResult} discriminated union
21
+ * to simplify downstream handling.
22
+ *
23
+ * @param params Parameters describing the tool execution to inspect.
24
+ *
25
+ * @returns Latest status returned by the Core API.
26
+ */
27
+ async check(params) {
28
+ const response = await this.coreApiProvider.awaitTransaction({
29
+ toolName: params.toolName,
30
+ protocol: params.protocol,
31
+ args: params.descriptor,
32
+ });
33
+ if (isErrorResponse(response)) {
34
+ return {
35
+ isError: true,
36
+ error: response,
37
+ };
38
+ }
39
+ return {
40
+ isError: false,
41
+ response,
42
+ };
43
+ }
44
+ /**
45
+ * Subscribes to status updates for a tool execution using a polling strategy.
46
+ *
47
+ * TODO: Implement polling orchestration and event dispatch once the execution
48
+ * checker workflow is defined.
49
+ *
50
+ * @param events Callback handlers invoked during the subscription lifecycle.
51
+ * @param pollingConfig Configuration that controls polling cadence and retries.
52
+ *
53
+ * @returns Subscription handle that allows callers to cancel the polling loop.
54
+ */
55
+ subscribe(params, events, pollingConfig) {
56
+ const intervalMs = normalizeTimeout(pollingConfig.interval);
57
+ const retryThresholdMs = normalizeTimeout(pollingConfig.retryThreshold);
58
+ const maxRetries = Math.max(0, Math.floor(pollingConfig.maxRetries));
59
+ const maxDurationSeconds = Math.max(0, pollingConfig.maxDuration);
60
+ const maxDurationMs = maxDurationSeconds > 0 ? normalizeTimeout(maxDurationSeconds) : undefined;
61
+ let retries = 0;
62
+ let isActive = true;
63
+ let previous = null;
64
+ let pollingTimer;
65
+ let maxDurationTimer;
66
+ let inFlightController = null;
67
+ const clearTimer = (timer) => {
68
+ if (timer !== undefined) {
69
+ clearTimeout(timer);
70
+ }
71
+ };
72
+ const finalize = (error, notifyError = error !== undefined) => {
73
+ if (!isActive) {
74
+ return;
75
+ }
76
+ isActive = false;
77
+ clearTimer(pollingTimer);
78
+ pollingTimer = undefined;
79
+ clearTimer(maxDurationTimer);
80
+ maxDurationTimer = undefined;
81
+ if (inFlightController !== null) {
82
+ inFlightController.abort();
83
+ inFlightController = null;
84
+ }
85
+ if (notifyError && error !== undefined) {
86
+ events.onError?.(error);
87
+ }
88
+ };
89
+ if (maxDurationMs !== undefined) {
90
+ maxDurationTimer = setTimeout(() => {
91
+ finalize(new AsyncToolCheckerTimeout(maxDurationSeconds));
92
+ }, maxDurationMs);
93
+ }
94
+ const emitStatus = (current) => {
95
+ if (!isActive) {
96
+ return false;
97
+ }
98
+ // Avoids duplicate notifications when no state transition occurred.
99
+ if (previous === current) {
100
+ return true;
101
+ }
102
+ const event = {
103
+ previous,
104
+ current,
105
+ };
106
+ try {
107
+ events.onStatusChange(event);
108
+ }
109
+ catch (handlerError) {
110
+ finalize(handlerError);
111
+ return false;
112
+ }
113
+ previous = current;
114
+ return true;
115
+ };
116
+ const scheduleNext = (delayMs) => {
117
+ if (!isActive) {
118
+ return;
119
+ }
120
+ clearTimer(pollingTimer);
121
+ pollingTimer = setTimeout(() => {
122
+ pollingTimer = undefined;
123
+ void tick();
124
+ }, delayMs);
125
+ };
126
+ const handleRetryableError = (error) => {
127
+ retries += 1;
128
+ if (retries > maxRetries) {
129
+ finalize(new AsyncToolCheckerMaxRetriesExceeded(maxRetries, error));
130
+ return;
131
+ }
132
+ scheduleNext(retryThresholdMs);
133
+ };
134
+ const handleSuccessResponse = (response) => {
135
+ retries = 0;
136
+ if (!emitStatus(response)) {
137
+ return;
138
+ }
139
+ if (response.pollStatus === "pending") {
140
+ scheduleNext(intervalMs);
141
+ return;
142
+ }
143
+ finalize();
144
+ };
145
+ /**
146
+ * Normalizes successful polling responses by preserving pending and completed states.
147
+ */
148
+ const normalizeSuccessResponse = (response) => {
149
+ if (response.pollStatus !== "failed") {
150
+ return response;
151
+ }
152
+ return {
153
+ ...response,
154
+ error: response.error,
155
+ };
156
+ };
157
+ const tick = async () => {
158
+ if (!isActive) {
159
+ return;
160
+ }
161
+ const controller = new AbortController();
162
+ inFlightController = controller;
163
+ let response;
164
+ try {
165
+ response = await this.coreApiProvider.awaitTransaction({
166
+ toolName: params.toolName,
167
+ protocol: params.protocol,
168
+ args: params.descriptor,
169
+ }, { signal: controller.signal });
170
+ }
171
+ catch (error) {
172
+ if (!isActive) {
173
+ return;
174
+ }
175
+ if (controller.signal.aborted) {
176
+ finalize(undefined, false);
177
+ return;
178
+ }
179
+ finalize(error);
180
+ return;
181
+ }
182
+ finally {
183
+ if (inFlightController === controller) {
184
+ inFlightController = null;
185
+ }
186
+ }
187
+ if (!isActive) {
188
+ return;
189
+ }
190
+ if (isErrorResponse(response)) {
191
+ const statusCode = response.statusCode;
192
+ if (statusCode === 400 || statusCode === 429) {
193
+ handleRetryableError(response);
194
+ return;
195
+ }
196
+ finalize(response);
197
+ return;
198
+ }
199
+ handleSuccessResponse(normalizeSuccessResponse(response));
200
+ };
201
+ void tick();
202
+ return {
203
+ unsubscribe: () => {
204
+ finalize(undefined, false);
205
+ },
206
+ };
207
+ }
208
+ }
209
+ //# sourceMappingURL=AsyncToolChecker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncToolChecker.js","sourceRoot":"","sources":["../../../src/asyncToolChecker/AsyncToolChecker.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,kCAAkC,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAErE;;GAEG;AACH,MAAM,OAAO,gBAAgB;IACR,eAAe,CAAmB;IAEnD;;;;OAIG;IACH,YAAmB,OAAgC;QAC/C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IACnD,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,KAAK,CAAC,MAAmC;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC;YACzD,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,IAAI,EAAE,MAAM,CAAC,UAAU;SAC1B,CAAC,CAAC;QAEH,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACH,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,QAAQ;aAClB,CAAC;QACN,CAAC;QAED,OAAO;YACH,OAAO,EAAE,KAAK;YACd,QAAQ;SACX,CAAC;IACN,CAAC;IAED;;;;;;;;;;OAUG;IACI,SAAS,CACZ,MAAmC,EACnC,MAA4C,EAC5C,aAA4B;QAE5B,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC5D,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QACxE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,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BACZ,OAAO;gBACX,CAAC;gBAED,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;oBAC5B,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;oBAC3B,OAAO;gBACX,CAAC;gBAED,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAChB,OAAO;YACX,CAAC;oBAAS,CAAC;gBACP,IAAI,kBAAkB,KAAK,UAAU,EAAE,CAAC;oBACpC,kBAAkB,GAAG,IAAI,CAAC;gBAC9B,CAAC;YACL,CAAC;YAED,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACZ,OAAO;YACX,CAAC;YAED,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;gBAEvC,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC3C,oBAAoB,CAAC,QAAQ,CAAC,CAAC;oBAC/B,OAAO;gBACX,CAAC;gBAED,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACnB,OAAO;YACX,CAAC;YAED,qBAAqB,CACjB,wBAAwB,CAAC,QAAsD,CAAC,CACnF,CAAC;QACN,CAAC,CAAC;QAEF,KAAK,IAAI,EAAE,CAAC;QAEZ,OAAO;YACH,WAAW,EAAE,GAAS,EAAE;gBACpB,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YAC/B,CAAC;SACJ,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,23 @@
1
+ import type { LongPollingActionErrorResponse } from "@illalabs/interfaces";
2
+ /**
3
+ * Error emitted when the async tool checker exhausts the configured retry attempts for recoverable errors.
4
+ */
5
+ export declare class AsyncToolCheckerMaxRetriesExceeded extends Error {
6
+ /**
7
+ * Number of retry attempts that were configured.
8
+ */
9
+ readonly maxRetries: number;
10
+ /**
11
+ * Last error response received from the Core API.
12
+ */
13
+ readonly lastError: LongPollingActionErrorResponse;
14
+ /**
15
+ * Creates a new {@link AsyncToolCheckerMaxRetriesExceeded} instance.
16
+ *
17
+ * @param maxRetries Maximum number of retries allowed before failing.
18
+ * @param lastError Last error emitted by the Core API.
19
+ * @param options Error options.
20
+ */
21
+ constructor(maxRetries: number, lastError: LongPollingActionErrorResponse, options?: ErrorOptions);
22
+ }
23
+ //# sourceMappingURL=AsyncToolCheckerMaxRetriesExceeded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncToolCheckerMaxRetriesExceeded.d.ts","sourceRoot":"","sources":["../../../../src/asyncToolChecker/errors/AsyncToolCheckerMaxRetriesExceeded.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAE3E;;GAEG;AACH,qBAAa,kCAAmC,SAAQ,KAAK;IACzD;;OAEG;IACH,SAAgB,UAAU,EAAE,MAAM,CAAC;IAEnC;;OAEG;IACH,SAAgB,SAAS,EAAE,8BAA8B,CAAC;IAE1D;;;;;;OAMG;gBAEC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,8BAA8B,EACzC,OAAO,CAAC,EAAE,YAAY;CAU7B"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Error emitted when the async tool checker exhausts the configured retry attempts for recoverable errors.
3
+ */
4
+ export class AsyncToolCheckerMaxRetriesExceeded extends Error {
5
+ /**
6
+ * Number of retry attempts that were configured.
7
+ */
8
+ maxRetries;
9
+ /**
10
+ * Last error response received from the Core API.
11
+ */
12
+ lastError;
13
+ /**
14
+ * Creates a new {@link AsyncToolCheckerMaxRetriesExceeded} instance.
15
+ *
16
+ * @param maxRetries Maximum number of retries allowed before failing.
17
+ * @param lastError Last error emitted by the Core API.
18
+ * @param options Error options.
19
+ */
20
+ constructor(maxRetries, lastError, options) {
21
+ super(`Async tool checker exceeded maximum retry attempts (${maxRetries}).`, {
22
+ cause: lastError,
23
+ ...options,
24
+ });
25
+ this.name = "AsyncToolCheckerMaxRetriesExceeded";
26
+ this.maxRetries = maxRetries;
27
+ this.lastError = lastError;
28
+ }
29
+ }
30
+ //# sourceMappingURL=AsyncToolCheckerMaxRetriesExceeded.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncToolCheckerMaxRetriesExceeded.js","sourceRoot":"","sources":["../../../../src/asyncToolChecker/errors/AsyncToolCheckerMaxRetriesExceeded.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IACzD;;OAEG;IACa,UAAU,CAAS;IAEnC;;OAEG;IACa,SAAS,CAAiC;IAE1D;;;;;;OAMG;IACH,YACI,UAAkB,EAClB,SAAyC,EACzC,OAAsB;QAEtB,KAAK,CAAC,uDAAuD,UAAU,IAAI,EAAE;YACzE,KAAK,EAAE,SAAS;YAChB,GAAG,OAAO;SACb,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Error thrown when an {@link AsyncToolChecker} method is invoked prior to its implementation.
3
+ */
4
+ export declare class AsyncToolCheckerMethodNotImplemented extends Error {
5
+ /**
6
+ * Additional context useful for debugging the method invocation.
7
+ */
8
+ readonly context?: unknown;
9
+ /**
10
+ * Creates a new {@link AsyncToolCheckerMethodNotImplemented} instance.
11
+ *
12
+ * @param methodName Name of the method that is not implemented.
13
+ * @param context Optional contextual information describing the invocation.
14
+ */
15
+ constructor(methodName: string, context?: unknown);
16
+ }
17
+ //# sourceMappingURL=AsyncToolCheckerMethodNotImplemented.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncToolCheckerMethodNotImplemented.d.ts","sourceRoot":"","sources":["../../../../src/asyncToolChecker/errors/AsyncToolCheckerMethodNotImplemented.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,KAAK;IAC3D;;OAEG;IACH,SAAgB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElC;;;;;OAKG;gBACgB,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAU3D"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Error thrown when an {@link AsyncToolChecker} method is invoked prior to its implementation.
3
+ */
4
+ export class AsyncToolCheckerMethodNotImplemented extends Error {
5
+ /**
6
+ * Additional context useful for debugging the method invocation.
7
+ */
8
+ context;
9
+ /**
10
+ * Creates a new {@link AsyncToolCheckerMethodNotImplemented} instance.
11
+ *
12
+ * @param methodName Name of the method that is not implemented.
13
+ * @param context Optional contextual information describing the invocation.
14
+ */
15
+ constructor(methodName, context) {
16
+ super(`AsyncToolChecker method "${methodName}" is not implemented.`);
17
+ this.name = "AsyncToolCheckerMethodNotImplemented";
18
+ if (context !== undefined) {
19
+ Object.defineProperty(this, "context", {
20
+ value: context,
21
+ enumerable: true,
22
+ });
23
+ }
24
+ }
25
+ }
26
+ //# sourceMappingURL=AsyncToolCheckerMethodNotImplemented.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncToolCheckerMethodNotImplemented.js","sourceRoot":"","sources":["../../../../src/asyncToolChecker/errors/AsyncToolCheckerMethodNotImplemented.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,oCAAqC,SAAQ,KAAK;IAC3D;;OAEG;IACa,OAAO,CAAW;IAElC;;;;;OAKG;IACH,YAAmB,UAAkB,EAAE,OAAiB;QACpD,KAAK,CAAC,4BAA4B,UAAU,uBAAuB,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,GAAG,sCAAsC,CAAC;QACnD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE;gBACnC,KAAK,EAAE,OAAO;gBACd,UAAU,EAAE,IAAI;aACnB,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Error emitted when an asynchronous polling operation exceeds the configured maximum duration.
3
+ */
4
+ export declare class AsyncToolCheckerTimeout extends Error {
5
+ /**
6
+ * Maximum duration, expressed in seconds, that was exceeded.
7
+ */
8
+ readonly maxDuration: number;
9
+ /**
10
+ * Creates a new {@link AsyncToolCheckerTimeout} instance.
11
+ *
12
+ * @param maxDuration Maximum duration, in seconds, permitted for the polling loop.
13
+ * @param options Error options.
14
+ */
15
+ constructor(maxDuration: number, options?: ErrorOptions);
16
+ }
17
+ //# sourceMappingURL=AsyncToolCheckerTimeout.d.ts.map