openliate 0.0.1 → 0.1.5

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 (73) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +73 -241
  3. package/README.npm.md +128 -0
  4. package/dist/bin.js +24634 -42274
  5. package/dist/liate.js +39468 -0
  6. package/dist/runtime/hono.js +28061 -0
  7. package/dist/runtime/index.js +28061 -0
  8. package/hub/agents/docgyan-agent/agent.json +27 -0
  9. package/hub/agents/docgyan-agent/agent.ts +39 -0
  10. package/hub/agents/gnani-agent/agent.json +17 -0
  11. package/hub/agents/neon-agent/agent.json +18 -0
  12. package/hub/agents/prism-agent/agent.json +17 -0
  13. package/hub/agents/sarvam-agent/agent.json +1 -3
  14. package/package.json +33 -21
  15. package/src/cli/index.ts +346 -0
  16. package/src/cli/resolver.ts +153 -0
  17. package/src/core/aum.ts +87 -28
  18. package/src/core/om.ts +159 -0
  19. package/src/core/spec.ts +112 -0
  20. package/src/core/uuid.ts +5 -16
  21. package/src/core/version.ts +2 -0
  22. package/src/layers/agent/harness.ts +118 -0
  23. package/src/{agent → layers/agent}/loop.ts +44 -24
  24. package/src/layers/agent/skills.ts +302 -0
  25. package/src/{agent → layers/agent}/types.ts +14 -1
  26. package/src/{environment/environment.ts → layers/environment/sandbox.ts} +24 -5
  27. package/src/{environment → layers/environment}/types.ts +8 -0
  28. package/src/layers/integration/knowledge.ts +187 -0
  29. package/src/layers/integration/lib.ts +167 -0
  30. package/src/{integration → layers/integration}/memory.ts +49 -67
  31. package/src/layers/integration/repo.ts +273 -0
  32. package/src/{integration → layers/integration}/types.ts +60 -31
  33. package/src/layers/llm/model.ts +916 -0
  34. package/src/layers/llm/types.ts +64 -0
  35. package/src/{tools → layers/tools}/mcp.ts +24 -10
  36. package/src/layers/tools/registry.ts +307 -0
  37. package/src/{tools → layers/tools}/server.ts +12 -13
  38. package/src/{tools → layers/tools}/types.ts +3 -2
  39. package/src/liate.ts +64 -24
  40. package/src/routes/skills.ts +73 -0
  41. package/src/runtime/hono.ts +346 -0
  42. package/src/runtime/wasm.ts +23 -0
  43. package/src/scaffold/project.ts +188 -0
  44. package/dist/engine/engine.zip +0 -0
  45. package/dist/engine/index.js +0 -36790
  46. package/hub/agents/email-agent/agent.json +0 -19
  47. package/hub/agents/general-agent/agent.json +0 -18
  48. package/hub/agents/identity-agent/agent.json +0 -19
  49. package/hub/agents/research-agent/agent.json +0 -18
  50. package/hub/llm/sarvam.json +0 -27
  51. package/hub/mcp/agentmail.json +0 -10
  52. package/hub/mcp/fetch.json +0 -9
  53. package/hub/mcp/neon.json +0 -12
  54. package/hub/mcp/sarvam.json +0 -12
  55. package/hub/mcp/supabase.json +0 -12
  56. package/hub/mcp/vercel.json +0 -12
  57. package/src/agent/agent.ts +0 -165
  58. package/src/cli.ts +0 -272
  59. package/src/engine/types.ts +0 -104
  60. package/src/integration/integration.ts +0 -37
  61. package/src/link/index.ts +0 -317
  62. package/src/link/neon.ts +0 -646
  63. package/src/link/supabase.ts +0 -567
  64. package/src/link/vercel.ts +0 -633
  65. package/src/llm/config.ts +0 -46
  66. package/src/llm/hub.ts +0 -59
  67. package/src/llm/llm.ts +0 -60
  68. package/src/llm/sarvam.ts +0 -136
  69. package/src/server/engine.ts +0 -277
  70. package/src/server/index.ts +0 -32
  71. package/src/tools/builtin/fetch.ts +0 -66
  72. package/src/tools/builtin/identity.ts +0 -131
  73. package/src/tools/registry.ts +0 -218
