openliate 0.0.0-stage → 0.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +295 -2
  3. package/dist/bin.js +46374 -0
  4. package/dist/engine/engine.zip +0 -0
  5. package/dist/engine/index.js +36790 -0
  6. package/hub/agents/email-agent/agent.json +19 -0
  7. package/hub/agents/general-agent/agent.json +18 -0
  8. package/hub/agents/identity-agent/agent.json +19 -0
  9. package/hub/agents/research-agent/agent.json +18 -0
  10. package/hub/agents/sarvam-agent/agent.json +19 -0
  11. package/hub/llm/sarvam.json +27 -0
  12. package/hub/mcp/agentmail.json +10 -0
  13. package/hub/mcp/fetch.json +9 -0
  14. package/hub/mcp/neon.json +12 -0
  15. package/hub/mcp/sarvam.json +12 -0
  16. package/hub/mcp/supabase.json +12 -0
  17. package/hub/mcp/vercel.json +12 -0
  18. package/package.json +59 -4
  19. package/src/agent/agent.ts +165 -0
  20. package/src/agent/loop.ts +183 -0
  21. package/src/agent/types.ts +53 -0
  22. package/src/cli.ts +272 -0
  23. package/src/core/aum.ts +78 -0
  24. package/src/core/uuid.ts +19 -0
  25. package/src/engine/types.ts +104 -0
  26. package/src/environment/environment.ts +88 -0
  27. package/src/environment/types.ts +15 -0
  28. package/src/integration/integration.ts +37 -0
  29. package/src/integration/memory.ts +153 -0
  30. package/src/integration/types.ts +31 -0
  31. package/src/liate.ts +25 -0
  32. package/src/link/index.ts +317 -0
  33. package/src/link/neon.ts +646 -0
  34. package/src/link/supabase.ts +567 -0
  35. package/src/link/vercel.ts +633 -0
  36. package/src/llm/config.ts +46 -0
  37. package/src/llm/hub.ts +59 -0
  38. package/src/llm/llm.ts +60 -0
  39. package/src/llm/sarvam.ts +136 -0
  40. package/src/server/engine.ts +277 -0
  41. package/src/server/index.ts +32 -0
  42. package/src/tools/builtin/fetch.ts +66 -0
  43. package/src/tools/builtin/identity.ts +131 -0
  44. package/src/tools/mcp.ts +222 -0
  45. package/src/tools/registry.ts +218 -0
  46. package/src/tools/server.ts +70 -0
  47. package/src/tools/types.ts +37 -0
