@illalabs/sdk 0.0.0-dev-3-9cae6c3-20251024213833 โ 0.1.0-canary.48bfe253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -0
- package/dist/src/interfaces/coreApiProvider.interface.d.ts +7 -1
- package/dist/src/interfaces/coreApiProvider.interface.d.ts.map +1 -1
- package/dist/src/providers/coreApiProvider/CoreApiProvider.d.ts +9 -2
- package/dist/src/providers/coreApiProvider/CoreApiProvider.d.ts.map +1 -1
- package/dist/src/providers/coreApiProvider/CoreApiProvider.js +18 -5
- package/dist/src/providers/coreApiProvider/CoreApiProvider.js.map +1 -1
- package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.d.ts +2 -4
- package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.d.ts.map +1 -1
- package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.js +7 -6
- package/dist/src/providers/coreApiProvider/errors/CoreApiAuthenticationMissing.js.map +1 -1
- package/dist/src/providers/coreApiProvider/index.d.ts +2 -3
- package/dist/src/providers/coreApiProvider/index.d.ts.map +1 -1
- package/dist/src/providers/coreApiProvider/index.js.map +1 -1
- package/dist/src/providers/coreApiProvider/{CoreApiProviderConfig.d.ts โ interfaces/CoreApiProviderConfig.interface.d.ts} +7 -2
- package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.d.ts.map +1 -0
- package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.js +2 -0
- package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.js.map +1 -0
- package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.d.ts +14 -0
- package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.d.ts.map +1 -0
- package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.js +2 -0
- package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.js.map +1 -0
- package/dist/src/providers/coreApiProvider/interfaces/index.d.ts +3 -0
- package/dist/src/providers/coreApiProvider/interfaces/index.d.ts.map +1 -0
- package/dist/src/providers/coreApiProvider/interfaces/index.js +2 -0
- package/dist/src/providers/coreApiProvider/interfaces/index.js.map +1 -0
- package/dist/src/providers/coreApiProvider/types.d.ts +9 -0
- package/dist/src/providers/coreApiProvider/types.d.ts.map +1 -1
- package/package.json +10 -5
- package/dist/src/providers/coreApiProvider/CoreApiProviderConfig.d.ts.map +0 -1
- package/dist/src/providers/coreApiProvider/CoreApiProviderConfig.js +0 -2
- package/dist/src/providers/coreApiProvider/CoreApiProviderConfig.js.map +0 -1
- package/dist/src/providers/coreApiProvider/RequestOptions.d.ts +0 -10
- package/dist/src/providers/coreApiProvider/RequestOptions.d.ts.map +0 -1
- package/dist/src/providers/coreApiProvider/RequestOptions.js +0 -2
- package/dist/src/providers/coreApiProvider/RequestOptions.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# @illalabs/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for building chat-based blockchain interactions with Illa's Core API.
|
|
4
|
+
|
|
5
|
+
## ๐ Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @illalabs/sdk
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @illalabs/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## ๐ Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Chat, ContextManager, CoreApiProvider, InMemoryCache, Prompt } from "@illalabs/sdk";
|
|
17
|
+
|
|
18
|
+
// Configure the API provider
|
|
19
|
+
const provider = new CoreApiProvider({
|
|
20
|
+
baseURL: "https://api-dev.illalabs.io",
|
|
21
|
+
headers: {
|
|
22
|
+
"x-api-key": "your-api-key",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Set up context management with caching
|
|
27
|
+
const cache = new InMemoryCache();
|
|
28
|
+
const contextManager = new ContextManager(cache);
|
|
29
|
+
|
|
30
|
+
// Create a chat instance
|
|
31
|
+
const chat = new Chat({
|
|
32
|
+
coreApiProvider: provider,
|
|
33
|
+
contextManager,
|
|
34
|
+
userContext: {
|
|
35
|
+
address: "0x...", // User's wallet address
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Send a message
|
|
40
|
+
const prompt = new Prompt({ text: "What is my wallet balance on Base?" });
|
|
41
|
+
const result = await chat.sendMessage(prompt);
|
|
42
|
+
|
|
43
|
+
console.log("Response:", result.response.text);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## ๐งช Testing
|
|
47
|
+
|
|
48
|
+
### Unit Tests
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pnpm test # Run unit tests
|
|
52
|
+
pnpm test:cov # Run with coverage
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### E2E Tests
|
|
56
|
+
|
|
57
|
+
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).
|
|
58
|
+
|
|
59
|
+
#### Prerequisites
|
|
60
|
+
|
|
61
|
+
E2E tests **require** a Base RPC URL for forking:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Set Base fork URL (required for E2E tests)
|
|
65
|
+
export E2E_FORK_BASE_RPC_URL="https://mainnet.base.org"
|
|
66
|
+
|
|
67
|
+
# Get a faster RPC from:
|
|
68
|
+
# - Alchemy: https://www.alchemy.com/
|
|
69
|
+
# - Infura: https://www.infura.io/
|
|
70
|
+
# - QuickNode: https://www.quicknode.com/
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Quick Start
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Mocked API + Anvil (Base fork)
|
|
77
|
+
E2E_FORK_BASE_RPC_URL="https://mainnet.base.org" pnpm test:e2e:anvil
|
|
78
|
+
|
|
79
|
+
# Real API + Anvil (Base fork) - full integration
|
|
80
|
+
E2E_API_KEY=your-api-key E2E_FORK_BASE_RPC_URL="https://mainnet.base.org" pnpm test:e2e:anvil
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### Configuration Options
|
|
84
|
+
|
|
85
|
+
**Required:**
|
|
86
|
+
|
|
87
|
+
- `E2E_FORK_BASE_RPC_URL`: Base mainnet RPC URL for forking (required for all E2E tests)
|
|
88
|
+
|
|
89
|
+
**Optional:**
|
|
90
|
+
|
|
91
|
+
- `E2E_API_KEY`: API key for authentication (if not provided, uses mocked API)
|
|
92
|
+
- `E2E_BASE_URL`: Base URL for the API endpoint (default: `https://api-dev.illalabs.io`)
|
|
93
|
+
- `E2E_TEST_ADDRESS`: Test wallet address (default: `0x5527E7744df42A56ABE7451cbFEDa1601Fa35196`)
|
|
94
|
+
|
|
95
|
+
**Note:** Environment variables use the `E2E_` prefix to avoid conflicts with vitest/vite built-in variables.
|
|
96
|
+
|
|
97
|
+
## ๐ Documentation
|
|
98
|
+
|
|
99
|
+
- [Introduction](./docs/introduction.mdx)
|
|
100
|
+
- [Authentication](./docs/authentication.mdx)
|
|
101
|
+
- [Quickstart](./docs/quickstart.mdx)
|
|
102
|
+
- [Configuration](./docs/concepts/configuration.mdx)
|
|
103
|
+
- [Error Handling](./docs/concepts/error-handling.mdx)
|
|
104
|
+
- [TypeScript Support](./docs/concepts/typescript-support.mdx)
|
|
105
|
+
- [Testing Guide](./docs/testing.mdx)
|
|
106
|
+
|
|
107
|
+
## Features
|
|
108
|
+
|
|
109
|
+
- **Chat-based Interface**: Intuitive conversational API for blockchain interactions
|
|
110
|
+
- **Context Management**: Automatic conversation history and state management
|
|
111
|
+
- **Multi-turn Conversations**: Seamless context preservation across messages
|
|
112
|
+
- **Session Persistence**: Resume conversations across different instances
|
|
113
|
+
- **Async Tool Monitoring**: Built-in support for long-running blockchain operations
|
|
114
|
+
- **TypeScript-first**: Full type safety with comprehensive type definitions
|
|
115
|
+
- **Flexible Caching**: Pluggable cache implementations (in-memory, Redis, etc.)
|
|
116
|
+
|
|
117
|
+
## ๐ฆ Project Structure
|
|
118
|
+
|
|
119
|
+
```plaintext
|
|
120
|
+
src/
|
|
121
|
+
โโโ chat/ # Chat class and related utilities
|
|
122
|
+
โโโ context/ # Context management
|
|
123
|
+
โโโ caching/ # Cache implementations
|
|
124
|
+
โโโ prompt/ # Prompt creation and formatting
|
|
125
|
+
โโโ providers/ # API provider implementations
|
|
126
|
+
โโโ interfaces/ # TypeScript interfaces
|
|
127
|
+
โโโ asyncToolChecker/ # Tool execution monitoring
|
|
128
|
+
|
|
129
|
+
test/
|
|
130
|
+
โโโ unit/ # Unit tests
|
|
131
|
+
โโโ e2e/ # End-to-end tests organized by class
|
|
132
|
+
โโโ utils/ # Shared test utilities and helpers
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Contributing
|
|
136
|
+
|
|
137
|
+
Wonderland is a team of top Web3 researchers, developers, and operators who believe that the future needs to be open-source, permissionless, and decentralized
|
|
138
|
+
|
|
139
|
+
[DeFi sucks](https://defi.sucks), but Wonderland is here to make it better
|
|
140
|
+
|
|
141
|
+
## ๐ License
|
|
142
|
+
|
|
143
|
+
MIT - See [LICENSE](../../LICENSE) for details.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CoreApiChatRequest, CoreApiChatResponse, LongPollingActionRequest, LongPollingActionResponse } from "@illalabs/interfaces";
|
|
2
|
-
import type { RequestOptions } from "../providers/coreApiProvider/index.js";
|
|
2
|
+
import type { CoreApiProviderRoutes, RequestOptions } from "../providers/coreApiProvider/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Contract for the Core API provider
|
|
5
5
|
*/
|
|
@@ -22,5 +22,11 @@ export interface ICoreApiProvider {
|
|
|
22
22
|
* @returns Core API execution checker response
|
|
23
23
|
*/
|
|
24
24
|
awaitTransaction(request: LongPollingActionRequest["params"], options?: RequestOptions): Promise<LongPollingActionResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves the configured routes for the Core API endpoints used by the provider.
|
|
27
|
+
*
|
|
28
|
+
* @returns Route configuration including chat and action status paths.
|
|
29
|
+
*/
|
|
30
|
+
getRoutes(): Required<CoreApiProviderRoutes>;
|
|
25
31
|
}
|
|
26
32
|
//# sourceMappingURL=coreApiProvider.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreApiProvider.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/coreApiProvider.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"coreApiProvider.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/coreApiProvider.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEnG;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;;;;OAOG;IACH,WAAW,CACP,OAAO,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACnC,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEhC;;;;;;;OAOG;IACH,gBAAgB,CACZ,OAAO,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAC3C,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAEtC;;;;OAIG;IACH,SAAS,IAAI,QAAQ,CAAC,qBAAqB,CAAC,CAAC;CAChD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { CoreApiChatRequest, CoreApiChatResponse, LongPollingActionRequest, LongPollingActionResponse } from "@illalabs/interfaces";
|
|
2
2
|
import type { AxiosInstance } from "axios";
|
|
3
3
|
import type { ICoreApiProvider } from "../../interfaces/index.js";
|
|
4
|
-
import type { CoreApiProviderConfig,
|
|
4
|
+
import type { CoreApiProviderConfig, CoreApiProviderRoutes } from "./interfaces/index.js";
|
|
5
|
+
import type { RequestOptions } from "./types.js";
|
|
5
6
|
/**
|
|
6
7
|
* Axios based Core API provider implementation
|
|
7
8
|
*/
|
|
@@ -10,10 +11,14 @@ export declare class CoreApiProvider implements ICoreApiProvider {
|
|
|
10
11
|
* Axios instance configured for the Core API
|
|
11
12
|
*/
|
|
12
13
|
protected readonly client: AxiosInstance;
|
|
14
|
+
/**
|
|
15
|
+
* Routes used by the provider when issuing requests.
|
|
16
|
+
*/
|
|
17
|
+
protected readonly routes: Required<CoreApiProviderRoutes>;
|
|
13
18
|
/**
|
|
14
19
|
* @param config Core API provider configuration
|
|
15
20
|
*/
|
|
16
|
-
constructor({ baseURL, timeout, headers, httpClientFactory }: CoreApiProviderConfig);
|
|
21
|
+
constructor({ baseURL, timeout, headers, httpClientFactory, routes }: CoreApiProviderConfig);
|
|
17
22
|
/**
|
|
18
23
|
* Sends a chat message to the Core API
|
|
19
24
|
*/
|
|
@@ -22,6 +27,8 @@ export declare class CoreApiProvider implements ICoreApiProvider {
|
|
|
22
27
|
* Polls the Core API for transaction status
|
|
23
28
|
*/
|
|
24
29
|
awaitTransaction(params: LongPollingActionRequest["params"], options?: RequestOptions): Promise<LongPollingActionResponse>;
|
|
30
|
+
/** @inheritdoc */
|
|
31
|
+
getRoutes(): Required<CoreApiProviderRoutes>;
|
|
25
32
|
/**
|
|
26
33
|
* Builds request configuration shared across endpoints
|
|
27
34
|
*/
|
|
@@ -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;
|
|
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,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,YAAY,CAAC;AAGpE;;GAEG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;IACpD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAEzC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IAE3D;;OAEG;gBACS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,qBAAqB;IAmB3F;;OAEG;IACU,WAAW,CACpB,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAChC,OAAO,GAAE,cAAmB,GAC7B,OAAO,CAAC,mBAAmB,CAAC;IAsB/B;;OAEG;IACU,gBAAgB,CACzB,MAAM,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAC1C,OAAO,GAAE,cAAmB,GAC7B,OAAO,CAAC,yBAAyB,CAAC;IA6BrC,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"}
|
|
@@ -8,10 +8,14 @@ export class CoreApiProvider {
|
|
|
8
8
|
* Axios instance configured for the Core API
|
|
9
9
|
*/
|
|
10
10
|
client;
|
|
11
|
+
/**
|
|
12
|
+
* Routes used by the provider when issuing requests.
|
|
13
|
+
*/
|
|
14
|
+
routes;
|
|
11
15
|
/**
|
|
12
16
|
* @param config Core API provider configuration
|
|
13
17
|
*/
|
|
14
|
-
constructor({ baseURL, timeout, headers, httpClientFactory }) {
|
|
18
|
+
constructor({ baseURL, timeout, headers, httpClientFactory, routes }) {
|
|
15
19
|
const authHeaders = this.ensureAuthHeaders(headers);
|
|
16
20
|
const resolveClientFactory = httpClientFactory ??
|
|
17
21
|
((configuration) => axios.create(configuration));
|
|
@@ -20,13 +24,17 @@ export class CoreApiProvider {
|
|
|
20
24
|
timeout,
|
|
21
25
|
headers: this.buildDefaultHeaders(authHeaders),
|
|
22
26
|
});
|
|
27
|
+
this.routes = {
|
|
28
|
+
chat: routes?.chat ?? "/api/v1/chat/",
|
|
29
|
+
actionStatus: routes?.actionStatus ?? "/api/v1/actions/check",
|
|
30
|
+
};
|
|
23
31
|
}
|
|
24
32
|
/**
|
|
25
33
|
* Sends a chat message to the Core API
|
|
26
34
|
*/
|
|
27
35
|
async sendMessage(body, options = {}) {
|
|
28
36
|
const requestConfig = this.buildRequestConfig(options);
|
|
29
|
-
const response = await this.client.post(
|
|
37
|
+
const response = await this.client.post(this.routes.chat, body, requestConfig);
|
|
30
38
|
return response.data;
|
|
31
39
|
//TODO: Handle errors
|
|
32
40
|
// try{
|
|
@@ -45,7 +53,7 @@ export class CoreApiProvider {
|
|
|
45
53
|
*/
|
|
46
54
|
async awaitTransaction(params, options = {}) {
|
|
47
55
|
const requestConfig = this.buildRequestConfig(options);
|
|
48
|
-
const response = await this.client.get(
|
|
56
|
+
const response = await this.client.get(this.routes.actionStatus, {
|
|
49
57
|
...requestConfig,
|
|
50
58
|
params: {
|
|
51
59
|
toolName: params.toolName,
|
|
@@ -66,6 +74,10 @@ export class CoreApiProvider {
|
|
|
66
74
|
// return errorResponse;
|
|
67
75
|
// }
|
|
68
76
|
}
|
|
77
|
+
/** @inheritdoc */
|
|
78
|
+
getRoutes() {
|
|
79
|
+
return this.routes;
|
|
80
|
+
}
|
|
69
81
|
/**
|
|
70
82
|
* Builds request configuration shared across endpoints
|
|
71
83
|
*/
|
|
@@ -75,7 +87,8 @@ export class CoreApiProvider {
|
|
|
75
87
|
};
|
|
76
88
|
}
|
|
77
89
|
resolveBaseUrl(baseURL) {
|
|
78
|
-
|
|
90
|
+
// TODO: update base URL depending on final deployment
|
|
91
|
+
return baseURL ?? "https://api-dev.illalabs.io";
|
|
79
92
|
}
|
|
80
93
|
buildDefaultHeaders(headers) {
|
|
81
94
|
return {
|
|
@@ -84,7 +97,7 @@ export class CoreApiProvider {
|
|
|
84
97
|
};
|
|
85
98
|
}
|
|
86
99
|
ensureAuthHeaders(headers) {
|
|
87
|
-
if (headers?.["x-
|
|
100
|
+
if (headers?.["x-api-key"] === undefined) {
|
|
88
101
|
throw new CoreApiAuthenticationMissing();
|
|
89
102
|
}
|
|
90
103
|
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;
|
|
1
|
+
{"version":3,"file":"CoreApiProvider.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiProvider.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Raised when the
|
|
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,
|
|
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
|
|
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
|
-
|
|
7
|
+
const message = "Core API key is required";
|
|
8
|
+
super(message);
|
|
10
9
|
this.name = "CoreApiAuthenticationMissing";
|
|
11
|
-
|
|
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,
|
|
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 "./
|
|
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,
|
|
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;
|
|
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 "
|
|
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
|
package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderConfig.interface.d.ts.map
ADDED
|
@@ -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 @@
|
|
|
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
|
package/dist/src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.d.ts.map
ADDED
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"CoreApiProviderRoutes.interface.js","sourceRoot":"","sources":["../../../../../src/providers/coreApiProvider/interfaces/CoreApiProviderRoutes.interface.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@illalabs/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0-canary.48bfe253",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "TypeScript SDK for interacting with Illa's Core API",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,13 +23,16 @@
|
|
|
23
23
|
"axios": "1.12.2",
|
|
24
24
|
"uuid": "13.0.0",
|
|
25
25
|
"viem": "2.37.13",
|
|
26
|
-
"@illalabs/interfaces": "0.
|
|
26
|
+
"@illalabs/interfaces": "0.1.0-canary.48bfe253"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"zod": "4.1.12"
|
|
27
30
|
},
|
|
28
31
|
"publishConfig": {
|
|
29
|
-
"access": "public"
|
|
30
|
-
"registry": "https://registry.npmjs.org/"
|
|
32
|
+
"access": "public"
|
|
31
33
|
},
|
|
32
34
|
"scripts": {
|
|
35
|
+
"anvil": "./scripts/start-anvil.sh",
|
|
33
36
|
"build": "tsc -p tsconfig.build.json",
|
|
34
37
|
"check-types": "tsc --noEmit -p tsconfig.json",
|
|
35
38
|
"clean": "rm -rf dist",
|
|
@@ -38,6 +41,8 @@
|
|
|
38
41
|
"lint": "eslint \"{src,test}/**/*.{ts,js,json}\"",
|
|
39
42
|
"lint:fix": "pnpm lint --fix",
|
|
40
43
|
"test": "vitest run --config vitest.config.ts --passWithNoTests",
|
|
41
|
-
"test:cov": "vitest run --config vitest.config.ts --coverage"
|
|
44
|
+
"test:cov": "vitest run --config vitest.config.ts --coverage",
|
|
45
|
+
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
46
|
+
"test:e2e:anvil": "./scripts/test-with-anvil.sh"
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CoreApiProviderConfig.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiProviderConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;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;CAClD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CoreApiProviderConfig.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/CoreApiProviderConfig.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestOptions.d.ts","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/RequestOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CACjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RequestOptions.js","sourceRoot":"","sources":["../../../../src/providers/coreApiProvider/RequestOptions.ts"],"names":[],"mappings":""}
|