@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
@@ -1 +1 @@
1
- {"version":3,"file":"CoreApiProvider.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIxE;;GAEG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;IACpD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAEzC;;OAEG;gBACS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,qBAAqB;IAcnF;;OAEG;IACU,WAAW,CACpB,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAChC,OAAO,GAAE,cAAmB,GAC7B,OAAO,CAAC,mBAAmB,CAAC;IAsB/B;;OAEG;IACU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gB,CACzB,MAAM,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAC1C,OAAO,GAAE,cAAmB,GAC7B,OAAO,CAAC,yBAAyB,CAAC;IAuBrC,kBAAkB;IACX,SAAS,IAAI,QAAQ,CAAC,qBAAqB,CAAC;IAInD;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE;IAM/E,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,iBAAiB;CAO5B"}
@@ -1,4 +1,5 @@
1
1
  import axios from "axios";
2
+ import { AsyncToolCheckerErrorHandler, ChatErrorHandler } from "./CoreApiErrorHandler.js";
2
3
  import { CoreApiAuthenticationMissing } from "./errors/index.js";
3
4
  /**
4
5
  * Axios based Core API provider implementation
@@ -8,10 +9,14 @@ export class CoreApiProvider {
8
9
  * Axios instance configured for the Core API
9
10
  */
10
11
  client;
12
+ /**
13
+ * Routes used by the provider when issuing requests.
14
+ */
15
+ routes;
11
16
  /**
12
17
  * @param config Core API provider configuration
13
18
  */
14
- constructor({ baseURL, timeout, headers, httpClientFactory }) {
19
+ constructor({ baseURL, timeout, headers, httpClientFactory, routes }) {
15
20
  const authHeaders = this.ensureAuthHeaders(headers);
16
21
  const resolveClientFactory = httpClientFactory ??
17
22
  ((configuration) => axios.create(configuration));
@@ -20,51 +25,49 @@ export class CoreApiProvider {
20
25
  timeout,
21
26
  headers: this.buildDefaultHeaders(authHeaders),
22
27
  });
28
+ this.routes = {
29
+ chat: routes?.chat ?? "/api/v1/chat/",
30
+ actionStatus: routes?.actionStatus ?? "/api/v1/actions/check",
31
+ };
23
32
  }
24
33
  /**
25
34
  * Sends a chat message to the Core API
26
35
  */
27
36
  async sendMessage(body, options = {}) {
28
37
  const requestConfig = this.buildRequestConfig(options);
29
- const response = await this.client.post("/api/v1/chat", body, requestConfig);
30
- return response.data;
31
- //TODO: Handle errors
32
- // try{
33
- // this.client.post<CoreApiChatSuccessResponse>(...);
34
- // return response.data;
35
- // }
36
- // catch(error){
37
- // All errors will end up here because Axios throws for 4XX and 5XX status codes
38
- // if (error instanceof AxiosError) {
39
- // const errorResponse: CoreApiChatErrorResponse = ChatErrorHandler.handle(error);
40
- // return errorResponse;
41
- // }
38
+ try {
39
+ const response = await this.client.post(this.routes.chat, body, requestConfig);
40
+ return response.data;
41
+ }
42
+ catch (error) {
43
+ const errorResponse = ChatErrorHandler.handle(error);
44
+ return errorResponse;
45
+ }
42
46
  }
43
47
  /**
44
48
  * Polls the Core API for transaction status
45
49
  */
46
50
  async awaitTransaction(params, options = {}) {
47
51
  const requestConfig = this.buildRequestConfig(options);
48
- const response = await this.client.get("/api/v1/actions/check", {
49
- ...requestConfig,
50
- params: {
51
- toolName: params.toolName,
52
- protocol: params.protocol,
53
- args: params.args,
54
- },
55
- });
56
- return response.data;
57
- //TODO: Handle errors
58
- // try{
59
- // this.client.get<LongPollingActionSuccessResponse>(...);
60
- // return response.data;
61
- // }
62
- // catch(error){
63
- // All errors will end up here because Axios throws for 4XX and 5XX status codes
64
- // if (error instanceof AxiosError) {
65
- // const errorResponse: LongPollingActionErrorResponse = ExecutionCheckerErrorHandler.handle(error);
66
- // return errorResponse;
67
- // }
52
+ try {
53
+ const response = await this.client.get(this.routes.actionStatus, {
54
+ ...requestConfig,
55
+ params: {
56
+ toolName: params.toolName,
57
+ protocol: params.protocol,
58
+ args: params.args,
59
+ },
60
+ });
61
+ return response.data;
62
+ }
63
+ catch (error) {
64
+ const errorResponse = AsyncToolCheckerErrorHandler.handle(error);
65
+ return errorResponse;
66
+ }
67
+ }
68
+ /** @inheritdoc */
69
+ getRoutes() {
70
+ return this.routes;
68
71
  }
