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.
- package/LICENSE +21 -21
- package/README.md +73 -241
- package/README.npm.md +128 -0
- package/dist/bin.js +24634 -42274
- package/dist/liate.js +39468 -0
- package/dist/runtime/hono.js +28061 -0
- package/dist/runtime/index.js +28061 -0
- package/hub/agents/docgyan-agent/agent.json +27 -0
- package/hub/agents/docgyan-agent/agent.ts +39 -0
- package/hub/agents/gnani-agent/agent.json +17 -0
- package/hub/agents/neon-agent/agent.json +18 -0
- package/hub/agents/prism-agent/agent.json +17 -0
- package/hub/agents/sarvam-agent/agent.json +1 -3
- package/package.json +33 -21
- package/src/cli/index.ts +346 -0
- package/src/cli/resolver.ts +153 -0
- package/src/core/aum.ts +87 -28
- package/src/core/om.ts +159 -0
- package/src/core/spec.ts +112 -0
- package/src/core/uuid.ts +5 -16
- package/src/core/version.ts +2 -0
- package/src/layers/agent/harness.ts +118 -0
- package/src/{agent → layers/agent}/loop.ts +44 -24
- package/src/layers/agent/skills.ts +302 -0
- package/src/{agent → layers/agent}/types.ts +14 -1
- package/src/{environment/environment.ts → layers/environment/sandbox.ts} +24 -5
- package/src/{environment → layers/environment}/types.ts +8 -0
- package/src/layers/integration/knowledge.ts +187 -0
- package/src/layers/integration/lib.ts +167 -0
- package/src/{integration → layers/integration}/memory.ts +49 -67
- package/src/layers/integration/repo.ts +273 -0
- package/src/{integration → layers/integration}/types.ts +60 -31
- package/src/layers/llm/model.ts +916 -0
- package/src/layers/llm/types.ts +64 -0
- package/src/{tools → layers/tools}/mcp.ts +24 -10
- package/src/layers/tools/registry.ts +307 -0
- package/src/{tools → layers/tools}/server.ts +12 -13
- package/src/{tools → layers/tools}/types.ts +3 -2
- package/src/liate.ts +64 -24
- package/src/routes/skills.ts +73 -0
- package/src/runtime/hono.ts +346 -0
- package/src/runtime/wasm.ts +23 -0
- package/src/scaffold/project.ts +188 -0
- package/dist/engine/engine.zip +0 -0
- package/dist/engine/index.js +0 -36790
- package/hub/agents/email-agent/agent.json +0 -19
- package/hub/agents/general-agent/agent.json +0 -18
- package/hub/agents/identity-agent/agent.json +0 -19
- package/hub/agents/research-agent/agent.json +0 -18
- package/hub/llm/sarvam.json +0 -27
- package/hub/mcp/agentmail.json +0 -10
- package/hub/mcp/fetch.json +0 -9
- package/hub/mcp/neon.json +0 -12
- package/hub/mcp/sarvam.json +0 -12
- package/hub/mcp/supabase.json +0 -12
- package/hub/mcp/vercel.json +0 -12
- package/src/agent/agent.ts +0 -165
- package/src/cli.ts +0 -272
- package/src/engine/types.ts +0 -104
- package/src/integration/integration.ts +0 -37
- package/src/link/index.ts +0 -317
- package/src/link/neon.ts +0 -646
- package/src/link/supabase.ts +0 -567
- package/src/link/vercel.ts +0 -633
- package/src/llm/config.ts +0 -46
- package/src/llm/hub.ts +0 -59
- package/src/llm/llm.ts +0 -60
- package/src/llm/sarvam.ts +0 -136
- package/src/server/engine.ts +0 -277
- package/src/server/index.ts +0 -32
- package/src/tools/builtin/fetch.ts +0 -66
- package/src/tools/builtin/identity.ts +0 -131
- package/src/tools/registry.ts +0 -218
package/src/engine/types.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LIATE — Open Source Backend Layer for AI Agents
|
|
3
|
-
*
|
|
4
|
-
* "If Stripe did payments in 7 lines of code, why not AI Agents in 5 lines of code?"
|
|
5
|
-
* "Don't build AI agents. Integrate by parts."
|
|
6
|
-
*
|
|
7
|
-
* The 5 Orthogonal Layers (NVIDIA Keynote Alignment):
|
|
8
|
-
* L[LM] — Model
|
|
9
|
-
* I[ntegration] — Knowledge & State
|
|
10
|
-
* A[gent] — Harness & Reasoning Loop
|
|
11
|
-
* T[ools] — Tools & MCP
|
|
12
|
-
* E[nvironment] — Sandbox & Security
|
|
13
|
-
*
|
|
14
|
-
* Slogan: "Let's Try Liate."
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* [L] Large Models Layer
|
|
19
|
-
* Any Model: Text LLMs, Image Gen (Nano Banana), Video Gen (SeaDance), Decision Models (OpenJev).
|
|
20
|
-
* Foundation models are cognitive inputs, NEVER actuators/tools.
|
|
21
|
-
*/
|
|
22
|
-
export type LayerL =
|
|
23
|
-
| string
|
|
24
|
-
| {
|
|
25
|
-
provider?: string;
|
|
26
|
-
model: string;
|
|
27
|
-
baseUrl?: string;
|
|
28
|
-
apiKey?: string;
|
|
29
|
-
temperature?: number;
|
|
30
|
-
maxTokens?: number;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* [I] Integration Layer
|
|
35
|
-
* Any Integration: Libraries (Zod), Memory, Context Window, Persistent State,
|
|
36
|
-
* Neon Postgres, Frameworks (LlamaIndex), Webhooks, Git Repos.
|
|
37
|
-
*/
|
|
38
|
-
export interface LayerI {
|
|
39
|
-
memory?: string;
|
|
40
|
-
state?: Record<string, unknown>;
|
|
41
|
-
database?: string;
|
|
42
|
-
webhooks?: string[];
|
|
43
|
-
repo?: string;
|
|
44
|
-
[key: string]: unknown;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* [A] Agent Layer
|
|
49
|
-
* Any Agent: Identity, Name, Intent, Version, ReAct Loop, Subagents,
|
|
50
|
-
* Multi-Agent Swarms, External Framework Wrappers (CrewAI / LangGraph).
|
|
51
|
-
*/
|
|
52
|
-
export interface LayerA {
|
|
53
|
-
name: string;
|
|
54
|
-
intent?: string;
|
|
55
|
-
version?: string;
|
|
56
|
-
system?: string;
|
|
57
|
-
maxTurns?: number;
|
|
58
|
-
/** Portable agent skills from Vercel Labs (skills.sh) or local SKILL.md rules */
|
|
59
|
-
skills?: string[];
|
|
60
|
-
subagents?: LayerA[];
|
|
61
|
-
[key: string]: unknown;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* [T] Tools Layer
|
|
66
|
-
* Any Tool: MCP v2 (Local Stdio & Remote SSE), Custom REST APIs, Actuators.
|
|
67
|
-
*/
|
|
68
|
-
export interface ToolDefinition {
|
|
69
|
-
name: string;
|
|
70
|
-
description?: string;
|
|
71
|
-
parameters?: Record<string, unknown>;
|
|
72
|
-
execute?: (args: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export type LayerT = Array<string | ToolDefinition>;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* [E] Environment Layer
|
|
79
|
-
* Any Environment: Secrets (.env keys), Neon Sandbox Isolates, Guardrails.
|
|
80
|
-
*/
|
|
81
|
-
export type LayerE = Record<string, string | undefined>;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* The Universal 5-Line Agent Manifest (AUM)
|
|
85
|
-
*/
|
|
86
|
-
export interface AgentManifest {
|
|
87
|
-
L: LayerL;
|
|
88
|
-
I?: LayerI;
|
|
89
|
-
A: LayerA | string;
|
|
90
|
-
T?: LayerT;
|
|
91
|
-
E?: LayerE;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Standard Result returned from an Agent execution run
|
|
96
|
-
*/
|
|
97
|
-
export interface AgentRunResult {
|
|
98
|
-
agent: string;
|
|
99
|
-
answer: string;
|
|
100
|
-
turns: number;
|
|
101
|
-
latencyMs: number;
|
|
102
|
-
toolsExecuted: number;
|
|
103
|
-
error?: string;
|
|
104
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { MemoryProvider } from "./types";
|
|
2
|
-
import { FileSessionMemory, InMemorySession } from "./memory";
|
|
3
|
-
|
|
4
|
-
export interface IntegrationConfig {
|
|
5
|
-
memory?: string;
|
|
6
|
-
type?: string;
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class IntegrationResolver {
|
|
11
|
-
public static resolveMemory(
|
|
12
|
-
config?: string | IntegrationConfig | MemoryProvider,
|
|
13
|
-
metadata?: Record<string, any>,
|
|
14
|
-
sessionId?: string
|
|
15
|
-
): MemoryProvider {
|
|
16
|
-
if (!config) {
|
|
17
|
-
return new InMemorySession(sessionId || "ephemeral", metadata);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (typeof config === "object" && "append" in config && "getMessages" in config) {
|
|
21
|
-
return config as MemoryProvider;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const memoryTarget = typeof config === "string" ? config : (config.memory || config.type);
|
|
25
|
-
|
|
26
|
-
if (!memoryTarget || memoryTarget === ":memory:" || memoryTarget === "memory" || memoryTarget === "in-memory") {
|
|
27
|
-
return new InMemorySession(sessionId || "ephemeral", metadata);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Local file path (e.g. "sessions/hello-agent" or "./data/session.json")
|
|
31
|
-
try {
|
|
32
|
-
return new FileSessionMemory(memoryTarget, metadata);
|
|
33
|
-
} catch {
|
|
34
|
-
return new InMemorySession(sessionId || "ephemeral", metadata);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
package/src/link/index.ts
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
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
|
-
}
|