@illalabs/sdk 0.3.3-canary.b7f69a88 → 0.4.0-canary.2110efe9

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 (45) hide show
  1. package/dist/src/chat/Chat.d.ts +6 -3
  2. package/dist/src/chat/Chat.d.ts.map +1 -1
  3. package/dist/src/chat/Chat.js +73 -22
  4. package/dist/src/chat/Chat.js.map +1 -1
  5. package/dist/src/chat/errors/ChatInvalidMultiplePromptsKind.d.ts +22 -0
  6. package/dist/src/chat/errors/ChatInvalidMultiplePromptsKind.d.ts.map +1 -0
  7. package/dist/src/chat/errors/ChatInvalidMultiplePromptsKind.js +31 -0
  8. package/dist/src/chat/errors/ChatInvalidMultiplePromptsKind.js.map +1 -0
  9. package/dist/src/chat/errors/ChatInvalidPromptSnapshot.d.ts +19 -0
  10. package/dist/src/chat/errors/ChatInvalidPromptSnapshot.d.ts.map +1 -0
  11. package/dist/src/chat/errors/ChatInvalidPromptSnapshot.js +28 -0
  12. package/dist/src/chat/errors/ChatInvalidPromptSnapshot.js.map +1 -0
  13. package/dist/src/chat/errors/ChatInvalidSinglePromptKind.d.ts +22 -0
  14. package/dist/src/chat/errors/ChatInvalidSinglePromptKind.d.ts.map +1 -0
  15. package/dist/src/chat/errors/ChatInvalidSinglePromptKind.js +31 -0
  16. package/dist/src/chat/errors/ChatInvalidSinglePromptKind.js.map +1 -0
  17. package/dist/src/chat/errors/index.d.ts +3 -0
  18. package/dist/src/chat/errors/index.d.ts.map +1 -1
  19. package/dist/src/chat/errors/index.js +3 -0
  20. package/dist/src/chat/errors/index.js.map +1 -1
  21. package/dist/src/chat/utils/prompt.d.ts +3 -0
  22. package/dist/src/chat/utils/prompt.d.ts.map +1 -0
  23. package/dist/src/chat/utils/prompt.js +6 -0
  24. package/dist/src/chat/utils/prompt.js.map +1 -0
  25. package/dist/src/context/ContextManager.d.ts +2 -0
  26. package/dist/src/context/ContextManager.d.ts.map +1 -1
  27. package/dist/src/context/ContextManager.js +7 -0
  28. package/dist/src/context/ContextManager.js.map +1 -1
  29. package/dist/src/errors/SdkEmptyToolsResultsError.d.ts +19 -0
  30. package/dist/src/errors/SdkEmptyToolsResultsError.d.ts.map +1 -0
  31. package/dist/src/errors/SdkEmptyToolsResultsError.js +28 -0
  32. package/dist/src/errors/SdkEmptyToolsResultsError.js.map +1 -0
  33. package/dist/src/interfaces/chat.interface.d.ts +3 -2
  34. package/dist/src/interfaces/chat.interface.d.ts.map +1 -1
  35. package/dist/src/interfaces/contextManager.interface.d.ts +7 -1
  36. package/dist/src/interfaces/contextManager.interface.d.ts.map +1 -1
  37. package/dist/src/sdk.d.ts +226 -13
  38. package/dist/src/sdk.d.ts.map +1 -1
  39. package/dist/src/sdk.js +288 -15
  40. package/dist/src/sdk.js.map +1 -1
  41. package/package.json +2 -2
  42. package/dist/src/chat/errors/ChatInvalidModelContext.d.ts +0 -15
  43. package/dist/src/chat/errors/ChatInvalidModelContext.d.ts.map +0 -1
  44. package/dist/src/chat/errors/ChatInvalidModelContext.js +0 -24
  45. package/dist/src/chat/errors/ChatInvalidModelContext.js.map +0 -1
package/dist/src/sdk.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { normalizePrompt } from "./chat/utils/prompt.js";
2
+ import { SdkEmptyToolsResultsError } from "./errors/SdkEmptyToolsResultsError.js";
1
3
  import { AsyncToolChecker, Chat, ContextManager, CoreApiProvider, InMemoryCache, Prompt, UserContextMissing, } from "./internal.js";