69
72
  /**
70
73
  * Builds request configuration shared across endpoints
@@ -75,7 +78,8 @@ export class CoreApiProvider {
75
78
  };
76
79
  }
77
80
  resolveBaseUrl(baseURL) {
78
- return baseURL ?? "https://app.illa.network";
81
+ // TODO: update base URL depending on final deployment
82
+ return baseURL ?? "https://api-dev.illalabs.io";
79
83
  }
80
84
  buildDefaultHeaders(headers) {
81
85
  return {
@@ -84,7 +88,7 @@ export class CoreApiProvider {
84
88
  };
85
89
  }
86
90
  ensureAuthHeaders(headers) {
87
- if (headers?.["x-auth-token"] === undefined) {
91
+ if (headers?.["x-api-key"] === undefined) {
88
92
  throw new CoreApiAuthenticationMissing();
89
93
  }
90
94
  return headers;
@@ -1 +1 @@
1
- {"version":3,"file":"CoreApiProvider.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiProvider.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;GAEG;AACH,MAAM,OAAO,eAAe;IACxB;;OAEG;IACgB,MAAM,CAAgB;IAEzC;;OAEG;IACH,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAyB;QAC/E,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEpD,MAAM,oBAAoB,GACtB,iBAAiB;YACjB,CAAC,CAAC,aAAkC,EAAiB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAEzF,IAAI,CAAC,MAAM,GAAG,oBAAoB,CAAC;YAC/B,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;YACrC,OAAO;YACP,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC;SACjD,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAAW,CACpB,IAAgC,EAChC,UAA0B,EAAE;QAE5B,MAAM,aAAa,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACnC,c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AAC;IAEO,mBAAmB,CAAC,OAA2B;QACnD,OAAO;YACH,cAAc,EAAE,kBAAkB;YAClC,GAAG,OAAO;SACb,CAAC;IACN,CAAC;IAEO,iBAAiB,CAAC,OAA4B;QAClD,IAAI,OAAO,EAAE,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,IAAI,4BAA4B,EAAE,CAAC;QAC7C,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Raised when the authentication token is not provided
2
+ * Raised when the API key is not provided
3
3
  */
