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
@@ -0,0 +1,64 @@
1
+ export type LlmRole = "system" | "user" | "assistant" | "tool";
2
+
3
+ export interface LlmMessage {
4
+ role: LlmRole;
5
+ content: string | null;
6
+ name?: string;
7
+ tool_call_id?: string;
8
+ tool_calls?: any[];
9
+ }
10
+
11
+ export type SarvamMessage = LlmMessage;
12
+
13
+ export interface ToolCall {
14
+ id: string;
15
+ name: string;
16
+ arguments: Record<string, any>;
17
+ }
18
+
19
+ export interface LlmChatOptions {
20
+ model: string;
21
+ provider?: string;
22
+ baseUrl?: string;
23
+ endpoint?: string;
24
+ temperature?: number;
25
+ maxTokens?: number;
26
+ reasoningEffort?: "none" | "low" | "high" | "max";
27
+ apiKey?: string;
28
+ tools?: any[];
29
+ toolChoice?: string | object;
30
+ systemPrompt?: string;
31
+ }
32
+
33
+ export type SarvamChatOptions = LlmChatOptions;
34
+
35
+ export interface LlmChatResponse {
36
+ text: string;
37
+ reasoningContent?: string;
38
+ toolCalls?: ToolCall[];
39
+ model: string;
40
+ usage?: {
41
+ promptTokens: number;
42
+ completionTokens: number;
43
+ totalTokens: number;
44
+ };
45
+ audioBase64?: string;
46
+ }
47
+
48
+ export interface LlmTtsOptions {
49
+ text: string;
50
+ model?: string;
51
+ voice?: string;
52
+ language?: string;
53
+ apiKey?: string;
54
+ }
55
+
56
+ export interface LlmTtsResponse {
57
+ audioBuffer: Buffer;
58
+ contentType: string;
59
+ model: string;
60
+ voice: string;
61
+ byteLength: number;
62
+ }
63
+
64
+
@@ -1,9 +1,9 @@
1
1
  import { Client } from "@modelcontextprotocol/client";
2
2
  import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
3
- import type { AgentTool } from "../agent/types";
4
- import type { McpServerConfig } from "./types";
3
+ import type { AgentTool } from "@/layers/agent/types";
4
+ import type { McpServerConfig } from "@/layers/tools/types";
5
5
 