@@ -0,0 +1,153 @@
1
+ import fs from "fs/promises";
2
+ import path from "path";
3
+ import type { AgentMessage, MemoryProvider, SessionData } from "./types";
4
+
5
+ export class InMemorySession implements MemoryProvider {
6
+ public readonly sessionId: string;
7
+ private data: SessionData;
8
+
9
+ constructor(sessionId: string = "default", metadata?: Record<string, any>) {
10
+ this.sessionId = sessionId;
11
+ const now = new Date().toISOString();
12
+ this.data = {
13
+ sessionId,
14
+ createdAt: now,
15
+ updatedAt: now,
16
+ metadata: metadata || {},
17
+ messages: [],
18
+ state: {}
19
+ };
20
+ }
21
+
22
+ public async load(): Promise<SessionData> {
23
+ return this.data;
24
+ }
25
+
26
+ public async save(): Promise<void> {
27
+ this.data.updatedAt = new Date().toISOString();
28
+ }
29
+
30
+ public getMessages(): AgentMessage[] {
31
+ return [...this.data.messages];
32
+ }
33
+
34
+ public async append(message: AgentMessage | AgentMessage[]): Promise<void> {
35
+ const list = Array.isArray(message) ? message : [message];
36
+ for (const msg of list) {
37
+ this.data.messages.push({
38
+ ...msg,
39
+ timestamp: msg.timestamp ?? Date.now()
40
+ });
41
+ }
42
+ await this.save();
43
+ }
44
+
45
+ public getState(key: string): any {
46
+ return this.data.state[key];
47
+ }
48
+
49
+ public async setState(key: string, value: any): Promise<void> {
50
+ this.data.state[key] = value;
51
+ await this.save();
52
+ }
53
+
54
+ public async clear(): Promise<void> {
55
+ this.data.messages = [];
56
+ this.data.state = {};
57
+ await this.save();
58
+ }
59
+ }
60
+
61
+ export class FileSessionMemory implements MemoryProvider {
62
+ public readonly sessionId: string;
63
+ public readonly filePath: string;
64
+ private data: SessionData;
65
+ private loaded: boolean = false;
66
+
67
+ constructor(filePath: string, metadata?: Record<string, any>) {
68
+ const normalized = filePath.endsWith(".json") ? filePath : `${filePath}.json`;
69
+ this.filePath = path.isAbsolute(normalized) ? normalized : path.resolve(process.cwd(), normalized);
70
+ this.sessionId = path.basename(this.filePath, ".json");
71
+
72
+ const now = new Date().toISOString();
73
+ this.data = {
74
+ sessionId: this.sessionId,
75
+ createdAt: now,
76
+ updatedAt: now,
77
+ metadata: metadata || {},
78
+ messages: [],
79
+ state: {}
80
+ };
81
+ }
82
+
83
+ public async load(): Promise<SessionData> {
84
+ try {
85
+ const content = await fs.readFile(this.filePath, "utf-8");
86
+ const parsed = JSON.parse(content);
87
+ this.data = {
88
+ sessionId: parsed.sessionId || this.sessionId,
89
+ createdAt: parsed.createdAt || this.data.createdAt,
90
+ updatedAt: parsed.updatedAt || new Date().toISOString(),
91
+ metadata: { ...(this.data.metadata || {}), ...(parsed.metadata || {}) },
92
+ messages: Array.isArray(parsed.messages) ? parsed.messages : [],
93
+ state: parsed.state && typeof parsed.state === "object" ? parsed.state : {}
94
+ };
95
+ this.loaded = true;
96
+ } catch (err: any) {
97
+ if (err.code !== "ENOENT") {
98
+ throw new Error(`Failed to load session memory from ${this.filePath}: ${err.message}`);
99
+ }
100
+ // If file does not exist yet, initialize it
101
+ await this.save();
102
+ this.loaded = true;
103
+ }
104
+ return this.data;
105
+ }
106
+
107
+ public async save(): Promise<void> {
108
+ this.data.updatedAt = new Date().toISOString();
109
+ try {
110
+ const dir = path.dirname(this.filePath);
111
+ await fs.mkdir(dir, { recursive: true });
112
+ await fs.writeFile(this.filePath, JSON.stringify(this.data, null, 2), "utf-8");
113
+ } catch {
114
+ // In read-only cloud container environments (e.g. Neon Functions), gracefully persist in memory
115
+ }
116
+ }
117
+
118
+ public getMessages(): AgentMessage[] {
119
+ return [...this.data.messages];
120
+ }
121
+
122
+ public async append(message: AgentMessage | AgentMessage[]): Promise<void> {
123
+ if (!this.loaded) {
124
+ await this.load();
125
+ }
126
+ const list = Array.isArray(message) ? message : [message];
127
+ for (const msg of list) {
128
+ this.data.messages.push({
129
+ ...msg,
130
+ timestamp: msg.timestamp ?? Date.now()
131
+ });
132
+ }
133
+ await this.save();
134
+ }
135
+
136
+ public getState(key: string): any {
137
+ return this.data.state[key];
138
+ }
139
+
140
+ public async setState(key: string, value: any): Promise<void> {
141
+ if (!this.loaded) {
142
+ await this.load();
143
+ }
144
+ this.data.state[key] = value;
145
+ await this.save();
146
+ }
147
+
148
+ public async clear(): Promise<void> {
149
+ this.data.messages = [];
150
+ this.data.state = {};
151
+ await this.save();
152
+ }
153
+ }
@@ -0,0 +1,31 @@
1
+ export type MessageRole = "system" | "user" | "assistant" | "tool";
2
+
3
+ export interface AgentMessage {
4
+ role: MessageRole;
5
+ content: string;
6
+ name?: string;
7
+ toolCallId?: string;
8
+ toolCalls?: Array<{ id: string; name: string; arguments: Record<string, any> }>;
9
+ reasoningContent?: string;
10
+ timestamp?: number;
11
+ }
12
+
13
+ export interface SessionData {
14
+ sessionId: string;
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ metadata?: Record<string, any>;
18
+ messages: AgentMessage[];
19
+ state: Record<string, any>;
20
+ }
21
+
22
+ export interface MemoryProvider {
23
+ readonly sessionId: string;
24
+ load(): Promise<SessionData>;
25
+ save(): Promise<void>;
26
+ getMessages(): AgentMessage[];
27
+ append(message: AgentMessage | AgentMessage[]): Promise<void>;
28
+ getState(key: string): any;
29
+ setState(key: string, value: any): Promise<void>;
30
+ clear(): Promise<void>;
31
+ }
package/src/liate.ts ADDED
@@ -0,0 +1,25 @@
1
+ export * from "./agent/agent";
2
+ export * from "./agent/types";
3
+ export * from "./agent/loop";
4
+ export * from "./core/aum";
5
+ export * from "./engine/types";
6
+ export * from "./integration/memory";
7
+ export * from "./integration/types";
8
+ export * from "./integration/integration";
9
+ export * from "./llm/sarvam";
10
+ export * from "./llm/llm";
11
+ export * from "./llm/hub";
12
+ export * from "./tools/types";
13
+ export * from "./tools/mcp";
14
+ export * from "./tools/server";
15
+ export * from "./tools/registry";
16
+ export * from "./tools/builtin/fetch";
17
+ export * from "./tools/builtin/identity";
18
+ export * from "./environment/environment";
19
+ export * from "./environment/types";
20
+ export * from "./link/neon";
21
+ export * from "./link/index";
22
+ export * from "./server/engine";
23
+
24
+ // CLI entry point
25
+ import "./cli";
@@ -0,0 +1,317 @@
1
+ import { NeonMcpOAuth, NeonMcpClient, generatePKCE } from "./neon";
2
+ import { VercelMcpOAuth, VercelMcpClient, runVercelLinkFlow } from "./vercel";
3
+ import { SupabaseMcpOAuth, SupabaseMcpClient, runSupabaseLinkFlow } from "./supabase";
4
+
5
+ export interface LinkOptions {
6
+ provider?: "neon" | "vercel" | "supabase" | "both" | "all";
7
+ key?: string;
8
+ isDaemon?: boolean;
9
+ relink?: boolean;
10
+ }
11
+
12
+ export function printHowToRunAgent(runEndpoint: string, provider: "neon" | "vercel" | "supabase"): void {
13
+ const sarvamKey = process.env.SARVAM_API_KEY || "<YOUR_SARVAM_API_KEY>";
14
+ console.log("How to run an agent (5-Pillar L·I·A·T·E Architecture):\n");
15
+ console.log(" 1. Via cURL (Direct HTTP API with on-the-fly BYOAI key):");
16
+ console.log(` curl -X POST ${runEndpoint} \\`);
17
+ console.log(` -H "Content-Type: application/json" \\`);
18
+ console.log(` -d '{"prompt": "Namaste, who are you and what tools do you have?", "sessionId": "${provider}-session-1", "L": {"provider": "sarvam", "model": "sarvam-105b"}, "I": {"session": "${provider}-session-1"}, "A": {"name": "sovereign_agent", "intent": "Autonomous Sovereign Indic AI Agent"}, "T": ["mcp:sarvam"], "E": {}, "keys": {"SARVAM_API_KEY": "${sarvamKey}"}}'\n`);
19
+ console.log(" 2. Via PowerShell (Windows Invoke-RestMethod):");
20
+ console.log(` Invoke-RestMethod -Uri "${runEndpoint}" -Method Post -ContentType "application/json" -Body '{"prompt":"Namaste, who are you and what tools do you have?","sessionId":"${provider}-session-1","L":{"provider":"sarvam","model":"sarvam-105b"},"I":{"session":"${provider}-session-1"},"A":{"name":"sovereign_agent","intent":"Autonomous Sovereign Indic AI Agent"},"T":["mcp:sarvam"],"E":{},"keys":{"SARVAM_API_KEY":"${sarvamKey}"}}'\n`);
21
+ console.log(" 3. Via OpenLiate CLI (Local):");
22
+ console.log(` liate run hub/agents/sarvam-agent/agent.json "Namaste, who are you?"`);
23
+ console.log(` liate run hub/agents/email-agent/agent.json "Check new inboxes"\n`);
24
+ console.log("Refer to https://docs.openliate.tech for documentation, agents, and guides.\n");
25
+ }
26
+
27
+ export async function linkNeon(key?: string, relink: boolean = false): Promise<void> {
28
+ console.log(`\n===========================================================`);
29
+ console.log(`LIATE LINK — NEON CLOUD (REGIONAL POSTGRES MEMORY)`);
30
+ console.log(`===========================================================`);
31
+
32
+ if (relink) {
33
+ console.log("[OpenLiate] Relink requested. Clearing saved Neon tokens from disk...");
34
+ NeonMcpOAuth.clearSavedToken();
35
+ }
36
+
37
+ let token = relink ? undefined : (NeonMcpOAuth.loadSavedToken()?.access_token || key || process.env.NEON_API_KEY || process.env.NEON_MCP_TOKEN);
38
+
39
+ async function performNeonOAuth(): Promise<string> {
40
+ console.log("[OpenLiate] Registering Dynamic Client with Neon MCP Server (RFC 7591)...");
41
+ const reg = await NeonMcpOAuth.registerClient();
42
+ const { codeVerifier, codeChallenge } = generatePKCE();
43
+ const state = crypto.randomUUID();
44
+ const authUrl = NeonMcpOAuth.buildAuthorizeUrl({
45
+ clientId: reg.client_id,
46
+ codeChallenge,
47
+ state
48
+ });
49
+
50
+ console.log(`\n1. Authorize Neon access in your browser:\n ${authUrl}\n`);
51
+ try {
52
+ const openCmd = process.platform === "win32" ? `start "" "${authUrl}"` : process.platform === "darwin" ? `open "${authUrl}"` : `xdg-open "${authUrl}"`;
53
+ const { exec } = await import("child_process");
54
+ exec(openCmd);
55
+ } catch {}
56
+
57
+ const { code } = await NeonMcpOAuth.waitForCallback(54321);
58
+ const tokens = await NeonMcpOAuth.exchangeToken({
59
+ code,
60
+ codeVerifier,
61
+ clientId: reg.client_id,
62
+ clientSecret: reg.client_secret
63
+ });
64
+ return tokens.access_token;
65
+ }
66
+
67
+ if (!token) {
68
+ token = await performNeonOAuth();
69
+ }
70
+
71
+ console.log("✔ Linked to Neon Cloud via MCP OAuth!");
72
+ console.log("✔ 1,000,000 Free AI Agent Runs Unlocked (2 vCPU, 8GB RAM + pgvector).");
73
+ console.log("\n[OpenLiate] Deploying OpenLiate to Neon...");
74
+
75
+ let deployment;
76
+ try {
77
+ const client = new NeonMcpClient(token);
78
+ deployment = await client.deployEngine();
79
+ } catch (err: any) {
80
+ const isAuthError = err.message && (
81
+ err.message.includes("expired") ||
82
+ err.message.includes("invalid") ||
83
+ err.message.includes("401") ||
84
+ err.message.includes("Unauthorized")
85
+ );
86
+
87
+ if (isAuthError) {
88
+ console.log(`\n⚠️ Saved Neon token is expired or invalid. Auto-clearing and relinking via browser OAuth...`);
89
+ NeonMcpOAuth.clearSavedToken();
90
+ token = await performNeonOAuth();
91
+ console.log("✔ Relinked to Neon Cloud via MCP OAuth!");
92
+ console.log("\n[OpenLiate] Deploying OpenLiate to Neon...");
93
+ const client = new NeonMcpClient(token);
94
+ deployment = await client.deployEngine();
95
+ } else {
96
+ throw err;
97
+ }
98
+ }
99
+
100
+ const baseUrl = deployment.invocationUrl.replace(/\/+$/, "").replace(/\/run$/, "");
101
+ const runEndpoint = `${baseUrl}/run`;
102
+
103
+ console.log("\n===========================================================");
104
+ console.log("✔ OPENLIATE DEPLOYED LIVE TO NEON!");
105
+ console.log(`Project: ${deployment.projectName} (${deployment.projectId})`);
106
+ console.log(`Branch: ${deployment.branchName} (${deployment.branchId})`);
107
+ console.log(`Endpoint: ${baseUrl}`);
108
+ console.log(`Compute: Neon Functions (Scale-to-Zero Node.js)`);
109
+ console.log(`Capacity: 1,000,000 Free AI Agent Runs / Month`);
110
+ console.log("Memory [I]: Serverless Postgres + pgvector");
111
+ console.log("Triggers: Neon Function Triggers (Scale-to-Zero Scheduled Cron)");
112
+ console.log("Tooling: Remote MCP (HTTP/SSE) + Native Tools Enabled");
113
+ console.log("===========================================================\n");
114
+ printHowToRunAgent(runEndpoint, "neon");
115
+ }
116
+
117
+ export async function linkVercel(key?: string, isDaemon: boolean = false, relink: boolean = false): Promise<void> {
118
+ console.log(`\n===========================================================`);
119
+ if (isDaemon) {
120
+ console.log(`LIATE LINK — VERCEL CLOUD (CONTAINERIZED DAEMON WORKER)`);
121
+ } else {
122
+ console.log(`LIATE LINK — VERCEL CLOUD (FLUID COMPUTE FUNCTIONS)`);
123
+ }
124
+ console.log(`===========================================================`);
125
+
126
+ if (relink) {
127
+ console.log("[OpenLiate] Relink requested. Clearing saved Vercel tokens from disk...");
128
+ VercelMcpOAuth.clearToken();
129
+ }
130
+
131
+ let token = relink ? undefined : (VercelMcpOAuth.loadToken()?.access_token || key || process.env.VERCEL_TOKEN || process.env.VERCEL_MCP_TOKEN);
132
+
133
+ async function performVercelOAuth(): Promise<string> {
134
+ console.log("[OpenLiate] Starting Vercel MCP OAuth 2.0 Authorization (via https://mcp.vercel.com)...");
135
+ const tokenData = await runVercelLinkFlow({ port: 54322 });
136
+ return tokenData.access_token;
137
+ }
138
+
139
+ if (!token) {
140
+ token = await performVercelOAuth();
141
+ }
142
+
143
+ console.log("✔ Linked to Vercel Cloud via MCP OAuth!");
144
+ if (isDaemon) {
145
+ console.log("✔ Vercel Fluid Daemon Worker Unlocked (24/7 Container Execution).");
146
+ console.log("\n[OpenLiate] Deploying OpenLiate to Vercel...");
147
+ } else {
148
+ console.log("✔ 1,000,000 Free AI Agent Runs + Fluid Compute Functions Unlocked.");
149
+ console.log("\n[OpenLiate] Deploying OpenLiate to Vercel...");
150
+ }
151
+
152
+ let deployment;
153
+ try {
154
+ const client = new VercelMcpClient(token);
155
+ deployment = await client.deployEngine({
156
+ mode: isDaemon ? "daemon" : "function"
157
+ });
158
+ } catch (err: any) {
159
+ const isAuthError = err.message && (
160
+ err.message.includes("expired") ||
161
+ err.message.includes("invalid") ||
162
+ err.message.includes("401") ||
163
+ err.message.includes("Unauthorized")
164
+ );
165
+
166
+ if (isAuthError) {
167
+ console.log(`\n⚠️ Saved Vercel token is expired or invalid. Auto-clearing and relinking via browser OAuth...`);
168
+ VercelMcpOAuth.clearToken();
169
+ token = await performVercelOAuth();
170
+ console.log("✔ Relinked to Vercel Cloud via MCP OAuth!");
171
+ const client = new VercelMcpClient(token);
172
+ deployment = await client.deployEngine({
173
+ mode: isDaemon ? "daemon" : "function"
174
+ });
175
+ } else {
176
+ throw err;
177
+ }
178
+ }
179
+
180
+ console.log("\n===========================================================");
181
+ if (isDaemon) {
182
+ console.log("✔ OPENLIATE DAEMON WORKER DEPLOYED LIVE TO VERCEL!");
183
+ console.log(`Project: ${deployment.name} (${deployment.projectId})`);
184
+ console.log(`Deployment: ${deployment.url}`);
185
+ console.log(`Mode: Background Daemon Worker (Pull-based / Queue / Long-running)`);
186
+ console.log(`Runtime: Linux Node.js (Dedicated Worker)`);
187
+ console.log(`Instances: 1 Dedicated Worker Instance (iad1)`);
188
+ console.log("Tooling: Remote MCP (HTTP/SSE) + Native Tools Enabled");
189
+ console.log("===========================================================\n");
190
+ console.log("Daemon Operation & Monitoring:\n");
191
+ console.log(` 1. View live streaming daemon logs in Vercel Dashboard:`);
192
+ console.log(` https://vercel.com/dashboard -> Projects -> ${deployment.name} -> Logs\n`);
193
+ console.log(` 2. Daemons run continuously without inbound HTTP traffic, pulling`);
194
+ console.log(` and executing long-running agent tasks autonomously.\n`);
195
+ } else {
196
+ const baseUrl = (deployment.url || deployment.engineUrl).replace(/\/+$/, "").replace(/\/run$/, "");
197
+ const runEndpoint = `${baseUrl}/run`;
198
+
199
+ console.log("✔ OPENLIATE DEPLOYED LIVE TO VERCEL!");
200
+ console.log(`Project: ${deployment.name} (${deployment.projectId})`);
201
+ console.log(`Endpoint: ${baseUrl}`);
202
+ console.log(`Mode: Serverless Fluid Compute Function (Auto-scales to 0)`);
203
+ console.log(`Capacity: 1,000,000 Free AI Agent Runs / Month`);
204
+ console.log("Tooling: Remote MCP (HTTP/SSE) + Native Tools Enabled");
205
+ console.log("===========================================================\n");
206
+ printHowToRunAgent(runEndpoint, "vercel");
207
+ }
208
+ }
209
+
210
+ export async function linkSupabase(key?: string, relink: boolean = false): Promise<void> {
211
+ console.log(`\n===========================================================`);
212
+ console.log(`LIATE LINK — SUPABASE CLOUD (EDGE FUNCTIONS & PGVECTOR)`);
213
+ console.log(`===========================================================`);
214
+
215
+ if (relink) {
216
+ console.log("[OpenLiate] Relink requested. Clearing saved Supabase tokens from disk...");
217
+ SupabaseMcpOAuth.clearToken();
218
+ }
219
+
220
+ let token = relink ? undefined : (SupabaseMcpOAuth.loadToken()?.access_token || key || process.env.SUPABASE_MCP_TOKEN || process.env.SUPABASE_ACCESS_TOKEN);
221
+
222
+ async function performSupabaseOAuth(): Promise<string> {
223
+ console.log("[OpenLiate] Starting Supabase MCP OAuth 2.0 Authorization (via https://mcp.supabase.com)...");
224
+ const tokenData = await runSupabaseLinkFlow({ port: 54323 });
225
+ return tokenData.access_token;
226
+ }
227
+
228
+ if (!token) {
229
+ token = await performSupabaseOAuth();
230
+ }
231
+
232
+ console.log("✔ Linked to Supabase Cloud via MCP OAuth!");
233
+ console.log("✔ 500,000 Free AI Agent Runs + Edge Functions & pgvector Unlocked.");
234
+ console.log("\n[OpenLiate] Deploying OpenLiate to Supabase...");
235
+
236
+ let deployment;
237
+ try {
238
+ const client = new SupabaseMcpClient(token);
239
+ deployment = await client.deployEngine();
240
+ } catch (err: any) {
241
+ const isAuthError = err.message && (
242
+ err.message.includes("expired") ||
243
+ err.message.includes("invalid") ||
244
+ err.message.includes("401") ||
245
+ err.message.includes("Unauthorized")
246
+ );
247
+
248
+ if (isAuthError) {
249
+ console.log(`\n⚠️ Saved Supabase token is expired or invalid. Auto-clearing and relinking via browser OAuth...`);
250
+ SupabaseMcpOAuth.clearToken();
251
+ token = await performSupabaseOAuth();
252
+ console.log("✔ Relinked to Supabase Cloud via MCP OAuth!");
253
+ const client = new SupabaseMcpClient(token);
254
+ deployment = await client.deployEngine();
255
+ } else {
256
+ throw err;
257
+ }
258
+ }
259
+
260
+ const baseUrl = (deployment.functionUrl || deployment.engineUrl).replace(/\/+$/, "").replace(/\/run$/, "");
261
+ const runEndpoint = `${baseUrl}/run`;
262
+
263
+ console.log("\n===========================================================");
264
+ console.log("✔ OPENLIATE DEPLOYED LIVE TO SUPABASE!");
265
+ console.log(`Function: ${deployment.name}`);
266
+ console.log(`Project: ${deployment.projectRef}`);
267
+ console.log(`Endpoint: ${baseUrl}`);
268
+ console.log(`Capacity: 500,000 Free AI Agent Runs / Month`);
269
+ console.log("Tooling: Remote MCP (HTTP/SSE) + Native Tools Enabled");
270
+ console.log("Memory [I]: pgvector Embeddings & Realtime Postgres");
271
+ console.log("===========================================================\n");
272
+ printHowToRunAgent(runEndpoint, "supabase");
273
+ }
274
+
275
+ export async function unlink(provider: "neon" | "vercel" | "supabase" | "all" = "all"): Promise<void> {
276
+ console.log(`\n===========================================================`);
277
+ console.log(`LIATE UNLINK — CLOUD PROVIDER TOKENS`);
278
+ console.log(`===========================================================`);
279
+
280
+ if (provider === "neon" || provider === "all") {
281
+ NeonMcpOAuth.clearSavedToken();
282
+ console.log("✔ Unlinked from Neon Cloud (tokens cleared from disk and .env.local).");
283
+ }
284
+
285
+ if (provider === "vercel" || provider === "all") {
286
+ VercelMcpOAuth.clearToken();
287
+ console.log("✔ Unlinked from Vercel Cloud (tokens cleared from disk and .env.local).");
288
+ }
289
+
290
+ if (provider === "supabase" || provider === "all") {
291
+ SupabaseMcpOAuth.clearToken();
292
+ console.log("✔ Unlinked from Supabase Cloud (tokens cleared from disk and .env.local).");
293
+ }
294
+
295
+ console.log("===========================================================\n");
296
+ }
297
+
298
+ export async function relink(options: LinkOptions = {}): Promise<void> {
299
+ return link({ ...options, relink: true });
300
+ }
301
+
302
+ export async function link(options: LinkOptions = {}): Promise<void> {
303
+ const provider = options.provider || "all";
304
+ const shouldRelink = Boolean(options.relink);
305
+
306
+ if (provider === "neon" || provider === "both" || provider === "all") {
307
+ await linkNeon(options.key, shouldRelink);
308
+ }
309
+
310
+ if (provider === "vercel" || provider === "both" || provider === "all") {
311
+ await linkVercel(options.key, options.isDaemon, shouldRelink);
312
+ }
313
+
314
+ if (provider === "supabase" || provider === "all") {
315
+ await linkSupabase(options.key, shouldRelink);
316
+ }
317
+ }