2
4
  /**
3
5
  * Error raised when attempting to interact with a chat that doesn't exist.
@@ -77,9 +79,13 @@ class IllaSDK {
77
79
  constructor(config, options) {
78
80
  this.coreApiProvider = new CoreApiProvider({
79
81
  baseURL: config.baseURL,
82
+ timeout: config.timeout,
80
83
  headers: {
81
84
  "x-api-key": config.apiKey,
85
+ ...config.headers,
82
86
  },
87
+ httpClientFactory: config.httpClientFactory,
88
+ routes: config.routes,
83
89
  });
84
90
  if (options && options.contextManager) {
85
91
  this.contextManager = options.contextManager;
@@ -164,6 +170,7 @@ class IllaSDK {
164
170
  coreApiProvider: this.coreApiProvider,
165
171
  }),
166
172
  personalityContext: options.personalityContext,
173
+ modelContext: options.modelContext,
167
174
  });
168
175
  this.chats.set(chat.getId(), chat);
169
176
  return chat;
@@ -173,15 +180,16 @@ class IllaSDK {
173
180
  * If a chatId is provided, the message will be sent to the existing chat.
174
181
  * If a chatId is not provided, a new chat will be created with the provided userContext.
175
182
  *
176
- * @param msg - The message text to send
183
+ * @param msg - The message to send (can be a string or Prompt object)
177
184
  * @param context - Context containing either chatId for existing chat or userContext for new chat
185
+ * @param chatOptions - Optional chat configuration when creating a new chat
178
186
  * @returns {Promise<SendMessageResult>} The AI's response including chat ID, response text, and any pending tools
179
187
  *
180
188
  * @example
181
189
  * ```typescript
182
190
  * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
183
191
  *
184
- * // Start a new conversation
192
+ * // Start a new conversation with a string
185
193
  * const result1 = await sdk.sendMessage(
186
194
  * "What can you help me with?",
187
195
  * { userContext: { address: "0x1234..." } }
@@ -189,11 +197,9 @@ class IllaSDK {
189
197
  * console.log(result1.response.text);
190
198
  * console.log("Chat ID:", result1.chatId);
191
199
  *
192
- * // Continue the conversation using the chat ID
193
- * const result2 = await sdk.sendMessage(
194
- * "I want to swap 1 ETH for USDC on Base",
195
- * { chatId: result1.chatId }
196
- * );
200
+ * // Continue the conversation with a Prompt object
201
+ * const prompt = new Prompt({ text: "I want to swap 1 ETH for USDC on Base" });
202
+ * const result2 = await sdk.sendMessage(prompt, { chatId: result1.chatId });
197
203
  *
198
204
  * // Check if there are tools to execute
199
205
  * if (result2.response.pendingTools && result2.response.pendingTools.length > 0) {
@@ -201,16 +207,32 @@ class IllaSDK {
201
207
  * }
202
208
  * ```
203
209
  */
