sylix 1.0.1

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/LICENSE ADDED
@@ -0,0 +1,52 @@
1
+ SYLIX PROPRIETARY LICENSE
2
+
3
+ Copyright (c) 2026 Sylix. All rights reserved.
4
+
5
+ NOTICE: This software and associated documentation files (the "Software") are
6
+ the proprietary property of Sylix and are protected by copyright law and
7
+ international treaties.
8
+
9
+ RESTRICTIONS:
10
+
11
+ 1. You may NOT copy, modify, merge, publish, distribute, sublicense, or sell
12
+ copies of the Software without prior written authorization from Sylix.
13
+
14
+ 2. You may NOT reverse engineer, decompile, or disassemble the Software.
15
+
16
+ 3. You may NOT use the Software for any purpose other than as expressly
17
+ authorized by Sylix.
18
+
19
+ 4. You may NOT remove or alter any proprietary notices, labels, or marks on
20
+ the Software.
21
+
22
+ AUTHORIZED USE:
23
+
24
+ Use of this Software is permitted only:
25
+ - By authorized licensees with a valid Sylix API key
26
+ - In accordance with the Sylix Terms of Service
27
+ - For integration with Sylix services and APIs
28
+
29
+ WARRANTY DISCLAIMER:
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
34
+
35
+ LIMITATION OF LIABILITY:
36
+
37
+ IN NO EVENT SHALL SYLIX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
39
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40
+
41
+ TERMINATION:
42
+
43
+ This license is effective until terminated. Your rights under this license
44
+ will terminate automatically without notice if you fail to comply with any
45
+ of its terms.
46
+
47
+ CONTACT:
48
+
49
+ For licensing inquiries, contact: legal@sylixide.com
50
+
51
+ ---
52
+ Sylix - All Rights Reserved
package/README.md ADDED
@@ -0,0 +1,357 @@
1
+ # Sylix SDK
2
+
3
+ The official SDK for Charles AI models. OpenAI-compatible API for seamless integration.
4
+
5
+ **Version:** 1.0.1 | **License:** Proprietary | **Status:** Production Ready
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ - [Installation](#installation)
12
+ - [Quick Start](#quick-start)
13
+ - [Charles API](#charles-api)
14
+ - [Available Models](#available-models)
15
+ - [Examples](#examples)
16
+ - [Error Handling](#error-handling)
17
+ - [Configuration](#configuration)
18
+ - [API Reference](#api-reference)
19
+
20
+ ---
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install @sylix/sdk
26
+ ```
27
+
28
+ **Requirements:** Node.js 18.0.0 or higher
29
+
30
+ ---
31
+
32
+ ## Quick Start
33
+
34
+ ### Initialize
35
+
36
+ ```typescript
37
+ import { Sylix, CHARLES_MODELS } from "@sylix/sdk";
38
+
39
+ const sylix = new Sylix({
40
+ apiKey: process.env.SYLIX_API_KEY
41
+ });
42
+ ```
43
+
44
+ ### Chat Completion
45
+
46
+ ```typescript
47
+ const response = await sylix.charles.chat.completions.create({
48
+ model: CHARLES_MODELS.MINI,
49
+ messages: [
50
+ { role: "system", content: "You are a helpful assistant." },
51
+ { role: "user", content: "Hello!" }
52
+ ]
53
+ });
54
+
55
+ console.log(response.choices[0].message.content);
56
+ ```
57
+
58
+ ### List Models
59
+
60
+ ```typescript
61
+ const models = await sylix.charles.models.list();
62
+ ```
63
+
64
+ ### Generate Embeddings
65
+
66
+ ```typescript
67
+ const result = await sylix.charles.embeddings.create({
68
+ model: CHARLES_MODELS.MINI,
69
+ input: "Hello world"
70
+ });
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Charles API
76
+
77
+ The Charles namespace provides OpenAI-compatible endpoints.
78
+
79
+ ### Chat Completions
80
+
81
+ ```typescript
82
+ sylix.charles.chat.completions.create(options)
83
+ ```
84
+
85
+ | Parameter | Type | Required | Description |
86
+ |-----------|------|----------|-------------|
87
+ | `model` | `string` | Yes | Model ID |
88
+ | `messages` | `ChatMessage[]` | Yes | Conversation messages |
89
+ | `temperature` | `number` | No | Sampling temperature (0-2) |
90
+ | `max_tokens` | `number` | No | Maximum tokens in response |
91
+ | `stream` | `boolean` | No | Enable streaming |
92
+ | `tools` | `Tool[]` | No | Function calling tools |
93
+ | `tool_choice` | `string` | No | Tool selection mode |
94
+
95
+ ### Models
96
+
97
+ ```typescript
98
+ // List all models
99
+ const models = await sylix.charles.models.list();
100
+
101
+ // Retrieve specific model
102
+ const model = await sylix.charles.models.retrieve("charles-mini");
103
+ ```
104
+
105
+ ### Embeddings
106
+
107
+ ```typescript
108
+ const result = await sylix.charles.embeddings.create({
109
+ model: "charles-mini:latest",
110
+ input: "Text to embed"
111
+ });
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Available Models
117
+
118
+ | Model | ID | Tier | Description |
119
+ |-------|-----|------|-------------|
120
+ | Charles Mini | `charles-mini:latest` | Free | Lightweight, fast responses |
121
+ | Charles S1 | `charles-s1:latest` | Standard | Reasoning and code generation |
122
+ | Charles V1 | `charles-v1:latest` | Advanced | Complex analysis |
123
+ | Charles 2.9 | `charles-2.9:latest` | Premium | State-of-the-art performance |
124
+ | Charles R1 | `charles-r1:latest` | Premium | Advanced reasoning |
125
+
126
+ ### Model Constants
127
+
128
+ ```typescript
129
+ import { CHARLES_MODELS } from "@sylix/sdk";
130
+
131
+ CHARLES_MODELS.MINI // "charles-mini:latest"
132
+ CHARLES_MODELS.S1 // "charles-s1:latest"
133
+ CHARLES_MODELS.V1 // "charles-v1:latest"
134
+ CHARLES_MODELS.V2_9 // "charles-2.9:latest"
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Examples
140
+
141
+ ### Multi-turn Conversation
142
+
143
+ ```typescript
144
+ const messages = [
145
+ { role: "system", content: "You are a coding assistant." },
146
+ { role: "user", content: "Write hello world in Python" }
147
+ ];
148
+
149
+ const response = await sylix.charles.chat.completions.create({
150
+ model: CHARLES_MODELS.S1,
151
+ messages
152
+ });
153
+
154
+ messages.push(response.choices[0].message);
155
+ messages.push({ role: "user", content: "Now in Rust" });
156
+
157
+ const followUp = await sylix.charles.chat.completions.create({
158
+ model: CHARLES_MODELS.S1,
159
+ messages
160
+ });
161
+ ```
162
+
163
+ ### Function Calling
164
+
165
+ ```typescript
166
+ const response = await sylix.charles.chat.completions.create({
167
+ model: CHARLES_MODELS.V1,
168
+ messages: [{ role: "user", content: "What is the weather in Tokyo?" }],
169
+ tools: [{
170
+ type: "function",
171
+ function: {
172
+ name: "get_weather",
173
+ description: "Get weather for a location",
174
+ parameters: {
175
+ type: "object",
176
+ properties: {
177
+ location: { type: "string" }
178
+ },
179
+ required: ["location"]
180
+ }
181
+ }
182
+ }],
183
+ tool_choice: "auto"
184
+ });
185
+ ```
186
+
187
+ ### Batch Processing
188
+
189
+ ```typescript
190
+ const prompts = ["What is AI?", "Explain ML", "Define DL"];
191
+
192
+ const responses = await Promise.all(
193
+ prompts.map(prompt =>
194
+ sylix.charles.chat.completions.create({
195
+ model: CHARLES_MODELS.MINI,
196
+ messages: [{ role: "user", content: prompt }]
197
+ })
198
+ )
199
+ );
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Error Handling
205
+
206
+ ```typescript
207
+ import { Sylix, SylixError } from "@sylix/sdk";
208
+
209
+ try {
210
+ const response = await sylix.charles.chat.completions.create({
211
+ model: "invalid-model",
212
+ messages: [{ role: "user", content: "Hello" }]
213
+ });
214
+ } catch (error) {
215
+ if (error instanceof SylixError) {
216
+ console.error(`[${error.code}] ${error.message}`);
217
+ }
218
+ }
219
+ ```
220
+
221
+ ### Error Codes
222
+
223
+ | Code | Description |
224
+ |------|-------------|
225
+ | `MISSING_API_KEY` | API key not provided |
226
+ | `INVALID_MODEL` | Model not found |
227
+ | `invalid_api_key` | Invalid or expired API key |
228
+ | `model_backend_error` | Model backend unavailable |
229
+ | `internal_error` | Internal server error |
230
+
231
+ ---
232
+
233
+ ## Configuration
234
+
235
+ ```typescript
236
+ interface SylixConfig {
237
+ apiKey: string; // Required
238
+ baseURL?: string; // Default: https://api.sylixide.com/v1
239
+ timeout?: number; // Default: 30000 (ms)
240
+ headers?: Record<string, string>; // Custom headers
241
+ }
242
+
243
+ const sylix = new Sylix({
244
+ apiKey: process.env.SYLIX_API_KEY,
245
+ baseURL: "https://api.sylixide.com/v1",
246
+ timeout: 60000
247
+ });
248
+ ```
249
+
250
+ ### Security
251
+
252
+ Store API keys in environment variables:
253
+
254
+ ```typescript
255
+ // Recommended
256
+ const sylix = new Sylix({ apiKey: process.env.SYLIX_API_KEY });
257
+
258
+ // Not recommended
259
+ const sylix = new Sylix({ apiKey: "sk-..." });
260
+ ```
261
+
262
+ ---
263
+
264
+ ## API Reference
265
+
266
+ For complete API documentation, see [API_REFERENCE.md](./API_REFERENCE.md).
267
+
268
+ ### Types
269
+
270
+ ```typescript
271
+ // Chat message
272
+ interface ChatMessage {
273
+ role: "system" | "user" | "assistant";
274
+ content: string;
275
+ }
276
+
277
+ // Chat response
278
+ interface ChatResponse {
279
+ id: string;
280
+ object: "chat.completion";
281
+ created: number;
282
+ model: string;
283
+ choices: Array<{
284
+ index: number;
285
+ message: ChatMessage;
286
+ finish_reason: string;
287
+ }>;
288
+ usage: {
289
+ prompt_tokens: number;
290
+ completion_tokens: number;
291
+ total_tokens: number;
292
+ };
293
+ }
294
+
295
+ // Model
296
+ interface CharlesModel {
297
+ id: string;
298
+ object: "model";
299
+ created: number;
300
+ owned_by: "sylix";
301
+ }
302
+ ```
303
+
304
+ ---
305
+
306
+ ## Development
307
+
308
+ ### Build
309
+
310
+ ```bash
311
+ npm install
312
+ npm run build
313
+ npm test
314
+ ```
315
+
316
+ ### Project Structure
317
+
318
+ ```
319
+ sylix-sdk/
320
+ ├── src/
321
+ │ ├── index.ts # Main exports
322
+ │ ├── types.ts # TypeScript types
323
+ │ ├── client.ts # HTTP client
324
+ │ └── utils.ts # Utilities
325
+ ├── dist/ # Compiled output
326
+ └── API_REFERENCE.md # API documentation
327
+ ```
328
+
329
+ ---
330
+
331
+ ## Contributing
332
+
333
+ 1. Fork the repository
334
+ 2. Create a feature branch
335
+ 3. Commit changes
336
+ 4. Submit a pull request
337
+
338
+ ---
339
+
340
+ ## License
341
+
342
+ Proprietary License. Copyright 2026 Sylix. All rights reserved.
343
+
344
+ This software is proprietary and confidential. Unauthorized copying, distribution, or modification is strictly prohibited.
345
+
346
+ ---
347
+
348
+ ## Support
349
+
350
+ - **Documentation:** [API_REFERENCE.md](./API_REFERENCE.md)
351
+ - **Issues:** [GitHub Issues](https://github.com/Curly-09/sylix-ide-sdk/issues)
352
+ - **Website:** [sylixide.com](https://sylixide.com)
353
+ - **Email:** support@sylixide.com
354
+
355
+ ---
356
+
357
+ Sylix SDK - Built for developers.
@@ -0,0 +1,12 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { SylixConfig } from "./types.js";
3
+ export declare class SylixClient {
4
+ private client;
5
+ private apiKey;
6
+ private baseURL;
7
+ constructor(config: SylixConfig);
8
+ validateModel(model: string): void;
9
+ getClient(): AxiosInstance;
10
+ getBaseURL(): string;
11
+ }
12
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAiC,MAAM,YAAY,CAAC;AAExE,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,WAAW;IA+C/B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAWlC,SAAS,IAAI,aAAa;IAI1B,UAAU,IAAI,MAAM;CAGrB"}
package/dist/client.js ADDED
@@ -0,0 +1,48 @@
1
+ import axios from "axios";
2
+ import { SylixError, CHARLES_MODEL_IDS } from "./types.js";
3
+ export class SylixClient {
4
+ constructor(config) {
5
+ if (!config.apiKey) {
6
+ throw new SylixError("MISSING_API_KEY", "apiKey is required. Get your API key from https://sylixide.com");
7
+ }
8
+ this.apiKey = config.apiKey;
9
+ this.baseURL = config.baseURL || "https://api.sylixide.com/v1";
10
+ const headers = {
11
+ "Content-Type": "application/json",
12
+ "x-api-key": this.apiKey,
13
+ ...(config.headers || {}),
14
+ };
15
+ this.client = axios.create({
16
+ baseURL: this.baseURL,
17
+ timeout: config.timeout || 30000,
18
+ headers,
19
+ });
20
+ // Add retry interceptor for 5xx errors
21
+ this.client.interceptors.response.use((response) => response, async (error) => {
22
+ const config = error.config;
23
+ if (!config)
24
+ return Promise.reject(error);
25
+ // Retry up to 3 times for 5xx errors
26
+ config.retryCount = config.retryCount || 0;
27
+ if (error.response?.status >= 500 && config.retryCount < 3) {
28
+ config.retryCount++;
29
+ // Exponential backoff: 1s, 2s, 4s
30
+ const delay = Math.pow(2, config.retryCount - 1) * 1000;
31
+ await new Promise((resolve) => setTimeout(resolve, delay));
32
+ return this.client(config);
33
+ }
34
+ return Promise.reject(error);
35
+ });
36
+ }
37
+ validateModel(model) {
38
+ if (!CHARLES_MODEL_IDS.includes(model)) {
39
+ throw new SylixError("INVALID_MODEL", `Model "${model}" is not available in v1.0.0. Available models: ${CHARLES_MODEL_IDS.join(", ")}. To use custom models, see https://github.com/sylix-ide/sylix-sdk#custom-models`);
40
+ }
41
+ }
42
+ getClient() {
43
+ return this.client;
44
+ }
45
+ getBaseURL() {
46
+ return this.baseURL;
47
+ }
48
+ }
@@ -0,0 +1,150 @@
1
+ import { SylixClient } from "./client.js";
2
+ import { ChatRequest, ChatResponse, VisionRequest, VisionResponse, CodeRequest, CodeResponse, ReasonRequest, ReasonResponse, ModelInfo, SylixConfig, CharlesModel, CharlesModelsListResponse, CharlesEmbeddingRequest, CharlesEmbeddingResponse, CharlesChatRequest } from "./types.js";
3
+ import { readFile, fileToBase64 } from "./utils.js";
4
+ /**
5
+ * Chat completions namespace
6
+ */
7
+ declare class ChatCompletions {
8
+ private client;
9
+ constructor(client: SylixClient);
10
+ create(payload: ChatRequest): Promise<ChatResponse>;
11
+ private handleError;
12
+ }
13
+ /**
14
+ * Vision namespace (image processing)
15
+ */
16
+ declare class Vision {
17
+ private client;
18
+ constructor(client: SylixClient);
19
+ process(payload: VisionRequest): Promise<VisionResponse>;
20
+ private handleError;
21
+ }
22
+ /**
23
+ * Code generation namespace (stub for v1)
24
+ */
25
+ declare class Code {
26
+ private client;
27
+ constructor(client: SylixClient);
28
+ generate(payload: CodeRequest): Promise<CodeResponse>;
29
+ private handleError;
30
+ }
31
+ /**
32
+ * Reasoning namespace (stub for v1)
33
+ */
34
+ declare class Reason {
35
+ private client;
36
+ constructor(client: SylixClient);
37
+ process(payload: ReasonRequest): Promise<ReasonResponse>;
38
+ private handleError;
39
+ }
40
+ /**
41
+ * Charles chat completions namespace
42
+ * Usage: sylix.charles.chat.completions.create()
43
+ */
44
+ declare class CharlesChatCompletions {
45
+ private client;
46
+ constructor(client: SylixClient);
47
+ /**
48
+ * Create a chat completion
49
+ * @param payload - Chat request parameters
50
+ * @returns Chat completion response
51
+ */
52
+ create(payload: CharlesChatRequest): Promise<ChatResponse>;
53
+ private handleError;
54
+ }
55
+ /**
56
+ * Charles chat namespace
57
+ * Usage: sylix.charles.chat.completions
58
+ */
59
+ declare class CharlesChat {
60
+ completions: CharlesChatCompletions;
61
+ constructor(client: SylixClient);
62
+ }
63
+ /**
64
+ * Charles models namespace
65
+ * Usage: sylix.charles.models.list(), sylix.charles.models.retrieve()
66
+ */
67
+ declare class CharlesModels {
68
+ private client;
69
+ constructor(client: SylixClient);
70
+ /**
71
+ * List all available Charles models
72
+ * @returns List of Charles models
73
+ */
74
+ list(): Promise<CharlesModelsListResponse>;
75
+ /**
76
+ * Retrieve a specific model by ID
77
+ * @param modelId - Model ID (e.g., "charles-mini:latest" or "charles-mini")
78
+ * @returns Model details
79
+ */
80
+ retrieve(modelId: string): Promise<CharlesModel>;
81
+ private handleError;
82
+ }
83
+ /**
84
+ * Charles embeddings namespace
85
+ * Usage: sylix.charles.embeddings.create()
86
+ */
87
+ declare class CharlesEmbeddings {
88
+ private client;
89
+ constructor(client: SylixClient);
90
+ /**
91
+ * Create embeddings for text
92
+ * @param payload - Embedding request parameters
93
+ * @returns Embedding vectors
94
+ */
95
+ create(payload: CharlesEmbeddingRequest): Promise<CharlesEmbeddingResponse>;
96
+ private handleError;
97
+ }
98
+ /**
99
+ * Charles main namespace (OpenAI-compatible)
100
+ *
101
+ * Provides access to all Charles v1 API endpoints:
102
+ * - chat.completions - Chat completions
103
+ * - models - Model listing and retrieval
104
+ * - embeddings - Text embeddings
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const sylix = new Sylix({ apiKey: 'sk-...' });
109
+ *
110
+ * // Chat completion
111
+ * const response = await sylix.charles.chat.completions.create({
112
+ * model: 'charles-mini:latest',
113
+ * messages: [{ role: 'user', content: 'Hello!' }]
114
+ * });
115
+ *
116
+ * // List models
117
+ * const models = await sylix.charles.models.list();
118
+ * ```
119
+ */
120
+ declare class Charles {
121
+ chat: CharlesChat;
122
+ models: CharlesModels;
123
+ embeddings: CharlesEmbeddings;
124
+ constructor(client: SylixClient);
125
+ }
126
+ /**
127
+ * Main Sylix SDK class
128
+ */
129
+ export declare class Sylix {
130
+ private client;
131
+ chat: ChatCompletions;
132
+ vision: Vision;
133
+ code: Code;
134
+ reason: Reason;
135
+ /** Charles v1 API namespace (OpenAI-compatible) */
136
+ charles: Charles;
137
+ constructor(config: SylixConfig);
138
+ /**
139
+ * Get available models
140
+ */
141
+ models(): ModelInfo[];
142
+ /**
143
+ * Get a single model by ID
144
+ */
145
+ getModel(id: string): ModelInfo | undefined;
146
+ }
147
+ export { ChatRequest, ChatResponse, VisionRequest, VisionResponse, CodeRequest, CodeResponse, ReasonRequest, ReasonResponse, ModelInfo, SylixError, CHARLES_MODELS, CHARLES_MODEL_IDS, CharlesModel, CharlesModelsListResponse, CharlesEmbeddingRequest, CharlesEmbeddingResponse, CharlesChatRequest, } from "./types.js";
148
+ export type { ChatMessage } from "./types.js";
149
+ export { readFile, fileToBase64 };
150
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,SAAS,EACT,WAAW,EAKX,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,cAAM,eAAe;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEjC,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAezD,OAAO,CAAC,WAAW;CAQpB;AAED;;GAEG;AACH,cAAM,MAAM;IACE,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEjC,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IA6B9D,OAAO,CAAC,WAAW;CAQpB;AAED;;GAEG;AACH,cAAM,IAAI;IACI,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEjC,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAe3D,OAAO,CAAC,WAAW;CAQpB;AAED;;GAEG;AACH,cAAM,MAAM;IACE,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAE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,OAAO,CAAC;gBAEZ,MAAM,EAAE,WAAW;IAS/B;;OAEG;IACH,MAAM,IAAI,SAAS,EAAE;IA4CrB;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;CAG5C;AAGD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,SAAS,EACT,UAAU,EACV,cAAc,EACd,iBAAiB,EAEjB,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,316 @@
1
+ import { SylixClient } from "./client.js";
2
+ import { SylixError, } from "./types.js";
3
+ import { readFile, fileToBase64 } from "./utils.js";
4
+ /**
5
+ * Chat completions namespace
6
+ */
7
+ class ChatCompletions {
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ async create(payload) {
12
+ this.client.validateModel(payload.model);
13
+ try {
14
+ const response = await this.client.getClient().post("/chat/completions", payload);
15
+ return response.data;
16
+ }
17
+ catch (error) {
18
+ throw this.handleError(error);
19
+ }
20
+ }
21
+ handleError(error) {
22
+ const message = error.response?.data?.error?.message || error.message || "Unknown error";
23
+ const code = error.response?.data?.error?.type || error.code || "UNKNOWN_ERROR";
24
+ return new SylixError(code, message, error.response?.data);
25
+ }
26
+ }
27
+ /**
28
+ * Vision namespace (image processing)
29
+ */
30
+ class Vision {
31
+ constructor(client) {
32
+ this.client = client;
33
+ }
34
+ async process(payload) {
35
+ this.client.validateModel(payload.model);
36
+ try {
37
+ // Convert image to base64 if it's a path or Buffer
38
+ let imageData = payload.image;
39
+ if (typeof payload.image === "string" && !payload.image.startsWith("data:")) {
40
+ // It's a file path
41
+ imageData = await fileToBase64(payload.image);
42
+ }
43
+ else if (Buffer.isBuffer(payload.image)) {
44
+ imageData = payload.image.toString("base64");
45
+ }
46
+ const response = await this.client.getClient().post("/vision/process", {
47
+ model: payload.model,
48
+ image: imageData,
49
+ prompt: payload.prompt,
50
+ });
51
+ return response.data;
52
+ }
53
+ catch (error) {
54
+ throw this.handleError(error);
55
+ }
56
+ }
57
+ handleError(error) {
58
+ const message = error.response?.data?.error?.message || error.message || "Unknown error";
59
+ const code = error.response?.data?.error?.type || error.code || "UNKNOWN_ERROR";
60
+ return new SylixError(code, message, error.response?.data);
61
+ }
62
+ }
63
+ /**
64
+ * Code generation namespace (stub for v1)
65
+ */
66
+ class Code {
67
+ constructor(client) {
68
+ this.client = client;
69
+ }
70
+ async generate(payload) {
71
+ this.client.validateModel(payload.model);
72
+ try {
73
+ const response = await this.client.getClient().post("/code/generate", payload);
74
+ return response.data;
75
+ }
76
+ catch (error) {
77
+ throw this.handleError(error);
78
+ }
79
+ }
80
+ handleError(error) {
81
+ const message = error.response?.data?.error?.message || error.message || "Unknown error";
82
+ const code = error.response?.data?.error?.type || error.code || "UNKNOWN_ERROR";
83
+ return new SylixError(code, message, error.response?.data);
84
+ }
85
+ }
86
+ /**
87
+ * Reasoning namespace (stub for v1)
88
+ */
89
+ class Reason {
90
+ constructor(client) {
91
+ this.client = client;
92
+ }
93
+ async process(payload) {
94
+ this.client.validateModel(payload.model);
95
+ try {
96
+ const response = await this.client.getClient().post("/reason/process", payload);
97
+ return response.data;
98
+ }
99
+ catch (error) {
100
+ throw this.handleError(error);
101
+ }
102
+ }
103
+ handleError(error) {
104
+ const message = error.response?.data?.error?.message || error.message || "Unknown error";
105
+ const code = error.response?.data?.error?.type || error.code || "UNKNOWN_ERROR";
106
+ return new SylixError(code, message, error.response?.data);
107
+ }
108
+ }
109
+ // ============================================================================
110
+ // CHARLES v1 NAMESPACE (OpenAI-compatible)
111
+ // Owned by Sylix © 2025
112
+ // ============================================================================
113
+ /**
114
+ * Charles chat completions namespace
115
+ * Usage: sylix.charles.chat.completions.create()
116
+ */
117
+ class CharlesChatCompletions {
118
+ constructor(client) {
119
+ this.client = client;
120
+ }
121
+ /**
122
+ * Create a chat completion
123
+ * @param payload - Chat request parameters
124
+ * @returns Chat completion response
125
+ */
126
+ async create(payload) {
127
+ try {
128
+ const response = await this.client.getClient().post("/charles/chat/completions", payload);
129
+ return response.data;
130
+ }
131
+ catch (error) {
132
+ throw this.handleError(error);
133
+ }
134
+ }
135
+ handleError(error) {
136
+ const message = error.response?.data?.error?.message || error.message || "Unknown error";
137
+ const code = error.response?.data?.error?.code || error.code || "UNKNOWN_ERROR";
138
+ return new SylixError(code, message, error.response?.data);
139
+ }
140
+ }
141
+ /**
142
+ * Charles chat namespace
143
+ * Usage: sylix.charles.chat.completions
144
+ */
145
+ class CharlesChat {
146
+ constructor(client) {
147
+ this.completions = new CharlesChatCompletions(client);
148
+ }
149
+ }
150
+ /**
151
+ * Charles models namespace
152
+ * Usage: sylix.charles.models.list(), sylix.charles.models.retrieve()
153
+ */
154
+ class CharlesModels {
155
+ constructor(client) {
156
+ this.client = client;
157
+ }
158
+ /**
159
+ * List all available Charles models
160
+ * @returns List of Charles models
161
+ */
162
+ async list() {
163
+ try {
164
+ const response = await this.client.getClient().get("/charles/models");
165
+ return response.data;
166
+ }
167
+ catch (error) {
168
+ throw this.handleError(error);
169
+ }
170
+ }
171
+ /**
172
+ * Retrieve a specific model by ID
173
+ * @param modelId - Model ID (e.g., "charles-mini:latest" or "charles-mini")
174
+ * @returns Model details
175
+ */
176
+ async retrieve(modelId) {
177
+ try {
178
+ const response = await this.client.getClient().get(`/charles/models/${encodeURIComponent(modelId)}`);
179
+ return response.data;
180
+ }
181
+ catch (error) {
182
+ throw this.handleError(error);
183
+ }
184
+ }
185
+ handleError(error) {
186
+ const message = error.response?.data?.error?.message || error.message || "Unknown error";
187
+ const code = error.response?.data?.error?.code || error.code || "UNKNOWN_ERROR";
188
+ return new SylixError(code, message, error.response?.data);
189
+ }
190
+ }
191
+ /**
192
+ * Charles embeddings namespace
193
+ * Usage: sylix.charles.embeddings.create()
194
+ */
195
+ class CharlesEmbeddings {
196
+ constructor(client) {
197
+ this.client = client;
198
+ }
199
+ /**
200
+ * Create embeddings for text
201
+ * @param payload - Embedding request parameters
202
+ * @returns Embedding vectors
203
+ */
204
+ async create(payload) {
205
+ try {
206
+ const response = await this.client.getClient().post("/charles/embeddings", payload);
207
+ return response.data;
208
+ }
209
+ catch (error) {
210
+ throw this.handleError(error);
211
+ }
212
+ }
213
+ handleError(error) {
214
+ const message = error.response?.data?.error?.message || error.message || "Unknown error";
215
+ const code = error.response?.data?.error?.code || error.code || "UNKNOWN_ERROR";
216
+ return new SylixError(code, message, error.response?.data);
217
+ }
218
+ }
219
+ /**
220
+ * Charles main namespace (OpenAI-compatible)
221
+ *
222
+ * Provides access to all Charles v1 API endpoints:
223
+ * - chat.completions - Chat completions
224
+ * - models - Model listing and retrieval
225
+ * - embeddings - Text embeddings
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * const sylix = new Sylix({ apiKey: 'sk-...' });
230
+ *
231
+ * // Chat completion
232
+ * const response = await sylix.charles.chat.completions.create({
233
+ * model: 'charles-mini:latest',
234
+ * messages: [{ role: 'user', content: 'Hello!' }]
235
+ * });
236
+ *
237
+ * // List models
238
+ * const models = await sylix.charles.models.list();
239
+ * ```
240
+ */
241
+ class Charles {
242
+ constructor(client) {
243
+ this.chat = new CharlesChat(client);
244
+ this.models = new CharlesModels(client);
245
+ this.embeddings = new CharlesEmbeddings(client);
246
+ }
247
+ }
248
+ /**
249
+ * Main Sylix SDK class
250
+ */
251
+ export class Sylix {
252
+ constructor(config) {
253
+ this.client = new SylixClient(config);
254
+ this.chat = new ChatCompletions(this.client);
255
+ this.vision = new Vision(this.client);
256
+ this.code = new Code(this.client);
257
+ this.reason = new Reason(this.client);
258
+ this.charles = new Charles(this.client);
259
+ }
260
+ /**
261
+ * Get available models
262
+ */
263
+ models() {
264
+ return [
265
+ {
266
+ id: "charles-mini",
267
+ name: "Charles Mini",
268
+ displayName: "charles-mini:latest",
269
+ description: "Lightweight model for quick completions",
270
+ capabilities: ["code", "chat", "lightweight"],
271
+ tier: "free",
272
+ },
273
+ {
274
+ id: "charles-s1",
275
+ name: "Charles S1",
276
+ displayName: "charles-s1:latest",
277
+ description: "Standard reasoning model",
278
+ capabilities: ["code", "chat", "reasoning", "advanced"],
279
+ tier: "standard",
280
+ },
281
+ {
282
+ id: "charles-v1",
283
+ name: "Charles V1",
284
+ displayName: "charles-v1:latest",
285
+ description: "Advanced version 1 model",
286
+ capabilities: ["code", "chat", "reasoning", "advanced", "complex"],
287
+ tier: "advanced",
288
+ },
289
+ {
290
+ id: "charles-2.9",
291
+ name: "Charles 2.9",
292
+ displayName: "charles-2.9:latest",
293
+ description: "Latest version 2.9 model",
294
+ capabilities: [
295
+ "code",
296
+ "chat",
297
+ "reasoning",
298
+ "advanced",
299
+ "complex",
300
+ "latest",
301
+ ],
302
+ tier: "premium",
303
+ },
304
+ ];
305
+ }
306
+ /**
307
+ * Get a single model by ID
308
+ */
309
+ getModel(id) {
310
+ return this.models().find((m) => m.id === id || m.displayName === id);
311
+ }
312
+ }
313
+ // Exports
314
+ export { SylixError, CHARLES_MODELS, CHARLES_MODEL_IDS, } from "./types.js";
315
+ // Utilities
316
+ export { readFile, fileToBase64 };
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Sylix SDK Type Definitions
3
+ * OpenAI-style types for Charles models
4
+ */
5
+ export interface SylixConfig {
6
+ apiKey: string;
7
+ baseURL?: string;
8
+ timeout?: number;
9
+ headers?: Record<string, string>;
10
+ }
11
+ export interface ChatMessage {
12
+ role: "system" | "user" | "assistant";
13
+ content: string;
14
+ }
15
+ export interface ChatRequest {
16
+ model: string;
17
+ messages: ChatMessage[];
18
+ max_tokens?: number;
19
+ temperature?: number;
20
+ stream?: boolean;
21
+ }
22
+ export interface ChatChoice {
23
+ index: number;
24
+ message: ChatMessage;
25
+ finish_reason: string;
26
+ }
27
+ export interface ChatUsage {
28
+ prompt_tokens: number;
29
+ completion_tokens: number;
30
+ total_tokens: number;
31
+ }
32
+ export interface ChatResponse {
33
+ id: string;
34
+ object: string;
35
+ created: number;
36
+ model: string;
37
+ choices: ChatChoice[];
38
+ usage?: ChatUsage;
39
+ }
40
+ export interface VisionRequest {
41
+ model: string;
42
+ image: Buffer | string;
43
+ prompt: string;
44
+ }
45
+ export interface VisionResponse {
46
+ id: string;
47
+ object: string;
48
+ created: number;
49
+ model: string;
50
+ result: string;
51
+ usage?: ChatUsage;
52
+ }
53
+ export interface CodeRequest {
54
+ model: string;
55
+ prompt: string;
56
+ language?: string;
57
+ max_tokens?: number;
58
+ temperature?: number;
59
+ }
60
+ export interface CodeResponse {
61
+ id: string;
62
+ object: string;
63
+ created: number;
64
+ model: string;
65
+ code: string;
66
+ language?: string;
67
+ usage?: ChatUsage;
68
+ }
69
+ export interface ReasonRequest {
70
+ model: string;
71
+ prompt: string;
72
+ reasoning_type?: "step-by-step" | "chain-of-thought";
73
+ max_tokens?: number;
74
+ }
75
+ export interface ReasonResponse {
76
+ id: string;
77
+ object: string;
78
+ created: number;
79
+ model: string;
80
+ reasoning: string;
81
+ conclusion: string;
82
+ usage?: ChatUsage;
83
+ }
84
+ export interface ModelInfo {
85
+ id: string;
86
+ name: string;
87
+ displayName: string;
88
+ description: string;
89
+ capabilities: string[];
90
+ tier: string;
91
+ }
92
+ export interface SylixResponse<T> {
93
+ ok: boolean;
94
+ status: number;
95
+ data: T;
96
+ }
97
+ export declare class SylixError extends Error {
98
+ code: string;
99
+ raw?: any | undefined;
100
+ constructor(code: string, message: string, raw?: any | undefined);
101
+ }
102
+ export declare const CHARLES_MODELS: {
103
+ readonly MINI: "charles-mini:latest";
104
+ readonly S1: "charles-s1:latest";
105
+ readonly V1: "charles-v1:latest";
106
+ readonly V2_9: "charles-2.9:latest";
107
+ readonly R1: "charles-r1:latest";
108
+ readonly V3: "charles-v3:latest";
109
+ };
110
+ export declare const CHARLES_MODEL_IDS: ("charles-mini:latest" | "charles-s1:latest" | "charles-v1:latest" | "charles-2.9:latest" | "charles-r1:latest" | "charles-v3:latest")[];
111
+ /**
112
+ * Charles model object (OpenAI-compatible)
113
+ */
114
+ export interface CharlesModel {
115
+ id: string;
116
+ object: "model";
117
+ created: number;
118
+ owned_by: "sylix";
119
+ permission?: any[];
120
+ root?: string;
121
+ parent?: string | null;
122
+ }
123
+ /**
124
+ * Response from /v1/charles/models
125
+ */
126
+ export interface CharlesModelsListResponse {
127
+ object: "list";
128
+ data: CharlesModel[];
129
+ }
130
+ /**
131
+ * Request for /v1/charles/embeddings
132
+ */
133
+ export interface CharlesEmbeddingRequest {
134
+ model: string;
135
+ input: string | string[];
136
+ encoding_format?: "float" | "base64";
137
+ user?: string;
138
+ }
139
+ /**
140
+ * Individual embedding in response
141
+ */
142
+ export interface CharlesEmbedding {
143
+ object: "embedding";
144
+ embedding: number[];
145
+ index: number;
146
+ }
147
+ /**
148
+ * Response from /v1/charles/embeddings
149
+ */
150
+ export interface CharlesEmbeddingResponse {
151
+ object: "list";
152
+ data: CharlesEmbedding[];
153
+ model: string;
154
+ usage: {
155
+ prompt_tokens: number;
156
+ total_tokens: number;
157
+ };
158
+ }
159
+ /**
160
+ * Streaming chat completion chunk
161
+ */
162
+ export interface ChatCompletionChunk {
163
+ id: string;
164
+ object: "chat.completion.chunk";
165
+ created: number;
166
+ model: string;
167
+ choices: Array<{
168
+ index: number;
169
+ delta: {
170
+ role?: "assistant";
171
+ content?: string;
172
+ tool_calls?: any[];
173
+ };
174
+ finish_reason: string | null;
175
+ }>;
176
+ }
177
+ /**
178
+ * Tool definition for function calling
179
+ */
180
+ export interface CharlesFunctionTool {
181
+ type: "function";
182
+ function: {
183
+ name: string;
184
+ description?: string;
185
+ parameters?: Record<string, any>;
186
+ };
187
+ }
188
+ /**
189
+ * Extended chat request with all OpenAI-compatible options
190
+ */
191
+ export interface CharlesChatRequest extends ChatRequest {
192
+ tools?: CharlesFunctionTool[];
193
+ tool_choice?: "auto" | "none" | {
194
+ type: "function";
195
+ function: {
196
+ name: string;
197
+ };
198
+ };
199
+ presence_penalty?: number;
200
+ frequency_penalty?: number;
201
+ top_p?: number;
202
+ n?: number;
203
+ stop?: string | string[];
204
+ user?: string;
205
+ }
206
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,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Q,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACjF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
package/dist/types.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Sylix SDK Type Definitions
3
+ * OpenAI-style types for Charles models
4
+ */
5
+ export class SylixError extends Error {
6
+ constructor(code, message, raw) {
7
+ super(message);
8
+ this.code = code;
9
+ this.raw = raw;
10
+ this.name = "SylixError";
11
+ }
12
+ }
13
+ export const CHARLES_MODELS = {
14
+ MINI: "charles-mini:latest",
15
+ S1: "charles-s1:latest",
16
+ V1: "charles-v1:latest",
17
+ V2_9: "charles-2.9:latest",
18
+ R1: "charles-r1:latest",
19
+ V3: "charles-v3:latest",
20
+ };
21
+ export const CHARLES_MODEL_IDS = Object.values(CHARLES_MODELS);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Read a file and convert to base64
3
+ */
4
+ export declare function fileToBase64(filePath: string): Promise<string>;
5
+ /**
6
+ * Read a file
7
+ */
8
+ export declare function readFile(filePath: string): Promise<string>;
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGpE;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGhE"}
package/dist/utils.js ADDED
@@ -0,0 +1,15 @@
1
+ import { promises as fs } from "fs";
2
+ /**
3
+ * Read a file and convert to base64
4
+ */
5
+ export async function fileToBase64(filePath) {
6
+ const data = await fs.readFile(filePath);
7
+ return data.toString("base64");
8
+ }
9
+ /**
10
+ * Read a file
11
+ */
12
+ export async function readFile(filePath) {
13
+ const data = await fs.readFile(filePath, "utf-8");
14
+ return data;
15
+ }
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "sylix",
3
+ "version": "1.0.1",
4
+ "description": "The official Sylix AI SDK for TypeScript and JavaScript. Build intelligent applications with Charles v3 models featuring multi-model consensus, intelligent routing, vision understanding, deep reasoning, and OpenAI-compatible APIs. Enterprise-grade AI infrastructure for developers.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest",
24
+ "lint": "tsc --noEmit",
25
+ "prepublishOnly": "npm run build && npm run test",
26
+ "pack": "npm pack"
27
+ },
28
+ "keywords": [
29
+ "sylix",
30
+ "charles",
31
+ "ai",
32
+ "llm",
33
+ "sdk",
34
+ "openai",
35
+ "openai-compatible",
36
+ "chat",
37
+ "completion",
38
+ "vision",
39
+ "multimodal",
40
+ "reasoning",
41
+ "embeddings",
42
+ "api",
43
+ "machine-learning",
44
+ "deep-learning",
45
+ "artificial-intelligence",
46
+ "typescript",
47
+ "nodejs"
48
+ ],
49
+ "author": "Sylix Technologies <hello@sylixide.com> (https://sylixide.com)",
50
+ "license": "Proprietary",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/Curly-09/sylix-ide-sdk.git"
54
+ },
55
+ "bugs": {
56
+ "url": "https://github.com/Curly-09/sylix-ide-sdk/issues"
57
+ },
58
+ "homepage": "https://sylixide.com/sdk",
59
+ "dependencies": {
60
+ "axios": "^1.7.7"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^20.19.30",
64
+ "@vitest/ui": "^1.6.0",
65
+ "typescript": "^5.5.0",
66
+ "vitest": "^1.6.0"
67
+ },
68
+ "engines": {
69
+ "node": ">=18.0.0"
70
+ }
71
+ }