4
- export declare class CoreApiAuthenticationMissing {
4
+ export declare class CoreApiAuthenticationMissing extends Error {
5
5
  readonly statusCode = 401;
6
- readonly name: string;
7
- readonly message: string;
8
6
  constructor();
9
7
  }
10
8
  //# sourceMappingURL=CoreApiAuthenticationMissing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoreApiAuthenticationMissing.d.ts","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,4BAA4B;IACrC,SAAgB,UAAU,OAAO;IACjC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,EAAE,MAAM,CAAC;;CAMnC"}
1
+ {"version":3,"file":"CoreApiAuthenticationMissing.d.ts","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACnD,SAAgB,UAAU,OAAO;;CAWpC"}
@@ -1,14 +1,15 @@
1
1
  /**
2
- * Raised when the authentication token is not provided
2
+ * Raised when the API key is not provided
3
3
  */
4
- export class CoreApiAuthenticationMissing {
4
+ export class CoreApiAuthenticationMissing extends Error {
5
5
  statusCode = 401;
6
- name;
7
- message;
8
6
  constructor() {
9
- this.statusCode = 401;
7
+ const message = "Core API key is required";
8
+ super(message);
10
9
  this.name = "CoreApiAuthenticationMissing";
11
- this.message = "Core API authentication token is required";
10
+ if (Error.captureStackTrace) {
11
+ Error.captureStackTrace(this, CoreApiAuthenticationMissing);
12
+ }
12
13
  }
13
14
  }
14
15
  //# sourceMappingURL=CoreApiAuthenticationMissing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoreApiAuthenticationMissing.js","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,4BAA4B;IACrB,UAAU,GAAG,GAAG,CAAC;IACjB,IAAI,CAAS;IACb,OAAO,CAAS;IAChC;QACI,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,2CAA2C,CAAC;IAC/D,CAAC;CACJ"}
1
+ {"version":3,"file":"CoreApiAuthenticationMissing.js","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACnC,UAAU,GAAG,GAAG,CAAC;IAEjC;QACI,MAAM,OAAO,GAAG,0BAA0B,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;QAE3C,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC1B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;QAChE,CAAC;IACL,CAAC;CACJ"}
@@ -1,7 +1,6 @@
1
1
  export * from "./CoreApiProvider.js";
2
2
  export type { ICoreApiProvider } from "../../interfaces/index.js";
3
- export type { CoreApiProviderConfig } from "./CoreApiProviderConfig.js";
4
- export type { HttpClientFactory } from "./types.js";
5
- export type { RequestOptions } from "./RequestOptions.js";
3
+ export type { CoreApiProviderConfig, CoreApiProviderRoutes } from "./interfaces/index.js";
4
+ export type { HttpClientFactory, RequestOptions } from "./types.js";
6
5
  export * from "./errors/index.js";
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACpE,cAAc,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AAKrC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AAIrC,cAAc,mBAAmB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { CoreApiAuthHeaders } from "@illalabs/interfaces";
2
- import type { HttpClientFactory } from "./types.js";
2
+ import type { HttpClientFactory } from "../types.js";
3
+ import type { CoreApiProviderRoutes } from "./CoreApiProviderRoutes.interface.js";
3
4
  /**
4
5
  * Core API provider configuration
5
6
  */
@@ -20,5 +21,9 @@ export interface CoreApiProviderConfig {
20
21
  * Optional factory used to create a configured axios instance. Primarily used for testing.
21
22
  */
22
23
  readonly httpClientFactory?: HttpClientFactory;
24
+ /**
25
+ * Optional overrides for API routes used by the provider.
26
+ */
27
+ readonly routes?: CoreApiProviderRoutes;
23
28
  }
24
- //# sourceMappingURL=CoreApiProviderConfig.d.ts.map
29
+ //# sourceMappingURL=CoreApiProviderConfig.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoreApiProviderConfig.interface.d.ts","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAE/C;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAC3C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CoreApiProviderConfig.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoreApiProviderConfig.interface.js","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Optional route overrides used by the {@link CoreApiProvider}.
3
+ */
4
+ export interface CoreApiProviderRoutes {
5
+ /**
6
+ * Path used when sending chat requests. Defaults to `/api/v1/chat/`.
7
+ */
8
+ readonly chat?: string;
9
+ /**
10
+ * Path used when polling asynchronous tool executions. Defaults to `/api/v1/actions/check`.
11
+ */
12
+ readonly actionStatus?: string;
13
+ }
14
+ //# sourceMappingURL=CoreApiProviderRoutes.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoreApiProviderRoutes.interface.d.ts","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAClC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CoreApiProviderRoutes.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoreApiProviderRoutes.interface.js","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export type { CoreApiProviderRoutes } from "./CoreApiProviderRoutes.interface.js";
2
+ export type { CoreApiProviderConfig } from "./CoreApiProviderConfig.interface.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/interfaces/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/interfaces/index.ts"],"names":[],"mappings":""}
@@ -4,4 +4,13 @@ import type { AxiosInstance, AxiosRequestConfig } from "axios";
4
4
  * Kept separate to enable reuse in tests and other providers.
5
5
  */
6
6
  export type HttpClientFactory = (config?: AxiosRequestConfig) => AxiosInstance;