@@ -1,633 +0,0 @@
1
- import { createHash, randomBytes } from "crypto";
2
- import http from "http";
3
- import fs from "fs";
4
- import path from "path";
5
- import os from "os";
6
- import { generateUUIDv7 } from "../core/uuid";
7
-
8
- export const VERCEL_MCP_ENDPOINT = "https://mcp.vercel.com";
9
- export const VERCEL_REGISTER_ENDPOINT = "https://vercel.com/api/login/oauth/register";
10
- export const VERCEL_AUTH_ENDPOINT = "https://vercel.com/oauth/authorize";
11
- export const VERCEL_TOKEN_ENDPOINT = "https://vercel.com/api/login/oauth/token";
12
- export const VERCEL_API_ENDPOINT = "https://api.vercel.com";
13
- export const DEFAULT_VERCEL_CALLBACK_PORT = 54322;
14
- export const DEFAULT_VERCEL_CALLBACK_URL = `http://localhost:${DEFAULT_VERCEL_CALLBACK_PORT}/callback`;
15
-
16
- export function base64url(buffer: Buffer): string {
17
- return buffer
18
- .toString("base64")
19
- .replace(/\+/g, "-")
20
- .replace(/\//g, "_")
21
- .replace(/=+$/, "");
22
- }
23
-
24
- export function generatePKCE() {
25
- const codeVerifier = base64url(randomBytes(32));
26
- const codeChallenge = base64url(createHash("sha256").update(codeVerifier).digest());
27
- return { codeVerifier, codeChallenge };
28
- }
29
-
30
- export interface VercelTokenData {
31
- access_token: string;
32
- refresh_token?: string;
33
- user_id?: string;
34
- team_id?: string;
35
- scope?: string;
36
- saved_at: string;
37
- }
38
-
39
- export interface ClientRegistration {
40
- client_id: string;
41
- client_secret?: string;
42
- }
43
-
44
- export class VercelMcpOAuth {
45
- public static getTokenPath(): string {
46
- if (process.env.LIATE_CONFIG_DIR) {
47
- if (!fs.existsSync(process.env.LIATE_CONFIG_DIR)) {
48
- fs.mkdirSync(process.env.LIATE_CONFIG_DIR, { recursive: true });
49
- }
50
- return path.join(process.env.LIATE_CONFIG_DIR, "vercel_token.json");
51
- }
52
-
53
- const candidateDirs = [
54
- path.resolve(process.cwd(), ".liate"),
55
- path.resolve(process.cwd(), "..", ".liate"),
56
- path.resolve(__dirname, "..", "..", ".liate")
57
- ];
58
-
59
- for (const d of candidateDirs) {
60
- try {
61
- if (!fs.existsSync(d)) {
62
- fs.mkdirSync(d, { recursive: true });
63
- }
64
- return path.join(d, "vercel_token.json");
65
- } catch {}
66
- }
67
-
68
- try {
69
- const homeDir = path.join(os.homedir(), ".liate");
70
- if (!fs.existsSync(homeDir)) {
71
- fs.mkdirSync(homeDir, { recursive: true });
72
- }
73
- return path.join(homeDir, "vercel_token.json");
74
- } catch {
75
- return path.resolve(process.cwd(), ".liate", "vercel_token.json");
76
- }
77
- }
78
-
79
- public static loadToken(): VercelTokenData | null {
80
- const candidatePaths = [
81
- VercelMcpOAuth.getTokenPath(),
82
- path.resolve(process.cwd(), ".liate", "vercel_token.json"),
83
- path.resolve(process.cwd(), "..", ".liate", "vercel_token.json"),
84
- path.join(os.homedir(), ".liate", "vercel_token.json")
85
- ];
86
-
87
- for (const p of candidatePaths) {
88
- try {
89
- if (fs.existsSync(p)) {
90
- const raw = fs.readFileSync(p, "utf-8");
91
- const data = JSON.parse(raw) as VercelTokenData;
92
- if (data && data.access_token) {
93
- return data;
94
- }
95
- }
96
- } catch {}
97
- }
98
-
99
- const envToken = process.env.VERCEL_TOKEN || process.env.VERCEL_MCP_TOKEN;
100
- if (envToken) {
101
- return {
102
- access_token: envToken,
103
- saved_at: new Date().toISOString()
104
- };
105
- }
106
-
107
- return null;
108
- }
109
-
110
- public static saveToken(data: VercelTokenData): void {
111
- const tokenPath = VercelMcpOAuth.getTokenPath();
112
- const dir = path.dirname(tokenPath);
113
- if (!fs.existsSync(dir)) {
114
- fs.mkdirSync(dir, { recursive: true });
115
- }
116
- fs.writeFileSync(tokenPath, JSON.stringify(data, null, 2), "utf-8");
117
-
118
- try {
119
- const mirrorPath = path.resolve(process.cwd(), ".liate", "vercel_token.json");
120
- const mirrorDir = path.dirname(mirrorPath);
121
- if (!fs.existsSync(mirrorDir)) {
122
- fs.mkdirSync(mirrorDir, { recursive: true });
123
- }
124
- fs.writeFileSync(mirrorPath, JSON.stringify(data, null, 2), "utf-8");
125
- } catch {}
126
-
127
- try {
128
- const envPath = path.join(process.cwd(), ".env.local");
129
- let content = fs.existsSync(envPath) ? fs.readFileSync(envPath, "utf-8") : "";
130
- if (content.includes("VERCEL_TOKEN=")) {
131
- content = content.replace(/VERCEL_TOKEN=.*(\r?\n|$)/, `VERCEL_TOKEN=${data.access_token}\n`);
132
- } else {
133
- content += `\n# OpenLiate Vercel MCP Access Token\nVERCEL_TOKEN=${data.access_token}\n`;
134
- }
135
- fs.writeFileSync(envPath, content, "utf-8");
136
- } catch {}
137
- }
138
-
139
- public static clearToken(): void {
140
- const candidatePaths = [
141
- process.env.LIATE_CONFIG_DIR ? path.join(process.env.LIATE_CONFIG_DIR, "vercel_token.json") : "",
142
- VercelMcpOAuth.getTokenPath(),
143
- path.resolve(process.cwd(), ".liate", "vercel_token.json"),
144
- path.resolve(process.cwd(), "..", ".liate", "vercel_token.json"),
145
- path.resolve(__dirname, "..", "..", ".liate", "vercel_token.json"),
146
- path.resolve(os.homedir(), ".liate", "vercel_token.json")
147
- ].filter(Boolean);
148
-
149
- for (const p of candidatePaths) {
150
- try {
151
- if (fs.existsSync(p)) {
152
- fs.unlinkSync(p);
153
- }
154
- } catch {}
155
- }
156
-
157
- try {
158
- const envPath = path.join(process.cwd(), ".env.local");
159
- if (fs.existsSync(envPath)) {
160
- let content = fs.readFileSync(envPath, "utf-8");
161
- content = content.replace(/VERCEL_TOKEN=.*(\r?\n|$)/g, "");
162
- fs.writeFileSync(envPath, content.trim() + "\n", "utf-8");
163
- }
164
- } catch {}
165
-
166
- delete process.env.VERCEL_TOKEN;
167
- delete process.env.VERCEL_MCP_TOKEN;
168
- }
169
-
170
- public static async registerClient(callbackUrl: string): Promise<ClientRegistration> {
171
- try {
172
- const res = await fetch(VERCEL_REGISTER_ENDPOINT, {
173
- method: "POST",
174
- headers: { "Content-Type": "application/json" },
175
- body: JSON.stringify({
176
- client_name: "OpenLiate CLI Vercel MCP",
177
- client_uri: "https://openliate.tech",
178
- redirect_uris: [callbackUrl],
179
- grant_types: ["authorization_code", "refresh_token"],
180
- response_types: ["code"],
181
- token_endpoint_auth_method: "none"
182
- })
183
- });
184
-
185
- if (res.ok) {
186
- const body = (await res.json()) as any;
187
- if (body.client_id) {
188
- return {
189
- client_id: body.client_id,
190
- client_secret: body.client_secret
191
- };
192
- }
193
- }
194
- } catch {}
195
-
196
- return {
197
- client_id: "openliate-vercel-mcp-cli"
198
- };
199
- }
200
-
201
- public static buildAuthUrl(
202
- clientId: string,
203
- redirectUri: string,
204
- codeChallenge: string,
205
- state: string
206
- ): string {
207
- const url = new URL(VERCEL_AUTH_ENDPOINT);
208
- url.searchParams.set("client_id", clientId);
209
- url.searchParams.set("response_type", "code");
210
- url.searchParams.set("redirect_uri", redirectUri);
211
- url.searchParams.set("scope", "openid email offline_access profile");
212
- url.searchParams.set("code_challenge", codeChallenge);
213
- url.searchParams.set("code_challenge_method", "S256");
214
- url.searchParams.set("state", state);
215
- url.searchParams.set("resource", "https://mcp.vercel.com/");
216
- return url.toString();
217
- }
218
-
219
- public static async exchangeCodeForToken(
220
- clientId: string,
221
- code: string,
222
- codeVerifier: string,
223
- redirectUri: string
224
- ): Promise<VercelTokenData> {
225
- const params = new URLSearchParams({
226
- grant_type: "authorization_code",
227
- code: code,
228
- redirect_uri: redirectUri,
229
- client_id: clientId,
230
- code_verifier: codeVerifier
231
- });
232
-
233
- const res = await fetch(VERCEL_TOKEN_ENDPOINT, {
234
- method: "POST",
235
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
236
- body: params
237
- });
238
-
239
- if (!res.ok) {
240
- const errText = await res.text();
241
- throw new Error(`Vercel MCP token exchange failed (${res.status}): ${errText}`);
242
- }
243
-
244
- const data = (await res.json()) as any;
245
- if (!data.access_token) {
246
- throw new Error("No access_token returned by Vercel token endpoint");
247
- }
248
-
249
- return {
250
- access_token: data.access_token,
251
- refresh_token: data.refresh_token,
252
- user_id: data.user_id,
253
- team_id: data.team_id,
254
- scope: data.scope,
255
- saved_at: new Date().toISOString()
256
- };
257
- }
258
- }
259
-
260
- export class VercelMcpClient {
261
- private token: string;
262
-
263
- constructor(token: string) {
264
- this.token = token;
265
- }
266
-
267
- public async callMcp(method: string, params: Record<string, any> = {}): Promise<any> {
268
- const rpcPayload = {
269
- jsonrpc: "2.0",
270
- id: Date.now(),
271
- method: method,
272
- params: params
273
- };
274
-
275
- const res = await fetch(VERCEL_MCP_ENDPOINT, {
276
- method: "POST",
277
- headers: {
278
- "Content-Type": "application/json",
279
- Authorization: `Bearer ${this.token}`,
280
- Accept: "application/json, text/event-stream"
281
- },
282
- body: JSON.stringify(rpcPayload)
283
- });
284
-
285
- const text = await res.text();
286
- const match = text.match(/data: ({.*})/);
287
- if (match) {
288
- return JSON.parse(match[1]);
289
- }
290
- try {
291
- return JSON.parse(text);
292
- } catch {
293
- return { raw: text };
294
- }
295
- }
296
-
297
- public async listProjects(): Promise<any[]> {
298
- const res = await fetch(`${VERCEL_API_ENDPOINT}/v9/projects?limit=50`, {
299
- headers: {
300
- Authorization: `Bearer ${this.token}`
301
- }
302
- });
303
-
304
- if (res.ok) {
305
- const data = (await res.json()) as any;
306
- return data.projects || [];
307
- }
308
-
309
- const mcpRes = await this.callMcp("tools/call", {
310
- name: "list_projects",
311
- arguments: {}
312
- });
313
- try {
314
- const content = mcpRes.result?.content?.[0]?.text;
315
- return content ? JSON.parse(content) : [];
316
- } catch {
317
- return [];
318
- }
319
- }
320
-
321
- public async deployEngine(options: {
322
- name?: string;
323
- target?: string;
324
- mode?: "function" | "daemon";
325
- files?: Array<{ file: string; data: string; encoding?: string }>;
326
- } = {}): Promise<{
327
- id: string;
328
- url: string;
329
- engineUrl: string;
330
- projectId?: string;
331
- name: string;
332
- mode: "function" | "daemon";
333
- }> {
334
- const isDaemon = options.mode === "daemon";
335
- const uuid7 = generateUUIDv7();
336
- const cleanId = uuid7.replace(/-/g, "").slice(0, 8);
337
- const projectName = options.name || (isDaemon ? "openliate-daemon" : "openliate");
338
-
339
- let bundleCode = "";
340
- if (options.files && options.files.length > 0) {
341
- const targetFile = options.files.find((f) => f.file === "api/index.js" || f.file === "dist/engine/index.js");
342
- if (targetFile) bundleCode = targetFile.data;
343
- }
344
-
345
- if (!bundleCode) {
346
- const candidatePaths = [
347
- path.resolve(process.cwd(), "dist", "engine", "index.js"),
348
- path.resolve(process.cwd(), "liate", "dist", "engine", "index.js"),
349
- path.resolve(__dirname, "..", "..", "dist", "engine", "index.js")
350
- ];
351
- for (const p of candidatePaths) {
352
- if (fs.existsSync(p)) {
353
- bundleCode = fs.readFileSync(p, "utf-8");
354
- break;
355
- }
356
- }
357
- }
358
-
359
- if (!bundleCode) {
360
- throw new Error(
361
- "Could not locate dist/engine/index.js. Please run 'bun run build:engine' first."
362
- );
363
- }
364
-
365
- let files: Array<{ file: string; data: string; encoding?: string }>;
366
-
367
- if (isDaemon) {
368
- let dockerfileContent = "";
369
- const dockerfileCandidates = [
370
- path.resolve(process.cwd(), "Dockerfile"),
371
- path.resolve(process.cwd(), "liate", "Dockerfile"),
372
- path.resolve(__dirname, "..", "..", "Dockerfile")
373
- ];
374
- for (const df of dockerfileCandidates) {
375
- if (fs.existsSync(df)) {
376
- dockerfileContent = fs.readFileSync(df, "utf-8");
377
- break;
378
- }
379
- }
380
- if (!dockerfileContent) {
381
- dockerfileContent = `FROM node:24-alpine
382
- WORKDIR /app
383
- COPY dist/engine ./dist/engine
384
- COPY package.json ./package.json
385
- EXPOSE 3000
386
- CMD ["node", "dist/engine/index.js"]`;
387
- }
388
-
389
- files = [
390
- {
391
- file: "dist/engine/index.js",
392
- data: bundleCode,
393
- encoding: "utf-8"
394
- },
395
- {
396
- file: "Dockerfile",
397
- data: dockerfileContent,
398
- encoding: "utf-8"
399
- },
400
- {
401
- file: "package.json",
402
- data: JSON.stringify(
403
- {
404
- name: projectName,
405
- version: "1.0.0",
406
- type: "module",
407
- main: "dist/engine/index.js"
408
- },
409
- null,
410
- 2
411
- ),
412
- encoding: "utf-8"
413
- },
414
- {
415
- file: "vercel.json",
416
- data: JSON.stringify(
417
- {
418
- version: 2,
419
- daemons: {
420
- "liate-daemon": {
421
- entrypoint: "Dockerfile",
422
- command: ["node", "dist/engine/index.js"],
423
- instances: {
424
- iad1: 1
425
- }
426
- }
427
- }
428
- },
429
- null,
430
- 2
431
- ),
432
- encoding: "utf-8"
433
- }
434
- ];
435
- } else {
436
- files = [
437
- {
438
- file: "api/index.js",
439
- data: bundleCode,
440
- encoding: "utf-8"
441
- },
442
- {
443
- file: "package.json",
444
- data: JSON.stringify(
445
- {
446
- name: projectName,
447
- version: "1.0.0",
448
- type: "module",
449
- main: "api/index.js"
450
- },
451
- null,
452
- 2
453
- ),
454
- encoding: "utf-8"
455
- },
456
- {
457
- file: "vercel.json",
458
- data: JSON.stringify(
459
- {
460
- version: 2,
461
- routes: [
462
- {
463
- src: "/(.*)",
464
- dest: "/api/index.js"
465
- }
466
- ]
467
- },
468
- null,
469
- 2
470
- ),
471
- encoding: "utf-8"
472
- }
473
- ];
474
- }
475
-
476
- const deployPayload = {
477
- name: projectName,
478
- target: options.target || "production",
479
- files,
480
- projectSettings: {
481
- framework: null
482
- }
483
- };
484
-
485
- const deployRes = await fetch(
486
- `${VERCEL_API_ENDPOINT}/v13/deployments?skipAutoDetectionConfirmation=1`,
487
- {
488
- method: "POST",
489
- headers: {
490
- "Content-Type": "application/json",
491
- Authorization: `Bearer ${this.token}`
492
- },
493
- body: JSON.stringify(deployPayload)
494
- }
495
- );
496
-
497
- const deployData = (await deployRes.json()) as any;
498
- if (!deployRes.ok || !deployData.url) {
499
- throw new Error(
500
- `Vercel deployment failed (${deployRes.status}): ${deployData.error?.message || "Unknown error"}`
501
- );
502
- }
503
-
504
- const rawUrl = deployData.alias?.[0] || deployData.url;
505
- const deploymentUrl = rawUrl.startsWith("http") ? rawUrl : `https://${rawUrl}`;
506
- const engineUrl = `${deploymentUrl}/run`;
507
-
508
- try {
509
- const deployPath = path.resolve(process.cwd(), ".liate", "vercel_deployment.json");
510
- const deployDir = path.dirname(deployPath);
511
- if (!fs.existsSync(deployDir)) {
512
- fs.mkdirSync(deployDir, { recursive: true });
513
- }
514
- fs.writeFileSync(
515
- deployPath,
516
- JSON.stringify(
517
- {
518
- projectName,
519
- deploymentUrl,
520
- engineUrl,
521
- id: deployData.id,
522
- uuid7,
523
- deployedAt: new Date().toISOString()
524
- },
525
- null,
526
- 2
527
- ),
528
- "utf-8"
529
- );
530
- } catch {}
531
-
532
- return {
533
- id: deployData.id,
534
- url: deploymentUrl,
535
- engineUrl,
536
- projectId: deployData.project?.id || deployData.projectId || deployData.id,
537
- name: projectName,
538
- mode: isDaemon ? "daemon" : "function"
539
- };
540
- }
541
- }
542
-
543
- export async function runVercelLinkFlow(options: {
544
- port?: number;
545
- openBrowser?: boolean;
546
- } = {}): Promise<VercelTokenData> {
547
- const port = options.port || DEFAULT_VERCEL_CALLBACK_PORT;
548
- const redirectUri = `http://localhost:${port}/callback`;
549
-
550
- console.log(`\n▲ [OpenLiate] Registering Dynamic Client with Vercel MCP...`);
551
- const reg = await VercelMcpOAuth.registerClient(redirectUri);
552
-
553
- const { codeVerifier, codeChallenge } = generatePKCE();
554
- const state = base64url(randomBytes(16));
555
-
556
- const authUrl = VercelMcpOAuth.buildAuthUrl(reg.client_id, redirectUri, codeChallenge, state);
557
-
558
- return new Promise<VercelTokenData>((resolve, reject) => {
559
- const server = http.createServer(async (req, res) => {
560
- try {
561
- const reqUrl = new URL(req.url || "/", `http://localhost:${port}`);
562
- if (reqUrl.pathname === "/callback") {
563
- const code = reqUrl.searchParams.get("code");
564
- const retState = reqUrl.searchParams.get("state");
565
- const error = reqUrl.searchParams.get("error");
566
-
567
- if (error) {
568
- res.writeHead(400, { "Content-Type": "text/html" });
569
- res.end(`<h3>Vercel MCP Link Failed</h3><p>${error}</p>`);
570
- server.close();
571
- return reject(new Error(`Vercel OAuth Error: ${error}`));
572
- }
573
-
574
- if (!code || retState !== state) {
575
- res.writeHead(400, { "Content-Type": "text/html" });
576
- res.end(`<h3>Invalid State or Missing Code</h3>`);
577
- server.close();
578
- return reject(new Error("State mismatch or missing authorization code"));
579
- }
580
-
581
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
582
- res.end(`<!DOCTYPE html>
583
- <html>
584
- <head>
585
- <meta charset="utf-8">
586
- <title>Liate — Authentication Successful</title>
587
- </head>
588
- <body style="font-family: -apple-system, system-ui, sans-serif; padding: 40px; text-align: center; color: #111;">
589
- <h2>Authentication successful</h2>
590
- <p>You can close this window and return to your terminal.</p>
591
- <script>try { window.close(); } catch(e) {}</script>
592
- </body>
593
- </html>`);
594
- server.close();
595
-
596
- console.log(`▲ [OpenLiate] Exchanging Authorization Code with Vercel...`);
597
- const tokenData = await VercelMcpOAuth.exchangeCodeForToken(
598
- reg.client_id,
599
- code,
600
- codeVerifier,
601
- redirectUri
602
- );
603
-
604
- VercelMcpOAuth.saveToken(tokenData);
605
- console.log(`▲ [OpenLiate] Vercel MCP Access Token saved successfully!`);
606
- resolve(tokenData);
607
- }
608
- } catch (err) {
609
- server.close();
610
- reject(err);
611
- }
612
- });
613
-
614
- server.listen(port, () => {
615
- console.log(`\n▲ [OpenLiate] Complete authorization in your browser:\n`);
616
- console.log(` ${authUrl}\n`);
617
-
618
- if (options.openBrowser !== false) {
619
- try {
620
- const { exec } = require("child_process");
621
- const startCmd =
622
- process.platform === "win32"
623
- ? `start "" "${authUrl}"`
624
- : process.platform === "darwin"
625
- ? `open "${authUrl}"`
626
- : `xdg-open "${authUrl}"`;
627
- exec(startCmd);
628
- } catch {}
629
- }
630
- });
631
- });
632
- }
633
-
package/src/llm/config.ts DELETED
@@ -1,46 +0,0 @@
1
- import type { ModelConfig } from "../engine/types";
2
-
3
- export interface NormalizedModel {
4
- provider: "sarvam" | "openai" | "anthropic" | "google" | "ollama" | "custom";
5
- model: string;
6
- temperature?: number;
7
- maxTokens?: number;
8
- endpoint?: string;
9
- }
10
-
11
- export function normalizeModelConfig(input: string | ModelConfig): NormalizedModel {
12
- if (typeof input === "string") {
13
- const parts = input.split("/");
14
- if (parts.length === 2) {
15
- const provider = parts[0].toLowerCase();
16
- const model = parts[1];
17
- return {
18
- provider: mapProvider(provider),
19
- model
20
- };
21
- }
22
- return {
23
- provider: "sarvam",
24
- model: input
25
- };
26
- }
27
-
28
- return {
29
- provider: mapProvider(input.provider),
30
- model: input.model,
31
- temperature: input.temperature,
32
- maxTokens: input.maxTokens,
33
- endpoint: input.endpoint
34
- };
35
- }
36
-
37
- function mapProvider(provider: string): NormalizedModel["provider"] {
38
- const p = provider.toLowerCase();
39
- if (p === "sarvam") return "sarvam";
40
- if (p === "openai") return "openai";
41
- if (p === "anthropic" || p === "claude") return "anthropic";
42
- if (p === "google" || p === "gemini") return "google";
43
- if (p === "ollama") return "ollama";
44
- return "custom";
45
- }
46
-