6
- export class LiateMcp {
6
+ export class MCP {
7
7
  private static activeClients: Client[] = [];
8
8
  private static activeTransports: any[] = [];
9
9
 
@@ -23,6 +23,12 @@ export class LiateMcp {
23
23
  if (typeof transport.close === "function") {
24
24
  await transport.close();
25
25
  }
26
+ const proc = (transport as any)._process || (transport as any).process;
27
+ if (proc && typeof proc.kill === "function" && !proc.killed) {
28
+ try {
29
+ proc.kill();
30
+ } catch {}
31
+ }
26
32
  } catch {}
27
33
  }
28
34
  this.activeTransports = [];
@@ -57,16 +63,22 @@ export class LiateMcp {
57
63
  const filterSet = toolFilter && toolFilter.length > 0 ? new Set(toolFilter.map(t => t.toLowerCase())) : null;
58
64
 
59
65
  try {
66
+ const isWin = process.platform === "win32";
60
67
  const containerSafeEnv: Record<string, string> = {
61
- HOME: "/tmp",
62
- npm_config_cache: "/tmp/.npm",
68
+ ...(isWin ? {} : { HOME: process.env.HOME || "/tmp" }),
69
+ npm_config_cache: isWin ? (process.env.TEMP || "/tmp") : "/tmp/.npm",
63
70
  npm_config_update_notifier: "false",
64
71
  ...process.env,
65
72
  ...(config.env || {})
66
73
  };
67
74
 
75
+ let resolvedCommand = config.command || "npx";
76
+ if (isWin && (resolvedCommand === "npx" || resolvedCommand === "npm" || resolvedCommand === "pnpm")) {
77
+ resolvedCommand = `${resolvedCommand}.cmd`;
78
+ }
79
+
68
80
  const transport = new StdioClientTransport({
69
- command: config.command || "npx",
81
+ command: resolvedCommand,
70
82
  args: config.args || [],
71
83
  env: containerSafeEnv
72
84
  });
@@ -78,8 +90,8 @@ export class LiateMcp {
78
90
 
79
91
  const client = new Client(
80
92
  {
81
- name: `openliate-${config.name}`,
82
- version: "1.0.0"
93
+ name: `liate-${config.name}`,
94
+ version: config.version || "0.0.1"
83
95
  },
84
96
  {
85
97
  capabilities: {},
@@ -121,7 +133,7 @@ export class LiateMcp {
121
133
 
122
134
  return registeredTools;
123
135
  } catch (err: any) {
124
- console.warn(`[LiateMcp] Stdio discovery failed for ${config.name}: ${err.message}`);
136
+ console.warn(`[MCP] Stdio discovery failed for ${config.name}: ${err.message}`);
125
137
  return [];
126
138
  }
127
139
  }
@@ -171,6 +183,8 @@ export class LiateMcp {
171
183
  });
172
184
 
173
185
  if (!res.ok) {
186
+ const errBody = await res.text().catch(() => "");
187
+ console.warn(`[MCP] Remote HTTP server '${config.name}' returned status ${res.status}: ${errBody || res.statusText}`);
174
188
  return [];
175
189
  }
176
190
 
@@ -215,7 +229,7 @@ export class LiateMcp {
215
229
 
216
230
  return registeredTools;
217
231
  } catch (err: any) {
218
- console.warn(`[LiateMcp] HTTP discovery failed for ${config.name}: ${err.message}`);
232
+ console.warn(`[MCP] HTTP discovery failed for ${config.name}: ${err.message}`);
219
233
  return [];
220
234
  }
221
235
  }
@@ -0,0 +1,307 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import type { AgentTool } from "@/layers/agent/types";
4
+ import type { McpServerConfig, ParsedToolSpec } from "@/layers/tools/types";
5
+ import { MCP } from "@/layers/tools/mcp";
6
+
7
+ export class ToolRegistry {
8
+ public static parseSpec(spec: string): ParsedToolSpec {
9
+ const trimmed = spec.trim();
10
+
11
+ if (trimmed.toLowerCase() === "fetch" || trimmed.toLowerCase() === "mcp:fetch" || trimmed.toLowerCase() === "mcp/fetch") {
12
+ return {
13
+ raw: trimmed,
14
+ isMcp: true,
15
+ serverName: "fetch"
16
+ };
17
+ }
18
+
19
+ if (trimmed.startsWith("mcp:")) {
20
+ const remainder = trimmed.slice(4); // Remove "mcp:"
21
+ const colonIndex = remainder.indexOf(":");
22
+
23
+ if (colonIndex === -1) {
24
+ // e.g. "mcp:agentmail" -> all tools
25
+ return {
26
+ raw: trimmed,
27
+ isMcp: true,
28
+ isBuiltin: false,
29
+ serverName: remainder.trim(),
30
+ selectedTools: undefined
31
+ };
32
+ }
33
+
34
+ // e.g. "mcp:agentmail:send_email,read_inbox"
35
+ const serverName = remainder.slice(0, colonIndex).trim();
36
+ const toolsPart = remainder.slice(colonIndex + 1).trim();
37
+ const selectedTools = toolsPart ? toolsPart.split(",").map(s => s.trim()).filter(Boolean) : undefined;
38
+
39
+ return {
40
+ raw: trimmed,
41
+ isMcp: true,
42
+ isBuiltin: false,
43
+ serverName,
44
+ selectedTools
45
+ };
46
+ }
47
+
48
+ // Check if it's "serverName:tool1,tool2"
49
+ if (trimmed.includes(":")) {
50
+ const [serverName, toolsPart] = trimmed.split(":");
51
+ const selectedTools = toolsPart ? toolsPart.split(",").map(s => s.trim()).filter(Boolean) : undefined;
52
+ return {
53
+ raw: trimmed,
54
+ isMcp: true,
55
+ isBuiltin: false,
56
+ serverName: serverName.trim(),
57
+ selectedTools
58
+ };
59
+ }
60
+
61
+ // Default to an MCP server name (e.g. "agentmail")
62
+ return {
63
+ raw: trimmed,
64
+ isMcp: true,
65
+ isBuiltin: false,
66
+ serverName: trimmed,
67
+ selectedTools: undefined
68
+ };
69
+ }
70
+
71
+ /**
72
+ * Resolve local workspace .liate/mcp.json path
73
+ */
74
+ public static getMcpJsonPath(): string {
75
+ const candidates = [
76
+ path.resolve(process.cwd(), ".liate", "mcp.json"),
77
+ path.resolve(process.cwd(), "..", ".liate", "mcp.json")
78
+ ];
79
+ for (const p of candidates) {
80
+ if (fs.existsSync(p)) return p;
81
+ }
82
+ return path.resolve(process.cwd(), ".liate", "mcp.json");
83
+ }
84
+
85
+ /**
86
+ * Reads .liate/mcp.json if available
87
+ */
88
+ public static readWorkspaceMcpServers(): Record<string, any> {
89
+ const mcpJsonPath = ToolRegistry.getMcpJsonPath();
90
+ if (fs.existsSync(mcpJsonPath)) {
91
+ try {
92
+ const raw = fs.readFileSync(mcpJsonPath, "utf-8");
93
+ const parsed = JSON.parse(raw);
94
+ return parsed.mcpServers || parsed || {};
95
+ } catch {}
96
+ }
97
+ return {};
98
+ }
99
+
100
+ /**
101
+ * Caches/writes an MCP server definition into .liate/mcp.json
102
+ */
103
+ public static cacheMcpServer(serverName: string, config: McpServerConfig): void {
104
+ try {
105
+ const mcpJsonPath = ToolRegistry.getMcpJsonPath();
106
+ const dir = path.dirname(mcpJsonPath);
107
+ if (!fs.existsSync(dir)) {
108
+ fs.mkdirSync(dir, { recursive: true });
109
+ }
110
+
111
+ let data: { mcpServers: Record<string, any> } = { mcpServers: {} };
112
+ if (fs.existsSync(mcpJsonPath)) {
113
+ try {
114
+ const raw = fs.readFileSync(mcpJsonPath, "utf-8");
115
+ const parsed = JSON.parse(raw);
116
+ data.mcpServers = parsed.mcpServers || parsed || {};
117
+ } catch {}
118
+ }
119
+
120
+ data.mcpServers[serverName] = {
121
+ name: config.name || serverName,
122
+ transport: config.transport || (config.url ? "http" : "stdio"),
123
+ ...(config.command ? { command: config.command } : {}),
124
+ ...(config.args ? { args: config.args } : {}),
125
+ ...(config.url ? { url: config.url } : {}),
126
+ ...(config.headers ? { headers: config.headers } : {}),
127
+ ...(config.env ? { env: config.env } : {})
128
+ };
129
+
130
+ fs.writeFileSync(mcpJsonPath, JSON.stringify(data, null, 2), "utf-8");
131
+ } catch {}
132
+ }
133
+
134
+ public static loadMcpConfig(serverName: string, customEnv: Record<string, string | undefined> = process.env): McpServerConfig {
135
+ let parsed: McpServerConfig | null = null;
136
+
137
+ // Check workspace .liate/mcp.json (local cache & user-registered servers)
138
+ const workspaceServers = ToolRegistry.readWorkspaceMcpServers();
139
+ if (workspaceServers && workspaceServers[serverName]) {
140
+ const s = workspaceServers[serverName];
141
+ parsed = {
142
+ id: serverName,
143
+ name: s.name || serverName,
144
+ description: s.description,
145
+ transport: s.transport || (s.url ? "http" : "stdio"),
146
+ command: s.command,
147
+ args: s.args,
148
+ url: s.url,
149
+ headers: s.headers,
150
+ env: s.env
151
+ };
152
+ }
153
+
154
+ if (!parsed) {
155
+ throw new Error(`MCP server '${serverName}' not found. Define it directly inline in Layer [T] (e.g. { url: "...", transport: "http" }) or register it in .liate/mcp.json.`);
156
+ }
157
+
158
+ // Resolve environment variables in headers and URL
159
+ const resolvedHeaders: Record<string, string> = {};
160
+ for (const [k, v] of Object.entries(parsed.headers || {})) {
161
+ if (typeof v === "string" && v.startsWith("$")) {
162
+ const envName = v.slice(1);
163
+ resolvedHeaders[k] = customEnv[envName] || "";
164
+ } else if (typeof v === "string" && v.includes("$")) {
165
+ resolvedHeaders[k] = v.replace(/\$([A-Z0-9_]+)/g, (_, name) => customEnv[name] || "");
166
+ } else {
167
+ resolvedHeaders[k] = String(v);
168
+ }
169
+ }
170
+
171
+ let resolvedUrl = parsed.url;
172
+ if (resolvedUrl && resolvedUrl.includes("$")) {
173
+ resolvedUrl = resolvedUrl.replace(/\$([A-Z0-9_]+)/g, (_, name) => customEnv[name] || "");
174
+ }
175
+
176
+ return {
177
+ ...parsed,
178
+ url: resolvedUrl,
179
+ headers: resolvedHeaders
180
+ };
181
+ }
182
+
183
+ public static async resolveTools(
184
+ specs: Array<string | AgentTool | Record<string, any>> | Record<string, any>,
185
+ customEnv: Record<string, string | undefined> = process.env
186
+ ): Promise<AgentTool[]> {
187
+ const resolved: AgentTool[] = [];
188
+ let rawList: Array<string | AgentTool | Record<string, any>> = [];
189
+
190
+ if (Array.isArray(specs)) {
191
+ rawList = specs;
192
+ } else if (typeof specs === "object" && specs !== null) {
193
+ if ("command" in specs || "url" in specs) {
194
+ rawList = [{ id: "inline_tool", name: "inline_tool", ...specs }];
195
+ } else {
196
+ rawList = Object.entries(specs).map(([key, val]) => {
197
+ if (typeof val === "object" && val !== null) {
198
+ return { id: key, name: key, ...val };
199
+ }
200
+ return key;
201
+ });
202
+ }
203
+ }
204
+
205
+ for (const item of rawList) {
206
+ if (typeof item === "object" && item !== null) {
207
+ // Direct AgentTool object (has name & execute function)
208
+ if ("name" in item && "execute" in item && typeof (item as any).execute === "function") {
209
+ resolved.push(item as AgentTool);
210
+ continue;
211
+ }
212
+
213
+ // Inline MCP Config Object (e.g. { command: "uvx", args: ["mcp-server-time"], tools: ["*"] })
214
+ if ("command" in item || "url" in item) {
215
+ const rawArgs = (item as any).args;
216
+ const resolvedArgs = Array.isArray(rawArgs)
217
+ ? rawArgs.map(arg => typeof arg === "string" ? arg.replace(/\$([A-Z0-9_]+)/g, (_, name) => customEnv[name] || process.env[name] || "") : arg)
218
+ : undefined;
219
+
220
+ const rawEnv = (item as any).env;
221
+ const resolvedEnv: Record<string, string> = {};
222
+ if (rawEnv && typeof rawEnv === "object") {
223
+ for (const [k, v] of Object.entries(rawEnv)) {
224
+ resolvedEnv[k] = typeof v === "string"
225
+ ? v.replace(/\$([A-Z0-9_]+)/g, (_, name) => customEnv[name] || process.env[name] || "")
226
+ : String(v);
227
+ }
228
+ }
229
+
230
+ let resolvedUrl = (item as any).url;
231
+ if (resolvedUrl && typeof resolvedUrl === "string" && resolvedUrl.includes("$")) {
232
+ resolvedUrl = resolvedUrl.replace(/\$([A-Z0-9_]+)/g, (_, name) => customEnv[name] || process.env[name] || "");
233
+ }
234
+
235
+ const rawHeaders = (item as any).headers;
236
+ const resolvedHeaders: Record<string, string> = {};
237
+ if (rawHeaders && typeof rawHeaders === "object") {
238
+ for (const [k, v] of Object.entries(rawHeaders)) {
239
+ resolvedHeaders[k] = typeof v === "string"
240
+ ? v.replace(/\$([A-Z0-9_]+)/g, (_, name) => customEnv[name] || process.env[name] || "")
241
+ : String(v);
242
+ }
243
+ }
244
+
245
+ const inlineConfig: McpServerConfig = {
246
+ id: (item as any).id || (item as any).name || "inline_mcp",
247
+ name: (item as any).name || (item as any).id || "inline_mcp",
248
+ transport: (item as any).transport || ((item as any).url ? "http" : "stdio"),
249
+ command: (item as any).command,
250
+ args: resolvedArgs,
251
+ url: resolvedUrl,
252
+ env: Object.keys(resolvedEnv).length > 0 ? resolvedEnv : undefined,
253
+ headers: Object.keys(resolvedHeaders).length > 0 ? resolvedHeaders : undefined
254
+ };
255
+
256
+ const rawFilter = (item as any).tools || (item as any).selectedTools;
257
+ const toolFilter: string[] | undefined = Array.isArray(rawFilter)
258
+ ? (rawFilter.includes("*") ? undefined : rawFilter)
259
+ : typeof rawFilter === "string" && rawFilter !== "*"
260
+ ? rawFilter.split(",").map((s: string) => s.trim()).filter(Boolean)
261
+ : undefined;
262
+
263
+ try {
264
+ const tools = await MCP.discoverTools(inlineConfig, toolFilter);
265
+ resolved.push(...tools);
266
+ } catch (err: any) {
267
+ console.warn(`[ToolRegistry] Failed to resolve inline MCP config '${inlineConfig.name}': ${err.message}`);
268
+ }
269
+ continue;
270
+ }
271
+ }
272
+
273
+ if (typeof item === "string") {
274
+ const trimmed = item.trim();
275
+ const parsed = this.parseSpec(trimmed);
276
+
277
+ if (trimmed.toLowerCase() === "fetch" || trimmed.toLowerCase() === "mcp:fetch" || trimmed.toLowerCase() === "mcp/fetch") {
278
+ try {
279
+ const tools = await MCP.discoverTools({
280
+ id: "fetch",
281
+ name: "fetch",
282
+ transport: "stdio",
283
+ command: "uvx",
284
+ args: ["mcp-server-fetch"]
285
+ }, parsed.selectedTools);
286
+ resolved.push(...tools);
287
+ } catch (err: any) {
288
+ console.warn(`[ToolRegistry] Failed to resolve uvx mcp-server-fetch: ${err.message}`);
289
+ }
290
+ continue;
291
+ }
292
+
293
+ if (parsed.isMcp && parsed.serverName) {
294
+ try {
295
+ const config = this.loadMcpConfig(parsed.serverName, customEnv);
296
+ const tools = await MCP.discoverTools(config, parsed.selectedTools);
297
+ resolved.push(...tools);
298
+ } catch (err: any) {
299
+ console.warn(`[ToolRegistry] Failed to resolve MCP server '${parsed.serverName}': ${err.message}`);
300
+ }
301
+ }
302
+ }
303
+ }
304
+
305
+ return resolved;
306
+ }
307
+ }
@@ -8,25 +8,25 @@ export interface McpAgentLike {
8
8
  }
9
9
 
10
10
  /**
11
- * OpenLiate MCP Server Exposer [Layer T]
12
- * Exposes a Liate Agent as a standard Model Context Protocol (MCP) server
13
- * so external IDEs (Claude Desktop, Cursor, Antigravity) can call it directly.
11
+ * Liate MCP Server Exposer [Layer T]
12
+ * Exposes a Liate Agent as a standard Model Context Protocol (MCP) server.
14
13
  */
15
14
  export function createAgentMcpServer(agent: McpAgentLike): McpServer {
16
- const agentName = agent.name || "LiateAgent";
15
+ const agentName = agent.name || "Agent";
16
+ const agentVersion = (agent as any).version || "0.0.1";
17
17
  const server = new McpServer({
18
18
  name: `liate-${agentName.toLowerCase()}`,
19
- version: "1.0.0"
19
+ version: agentVersion
20
20
  });
21
21
 
22
22
  // Tool 1: Run Agent
23
- server.registerTool(
23
+ (server as any).registerTool(
24
24
  `${agentName.toLowerCase()}_run`,
25
25
  {
26
26
  description: `Execute cognitive reasoning using the ${agentName} agent.`,
27
- inputSchema: z.object({
27
+ inputSchema: {
28
28
  prompt: z.string().describe("The prompt or instruction to execute")
29
- })
29
+ }
30
30
  },
31
31
  async ({ prompt }: { prompt: string }) => {
32
32
  const result = await agent.run(prompt);
@@ -37,11 +37,11 @@ export function createAgentMcpServer(agent: McpAgentLike): McpServer {
37
37
  );
38
38
 
39
39
  // Tool 2: Agent Health & Status
40
- server.registerTool(
40
+ (server as any).registerTool(
41
41
  `${agentName.toLowerCase()}_health`,
42
42
  {
43
43
  description: `Check the status of the ${agentName} agent.`,
44
- inputSchema: z.object({})
44
+ inputSchema: {}
45
45
  },
46
46
  async () => {
47
47
  return {
@@ -52,9 +52,8 @@ export function createAgentMcpServer(agent: McpAgentLike): McpServer {
52
52
  {
53
53
  status: "ok",
54
54
  agent: agentName,
55
- protocol: "LAPI/v1",
56
- mcpVersion: "v2",
57
- doctrine: "Class is an Agent. Agent is a LAPI. That's your Backend."
55
+ protocol: "Liate API v1",
56
+ doctrine: "Where a Class is an Agent. Built for Sovereign AI Agents From India to the World."
58
57
  },
59
58
  null,
60
59
  2
@@ -1,4 +1,4 @@
1
- import type { AgentContext } from "../agent/types";
1
+ import type { AgentContext } from "@/layers/agent/types";
2
2
 
3
3
  export interface LlmToolSchema {
4
4
  type: "function";
@@ -12,6 +12,7 @@ export interface LlmToolSchema {
12
12
  export interface McpServerConfig {
13
13
  id: string;
14
14
  name: string;
15
+ version?: string;
15
16
  description?: string;
16
17
  transport?: "stdio" | "sse" | "http";
17
18
  command?: string;
@@ -30,7 +31,7 @@ export interface ToolExecutorResult {
30
31
  export interface ParsedToolSpec {
31
32
  raw: string;
32
33
  isMcp: boolean;
33
- isBuiltin: boolean;
34
+ isBuiltin?: boolean;
34
35
  serverName?: string;
35
36
  selectedTools?: string[];
36
37
  }
package/src/liate.ts CHANGED
@@ -1,25 +1,65 @@
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";
1
+ /**
2
+ * Liate — Open Source AI Agents Framework
3
+ * Built for Sovereign AI Agents From India to the World.
4
+ *
5
+ * Universal Framework Entrypoint & SDK Exports
6
+ *
7
+ * Usage:
8
+ * import { liate } from "@openliate/liate";
9
+ * class MyAgent extends liate { L; I; A; T; E; }
10
+ */
23
11
 
24
- // CLI entry point
25
- import "./cli";
12
+ // 1. The 5 Layers (L · I · A · T · E)
13
+ export * from "@/layers/llm/model";
14
+ export * from "@/layers/integration/memory";
15
+ export * from "@/layers/integration/knowledge";
16
+ export * from "@/layers/integration/repo";
17
+ export * from "@/layers/integration/lib";
18
+ export * from "@/layers/agent/harness";
19
+ export * from "@/layers/agent/loop";
20
+ export * from "@/layers/agent/skills";
21
+ export * from "@/layers/agent/types";
22
+ export * from "@/layers/tools/mcp";
23
+ export * from "@/layers/tools/server";
24
+ export * from "@/layers/tools/registry";
25
+ export * from "@/layers/environment/sandbox";
26
+ export * from "@/layers/environment/types";
27
+
28
+ // Canonical exports to resolve cross-layer duplicates
29
+ export type { AgentTool, ToolCall } from "@/layers/agent/types";
30
+
31
+ // 2. Core Specification, AUM & OM Engine + Scaffolder
32
+ export * from "@/core/spec";
33
+ export * from "@/core/aum";
34
+ export * from "@/core/om";
35
+ export * from "@/core/version";
36
+ export * from "@/core/uuid";
37
+ export * from "@/scaffold/project";
38
+
39
+ // 3. Default Export: The universal base class
40
+ import { liate } from "@/core/om";
41
+ export default liate;
42
+
43
+ // 4. CLI Direct Execution Entrypoint (only if run directly as script)
44
+ if (typeof import.meta !== "undefined" && import.meta.main && process.argv[1] && (process.argv[1].endsWith("liate.ts") || process.argv[1].endsWith("liate.js"))) {
45
+ let rawArgs = process.argv.slice(2);
46
+ if (rawArgs[0] === "run") {
47
+ rawArgs = rawArgs.slice(1);
48
+ }
49
+ const targetFile = rawArgs[0] && !rawArgs[0].startsWith("-") ? rawArgs[0] : "agent.json";
50
+ const prompt = (rawArgs[0] && !rawArgs[0].startsWith("-") ? rawArgs.slice(1) : rawArgs).join(" ") || "Hello! Confirm you are running pure Liate.";
51
+
52
+ try {
53
+ const agent = await liate.load(targetFile);
54
+ console.log(`[Liate] Running ${targetFile} (Agent: ${agent.A?.name || "Agent"})...`);
55
+ console.log(`[Prompt] "${prompt}"\n`);
56
+ const result = await agent.run(prompt);
57
+ console.log(`[Response]\n${result.text}\n`);
58
+ console.log(`[Stats] Steps: ${result.totalSteps} | Duration: ${result.durationMs}ms | Finish: ${result.finishReason}`);
59
+ await agent.close();
60
+ process.exit(0);
61
+ } catch (err: any) {
62
+ console.error(`[Liate Error] ${err.message}`);
63
+ process.exit(1);
64
+ }
65
+ }