7
+ /**
8
+ * Options for Core API requests
9
+ */
10
+ export interface RequestOptions {
11
+ /**
12
+ * Abort signal used to cancel the request
13
+ */
14
+ readonly signal?: AbortSignal;
15
+ }
7
16
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,CAAC,EAAE,kBAAkB,KAAK,aAAa,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE/D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,CAAC,EAAE,kBAAkB,KAAK,aAAa,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CACjC"}
@@ -0,0 +1,288 @@
1
+ import type { MessageHistoryType, ToolResultType, UserContext } from "@illalabs/interfaces";
2
+ import type { CacheEntryOptions, ChatContextSnapshot, ContextManagerOptions, ICache, IContextManager, SendMessageResult } from "./internal.js";
3
+ import { Chat, ContextManager } from "./internal.js";
4
+ /**
5
+ * Configuration options for initializing the IllaSDK.
6
+ *
7
+ * @property apiKey - Your ILLA API key for authentication
8
+ * @property baseURL - Optional custom base URL for the ILLA API (defaults to production API)
9
+ */
10
+ type illaSDKConfig = {
11
+ apiKey: string;
12
+ baseURL?: string;
13
+ };
14
+ /**
15
+ * Optional configuration for the IllaSDK instance.
16
+ * You can either provide a custom cache and context manager options,
17
+ * or provide a complete custom context manager implementation.
18
+ *
19
+ * @property cache - Optional custom cache implementation (used with contextManagerOptions)
20
+ * @property contextManagerOptions - Optional configuration for the default context manager
21
+ * @property contextManager - Optional custom context manager implementation (mutually exclusive with cache/contextManagerOptions)
22
+ */
23
+ type illaSDKOptions = {
24
+ cache?: ICache;
25
+ contextManagerOptions?: ContextManagerOptions;
26
+ contextManager?: never;
27
+ } | {
28
+ contextManager: IContextManager;
29
+ cache?: never;
30
+ contextManagerOptions?: never;
31
+ };
32
+ /**
33
+ * Options for creating a new chat instance.
34
+ *
35
+ * @property userContext - The user's context information { address: `0x${string}` }
36
+ * @property id - Optional custom ID for the chat. If not provided, a UUID will be generated
37
+ */
38
+ type ChatOptions = {
39
+ userContext: UserContext;
40
+ id?: string;
41
+ };
42
+ /**
43
+ * Context for sending a message. Requires either a chatId (to use an existing chat)
44
+ * or a userContext (to create a new chat).
45
+ *
46
+ * @property chatId - ID of an existing chat to send the message to
47
+ * @property userContext - User context for creating a new chat (required if chatId is not provided)
48
+ */
49
+ type SendMessageContext = {
50
+ chatId: string;
51
+ userContext?: never;
52
+ } | {
53
+ chatId?: never;
54
+ userContext: UserContext;
55
+ };
56
+ /**
57
+ * Error raised when attempting to interact with a chat that doesn't exist.
58
+ *
59
+ * This typically occurs when using an invalid or expired chat ID with methods
60
+ * like {@link IllaSDK.sendToolResult}.
61
+ */
62
+ declare class ChatNotFound extends Error {
63
+ /**
64
+ * The ID of the chat that was not found.
65
+ */
66
+ readonly chatId: string;
67
+ /**
68
+ * Creates a new {@link ChatNotFound} instance.
69
+ *
70
+ * @param chatId The ID of the chat that was not found.
71
+ * @param options Error options for error chaining.
72
+ */
73
+ constructor(chatId: string, options?: ErrorOptions);
74
+ }
75
+ /**
76
+ * The main entry point for interacting with the ILLA AI SDK.
77
+ * This class provides methods for creating and managing chat sessions,
78
+ * sending messages, handling tool results, and configuring async tool checkers.
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * import { IllaSDK } from '@illalabs/sdk';
83
+ *
84
+ * const sdk = new IllaSDK({
85
+ * apiKey: 'your-api-key'
86
+ * });
87
+ *
88
+ * // Start a conversation
89
+ * const result = await sdk.sendMessage(
90
+ * "What can you help me with?",
91
+ * { userContext: { address: "0x1234..." } }
92
+ * );
93
+ *
94
+ * console.log(result.response.text);
95
+ * ```
96
+ */
97
+ declare class IllaSDK {
98
+ private coreApiProvider;
99
+ private contextManager;
100
+ private chats;
101
+ /**
102
+ * Creates a new instance of the IllaSDK.
103
+ *
104
+ * @param config - Configuration object containing API key and optional base URL
105
+ * @param options - Optional configuration for cache and context manager
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * // Basic initialization
110
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
111
+ *
112
+ * // With custom cache
113
+ * const cache = new InMemoryCache();
114
+ * const sdk = new IllaSDK(
115
+ * { apiKey: 'your-api-key' },
116
+ * { cache }
117
+ * );
118
+ *
119
+ * // With custom context manager
120
+ * const contextManager = new ContextManager(cache, { defaultToolsConfig: { autoRouter: { swapOrBridge: 'lifi' } } });
121
+ * const sdk = new IllaSDK(
122
+ * { apiKey: 'your-api-key' },
123
+ * { contextManager }
124
+ * );
125
+ * ```
126
+ */
127
+ constructor(config: illaSDKConfig, options?: illaSDKOptions);
128
+ /**
129
+ * Gets an array of all active chat IDs managed by this SDK instance.
130
+ *
131
+ * @returns {string[]} Array of chat IDs
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
136
+ *
137
+ * await sdk.sendMessage("Hello", { userContext: { address: "0x123" } });
138
+ * await sdk.sendMessage("Hi", { userContext: { address: "0x456" } });
139
+ *
140
+ * const chatIds = sdk.chatIds;
141
+ * console.log(chatIds); // ['chat-id-1', 'chat-id-2']
142
+ * ```
143
+ */
144
+ get chatIds(): string[];
145
+ /**
146
+ * Creates a new ContextManager instance. This is a factory method for creating
147
+ * context managers with custom configurations.
148
+ *
149
+ * @param cache - The cache implementation to use for storing context
150
+ * @param options - Configuration options for the context manager
151
+ * @returns {ContextManager} A new ContextManager instance
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * const cache = new InMemoryCache();
156
+ * const contextManager = IllaSDK.createNewContextManager(cache, {
157
+ * defaultToolsConfig: {
158
+ * autoRouter: { swapOrBridge: 'lifi' }
159
+ * }
160
+ * });
161
+ *
162
+ * const sdk = new IllaSDK(
163
+ * { apiKey: 'your-api-key' },
164
+ * { contextManager }
165
+ * );
166
+ * ```
167
+ */
168
+ static createNewContextManager(cache: ICache, options: ContextManagerOptions): ContextManager;
169
+ /**
170
+ * Creates a new Chat instance with the specified options.
171
+ * The chat is automatically registered with this SDK instance.
172
+ *
173
+ * @param options - Options for creating the chat, including user context and optional ID
174
+ * @param contextManager - Optional custom context manager for this chat. If not provided, uses the SDK's default
175
+ * @returns {Chat} A new Chat instance
176
+ *
177
+ * @example
178
+ * ```typescript
179
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
180
+ *
181
+ * // Create a new chat
182
+ * const chat = sdk.createChat({
183
+ * userContext: { address: "0x1234..." }
184
+ * });
185
+ *
186
+ * // Send messages directly through the chat instance
187
+ * const result = await chat.sendMessage(new Prompt({ text: "Hello!" }));
188
+ * ```
189
+ */
190
+ createChat(options: ChatOptions, contextManager?: ContextManager): Chat;
191
+ /**
192
+ * Sends a message to a chat session. This is the primary method for interacting with the AI.
193
+ * If a chatId is provided, the message will be sent to the existing chat.
194
+ * If a chatId is not provided, a new chat will be created with the provided userContext.
195
+ *
196
+ * @param msg - The message text to send
197
+ * @param context - Context containing either chatId for existing chat or userContext for new chat
198
+ * @returns {Promise<SendMessageResult>} The AI's response including chat ID, response text, and any pending tools
199
+ *
200
+ * @example
201
+ * ```typescript
202
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
203
+ *
204
+ * // Start a new conversation
205
+ * const result1 = await sdk.sendMessage(
206
+ * "What can you help me with?",
207
+ * { userContext: { address: "0x1234..." } }
208
+ * );
209
+ * console.log(result1.response.text);
210
+ * console.log("Chat ID:", result1.chatId);
211
+ *
212
+ * // Continue the conversation using the chat ID
213
+ * const result2 = await sdk.sendMessage(
214
+ * "I want to swap 1 ETH for USDC on Base",
215
+ * { chatId: result1.chatId }
216
+ * );
217
+ *
218
+ * // Check if there are tools to execute
219
+ * if (result2.response.pendingTools && result2.response.pendingTools.length > 0) {
220
+ * console.log("Tool to execute:", result2.response.pendingTools[0]);
221
+ * }
222
+ * ```
223
+ */
224
+ sendMessage(msg: string, context: SendMessageContext): Promise<SendMessageResult>;
225
+ /**
226
+ * Sends the result of a tool execution back to the AI. This method is used to complete
227
+ * the tool execution loop when the AI requests a tool to be executed.
228
+ *
229
+ * @param chatId - The ID of the chat to send the tool result to
230
+ * @param toolResult - The result of the tool execution
231
+ * @returns {Promise<SendMessageResult>} The AI's response after processing the tool result
232
+ * @throws {Error} If the chat with the specified chatId is not found
233
+ *
234
+ * @example
235
+ * ```typescript
236
+ * const sdk = new IllaSDK({ apiKey: 'your-api-key' });
237
+ *
238
+ * // Start a conversation that will request a tool execution
239
+ * const result1 = await sdk.sendMessage(
240
+ * "Swap 1 ETH for USDC on Base",
241
+ * { userContext: { address: "0x1234..." } }
242
+ * );
243
+ *
244
+ * // Check if there are pending tools to execute
245
+ * if (result1.response.pendingTools && result1.response.pendingTools.length > 0) {
246
+ * const tool = result1.response.pendingTools[0];
247
+ *
248
+ * // Execute the tool (e.g., send a transaction)
249
+ * const executionResult = await executeTool(tool);
250
+ *
251
+ * // Send the result back to the ILLA
252
+ * const toolResult: ToolResultType = {
253
+ * toolCallId: tool.toolCallId,
254
+ * toolName: tool.toolName,
255
+ * result?: executionResult,
256
+ * error?: executionResult.error,
257
+ * };
258
+ *
259
+ * const result2 = await sdk.sendToolResult(result1.chatId, toolResult);
260
+ * console.log(result2.response.text); // ILLA's response after processing the tool result
261
+ * }
262
+ * ```
263
+ */
264
+ sendToolResult(chatId: string, toolResult: ToolResultType): Promise<SendMessageResult>;
265
+ /**
266
+ * Gets the messages for a given chat ID.
267
+ *
268
+ * @param chatId - The ID of the chat to get the messages for
269
+ * @returns {Promise<MessageHistoryType>} The messages for the chat
270
+ * @throws {ChatNotFound} If the chat with the specified chatId is not found
271
+ */
272
+ getMessages(chatId: string): Promise<MessageHistoryType>;
273
+ }
274
+ /**
275
+ * Exports the public API of the SDK.
276
+ * A user could import IllaSDK as a single entry point to the SDK.
277
+ * Or they could import the individual components of the SDK for advanced usage.
278
+ */
279
+ export { IllaSDK, ChatNotFound };
280
+ export { InMemoryCache } from "./caching/index.js";
281
+ export { Prompt } from "./prompt/index.js";
282
+ export { Chat } from "./chat/index.js";
283
+ export { ContextManager } from "./context/index.js";
284
+ export { AsyncToolChecker } from "./asyncToolChecker/index.js";
285
+ export { CoreApiProvider } from "./providers/index.js";
286
+ export { UserContextMissing } from "./chat/errors/index.js";
287
+ export type { illaSDKConfig, ChatContextSnapshot, CacheEntryOptions, ICache, IContextManager, SendMessageContext, };
288
+ //# sourceMappingURL=sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE5F,OAAO,KAAK,EACR,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,MAAM,EACN,eAAe,EACf,iBAAiB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEH,IAAI,EACJ,cAAc,EAKjB,MAAM,eAAe,CA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