204
- sendMessage(msg, context) {
205
- if (context.chatId && this.chats.get(context.chatId) !== undefined) {
206
- return this.chats.get(context.chatId).sendMessage(new Prompt({ text: msg }));
210
+ sendMessage(msg, context, chatOptions) {
211
+ const prompt = normalizePrompt(msg);
212
+ const chat = this.getOrCreateChat(context, chatOptions);
213
+ return chat.sendMessage(prompt);
214
+ }
215
+ /**
216
+ * Gets an existing chat or creates a new one if it doesn't exist.
217
+ *
218
+ * @param context - Context containing either chatId for existing chat or userContext for new chat
219
+ * @param chatOptions - Optional chat configuration when creating a new chat
220
+ * @returns {Chat} The chat instance
221
+ */
222
+ getOrCreateChat(context, chatOptions) {
223
+ if (context.chatId) {
224
+ const existingChat = this.chats.get(context.chatId);
225
+ if (existingChat) {
226
+ return existingChat;
227
+ }
207
228
  }
229
+ // If no chatId is provided, create a new chat
208
230
  if (!context.userContext) {
209
231
  throw new UserContextMissing();
210
232
  }
211
- const chat = this.createChat({ userContext: context.userContext });
233
+ const chat = this.createChat({ userContext: context.userContext, ...chatOptions });
212
234
  this.chats.set(chat.getId(), chat);
213
- return chat.sendMessage(new Prompt({ text: msg }));
235
+ return chat;
214
236
  }
215
237
  /**
216
238
  * Sends the result of a tool execution back to the AI. This method is used to complete
@@ -219,7 +241,7 @@ class IllaSDK {
219
241
  * @param chatId - The ID of the chat to send the tool result to
220
242
  * @param toolResult - The result of the tool execution
221
243
  * @returns {Promise<SendMessageResult>} The AI's response after processing the tool result
222
- * @throws {Error} If the chat with the specified chatId is not found
244
+ * @throws {ChatNotFound} If the chat with the specified chatId is not found
223
245
  *
224
246
  * @example
225
247
  * ```typescript
@@ -252,10 +274,10 @@ class IllaSDK {
252
274
  * ```
253
275
  */
254
276
  async sendToolResult(chatId, toolResult) {
255
- if (this.chats.get(chatId) === undefined) {
277
+ if (!this.chats.has(chatId)) {
256
278
  throw new ChatNotFound(chatId);
257
279
  }
258
- return await this.chats.get(chatId).sendMessage(new Prompt({ toolResult }));
280
+ return this.chats.get(chatId).sendMessage(new Prompt({ toolResult }));
259
281
  }
260
282
  /**
261
283
  * Gets the messages for a given chat ID.
@@ -271,6 +293,257 @@ class IllaSDK {
271
293
  }
272
294
  return chat.messages;
273
295
  }
296
+ /**
297
+ * Appends messages to an existing chat's message history.
298
+ *
299
+ * @param chatId - The ID of the chat to append messages to
300
+ * @param messages - The messages to append to the chat history
301
+ * @throws {ChatNotFound} If the chat with the specified chatId is not found
302
+ *
303
+ * @example
304
+ * ```typescript
305
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
306
+ *
307
+ * // Append synthetic messages for testing or prompting
308
+ * await sdk.appendMessages(chatId, [
309
+ * { role: "user", content: "Previous context..." },
310
+ * { role: "assistant", content: "Understood..." }
311
+ * ]);
312
+ * ```
313
+ */
314
+ async appendMessages(chatId, messages) {
315
+ if (!this.chats.has(chatId)) {
316
+ throw new ChatNotFound(chatId);
317
+ }
318
+ await this.contextManager.appendMessages(chatId, messages);
319
+ }
320
+ /**
321
+ * Clears the message history for a chat while keeping the chat instance.
322
+ *
323
+ * @param chatId - The ID of the chat to clear
324
+ * @throws {ChatNotFound} If the chat with the specified chatId is not found
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
329
+ *
330
+ * // Clear chat history to start fresh
331
+ * await sdk.clearContext(chatId);
332
+ * ```
333
+ */
334
+ async clearContext(chatId) {
335
+ if (!this.chats.has(chatId)) {
336
+ throw new ChatNotFound(chatId);
337
+ }
338
+ await this.contextManager.clearContext(chatId);
339
+ }
340
+ /**
341
+ * Deletes a chat and removes all associated data.
342
+ *
343
+ * @param chatId - The ID of the chat to delete
344
+ * @throws {ChatNotFound} If the chat with the specified chatId is not found
345
+ *
346
+ * @example
347
+ * ```typescript
348
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
349
+ *
350
+ * // Clean up chat when done
351
+ * await sdk.deleteChat(chatId);
352
+ * ```
353
+ */
354
+ async deleteChat(chatId) {
355
+ if (!this.chats.has(chatId)) {
356
+ throw new ChatNotFound(chatId);
357
+ }
358
+ await this.contextManager.deleteContext(chatId);
359
+ this.chats.delete(chatId);
360
+ }
361
+ /**
362
+ * Sends multiple tool results back to the AI in a single request.
363
+ * This method is used when multiple tools need to be executed and their results
364
+ * sent back together.
365
+ *
366
+ * @param chatId - The ID of the chat to send the tool results to
367
+ * @param toolResults - Array of tool execution results
368
+ * @param options - Optional parameters including AbortSignal
369
+ * @returns {Promise<SendMessageResult>} The AI's response after processing all tool results
370
+ * @throws {ChatNotFound} If the chat with the specified chatId is not found
371
+ *
372
+ * @example
373
+ * ```typescript
374
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
375
+ *
376
+ * // Execute multiple tools and send results together
377
+ * const toolResults: ToolResultType[] = pendingTools.map(tool => ({
378
+ * toolCallId: tool.toolCallId,
379
+ * toolName: tool.toolName,
380
+ * result: executeToolSync(tool),
381
+ * }));
382
+ *
383
+ * const response = await sdk.sendToolResults(chatId, toolResults);
384
+ * ```
385
+ */
386
+ async sendToolResults(chatId, toolResults) {
387
+ if (!this.chats.has(chatId)) {
388
+ throw new ChatNotFound(chatId);
389
+ }
390
+ if (toolResults.length === 0) {
391
+ throw new SdkEmptyToolsResultsError({ chatId });
392
+ }
393
+ const chat = this.chats.get(chatId);
394
+ return await chat.sendMessage(toolResults.map((toolResult) => new Prompt({ toolResult })));
395
+ }
396
+ /**
397
+ * Subscribes to status updates for a long-running tool execution.
398
+ *
399
+ * @param params - Parameters identifying the tool execution to monitor
400
+ * @param callbacks - Event handlers for status changes and errors
401
+ * @param config - Optional polling configuration
402
+ * @returns {EventSubscription} Subscription handle to cancel monitoring
403
+ *
404
+ * @example
405
+ * ```typescript
406
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
407
+ *
408
+ * const subscription = sdk.subscribeToToolStatus(
409
+ * { toolName: "swap", protocol: "li.fi", args: txHash },
410
+ * {
411
+ * onStatusChange: (event) => console.log("Status:", event.status),
412
+ * onError: (error) => console.error("Error:", error)
413
+ * },
414
+ * { interval: 2000, maxDuration: 300, maxRetries: 3 }
415
+ * );
416
+ *
417
+ * // Later, cancel the subscription
418
+ * subscription.unsubscribe();
419
+ * ```
420
+ */
421
+ subscribeToToolStatus(params, callbacks, config) {
422
+ const asyncToolChecker = new AsyncToolChecker({
423
+ coreApiProvider: this.coreApiProvider,
424
+ });
425
+ const defaultConfig = {
426
+ interval: config?.interval ?? 5000,
427
+ maxDuration: config?.maxDuration ?? 300,
428
+ retryThreshold: config?.retryThreshold ?? 30000,
429
+ maxRetries: config?.maxRetries ?? 3,
430
+ };
431
+ return asyncToolChecker.subscribe(params, callbacks, defaultConfig);
432
+ }
433
+ /**
434
+ * Awaits the completion of a long-running action triggered by a chat.
435
+ *
436
+ * @param chatId - The ID of the chat that triggered the action
437
+ * @param descriptor - Descriptor identifying the action to track
438
+ * @returns {Promise<AwaitActionResult>} The final status of the action
439
+ * @throws {ChatNotFound} If the chat with the specified chatId is not found
440
+ *
441
+ * @example
442
+ * ```typescript
443
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
444
+ *
445
+ * const result = await sdk.awaitAction(chatId, {
446
+ * toolName: "swap",
447
+ * protocol: "li.fi",
448
+ * args: { txHash: "0x..." }
449
+ * });
450
+ *
451
+ * if (result.isError) {
452
+ * console.error("Action failed:", result.error);
453
+ * } else {
454
+ * console.log("Action completed:", result.response);
455
+ * }
456
+ * ```
457
+ */
458
+ async awaitAction(chatId, descriptor) {
459
+ const chat = this.chats.get(chatId);
460
+ if (!chat) {
461
+ throw new ChatNotFound(chatId);
462
+ }
463
+ return chat.awaitAction(descriptor);
464
+ }
465
+ /**
466
+ * Gets the underlying Chat instance for advanced operations.
467
+ *
468
+ * @param chatId - The ID of the chat to retrieve
469
+ * @returns {Chat} The Chat instance
470
+ * @throws {ChatNotFound} If the chat with the specified chatId is not found
471
+ *
472
+ * @example
473
+ * ```typescript
474
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
475
+ *
476
+ * const chat = sdk.getChat(chatId);
477
+ * // Now you can use advanced Chat methods directly
478
+ * const context = await chat.getContext();
479
+ * ```
480
+ */
481
+ getChat(chatId) {
482
+ const chat = this.chats.get(chatId);
483
+ if (!chat) {
484
+ throw new ChatNotFound(chatId);
485
+ }
486
+ return chat;
487
+ }
488
+ /**
489
+ * Gets all active chat IDs as an array.
490
+ * Alias for the chatIds getter property.
491
+ *
492
+ * @returns {string[]} Array of active chat IDs
493
+ *
494
+ * @example
495
+ * ```typescript
496
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
497
+ *
498
+ * const ids = sdk.getChatIds();
499
+ * console.log("Active chats:", ids);
500
+ * ```
501
+ */
502
+ getChatIds() {
503
+ return this.chatIds;
504
+ }
505
+ /**
506
+ * Helper method to extract detailed response metadata from a SendMessageResult.
507
+ * Provides access to incompleteTools, toolErrors, and other response details.
508
+ *
509
+ * @param result - The SendMessageResult to extract metadata from
510
+ * @returns {ResponseMetadata} Extracted response metadata
511
+ *
512
+ * @example
513
+ * ```typescript
514
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
515
+ *
516
+ * const result = await sdk.sendMessage("Hello", { chatId });
517
+ * const metadata = sdk.getResponseMetadata(result);
518
+ *
519
+ * if (metadata.incompleteTools?.length > 0) {
520
+ * console.log("Incomplete tools:", metadata.incompleteTools);
521
+ * }
522
+ * if (metadata.toolErrors?.length > 0) {
523
+ * console.log("Tool errors:", metadata.toolErrors);
524
+ * }
525
+ * ```
526
+ */
527
+ getResponseMetadata(result) {
528
+ if (result.response.isError) {
529
+ return {
530
+ isError: true,
531
+ error: result.response.error,
532
+ };
533
+ }
534
+ const data = result.response.data;
535
+ return {
536
+ isError: false,
537
+ text: data.text,
538
+ messages: data.messages,
539
+ pendingTools: data.pendingTools,
540
+ incompleteTools: data.incompleteTools,
541
+ toolErrors: data.toolErrors,
542
+ };
543
+ }
544
+ isSuccessResponse(response) {
545
+ return "status" in response && response.status === 200;
546
+ }
274
547
  }
275
548
  /**
276
549
  * Exports the public API of the SDK.
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAeA,OAAO,EACH,gBAAgB,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AAO,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@illalabs/sdk",
3
- "version": "0.3.3-canary.b7f69a88",
3
+ "version": "0.4.0-canary.2110efe9",
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.3.0-canary.b7f69a88"
26
+ "@illalabs/interfaces": "0.3.0-canary.2110efe9"
27
27
  },
28
28
  "devDependencies": {
29
29
  "zod": "4.1.12"
@@ -1,15 +0,0 @@
1
- /**
2
- * Error emitted when attempting to create a chat with an invalid model context.
3
- *
4
- * The error may include a `context` property with additional debugging information
5
- * such as the `modelContext` that was invalid.
6
- */
7
- export declare class ChatInvalidModelContext extends Error {
8
- /**
9
- * Creates a new {@link ChatInvalidModelContext} instance.
10
- *
11
- * @param context Additional context useful for debugging, e.g. `{ modelContext: unknown }`.
12
- */
13
- constructor(context?: unknown);
14
- }
15
- //# sourceMappingURL=ChatInvalidModelContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatInvalidModelContext.d.ts","sourceRoot":"","sources":["../../../../src/chat/errors/ChatInvalidModelContext.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAC9C;;;;OAIG;gBACgB,OAAO,CAAC,EAAE,OAAO;CAUvC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * Error emitted when attempting to create a chat with an invalid model context.
3
- *
4
- * The error may include a `context` property with additional debugging information
5
- * such as the `modelContext` that was invalid.
6
- */
7
- export class ChatInvalidModelContext extends Error {
8
- /**
9
- * Creates a new {@link ChatInvalidModelContext} instance.
10
- *
11
- * @param context Additional context useful for debugging, e.g. `{ modelContext: unknown }`.
12
- */
13
- constructor(context) {
14
- super("Invalid model context.");
15
- this.name = "ChatInvalidModelContext";
16
- if (context !== undefined) {
17
- Object.defineProperty(this, "context", {
18
- value: context,
19
- enumerable: true,
20
- });
21
- }
22
- }
23
- }
24
- //# sourceMappingURL=ChatInvalidModelContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatInvalidModelContext.js","sourceRoot":"","sources":["../../../../src/chat/errors/ChatInvalidModelContext.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC9C;;;;OAIG;IACH,YAAmB,OAAiB;QAChC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,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"}