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
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import type { AgentTool } from "../../agent/types";
|
|
2
|
-
|
|
3
|
-
// Verhoeff algorithm multiplication table
|
|
4
|
-
const dTable = [
|
|
5
|
-
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
6
|
-
[1, 2, 3, 4, 0, 6, 7, 8, 9, 5],
|
|
7
|
-
[2, 3, 4, 0, 1, 7, 8, 9, 5, 6],
|
|
8
|
-
[3, 4, 0, 1, 2, 8, 9, 5, 6, 7],
|
|
9
|
-
[4, 0, 1, 2, 3, 9, 5, 6, 7, 8],
|
|
10
|
-
[5, 9, 8, 7, 6, 0, 4, 3, 2, 1],
|
|
11
|
-
[6, 5, 9, 8, 7, 1, 0, 4, 3, 2],
|
|
12
|
-
[7, 6, 5, 9, 8, 2, 1, 0, 4, 3],
|
|
13
|
-
[8, 7, 6, 5, 9, 3, 2, 1, 0, 4],
|
|
14
|
-
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
// Verhoeff permutation table
|
|
18
|
-
const pTable = [
|
|
19
|
-
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
|
20
|
-
[1, 5, 7, 6, 2, 8, 3, 0, 9, 4],
|
|
21
|
-
[5, 8, 0, 3, 7, 9, 6, 1, 4, 2],
|
|
22
|
-
[8, 9, 1, 6, 0, 4, 3, 5, 2, 7],
|
|
23
|
-
[9, 4, 5, 3, 1, 2, 6, 8, 7, 0],
|
|
24
|
-
[4, 2, 8, 6, 5, 7, 3, 9, 0, 1],
|
|
25
|
-
[2, 7, 9, 3, 8, 0, 6, 4, 1, 5],
|
|
26
|
-
[7, 0, 4, 6, 9, 1, 3, 2, 5, 8]
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
function validateAadhaar(numStr: string): { valid: boolean; error?: string; masked?: string } {
|
|
30
|
-
const clean = numStr.replace(/[\s-]/g, "");
|
|
31
|
-
if (!/^\d{12}$/.test(clean)) {
|
|
32
|
-
return { valid: false, error: "Aadhaar must be exactly 12 numeric digits." };
|
|
33
|
-
}
|
|
34
|
-
if (clean.startsWith("0") || clean.startsWith("1")) {
|
|
35
|
-
return { valid: false, error: "Aadhaar cannot start with 0 or 1." };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Verhoeff checksum validation
|
|
39
|
-
let c = 0;
|
|
40
|
-
const reversed = clean.split("").reverse().map(Number);
|
|
41
|
-
for (let i = 0; i < reversed.length; i++) {
|
|
42
|
-
c = dTable[c][pTable[i % 8][reversed[i]]];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const valid = c === 0;
|
|
46
|
-
const masked = `XXXX-XXXX-${clean.slice(8)}`;
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
valid,
|
|
50
|
-
masked,
|
|
51
|
-
error: valid ? undefined : "Aadhaar checksum failed (invalid Verhoeff check digit)."
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const PAN_ENTITY_TYPES: Record<string, string> = {
|
|
56
|
-
P: "Individual / Person",
|
|
57
|
-
C: "Company",
|
|
58
|
-
H: "Hindu Undivided Family (HUF)",
|
|
59
|
-
F: "Firm / Partnership",
|
|
60
|
-
A: "Association of Persons (AOP)",
|
|
61
|
-
T: "Trust",
|
|
62
|
-
B: "Body of Individuals (BOI)",
|
|
63
|
-
L: "Local Authority",
|
|
64
|
-
J: "Artificial Juridical Person",
|
|
65
|
-
G: "Government Agency"
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
function validatePAN(panStr: string): { valid: boolean; error?: string; details?: Record<string, any> } {
|
|
69
|
-
const clean = panStr.trim().toUpperCase();
|
|
70
|
-
const panRegex = /^[A-Z]{5}[0-9]{4}[A-Z]$/;
|
|
71
|
-
|
|
72
|
-
if (!panRegex.test(clean)) {
|
|
73
|
-
return {
|
|
74
|
-
valid: false,
|
|
75
|
-
error: "PAN must follow standard 10-character format: 5 letters, 4 digits, 1 letter (e.g. ABCDE1234F)."
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const entityCode = clean[3];
|
|
80
|
-
const entityType = PAN_ENTITY_TYPES[entityCode] || "Other / Unknown Entity";
|
|
81
|
-
const masked = `${clean.slice(0, 2)}***${clean.slice(5)}`;
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
valid: true,
|
|
85
|
-
details: {
|
|
86
|
-
pan: clean,
|
|
87
|
-
masked,
|
|
88
|
-
entityType,
|
|
89
|
-
entityCode,
|
|
90
|
-
surnameInitial: clean[4]
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export const identityVerifierTool: AgentTool = {
|
|
96
|
-
name: "verify_identity",
|
|
97
|
-
description: "Verify and validate Indian identity credentials (Aadhaar 12-digit Verhoeff checksum and PAN card 10-character structure).",
|
|
98
|
-
parameters: {
|
|
99
|
-
type: "object",
|
|
100
|
-
properties: {
|
|
101
|
-
aadhaar: {
|
|
102
|
-
type: "string",
|
|
103
|
-
description: "12-digit Aadhaar number to validate"
|
|
104
|
-
},
|
|
105
|
-
pan: {
|
|
106
|
-
type: "string",
|
|
107
|
-
description: "10-character PAN number to validate (e.g. ABCDE1234F)"
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
execute: async (args: Record<string, any>) => {
|
|
112
|
-
const results: Record<string, any> = {};
|
|
113
|
-
|
|
114
|
-
if (args.aadhaar) {
|
|
115
|
-
results.aadhaar = validateAadhaar(String(args.aadhaar));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (args.pan) {
|
|
119
|
-
results.pan = validatePAN(String(args.pan));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!args.aadhaar && !args.pan) {
|
|
123
|
-
return JSON.stringify({
|
|
124
|
-
error: "Please provide either 'aadhaar' or 'pan' to verify."
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return JSON.stringify(results, null, 2);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
package/src/tools/registry.ts
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import type { AgentTool } from "../agent/types";
|
|
4
|
-
import type { McpServerConfig, ParsedToolSpec } from "./types";
|
|
5
|
-
import { LiateMcp } from "./mcp";
|
|
6
|
-
import { fetchTool } from "./builtin/fetch";
|
|
7
|
-
import { identityVerifierTool } from "./builtin/identity";
|
|
8
|
-
import agentmailDef from "../../hub/mcp/agentmail.json";
|
|
9
|
-
import fetchDef from "../../hub/mcp/fetch.json";
|
|
10
|
-
import neonDef from "../../hub/mcp/neon.json";
|
|
11
|
-
import vercelDef from "../../hub/mcp/vercel.json";
|
|
12
|
-
import supabaseDef from "../../hub/mcp/supabase.json";
|
|
13
|
-
|
|
14
|
-
export class ToolRegistry {
|
|
15
|
-
public static parseSpec(spec: string): ParsedToolSpec {
|
|
16
|
-
const trimmed = spec.trim();
|
|
17
|
-
|
|
18
|
-
if (trimmed.toLowerCase() === "fetch" || trimmed.toLowerCase() === "builtin:fetch") {
|
|
19
|
-
return {
|
|
20
|
-
raw: trimmed,
|
|
21
|
-
isMcp: false,
|
|
22
|
-
isBuiltin: true
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
trimmed.toLowerCase() === "identity" ||
|
|
28
|
-
trimmed.toLowerCase() === "verify_identity" ||
|
|
29
|
-
trimmed.toLowerCase() === "builtin:identity"
|
|
30
|
-
) {
|
|
31
|
-
return {
|
|
32
|
-
raw: trimmed,
|
|
33
|
-
isMcp: false,
|
|
34
|
-
isBuiltin: true
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (trimmed.startsWith("mcp:")) {
|
|
39
|
-
const remainder = trimmed.slice(4); // Remove "mcp:"
|
|
40
|
-
const colonIndex = remainder.indexOf(":");
|
|
41
|
-
|
|
42
|
-
if (colonIndex === -1) {
|
|
43
|
-
// e.g. "mcp:agentmail" -> all tools
|
|
44
|
-
return {
|
|
45
|
-
raw: trimmed,
|
|
46
|
-
isMcp: true,
|
|
47
|
-
isBuiltin: false,
|
|
48
|
-
serverName: remainder.trim(),
|
|
49
|
-
selectedTools: undefined
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// e.g. "mcp:agentmail:send_email,read_inbox"
|
|
54
|
-
const serverName = remainder.slice(0, colonIndex).trim();
|
|
55
|
-
const toolsPart = remainder.slice(colonIndex + 1).trim();
|
|
56
|
-
const selectedTools = toolsPart ? toolsPart.split(",").map(s => s.trim()).filter(Boolean) : undefined;
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
raw: trimmed,
|
|
60
|
-
isMcp: true,
|
|
61
|
-
isBuiltin: false,
|
|
62
|
-
serverName,
|
|
63
|
-
selectedTools
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Check if it's "serverName:tool1,tool2"
|
|
68
|
-
if (trimmed.includes(":")) {
|
|
69
|
-
const [serverName, toolsPart] = trimmed.split(":");
|
|
70
|
-
const selectedTools = toolsPart ? toolsPart.split(",").map(s => s.trim()).filter(Boolean) : undefined;
|
|
71
|
-
return {
|
|
72
|
-
raw: trimmed,
|
|
73
|
-
isMcp: true,
|
|
74
|
-
isBuiltin: false,
|
|
75
|
-
serverName: serverName.trim(),
|
|
76
|
-
selectedTools
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Default to an MCP server name (e.g. "agentmail")
|
|
81
|
-
return {
|
|
82
|
-
raw: trimmed,
|
|
83
|
-
isMcp: true,
|
|
84
|
-
isBuiltin: false,
|
|
85
|
-
serverName: trimmed,
|
|
86
|
-
selectedTools: undefined
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public static loadMcpConfig(serverName: string, customEnv: Record<string, string | undefined> = process.env): McpServerConfig {
|
|
91
|
-
const possiblePaths = [
|
|
92
|
-
path.resolve(process.cwd(), `hub/mcp/${serverName}.json`),
|
|
93
|
-
path.resolve(process.cwd(), "..", `hub/mcp/${serverName}.json`),
|
|
94
|
-
path.join(__dirname, "..", "..", `hub/mcp/${serverName}.json`)
|
|
95
|
-
];
|
|
96
|
-
|
|
97
|
-
let foundPath: string | undefined;
|
|
98
|
-
for (const p of possiblePaths) {
|
|
99
|
-
if (fs.existsSync(p)) {
|
|
100
|
-
foundPath = p;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
let parsed: McpServerConfig;
|
|
106
|
-
if (foundPath) {
|
|
107
|
-
const raw = fs.readFileSync(foundPath, "utf-8");
|
|
108
|
-
parsed = JSON.parse(raw);
|
|
109
|
-
} else if (serverName === "agentmail") {
|
|
110
|
-
parsed = JSON.parse(JSON.stringify(agentmailDef)) as McpServerConfig;
|
|
111
|
-
} else if (serverName === "fetch") {
|
|
112
|
-
parsed = JSON.parse(JSON.stringify(fetchDef)) as McpServerConfig;
|
|
113
|
-
} else if (serverName === "neon") {
|
|
114
|
-
parsed = JSON.parse(JSON.stringify(neonDef)) as McpServerConfig;
|
|
115
|
-
} else if (serverName === "vercel") {
|
|
116
|
-
parsed = JSON.parse(JSON.stringify(vercelDef)) as McpServerConfig;
|
|
117
|
-
} else if (serverName === "supabase") {
|
|
118
|
-
parsed = JSON.parse(JSON.stringify(supabaseDef)) as McpServerConfig;
|
|
119
|
-
} else {
|
|
120
|
-
throw new Error(`MCP definition file not found for '${serverName}' at hub/mcp/${serverName}.json`);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Resolve environment variables in headers and URL
|
|
124
|
-
const resolvedHeaders: Record<string, string> = {};
|
|
125
|
-
for (const [k, v] of Object.entries(parsed.headers || {})) {
|
|
126
|
-
if (typeof v === "string" && v.startsWith("$")) {
|
|
127
|
-
const envName = v.slice(1);
|
|
128
|
-
resolvedHeaders[k] = customEnv[envName] || "";
|
|
129
|
-
} else if (typeof v === "string" && v.includes("$")) {
|
|
130
|
-
resolvedHeaders[k] = v.replace(/\$([A-Z0-9_]+)/g, (_, name) => customEnv[name] || "");
|
|
131
|
-
} else {
|
|
132
|
-
resolvedHeaders[k] = String(v);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
let resolvedUrl = parsed.url;
|
|
137
|
-
if (resolvedUrl && resolvedUrl.includes("$")) {
|
|
138
|
-
resolvedUrl = resolvedUrl.replace(/\$([A-Z0-9_]+)/g, (_, name) => customEnv[name] || "");
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
...parsed,
|
|
143
|
-
url: resolvedUrl,
|
|
144
|
-
headers: resolvedHeaders
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
public static async resolveTools(
|
|
149
|
-
specs: Array<string | AgentTool | Record<string, any>> | Record<string, any>,
|
|
150
|
-
customEnv: Record<string, string | undefined> = process.env
|
|
151
|
-
): Promise<AgentTool[]> {
|
|
152
|
-
const resolved: AgentTool[] = [];
|
|
153
|
-
const rawList: Array<string | AgentTool | Record<string, any>> = Array.isArray(specs)
|
|
154
|
-
? specs
|
|
155
|
-
: Object.entries(specs || {}).map(([key, val]) => {
|
|
156
|
-
if (typeof val === "object" && val !== null) {
|
|
157
|
-
return { id: key, name: key, ...val };
|
|
158
|
-
}
|
|
159
|
-
return key;
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
for (const item of rawList) {
|
|
163
|
-
if (typeof item === "object" && item !== null) {
|
|
164
|
-
// Direct AgentTool object (has name & execute function)
|
|
165
|
-
if ("name" in item && "execute" in item && typeof (item as any).execute === "function") {
|
|
166
|
-
resolved.push(item as AgentTool);
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Inline MCP Config Object (e.g. { command: "uvx", args: ["mcp-server-fetch"] })
|
|
171
|
-
if ("command" in item || "url" in item) {
|
|
172
|
-
const inlineConfig: McpServerConfig = {
|
|
173
|
-
id: (item as any).id || (item as any).name || "inline_mcp",
|
|
174
|
-
name: (item as any).name || (item as any).id || "inline_mcp",
|
|
175
|
-
transport: (item as any).transport || ((item as any).url ? "http" : "stdio"),
|
|
176
|
-
command: (item as any).command,
|
|
177
|
-
args: (item as any).args,
|
|
178
|
-
url: (item as any).url,
|
|
179
|
-
env: (item as any).env,
|
|
180
|
-
headers: (item as any).headers
|
|
181
|
-
};
|
|
182
|
-
try {
|
|
183
|
-
const tools = await LiateMcp.discoverTools(inlineConfig);
|
|
184
|
-
resolved.push(...tools);
|
|
185
|
-
} catch (err: any) {
|
|
186
|
-
console.warn(`[ToolRegistry] Failed to resolve inline MCP config: ${err.message}`);
|
|
187
|
-
}
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (typeof item === "string") {
|
|
193
|
-
const parsed = this.parseSpec(item);
|
|
194
|
-
|
|
195
|
-
if (parsed.isBuiltin) {
|
|
196
|
-
if (parsed.raw.toLowerCase().includes("identity")) {
|
|
197
|
-
resolved.push(identityVerifierTool);
|
|
198
|
-
} else {
|
|
199
|
-
resolved.push(fetchTool);
|
|
200
|
-
}
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (parsed.isMcp && parsed.serverName) {
|
|
205
|
-
try {
|
|
206
|
-
const config = this.loadMcpConfig(parsed.serverName, customEnv);
|
|
207
|
-
const tools = await LiateMcp.discoverTools(config, parsed.selectedTools);
|
|
208
|
-
resolved.push(...tools);
|
|
209
|
-
} catch (err: any) {
|
|
210
|
-
console.warn(`[ToolRegistry] Failed to resolve MCP server '${parsed.serverName}': ${err.message}`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return resolved;
|
|
217
|
-
}
|
|
218
|
-
}
|