kompass-sdk 0.1.0
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/dist/a2a/agent-card.d.ts +13 -0
- package/dist/a2a/agent-card.d.ts.map +1 -0
- package/dist/a2a/agent-card.js +52 -0
- package/dist/a2a/agent-card.js.map +1 -0
- package/dist/a2a/bridge.d.ts +52 -0
- package/dist/a2a/bridge.d.ts.map +1 -0
- package/dist/a2a/bridge.js +123 -0
- package/dist/a2a/bridge.js.map +1 -0
- package/dist/a2a/client.d.ts +34 -0
- package/dist/a2a/client.d.ts.map +1 -0
- package/dist/a2a/client.js +65 -0
- package/dist/a2a/client.js.map +1 -0
- package/dist/a2a/server.d.ts +17 -0
- package/dist/a2a/server.d.ts.map +1 -0
- package/dist/a2a/server.js +194 -0
- package/dist/a2a/server.js.map +1 -0
- package/dist/abi.d.ts +1068 -0
- package/dist/abi.d.ts.map +1 -0
- package/dist/abi.js +1372 -0
- package/dist/abi.js.map +1 -0
- package/dist/adapters/agentkit.d.ts +41 -0
- package/dist/adapters/agentkit.d.ts.map +1 -0
- package/dist/adapters/agentkit.js +67 -0
- package/dist/adapters/agentkit.js.map +1 -0
- package/dist/adapters/generic.d.ts +35 -0
- package/dist/adapters/generic.d.ts.map +1 -0
- package/dist/adapters/generic.js +47 -0
- package/dist/adapters/generic.js.map +1 -0
- package/dist/adapters/index.d.ts +5 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +5 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/langchain.d.ts +26 -0
- package/dist/adapters/langchain.d.ts.map +1 -0
- package/dist/adapters/langchain.js +228 -0
- package/dist/adapters/langchain.js.map +1 -0
- package/dist/adapters/openclaw.d.ts +18 -0
- package/dist/adapters/openclaw.d.ts.map +1 -0
- package/dist/adapters/openclaw.js +168 -0
- package/dist/adapters/openclaw.js.map +1 -0
- package/dist/aggregator.d.ts +36 -0
- package/dist/aggregator.d.ts.map +1 -0
- package/dist/aggregator.js +168 -0
- package/dist/aggregator.js.map +1 -0
- package/dist/backends/acp.d.ts +29 -0
- package/dist/backends/acp.d.ts.map +1 -0
- package/dist/backends/acp.js +126 -0
- package/dist/backends/acp.js.map +1 -0
- package/dist/backends/types.d.ts +59 -0
- package/dist/backends/types.d.ts.map +1 -0
- package/dist/backends/types.js +2 -0
- package/dist/backends/types.js.map +1 -0
- package/dist/bridge.d.ts +35 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +192 -0
- package/dist/bridge.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +331 -0
- package/dist/cli.js.map +1 -0
- package/dist/discover.d.ts +15 -0
- package/dist/discover.d.ts.map +1 -0
- package/dist/discover.js +163 -0
- package/dist/discover.js.map +1 -0
- package/dist/escrow.d.ts +45 -0
- package/dist/escrow.d.ts.map +1 -0
- package/dist/escrow.js +243 -0
- package/dist/escrow.js.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +145 -0
- package/dist/index.js.map +1 -0
- package/dist/intents.d.ts +28 -0
- package/dist/intents.d.ts.map +1 -0
- package/dist/intents.js +111 -0
- package/dist/intents.js.map +1 -0
- package/dist/matching.d.ts +29 -0
- package/dist/matching.d.ts.map +1 -0
- package/dist/matching.js +147 -0
- package/dist/matching.js.map +1 -0
- package/dist/pipelineAbi.d.ts +113 -0
- package/dist/pipelineAbi.d.ts.map +1 -0
- package/dist/pipelineAbi.js +74 -0
- package/dist/pipelineAbi.js.map +1 -0
- package/dist/pipelines.d.ts +42 -0
- package/dist/pipelines.d.ts.map +1 -0
- package/dist/pipelines.js +185 -0
- package/dist/pipelines.js.map +1 -0
- package/dist/registry.d.ts +36 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +187 -0
- package/dist/registry.js.map +1 -0
- package/dist/reputation.d.ts +10 -0
- package/dist/reputation.d.ts.map +1 -0
- package/dist/reputation.js +33 -0
- package/dist/reputation.js.map +1 -0
- package/dist/router.d.ts +72 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +190 -0
- package/dist/router.js.map +1 -0
- package/dist/simple.d.ts +160 -0
- package/dist/simple.d.ts.map +1 -0
- package/dist/simple.js +237 -0
- package/dist/simple.js.map +1 -0
- package/dist/sources/a2a-wellknown.d.ts +8 -0
- package/dist/sources/a2a-wellknown.d.ts.map +1 -0
- package/dist/sources/a2a-wellknown.js +104 -0
- package/dist/sources/a2a-wellknown.js.map +1 -0
- package/dist/sources/acp.d.ts +7 -0
- package/dist/sources/acp.d.ts.map +1 -0
- package/dist/sources/acp.js +86 -0
- package/dist/sources/acp.js.map +1 -0
- package/dist/sources/adp.d.ts +7 -0
- package/dist/sources/adp.d.ts.map +1 -0
- package/dist/sources/adp.js +59 -0
- package/dist/sources/adp.js.map +1 -0
- package/dist/sources/erc8004.d.ts +7 -0
- package/dist/sources/erc8004.d.ts.map +1 -0
- package/dist/sources/erc8004.js +150 -0
- package/dist/sources/erc8004.js.map +1 -0
- package/dist/sources/index.d.ts +17 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +35 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/kompass-registry.d.ts +8 -0
- package/dist/sources/kompass-registry.d.ts.map +1 -0
- package/dist/sources/kompass-registry.js +62 -0
- package/dist/sources/kompass-registry.js.map +1 -0
- package/dist/sources/l402-directory.d.ts +7 -0
- package/dist/sources/l402-directory.d.ts.map +1 -0
- package/dist/sources/l402-directory.js +42 -0
- package/dist/sources/l402-directory.js.map +1 -0
- package/dist/sources/mcp-registry.d.ts +8 -0
- package/dist/sources/mcp-registry.d.ts.map +1 -0
- package/dist/sources/mcp-registry.js +85 -0
- package/dist/sources/mcp-registry.js.map +1 -0
- package/dist/sources/skills.d.ts +8 -0
- package/dist/sources/skills.d.ts.map +1 -0
- package/dist/sources/skills.js +153 -0
- package/dist/sources/skills.js.map +1 -0
- package/dist/sources/types.d.ts +72 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +8 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/sources/x402-ecosystem.d.ts +7 -0
- package/dist/sources/x402-ecosystem.d.ts.map +1 -0
- package/dist/sources/x402-ecosystem.js +78 -0
- package/dist/sources/x402-ecosystem.js.map +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/unified.d.ts +90 -0
- package/dist/unified.d.ts.map +1 -0
- package/dist/unified.js +107 -0
- package/dist/unified.js.map +1 -0
- package/dist/x402.d.ts +30 -0
- package/dist/x402.d.ts.map +1 -0
- package/dist/x402.js +79 -0
- package/dist/x402.js.map +1 -0
- package/package.json +61 -0
- package/scripts/bootstrap-agents.mjs +246 -0
- package/src/.gitkeep +0 -0
- package/src/a2a/agent-card.ts +66 -0
- package/src/a2a/bridge.ts +168 -0
- package/src/a2a/client.ts +92 -0
- package/src/a2a/server.ts +234 -0
- package/src/abi.ts +1373 -0
- package/src/adapters/agentkit.ts +83 -0
- package/src/adapters/generic.ts +62 -0
- package/src/adapters/index.ts +4 -0
- package/src/adapters/langchain.ts +282 -0
- package/src/adapters/openclaw.ts +203 -0
- package/src/aggregator.ts +203 -0
- package/src/backends/acp.ts +199 -0
- package/src/backends/types.ts +78 -0
- package/src/bridge.ts +263 -0
- package/src/cli.ts +397 -0
- package/src/discover.ts +187 -0
- package/src/escrow.ts +284 -0
- package/src/index.ts +245 -0
- package/src/intents.ts +166 -0
- package/src/matching.ts +192 -0
- package/src/pipelineAbi.ts +74 -0
- package/src/pipelines.ts +253 -0
- package/src/registry.ts +232 -0
- package/src/reputation.ts +43 -0
- package/src/router.ts +279 -0
- package/src/simple.ts +366 -0
- package/src/sources/a2a-wellknown.ts +120 -0
- package/src/sources/acp.ts +91 -0
- package/src/sources/adp.ts +64 -0
- package/src/sources/erc8004.ts +166 -0
- package/src/sources/index.ts +52 -0
- package/src/sources/kompass-registry.ts +67 -0
- package/src/sources/l402-directory.ts +51 -0
- package/src/sources/mcp-registry.ts +104 -0
- package/src/sources/skills.ts +161 -0
- package/src/sources/types.ts +82 -0
- package/src/sources/x402-ecosystem.ts +86 -0
- package/src/types.ts +147 -0
- package/src/unified.ts +155 -0
- package/src/x402.ts +122 -0
- package/tests/pipelineFlow.test.ts +239 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Registry Source Adapter
|
|
3
|
+
* Crawls registry.modelcontextprotocol.io for MCP servers
|
|
4
|
+
* No auth required. Public REST API with cursor pagination.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { SourceAdapter, UnifiedAgent, SourceSearchOptions } from "./types.js";
|
|
8
|
+
|
|
9
|
+
const BASE_URL = "https://registry.modelcontextprotocol.io";
|
|
10
|
+
|
|
11
|
+
interface McpServer {
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
repo?: string;
|
|
16
|
+
website?: string;
|
|
17
|
+
packages?: { registry: string; name: string }[];
|
|
18
|
+
remotes?: { transport: string; url: string }[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const mcpRegistryAdapter: SourceAdapter = {
|
|
22
|
+
name: "mcp-registry",
|
|
23
|
+
displayName: "MCP Registry (Anthropic)",
|
|
24
|
+
|
|
25
|
+
async search(query: string, options?: SourceSearchOptions): Promise<UnifiedAgent[]> {
|
|
26
|
+
const limit = options?.limit ?? 50;
|
|
27
|
+
const timeout = options?.timeout ?? 10000;
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const url = new URL("/v0.1/servers", BASE_URL);
|
|
31
|
+
url.searchParams.set("limit", String(Math.min(limit, 96)));
|
|
32
|
+
if (query) url.searchParams.set("search", query);
|
|
33
|
+
url.searchParams.set("version", "latest");
|
|
34
|
+
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
const timer = setTimeout(() => controller.abort(), timeout);
|
|
37
|
+
|
|
38
|
+
const res = await fetch(url.toString(), { signal: controller.signal });
|
|
39
|
+
clearTimeout(timer);
|
|
40
|
+
|
|
41
|
+
if (!res.ok) return [];
|
|
42
|
+
|
|
43
|
+
const data = await res.json();
|
|
44
|
+
const rawServers = data.servers ?? data.data ?? [];
|
|
45
|
+
// MCP registry wraps in { server: {...} } objects
|
|
46
|
+
const servers: McpServer[] = rawServers.map((item: any) => item.server ?? item);
|
|
47
|
+
|
|
48
|
+
return servers.slice(0, limit).map((server) => mapMcpServer(server));
|
|
49
|
+
} catch {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
async ping(): Promise<boolean> {
|
|
55
|
+
try {
|
|
56
|
+
const res = await fetch(`${BASE_URL}/v0.1/servers?limit=1`, {
|
|
57
|
+
signal: AbortSignal.timeout(5000),
|
|
58
|
+
});
|
|
59
|
+
return res.ok;
|
|
60
|
+
} catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function mapMcpServer(server: McpServer): UnifiedAgent {
|
|
67
|
+
const remoteUrl = server.remotes?.[0]?.url;
|
|
68
|
+
const categories = extractCategories(server.description ?? server.name);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
id: `mcp-registry:${server.name}`,
|
|
72
|
+
nativeId: server.name,
|
|
73
|
+
name: server.name,
|
|
74
|
+
description: server.description ?? "",
|
|
75
|
+
categories,
|
|
76
|
+
capabilities: [server.description ?? server.name],
|
|
77
|
+
source: "mcp-registry",
|
|
78
|
+
protocol: "mcp",
|
|
79
|
+
endpoints: {
|
|
80
|
+
mcp: remoteUrl,
|
|
81
|
+
http: server.website ?? server.repo,
|
|
82
|
+
},
|
|
83
|
+
pricing: { model: "free" },
|
|
84
|
+
verified: !!server.repo,
|
|
85
|
+
raw: server,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function extractCategories(text: string): string[] {
|
|
90
|
+
const lower = text.toLowerCase();
|
|
91
|
+
const cats: string[] = [];
|
|
92
|
+
const keywords: Record<string, string> = {
|
|
93
|
+
defi: "defi", yield: "defi", swap: "defi", token: "defi", blockchain: "defi",
|
|
94
|
+
data: "data", analytics: "data", database: "data", search: "data",
|
|
95
|
+
code: "development", github: "development", git: "development",
|
|
96
|
+
file: "tools", browser: "tools", web: "tools",
|
|
97
|
+
ai: "ai", llm: "ai", model: "ai",
|
|
98
|
+
image: "media", video: "media", audio: "media",
|
|
99
|
+
};
|
|
100
|
+
for (const [keyword, cat] of Object.entries(keywords)) {
|
|
101
|
+
if (lower.includes(keyword) && !cats.includes(cat)) cats.push(cat);
|
|
102
|
+
}
|
|
103
|
+
return cats.length > 0 ? cats : ["general"];
|
|
104
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills Source Adapter
|
|
3
|
+
* Searches skills.sh (Vercel) and ClawHub registries for agent skills
|
|
4
|
+
* 13,700+ capabilities indexed across both registries
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { SourceAdapter, UnifiedAgent, SourceSearchOptions } from "./types.js";
|
|
8
|
+
|
|
9
|
+
const SKILLS_SH_API = "https://skills.sh";
|
|
10
|
+
const CLAWHUB_API = "https://clawhub.ai";
|
|
11
|
+
|
|
12
|
+
export const skillsAdapter: SourceAdapter = {
|
|
13
|
+
name: "skills-registry",
|
|
14
|
+
displayName: "Skills Registry (skills.sh + ClawHub)",
|
|
15
|
+
|
|
16
|
+
async search(query: string, options?: SourceSearchOptions): Promise<UnifiedAgent[]> {
|
|
17
|
+
const limit = options?.limit ?? 20;
|
|
18
|
+
const timeout = options?.timeout ?? 10000;
|
|
19
|
+
const results: UnifiedAgent[] = [];
|
|
20
|
+
|
|
21
|
+
// Search skills.sh
|
|
22
|
+
try {
|
|
23
|
+
const skillsShResults = await searchSkillsSh(query, Math.ceil(limit / 2), timeout);
|
|
24
|
+
results.push(...skillsShResults);
|
|
25
|
+
} catch {
|
|
26
|
+
// skills.sh might not have a public search API — fall back to known skills
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Search ClawHub
|
|
30
|
+
try {
|
|
31
|
+
const clawHubResults = await searchClawHub(query, Math.ceil(limit / 2), timeout);
|
|
32
|
+
results.push(...clawHubResults);
|
|
33
|
+
} catch {
|
|
34
|
+
// ClawHub might be rate-limited
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// If both APIs fail, return from seed list
|
|
38
|
+
if (results.length === 0) {
|
|
39
|
+
return searchSeedList(query, limit);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return results.slice(0, limit);
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
async ping(): Promise<boolean> {
|
|
46
|
+
try {
|
|
47
|
+
const res = await fetch(SKILLS_SH_API, { signal: AbortSignal.timeout(3000) });
|
|
48
|
+
return res.ok;
|
|
49
|
+
} catch {
|
|
50
|
+
return true; // Seed list always available
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
async function searchSkillsSh(query: string, limit: number, timeout: number): Promise<UnifiedAgent[]> {
|
|
56
|
+
// skills.sh has a search page — try to query it
|
|
57
|
+
const res = await fetch(`${SKILLS_SH_API}/api/search?q=${encodeURIComponent(query)}&limit=${limit}`, {
|
|
58
|
+
signal: AbortSignal.timeout(timeout),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (!res.ok) {
|
|
62
|
+
// Try the leaderboard endpoint
|
|
63
|
+
const lbRes = await fetch(`${SKILLS_SH_API}/api/leaderboard?limit=${limit}`, {
|
|
64
|
+
signal: AbortSignal.timeout(timeout),
|
|
65
|
+
});
|
|
66
|
+
if (!lbRes.ok) return [];
|
|
67
|
+
const data = await lbRes.json();
|
|
68
|
+
const skills = Array.isArray(data) ? data : data.skills ?? data.data ?? [];
|
|
69
|
+
return skills
|
|
70
|
+
.filter((s: any) => matchesQuery(s, query))
|
|
71
|
+
.map((s: any) => mapSkill(s, "skills-sh"));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const data = await res.json();
|
|
75
|
+
const skills = Array.isArray(data) ? data : data.skills ?? data.results ?? [];
|
|
76
|
+
return skills.map((s: any) => mapSkill(s, "skills-sh"));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function searchClawHub(query: string, limit: number, timeout: number): Promise<UnifiedAgent[]> {
|
|
80
|
+
const res = await fetch(`${CLAWHUB_API}/api/skills/search?q=${encodeURIComponent(query)}&limit=${limit}`, {
|
|
81
|
+
signal: AbortSignal.timeout(timeout),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (!res.ok) return [];
|
|
85
|
+
|
|
86
|
+
const data = await res.json();
|
|
87
|
+
const skills = Array.isArray(data) ? data : data.skills ?? data.results ?? [];
|
|
88
|
+
return skills.map((s: any) => mapSkill(s, "clawhub"));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function mapSkill(skill: any, registry: string): UnifiedAgent {
|
|
92
|
+
const name = skill.name ?? skill.slug ?? skill.title ?? "Unknown Skill";
|
|
93
|
+
const description = skill.description ?? "";
|
|
94
|
+
const repo = skill.repo ?? skill.repository ?? skill.url ?? "";
|
|
95
|
+
const installs = skill.installs ?? skill.downloads ?? 0;
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
id: `skills-registry:${registry}:${name.toLowerCase().replace(/\s+/g, "-")}`,
|
|
99
|
+
nativeId: skill.id ?? name,
|
|
100
|
+
name,
|
|
101
|
+
description,
|
|
102
|
+
categories: extractSkillCategories(name, description),
|
|
103
|
+
capabilities: [description, ...(skill.tags ?? [])],
|
|
104
|
+
source: "skills-registry" as any,
|
|
105
|
+
protocol: "skill" as any,
|
|
106
|
+
endpoints: {
|
|
107
|
+
http: repo || `https://skills.sh/${name}`,
|
|
108
|
+
},
|
|
109
|
+
pricing: { model: "free" as const },
|
|
110
|
+
verified: installs > 100,
|
|
111
|
+
lastSeen: Date.now(),
|
|
112
|
+
raw: { ...skill, registry },
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Seed list of well-known skills for when APIs are unavailable
|
|
117
|
+
const KNOWN_SKILLS = [
|
|
118
|
+
{ name: "remotion-best-practices", description: "Video creation in React with Remotion", categories: ["media", "development"], registry: "skills-sh", installs: 145000 },
|
|
119
|
+
{ name: "web-design-guidelines", description: "UI/UX design best practices for web development", categories: ["design", "development"], registry: "skills-sh", installs: 89000 },
|
|
120
|
+
{ name: "react-best-practices", description: "React and Next.js performance optimization from Vercel", categories: ["development"], registry: "skills-sh", installs: 120000 },
|
|
121
|
+
{ name: "solana-dev", description: "End-to-end Solana development playbook", categories: ["development", "defi"], registry: "skills-sh", installs: 50000 },
|
|
122
|
+
{ name: "cairo-contracts", description: "Write Cairo smart contracts on Starknet", categories: ["development", "defi"], registry: "skills-sh", installs: 30000 },
|
|
123
|
+
{ name: "x402-skill", description: "x402 HTTP payment protocol for monetizing APIs", categories: ["payments", "development"], registry: "skills-sh", installs: 25000 },
|
|
124
|
+
{ name: "agent-browser", description: "Automate browser interactions, screenshots, form filling", categories: ["tools", "automation"], registry: "skills-sh", installs: 70000 },
|
|
125
|
+
{ name: "implement-design", description: "Translate Figma designs into production-ready code", categories: ["design", "development"], registry: "skills-sh", installs: 60000 },
|
|
126
|
+
{ name: "find-skills", description: "Discover and install new agent skills", categories: ["tools", "discovery"], registry: "skills-sh", installs: 200000 },
|
|
127
|
+
{ name: "tailwind-v4-shadcn", description: "Set up Tailwind v4 with shadcn/ui", categories: ["development", "design"], registry: "skills-sh", installs: 45000 },
|
|
128
|
+
{ name: "ethskills", description: "Learn Ethereum, Solidity, smart contracts, web3 development", categories: ["development", "defi"], registry: "skills-sh", installs: 8000 },
|
|
129
|
+
{ name: "soul-markets", description: "Agent skill marketplace — monetize agent capabilities", categories: ["marketplace", "commerce"], registry: "clawhub", installs: 5000 },
|
|
130
|
+
{ name: "a2a-market", description: "Buy and sell agent skills using USDC on Base via A2A", categories: ["marketplace", "commerce"], registry: "clawhub", installs: 3000 },
|
|
131
|
+
{ name: "skillzmarket", description: "Discover and install skills from community marketplace", categories: ["marketplace", "discovery"], registry: "clawhub", installs: 4000 },
|
|
132
|
+
{ name: "x402-agent-marketplace", description: "x402 agent marketplace for paid AI capabilities", categories: ["marketplace", "payments"], registry: "clawhub", installs: 2000 },
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
function searchSeedList(query: string, limit: number): UnifiedAgent[] {
|
|
136
|
+
const lower = query.toLowerCase();
|
|
137
|
+
return KNOWN_SKILLS
|
|
138
|
+
.filter((s) => matchesQuery(s, query))
|
|
139
|
+
.slice(0, limit)
|
|
140
|
+
.map((s) => mapSkill({ ...s, installs: s.installs }, s.registry));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function matchesQuery(skill: any, query: string): boolean {
|
|
144
|
+
if (!query) return true;
|
|
145
|
+
const lower = query.toLowerCase();
|
|
146
|
+
const text = `${skill.name ?? ""} ${skill.description ?? ""} ${(skill.tags ?? []).join(" ")} ${(skill.categories ?? []).join(" ")}`.toLowerCase();
|
|
147
|
+
return lower.split(/\s+/).some((term) => text.includes(term));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function extractSkillCategories(name: string, description: string): string[] {
|
|
151
|
+
const text = `${name} ${description}`.toLowerCase();
|
|
152
|
+
const cats: string[] = [];
|
|
153
|
+
if (text.match(/react|next|vue|svelte|frontend|css|tailwind|design/)) cats.push("development");
|
|
154
|
+
if (text.match(/defi|yield|swap|solidity|ethereum|solana|contract/)) cats.push("defi");
|
|
155
|
+
if (text.match(/image|video|audio|media|remotion|figma/)) cats.push("media");
|
|
156
|
+
if (text.match(/data|analytics|research|search/)) cats.push("data");
|
|
157
|
+
if (text.match(/browser|automat|tool|file/)) cats.push("tools");
|
|
158
|
+
if (text.match(/market|commerce|pay|x402|monetiz/)) cats.push("commerce");
|
|
159
|
+
if (text.match(/security|audit|test/)) cats.push("security");
|
|
160
|
+
return cats.length > 0 ? cats : ["general"];
|
|
161
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kompass Universal Agent Discovery — Core Types
|
|
3
|
+
*
|
|
4
|
+
* UnifiedAgent is the normalized representation of an agent
|
|
5
|
+
* from ANY source (ACP, MCP, ERC-8004, x402, A2A, L402, etc.)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type AgentSource =
|
|
9
|
+
| "kompass-registry"
|
|
10
|
+
| "acp"
|
|
11
|
+
| "mcp-registry"
|
|
12
|
+
| "x402-ecosystem"
|
|
13
|
+
| "erc8004"
|
|
14
|
+
| "adp"
|
|
15
|
+
| "a2a-wellknown"
|
|
16
|
+
| "l402-directory"
|
|
17
|
+
| "skills-registry";
|
|
18
|
+
|
|
19
|
+
export type AgentProtocol = "acp" | "mcp" | "x402" | "a2a" | "http" | "l402" | "onchain" | "skill";
|
|
20
|
+
|
|
21
|
+
export interface UnifiedAgent {
|
|
22
|
+
/** Globally unique ID: "${source}:${nativeId}" */
|
|
23
|
+
id: string;
|
|
24
|
+
/** ID within the source registry */
|
|
25
|
+
nativeId: string;
|
|
26
|
+
/** Agent name */
|
|
27
|
+
name: string;
|
|
28
|
+
/** Description of what this agent does */
|
|
29
|
+
description: string;
|
|
30
|
+
/** Capability categories (e.g., ["defi", "yield", "analytics"]) */
|
|
31
|
+
categories: string[];
|
|
32
|
+
/** Free-text capability descriptions for matching */
|
|
33
|
+
capabilities: string[];
|
|
34
|
+
/** Which source registry this came from */
|
|
35
|
+
source: AgentSource;
|
|
36
|
+
/** Which protocol to use for hiring/interacting */
|
|
37
|
+
protocol: AgentProtocol;
|
|
38
|
+
/** Protocol-specific endpoints */
|
|
39
|
+
endpoints: {
|
|
40
|
+
mcp?: string;
|
|
41
|
+
a2a?: string;
|
|
42
|
+
x402?: string;
|
|
43
|
+
http?: string;
|
|
44
|
+
l402?: string;
|
|
45
|
+
acp?: { walletAddress: string; entityAddress?: string };
|
|
46
|
+
};
|
|
47
|
+
/** Reputation/trust signals */
|
|
48
|
+
reputation?: {
|
|
49
|
+
score: number;
|
|
50
|
+
count: number;
|
|
51
|
+
source: string;
|
|
52
|
+
};
|
|
53
|
+
/** Pricing info */
|
|
54
|
+
pricing?: {
|
|
55
|
+
model: "free" | "per-call" | "subscription" | "escrow" | "unknown";
|
|
56
|
+
amount?: string;
|
|
57
|
+
currency?: string;
|
|
58
|
+
};
|
|
59
|
+
/** Identity verification status */
|
|
60
|
+
verified?: boolean;
|
|
61
|
+
/** Last time this agent was seen active */
|
|
62
|
+
lastSeen?: number;
|
|
63
|
+
/** Original raw data from source */
|
|
64
|
+
raw?: unknown;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface SourceSearchOptions {
|
|
68
|
+
limit?: number;
|
|
69
|
+
category?: string;
|
|
70
|
+
timeout?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface SourceAdapter {
|
|
74
|
+
/** Unique name for this source */
|
|
75
|
+
name: AgentSource;
|
|
76
|
+
/** Human-readable display name */
|
|
77
|
+
displayName: string;
|
|
78
|
+
/** Search this source for agents matching the query */
|
|
79
|
+
search(query: string, options?: SourceSearchOptions): Promise<UnifiedAgent[]>;
|
|
80
|
+
/** Check if this source is reachable */
|
|
81
|
+
ping(): Promise<boolean>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* x402 Ecosystem Source Adapter
|
|
3
|
+
* Fetches known x402 endpoints from the x402.org ecosystem
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { SourceAdapter, UnifiedAgent, SourceSearchOptions } from "./types.js";
|
|
7
|
+
|
|
8
|
+
// Seed list of known x402 services (from x402.org/ecosystem + x402scan)
|
|
9
|
+
const KNOWN_X402_SERVICES = [
|
|
10
|
+
{ name: "OpenRouter", url: "https://openrouter.ai", description: "LLM API access with USDC payments", categories: ["ai", "llm"] },
|
|
11
|
+
{ name: "Dexter AI", url: "https://dexterai.com", description: "x402 facilitator on Solana. 38M+ settlements", categories: ["defi", "trading"] },
|
|
12
|
+
{ name: "AgentCash", url: "https://agentcash.dev", description: "One balance, every paid API. Multi-protocol agent wallet", categories: ["payments", "tools"] },
|
|
13
|
+
{ name: "Allium", url: "https://allium.so", description: "Blockchain data APIs with x402 payments", categories: ["data", "analytics"] },
|
|
14
|
+
{ name: "Kompass Data Provider", url: "http://localhost:4021", description: "DeFi yield data, token prices, risk scores via x402", categories: ["defi", "data"] },
|
|
15
|
+
{ name: "Wurk", url: "https://wurk.fun", description: "Agent job board with x402 integration", categories: ["jobs", "tools"] },
|
|
16
|
+
{ name: "Tavily", url: "https://tavily.com", description: "AI-powered web search API", categories: ["search", "data"] },
|
|
17
|
+
{ name: "ASSAY", url: "https://assayaudit.com", description: "Agent evaluation and auditing service", categories: ["audit", "trust"] },
|
|
18
|
+
{ name: "Zentiece", url: "https://zentiece.com", description: "Agent with x402 payments + ORBIT burns", categories: ["defi", "trading"] },
|
|
19
|
+
{ name: "AlgoVoi", url: "https://algovoi.com", description: "x402 integration on Algorand", categories: ["defi", "tools"] },
|
|
20
|
+
{ name: "LibertAI", url: "https://libertai.io", description: "Autonomous agents on Aleph Cloud with x402", categories: ["ai", "compute"] },
|
|
21
|
+
{ name: "Handshake_58", url: "https://handshake58.com", description: "Streaming AI agent payment channels", categories: ["payments"] },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export const x402EcosystemAdapter: SourceAdapter = {
|
|
25
|
+
name: "x402-ecosystem",
|
|
26
|
+
displayName: "x402 Ecosystem",
|
|
27
|
+
|
|
28
|
+
async search(query: string, options?: SourceSearchOptions): Promise<UnifiedAgent[]> {
|
|
29
|
+
// Also try to fetch from x402.org ecosystem page
|
|
30
|
+
let dynamicServices: typeof KNOWN_X402_SERVICES = [];
|
|
31
|
+
try {
|
|
32
|
+
const res = await fetch("https://www.x402.org/ecosystem", {
|
|
33
|
+
signal: AbortSignal.timeout(options?.timeout ?? 5000),
|
|
34
|
+
});
|
|
35
|
+
if (res.ok) {
|
|
36
|
+
const html = await res.text();
|
|
37
|
+
// Extract any JSON data from the page
|
|
38
|
+
const jsonMatch = html.match(/\[{.*"name".*}\]/s);
|
|
39
|
+
if (jsonMatch) {
|
|
40
|
+
dynamicServices = JSON.parse(jsonMatch[0]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch {
|
|
44
|
+
// Fall back to seed list
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const allServices = [...KNOWN_X402_SERVICES, ...dynamicServices];
|
|
48
|
+
const lower = query.toLowerCase();
|
|
49
|
+
|
|
50
|
+
return allServices
|
|
51
|
+
.filter((s) => {
|
|
52
|
+
if (!query) return true;
|
|
53
|
+
return (
|
|
54
|
+
s.name.toLowerCase().includes(lower) ||
|
|
55
|
+
s.description.toLowerCase().includes(lower) ||
|
|
56
|
+
s.categories.some((c) => lower.includes(c))
|
|
57
|
+
);
|
|
58
|
+
})
|
|
59
|
+
.slice(0, options?.limit ?? 50)
|
|
60
|
+
.map(mapX402Service);
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
async ping(): Promise<boolean> {
|
|
64
|
+
return true; // Seed list always available
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
function mapX402Service(service: (typeof KNOWN_X402_SERVICES)[0]): UnifiedAgent {
|
|
69
|
+
return {
|
|
70
|
+
id: `x402-ecosystem:${service.name.toLowerCase().replace(/\s+/g, "-")}`,
|
|
71
|
+
nativeId: service.name,
|
|
72
|
+
name: service.name,
|
|
73
|
+
description: service.description,
|
|
74
|
+
categories: service.categories,
|
|
75
|
+
capabilities: [service.description],
|
|
76
|
+
source: "x402-ecosystem",
|
|
77
|
+
protocol: "x402",
|
|
78
|
+
endpoints: {
|
|
79
|
+
x402: service.url,
|
|
80
|
+
http: service.url,
|
|
81
|
+
},
|
|
82
|
+
pricing: { model: "per-call", currency: "USDC" },
|
|
83
|
+
verified: true,
|
|
84
|
+
raw: service,
|
|
85
|
+
};
|
|
86
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Address, WalletClient, PublicClient, Chain, Transport, Account } from "viem";
|
|
2
|
+
|
|
3
|
+
/** SDK configuration */
|
|
4
|
+
export interface KompassConfig {
|
|
5
|
+
/** viem PublicClient for read operations */
|
|
6
|
+
publicClient: PublicClient<Transport, Chain>;
|
|
7
|
+
/** viem WalletClient for write operations (optional for read-only usage) */
|
|
8
|
+
walletClient?: WalletClient<Transport, Chain, Account>;
|
|
9
|
+
/** KompassEscrow contract address */
|
|
10
|
+
escrowAddress: Address;
|
|
11
|
+
/** KompassRegistry contract address */
|
|
12
|
+
registryAddress: Address;
|
|
13
|
+
/** ERC-8004 Reputation Registry address */
|
|
14
|
+
reputationRegistryAddress: Address;
|
|
15
|
+
/** PipelineOrchestrator contract address */
|
|
16
|
+
pipelineAddress?: Address;
|
|
17
|
+
/** Default settlement token for pipeline creation */
|
|
18
|
+
paymentTokenAddress?: Address;
|
|
19
|
+
/** Default hook address for escrow jobs (e.g., ReputationUpdateHook) */
|
|
20
|
+
defaultHookAddress?: Address;
|
|
21
|
+
/** Indexer GraphQL endpoint (e.g., http://localhost:42069/graphql) */
|
|
22
|
+
indexerUrl: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Job status matching the contract enum */
|
|
26
|
+
export type JobStatus = "Open" | "Funded" | "Submitted" | "Completed" | "Rejected" | "Expired";
|
|
27
|
+
|
|
28
|
+
/** Milestone status matching the contract enum */
|
|
29
|
+
export type MilestoneStatus = "Pending" | "Submitted" | "Approved" | "Rejected";
|
|
30
|
+
|
|
31
|
+
/** Agent type from ENS text records */
|
|
32
|
+
export type AgentType = "provider" | "evaluator" | "both" | "unknown";
|
|
33
|
+
|
|
34
|
+
/** Payment mode for agent services */
|
|
35
|
+
export type PaymentMode = "escrow" | "x402" | "hybrid" | "unknown";
|
|
36
|
+
|
|
37
|
+
/** Agent profile from the indexer */
|
|
38
|
+
export interface AgentProfile {
|
|
39
|
+
id: Address;
|
|
40
|
+
ensNode: `0x${string}`;
|
|
41
|
+
ensName: string;
|
|
42
|
+
agentType: AgentType;
|
|
43
|
+
categories: string;
|
|
44
|
+
pricingModel: string;
|
|
45
|
+
pricingRate: string;
|
|
46
|
+
pricingToken: string;
|
|
47
|
+
erc8004Id: string;
|
|
48
|
+
identityVerification: string;
|
|
49
|
+
identityVerified: boolean;
|
|
50
|
+
paymentMode: PaymentMode;
|
|
51
|
+
endpointMcp: string;
|
|
52
|
+
endpointA2a: string;
|
|
53
|
+
endpointX402: string;
|
|
54
|
+
x402Enabled: boolean;
|
|
55
|
+
evaluatorDomains: string;
|
|
56
|
+
description: string;
|
|
57
|
+
registered: boolean;
|
|
58
|
+
registeredAt: bigint;
|
|
59
|
+
updatedAt: bigint;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Options for discovering agents */
|
|
63
|
+
export interface DiscoverOptions {
|
|
64
|
+
category?: string;
|
|
65
|
+
evaluatorDomain?: string;
|
|
66
|
+
maxPrice?: bigint;
|
|
67
|
+
minReputation?: number;
|
|
68
|
+
agentType?: AgentType;
|
|
69
|
+
paymentMode?: PaymentMode;
|
|
70
|
+
requiresX402?: boolean;
|
|
71
|
+
verifiedOnly?: boolean;
|
|
72
|
+
limit?: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Milestone configuration for job creation */
|
|
76
|
+
export interface MilestoneConfig {
|
|
77
|
+
budgetShareBps: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Options for creating a job */
|
|
81
|
+
export interface CreateJobOptions {
|
|
82
|
+
provider: Address;
|
|
83
|
+
evaluator: Address;
|
|
84
|
+
budget: bigint;
|
|
85
|
+
expiredAt: bigint;
|
|
86
|
+
description: string;
|
|
87
|
+
hook?: Address;
|
|
88
|
+
milestones?: MilestoneConfig[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** On-chain job data */
|
|
92
|
+
export interface Job {
|
|
93
|
+
client: Address;
|
|
94
|
+
provider: Address;
|
|
95
|
+
evaluator: Address;
|
|
96
|
+
hook: Address;
|
|
97
|
+
budget: bigint;
|
|
98
|
+
expiredAt: bigint;
|
|
99
|
+
status: JobStatus;
|
|
100
|
+
description: string;
|
|
101
|
+
deliverable: `0x${string}`;
|
|
102
|
+
milestoneCount: number;
|
|
103
|
+
currentMilestone: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Milestone data from contract */
|
|
107
|
+
export interface MilestoneData {
|
|
108
|
+
budgetShareBps: number;
|
|
109
|
+
deliverable: `0x${string}`;
|
|
110
|
+
status: MilestoneStatus;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Transaction result */
|
|
114
|
+
export interface TxResult {
|
|
115
|
+
txHash: `0x${string}`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Job creation result */
|
|
119
|
+
export interface CreateJobResult extends TxResult {
|
|
120
|
+
jobId: bigint;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** ERC-8004 reputation summary */
|
|
124
|
+
export interface ReputationSummary {
|
|
125
|
+
count: bigint;
|
|
126
|
+
summaryValue: bigint;
|
|
127
|
+
summaryValueDecimals: number;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Registration profile (fields to set as ENS text records) */
|
|
131
|
+
export interface RegisterProfile {
|
|
132
|
+
ensNode: `0x${string}`;
|
|
133
|
+
ensName?: string;
|
|
134
|
+
agentType?: AgentType;
|
|
135
|
+
categories?: string;
|
|
136
|
+
pricingModel?: string;
|
|
137
|
+
pricingRate?: string;
|
|
138
|
+
pricingToken?: string;
|
|
139
|
+
erc8004Id?: string;
|
|
140
|
+
identityVerification?: string;
|
|
141
|
+
paymentMode?: PaymentMode;
|
|
142
|
+
endpointMcp?: string;
|
|
143
|
+
endpointA2a?: string;
|
|
144
|
+
endpointX402?: string;
|
|
145
|
+
evaluatorDomains?: string;
|
|
146
|
+
description?: string;
|
|
147
|
+
}
|